From nobody Wed Oct 2 20:39:52 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XJmrn0YqHz5Y46W for ; Wed, 02 Oct 2024 20:39:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XJmrm5f8Zz4hZj for ; Wed, 2 Oct 2024 20:39:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727901592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BUrmbRIXFrNUi50mWQXggs25D4+wo1jNzrwMiAn+efw=; b=K55M7tuIBpbg7z1uBWagYMXniAdEwgHYNBq3JhavXiL8n4ef4h0h6snFlL/mh54IRY+Ajp L8mt4oYGmKlKD9zgXSObGDPWTkH1Esy2yag/oLHi7QN731JlsSsiT3SZAzW7Y0XzqeKmfw iseH+L1F7v/dSAP8R4YccFGDAqfwebrysMhXOgy2nBRjgsU9J3ycHGmOETQnXAjOK+FVL3 tRNvtkECgdDmYFEERNOmNzIAe8ERUpQdZn4mo+MV+Z2KCLMwDji0bfcqTnBscd0Qq3NmKd ZjAJCJpOVHvF7aD+O3OjrVH6T0zC+pt9R1G8FLemw9BiGsyds6IOKrjitsaZYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727901592; a=rsa-sha256; cv=none; b=A+PvkmbtQLrFcAJewPBwXTw+cIBLiHv9BiTfWTtuVZfO9d6h64gIMO/lS2tRIbt7Id1pR8 3UGVYgV/jIXEzGcWc5QqMMCfZ4rYO3Po7QBXCL66EYEjY4KImqZEDjxR+ZhHizCz4ybA+7 M2kamm87EvCwali28lTbuqYu3A6bBQyfdd7IeRu/4PxGRjd8Qk2myYVVgvv/vboedXFk0D Qpnwaf/MEG9sf4lIoHqUOaB7ERaWlmjP1ogporEzS7d9gaehal/MdJd2ToicM4F6yONQ88 eL0GwGc0PlkHsf2OJo7MsqAfZ2y9duqRxlR8Y8pBFWE/sRpG1dGGkXG7W0fOuQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XJmrm4kfvzLkn for ; Wed, 2 Oct 2024 20:39:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 492KdqXT078836 for ; Wed, 2 Oct 2024 20:39:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 492Kdq8o078835 for bugs@FreeBSD.org; Wed, 2 Oct 2024 20:39:52 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 281825] SDT tracepoints are not cleaned up when a module is unloaded Date: Wed, 02 Oct 2024 20:39:52 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jhb@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D281825 Bug ID: 281825 Summary: SDT tracepoints are not cleaned up when a module is unloaded Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: jhb@FreeBSD.org Kernel modules may reference SDT probes defined in another module (or the kernel itself). A specific example of this are all the mbuf probes in for functions like m_get(). Kernel modules which use these in= line functions will include a tracepoint that gets registered during kldload in sdt_kld_load_probes. However, sdt_kldunload_try() doesn't cleanup any of t= he state initialized in sdt_kld_load_probes, only the state initialized in set_kld_load_providers(). As a result, this can leave dangling pointers (e= .g. in the tp->probe->tracepoint_list) when a module is unloaded. The panic I've seen is when re-loading a previously-unloaded module that crashes in sdt_kld_load_probes() when it walks off an invalid pointer in the STAILQ_INSERT_TAIL of the tracepoint_list. However, that panic is a bit finicky and not easy to reproduce. A simpler reproducer is below: kldload sdt kldload nvmft kldunload nvmft dtrace -n m-get Panic: Fatal trap 12: page fault while in kernel mode cpuid =3D 6; apic id =3D 06 fault virtual address =3D 0xffffffff8283d008 fault code =3D supervisor read data, page not present instruction pointer =3D 0x20:0xffffffff82816b96 stack pointer =3D 0x28:0xfffffe00dc1e9730 frame pointer =3D 0x28:0xfffffe00dc1e9740 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D resume, IOPL =3D 0 current process =3D 1115 (dtrace) rdi: 0000000000000001 rsi: ffffffff80f3a4fc rdx: 000000000000000f rcx: 0000000080040033 r8: 0000000000000016 r9: 00000000000f4240 rax: 0000000080050033 rbx: fffffe00dc1e98e8 rbp: fffffe00dc1e9740 r10: 0000000000000000 r11: 0000000000000000 r12: 0000000000000000 r13: ffffffff82816b20 r14: ffffffff8283d000 r15: 0000000000000000 trap number =3D 12 panic: page fault cpuid =3D 6 time =3D 1727901518 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00dc1e9= 400 vpanic() at vpanic+0x13f/frame 0xfffffe00dc1e9530 panic() at panic+0x43/frame 0xfffffe00dc1e9590 trap_fatal() at trap_fatal+0x40b/frame 0xfffffe00dc1e95f0 trap_pfault() at trap_pfault+0xa0/frame 0xfffffe00dc1e9660 calltrap() at calltrap+0x8/frame 0xfffffe00dc1e9660 --- trap 0xc, rip =3D 0xffffffff82816b96, rsp =3D 0xfffffe00dc1e9730, rbp = =3D 0xfffffe00dc1e9740 --- sdt_probe_update_cb() at sdt_probe_update_cb+0x76/frame 0xfffffe00dc1e9740 smp_rendezvous_action() at smp_rendezvous_action+0x9d/frame 0xfffffe00dc1e9= 780 smp_rendezvous_cpus() at smp_rendezvous_cpus+0x145/frame 0xfffffe00dc1e9840 smp_rendezvous() at smp_rendezvous+0x34/frame 0xfffffe00dc1e98d0 sdt_enable() at sdt_enable+0xae/frame 0xfffffe00dc1e9910 dtrace_ecb_create_enable() at dtrace_ecb_create_enable+0xee8/frame 0xfffffe00dc1e99a0 dtrace_match() at dtrace_match+0x444/frame 0xfffffe00dc1e9a80 dtrace_enabling_match() at dtrace_enabling_match+0xc8/frame 0xfffffe00dc1e9= b10 dtrace_ioctl() at dtrace_ioctl+0x178b/frame 0xfffffe00dc1e9c00 devfs_ioctl() at devfs_ioctl+0xd1/frame 0xfffffe00dc1e9c50 vn_ioctl() at vn_ioctl+0xbc/frame 0xfffffe00dc1e9cc0 devfs_ioctl_f() at devfs_ioctl_f+0x1e/frame 0xfffffe00dc1e9ce0 kern_ioctl() at kern_ioctl+0x286/frame 0xfffffe00dc1e9d40 sys_ioctl() at sys_ioctl+0x12d/frame 0xfffffe00dc1e9e00 amd64_syscall() at amd64_syscall+0x158/frame 0xfffffe00dc1e9f30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe00dc1e9f30 --- syscall (54, FreeBSD ELF64, ioctl), rip =3D 0xc9cf811a9fa, rsp =3D 0xc9ced0c5c28, rbp =3D 0xc9ced0c5c70 --- --=20 You are receiving this mail because: You are the assignee for the bug.=