lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <87k0v7mrrd.fsf@nanos.tec.linutronix.de> Date: Fri, 30 Oct 2020 20:35:18 +0100 From: Thomas Gleixner <tglx@...utronix.de> To: Matthew Wilcox <willy@...radead.org> Cc: LKML <linux-kernel@...r.kernel.org>, linux-arch@...r.kernel.org, Linus Torvalds <torvalds@...uxfoundation.org>, Peter Zijlstra <peterz@...radead.org>, Paul McKenney <paulmck@...nel.org>, David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>, Ard Biesheuvel <ardb@...nel.org>, Herbert Xu <herbert@...dor.apana.org.au>, Christoph Hellwig <hch@....de>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Ingo Molnar <mingo@...nel.org>, Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org, x86@...nel.org, Vineet Gupta <vgupta@...opsys.com>, linux-snps-arc@...ts.infradead.org, Russell King <linux@...linux.org.uk>, Arnd Bergmann <arnd@...db.de>, linux-arm-kernel@...ts.infradead.org, Guo Ren <guoren@...nel.org>, linux-csky@...r.kernel.org, Michal Simek <monstr@...str.eu>, Thomas Bogendoerfer <tsbogend@...ha.franken.de>, linux-mips@...r.kernel.org, Nick Hu <nickhu@...estech.com>, Greentime Hu <green.hu@...il.com>, Vincent Chen <deanbo422@...il.com>, Michael Ellerman <mpe@...erman.id.au>, Benjamin Herrenschmidt <benh@...nel.crashing.org>, Paul Mackerras <paulus@...ba.org>, linuxppc-dev@...ts.ozlabs.org, "David S. Miller" <davem@...emloft.net>, sparclinux@...r.kernel.org, Chris Zankel <chris@...kel.net>, Max Filippov <jcmvbkbc@...il.com>, linux-xtensa@...ux-xtensa.org Subject: Re: [patch V2 00/18] mm/highmem: Preemptible variant of kmap_atomic & friends On Fri, Oct 30 2020 at 13:06, Matthew Wilcox wrote: > On Thu, Oct 29, 2020 at 11:18:06PM +0100, Thomas Gleixner wrote: >> This series provides kmap_local.* iomap_local variants which only disable >> migration to keep the virtual mapping address stable accross preemption, >> but do neither disable pagefaults nor preemption. The new functions can be >> used in any context, but if used in atomic context the caller has to take >> care of eventually disabling pagefaults. > > Could I ask for a CONFIG_KMAP_DEBUG which aliases all the kmap variants > to vmap()? I think we currently have a problem in iov_iter on HIGHMEM > configs: For kmap() that would work, but for kmap_atomic() not so much when it is called in non-preemptible context because vmap() might sleep. > copy_page_to_iter() calls page_copy_sane() which checks: > > head = compound_head(page); > if (likely(n <= v && v <= page_size(head))) > return true; > > but then: > > void *kaddr = kmap_atomic(page); > size_t wanted = copy_to_iter(kaddr + offset, bytes, i); > kunmap_atomic(kaddr); > > so if offset to offset+bytes is larger than PAGE_SIZE, this is going to > work for lowmem pages and fail miserably for highmem pages. I suggest > vmap() because vmap has a PAGE_SIZE gap between each allocation. On 32bit highmem the kmap_atomic() case is easy: Double the number of mapping slots and only use every second one, which gives you a guard page between the maps. For 64bit we could do something ugly: Enable the highmem kmap_atomic() crud and enforce an alias mapping (at least on the architectures where this is reasonable). Then you get the same as for 32bit. > Alternatively if we could have a kmap_atomic_compound(), that would > be awesome, but probably not realistic to implement. I've more > or less resigned myself to having to map things one page at a time. That might be horribly awesome on 32bit :) Thanks, tglx
Powered by blists - more mailing lists