Re: [syzbot] Re: [syzbot] [tomoyo?] WARNING in tomoyo_write_control

From: syzbot
Date: Mon Dec 16 2024 - 02:22:52 EST


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

***

Subject: Re: [syzbot] [tomoyo?] WARNING in tomoyo_write_control
Author: lizhi.xu@xxxxxxxxxxxxx

User input a too large avail length 0xfffffdeful.

#syz test

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c7b059a332a..65458b4059ab 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -2654,6 +2654,8 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,

if (!head->write)
return -EINVAL;
+ if (avail_len << PAGE_SHIFT > MAX_PAGE_ORDER)
+ return -EINVAL;
if (mutex_lock_interruptible(&head->io_sem))
return -EINTR;
cp0 = head->write_buf;