From owner-freebsd-bugs@freebsd.org Wed Dec 4 04:02:49 2019 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7626C1C853B for ; Wed, 4 Dec 2019 04:02:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 47SQDT2Zwfz4MST for ; Wed, 4 Dec 2019 04:02:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 589AF1C853A; Wed, 4 Dec 2019 04:02:49 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5851F1C8539 for ; Wed, 4 Dec 2019 04:02:49 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SQDT1f8tz4MSS for ; Wed, 4 Dec 2019 04:02:49 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1CD54225DA for ; Wed, 4 Dec 2019 04:02:49 +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 xB442mJS077045 for ; Wed, 4 Dec 2019 04:02:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id xB442mDT077044 for bugs@FreeBSD.org; Wed, 4 Dec 2019 04:02:48 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 242415] Running sockstat as underprivileged user panics the OS when using pf Date: Wed, 04 Dec 2019 04:02:48 +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: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: mshirk@daemon-security.com 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 attachments.created 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 MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 04:02:49 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242415 Bug ID: 242415 Summary: Running sockstat as underprivileged user panics the OS when using pf Product: Base System Version: CURRENT Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: mshirk@daemon-security.com Created attachment 209677 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D209677&action= =3Dedit Crash dump from FreeBSD FreeBSD 13.0-CURRENT #0 r355121: Wed Nov 27 04:20:46 UTC 2019 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC Originally discovered on HardenedBSD, but the issue appears to occur when u= sing pf and running sockstat -4 as a non-root user. I know there has been some recent work to remove locks so I wanted to make sure to log this bug (Crash dump is attached) <118>Wed Dec 4 03:42:25 UTC 2019 <118>Dec 4 03:42:25 freebsd ntpd[16430]: error resolving pool 0.freebsd.pool.ntp.org: Name does not resolve (8) <118>Dec 4 03:42:27 freebsd login[37838]: ROOT LOGIN (root) ON ttyu0 lock order reversal: (sleepable after non-sleepable) 1st 0xfffff80017f327c0 tcpinp (tcpinp) @ /usr/src/sys/netinet/tcp_subr.c:2= 169 2nd 0xffffffff81c7e168 sysctl lock (sysctl lock) @ /usr/src/sys/kern/kern_sysctl.c:181 stack backtrace: #0 0xffffffff80c32a81 at witness_debugger+0x71 #1 0xffffffff80c327f1 at witness_checkorder+0xab1 #2 0xffffffff80bc054b at _rm_rlock_debug+0x13b #3 0xffffffff80bd59af at sysctl_root_handler_locked+0xcf #4 0xffffffff80bd4d0a at sysctl_root+0x20a #5 0xffffffff80bd53bb at userland_sysctl+0x17b #6 0xffffffff80bd5759 at kern___sysctlbyname+0x219 #7 0xffffffff80bd57ad at sys___sysctlbyname+0x2d #8 0xffffffff81064846 at amd64_syscall+0x2d6 #9 0xffffffff8103aa70 at fast_syscall_common+0x101 lock order reversal: (sleepable after non-sleepable) 1st 0xfffff80017f327c0 tcpinp (tcpinp) @ /usr/src/sys/netinet/tcp_subr.c:2= 169 2nd 0xfffff80019546070 vm map (user) (vm map (user)) @ /usr/src/sys/vm/vm_map.c:2927 stack backtrace: #0 0xffffffff80c32a81 at witness_debugger+0x71 #1 0xffffffff80c327f1 at witness_checkorder+0xab1 #2 0xffffffff80bcf687 at _sx_xlock+0x67 #3 0xffffffff80f0f8c8 at vm_map_unwire+0x68 #4 0xffffffff80bd544b at userland_sysctl+0x20b #5 0xffffffff80bd5759 at kern___sysctlbyname+0x219 #6 0xffffffff80bd57ad at sys___sysctlbyname+0x2d #7 0xffffffff81064846 at amd64_syscall+0x2d6 #8 0xffffffff8103aa70 at fast_syscall_common+0x101 userret: returning with the following locks held: shared rw tcpinp (tcpinp) r =3D 0 (0xfffff80017f327c0) locked @ /usr/src/sys/netinet/tcp_subr.c:2169 shared rw tcpinp (tcpinp) r =3D 0 (0xfffff80017f325d8) locked @ /usr/src/sys/netinet/tcp_subr.c:2169 shared rw tcpinp (tcpinp) r =3D 0 (0xfffff80017f32020) locked @ /usr/src/sys/netinet/tcp_subr.c:2169 shared rw tcpinp (tcpinp) r =3D 0 (0xfffff80017f323f0) locked @ /usr/src/sys/netinet/tcp_subr.c:2169 panic: witness_warn cpuid =3D 0 time =3D 1575430988 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0024766= 8f0 vpanic() at vpanic+0x17e/frame 0xfffffe0024766950 panic() at panic+0x43/frame 0xfffffe00247669b0 witness_warn() at witness_warn+0x413/frame 0xfffffe0024766a70 userret() at userret+0xc0/frame 0xfffffe0024766ac0 amd64_syscall() at amd64_syscall+0x543/frame 0xfffffe0024766bf0 fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0024766bf0 --- syscall (2, FreeBSD ELF64, sys_fork), rip =3D 0x8003ad85a, rsp =3D 0x7fffffffead8, rbp =3D 0x7fffffffeb80 --- KDB: enter: panic sysctl.conf #security.bsd.see_other_uids=3D0 security.bsd.see_other_uids=3D0 security.bsd.see_other_gids=3D0 security.bsd.see_jail_proc=3D0 security.bsd.unprivileged_read_msgbuf=3D0 security.bsd.unprivileged_proc_debug=3D0 kern.randompid=3D1 vfs.zfs.min_auto_ashift=3D12 rc.conf clear_tmp_enable=3D"YES" syslogd_flags=3D"-ss" sendmail_enable=3D"NONE" hostname=3D"freebsd" ifconfig_vtnet0=3D"DHCP" local_unbound_enable=3D"YES" sshd_enable=3D"YES" ntpdate_enable=3D"YES" ntpd_enable=3D"YES" # Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable dumpdev=3D"AUTO" zfs_enable=3D"YES" pf_enable=3D"YES" pflog_enable=3D"YES" pflog_flags=3D"-s 1500" ddb_enable=3D"yes" --=20 You are receiving this mail because: You are the assignee for the bug.=