UBSAN: shift-out-of-bounds in vcc_connect
Subsystems (4)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: bd5f485f3f02 Merge tag 'soc-arm-7.3' of git://git.kernel.o.. git tree: upstream console+strace: https://syzkaller.appspot.com/x/log.txt?x=16736e79580000 kernel config: https://syzkaller.appspot.com/x/.config?x=6d6c2a05eaadaf10 dashboard link: https://syzkaller.appspot.com/bug?extid=6665d3db5fef15914802 compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=133f2549580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2da33ef8d789/disk-bd5f485f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7e8921e0c1e1/vmlinux-bd5f485f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c7e5335b79c8/bzImage-bd5f485f.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
------------[ cut here ]------------ UBSAN: shift-out-of-bounds in net/atm/common.c:381:10 shift exponent -1 is negative CPU: 0 UID: 0 PID: 6073 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 ubsan_epilogue+0xa/0x30 lib/ubsan.c:233 __ubsan_handle_shift_out_of_bounds+0x279/0x2a0 lib/ubsan.c:494 __vcc_connect net/atm/common.c:381 [inline] vcc_connect.cold+0xe0/0x123 net/atm/common.c:498 pvc_bind+0x33f/0x460 net/atm/pvc.c:52 __sys_bind_socket net/socket.c:1945 [inline] __sys_bind_socket net/socket.c:1937 [inline] __sys_bind+0x1a9/0x260 net/socket.c:1976 __do_sys_bind net/socket.c:1981 [inline] __se_sys_bind net/socket.c:1979 [inline] __x64_sys_bind+0x72/0xb0 net/socket.c:1979 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6a3099e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff44bcea08 EFLAGS: 00000246 ORIG_RAX: 0000000000000031 RAX: ffffffffffffffda RBX: 00007f6a30c25fa0 RCX: 00007f6a3099e0d9 RDX: 000000000000000c RSI: 0000200000000100 RDI: 0000000000000004 RBP: 00007f6a30a35024 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f6a30c25fac R14: 00007f6a30c25fa0 R15: 00007f6a30c25fa0 </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 [email protected].
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
syzbot
syzbotForwarded: [PATCH] net: atm: fix shift-out-of-bounds in __vcc_connect()
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: [PATCH] net: atm: fix shift-out-of-bounds in __vcc_connect()
Author: [email protected]
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
dev->ci_range.vpi_bits and vci_bits can legitimately be ATM_CI_MAX (-1), a sentinel meaning "no range configured, use maximum" (see include/uapi/linux/atmdev.h). Some drivers, such as usbatm_atm_init() in drivers/usb/atm/usbatm.c, set this sentinel and never resolve it to an actual bit width.
__vcc_connect() uses these fields directly as a shift amount without checking for the sentinel, so binding a PVC socket on such a device triggers a negative shift:
UBSAN: shift-out-of-bounds in net/atm/common.c:381:10 shift exponent -1 is negative
Skip the range check when ci_range.vpi_bits/vci_bits is still ATM_CI_MAX, since that value means "unrestricted".
--- net/atm/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/atm/common.c +4 -1
@@ -378,8 +378,11 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,int error;if ((vpi !=ATM_VPI_UNSPEC && vpi !=ATM_VPI_ANY && + dev->ci_range.vpi_bits !=ATM_CI_MAX && vpi >> dev->ci_range.vpi_bits) || (vci !=ATM_VCI_UNSPEC && - vci !=ATM_VCI_ANY && vci >> dev->ci_range.vci_bits)) + vci !=ATM_VCI_ANY && + dev->ci_range.vci_bits !=ATM_CI_MAX && + vci >> dev->ci_range.vci_bits))return -EINVAL ;if (vci >0 && vci <ATM_NOT_RSV_VCI && !capable (CAP_NET_BIND_SERVICE ))return -EPERM ;
Signature · 1 line
2.34.1