Hi. Thank you very much for the patch and Arch package.
The linux-hardened config uses:
CONFIG_CMDLINE="pti=on page_alloc.shuffle=1"
I would like to propose extending this with the following set of options (including those two):
init_on_alloc=1
init_on_free=1
l1tf=full,force
lockdown=integrity
lsm=lockdown,yama
mds=full,nosmt
nosmt=force
page_alloc.shuffle=1
page_poison=1
pti=on
slab_nomerge
slub_debug=FZP
spec_store_bypass_disable=on
spectre_v2=on
tsx=off
vsyscall=none
A few of these options are redundant with the kernel config, but there's no harm in having them listed here. If anything, it makes the patch easier to understand for non-programmers in my opinion.
Notably, upstream's default for the spec_store_bypass_disable vulnerability is incomplete and unsafe. It needs to be explicitly turned on here. Same with the MDS fix since it requires disabling hyperthreading. Since this is linux-hardened and not linux-quickened, I think security should take priority.
Second, I'm using the following sysctl settings and wanted to suggest any/all of them for inclusion as defaults:
dev.tty.ldisc_autoload=0
fs.protected_fifos=2
fs.protected_hardlinks=1
fs.protected_regular=2
fs.protected_symlinks=1
fs.suid_dumpable=0
kernel.dmesg_restrict=1
kernel.kexec_load_disabled=1
kernel.kptr_restrict=2
kernel.perf_event_paranoid=3
kernel.randomize_va_space=2
kernel.sysrq=0
kernel.tiocsti_restrict=1
kernel.unprivileged_bpf_disabled=1
kernel.unprivileged_userns_clone=0
kernel.yama.ptrace_scope=3
net.core.bpf_jit_harden=2
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.all.shared_media=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.default.shared_media=0
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.ip_forward=0
net.ipv4.tcp_rfc1337=1
net.ipv4.tcp_sack=0
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=0
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0
vm.mmap_min_addr=65536
vm.mmap_rnd_bits=32
vm.mmap_rnd_compat_bits=16
vm.unprivileged_userfaultfd=0
Some of them like kernel.tiocsti_restrict, kernel.dmesg_restrict, vm.unprivileged_userfaultfd, and so on seem to be compiled in by default with the Arch package's kernel config. I'm not savvy enough to "de-duplicate" the whole list, so I'm including it for completeness' sake.
Alternatively, the linux-hardened package could also include an /etc/sysctl.d/99-linux-hardened.conf file. That would be neat.
Last, a question: I noticed the net.ipv4.tcp_simult_connect sysctl was committed but it doesn't seem to work for me in the latest version.
Thanks for your time.
Hi. Thank you very much for the patch and Arch package.
The linux-hardened config uses:
CONFIG_CMDLINE="pti=on page_alloc.shuffle=1"
I would like to propose extending this with the following set of options (including those two):
init_on_alloc=1
init_on_free=1
l1tf=full,force
lockdown=integrity
lsm=lockdown,yama
mds=full,nosmt
nosmt=force
page_alloc.shuffle=1
page_poison=1
pti=on
slab_nomerge
slub_debug=FZP
spec_store_bypass_disable=on
spectre_v2=on
tsx=off
vsyscall=none
A few of these options are redundant with the kernel config, but there's no harm in having them listed here. If anything, it makes the patch easier to understand for non-programmers in my opinion.
Notably, upstream's default for the spec_store_bypass_disable vulnerability is incomplete and unsafe. It needs to be explicitly turned on here. Same with the MDS fix since it requires disabling hyperthreading. Since this is linux-hardened and not linux-quickened, I think security should take priority.
Second, I'm using the following sysctl settings and wanted to suggest any/all of them for inclusion as defaults:
dev.tty.ldisc_autoload=0
fs.protected_fifos=2
fs.protected_hardlinks=1
fs.protected_regular=2
fs.protected_symlinks=1
fs.suid_dumpable=0
kernel.dmesg_restrict=1
kernel.kexec_load_disabled=1
kernel.kptr_restrict=2
kernel.perf_event_paranoid=3
kernel.randomize_va_space=2
kernel.sysrq=0
kernel.tiocsti_restrict=1
kernel.unprivileged_bpf_disabled=1
kernel.unprivileged_userns_clone=0
kernel.yama.ptrace_scope=3
net.core.bpf_jit_harden=2
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.all.accept_source_route=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.all.shared_media=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.default.shared_media=0
net.ipv4.icmp_ignore_bogus_error_responses=1
net.ipv4.ip_forward=0
net.ipv4.tcp_rfc1337=1
net.ipv4.tcp_sack=0
net.ipv4.tcp_syncookies=1
net.ipv4.tcp_timestamps=0
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0
vm.mmap_min_addr=65536
vm.mmap_rnd_bits=32
vm.mmap_rnd_compat_bits=16
vm.unprivileged_userfaultfd=0
Some of them like kernel.tiocsti_restrict, kernel.dmesg_restrict, vm.unprivileged_userfaultfd, and so on seem to be compiled in by default with the Arch package's kernel config. I'm not savvy enough to "de-duplicate" the whole list, so I'm including it for completeness' sake.
Alternatively, the linux-hardened package could also include an /etc/sysctl.d/99-linux-hardened.conf file. That would be neat.
Last, a question: I noticed the net.ipv4.tcp_simult_connect sysctl was committed but it doesn't seem to work for me in the latest version.
Thanks for your time.