From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519Ab3A1Cii (ORCPT ); Sun, 27 Jan 2013 21:38:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751886Ab3A1Cig (ORCPT ); Sun, 27 Jan 2013 21:38:36 -0500 Message-ID: <5105E4A3.9040102@redhat.com> Date: Mon, 28 Jan 2013 10:38:27 +0800 From: Lingzhu Xiang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Matt Fleming CC: Al Viro , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, Jeremy Kerr Subject: Re: [RFC] efivars write(2) races References: <20130125002552.GC4503@ZenIV.linux.org.uk> <51020120.5000500@redhat.com> <1359119883.2496.156.camel@mfleming-mobl1.ger.corp.intel.com> In-Reply-To: <1359119883.2496.156.camel@mfleming-mobl1.ger.corp.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 this: printf "\x47\x00\x00\x00\x00" >test-1-$guid So it truncates the file before writing, but efivarfs figures out the right size afterwards. The size remains zero if the write fails. I should be using this for appending: printf "\x47\x00\x00\x00\x00" >>test-1-$guid