From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 2/2] efi: Validate UEFI boot variables
Date: Wed, 2 May 2012 15:54:12 +0100 [thread overview]
Message-ID: <20120502145412.GA20058@srcf.ucam.org> (raw)
In-Reply-To: <1335930906.8274.97.camel@deadeye>
On Wed, May 02, 2012 at 04:55:06AM +0100, Ben Hutchings wrote:
> This validation is crap; you're not accounting for the size of the node
> or invalid lengths. Try:
Good catch.
> Isn't this slightly too restrictive? The '& 0xff' results in many
> non-ASCII characters aliasing hex digits and potentially causes a
> variable to be validated as if it was special. I would think the
> correct condition is:
Mm. Yeah, I guess that should probably be permitted.
> if (var->VariableName[i] > 127 ||
> hex_to_bin(var->VariableName[i]) < 0)
>
> Presumably the variable should also be ignored if there are any more
> characters after the 4 hex digits?
The spec doesn't permit any such names, so I don't think it makes any
difference in practice. But in theory, we should probably either
explicitly permit or reject them rather than treating them as if they're
boot variables.
> > + /* A valid entry must be at least 6 bytes */
> > + if (len < 6)
> > + return false;
>
> Surely 8 bytes - otherwise you don't even have space for the
> description's null terminator.
Yes, I guess that could trip things up.
> > + filepathlength = buffer[4] | buffer[5] << 8;
> > +
> > + /*
> > + * There's no stored length for the description, so it has to be
> > + * found by hand
> > + */
> > + desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len) + 2;
> [...]
>
> Second argument should be len - 6.
Sure.
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2012-05-02 14:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 20:11 [PATCH 1/2] efi: Add new variable attributes Matthew Garrett
2012-04-30 20:11 ` [PATCH 2/2] efi: Validate UEFI boot variables Matthew Garrett
2012-05-01 0:00 ` Shea Levy
2012-05-01 0:31 ` Matthew Garrett
2012-05-02 3:55 ` Ben Hutchings
2012-05-02 14:54 ` Matthew Garrett [this message]
2012-04-30 22:33 ` [PATCH 1/2] efi: Add new variable attributes Linus Torvalds
-- strict thread matches above, loose matches on Subject: below --
2012-02-16 13:58 Matthew Garrett
2012-02-16 13:58 ` [PATCH 2/2] efi: Validate UEFI boot variables Matthew Garrett
2012-02-16 14:27 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120502145412.GA20058@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=ben@decadent.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox