Created attachment 18029 [details] tests: Handle unknown syscall call errno. Hi. With the 1.3.0 release the test_syscall_swrap.c self-test was added. It was not part of 1.2.9. It can fail like this: 1/1 Test #16: test_syscall_swrap ...............***Failed 0.00 sec [==========] Running 1 test(s). [ RUN ] test_uwrap_syscall_swrap [ ERROR ] --- 0x1 != 0x26 [ LINE ] --- /uid_wrapper-1.3.0/tests/test_syscall_swrap.c:37: error: Failure! [ FAILED ] test_uwrap_syscall_swrap [==========] 1 test(s) run. [ PASSED ] 0 test(s). [ FAILED ] 1 test(s), listed below: [ FAILED ] test_uwrap_syscall_swrap Chaising this down was fun, and boils down to unknown syscalls resulting in different errno values in virtualized environments vs non-virtualized. You can test it like this: jas@kaka:~$ cat>foo.c #include <stdio.h> #include <unistd.h> #include <sys/syscall.h> #include <signal.h> #include <errno.h> void main (void) { long rc; signal(SIGSYS, SIG_IGN); rc = syscall(123456789); signal(SIGSYS, SIG_DFL); printf ("rc %ld errno %d (EPERM %d ENOSYS %d)\n", rc, errno, EPERM, ENOSYS); } jas@kaka:~$ gcc foo.c jas@kaka:~$ ./a.out rc -1 errno 38 (EPERM 1 ENOSYS 38) jas@kaka:~$ If you run this in a VM it will output this instead: rc -1 errno 1 (EPERM 1 ENOSYS 38) Is the errno returned for unknown syscalls even documented anywhere? I'm attaching a patch that we will use in Debian to work around this problem. What do you think? /Simon
Created attachment 18030 [details] tests: Fix unknown syscall check in test_syscall_swrap.
Hi again Unfortunately, I found another virtualization environment (LXC) that seems to behave different compare to podman/QEMU, resulting in this error: [ ERROR ] --- 0xffffffffffffffff != 0x3ade68b1 It doesn't seem like checking errno for unknown syscalls is realiable. Attaching the new patch that simply drops the errno assert. /Simon
Sorry for adding noise here, but I spoke to soon. This new error: [ RUN ] test_uwrap_syscall_swrap [ ERROR ] --- 0xffffffffffffffff != 0x3ade68b1 [ LINE ] --- /tmp/autopkgtest-lxc.jbxvqbhs/downtmp/autopkgtest_tmp/tests/test_syscall_swrap.c:31: error: Failure! Is different from the original one, and may be due to some other problem in that particular environment. I'll debug more, but I'm leaning towards the first patch still being okay. /Simon
I have confirmed the second error message was a build environment bug. Thus I think the first patch should be used: https://bugzilla.samba.org/attachment.cgi?id=18029 The patch passes the initial Debian Salsa pipeline autopkgtest, and I will upload it to see if it passes debci checks. /Simon