Re: [RFC] efivars write(2) races

2013-01-28 Thread Lingzhu Xiang
On 01/28/2013 08:38 PM, Matt Fleming wrote: > On Mon, 2013-01-28 at 10:38 +0800, Lingzhu Xiang wrote: >> On 01/25/2013 09:18 PM, Matt Fleming wrote: 4. EFI_VARIABLE_APPEND_WRITE with EFI_OUT_OF_RESOURCES truncates size but you can still read its content. >>> >>> I'm not sure wh

Re: [RFC] efivars write(2) races

2013-01-28 Thread Matt Fleming
On Mon, 2013-01-28 at 10:38 +0800, Lingzhu Xiang wrote: > On 01/25/2013 09:18 PM, Matt Fleming wrote: > >> 4. EFI_VARIABLE_APPEND_WRITE with EFI_OUT_OF_RESOURCES truncates size but > >> you > >> can still read its content. > > > > I'm not sure what you mean by this. Could you please explain? >

Re: [RFC] efivars write(2) races

2013-01-27 Thread Lingzhu Xiang
On 01/25/2013 09:18 PM, Matt Fleming wrote: 4. EFI_VARIABLE_APPEND_WRITE with EFI_OUT_OF_RESOURCES truncates size but you can still read its content. I'm not sure what you mean by this. Could you please explain? Oops, this one is incorrect. I was testing EFI_VARIABLE_APPEND_WRITE using th

Re: [RFC] efivars write(2) races

2013-01-25 Thread Matt Fleming
On Fri, 2013-01-25 at 11:50 +0800, Lingzhu Xiang wrote: > On 01/25/2013 08:25 AM, 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 doe

Re: [RFC] efivars write(2) races

2013-01-25 Thread Matt Fleming
On Fri, 2013-01-25 at 00:25 +, 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

Re: [RFC] efivars write(2) races

2013-01-24 Thread Lingzhu Xiang
On 01/25/2013 08:25 AM, 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

[RFC] efivars write(2) races

2013-01-24 Thread Al Viro
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_mute