Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1550230 > unrolled thread
| Started by | Kees Cook <keescook@chromium.org> |
|---|---|
| First post | 2017-01-03 22:50 +0100 |
| Last post | 2017-01-08 10:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: sg_io HARDENED_USERCOPY_PAGESPAN trace Kees Cook <keescook@chromium.org> - 2017-01-03 22:50 +0100
Re: sg_io HARDENED_USERCOPY_PAGESPAN trace Christoph Hellwig <hch@infradead.org> - 2017-01-08 10:50 +0100
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Date | 2017-01-03 22:50 +0100 |
| Subject | Re: sg_io HARDENED_USERCOPY_PAGESPAN trace |
| Message-ID | <sVF7X-3Mr-19@gated-at.bofh.it> |
On Fri, Dec 30, 2016 at 7:10 AM, Christoph Hellwig <hch@infradead.org> wrote: > On Fri, Dec 30, 2016 at 10:01:39AM -0500, Dave Jones wrote: >> I threw this debug printk into the pagespan code to see what exactly >> it was complaining about.. >> >> ptr:ffff88042614cff8 end:ffff88042614d003 n:c >> >> so it was copying 12 bytes that spanned two pages. >> >From my reading of the config option help text, this thing is >> complaining that wasn't allocated with __GFP_COMP maybe ? 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? -Kees -- Kees Cook Nexus Security
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Date | 2017-01-08 10:50 +0100 |
| Message-ID | <sXigW-4z0-37@gated-at.bofh.it> |
| In reply to | #1550230 |
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---
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web