Re: [syzbot] Re: [syzbot] [trace?] WARNING in bitmap_parse_user

From: syzbot
Date: Sun Dec 15 2024 - 20:56:43 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] [trace?] WARNING in bitmap_parse_user
Author: lizhi.xu@xxxxxxxxxxxxx

User input a too large count 0x40fdef, it will triger a warning in bitmap_parse_user.

#syz test

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index be62f0ea1814..9e989d97bb78 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5224,6 +5224,8 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
struct trace_array *tr = file_inode(filp)->i_private;
cpumask_var_t tracing_cpumask_new;
int err;
+ if (count == 0 || count << PAGE_SHIFT > MAX_PAGE_ORDER)
+ return -EINVAL;

if (!zalloc_cpumask_var(&tracing_cpumask_new, GFP_KERNEL))
return -ENOMEM;