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
| ||
|
Date: Wed, 13 Jul 2022 11:28:04 +0200 From: Marco Elver <elver@...gle.com> To: Alexander Potapenko <glider@...gle.com> Cc: Alexander Viro <viro@...iv.linux.org.uk>, Alexei Starovoitov <ast@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, Andrey Konovalov <andreyknvl@...gle.com>, Andy Lutomirski <luto@...nel.org>, Arnd Bergmann <arnd@...db.de>, Borislav Petkov <bp@...en8.de>, Christoph Hellwig <hch@....de>, Christoph Lameter <cl@...ux.com>, David Rientjes <rientjes@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>, Eric Dumazet <edumazet@...gle.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Herbert Xu <herbert@...dor.apana.org.au>, Ilya Leoshkevich <iii@...ux.ibm.com>, Ingo Molnar <mingo@...hat.com>, Jens Axboe <axboe@...nel.dk>, Joonsoo Kim <iamjoonsoo.kim@....com>, Kees Cook <keescook@...omium.org>, Mark Rutland <mark.rutland@....com>, Matthew Wilcox <willy@...radead.org>, "Michael S. Tsirkin" <mst@...hat.com>, Pekka Enberg <penberg@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Petr Mladek <pmladek@...e.com>, Steven Rostedt <rostedt@...dmis.org>, Thomas Gleixner <tglx@...utronix.de>, Vasily Gorbik <gor@...ux.ibm.com>, Vegard Nossum <vegard.nossum@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, kasan-dev@...glegroups.com, linux-mm@...ck.org, linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org Subject: Re: [PATCH v4 19/45] kmsan: unpoison @tlb in arch_tlb_gather_mmu() On Fri, 1 Jul 2022 at 16:24, Alexander Potapenko <glider@...gle.com> wrote: > > This is a hack to reduce stackdepot pressure. Will it cause false negatives or other issues? If not, I'd just call it an optimization and not a hack. > struct mmu_gather contains 7 1-bit fields packed into a 32-bit unsigned > int value. The remaining 25 bits remain uninitialized and are never used, > but KMSAN updates the origin for them in zap_pXX_range() in mm/memory.c, > thus creating very long origin chains. This is technically correct, but > consumes too much memory. > > Unpoisoning the whole structure will prevent creating such chains. > > Signed-off-by: Alexander Potapenko <glider@...gle.com> Acked-by: Marco Elver <elver@...gle.com> > --- > Link: https://linux-review.googlesource.com/id/I76abee411b8323acfdbc29bc3a60dca8cff2de77 > --- > mm/mmu_gather.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c > index a71924bd38c0d..add4244e5790d 100644 > --- a/mm/mmu_gather.c > +++ b/mm/mmu_gather.c > @@ -1,6 +1,7 @@ > #include <linux/gfp.h> > #include <linux/highmem.h> > #include <linux/kernel.h> > +#include <linux/kmsan-checks.h> > #include <linux/mmdebug.h> > #include <linux/mm_types.h> > #include <linux/mm_inline.h> > @@ -265,6 +266,15 @@ void tlb_flush_mmu(struct mmu_gather *tlb) > static void __tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, > bool fullmm) > { > + /* > + * struct mmu_gather contains 7 1-bit fields packed into a 32-bit > + * unsigned int value. The remaining 25 bits remain uninitialized > + * and are never used, but KMSAN updates the origin for them in > + * zap_pXX_range() in mm/memory.c, thus creating very long origin > + * chains. This is technically correct, but consumes too much memory. > + * Unpoisoning the whole structure will prevent creating such chains. > + */ > + kmsan_unpoison_memory(tlb, sizeof(*tlb)); > tlb->mm = mm; > tlb->fullmm = fullmm; > > -- > 2.37.0.rc0.161.g10f37bed90-goog >
Powered by blists - more mailing lists