sched_xetaffinity test broken on compat

Sven Schnelle svens at linux.ibm.com
Mon Jul 31 07:39:51 UTC 2023


Hi List,

17c0945526ba ("tests/sched_xetaffinity: add a check for a
non-properly-sized CPU set") seems to be broken on compat.
I see the following both on s390 and x86:

64 bit:

$ ./sched_xetaffinity
sched_getaffinity(167052, 1, NULL) = -1 EINVAL (Invalid argument)
sched_getaffinity(167052, 2, NULL) = -1 EINVAL (Invalid argument)
sched_getaffinity(167052, 4, NULL) = -1 EINVAL (Invalid argument)
sched_getaffinity(167052, 8, NULL) = -1 EFAULT (Bad address)
sched_getaffinity(167052, 8, 0x7f5ad2b4a078) = -1 EFAULT (Bad address)
sched_getaffinity(167052, 8, [0 1 2 3 4 5 6 7 8 9 10 11]) = 8
sched_setaffinity(167052, 0, []) = -1 EINVAL (Invalid argument)
sched_setaffinity(167052, 1, 0x7f5ad2b4a000) = -1 EFAULT (Bad address)
sched_setaffinity(167052, 7, [8]) = 0
sched_setaffinity(167052, 8, [11]) = 0
sched_getaffinity(167052, 128, [11]) = 8
+++ exited with 0 +++

Which looks ok, but on compat:

$ ./sched_xetaffinity
sched_getaffinity(166994, 1, NULL) = -1 EINVAL (Invalid argument)
sched_getaffinity(166994, 2, NULL) = -1 EINVAL (Invalid argument)
sched_getaffinity(166994, 4, NULL) = -1 EFAULT (Bad address)
sched_getaffinity(166994, 4, 0xf7ee907c) = -1 EFAULT (Bad address)
sched_getaffinity(166994, 4, [0 1 2 3 4 5 6 7 8 9 10 11]) = 4
sched_setaffinity(166994, 0, []) = -1 EINVAL (Invalid argument)
sched_setaffinity(166994, 1, 0xf7ee9000) = -1 EFAULT (Bad address)
sched_setaffinity(): Bad address

I think this is because the test does:

                if (setaffinity(pid, 7, cpuset))
                       perror_msg_and_skip("sched_setaffinity()");

which works on 64 bit, but not with 32 bit. Instead of returning skip(77)
i think the test should either be fixed, or this part should be skipped
on compat. Any thoughts?

Thanks
Sven


More information about the Strace-devel mailing list