Re: [PATCH 00/10] perf/uprobe: Optimize uprobes

From: Peter Zijlstra
Date: Wed Jul 10 2024 - 06:22:13 EST


On Tue, Jul 09, 2024 at 02:47:12PM -0700, Andrii Nakryiko wrote:
> Running in my local VM with debugging config, I'm getting the
> following. Please check if that's something new or it's just another
> symptom of the issues that Oleg pointed out already.
>
>
> [ 11.213834] ================================================
> [ 11.214225] WARNING: lock held when returning to user space!
> [ 11.214603] 6.10.0-rc6-gd3f5cbffe86b #1263 Tainted: G OE
> [ 11.215040] ------------------------------------------------
> [ 11.215426] urandom_read/2412 is leaving the kernel with locks still held!
> [ 11.215876] 1 lock held by urandom_read/2412:
> [ 11.216175] #0: ffffffff835ce8f0 (uretprobes_srcu){.+.+}-{0:0},
> at: srcu_read_lock+0x31/0x3f

Bah, I forgot the SRCU thing had lockdep on.

> [ 11.262797] ------------[ cut here ]------------
> [ 11.263162] refcount_t: underflow; use-after-free.
> [ 11.263474] WARNING: CPU: 1 PID: 2409 at lib/refcount.c:28
> refcount_warn_saturate+0x99/0xda
> [ 11.263995] Modules linked in: bpf_testmod(OE) aesni_intel(E)
> crypto_simd(E) floppy(E) cryptd(E) i2c_piix4(E) crc32c_intel(E)
> button(E) i2c_core(E) i6300esb(E) pcspkr(E) serio_raw(E)
> [ 11.265105] CPU: 1 PID: 2409 Comm: test_progs Tainted: G
> OE 6.10.0-rc6-gd3f5cbffe86b #1263
> [ 11.265740] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
> BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
> [ 11.266507] RIP: 0010:refcount_warn_saturate+0x99/0xda
> [ 11.266862] Code: 05 ba 29 1d 02 01 e8 e2 c0 b4 ff 0f 0b c3 80 3d
> aa 29 1d 02 00 75 53 48 c7 c7 20 59 50 82 c6 05 9a 29 1d 02 01 e8 c3
> c0 b4 ff <0f> 0b c3 80 3d 8a 29 1d 02 00 75 34 a
> [ 11.268099] RSP: 0018:ffffc90001fbbd60 EFLAGS: 00010282
> [ 11.268451] RAX: 0000000000000026 RBX: ffff88810f333000 RCX: 0000000000000027
> [ 11.268931] RDX: 0000000000000000 RSI: ffffffff82580a45 RDI: 00000000ffffffff
> [ 11.269417] RBP: ffff888105937818 R08: 0000000000000000 R09: 0000000000000000
> [ 11.269910] R10: 00000000756f6366 R11: 0000000063666572 R12: ffff88810f333030
> [ 11.270387] R13: ffffc90001fbbb80 R14: ffff888100535190 R15: dead000000000100
> [ 11.270870] FS: 00007fc938bd2d00(0000) GS:ffff88881f680000(0000)
> knlGS:0000000000000000
> [ 11.271363] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 11.271725] CR2: 000000000073a005 CR3: 00000001127d5004 CR4: 0000000000370ef0
> [ 11.272220] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> [ 11.272693] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> [ 11.273182] Call Trace:
> [ 11.273370] <TASK>
> [ 11.273518] ? __warn+0x8b/0x14d
> [ 11.273753] ? report_bug+0xdb/0x151
> [ 11.273997] ? refcount_warn_saturate+0x99/0xda
> [ 11.274326] ? handle_bug+0x3c/0x5b
> [ 11.274564] ? exc_invalid_op+0x13/0x5c
> [ 11.274831] ? asm_exc_invalid_op+0x16/0x20
> [ 11.275119] ? refcount_warn_saturate+0x99/0xda
> [ 11.275428] uprobe_unregister_nosync+0x61/0x7c
> [ 11.275768] __probe_event_disable+0x5d/0x7d
> [ 11.276069] probe_event_disable+0x50/0x58

This I'll have to stare at for a bit.

Thanks!