Skip to contentSkip to conversation

pty04: Avoid receiving packets from all interfaces

PATCH New Richard Palethorpe 5 participants 8 messages May 15, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

Raw sockets receive all packets from all interfaces as soon as they are created. They don't need to be bound to one or more interfaces like I thought.

This creates the socket with a NULL packet type which appears to be unused in the Linux kernel and receives no packets. The protocol is then changed to ETH_P_ALL when binding to the netdevice we are interested in.

I assume it is impossible for a packet to have zero for its packet type. Most likely using ETH_P_LOOP would have been OK too, but I suppose that is really used by some hardware.

This also fixes various other problems that have been observed with this test. Such as memory allocation failures.

---

Another day, another patch for pty04.

 testcases/kernel/pty/pty04.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/pty/pty04.c +1 -1
index d574d8b2c..4adf2cbb7 100644
@@ -206,7 +206,7 @@ static void open_netdev(const struct ldisc_info *ldisc)
 	SAFE_IOCTL(pts, SIOCGIFNAME, ifreq.ifr_name);
 	tst_res(TINFO, "Netdev is %s", ifreq.ifr_name);
 
-	sk = SAFE_SOCKET(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
+	sk = SAFE_SOCKET(PF_PACKET, SOCK_RAW, 0);
 
 	ifreq.ifr_mtu = ldisc->mtu;
 	if (ioctl(sk, SIOCSIFMTU, &ifreq))
Signature · 1 line
2.26.1
#1 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

Hi!
Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

----- Original Message -----

Quoted 5 lines

Hi!
Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

I haven't spotted potential issue while looking at kernel code, will test the patch just to be sure.

#3 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

----- Original Message -----

Quoted 11 lines

----- Original Message -----

Quoted 5 lines

Hi!
Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

I haven't spotted potential issue while looking at kernel code, will test the patch just to be sure.

It still gets occasionally stuck on 5.7.0-rc4, but the chance to hit it appears lower. I think merge the patch and we'll see how frequently it happens with single iteration. We can always disable it later in runtest file.

# ./pty04 -i 10
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
pty04.c:130: INFO: PTS path is /dev/pts/2
pty04.c:207: INFO: Netdev is sl0
pty04.c:216: INFO: Netdev MTU is 8192 (we set 8192)
pty04.c:233: INFO: Bound netdev 245 to socket 5
tst_buffers.c:55: INFO: Test is using guarded buffers
pty04.c:324: INFO: Reading from socket 5
tst_buffers.c:55: INFO: Test is using guarded buffers
pty04.c:180: PASS: Wrote PTY N_SLIP 3 (1)
pty04.c:191: PASS: Wrote PTY N_SLIP 3 (2)
pty04.c:328: PASS: Read netdev N_SLIP 5 (1)

tst_checkpoint.c:149: BROK: pty04.c:364: tst_checkpoint_wait(0, 100000): ETIMEDOUT (110) tst_test.c:373: BROK: Reported by child (2990)
pty04.c:306: BROK: Read 0 of 8191 bytes: ENETDOWN (100)
pty04.c:196: PASS: Writing to PTY interrupted by hangup
tst_test.c:373: WARN: Reported by child (2987)

#4 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

Hello,

Quoted 32 lines · Jan Stancek

----- Original Message -----

Quoted 11 lines

----- Original Message -----

Quoted 5 lines

Hi!
Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

I haven't spotted potential issue while looking at kernel code, will test the patch just to be sure.

It still gets occasionally stuck on 5.7.0-rc4, but the chance to hit it appears lower. I think merge the patch and we'll see how frequently it happens with single iteration. We can always disable it later in runtest file.

# ./pty04 -i 10
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s
pty04.c:130: INFO: PTS path is /dev/pts/2
pty04.c:207: INFO: Netdev is sl0
pty04.c:216: INFO: Netdev MTU is 8192 (we set 8192)
pty04.c:233: INFO: Bound netdev 245 to socket 5
tst_buffers.c:55: INFO: Test is using guarded buffers
pty04.c:324: INFO: Reading from socket 5
tst_buffers.c:55: INFO: Test is using guarded buffers
pty04.c:180: PASS: Wrote PTY N_SLIP 3 (1)
pty04.c:191: PASS: Wrote PTY N_SLIP 3 (2)
pty04.c:328: PASS: Read netdev N_SLIP 5 (1)
Quoted 5 lines

tst_checkpoint.c:149: BROK: pty04.c:364: tst_checkpoint_wait(0, 100000): ETIMEDOUT (110) tst_test.c:373: BROK: Reported by child (2990)
pty04.c:306: BROK: Read 0 of 8191 bytes: ENETDOWN (100)
pty04.c:196: PASS: Writing to PTY interrupted by hangup
tst_test.c:373: WARN: Reported by child (2987)

Thanks for testing. I guess if the timeout is set long enough and you have RCU stall detection enabled(?) or SLUB debug, then you will get some stack trace. Probably related to memory allocation.

I tried again running it in parallel and still got the following stack traces, but the system is able to recover afterwards. It seems like the PTYs and line disciplines are a bit fragile. Which I suspect could be fixed by using different memory pools , but I'm not sure it is very important.

[   58.454313] rcu: INFO: rcu_sched self-detected stall on CPU
[   58.455115] rcu: 	2-....: (26000 ticks this GP) idle=bea/1/0x4000000000000002 softirq=2439/2439 fqs
[   58.456405] 	(t=26003 jiffies g=4233 q=26)
[   58.456949] NMI backtrace for cpu 2
[   58.457405] CPU: 2 PID: 280 Comm: kworker/u8:6 Not tainted 5.7.0-rc4+ #49
[   58.458286] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt4
[   58.459766] Workqueue: events_unbound flush_to_ldisc
[   58.460438] Call Trace:
[   58.460777]  <IRQ>
[   58.461063]  dump_stack+0x97/0xe0
[   58.461518]  nmi_cpu_backtrace.cold+0x46/0x80
[   58.462103]  ? lapic_can_unplug_cpu.cold+0x46/0x46
[   58.462741]  nmi_trigger_cpumask_backtrace+0x125/0x154
[   58.463438]  rcu_dump_cpu_stacks+0x1a0/0x1ea
[   58.464041]  rcu_sched_clock_irq.cold+0x518/0x978
[   58.464683]  update_process_times+0x24/0x50
[   58.465248]  tick_sched_handle+0xf7/0x160
[   58.465792]  tick_sched_timer+0x38/0xf0
[   58.466315]  __hrtimer_run_queues+0x4ae/0xa90
[   58.466902]  ? tick_sched_do_timer+0x150/0x150
[   58.467523]  ? enqueue_hrtimer+0x2d0/0x2d0
[   58.468092]  hrtimer_interrupt+0x2bf/0x740
[   58.468668]  smp_apic_timer_interrupt+0x109/0x4e0
[   58.469303]  apic_timer_interrupt+0xf/0x20
[   58.469852]  </IRQ>
[   58.470150] RIP: 0010:enqueue_to_backlog+0x156/0xb40
[   58.470821] Code: 74 08 3c 03 0f 8e 90 05 00 00 83 83 30 01 00 00 01 4c 89 ef e8 5b f4 7a 00 41 f7 c4 f
[   58.473235] RSP: 0018:ffffc900005479b0 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
[   58.474225] RAX: 0000000000000007 RBX: ffff88806b535d80 RCX: 1ffffffff1e2bffa
[   58.475155] RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff8d42ee73
[   58.476090] RBP: ffff888048188c80 R08: 0000000000000001 R09: ffffed100d6a6bdb
[   58.477068] R10: ffff88806b535ed3 R11: ffffed100d6a6bda R12: 0000000000000282
[   58.478003] R13: ffff88806b535ed0 R14: ffff888048188c90 R15: 00000000000003e9
[   58.479059]  ? enqueue_to_backlog+0x153/0xb40
[   58.479674]  netif_rx_internal+0xc6/0x450
[   58.480265]  ? enqueue_to_backlog+0xb40/0xb40
[   58.480985]  netif_rx_ni+0x4b/0x3a0
[   58.481545]  slcan_receive_buf+0x970/0xbb0 [slcan]
[   58.482295]  ? slcan_transmit+0x3e0/0x3e0 [slcan]
[   58.483047]  ? slcan_transmit+0x3e0/0x3e0 [slcan]
[   58.483793]  ? slcan_transmit+0x3e0/0x3e0 [slcan]
[   58.484544]  tty_ldisc_receive_buf+0x100/0x1d0
[   58.485246]  ? tty_ldisc_receive_buf+0x5/0x1d0
[   58.485970]  tty_port_default_receive_buf+0x61/0x90
[   58.486576]  flush_to_ldisc+0x1a7/0x3e0
[   58.487046]  process_one_work+0x926/0x16d0
[   58.487550]  ? pwq_dec_nr_in_flight+0x290/0x290
[   58.488077]  ? ftrace_graph_caller+0x6b/0xa0
[   58.488584]  ? rwlock_bug.part.0+0x90/0x90
[   58.489081]  worker_thread+0x92/0xfa0
[   58.489535]  ? process_one_work+0x16d0/0x16d0
[   58.490048]  kthread+0x2ba/0x3b0
[   58.490433]  ? kthread_create_on_node+0xd0/0xd0
[   58.490966]  ret_from_fork+0x3a/0x50
[   59.114357] rcu: INFO: rcu_sched detected expedited stalls on CPUs/tasks: { 2-... } 26468 jiffies s: 2.
[   59.115656] rcu: blocking rcu_node structures:
[   59.116176] Task dump for CPU 2:
[   59.116580] kworker/u8:6    R  running task    28768   280      2 0x80004008
[   59.117488] Workqueue: events_unbound flush_to_ldisc
[   59.118068] Call Trace:
[   59.118409]  ? pwq_dec_nr_in_flight+0x290/0x290
[   59.118936]  ? ftrace_graph_caller+0x6b/0xa0
[   59.119476]  ? rwlock_bug.part.0+0x90/0x90
[   59.119976]  ? worker_thread+0x92/0xfa0
[   59.120472]  ? process_one_work+0x16d0/0x16d0
[   59.120987]  ? kthread+0x2ba/0x3b0
[   59.121415]  ? kthread_create_on_node+0xd0/0xd0
[   59.121948]  ? ret_from_fork+0x3a/0x50
[   63.805607] warn_alloc: 1915 callbacks suppressed
[   26.819715] reproducer: page allocation failure: order:1, mode:0x40a20(GFP_ATOMIC|__GFP_COMP), nodemas0
[   26.820140] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.821191] CPU: 1 PID: 456 Comm: reproducer Not tainted 5.7.0-rc4+ #49
[   26.822013]   cache: skbuff_head_cache, object size: 224, buffer size: 320, default order: 1, min orde0
[   26.822583] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822590]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822596]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822604]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822712] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822719]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822724]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822732]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822760] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822767]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822772]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822780]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822807] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba527-rebuilt4
[   26.822813] Call Trace:
[   26.822818] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822823]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822828]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822834]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822870] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822876]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822882]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822890]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822932] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.822939]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.822946]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.822953]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.822995] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.823002]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.823007]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.823015]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.823057] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.823064]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.823069]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.823076]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.823116] SLUB: Unable to allocate memory on node -1, gfp=0xa20(GFP_ATOMIC)
[   26.823121]   cache: kmalloc-4k, object size: 4096, buffer size: 8192, default order: 3, min order: 1
[   26.823128]   kmalloc-4k debugging increased min order, use slub_debug=O to disable.
[   26.823134]   node 0: slabs: 44294, objs: 177164, free: 0
[   26.824222]   node 0: slabs: 12353, objs: 308825, free: 0
[   26.825031]  dump_stack+0x97/0xe0
[   26.859539]  warn_alloc.cold+0x87/0x18d
pty04.c:328:    26.860015]  ? zone_watermark_ok_safe+0x270/0x270
;32mPASS: Re[   26.860709]  ? zone_watermark_ok_safe+0x270/0x270

ad netdev N_SLCA[ 26.861611] ? __alloc_pages_slowpath.constprop.0+0x1cf3/0x2180
N 26 (1)[ 26.862395] ? prepare_ftrace_return+0xa1/0xf0

[   26.863008]  ? wakeup_kcompactd+0x18a/0x3e0
[   26.863526]  ? __isolate_free_page+0x4e0/0x4e0
[   26.864070]  __alloc_pages_slowpath.constprop.0+0x1cf3/0x2180
[   26.864739]  ? get_page_from_freelist+0x753/0x3920
pty04.c:332:    26.865300]  ? __isolate_free_page+0x4e0/0x4e0
;32mPASS: Re[   26.865989]  ? __alloc_pages_nodemask+0x277/0x6e0
ad netdev N_SLCA[   26.866675]  ? warn_alloc+0x120/0x120
N 26 (2)
[   26.867260]  ? ftrace_graph_caller+0x6b/0xa0
[   26.867867]  ? function_graph_enter+0x34b/0x520
[   26.868396]  ? __isolate_free_page+0x4e0/0x4e0
[   26.868914]  ? ftrace_graph_stop+0x10/0x10
[   26.869409]  __alloc_pages_nodemask+0x517/0x6e0
[   26.869942]  ? __alloc_pages_slowpath.constprop.0+0x2180/0x2180
[   26.870618]  ? ftrace_graph_caller+0x6b/0xa0
[   26.871141]  new_slab+0x28b/0x340
[   26.871547]  ___slab_alloc+0x370/0x5d0
[   26.871995]  ? __tty_buffer_request_room+0x1c0/0x560
[   26.872577]  ? __tty_buffer_request_room+0x1c0/0x560
[   26.873150]  ? ftrace_graph_caller+0x6b/0xa0
[   26.873645]  ? prepare_ftrace_return+0xa1/0xf0
[   26.874172]  ? __tty_buffer_request_room+0x1c0/0x560
[   26.874747]  ? __slab_alloc+0x38/0x70
[   26.875176]  __slab_alloc+0x38/0x70
[   26.875648]  ? __tty_buffer_request_room+0x1c0/0x560
[   26.876403]  __kmalloc+0x25e/0x2c0
[   26.876814]  __tty_buffer_request_room+0x1c0/0x560
[   26.877380]  tty_insert_flip_string_fixed_flag+0x7d/0x1f0
[   26.878181]  pty_write+0x103/0x1d0
[   26.878684]  n_tty_write+0x753/0xf90
[   26.879108]  ? ftrace_graph_stop+0x10/0x10
[   26.879585]  ? n_tty_read+0x16e0/0x16e0
[   26.880053]  ? tty_write+0x3c0/0x700
[   26.880472]  ? prepare_ftrace_return+0xa1/0xf0
[   26.880989]  ? n_tty_read+0x16e0/0x16e0
[   26.881435]  ? ftrace_graph_caller+0x6b/0xa0
[   26.881934]  ? prepare_to_wait_exclusive+0x200/0x200
[   26.882509]  ? n_tty_read+0x16e0/0x16e0
[   26.882973]  tty_write+0x3c0/0x700
[   26.883379]  ? n_tty_read+0x16e0/0x16e0
[   26.883857]  vfs_write+0x154/0x450
[   26.884324]  ksys_write+0xf9/0x1d0
[   26.884783]  ? __ia32_sys_read+0xb0/0xb0
[   26.885324]  do_syscall_64+0x95/0x4a0
[   26.885819]  entry_SYSCALL_64_after_hwframe+0x49/0xb3
[   26.886485] RIP: 0033:0x7f56ae533563
[   26.886961] Code: 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb bb 0f 1f 80 00 00 00 00 64 8b 04 25 18 8
[   26.889355] RSP: 002b:00007ffc3026c138 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[   26.890335] RAX: ffffffffffffffda RBX: 0000000000422600 RCX: 00007f56ae533563
[   26.891258] RDX: 0000000000002000 RSI: 00007f56ae42a000 RDI: 0000000000000015
[   26.892206] RBP: 00007f56ae60a580 R08: 0000000000000000 R09: 00007ffc3026ba80
[   26.893231] R10: 00000000000003cb R11: 0000000000000246 R12: 0000000000002000
[   26.894077] R13: 00007f56ae42a000 R14: 0000000000000015 R15: 0000000000000001
[   26.895141] Mem-Info:
[   26.895441] active_anon:3997 inactive_anon:4284 isolated_anon:0
[   26.895441]  active_file:0 inactive_file:0 isolated_file:0
[   26.895441]  unevictable:0 dirty:0 writeback:0 unstable:0
[   26.895441]  slab_reclaimable:4267 slab_unreclaimable:385849
[   26.895441]  mapped:913 shmem:7230 pagetables:205 bounce:0
[   26.895441]  free:5770 free_pcp:737 free_cma:0
[   26.899022] Node 0 active_anon:15988kB inactive_anon:17136kB active_file:0kB inactive_file:0kB unevicts
[   26.902008] Node 0 DMA free:6340kB min:444kB low:552kB high:660kB reserved_highatomic:2048KB active_anB
[   26.905162] lowmem_reserve[]: 0 1548 1548 1548 1548
[   26.905737] Node 0 DMA32 free:16612kB min:44608kB low:55760kB high:66912kB reserved_highatomic:18432KBB
[   26.909330] lowmem_reserve[]: 0 0 0 0 0
[   26.909856] Node 0 DMA: 1*4kB (U) 0*8kB 0*16kB 0*32kB 1*64kB (H) 1*128kB (H) 0*256kB 0*512kB 0*1024kB B
[   26.911422] Node 0 DMA32: 45*4kB (ME) 18*8kB (UME) 4*16kB (UME) 11*32kB (UM) 3*64kB (M) 2*128kB (UM) 1B
[   26.913285] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB
[   26.914279] Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
[   26.915231] 7230 total pagecache pages
[   26.915672] 0 pages in swap cache
[   26.916068] Swap cache stats: add 0, delete 0, find 0/0
[   26.916666] Free swap  = 0kB
[   26.917006] Total swap = 0kB
[   26.917345] 524156 pages RAM
[   26.917686] 0 pages HighMem/MovableOnly
[   26.918130] 115119 pages reserved
Signature · 2 lines
Thank you,
Richard.
#5 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

In reply to Jan Stancek

Hi,

Quoted 7 lines
Quoted 4 lines

Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

I haven't spotted potential issue while looking at kernel code, will test the patch just to be sure.

+1 reproduced kernel oops on 5.7.0-rc5-1.g298ea3d from openSUSE Tumbleweed, but when running with -i100 (=> this fix greatly reduces the problem, but still possible to reproduce)

Kind regards,
Petr

[27048.459612] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [kworker/u16:10:10487]
[27048.459615] Modules linked in: slcan slip slhc uas usb_storage vhost_net vhost tap vhost_iotlb ccm rfcomm fuse xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_nat iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables bpfilter tun bridge stp llc af_packet cmac algif_hash algif_skcipher af_alg bnep dmi_sysfs msr xfs dm_crypt cdc_ether usbnet snd_usb_audio r8152 snd_usbmidi_lib snd_rawmidi snd_seq_device mii uvcvideo btusb videobuf2_vmalloc x86_pkg_temp_thermal intel_powerclamp videobuf2_memops btrtl videobuf2_v4l2 btbcm coretemp videobuf2_common btintel btrfs bluetooth videodev kvm_intel blake2b_generic xor snd_hda_codec_hdmi ecdh_generic ecc mc joydev kvm iwlmvm raid6_pq irqbypass iTCO_wdt libcrc32c iTCO_vendor_support snd_hda_codec_realtek hid_multitouch mac80211 mei_hdcp mei_wdt intel_rapl_msr dell_rbtn crct10dif_pclmul
[27048.459667]  snd_hda_codec_generic crc32_pclmul dell_laptop ledtrig_audio intel_hid snd_hda_intel ghash_clmulni_intel dell_smm_hwmon libarc4 snd_intel_dspcfg aesni_intel snd_hda_codec crypto_simd cryptd glue_helper snd_hda_core iwlwifi snd_hwdep snd_pcm dell_wmi dell_smbios dcdbas snd_timer snd pcspkr sparse_keymap dell_wmi_descriptor wmi_bmof intel_wmi_thunderbolt cfg80211 i2c_i801 soundcore mei_me rfkill mei processor_thermal_device intel_lpss_pci intel_rapl_common intel_lpss idma64 intel_pch_thermal intel_soc_dts_iosf thermal fan int3403_thermal dell_smo8800 acpi_pad int3402_thermal int3400_thermal int340x_thermal_zone acpi_thermal_rel ac tiny_power_button nfsd auth_rpcgss nfs_acl lockd grace sunrpc hid_logitech_hidpp hid_logitech_dj hid_generic usbhid i915 nouveau rtsx_pci_sdmmc mmc_core ttm i2c_algo_bit drm_kms_helper xhci_pci xhci_hcd syscopyarea sysfillrect sysimgblt fb_sys_fops mxm_wmi cec rc_core crc32c_intel drm usbcore serio_raw rtsx_pci battery i2c_hid video wmi button
[27048.459695]  dm_mirror dm_region_hash dm_log sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua
[27048.459700] CPU: 1 PID: 10487 Comm: kworker/u16:10 Kdump: loaded Tainted: G          I       5.7.0-rc5-1.g298ea3d-default #1 openSUSE Tumbleweed (unreleased)
[27048.459701] Hardware name: Dell Inc. Precision 5510/0N8J4R, BIOS 1.2.13 08/08/2016
[27048.459705] Workqueue: events_unbound flush_to_ldisc
[27048.459709] RIP: 0010:slip_receive_buf+0xfc/0x2a0 [slip]
[27048.459710] Code: 10 48 83 80 60 01 00 00 01 f0 80 8b 88 00 00 00 04 41 83 ec 01 41 83 fc ff 0f 85 5f ff ff ff 48 83 c4 08 5b 5d 41 5c 41 5e c3 <3c> dc 0f 84 44 01 00 00 77 24 3c c0 0f 84 f3 00 00 00 3c db 75 2e
[27048.459711] RSP: 0018:ffffb7f022757de0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
[27048.459713] RAX: 000000000000005f RBX: ffff90a8d8e4d900 RCX: 0000000000000e00
[27048.459713] RDX: 0000000000000004 RSI: ffff90a8d959a4b0 RDI: ffff90a902d76400
[27048.459714] RBP: 0000000000000000 R08: ffffffffc1a9c000 R09: ffffffffb4871d01
[27048.459715] R10: ffff90a8d959f000 R11: 0000000000000001 R12: 0000000000000970
[27048.459716] R13: 0000000000000000 R14: 00000000ffffffc0 R15: ffff90a8d959a020
[27048.459717] FS:  0000000000000000(0000) GS:ffff90affdc40000(0000) knlGS:0000000000000000
[27048.459718] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[27048.459718] CR2: 000034ca2fb92400 CR3: 000000067380a001 CR4: 00000000003626e0
[27048.459719] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[27048.459720] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[27048.459720] Call Trace:
[27048.459725]  tty_ldisc_receive_buf+0x41/0x50
[27048.459727]  tty_port_default_receive_buf+0x3d/0x60
[27048.459729]  flush_to_ldisc+0x8a/0xd0
[27048.459732]  process_one_work+0x1e3/0x3b0
[27048.459735]  worker_thread+0x4d/0x3f0
[27048.459739]  kthread+0xf9/0x130
[27048.459741]  ? process_one_work+0x3b0/0x3b0
[27048.459742]  ? kthread_park+0x90/0x90
[27048.459744]  ret_from_fork+0x35/0x40
#6 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

Hi,

Quoted 13 lines · Petr Vorel

Hi,

Quoted 7 lines
Quoted 4 lines

Sounds reasonable, also hope it's the last patch. :-)

@Jan do you want to test this as well, or should I apply and proceed with the release?

I haven't spotted potential issue while looking at kernel code, will test the patch just to be sure.

+1 reproduced kernel oops on 5.7.0-rc5-1.g298ea3d from openSUSE Tumbleweed, but when running with -i100 (=> this fix greatly reduces the problem, but still possible to reproduce)

Quoted 6 lines

Kind regards,
Petr

[27048.459612] watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [kworker/u16:10:10487]
[27048.459615] Modules linked in: slcan slip slhc uas usb_storage vhost_net vhost tap vhost_iotlb ccm rfcomm fuse xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp ip6table_mangle ip6table_nat iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables bpfilter tun bridge stp llc af_packet cmac algif_hash algif_skcipher af_alg bnep dmi_sysfs msr xfs dm_crypt cdc_ether usbnet snd_usb_audio r8152 snd_usbmidi_lib snd_rawmidi snd_seq_device mii uvcvideo btusb videobuf2_vmalloc x86_pkg_temp_thermal intel_powerclamp videobuf2_memops btrtl videobuf2_v4l2 btbcm coretemp videobuf2_common btintel btrfs bluetooth videodev kvm_intel blake2b_generic xor snd_hda_codec_hdmi ecdh_generic ecc mc joydev kvm iwlmvm raid6_pq irqbypass iTCO_wdt libcrc32c iTCO_vendor_support snd_hda_codec_realtek hid_multitouch mac80211 mei_hdcp mei_wdt intel_rapl_msr dell_rbtn crct10dif_pclmul
[27048.459667]  snd_hda_codec_generic crc32_pclmul dell_laptop ledtrig_audio intel_hid snd_hda_intel ghash_clmulni_intel dell_smm_hwmon libarc4 snd_intel_dspcfg aesni_intel snd_hda_codec crypto_simd cryptd glue_helper snd_hda_core iwlwifi snd_hwdep snd_pcm dell_wmi dell_smbios dcdbas snd_timer snd pcspkr sparse_keymap dell_wmi_descriptor wmi_bmof intel_wmi_thunderbolt cfg80211 i2c_i801 soundcore mei_me rfkill mei processor_thermal_device intel_lpss_pci intel_rapl_common intel_lpss idma64 intel_pch_thermal intel_soc_dts_iosf thermal fan int3403_thermal dell_smo8800 acpi_pad int3402_thermal int3400_thermal int340x_thermal_zone acpi_thermal_rel ac tiny_power_button nfsd auth_rpcgss nfs_acl lockd grace sunrpc hid_logitech_hidpp hid_logitech_dj hid_generic usbhid i915 nouveau rtsx_pci_sdmmc mmc_core ttm i2c_algo_bit drm_kms_helper xhci_pci xhci_hcd syscopyarea sysfillrect sysimgblt fb_sys_fops mxm_wmi cec rc_core crc32c_intel drm usbcore serio_raw rtsx_pci battery i2c_hid video wmi butt

on

Quoted 19 lines
[27048.459695]  dm_mirror dm_region_hash dm_log sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua
[27048.459700] CPU: 1 PID: 10487 Comm: kworker/u16:10 Kdump: loaded Tainted: G          I       5.7.0-rc5-1.g298ea3d-default #1 openSUSE Tumbleweed (unreleased)
[27048.459701] Hardware name: Dell Inc. Precision 5510/0N8J4R, BIOS 1.2.13 08/08/2016
[27048.459705] Workqueue: events_unbound flush_to_ldisc
[27048.459709] RIP: 0010:slip_receive_buf+0xfc/0x2a0 [slip]
[27048.459710] Code: 10 48 83 80 60 01 00 00 01 f0 80 8b 88 00 00 00 04 41 83 ec 01 41 83 fc ff 0f 85 5f ff ff ff 48 83 c4 08 5b 5d 41 5c 41 5e c3 <3c> dc 0f 84 44 01 00 00 77 24 3c c0 0f 84 f3 00 00 00 3c db 75 2e
[27048.459711] RSP: 0018:ffffb7f022757de0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
[27048.459713] RAX: 000000000000005f RBX: ffff90a8d8e4d900 RCX: 0000000000000e00
[27048.459713] RDX: 0000000000000004 RSI: ffff90a8d959a4b0 RDI: ffff90a902d76400
[27048.459714] RBP: 0000000000000000 R08: ffffffffc1a9c000 R09: ffffffffb4871d01
[27048.459715] R10: ffff90a8d959f000 R11: 0000000000000001 R12: 0000000000000970
[27048.459716] R13: 0000000000000000 R14: 00000000ffffffc0 R15: ffff90a8d959a020
[27048.459717] FS:  0000000000000000(0000) GS:ffff90affdc40000(0000) knlGS:0000000000000000
[27048.459718] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[27048.459718] CR2: 000034ca2fb92400 CR3: 000000067380a001 CR4: 00000000003626e0
[27048.459719] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[27048.459720] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[27048.459720] Call Trace:
[27048.459725]  tty_ldisc_receive_buf+0x41/0x50
Quoted 8 lines
[27048.459727]  tty_port_default_receive_buf+0x3d/0x60
[27048.459729]  flush_to_ldisc+0x8a/0xd0
[27048.459732]  process_one_work+0x1e3/0x3b0
[27048.459735]  worker_thread+0x4d/0x3f0
[27048.459739]  kthread+0xf9/0x130
[27048.459741]  ? process_one_work+0x3b0/0x3b0
[27048.459742]  ? kthread_park+0x90/0x90
[27048.459744]  ret_from_fork+0x35/0x40

Is there more to this? Do you get allocation failures as well? (no problem if not, I'm just curious, I don't think this is an issue unless it happens with N=1).

Signature · 2 lines
Thank you,
Richard.
#7 lore raw

PATCH 1/1 pty04: Avoid receiving packets from all interfaces

In reply to Richard Palethorpe

Hi,

Quoted 7 lines

Raw sockets receive all packets from all interfaces as soon as they are created. They don't need to be bound to one or more interfaces like I thought.

This creates the socket with a NULL packet type which appears to be unused in the Linux kernel and receives no packets. The protocol is then changed to ETH_P_ALL when binding to the netdevice we are interested in.

Quoted 6 lines

I assume it is impossible for a packet to have zero for its packet type. Most likely using ETH_P_LOOP would have been OK too, but I suppose that is really used by some hardware.

This also fixes various other problems that have been observed with this test. Such as memory allocation failures.

So we have lost a potential CVE reproducer :).

Thanks for the fix.

Kind regards,
Petr