[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1293059636.26543.21.camel@Joe-Laptop>
Date: Wed, 22 Dec 2010 15:13:56 -0800
From: Joe Perches <joe@...ches.com>
To: Dan Rosenberg <drosenberg@...curity.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
linux-security-module@...r.kernel.org, jmorris@...ei.org,
eric.dumazet@...il.com, tgraf@...radead.org, eugeneteo@...nel.org,
kees.cook@...onical.com, mingo@...e.hu, davem@...emloft.net,
a.p.zijlstra@...llo.nl, akpm@...ux-foundation.org,
eparis@...isplace.org
Subject: Re: [PATCH v6] kptr_restrict for hiding kernel pointers
On Wed, 2010-12-22 at 17:53 -0500, Dan Rosenberg wrote:
> Add the %pK printk format specifier and
> the /proc/sys/kernel/kptr_restrict sysctl.
trivial comments.
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
[]
> @@ -201,6 +201,8 @@ extern int sscanf(const char *, const char *, ...)
> extern int vsscanf(const char *, const char *, va_list)
> __attribute__ ((format (scanf, 2, 0)));
>
> +extern int kptr_restrict; /* for sysctl */
I think this extern should go into printk.h
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
[]
> @@ -1035,6 +1038,30 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> return buf + vsnprintf(buf, end - buf,
> ((struct va_format *)ptr)->fmt,
> *(((struct va_format *)ptr)->va));
> + case 'K':
[]
> + 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 */
> +
I think this more readable as:
else if ((kptr_restrict == 0)) ||
(kptr_restrict == 1 &&
has_capability_noaudit(current, CAP_SYSLOG)))
break;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists