From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Drysdale <drysdale@google.com>,
Kees Cook <keescook@google.com>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>,
Sasha Levin <sasha.levin@oracle.com>,
Vegard Nossum <vegard.nossum@oracle.com>,
LKML <linux-kernel@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
Tavis Ormandy <taviso@google.com>,
Bjorn Helgaas <bhelgaas@google.com>,
syzkaller <syzkaller@googlegroups.com>,
Kostya Serebryany <kcc@google.com>,
Alexander Potapenko <glider@google.com>,
Andrey Ryabinin <ryabinin.a.a@gmail.com>
Subject: Re: [PATCH v3] kernel: add kcov code coverage
Date: Mon, 18 Jan 2016 23:52:01 +0200 [thread overview]
Message-ID: <20160118215201.GD14531@node.shutemov.name> (raw)
In-Reply-To: <CACT4Y+b72eard_VXaFLa9xh-OZWj7Y5LHsoFP0jvxVyLVxjoZQ@mail.gmail.com>
On Mon, Jan 18, 2016 at 08:28:04PM +0100, Dmitry Vyukov wrote:
> On Mon, Jan 18, 2016 at 1:42 PM, Kirill A. Shutemov
> <kirill@shutemov.name> wrote:
> > On Thu, Jan 14, 2016 at 03:22:21PM +0100, Dmitry Vyukov wrote:
> >> + area = t->kcov_area;
> >> + /* The first u32 is number of subsequent PCs. */
> >> + pos = READ_ONCE(area[0]) + 1;
> >> + if (likely(pos < t->kcov_size)) {
> >> + area[pos] = (u32)_RET_IP_;
> >
> > If area[0] is UINT32_MAX the condition will be true and you'll make
> > area[0] temporary set to (u32)_RET_IP_. That's may be fun. :)
>
> Well, if user wants to corrupt this region, he is free to do so. But
> it wont't corrupt kernel, right?
Right. But it's easy enough to avoid overflow too:
"if (likely(pos && pos < t->kcov_size)"
> >> +
> >> + page = vmalloc_to_page(kcov->area + off);
> >> + get_page(page);
> >> + vmf->page = page;
> >> + return 0;
> >> +}
> >
> > BTW, since all pages pre-allocated, you don't really need fault handler --
> > just setup all pages table enties during mmap. This would shorten warm up
> > period for userspace. See vm_insert_page().
>
> Done in v4
> I don't need to get_page() before vm_insert_page(), right?
Right. vm_insert_page() will take the referenece for you.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2016-01-18 21:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 14:22 [PATCH v3] kernel: add kcov code coverage Dmitry Vyukov
2016-01-14 16:25 ` Kirill A. Shutemov
2016-01-14 16:31 ` Dmitry Vyukov
2016-01-15 12:42 ` Kirill A. Shutemov
2016-01-15 14:21 ` Dmitry Vyukov
2016-01-18 11:21 ` Dmitry Vyukov
2016-01-18 12:42 ` Kirill A. Shutemov
2016-01-18 19:28 ` Dmitry Vyukov
2016-01-18 21:52 ` Kirill A. Shutemov [this message]
2016-01-19 12:47 ` Dmitry Vyukov
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=20160118215201.GD14531@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=drysdale@google.com \
--cc=dvyukov@google.com \
--cc=edumazet@google.com \
--cc=glider@google.com \
--cc=kcc@google.com \
--cc=keescook@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=quentin.casasnovas@oracle.com \
--cc=ryabinin.a.a@gmail.com \
--cc=sasha.levin@oracle.com \
--cc=syzkaller@googlegroups.com \
--cc=taviso@google.com \
--cc=vegard.nossum@oracle.com \
/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.