devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Anton Blanchard <anton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] Catch unsigned 32bit overflow when parsing flattened device tree offsets
Date: Fri, 19 Feb 2016 01:10:49 +1100	[thread overview]
Message-ID: <20160218141049.GM15224@voom.fritz.box> (raw)
In-Reply-To: <20160103093249.GF9329-JFWYtBTiNpwvqAi9XkHEEA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

On Sun, Jan 03, 2016 at 08:32:49PM +1100, David Gibson wrote:
> On Sun, Jan 03, 2016 at 08:43:35AM +1100, Anton Blanchard wrote:
> > We have a couple of checks of the form:
> > 
> >     if (offset+size > totalsize)
> >         die();
> > 
> > We need to check that offset+size doesn't overflow, otherwise the check
> > will pass, and we may access past totalsize.
> > 
> > Found with AFL.
> > 
> > Signed-off-by: Anton Blanchard <anton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
> > ---
> > 
> > I've attached an example device tree, do we want to add binary blobs
> > to the test suite?
> 
> I've generally avoided it, but I forget exactly why.  Usually I try to
> generate the testcases as dts and compile them, but I'm guessing this dtb is
> something that shouldn't be possible as good output from dtc.
> 
> It would be possible to construct it from test/trees.S, but just
> including the binary blob might be simpler.
> 
> Certainly I would like to include this testcase into the testsuite,
> one way or another.

I finally sorted this out and added this fix, plus a testcase to the
tree.

Btw, do you have the scripts you used to run AFL on dtc?  I'd love to
try it myself.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      parent reply	other threads:[~2016-02-18 14:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-02 21:43 [PATCH] Catch unsigned 32bit overflow when parsing flattened device tree offsets Anton Blanchard
2016-01-03  9:32 ` David Gibson
     [not found]   ` <20160103093249.GF9329-JFWYtBTiNpwvqAi9XkHEEA@public.gmane.org>
2016-02-18 14:10     ` David Gibson [this message]

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=20160218141049.GM15224@voom.fritz.box \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=anton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.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;
as well as URLs for NNTP newsgroup(s).