kptr_restrict for hiding kernel pointers from unprivileged users
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 1292385983.9764.5.camel@Dan
Eugene Teo
Acked-byQuoted 19 lines · Dan Rosenberg
The below patch adds the %pK format specifier, the
CONFIG_SECURITY_KPTR_RESTRICTconfiguration option, and thekptr_restrictsysctl.The %pK format specifier is designed to hide exposed kernel pointers from unprivileged users, specifically via /proc interfaces. Its behavior depends on the
kptr_restrictsysctl, whose default value depends onCONFIG_SECURITY_KPTR_RESTRICT. Ifkptr_restrictis set to 0, no deviation from the standard %p behavior occurs. Ifkptr_restrictis set to 1, if the current user (intended to be a reader viaseq_printf(), etc.) does not haveCAP_SYSLOG(which is currently in the LSM tree), kernel pointers using %pK are printed as 0's. This was chosen over the default "(null)", which cannot be parsed by userland %p, which expects "(nil)".v2 improves checking for inappropriate context, on suggestion by Peter Zijlstra. Thanks to Thomas Graf for suggesting use of a centralized format specifier.
Quoted 8 lines
Signed-off-by Dan Rosenberg <[email protected]>CC James Morris <[email protected]>CC Eugene Teo <[email protected]>CC Kees Cook <[email protected]>CC Ingo Molnar <[email protected]>CC David S. Miller <[email protected]>
Eugene