[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200106100501.GM2844@hirez.programming.kicks-ass.net>
Date: Mon, 6 Jan 2020 11:05:01 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Robin Murphy <robin.murphy@....com>
Cc: Marc Gonzalez <marc.w.gonzalez@...e.fr>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Rafael Wysocki <rjw@...ysocki.net>,
LKML <linux-kernel@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Alexey Brodkin <alexey.brodkin@...opsys.com>,
Will Deacon <will@...nel.org>,
Russell King <rmk+kernel@...linux.org.uk>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Tejun Heo <tj@...nel.org>, Mark Brown <broonie@...nel.org>
Subject: Re: [RFC PATCH v1] devres: align devres.data strictly only for
devm_kmalloc()
On Fri, Dec 20, 2019 at 10:02:13PM +0000, Robin Murphy wrote:
> There is also the streaming API for one-off transfers
> of data already existing at a given kernel address (think network packets,
> USB URBs, etc), which on non-coherent architectures is achieved with
> explicit cache maintenance plus an API contract that buffers must not be
> explicitly accessed by CPUs for the duration of the mapping. Addresses from
> kmalloc() are explicitly valid for dma_map_single() (and indeed are about
> the only thing you'd ever reasonably feed it), which is the primary reason
> why ARCH_KMALLOC_MINALIGN gets so big on architectures which can be
> non-coherent and also suffer from creative cache designs.
Would it make sense to extend KASAN (or something) to detect violations
of this 'promise'? Because most obvious this was broken for the longest
time and was only accidentally fixed due to the ARC alignment thingy.
Who knows how many other sites are subtly broken too.
Have the dma_{,un}map_single() things mark the memory as
uninitialized/unaccessible such that any concurrent access will trigger
a splat.
Powered by blists - more mailing lists