Bug 15448 - uid-wrapper: test_syscall_swrap unknown syscall failure on armel/armhf
Summary: uid-wrapper: test_syscall_swrap unknown syscall failure on armel/armhf
Status: NEW
Alias: None
Product: cwrap
Classification: Unclassified
Component: library (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-05 18:27 UTC by Simon Josefsson
Modified: 2023-08-05 18:27 UTC (History)
0 users

See Also:


Attachments
tests: Drop unknown syscall in test_syscall_swrap. (901 bytes, patch)
2023-08-05 18:27 UTC, Simon Josefsson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Josefsson 2023-08-05 18:27:45 UTC
Created attachment 18032 [details]
tests: Drop unknown syscall in test_syscall_swrap.

Hi

This uid-wrapper self test calls unknown syscall which has errno-related issues (see #15445) but I noticed a more critical failures like this:

19: Test command: /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/tests/test_syscall_setresuid
19: Working Directory: /<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/tests
19: Environment variables: 
19:  LD_PRELOAD=/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/tests/libuwrap_fake_socket_wrapper.so:/<<PKGBUILDDIR>>/obj-arm-linux-gnueabihf/src/libuid_wrapper.so
19:  UID_WRAPPER=1
19:  UID_WRAPPER_ROOT=1
19: Test timeout computed to be: 1500
16: [==========] 1 test(s) run.
16: [  PASSED  ] 0 test(s).
16: [  FAILED  ] 1 test(s), listed below:
16: [  FAILED  ] test_uwrap_syscall_swrap
16: 
16:  1 FAILED TEST(S)
16/33 Test #16: test_syscall_swrap ...............***Failed    0.02 sec
[==========] Running 1 test(s).
[ RUN      ] test_uwrap_syscall_swrap
[  ERROR   ] --- Test failed with exception: Illegal instruction(4)
[  FAILED  ] test_uwrap_syscall_swrap
[==========] 1 test(s) run.
[  PASSED  ] 0 test(s).
[  FAILED  ] 1 test(s), listed below:
[  FAILED  ] test_uwrap_syscall_swrap

I thought that the code could ignore SIGILL too, but it doesn't seem possible to catch this signal, or am I doing something wrong?

(sid_armhf-dchroot)jas@abel:~/uid-wrapper-1.3.0/obj-arm-linux-gnueabihf$ 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(SIGILL, SIG_IGN);
	rc = syscall(123456789);
	signal(SIGILL, SIG_DFL);
	printf ("rc %ld errno %d (EPERM %d ENOSYS %d)\n",
		rc, errno, EPERM, ENOSYS);
}
(sid_armhf-dchroot)jas@abel:~/uid-wrapper-1.3.0/obj-arm-linux-gnueabihf$ gcc foo.c
(sid_armhf-dchroot)jas@abel:~/uid-wrapper-1.3.0/obj-arm-linux-gnueabihf$ ./a.out 
Illegal instruction
(sid_armhf-dchroot)jas@abel:~/uid-wrapper-1.3.0/obj-arm-linux-gnueabihf$ 

Reading the code, I don't think the unknown syscall is the important part of this self-test, and seems to just cause problems.  It does not check any expected behaviour of uid-wrapper itself.  So how about simply dropping this part of the self-test altogether?

See proposed patch that does exactly that.  This will resolve #15445 too, but that is a separate problem so I'm opening separate bugs in case you prefer different resolution to these.

/Simon