Page MenuHomeFreeBSD

Fix crash on unknown syscall after r288832.
Needs ReviewPublic

Authored by bdrewery on Aug 17 2016, 12:41 PM.

Details

Reviewers
kib
jhb
Summary

Give the syscall a pseudo name based on its ABI. For example
a FreeBSD 64 #550 would become FreeBSD_ELF64_550.

Reported by: kib
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

Test Plan
$ trap '' SIGSYS
$ truss -c perl -e "my \$s = 'test'; syscall(550, \$s, 5, 3);"
-- UNKNOWN FreeBSD ELF64 SYSCALL 550 --
syscall                     seconds   calls  errors
FreeBSD_ELF64_550       0.000018799       1       1
fcntl                   0.000015711       1       0
ioctl                   0.000072305       4       1
stat                    0.000386441       6       6
getegid                 0.000052918       3       0
getgid                  0.000046609       3       0
geteuid                 0.000043334       3       0
getuid                  0.000051584       3       0
getcontext              0.000018582       1       0
getpid                  0.000029452       2       0
mprotect                0.000015605       1       0
_umtx_op                0.000019638       1       0
sigaction               0.000558552      34       0
rtprio_thread           0.000016274       1       0
thr_self                0.000020997       1       0
getrlimit               0.000018112       1       0
readlink                0.000035727       1       1
sigprocmask             0.001321707      79       0
sysarch                 0.000040931       2       0
lseek                   0.000096822       5       0
read                    0.000349454       7       0
access                  0.000595265      11       5
getdirentries           0.000161990       2       0
munmap                  0.000357362      14       0
fstatfs                 0.000026216       1       0
open                    0.000403822       6       0
close                   0.000373990      16       0
fstat                   0.000340292      14       0
openat                  0.000453338      10       0
lstat                   0.000271650       6       0
__sysctl                0.000351024      14       0
issetugid               0.000031275       2       0
mmap                    0.001244797      39       0
                      ------------- ------- -------
                        0.007840575     295      14
$ truss perl -e "my \$s = 'test'; syscall(550, \$s, 5, 3);"
...
-- UNKNOWN FreeBSD ELF64 SYSCALL 550 --
FreeBSD_ELF64_550()                              ERR#78 'Function not implemented'
...

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 4838
Build 4901: arc lint + arc unit

Event Timeline

bdrewery retitled this revision from to Fix crash on unknown syscall after r288832..
bdrewery updated this object.
bdrewery edited the test plan for this revision. (Show Details)
bdrewery added reviewers: jhb, kib.

Note that it doesn't show the *arguments* properly. I'm not quite sure why. If I assign narg = 10 it just shows:

FreeBSD_ELF64_550(0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0) ERR#78 'Function not implemented'
usr.bin/truss/setup.c
386

Should cs.name be freed or not ? It is actually not clear to me.

388

A temp local var of type char * could be used to get asprintf() result, mangled to replace spaces, and then assigned to cs.name without DECONST.