lkml.org 
[lkml]   [2013]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] efivars write(2) races
From
Date
On Fri, 2013-01-25 at 00:25 +0000, Al Viro wrote:
> 1) process A does write() on efivars file, reaches ->get_variable(),
> gets newdatasize set, drops efivars->lock and loses CPU before an attempt to
> grab ->i_mutex. process B comes and does the same thing, replacing the
> variable contents. Then it grabs ->i_mutex, updates size, drops ->i_mutex
> and buggers off. At which point A gets CPU back and proceeds to set size
> to whatever would be valid for its write. Only the value is bogus now...

Crap, yes. We'll have to jiggle the locking rules around to fix this
one.

> 2) what's to prevent EFI_NOT_FOUND being hit twice? Bad things
> will obviously happen in that case...

I'm not sure which execution path will trigger this? Oh, if we're
spinning for the spinlock in efivarfs_unlink() while another process
does a delete via efivarfs_file_write()? Yeah, that's gonna cause some
tears.

Thanks, Al.



\
 
 \ /
  Last update: 2013-01-25 14:21    [W:0.063 / U:53.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site