[lkml]   [2010]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/7] KEYS: Fix an RCU warning in the reading of user keys
Serge E. Hallyn <> 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.




 \ /
  Last update: 2010-05-04 14:51    [W:0.102 / U:36.424 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site