Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 3 Feb 2020 09:41:34 -0800
From: Christoph Hellwig <>
To: Matthew Wilcox <>
Cc: Jann Horn <>, Kees Cook <>,
	Christian Borntraeger <>,
	Christoph Hellwig <>,
	Christopher Lameter <>, Jiri Slaby <>,
	Julian Wiedmann <>,
	Ursula Braun <>,
	Alexander Viro <>,
	kernel list <>,
	David Windsor <>,
	Pekka Enberg <>,
	David Rientjes <>,
	Joonsoo Kim <>,
	Andrew Morton <>,
	Linux-MM <>,,
	Linus Torvalds <>,
	Andy Lutomirski <>,
	"David S. Miller" <>,
	Laura Abbott <>,
	Mark Rutland <>,
	"Martin K. Petersen" <>,
	Paolo Bonzini <>,
	Dave Kleikamp <>, Jan Kara <>,
	Marc Zyngier <>,
	Matthew Garrett <>,
	linux-fsdevel <>,
	linux-arch <>,
	Network Development <>,
	Kernel Hardening <>,
	Vlastimil Babka <>, Michal Kubecek <>
Subject: Re: [PATCH 09/38] usercopy: Mark kmalloc caches
 as usercopy caches

On Sun, Feb 02, 2020 at 11:46:44PM -0800, Matthew Wilcox wrote:
> > gives the hardware access to completely unrelated memory.) Instead,
> > they get pages from the page allocator, and these pages may e.g. be
> > allocated from the DMA, DMA32 or NORMAL zones depending on the
> > restrictions imposed by hardware. So I think the usercopy restriction
> > only affects a few oddball drivers (like this s390 stuff), which is
> > why you're not seeing more bug reports caused by this.
> Getting pages from the page allocator is true for dma_alloc_coherent()
> and friends.

dma_alloc_coherent also has a few other memory sources than the page

> But it's not true for streaming DMA mappings (dma_map_*)
> for which the memory usually comes from kmalloc().  If this is something
> we want to fix (and I have an awful feeling we're going to regret it
> if we say "no, we trust the hardware"), we're going to have to come up
> with a new memory allocation API for these cases.  Or bounce bugger the
> memory for devices we don't trust.

There aren't too many places that use slab allocations for streaming
mappings, and then do usercopies into them.  But I vaguely remember
some usb code getting the annotations for that a while ago.

But if you don't trust your hardware you will need to use IOMMUs and
page aligned memory, or IOMMUs plus bounce buffering for the kmalloc
allocations (we've recently grown code to do that for the intel-iommu
driver, which needs to be lifted into the generic IOMMU code).

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.