netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Dan Rosenberg <drosenberg@vsecurity.com>,
	linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] kptr_restrict for hiding kernel pointers from unprivileged users
Date: Fri, 10 Dec 2010 17:05:32 +0100	[thread overview]
Message-ID: <1291997132.13513.12.camel@laptop> (raw)
In-Reply-To: <1291865039.2795.46.camel@edumazet-laptop>

On Thu, 2010-12-09 at 04:23 +0100, Eric Dumazet wrote:
> > +             if (kptr_restrict) {
> > +                     if (in_interrupt())
> > +                             WARN(1, "%%pK used in interrupt context.\n");
> 
> So caller can not block BH ?
> 
> This seems wrong to me, please consider :
> 
> normal process context :
> 
> spin_lock_bh() ...
> 
> for (...)  
>         {xxx}printf( ...   "%pK"   ...)
> 
> spin_unlock_bh(); 

That's a bug in in_interrupt(), one I've been pointing out for a long
while. Luckily we recently grew the infrastructure to deal with it.

If you write it as: if (in_irq() || in_serving_softirq() || in_nmi())
you'll not trigger for the above example.

Ideally in_serving_softirq() wouldn't exist and in_softirq() would do
what in_server_softirq() does -- which would make it symmetric with the
hardirq functions -- but nobody has found time to audit all in_softirq()
users.



      parent reply	other threads:[~2010-12-10 16:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1291863926.2965.1.camel@Dan>
2010-12-09  3:23 ` [PATCH] kptr_restrict for hiding kernel pointers from unprivileged users Eric Dumazet
2010-12-09  3:26   ` Eric Dumazet
2010-12-09 11:51   ` Dan Rosenberg
2010-12-09 12:46     ` Dan Rosenberg
2010-12-09 13:30       ` Eric Dumazet
2010-12-10  2:45         ` Dan Rosenberg
2010-12-10 16:05   ` Peter Zijlstra [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=1291997132.13513.12.camel@laptop \
    --to=peterz@infradead.org \
    --cc=drosenberg@vsecurity.com \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).