netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [net?] UBSAN: array-index-out-of-bounds in ipv6_addr_prefix
@ 2025-05-01 11:15 syzbot
  2025-05-02  0:25 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2025-05-01 11:15 UTC (permalink / raw)
  To: davem, dsahern, edumazet, horms, kuba, linux-kernel, netdev,
	pabeni, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    5565acd1e6c4 Merge git://git.kernel.org/pub/scm/linux/kern..
git tree:       net-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f19574580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=2e3745cb659ef5d9
dashboard link: https://syzkaller.appspot.com/bug?extid=e4eec4b8584ac3f936e5
compiler:       Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10207fcf980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16f19574580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/80798769614c/disk-5565acd1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/435ecb0f1371/vmlinux-5565acd1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7790d5f923b6/bzImage-5565acd1.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e4eec4b8584ac3f936e5@syzkaller.appspotmail.com

------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in ./include/net/ipv6.h:616:21
index 16 is out of range for type 'const __u8[16]' (aka 'const unsigned char[16]')
CPU: 0 UID: 0 PID: 5837 Comm: syz-executor401 Not tainted 6.15.0-rc3-syzkaller-00557-g5565acd1e6c4 #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 ubsan_epilogue+0xa/0x40 lib/ubsan.c:231
 __ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:453
 ipv6_addr_prefix+0x145/0x1d0 include/net/ipv6.h:616
 ip6_route_info_create+0x629/0xa70 net/ipv6/route.c:3814
 ip6_route_mpath_info_create net/ipv6/route.c:5393 [inline]
 ip6_route_multipath_add net/ipv6/route.c:5519 [inline]
 inet6_rtm_newroute+0x578/0x1c70 net/ipv6/route.c:5710
 rtnetlink_rcv_msg+0x7cc/0xb70 net/core/rtnetlink.c:6955
 netlink_rcv_skb+0x219/0x490 net/netlink/af_netlink.c:2534
 netlink_unicast_kernel net/netlink/af_netlink.c:1313 [inline]
 netlink_unicast+0x758/0x8d0 net/netlink/af_netlink.c:1339
 netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1883
 sock_sendmsg_nosec net/socket.c:712 [inline]
 __sock_sendmsg+0x219/0x270 net/socket.c:727
 ____sys_sendmsg+0x505/0x830 net/socket.c:2566
 ___sys_sendmsg+0x21f/0x2a0 net/socket.c:2620
 __sys_sendmsg net/socket.c:2652 [inline]
 __do_sys_sendmsg net/socket.c:2657 [inline]
 __se_sys_sendmsg net/socket.c:2655 [inline]
 __x64_sys_sendmsg+0x19b/0x260 net/socket.c:2655
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc65575d369
Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff8937e028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fff8937e1f8 RCX: 00007fc65575d369
RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000003
RBP: 00007fc6557d0610 R08: 0000000000000000 R09: 00007fff8937e1f8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007fff8937e1e8 R14: 0000000000000001 R15: 0000000000000001
 </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] 2+ messages in thread

* Re: [syzbot] [net?] UBSAN: array-index-out-of-bounds in ipv6_addr_prefix
  2025-05-01 11:15 [syzbot] [net?] UBSAN: array-index-out-of-bounds in ipv6_addr_prefix syzbot
@ 2025-05-02  0:25 ` Kuniyuki Iwashima
  0 siblings, 0 replies; 2+ messages in thread
From: Kuniyuki Iwashima @ 2025-05-02  0:25 UTC (permalink / raw)
  To: syzbot+e4eec4b8584ac3f936e5
  Cc: davem, dsahern, edumazet, horms, kuba, linux-kernel, netdev,
	pabeni, syzkaller-bugs, kuniyu

From: syzbot <syzbot+e4eec4b8584ac3f936e5@syzkaller.appspotmail.com>
Date: Thu, 01 May 2025 04:15:34 -0700
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    5565acd1e6c4 Merge git://git.kernel.org/pub/scm/linux/kern..
> git tree:       net-next
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=12f19574580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=2e3745cb659ef5d9
> dashboard link: https://syzkaller.appspot.com/bug?extid=e4eec4b8584ac3f936e5
> compiler:       Debian clang version 20.1.2 (++20250402124445+58df0ef89dd6-1~exp1~20250402004600.97), Debian LLD 20.1.2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10207fcf980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16f19574580000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/80798769614c/disk-5565acd1.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/435ecb0f1371/vmlinux-5565acd1.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/7790d5f923b6/bzImage-5565acd1.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+e4eec4b8584ac3f936e5@syzkaller.appspotmail.com
> 
> ------------[ cut here ]------------
> UBSAN: array-index-out-of-bounds in ./include/net/ipv6.h:616:21
> index 16 is out of range for type 'const __u8[16]' (aka 'const unsigned char[16]')
> CPU: 0 UID: 0 PID: 5837 Comm: syz-executor401 Not tainted 6.15.0-rc3-syzkaller-00557-g5565acd1e6c4 #0 PREEMPT(full) 
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
> Call Trace:
>  <TASK>
>  dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
>  ubsan_epilogue+0xa/0x40 lib/ubsan.c:231
>  __ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:453
>  ipv6_addr_prefix+0x145/0x1d0 include/net/ipv6.h:616
>  ip6_route_info_create+0x629/0xa70 net/ipv6/route.c:3814
>  ip6_route_mpath_info_create net/ipv6/route.c:5393 [inline]
>  ip6_route_multipath_add net/ipv6/route.c:5519 [inline]

I missed err is reset by rtm_to_fib6_multipath_config()
and lwtunnel_valid_encap_type() ... I like setting
err just before goto...

so the diff below fixes,

---8<---
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index aa6b45bd3515..fee80b08bc46 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5275,6 +5275,8 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	if (newroute) {
+		err = -EINVAL;
+
 		/* RTF_PCPU is an internal flag; can not be set by userspace */
 		if (cfg->fc_flags & RTF_PCPU) {
 			NL_SET_ERR_MSG(extack, "Userspace can not set RTF_PCPU");
---8<---

but this patch also fixes it,

https://lore.kernel.org/netdev/20250501005335.53683-1-kuniyu@amazon.com/

so,

#syz dup: [syzbot] [net?] WARNING in ipv6_addr_prefix

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-02  0:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-01 11:15 [syzbot] [net?] UBSAN: array-index-out-of-bounds in ipv6_addr_prefix syzbot
2025-05-02  0:25 ` Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).