From: Christoph Hellwig <hch@infradead.org>
To: Kees Cook <keescook@chromium.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Dave Jones <davej@codemonkey.org.uk>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: sg_io HARDENED_USERCOPY_PAGESPAN trace
Date: Sun, 8 Jan 2017 01:44:25 -0800 [thread overview]
Message-ID: <20170108094425.GB17725@infradead.org> (raw)
In-Reply-To: <CAGXu5jKeeR3dq+FvRrgdmpMmHgFHjYx-bDfaB+_eSPmDNboY0g@mail.gmail.com>
On Tue, Jan 03, 2017 at 01:48:03PM -0800, Kees Cook wrote:
> There are a lot of cases of "missing" __GFP_COMP, which is why
> HARDENED_USERCOPY_PAGESPAN defaults to "n".
>
> > If this is on a devie using blk-mq the block core will use high
> > order allocations (as high as possible) to allocate the requests
> > for each queue, so struct request could very well span multiple
> > pages. But I don't see what __GFP_COMP would have to do with
> > user copy annoations. As all requests for a queue are freed
> > togeth again there is no point in setting __GFP_COMP for the
> > request allocations.
>
> Does it hurt anything to mark these pages as allocated "together" via
> __GFP_COMP?
It don't think it would hurt the block code - it only allocates the
pages once, and frees them once. But I think hijacking your feature
on top of a totally unrelated flag is a horrible idea. __GFP_COMP
is about refcounting the allocation, not about anything else. The prime
use case of high order allocations is to use them as a single memory
object, which might include user copies.
So as-is I think HARDENED_USERCOPY_PAGESPAN is a misfeature, it needs to
be opt-in for allocations where we might not copy over the span of
pages, not opt-out. And I suspect there aren't going to be all that
many opt-out candidates.
>
> -Kees
>
> --
> Kees Cook
> Nexus Security
---end quoted text---
prev parent reply other threads:[~2017-01-08 9:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 21:40 sg_io HARDENED_USERCOPY_PAGESPAN trace Dave Jones
2016-12-29 7:56 ` Christoph Hellwig
2016-12-29 15:43 ` Dave Jones
2016-12-30 13:37 ` Christoph Hellwig
2016-12-30 15:01 ` Dave Jones
2016-12-30 15:10 ` Christoph Hellwig
2017-01-03 21:48 ` Kees Cook
2017-01-08 9:44 ` Christoph Hellwig [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=20170108094425.GB17725@infradead.org \
--to=hch@infradead.org \
--cc=davej@codemonkey.org.uk \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.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).