[LTP] [PATCH] ht_affinity.c: fix ht_affinity test failure

Cyril Hrubis chrubis@suse.cz
Fri Sep 20 14:22:50 CEST 2024


Hi!
> From the kernel source code, the user_mask_ptr is unsigned long.
> 
> SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len,
> 		unsigned long __user *, user_mask_ptr)
> 
> so maybe we can keep the type of user_mask_ptr consistent with it.

It's actually accessed as an array. See get_user_cpu_mask() function just
above this syscall definition and userspace is suppose to pass an array
big enough for all the flags of CPUs it cares about.

There are also macros in the libc sched.h header that allows you to
allocate an array big enough for the current machine and manipulate the
bits, see man CPU_ALLOC.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list