* [syzbot] [sctp?] UBSAN: shift-out-of-bounds in sctp_transport_update_rto
@ 2025-07-21 19:06 syzbot
0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2025-07-21 19:06 UTC (permalink / raw)
To: davem, edumazet, horms, kuba, linux-kernel, linux-sctp,
lucien.xin, marcelo.leitner, netdev, pabeni, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 6832a9317eee Merge tag 'net-6.16-rc7' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=137d9d8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=693e2f5eea496864
dashboard link: https://syzkaller.appspot.com/bug?extid=2e455dd90ca648e48cea
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6a84ef6250f7/disk-6832a931.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/454efb0534f6/vmlinux-6832a931.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7a5841eb7e63/bzImage-6832a931.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+2e455dd90ca648e48cea@syzkaller.appspotmail.com
------------[ cut here ]------------
UBSAN: shift-out-of-bounds in net/sctp/transport.c:509:41
shift exponent 237 is too large for 32-bit type 'unsigned int'
CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.16.0-rc6-syzkaller-00121-g6832a9317eee #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<IRQ>
__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
sctp_transport_update_rto.cold+0x1c/0x34b net/sctp/transport.c:509
sctp_check_transmitted+0x11c4/0x1c30 net/sctp/outqueue.c:1502
sctp_outq_sack+0x4ef/0x1b20 net/sctp/outqueue.c:1338
sctp_cmd_process_sack net/sctp/sm_sideeffect.c:840 [inline]
sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1372 [inline]
sctp_side_effects net/sctp/sm_sideeffect.c:1204 [inline]
sctp_do_sm+0x36df/0x5c80 net/sctp/sm_sideeffect.c:1175
sctp_assoc_bh_rcv+0x392/0x6f0 net/sctp/associola.c:1034
sctp_inq_push+0x1db/0x270 net/sctp/inqueue.c:88
sctp_rcv+0x14d8/0x3c60 net/sctp/input.c:243
ip_protocol_deliver_rcu+0x447/0x4c0 net/ipv4/ip_input.c:205
ip_local_deliver_finish+0x316/0x570 net/ipv4/ip_input.c:233
NF_HOOK include/linux/netfilter.h:317 [inline]
NF_HOOK include/linux/netfilter.h:311 [inline]
ip_local_deliver+0x18e/0x1f0 net/ipv4/ip_input.c:254
dst_input include/net/dst.h:469 [inline]
ip_rcv_finish net/ipv4/ip_input.c:448 [inline]
NF_HOOK include/linux/netfilter.h:317 [inline]
NF_HOOK include/linux/netfilter.h:311 [inline]
ip_rcv+0x2c3/0x5d0 net/ipv4/ip_input.c:568
__netif_receive_skb_one_core+0x197/0x1e0 net/core/dev.c:5977
__netif_receive_skb+0x1d/0x160 net/core/dev.c:6090
process_backlog+0x442/0x15e0 net/core/dev.c:6442
__napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:7414
napi_poll net/core/dev.c:7478 [inline]
net_rx_action+0xa9f/0xfe0 net/core/dev.c:7605
handle_softirqs+0x219/0x8e0 kernel/softirq.c:579
__do_softirq kernel/softirq.c:613 [inline]
invoke_softirq kernel/softirq.c:453 [inline]
__irq_exit_rcu+0x109/0x170 kernel/softirq.c:680
irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:82
Code: 0b 6f 02 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d d3 77 25 00 fb f4 <e9> 8c fb 02 00 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90
RSP: 0018:ffffffff8e207e08 EFLAGS: 000002c6
RAX: 0000000000448811 RBX: 0000000000000000 RCX: ffffffff8b849c69
RDX: 0000000000000000 RSI: ffffffff8de2d10c RDI: ffffffff8c157960
RBP: fffffbfff1c52ef0 R08: 0000000000000001 R09: ffffed1017086645
R10: ffff8880b843322b R11: 0000000000000001 R12: 0000000000000000
R13: ffffffff8e297780 R14: ffffffff90a9a650 R15: 0000000000000000
arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline]
default_idle+0x13/0x20 arch/x86/kernel/process.c:749
default_idle_call+0x6d/0xb0 kernel/sched/idle.c:117
cpuidle_idle_call kernel/sched/idle.c:185 [inline]
do_idle+0x391/0x510 kernel/sched/idle.c:325
cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:423
rest_init+0x16b/0x2b0 init/main.c:745
start_kernel+0x3ee/0x4d0 init/main.c:1102
x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:307
x86_64_start_kernel+0x130/0x190 arch/x86/kernel/head64.c:288
common_startup_64+0x13e/0x148
</TASK>
---[ end trace ]---
----------------
Code disassembly (best guess):
0: 0b 6f 02 or 0x2(%rdi),%ebp
3: c3 ret
4: cc int3
5: cc int3
6: cc int3
7: cc int3
8: 0f 1f 00 nopl (%rax)
b: 90 nop
c: 90 nop
d: 90 nop
e: 90 nop
f: 90 nop
10: 90 nop
11: 90 nop
12: 90 nop
13: 90 nop
14: 90 nop
15: 90 nop
16: 90 nop
17: 90 nop
18: 90 nop
19: 90 nop
1a: 90 nop
1b: f3 0f 1e fa endbr64
1f: 66 90 xchg %ax,%ax
21: 0f 00 2d d3 77 25 00 verw 0x2577d3(%rip) # 0x2577fb
28: fb sti
29: f4 hlt
* 2a: e9 8c fb 02 00 jmp 0x2fbbb <-- trapping instruction
2f: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
36: 00 00 00
39: 66 90 xchg %ax,%ax
3b: 90 nop
3c: 90 nop
3d: 90 nop
3e: 90 nop
3f: 90 nop
---
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 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] 4+ messages in thread
* [syzbot] [sctp?] UBSAN: shift-out-of-bounds in sctp_transport_update_rto
@ 2025-07-22 19:46 Moon Hee Lee
2025-07-22 19:47 ` syzbot
0 siblings, 1 reply; 4+ messages in thread
From: Moon Hee Lee @ 2025-07-22 19:46 UTC (permalink / raw)
To: syzbot+2e455dd90ca648e48cea
Cc: syzkaller-bugs, linux-kernel, linux-sctp, netdev
[-- Attachment #1: Type: text/plain, Size: 76 bytes --]
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git main
[-- Attachment #2: 0001-sctp-guard-rto_alpha-and-rto_beta-against-unsafe-shi.patch --]
[-- Type: text/x-patch, Size: 2517 bytes --]
From 7c472b40b901a12cfc8dc00ca0a99ac2d992c338 Mon Sep 17 00:00:00 2001
From: Moon Hee Lee <moonhee.lee.ca@gmail.com>
Date: Tue, 22 Jul 2025 12:31:16 -0700
Subject: [PATCH net] sctp: guard rto_alpha and rto_beta against unsafe shift
values
rto_alpha and rto_beta are used as shift amounts in the RTT smoothing
calculation, where they represent inverse powers of two (e.g. 3 means 1/8).
Currently, the code uses net->sctp.rto_alpha and rto_beta directly in shift
expressions without validating them. If user-controlled or corrupted values
exceed valid shift bounds for 32-bit integers (e.g. 237), this leads to
undefined behavior and runtime faults.
syzbot reported such a case via UBSAN:
UBSAN: shift-out-of-bounds in net/sctp/transport.c:509:41
shift exponent 237 is too large for 32-bit type 'unsigned int'
This patch ensures both values are within the safe shift range [0, 31].
If not, the code falls back to the default constants SCTP_RTO_ALPHA and
SCTP_RTO_BETA to ensure correctness and system stability.
This preserves SCTP tunability while preventing undefined behavior.
Signed-off-by: Moon Hee Lee <moonhee.lee.ca@gmail.com>
---
net/sctp/transport.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 6946c1462793..848311bb7a9f 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -495,6 +495,8 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
if (tp->rttvar || tp->srtt) {
struct net *net = tp->asoc->base.net;
+ int rto_alpha = net->sctp.rto_alpha;
+ int rto_beta = net->sctp.rto_beta;
/* 6.3.1 C3) When a new RTT measurement R' is made, set
* RTTVAR <- (1 - RTO.Beta) * RTTVAR + RTO.Beta * |SRTT - R'|
* SRTT <- (1 - RTO.Alpha) * SRTT + RTO.Alpha * R'
@@ -505,7 +507,16 @@ void sctp_transport_update_rto(struct sctp_transport *tp, __u32 rtt)
* of two.
* For example, assuming the default value of RTO.Alpha of
* 1/8, rto_alpha would be expressed as 3.
+ *
+ * Guard rto_alpha and rto_beta to ensure they are within
+ * valid shift bounds [0, 31] to avoid undefined behavior.
*/
+ if (unlikely(rto_alpha < 0 || rto_alpha >= 32))
+ rto_alpha = SCTP_RTO_ALPHA;
+
+ if (unlikely(rto_beta < 0 || rto_beta >= 32))
+ rto_beta = SCTP_RTO_BETA;
+
tp->rttvar = tp->rttvar - (tp->rttvar >> net->sctp.rto_beta)
+ (((__u32)abs((__s64)tp->srtt - (__s64)rtt)) >> net->sctp.rto_beta);
tp->srtt = tp->srtt - (tp->srtt >> net->sctp.rto_alpha)
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <87ldlz2ps2.fsf@gmail.com>]
* Re: [syzbot] [sctp?] UBSAN: shift-out-of-bounds in sctp_transport_update_rto
[not found] <87ldlz2ps2.fsf@gmail.com>
@ 2025-09-28 3:56 ` syzbot
0 siblings, 0 replies; 4+ messages in thread
From: syzbot @ 2025-09-28 3:56 UTC (permalink / raw)
To: xandfury; +Cc: xandfury, linux-kernel, syzkaller-bugs
> syzbot <syzbot+2e455dd90ca648e48cea@syzkaller.appspotmail.com> writes:
>
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: 6832a9317eee Merge tag ’net-6.16-rc7’ of git://git.kernel…
>> git tree: upstream
>> console output: <https://syzkaller.appspot.com/x/log.txt?x=137d9d8c580000>
>> kernel config: <https://syzkaller.appspot.com/x/.config?x=693e2f5eea496864>
>> dashboard link: <https://syzkaller.appspot.com/bug?extid=2e455dd90ca648e48cea>
>> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
>>
>> Unfortunately, I don’t have any reproducer for this issue yet.
>>
>> Downloadable assets:
>> disk image: <https://storage.googleapis.com/syzbot-assets/6a84ef6250f7/disk-6832a931.raw.xz>
>> vmlinux: <https://storage.googleapis.com/syzbot-assets/454efb0534f6/vmlinux-6832a931.xz>
>> kernel image: <https://storage.googleapis.com/syzbot-assets/7a5841eb7e63/bzImage-6832a931.xz>
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+2e455dd90ca648e48cea@syzkaller.appspotmail.com
>>
>> ————[ cut here ]————
>> UBSAN: shift-out-of-bounds in net/sctp/transport.c:509:41
>> shift exponent 237 is too large for 32-bit type ’unsigned int’
>> CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.16.0-rc6-syzkaller-00121-g6832a9317eee #0 PREEMPT(full)
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
>> Call Trace:
>> <IRQ>
>> __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
>> sctp_transport_update_rto.cold+0x1c/0x34b net/sctp/transport.c:509
>> sctp_check_transmitted+0x11c4/0x1c30 net/sctp/outqueue.c:1502
>> sctp_outq_sack+0x4ef/0x1b20 net/sctp/outqueue.c:1338
>> sctp_cmd_process_sack net/sctp/sm_sideeffect.c:840 [inline]
>> sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1372 [inline]
>> sctp_side_effects net/sctp/sm_sideeffect.c:1204 [inline]
>> sctp_do_sm+0x36df/0x5c80 net/sctp/sm_sideeffect.c:1175
>> sctp_assoc_bh_rcv+0x392/0x6f0 net/sctp/associola.c:1034
>> sctp_inq_push+0x1db/0x270 net/sctp/inqueue.c:88
>> sctp_rcv+0x14d8/0x3c60 net/sctp/input.c:243
>> ip_protocol_deliver_rcu+0x447/0x4c0 net/ipv4/ip_input.c:205
>> ip_local_deliver_finish+0x316/0x570 net/ipv4/ip_input.c:233
>> NF_HOOK include/linux/netfilter.h:317 [inline]
>> NF_HOOK include/linux/netfilter.h:311 [inline]
>> ip_local_deliver+0x18e/0x1f0 net/ipv4/ip_input.c:254
>> dst_input include/net/dst.h:469 [inline]
>> ip_rcv_finish net/ipv4/ip_input.c:448 [inline]
>> NF_HOOK include/linux/netfilter.h:317 [inline]
>> NF_HOOK include/linux/netfilter.h:311 [inline]
>> ip_rcv+0x2c3/0x5d0 net/ipv4/ip_input.c:568
>> __netif_receive_skb_one_core+0x197/0x1e0 net/core/dev.c:5977
>> __netif_receive_skb+0x1d/0x160 net/core/dev.c:6090
>> process_backlog+0x442/0x15e0 net/core/dev.c:6442
>> __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:7414
>> napi_poll net/core/dev.c:7478 [inline]
>> net_rx_action+0xa9f/0xfe0 net/core/dev.c:7605
>> handle_softirqs+0x219/0x8e0 kernel/softirq.c:579
>> __do_softirq kernel/softirq.c:613 [inline]
>> invoke_softirq kernel/softirq.c:453 [inline]
>> __irq_exit_rcu+0x109/0x170 kernel/softirq.c:680
>> irq_exit_rcu+0x9/0x30 kernel/softirq.c:696
>> instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1050 [inline]
>> sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1050
>> </IRQ>
>> <TASK>
>> asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
>> RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:82
>> Code: 0b 6f 02 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 66 90 0f 00 2d d3 77 25 00 fb f4 <e9> 8c fb 02 00 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90
>> RSP: 0018:ffffffff8e207e08 EFLAGS: 000002c6
>> RAX: 0000000000448811 RBX: 0000000000000000 RCX: ffffffff8b849c69
>> RDX: 0000000000000000 RSI: ffffffff8de2d10c RDI: ffffffff8c157960
>> RBP: fffffbfff1c52ef0 R08: 0000000000000001 R09: ffffed1017086645
>> R10: ffff8880b843322b R11: 0000000000000001 R12: 0000000000000000
>> R13: ffffffff8e297780 R14: ffffffff90a9a650 R15: 0000000000000000
>> arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline]
>> default_idle+0x13/0x20 arch/x86/kernel/process.c:749
>> default_idle_call+0x6d/0xb0 kernel/sched/idle.c:117
>> cpuidle_idle_call kernel/sched/idle.c:185 [inline]
>> do_idle+0x391/0x510 kernel/sched/idle.c:325
>> cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:423
>> rest_init+0x16b/0x2b0 init/main.c:745
>> start_kernel+0x3ee/0x4d0 init/main.c:1102
>> x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:307
>> x86_64_start_kernel+0x130/0x190 arch/x86/kernel/head64.c:288
>> common_startup_64+0x13e/0x148
>> </TASK>
>> —[ end trace ]—
>> —————-
>> Code disassembly (best guess):
>> 0: 0b 6f 02 or 0x2(%rdi),%ebp
>> 3: c3 ret
>> 4: cc int3
>> 5: cc int3
>> 6: cc int3
>> 7: cc int3
>> 8: 0f 1f 00 nopl (%rax)
>> b: 90 nop
>> c: 90 nop
>> d: 90 nop
>> e: 90 nop
>> f: 90 nop
>> 10: 90 nop
>> 11: 90 nop
>> 12: 90 nop
>> 13: 90 nop
>> 14: 90 nop
>> 15: 90 nop
>> 16: 90 nop
>> 17: 90 nop
>> 18: 90 nop
>> 19: 90 nop
>> 1a: 90 nop
>> 1b: f3 0f 1e fa endbr64
>> 1f: 66 90 xchg %ax,%ax
>> 21: 0f 00 2d d3 77 25 00 verw 0x2577d3(%rip) # 0x2577fb
>> 28: fb sti
>> 29: f4 hlt
>> * 2a: e9 8c fb 02 00 jmp 0x2fbbb <– trapping instruction
>> 2f: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
>> 36: 00 00 00
>> 39: 66 90 xchg %ax,%ax
>> 3b: 90 nop
>> 3c: 90 nop
>> 3d: 90 nop
>> 3e: 90 nop
>> 3f: 90 nop
>>
>>
>> —
>> 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 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 master
This crash does not have a reproducer. I cannot test it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-28 3:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 19:06 [syzbot] [sctp?] UBSAN: shift-out-of-bounds in sctp_transport_update_rto syzbot
-- strict thread matches above, loose matches on Subject: below --
2025-07-22 19:46 Moon Hee Lee
2025-07-22 19:47 ` syzbot
[not found] <87ldlz2ps2.fsf@gmail.com>
2025-09-28 3:56 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox