public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Suzanne Wood <suzannew@cs.pdx.edu>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org, paulmck@us.ibm.com
Subject: Re: [RFC] install_session_keyring
Date: Mon, 03 Apr 2006 09:45:35 +0100	[thread overview]
Message-ID: <1279.1144053935@warthog.cambridge.redhat.com> (raw)
In-Reply-To: <200604020850.k328oUFC000624@baham.cs.pdx.edu>

Suzanne Wood <suzannew@cs.pdx.edu> wrote:

> In a study of the control flow graph dumps to check that 
> an rcu_assign_pointer() with a given argument type has 
> preceded a call to rcu_dereference(), I've come across 
> install_session_keyring() of security/keys/process_keys.c.  
> We note that although no rcu_read_lock() is in place 
> locally or in the function's kernel callers, siglock 
> likely addresses that.  While the rcu_dereference() would 
> indicate a desire for 'old' to persist, synchronize_rcu() 
> is called prior to key_put(old) which "disposes of 
> reference to a key."  The order of events with a use of 
> the copy of the pointer following synchronize_rcu() is 
> what I question.

Are you simply suggesting that the rcu_dereference() in:

	/* install the keyring */
       	spin_lock_irqsave(&tsk->sighand->siglock, flags);
       	old = rcu_dereference(tsk->signal->session_keyring);
       	rcu_assign_pointer(tsk->signal->session_keyring, keyring);
       	spin_unlock_irqrestore(&tsk->sighand->siglock, flags);

is unnecessary?

If so, I think you are right since the pointer is only changed with the
siglock held[*], and so modify/modify conflict isn't a problem and doesn't
need memory barriers.

[*] Apart from during the exit() cleanup, when I don't think this should be a
problem anyway.

David


  reply	other threads:[~2006-04-03  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  8:50 [RFC] install_session_keyring Suzanne Wood
2006-04-03  8:45 ` David Howells [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-04-03 16:11 Suzanne Wood
2006-04-03 19:07 ` David Howells
2006-04-04  2:13 Suzanne Wood
2006-04-04  9:10 ` David Howells

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=1279.1144053935@warthog.cambridge.redhat.com \
    --to=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@us.ibm.com \
    --cc=suzannew@cs.pdx.edu \
    /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