lkml.org 
[lkml]   [2010]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/7] KEYS: Fix an RCU warning in the reading of user keys
Date
Serge E. Hallyn <serue@us.ibm.com> wrote:

> heck it also serves to document it a bit, as looking at the fn
> itself it's not clear that it is called under key->sem.

Give or take the banner comment on user_read() where it states this explicitly:

/*
* read the key data
* - the key's semaphore is read-locked
*/
long user_read(const struct key *key, char __user *buffer, size_t buflen)
and Documentation/keys.txt where it also states this explicitly:

(*) long (*read)(const struct key *key, char __user *buffer, size_t buflen);

...

This method will be called with the key's semaphore read-locked. This will
prevent the key's payload changing. It is not necessary to use RCU locking
when accessing the key's payload. It is safe to sleep in this method, such
as might happen when the userspace buffer is accessed.

:-)

David

David


\
 
 \ /
  Last update: 2010-05-04 14:51    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site