mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [syzbot] [sctp?] general protection fault in sctp_inet_listen
@ 2024-09-27 14:59 syzbot
  2024-09-27 16:04 ` Xin Long
  0 siblings, 1 reply; 2+ messages in thread
From: syzbot @ 2024-09-27 14:59 UTC (permalink / raw)
  To: davem, edumazet, kuba, linux-kernel, linux-sctp, lucien.xin,
	marcelo.leitner, netdev, pabeni, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    196145c606d0 Merge tag 'clk-fixes-for-linus' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16f8549f980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=61d235cb8d15001c
dashboard link: https://syzkaller.appspot.com/bug?extid=f4e0f821e3a3b7cee51d
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: i386

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/629d679a6d66/disk-196145c6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/aec0dd4a04f3/vmlinux-196145c6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/68e515733997/bzImage-196145c6.xz

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

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 UID: 0 PID: 10078 Comm: syz.4.940 Not tainted 6.11.0-rc7-syzkaller-00097-g196145c606d0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:sctp_inet_listen+0x7f0/0xa20 net/sctp/socket.c:8617
Code: 8d 98 00 06 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 6e 4e 05 f7 48 8b 1b 48 83 c3 02 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 8e 01 00 00 c6 03 01 31 db e9 d6 f9 ff
RSP: 0018:ffffc90002eafd20 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff88802e973c00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90002eafe78 R08: ffffffff8af5839c R09: 1ffffffff283c920
R10: dffffc0000000000 R11: fffffbfff283c921 R12: 1ffff1100fc7e242
R13: dffffc0000000000 R14: ffff88807e3f1212 R15: 1ffff1100fc7e2ff
FS:  0000000000000000(0000) GS:ffff8880b8900000(0063) knlGS:00000000f5735b40
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 00007fadae30cff8 CR3: 0000000050d9a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __sys_listen_socket net/socket.c:1883 [inline]
 __sys_listen+0x1b7/0x230 net/socket.c:1894
 __do_sys_listen net/socket.c:1902 [inline]
 __se_sys_listen net/socket.c:1900 [inline]
 __ia32_sys_listen+0x5a/0x70 net/socket.c:1900
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0xb4/0x110 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x34/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf7fd6579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 002b:00000000f573556c EFLAGS: 00000206 ORIG_RAX: 000000000000016b
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:sctp_inet_listen+0x7f0/0xa20 net/sctp/socket.c:8617
Code: 8d 98 00 06 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 6e 4e 05 f7 48 8b 1b 48 83 c3 02 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 8e 01 00 00 c6 03 01 31 db e9 d6 f9 ff
RSP: 0018:ffffc90002eafd20 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff88802e973c00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90002eafe78 R08: ffffffff8af5839c R09: 1ffffffff283c920
R10: dffffc0000000000 R11: fffffbfff283c921 R12: 1ffff1100fc7e242
R13: dffffc0000000000 R14: ffff88807e3f1212 R15: 1ffff1100fc7e2ff
FS:  0000000000000000(0000) GS:ffff8880b8900000(0063) knlGS:00000000f5735b40
CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
CR2: 000055f65cf85950 CR3: 0000000050d9a000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	8d 98 00 06 00 00    	lea    0x600(%rax),%ebx
   6:	48 89 d8             	mov    %rbx,%rax
   9:	48 c1 e8 03          	shr    $0x3,%rax
   d:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
  12:	74 08                	je     0x1c
  14:	48 89 df             	mov    %rbx,%rdi
  17:	e8 6e 4e 05 f7       	call   0xf7054e8a
  1c:	48 8b 1b             	mov    (%rbx),%rbx
  1f:	48 83 c3 02          	add    $0x2,%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 0f b6 04 28       	movzbl (%rax,%r13,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 8e 01 00 00    	jne    0x1c5
  37:	c6 03 01             	movb   $0x1,(%rbx)
  3a:	31 db                	xor    %ebx,%ebx
  3c:	e9                   	.byte 0xe9
  3d:	d6                   	(bad)
  3e:	f9                   	stc
  3f:	ff                   	.byte 0xff


---
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] 2+ messages in thread

* Re: [syzbot] [sctp?] general protection fault in sctp_inet_listen
  2024-09-27 14:59 [syzbot] [sctp?] general protection fault in sctp_inet_listen syzbot
@ 2024-09-27 16:04 ` Xin Long
  0 siblings, 0 replies; 2+ messages in thread
From: Xin Long @ 2024-09-27 16:04 UTC (permalink / raw)
  To: syzbot
  Cc: davem, edumazet, kuba, linux-kernel, linux-sctp, marcelo.leitner,
	netdev, pabeni, syzkaller-bugs

On Fri, Sep 27, 2024 at 10:59 AM syzbot
<syzbot+f4e0f821e3a3b7cee51d@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    196145c606d0 Merge tag 'clk-fixes-for-linus' of git://git...
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=16f8549f980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=61d235cb8d15001c
> dashboard link: https://syzkaller.appspot.com/bug?extid=f4e0f821e3a3b7cee51d
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> userspace arch: i386
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/629d679a6d66/disk-196145c6.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/aec0dd4a04f3/vmlinux-196145c6.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/68e515733997/bzImage-196145c6.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+f4e0f821e3a3b7cee51d@syzkaller.appspotmail.com
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
> CPU: 1 UID: 0 PID: 10078 Comm: syz.4.940 Not tainted 6.11.0-rc7-syzkaller-00097-g196145c606d0 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
> RIP: 0010:sctp_inet_listen+0x7f0/0xa20 net/sctp/socket.c:8617
In sctp_listen_start() invoked by sctp_inet_listen(), it should set the
socket state back to CLOSED if sctp_autobind() fails due to whatever
reason:

@@ -8557,8 +8557,10 @@ static int sctp_listen_start(struct sock *sk,
int backlog)
         */
        inet_sk_set_state(sk, SCTP_SS_LISTENING);
        if (!ep->base.bind_addr.port) {
-               if (sctp_autobind(sk))
+               if (sctp_autobind(sk)) {
+                       inet_sk_set_state(sk, SCTP_SS_CLOSED);
                        return -EAGAIN;
+               }

Otherwise, next time when calling sctp_inet_listen(), if sctp_sk(sk)->reuse
is already set via setsockopt(SCTP_REUSE_PORT), sctp_sk(sk)->bind_hash will
be dereferenced as the state is LISTENING, and causes crash as bind_hash is
NULL.

> Code: 8d 98 00 06 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 6e 4e 05 f7 48 8b 1b 48 83 c3 02 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 8e 01 00 00 c6 03 01 31 db e9 d6 f9 ff
> RSP: 0018:ffffc90002eafd20 EFLAGS: 00010246
> RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff88802e973c00
> RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
> RBP: ffffc90002eafe78 R08: ffffffff8af5839c R09: 1ffffffff283c920
> R10: dffffc0000000000 R11: fffffbfff283c921 R12: 1ffff1100fc7e242
> R13: dffffc0000000000 R14: ffff88807e3f1212 R15: 1ffff1100fc7e2ff
> FS:  0000000000000000(0000) GS:ffff8880b8900000(0063) knlGS:00000000f5735b40
> CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
> CR2: 00007fadae30cff8 CR3: 0000000050d9a000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  <TASK>
>  __sys_listen_socket net/socket.c:1883 [inline]
>  __sys_listen+0x1b7/0x230 net/socket.c:1894
>  __do_sys_listen net/socket.c:1902 [inline]
>  __se_sys_listen net/socket.c:1900 [inline]
>  __ia32_sys_listen+0x5a/0x70 net/socket.c:1900
>  do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
>  __do_fast_syscall_32+0xb4/0x110 arch/x86/entry/common.c:386
>  do_fast_syscall_32+0x34/0x80 arch/x86/entry/common.c:411
>  entry_SYSENTER_compat_after_hwframe+0x84/0x8e
> RIP: 0023:0xf7fd6579
> Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
> RSP: 002b:00000000f573556c EFLAGS: 00000206 ORIG_RAX: 000000000000016b
> RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
> RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000
> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
>  </TASK>
> Modules linked in:
> ---[ end trace 0000000000000000 ]---
> RIP: 0010:sctp_inet_listen+0x7f0/0xa20 net/sctp/socket.c:8617
> Code: 8d 98 00 06 00 00 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8 6e 4e 05 f7 48 8b 1b 48 83 c3 02 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 8e 01 00 00 c6 03 01 31 db e9 d6 f9 ff
> RSP: 0018:ffffc90002eafd20 EFLAGS: 00010246
> RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff88802e973c00
> RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
> RBP: ffffc90002eafe78 R08: ffffffff8af5839c R09: 1ffffffff283c920
> R10: dffffc0000000000 R11: fffffbfff283c921 R12: 1ffff1100fc7e242
> R13: dffffc0000000000 R14: ffff88807e3f1212 R15: 1ffff1100fc7e2ff
> FS:  0000000000000000(0000) GS:ffff8880b8900000(0063) knlGS:00000000f5735b40
> CS:  0010 DS: 002b ES: 002b CR0: 0000000080050033
> CR2: 000055f65cf85950 CR3: 0000000050d9a000 CR4: 00000000003506f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> ----------------
> Code disassembly (best guess):
>    0:   8d 98 00 06 00 00       lea    0x600(%rax),%ebx
>    6:   48 89 d8                mov    %rbx,%rax
>    9:   48 c1 e8 03             shr    $0x3,%rax
>    d:   42 80 3c 28 00          cmpb   $0x0,(%rax,%r13,1)
>   12:   74 08                   je     0x1c
>   14:   48 89 df                mov    %rbx,%rdi
>   17:   e8 6e 4e 05 f7          call   0xf7054e8a
>   1c:   48 8b 1b                mov    (%rbx),%rbx
>   1f:   48 83 c3 02             add    $0x2,%rbx
>   23:   48 89 d8                mov    %rbx,%rax
>   26:   48 c1 e8 03             shr    $0x3,%rax
> * 2a:   42 0f b6 04 28          movzbl (%rax,%r13,1),%eax <-- trapping instruction
>   2f:   84 c0                   test   %al,%al
>   31:   0f 85 8e 01 00 00       jne    0x1c5
>   37:   c6 03 01                movb   $0x1,(%rbx)
>   3a:   31 db                   xor    %ebx,%ebx
>   3c:   e9                      .byte 0xe9
>   3d:   d6                      (bad)
>   3e:   f9                      stc
>   3f:   ff                      .byte 0xff
>
>
> ---
> 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] 2+ messages in thread

end of thread, other threads:[~2024-09-27 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-27 14:59 [syzbot] [sctp?] general protection fault in sctp_inet_listen syzbot
2024-09-27 16:04 ` Xin Long

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®