public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-security-module@vger.kernel.org, jmorris@namei.org,
	eric.dumazet@gmail.com, tgraf@infradead.org,
	eugeneteo@kernel.org, kees.cook@canonical.com, mingo@elte.hu,
	davem@davemloft.net, a.p.zijlstra@chello.nl,
	akpm@linux-foundation.org, eparis@parisplace.org
Subject: Re: [PATCH v6] kptr_restrict for hiding kernel pointers
Date: Wed, 22 Dec 2010 15:13:56 -0800	[thread overview]
Message-ID: <1293059636.26543.21.camel@Joe-Laptop> (raw)
In-Reply-To: <1293058439.9820.317.camel@dan>

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;



      reply	other threads:[~2010-12-22 23:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-22 22:53 [PATCH v6] kptr_restrict for hiding kernel pointers Dan Rosenberg
2010-12-22 23:13 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1293059636.26543.21.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=drosenberg@vsecurity.com \
    --cc=eparis@parisplace.org \
    --cc=eric.dumazet@gmail.com \
    --cc=eugeneteo@kernel.org \
    --cc=jmorris@namei.org \
    --cc=kees.cook@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=tgraf@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox