sched_xetaffinity test broken on compat

Dmitry V. Levin ldv at strace.io
Tue Aug 29 10:33:10 UTC 2023


On Mon, Jul 31, 2023 at 09:39:51AM +0200, Sven Schnelle wrote:
> 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?

I agree it would be nice to have it fixed, but I'm not quite familiar with
the subject so I'm not sure what would be the proper fix.


-- 
ldv


More information about the Strace-devel mailing list