diff options
author | Jonathon Reinhart <jonathon.reinhart@gmail.com> | 2021-04-12 00:24:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-04-12 13:27:11 -0700 |
commit | 31c4d2f160eb7b17cbead24dc6efed06505a3fee (patch) | |
tree | d95a8359a40bbc2151f3d2eacbb15e21f1c1f81f /tools/perf/scripts/python/export-to-sqlite.py | |
parent | a115d24a636e892ddd1ae58f8e23c78a0390cb68 (diff) |
net: Ensure net namespace isolation of sysctls
This adds an ensure_safe_net_sysctl() check during register_net_sysctl()
to validate that sysctl table entries for a non-init_net netns are
sufficiently isolated. To be netns-safe, an entry must adhere to at
least (and usually exactly) one of these rules:
1. It is marked read-only inside the netns.
2. Its data pointer does not point to kernel/module global data.
An entry which fails both of these checks is indicative of a bug,
whereby a child netns can affect global net sysctl values.
If such an entry is found, this code will issue a warning to the kernel
log, and force the entry to be read-only to prevent a leak.
To test, simply create a new netns:
$ sudo ip netns add dummy
As it sits now, this patch will WARN for two sysctls which will be
addressed in a subsequent patch:
- /proc/sys/net/netfilter/nf_conntrack_max
- /proc/sys/net/netfilter/nf_conntrack_expect_max
Signed-off-by: Jonathon Reinhart <Jonathon.Reinhart@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions