Thread (21 messages) flat view 21 messages, 4 authors, 2017-11-14

linux-next: Tree for Nov 7

From: mpe@ellerman.id.au (Michael Ellerman)
Date: 2017-11-14 08:55:12
Also in: linux-mips, linux-next, linux-sh, linuxppc-dev, lkml, sparclinux

Michal Hocko [off-list ref] writes:
On Mon 13-11-17 22:34:50, Michael Ellerman wrote:
quoted
Hi Michal,

Michal Hocko [off-list ref] writes:
quoted
On Mon 13-11-17 10:20:06, Michal Hocko wrote:
quoted
[Cc arm and ppc maintainers]
Hmm, it turned out to be a problem on other architectures as well.
CCing more maintainers. For your reference, we are talking about
http://lkml.kernel.org/r/20171023082608.6167-1-mhocko at kernel.org
which has broken architectures which do apply aligning on the mmap
address hint without MAP_FIXED applied. See below my proposed way
around this issue because I belive that the above patch is quite
valuable on its own to be dropped for all archs.
I don't really like your solution sorry :)  The fact that you've had to
patch seven arches seems like a red flag.

I think this is a generic problem with MAP_FIXED, which I've heard
userspace folks complain about in the past.
The thing is that we canno  change MAP_FIXED behavior as it is carved in
stone
Yes obviously. I didn't mean to imply we would change MAP_FIXED, rather
we would add a new flag with the new semantics.
quoted
Currently MAP_FIXED does two things:
  1. makes addr not a hint but the required address
  2. blasts any existing mapping

You want 1) but not 2).
+ fail if there is a clashing range
Yep. I thought that was implied :)
quoted
So the right solution IMHO would be to add a new mmap flag to request
that behaviour, ie. a fixed address but iff there is nothing already
mapped there.

I don't know the mm code well enough to know if that's hard for some
reason, but it *seems* like it should be doable.
Yes, I have mentioned that in the previous email but the amount of code
would be even larger. Basically every arch which reimplements
arch_get_unmapped_area would have to special case new MAP_FIXED flag to
do vma lookup.
I'd have to look, but my memory of the arch code is that it doesn't deal
with the vma so it wouldn't need any change.
So this was the most simple solution I could come up
with. If there was a general interest for MAP_FIXED_SAFE then we can
introduce it later of course. I would just like the hardening merged
sooner rather than later.
Sure. But in the scheme of things one more kernel release is not that
big a deal to get it right. Given that the simple approach of dropping
MAP_FIXED turns out to not be simple at all.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help