lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241216022732.2399635-1-lizhi.xu@windriver.com>
Date: Mon, 16 Dec 2024 10:27:32 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+0aecfd34fb878546f3fd@...kaller.appspotmail.com>
CC: <linux-kernel@...r.kernel.org>, <linux-trace-kernel@...r.kernel.org>,
        <mathieu.desnoyers@...icios.com>, <mhiramat@...nel.org>,
        <rostedt@...dmis.org>, <syzkaller-bugs@...glegroups.com>
Subject: [PATCH] tracing: Prevent bad count for tracing_cpumask_write

If a large count is provided, it will triger a warning in bitmap_parse_user.
Also check zero for it.

Reported-by: syzbot+0aecfd34fb878546f3fd@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0aecfd34fb878546f3fd
Tested-by: syzbot+0aecfd34fb878546f3fd@...kaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@...driver.com>
---
 kernel/trace/trace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index be62f0ea1814..109f301549b8 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5225,6 +5225,9 @@ tracing_cpumask_write(struct file *filp, const char __user *ubuf,
 	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;
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ