* [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach
@ 2025-07-07 16:32 syzbot
2025-07-08 12:17 ` Edward Adam Davis
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: syzbot @ 2025-07-07 16:32 UTC (permalink / raw)
To: abbotti, hsweeten, linux-kernel, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: a79a588fc176 Merge tag 'pm-6.16-rc5' of git://git.kernel.o..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14a4ac8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=5ba6cef8f153bfeb
dashboard link: https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12a4ac8c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13fc9c8c580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-a79a588f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c7aa4e6d68b0/vmlinux-a79a588f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5d71f2c64f29/bzImage-a79a588f.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
UBSAN: shift-out-of-bounds in drivers/comedi/drivers/aio_iiro_16.c:180:9
shift exponent 8550 is too large for 32-bit type 'int'
CPU: 2 UID: 0 PID: 6096 Comm: syz.0.16 Not tainted 6.16.0-rc4-syzkaller-00308-ga79a588fc176 #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120
ubsan_epilogue lib/ubsan.c:233 [inline]
__ubsan_handle_shift_out_of_bounds+0x27f/0x420 lib/ubsan.c:494
aio_iiro_16_attach drivers/comedi/drivers/aio_iiro_16.c:180 [inline]
aio_iiro_16_attach.cold+0x19/0x1e drivers/comedi/drivers/aio_iiro_16.c:164
comedi_device_attach+0x3b3/0x900 drivers/comedi/drivers.c:996
do_devconfig_ioctl+0x1a7/0x580 drivers/comedi/comedi_fops.c:855
comedi_unlocked_ioctl+0x15bb/0x2e90 drivers/comedi/comedi_fops.c:2136
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl fs/ioctl.c:893 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f3eb858e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc84ea1e58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f3eb87b5fa0 RCX: 00007f3eb858e929
RDX: 0000200000000140 RSI: 0000000040946400 RDI: 0000000000000003
RBP: 00007f3eb8610b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f3eb87b5fa0 R14: 00007f3eb87b5fa0 R15: 0000000000000003
</TASK>
---[ end trace ]---
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach
2025-07-07 16:32 [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
@ 2025-07-08 12:17 ` Edward Adam Davis
2025-07-08 12:37 ` syzbot
2025-07-08 12:37 ` [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number Edward Adam Davis
2025-09-28 0:36 ` Forwarded: Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-07-08 12:17 UTC (permalink / raw)
To: syzbot+f1bb7e4ea47ea12b535c; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/drivers/comedi/drivers/aio_iiro_16.c b/drivers/comedi/drivers/aio_iiro_16.c
index b00fab0b89d4..e43730f00c8b 100644
--- a/drivers/comedi/drivers/aio_iiro_16.c
+++ b/drivers/comedi/drivers/aio_iiro_16.c
@@ -177,7 +177,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
* Digital input change of state interrupts are optionally supported
* using IRQ 2-7, 10-12, 14, or 15.
*/
- if ((1 << it->options[1]) & 0xdcfc) {
+ if (it->options[1] > 1 && it->options[1] < 16 &&
+ (1 << it->options[1]) & 0xdcfc) {
ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
dev->board_name, dev);
if (ret == 0)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach
2025-07-08 12:17 ` Edward Adam Davis
@ 2025-07-08 12:37 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-07-08 12:37 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
Tested-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
Tested on:
commit: d7b8f8e2 Linux 6.16-rc5
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=121eabd4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=a09d8660a55f005f
dashboard link: https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=12734a8c580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number
2025-07-07 16:32 [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
2025-07-08 12:17 ` Edward Adam Davis
@ 2025-07-08 12:37 ` Edward Adam Davis
2025-07-08 13:18 ` Ian Abbott
2025-09-28 0:36 ` Forwarded: Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2025-07-08 12:37 UTC (permalink / raw)
To: syzbot+f1bb7e4ea47ea12b535c
Cc: abbotti, hsweeten, linux-kernel, syzkaller-bugs
The irq number 0x2166 passed by the reproducer is too large and is not
within the supported range [2-7, 10-12, 14, or 15], which triggers the oob.
Fixes: ad7a370c8be4 ("staging: comedi: aio_iiro_16: add command support for change of state detection")
Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
drivers/comedi/drivers/aio_iiro_16.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/comedi/drivers/aio_iiro_16.c b/drivers/comedi/drivers/aio_iiro_16.c
index b00fab0b89d4..e43730f00c8b 100644
--- a/drivers/comedi/drivers/aio_iiro_16.c
+++ b/drivers/comedi/drivers/aio_iiro_16.c
@@ -177,7 +177,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
* Digital input change of state interrupts are optionally supported
* using IRQ 2-7, 10-12, 14, or 15.
*/
- if ((1 << it->options[1]) & 0xdcfc) {
+ if (it->options[1] > 1 && it->options[1] < 16 &&
+ (1 << it->options[1]) & 0xdcfc) {
ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
dev->board_name, dev);
if (ret == 0)
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number
2025-07-08 12:37 ` [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number Edward Adam Davis
@ 2025-07-08 13:18 ` Ian Abbott
2025-09-28 19:08 ` Abhinav Saxena
0 siblings, 1 reply; 7+ messages in thread
From: Ian Abbott @ 2025-07-08 13:18 UTC (permalink / raw)
To: Edward Adam Davis, syzbot+f1bb7e4ea47ea12b535c
Cc: hsweeten, linux-kernel, syzkaller-bugs
On 08/07/2025 13:37, Edward Adam Davis wrote:
> The irq number 0x2166 passed by the reproducer is too large and is not
> within the supported range [2-7, 10-12, 14, or 15], which triggers the oob.
>
> Fixes: ad7a370c8be4 ("staging: comedi: aio_iiro_16: add command support for change of state detection")
> Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> drivers/comedi/drivers/aio_iiro_16.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/comedi/drivers/aio_iiro_16.c b/drivers/comedi/drivers/aio_iiro_16.c
> index b00fab0b89d4..e43730f00c8b 100644
> --- a/drivers/comedi/drivers/aio_iiro_16.c
> +++ b/drivers/comedi/drivers/aio_iiro_16.c
> @@ -177,7 +177,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
> * Digital input change of state interrupts are optionally supported
> * using IRQ 2-7, 10-12, 14, or 15.
> */
> - if ((1 << it->options[1]) & 0xdcfc) {
> + if (it->options[1] > 1 && it->options[1] < 16 &&
> + (1 << it->options[1]) & 0xdcfc) {
> ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
> dev->board_name, dev);
> if (ret == 0)
The patch is fine apart from the misspelling of "invalid" in the subject
line, but I'd already submitted a patch for this before syzbot detected it:
https://lore.kernel.org/lkml/20250707134622.75403-1-abbotti@mev.co.uk/
--
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
^ permalink raw reply [flat|nested] 7+ messages in thread
* Forwarded: Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach
2025-07-07 16:32 [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
2025-07-08 12:17 ` Edward Adam Davis
2025-07-08 12:37 ` [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number Edward Adam Davis
@ 2025-09-28 0:36 ` syzbot
2 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2025-09-28 0:36 UTC (permalink / raw)
To: linux-kernel, syzkaller-bugs
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach
Author: xandfury@gmail.com
syzbot <syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com> writes:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: a79a588fc176 Merge tag ’pm-6.16-rc5’ of git://git.kernel.o..
> git tree: upstream
> console output: <https://syzkaller.appspot.com/x/log.txt?x=14a4ac8c580000>
> kernel config: <https://syzkaller.appspot.com/x/.config?x=5ba6cef8f153bfeb>
> dashboard link: <https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c>
> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: <https://syzkaller.appspot.com/x/repro.syz?x=12a4ac8c580000>
> C reproducer: <https://syzkaller.appspot.com/x/repro.c?x=13fc9c8c580000>
>
> Downloadable assets:
> disk image (non-bootable): <https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-a79a588f.raw.xz>
> vmlinux: <https://storage.googleapis.com/syzbot-assets/c7aa4e6d68b0/vmlinux-a79a588f.xz>
> kernel image: <https://storage.googleapis.com/syzbot-assets/5d71f2c64f29/bzImage-a79a588f.xz>
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
>
> UBSAN: shift-out-of-bounds in drivers/comedi/drivers/aio_iiro_16.c:180:9
> shift exponent 8550 is too large for 32-bit type ’int’
> CPU: 2 UID: 0 PID: 6096 Comm: syz.0.16 Not tainted 6.16.0-rc4-syzkaller-00308-ga79a588fc176 #0 PREEMPT(full)
> Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
> Call Trace:
> <TASK>
> __dump_stack lib/dump_stack.c:94 [inline]
> dump_stack_lvl+0x16c/0x1f0 lib/dump_stack.c:120
> ubsan_epilogue lib/ubsan.c:233 [inline]
> __ubsan_handle_shift_out_of_bounds+0x27f/0x420 lib/ubsan.c:494
> aio_iiro_16_attach drivers/comedi/drivers/aio_iiro_16.c:180 [inline]
> aio_iiro_16_attach.cold+0x19/0x1e drivers/comedi/drivers/aio_iiro_16.c:164
> comedi_device_attach+0x3b3/0x900 drivers/comedi/drivers.c:996
> do_devconfig_ioctl+0x1a7/0x580 drivers/comedi/comedi_fops.c:855
> comedi_unlocked_ioctl+0x15bb/0x2e90 drivers/comedi/comedi_fops.c:2136
> vfs_ioctl fs/ioctl.c:51 [inline]
> __do_sys_ioctl fs/ioctl.c:907 [inline]
> __se_sys_ioctl fs/ioctl.c:893 [inline]
> __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:893
> do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
> do_syscall_64+0xcd/0x4c0 arch/x86/entry/syscall_64.c:94
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f3eb858e929
> Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89
> f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01
> f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007ffc84ea1e58 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 00007f3eb87b5fa0 RCX: 00007f3eb858e929
> RDX: 0000200000000140 RSI: 0000000040946400 RDI: 0000000000000003
> RBP: 00007f3eb8610b39 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 00007f3eb87b5fa0 R14: 00007f3eb87b5fa0 R15: 0000000000000003
> </TASK>
> —[ end trace ]—
>
>
> —
> This report is generated by a bot. It may contain errors.
> See <https://goo.gl/tpsmEJ> for more information about syzbot.
> syzbot engineers can be reached at syzkaller@googlegroups.com.
>
> syzbot will keep track of this issue. See:
> <https://goo.gl/tpsmEJ#status> for how to communicate with syzbot.
>
> If the report is already addressed, let syzbot know by replying with:
> #syz fix: exact-commit-title
>
> If you want syzbot to run the reproducer, reply with:
> #syz test: git://repo/address.git branch-or-commit-hash
> If you attach or paste a git patch, syzbot will apply it before testing.
>
> If you want to overwrite report’s subsystems, reply with:
> #syz set subsystems: new-subsystem
> (See the list of subsystem names on the web dashboard)
>
> If the report is a duplicate of another one, reply with:
> #syz dup: exact-subject-of-another-report
>
> If you want to undo deduplication, reply with:
> #syz undup
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 66acb1586737
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number
2025-07-08 13:18 ` Ian Abbott
@ 2025-09-28 19:08 ` Abhinav Saxena
0 siblings, 0 replies; 7+ messages in thread
From: Abhinav Saxena @ 2025-09-28 19:08 UTC (permalink / raw)
To: Ian Abbott
Cc: Edward Adam Davis, syzbot+f1bb7e4ea47ea12b535c, hsweeten,
linux-kernel, syzkaller-bugs, linux-hardening
[-- Attachment #1: Type: text/plain, Size: 1691 bytes --]
Ian Abbott <abbotti@mev.co.uk> writes:
> On 08/07/2025 13:37, Edward Adam Davis wrote:
>> The irq number 0x2166 passed by the reproducer is too large and is not
>> within the supported range [2-7, 10-12, 14, or 15], which triggers the oob.
>> Fixes: ad7a370c8be4 (“staging: comedi: aio_iiro_16: add command
>> support for change of state detection”)
>> Reported-by: syzbot+f1bb7e4ea47ea12b535c@syzkaller.appspotmail.com
>> Closes: <https://syzkaller.appspot.com/bug?extid=f1bb7e4ea47ea12b535c>
>> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
>> —
>> drivers/comedi/drivers/aio_iiro_16.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> diff –git a/drivers/comedi/drivers/aio_iiro_16.c
>> b/drivers/comedi/drivers/aio_iiro_16.c
>> index b00fab0b89d4..e43730f00c8b 100644
>> — a/drivers/comedi/drivers/aio_iiro_16.c
>> +++ b/drivers/comedi/drivers/aio_iiro_16.c
>> @@ -177,7 +177,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
>> * Digital input change of state interrupts are optionally supported
>> * using IRQ 2-7, 10-12, 14, or 15.
>> */
>> - if ((1 << it->options[1]) & 0xdcfc) {
>> + if (it->options[1] > 1 && it->options[1] < 16 &&
>> + (1 << it->options[1]) & 0xdcfc) {
>> ret = request_irq(it->options[1], aio_iiro_16_cos, 0,
>> dev->board_name, dev);
>> if (ret == 0)
>
> The patch is fine apart from the misspelling of “invalid” in the subject
> line, but I’d already submitted a patch for this before syzbot detected
> it:
>
> <https://lore.kernel.org/lkml/20250707134622.75403-1-abbotti@mev.co.uk/>
#syz fix: comedi: aio_iiro_16: Fix bit shift out of bounds
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-28 19:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-07 16:32 [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
2025-07-08 12:17 ` Edward Adam Davis
2025-07-08 12:37 ` syzbot
2025-07-08 12:37 ` [PATCH] comedi: aio_iiro_16: Prevent invlaid irq number Edward Adam Davis
2025-07-08 13:18 ` Ian Abbott
2025-09-28 19:08 ` Abhinav Saxena
2025-09-28 0:36 ` Forwarded: Re: [syzbot] [kernel?] UBSAN: shift-out-of-bounds in aio_iiro_16_attach syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox