From: "Jan Beulich" Subject: Re: [PATCH] EFI: Fix getting EFI variable list on some systems Date: Tue, 10 Mar 2015 08:44:26 +0000 Message-ID: <54FEBCFA0200007800067E71@mail.emea.novell.com> References: <1425919679-22436-1-git-send-email-ross.lagerwall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1425919679-22436-1-git-send-email-ross.lagerwall@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ross Lagerwall Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 09.03.15 at 17:47, wrote: > Copy the entire output buffer to the guest because it may contain data beyond > the output size that the firmware requires on a subsequent > GetNextVariableName() call (e.g. a NULL character). > > The spec requires that on each call, "the previous results" be passed in. > > Without this change, the following (simplified) sequence would occur: > GetNextVariableName: in \0, out AdminPw\0, size 7 > GetNextVariableName: in AdminPw\0, out UserPw\0, size 6 > GetNextVariableName: in UserPww\0, NOT FOUND As such behavior is outside the specification, please name the system needing this workaround: The runtime services function is documented to update *VariableNameSize only upon EFI_BUFFER_TOO_SMALL. A code comment would also seem to be on order, as otherwise people like me might be tempted to undo this again, as it's sub-optimal code for spec conforming firmware. And to save me from having to do an incremental patch on top, you may want to consider switching to __copy_to_user() at once. Jan