Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Dec 2019 04:02:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242415] Running sockstat as underprivileged user panics the OS when using pf
Message-ID:  <bug-242415-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242415-227>