The patch titled kptr_restrict-for-hiding-kernel-pointers-v7 has been added to the -mm tree. Its filename is kptr_restrict-for-hiding-kernel-pointers-v7.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: kptr_restrict-for-hiding-kernel-pointers-v7 From: Dan Rosenberg <drosenberg@xxxxxxxxxxxxx> v7 moves the extern to printk.h and cleans up the conditional statements based on the suggestions of Joe Perches. Signed-off-by: Dan Rosenberg <drosenberg@xxxxxxxxxxxxx> Cc: James Morris <jmorris@xxxxxxxxx> Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx> Cc: Thomas Graf <tgraf@xxxxxxxxxxxxx> Cc: Eugene Teo <eugeneteo@xxxxxxxxxx> Cc: Kees Cook <kees.cook@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Cc: Eric Paris <eparis@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/kernel.h | 2 -- include/linux/printk.h | 1 + lib/vsprintf.c | 11 ++++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff -puN include/linux/kernel.h~kptr_restrict-for-hiding-kernel-pointers-v7 include/linux/kernel.h --- a/include/linux/kernel.h~kptr_restrict-for-hiding-kernel-pointers-v7 +++ a/include/linux/kernel.h @@ -216,8 +216,6 @@ extern int sscanf(const char *, const ch extern int vsscanf(const char *, const char *, va_list) __attribute__ ((format (scanf, 2, 0))); -extern int kptr_restrict; /* for sysctl */ - extern int get_option(char **str, int *pint); extern char *get_options(const char *str, int nints, int *ints); extern unsigned long long memparse(const char *ptr, char **retptr); diff -puN include/linux/printk.h~kptr_restrict-for-hiding-kernel-pointers-v7 include/linux/printk.h --- a/include/linux/printk.h~kptr_restrict-for-hiding-kernel-pointers-v7 +++ a/include/linux/printk.h @@ -83,6 +83,7 @@ extern bool printk_timed_ratelimit(unsig extern int printk_delay_msec; extern int dmesg_restrict; +extern int kptr_restrict; /* * Print a one-time message (analogous to WARN_ONCE() et al): diff -puN lib/vsprintf.c~kptr_restrict-for-hiding-kernel-pointers-v7 lib/vsprintf.c --- a/lib/vsprintf.c~kptr_restrict-for-hiding-kernel-pointers-v7 +++ a/lib/vsprintf.c @@ -1049,13 +1049,10 @@ char *pointer(const char *fmt, char *buf return string(buf, end, "pK-error", spec); } - else if (!kptr_restrict) - break; /* %pK does not obscure pointers */ - - else if ((kptr_restrict != 2) && - has_capability_noaudit(current, CAP_SYSLOG)) - break; /* privileged apps expose pointers, - unless kptr_restrict is 2 */ + else if ((kptr_restrict == 0) || + (kptr_restrict == 1 && + has_capability_noaudit(current, CAP_SYSLOG))) + break; if (spec.field_width == -1) { spec.field_width = 2 * sizeof(void *); _ Patches currently in -mm which might be from drosenberg@xxxxxxxxxxxxx are linux-next.patch kptr_restrict-for-hiding-kernel-pointers-from-unprivileged-users.patch kptr_restrict-for-hiding-kernel-pointers-from-unprivileged-users-fix.patch kptr_restrict-for-hiding-kernel-pointers-v4.patch kptr_restrict-for-hiding-kernel-pointers-v6.patch kptr_restrict-for-hiding-kernel-pointers-v7.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html