Don't call cpumask_subset(new_mask, cpu_allowed_mask) if new_mask is cpu_allowed_mask. Caught with CONFIG_DEBUG_BITMAP: [ 0.132174] Call trace: [ 0.132189] __bitmap_check_params+0x144/0x250 [ 0.132216] __set_cpus_allowed_ptr_locked+0x8c/0x2c0 [ 0.132241] sched_init_smp+0x80/0xd8 [ 0.132273] kernel_init_freeable+0x12c/0x28c [ 0.132299] kernel_init+0x28/0x13c [ 0.132325] ret_from_fork+0x10/0x20 [ 0.132354] ---[ end trace 0000000000000000 ]--- [ 0.132378] b1: ffffcd0c07819a58 [ 0.132388] b2: ffffcd0c07819a58 [ 0.132397] b3: 0 [ 0.132405] nbits: 256 [ 0.132414] start: 0 [ 0.132422] off: 0 [ 0.132444] Bitmap: parameters check failed [ 0.132467] include/linux/bitmap.h [468]: bitmap_subset Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx> --- kernel/sched/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index da0bf6fe9ecd..d6424336ef2d 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2874,7 +2874,8 @@ static int __set_cpus_allowed_ptr_locked(struct task_struct *p, cpu_valid_mask = cpu_online_mask; } - if (!kthread && !cpumask_subset(new_mask, cpu_allowed_mask)) { + if (!kthread && new_mask != cpu_allowed_mask && + !cpumask_subset(new_mask, cpu_allowed_mask)) { ret = -EINVAL; goto out; } -- 2.34.1