Bug #6847
syscall header declaration incorrect
Start date:
2016-03-30
Due date:
% Done:
100%
Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
Description
Running gcl on 64-bit lx results in a seg fault (and a large core dump). Looking at the truss output for gcl is tell-tale:
... brk(0) = 0x10a4000 brk(0x8000000000d0c000) = 0x10a4000 brk(0x4000000000d0c000) = 0x10a4000 brk(0x2000000000d0c000) = 0x10a4000 brk(0x1000000000d0c000) = 0x10a4000 brk(0x800000000d0c000) = 0x10a4000 brk(0x400000000d0c000) = 0x10a4000 brk(0x200000000d0c000) = 0x10a4000 brk(0x100000000d0c000) = 0x10a4000 brk(0x80000000d0c000) = 0x10a4000 brk(0x40000000d0c000) = 0x10a4000 brk(0x20000000d0c000) = 0x10a4000 brk(0x10000000d0c000) = 0x10a4000 brk(0x8000000d0c000) = 0x10a4000 brk(0x4000000d0c000) = 0x10a4000 brk(0x2000000d0c000) = 0x10a4000 brk(0x1000000d0c000) = 0x10a4000 brk(0x800000d0c000) = 0x10a4000 brk(0x400000d0c000) = 0x10a4000 brk(0x200000d0c000) = 0x10a4000 brk(0x100000d0c000) = 0x10a4000 brk(0x80000d0c000) = 0x10a4000 brk(0x40000d0c000) = 0x10a4000 brk(0x20000d0c000) = 0x10a4000 brk(0x10000d0c000) = 0x10a4000 brk(0x8000d0c000) = 0x10a4000 brk(0x4000d0c000) = 0x10a4000 brk(0x2000d0c000) = 0x10a4000 brk(0x1000d0c000) = 0x10a4000 brk(0x800d0c000) = 0x10a4000 brk(0x400d0c000) = 0x10a4000 brk(0x200d0c000) = 0x10a4000 brk(0x100d0c000) = 0x10a4000 brk(0x80d0c000) = 0xffffffff80d0c000 brk(0x7fffffff80d0c001) = 0xffffffff80d0c000 brk(0x7fffffff80d0c001) = 0xffffffff80d0c000 brk(0x7fffffff80d0c001) = 0xffffffff80d0c000 brk(0x7fffffff80d0c001) = 0xffffffff80d0c000 brk(0x7fffffff80d0c001) = 0xffffffff80d0c000 ...
Leaving aside whatever crazy thing the interpreter is doing with respect
to setting the break, the `brk(0x80d0c000)` is clearly returning the
wrong thing: it should be returning 0x80d0c000, but it's getting
side-extended into madness. Further investigation reveals that the reason
is simple: syscall() is defined to return an int – which is clearly
wrong for 64-bit. Changing this definition to return a long results
in the correct behavior.
Updated by Robert Mustacchi almost 5 years ago
- Subject changed from syscall header decleration incorrect to syscall header declaration incorrect
Updated by Electric Monk almost 5 years ago
- Status changed from New to Closed
git commit c22cda1b41022b307ea9fda8c9dc19e6329a109a
commit c22cda1b41022b307ea9fda8c9dc19e6329a109a Author: Bryan Cantrill <bryan@joyent.com> Date: 2016-04-29T21:39:48.000Z 6847 syscall header declaration incorrect Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com> Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@omniti.com>