Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 07 Jun 2014 13:32:56 +0000
From:      bz-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 190751] New: [PATCH] devel/lua-alien: mark as SSP_UNSAFE
Message-ID:  <bug-190751-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=190751

            Bug ID: 190751
           Summary: [PATCH] devel/lua-alien: mark as SSP_UNSAFE
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: Needs Triage
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: sjyj+wok@sharklasers.com

Created attachment 143489
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=143489&action=edit
fix

Lua interpreter aborts with exit code 1 shortly after the first
foreign function if using alien built with Clang.

The following snippet successfully calls sleep(3) but aborts shortly after:

  require 'alien'

  local libc = alien.default
  libc.sleep:types('int', 'int')

  print "foo"
  libc.sleep(3)
  print "bar"

With clang -O0 a crash can be seen instead:

  (gdb) r
  Starting program: /usr/local/bin/lua52 test.lua
  [New LWP 101132]
  [New Thread 801c06400 (LWP 101132)]
  foo

  Program received signal SIGSEGV, Segmentation fault.
  [Switching to Thread 801c06400 (LWP 101132)]
  0x0000000000407421 in lua_pushnumber (L=0x800000000, n=0) at lapi.c:475
  475       setnvalue(L->top, n);
  (gdb) bt
  #0  0x0000000000407421 in lua_pushnumber (L=0x800000000, n=0) at lapi.c:475
  #1  0x00000008014e84aa in ?? () from /usr/local/lib/lua/5.2/alien_c.so
  #2  0x000000000040bf66 in luaD_precall (L=0x801c17300, func=0x801c8d570,
nresults=0) at ldo.c:319
  #3  0x000000000040c1d0 in luaD_precall (L=0x801c17300, func=0x801c8d570,
nresults=0) at ldo.c:356
  #4  0x000000000041f64f in luaV_execute (L=0x801c17300) at lvm.c:709
  #5  0x000000000040c779 in luaD_call (L=0x801c17300, func=0x801c200d0,
nResults=-1, allowyield=0) at ldo.c:402
  #6  0x0000000000408bd4 in f_call (L=0x801c17300, ud=0x7fffffffe080) at
lapi.c:923
  #7  0x000000000040b78f in luaD_rawrunprotected (L=0x801c17300, f=0x408ba0
<f_call>, ud=0x7fffffffe080) at ldo.c:131
  #8  0x000000000040cf19 in luaD_pcall (L=0x801c17300, func=0x408ba0 <f_call>,
u=0x7fffffffe080, old_top=80, ef=64) at ldo.c:603
  #9  0x0000000000408a90 in lua_pcallk (L=0x801c17300, nargs=0, nresults=-1,
errfunc=3, ctx=0, k=0x0) at lapi.c:949
  #10 0x0000000000405694 in docall (L=0x801c17300, narg=0, nres=-1) at
lua.c:179
  #11 0x00000000004053b5 in handle_script (L=0x801c17300, argv=0x7fffffffe4a0,
n=1) at lua.c:337
  #12 0x0000000000404a9c in pmain (L=0x801c17300) at lua.c:465
  #13 0x000000000040bf66 in luaD_precall (L=0x801c17300, func=0x801c20090,
nresults=1) at ldo.c:319
  #14 0x000000000040c765 in luaD_call (L=0x801c17300, func=0x801c20090,
nResults=1, allowyield=0) at ldo.c:401
  #15 0x0000000000408bd4 in f_call (L=0x801c17300, ud=0x7fffffffe3d0) at
lapi.c:923
  #16 0x000000000040b78f in luaD_rawrunprotected (L=0x801c17300, f=0x408ba0
<f_call>, ud=0x7fffffffe3d0) at ldo.c:131
  #17 0x000000000040cf19 in luaD_pcall (L=0x801c17300, func=0x408ba0 <f_call>,
u=0x7fffffffe3d0, old_top=16, ef=0) at ldo.c:603
  #18 0x0000000000408a90 in lua_pcallk (L=0x801c17300, nargs=2, nresults=1,
errfunc=0, ctx=0, k=0x0) at lapi.c:949
  #19 0x00000000004047a2 in main (argc=2, argv=0x7fffffffe4a0) at lua.c:491

The workaround is to build with GCC, otherwise use the attached patch.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-190751-13>