From: Brian Norris <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Cc: Shuah Khan <shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>,
Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"Luis R. Rodriguez" <mcgrof-IBi9RG/b67k@public.gmane.org>
Subject: Re: [PATCH 2/4] test: firmware_class: add asynchronous request trigger
Date: Wed, 9 Dec 2015 14:12:20 -0800 [thread overview]
Message-ID: <20151209221220.GB51175@google.com> (raw)
In-Reply-To: <CAGXu5jLGp315GdOWQyamD8awzrdZDFoNVWQozTFdjQAjrtRN0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Dec 09, 2015 at 02:05:17PM -0800, Kees Cook wrote:
> On Wed, Dec 9, 2015 at 1:48 PM, Brian Norris
> <computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > I was also thinking, since use-after-free isn't necessarily immediately
> > obvious (this worked fine in my testing), that maybe we could poison the
> > buffer before kfree()'ing? Like:
> >
> > name = ...;
> > len = strlen(name);
> >
> > ...
> >
> > rc = request_firmware_nowait(...);
> > if (rc) {
> > pr_info("...");
> > kfree(name);
> > goto out;
> > }
> > /*
> > * Clear out the name, to test for race conditions with the
> > * async request
> > */
> > memset(name, 0, len);
> > kfree(name);
>
> Hrm, well, I'm not against it, but I think running under KASan is
> probably the right way to find these things. But, might as well, just
> to notice any regressions.
Fair enough. The memset probably isn't that useful.
BTW, one reason I didn't notice my use-after-free is that the "use" was
under an error path that I didn't exercise. I need to remember to turn
my brain back on.
Brian
WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Kees Cook <keescook@chromium.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ming Lei <ming.lei@canonical.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
"Luis R. Rodriguez" <mcgrof@suse.com>
Subject: Re: [PATCH 2/4] test: firmware_class: add asynchronous request trigger
Date: Wed, 9 Dec 2015 14:12:20 -0800 [thread overview]
Message-ID: <20151209221220.GB51175@google.com> (raw)
In-Reply-To: <CAGXu5jLGp315GdOWQyamD8awzrdZDFoNVWQozTFdjQAjrtRN0w@mail.gmail.com>
On Wed, Dec 09, 2015 at 02:05:17PM -0800, Kees Cook wrote:
> On Wed, Dec 9, 2015 at 1:48 PM, Brian Norris
> <computersforpeace@gmail.com> wrote:
> > I was also thinking, since use-after-free isn't necessarily immediately
> > obvious (this worked fine in my testing), that maybe we could poison the
> > buffer before kfree()'ing? Like:
> >
> > name = ...;
> > len = strlen(name);
> >
> > ...
> >
> > rc = request_firmware_nowait(...);
> > if (rc) {
> > pr_info("...");
> > kfree(name);
> > goto out;
> > }
> > /*
> > * Clear out the name, to test for race conditions with the
> > * async request
> > */
> > memset(name, 0, len);
> > kfree(name);
>
> Hrm, well, I'm not against it, but I think running under KASan is
> probably the right way to find these things. But, might as well, just
> to notice any regressions.
Fair enough. The memset probably isn't that useful.
BTW, one reason I didn't notice my use-after-free is that the "use" was
under an error path that I didn't exercise. I need to remember to turn
my brain back on.
Brian
next prev parent reply other threads:[~2015-12-09 22:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 2:38 [PATCH 1/4] test: firmware_class: report errors properly on failure Brian Norris
2015-12-09 2:38 ` Brian Norris
2015-12-09 2:38 ` [PATCH 2/4] test: firmware_class: add asynchronous request trigger Brian Norris
2015-12-09 2:38 ` Brian Norris
2015-12-09 21:09 ` Kees Cook
2015-12-09 21:48 ` Brian Norris
[not found] ` <20151209214843.GA51175-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-12-09 22:05 ` Kees Cook
2015-12-09 22:05 ` Kees Cook
[not found] ` <CAGXu5jLGp315GdOWQyamD8awzrdZDFoNVWQozTFdjQAjrtRN0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-09 22:12 ` Brian Norris [this message]
2015-12-09 22:12 ` Brian Norris
2015-12-09 2:38 ` [PATCH 3/4] firmware: actually return NULL on failed request_firmware_nowait() Brian Norris
2015-12-09 2:38 ` Brian Norris
[not found] ` <1449628714-66641-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-09 4:01 ` Ming Lei
2015-12-09 4:01 ` Ming Lei
2015-12-09 21:13 ` Kees Cook
2015-12-09 2:38 ` [PATCH 4/4] selftests: firmware: add empty string and async tests Brian Norris
2015-12-09 2:38 ` Brian Norris
[not found] ` <1449628714-66641-4-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-09 21:10 ` Kees Cook
2015-12-09 21:10 ` Kees Cook
[not found] ` <1449628714-66641-1-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-12-09 21:12 ` [PATCH 1/4] test: firmware_class: report errors properly on failure Kees Cook
2015-12-09 21:12 ` Kees Cook
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=20151209221220.GB51175@google.com \
--to=computersforpeace-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mcgrof-IBi9RG/b67k@public.gmane.org \
--cc=ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=shuahkh-JPH+aEBZ4P+UEJcrhfAQsw@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.