running sysctl as non-privileged user causes segmentaion fault

Hi.

I found that running sysctl (58ae084c) as non-privileged user causes segmentaion fault.

$ id
uid=1000(vagrant) gid=1000(vagrant) groups=1000(vagrant)

$ /usr/local/sbin/sysctl -a
abi.vsyscall32 = 1
crypto.fips_enabled = 0
debug.exception-trace = 1
debug.kprobes-optimization = 1
debug.panic_on_rcu_stall = 0

... snip

fs.overflowuid = 65534
fs.pipe-max-size = 1048576
fs.pipe-user-pages-hard = 0
fs.pipe-user-pages-soft = 16384
Segmentation fault (core dumped)

$ /usr/local/sbin/sysctl net.ipv4.tcp_fastopen_key
Segmentation fault (core dumped)

$ /usr/local/sbin/sysctl -w vm.overcommit_ratio=0
Segmentation fault (core dumped)

GDB backtrace

Here is a backtrace of "/usr/local/sbin/sysctl net.ipv4.tcp_fastopen_key"

$ gdb /usr/local/sbin/sysctl
(gdb) r  net.ipv4.tcp_fastopen_key
(gdb) bt
#0  __GI__IO_setvbuf (fp=fp@entry=0x0, buf=0x606080 "16384\n6\n0\t0\t0\t0\t0\t0\n\n", mode=mode@entry=0, size=size@entry=131072) at iosetvbuf.c:42
#1  0x00000000004028c3 in ReadSetting (name=name@entry=0x63e5ba "fs/protected_hardlinks") at sysctl.c:226
#2  0x0000000000402ca0 in DisplayAll (path=path@entry=0x62e0d0 "/proc/sys/fs/") at sysctl.c:351
#3  0x0000000000402d55 in DisplayAll (path=path@entry=0x403b71 <PROC_PATH> "/proc/sys/") at sysctl.c:348
#4  0x000000000040191f in main (argc=0, argv=0x7fffffffe3f8) at sysctl.c:807

strace

$ strace /usr/local/sbin/sysctl net.ipv4.tcp_fastopen_key

...

munmap(0x7fc280971000, 4096)            = 0
stat("/proc/sys/net/ipv4/tcp_fastopen_key", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
open("/proc/sys/net/ipv4/tcp_fastopen_key", O_RDONLY) = -1 EACCES (Permission denied)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)