Message ID | 20220826150807.723137-20-glider@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1DFEFECAAD4 for <linux-mm@archiver.kernel.org>; Fri, 26 Aug 2022 15:09:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B1C0D94000B; Fri, 26 Aug 2022 11:09:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA4BC940007; Fri, 26 Aug 2022 11:09:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9211794000B; Fri, 26 Aug 2022 11:09:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 7C85F940007 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 11:09:07 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5D16EC0E54 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 15:09:07 +0000 (UTC) X-FDA: 79842076734.19.249C5BC Received: from mail-ej1-f73.google.com (mail-ej1-f73.google.com [209.85.218.73]) by imf17.hostedemail.com (Postfix) with ESMTP id 15F004000C for <linux-mm@kvack.org>; Fri, 26 Aug 2022 15:09:06 +0000 (UTC) Received: by mail-ej1-f73.google.com with SMTP id sd6-20020a1709076e0600b0073315809fb5so720610ejc.10 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 08:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=9AAV0khTKYQgqo5/UGS2nmhcIjrHMBeghL7l+ejLApU=; b=sDB5PJpJBZJ8zJUYHqSaroGLwunSs5Rwaz9QmpK5RO8+mlf1nYQAGNhjMXl1m0oFZH vzMQVlJHXNGU9aieZuBV0ihX2Xs7GeZCanFYLMBLdccTjtufIvPj0/C/g25QTIwI6/Qp sReL0ZmVrFu7c6GRkrze5jnIbC0eHcDyF/YHGMdyIlE3tPtruebYgAGRN7/qwGwqWIG0 d7O6U7dzRkmvp5N9Pl4k3vT+ZH5Z9JXhcKEWunCg7MMWVXl8aGl5D3s28uVHexHgHJDm JLeAgRz2XBzUtSevuOYUNl/dsbWhlT4VB5dIjKptqOcveXztv31OO3ARcYOVZyimZv3m XuFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=9AAV0khTKYQgqo5/UGS2nmhcIjrHMBeghL7l+ejLApU=; b=mUktXoTORUVvE55cMCtm2O2EPwl18E9wf19+dLA1F/Kq0eJvTbulKN4AeYgdNgJC8b S01l+9bIOU+byo32saNNANz14dKGueO2XzypzdPJY/tCBsikmE90HrvUzQW7DxTSCs4O h4EvQcGswRtA8goIvbLK9sxVHXhfPTh1CxNz3tl4zkNiFv1lPBliDipAsVTHKEq1GGl6 tjCLn9xqgtaB2XI+q2IwVI9fTK4beI7ns+JlqcHBaUyfY2JMjdlG/FfSPzXmwijPsPTT 8ZGnZutRb8gCtbadr8g7KE3jcuy7+rLi8gHUWkO+qvZyrowzbIXE5noMJjrTq1p5QmNO 99RQ== X-Gm-Message-State: ACgBeo1R0JBeEusw9QxDYYros6g/tQjVpI3pNPjmuDGDwU2dJdk6KCgt RFYvwSCWEf+Sgx4aS5vM2RpwjOLzflE= X-Google-Smtp-Source: AA6agR7OB7JfBU0FR/Gx7VVFS0BYXkDkX/D+5e1f7tZDKGDtu48HBg9ANVBecrhroNJG7bsthdjAB8Rc34M= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:5207:ac36:fdd3:502d]) (user=glider job=sendgmr) by 2002:a17:906:8a77:b0:73d:deef:8f76 with SMTP id hy23-20020a1709068a7700b0073ddeef8f76mr3332086ejc.765.1661526545890; Fri, 26 Aug 2022 08:09:05 -0700 (PDT) Date: Fri, 26 Aug 2022 17:07:42 +0200 In-Reply-To: <20220826150807.723137-1-glider@google.com> Mime-Version: 1.0 References: <20220826150807.723137-1-glider@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826150807.723137-20-glider@google.com> Subject: [PATCH v5 19/44] kmsan: unpoison @tlb in arch_tlb_gather_mmu() From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Alexei Starovoitov <ast@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Andrey Konovalov <andreyknvl@google.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>, Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Dmitry Vyukov <dvyukov@google.com>, Eric Dumazet <edumazet@google.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Herbert Xu <herbert@gondor.apana.org.au>, Ilya Leoshkevich <iii@linux.ibm.com>, Ingo Molnar <mingo@redhat.com>, Jens Axboe <axboe@kernel.dk>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Kees Cook <keescook@chromium.org>, Marco Elver <elver@google.com>, Mark Rutland <mark.rutland@arm.com>, Matthew Wilcox <willy@infradead.org>, "Michael S. Tsirkin" <mst@redhat.com>, Pekka Enberg <penberg@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Petr Mladek <pmladek@suse.com>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, Vasily Gorbik <gor@linux.ibm.com>, Vegard Nossum <vegard.nossum@oracle.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=sDB5PJpJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3EeIIYwYKCBg49612F4CC492.0CA96BIL-AA8Jy08.CF4@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3EeIIYwYKCBg49612F4CC492.0CA96BIL-AA8Jy08.CF4@flex--glider.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661526547; a=rsa-sha256; cv=none; b=rIm/XvxFe9OoZlGQtD7FZEb86rpa9G1PLwC4Pjl//tclWBCDKf7HM1UOJPY4kDpA3WRuKp 1hQzYU29sQr2vdgfussjKZtZBq+iCcpuvKkyK+TtUqE9FJhYoypXG4J48q2TGZgALYgmeX ASYyOVamutqb96IJwn87mFWINBDOuFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661526547; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9AAV0khTKYQgqo5/UGS2nmhcIjrHMBeghL7l+ejLApU=; b=2D12cosG6wmlApv/erAm9xGpXEffLMMzCmb0ZLAN70FKi765cnAFk4eu6PN8rb+2wy8AW+ PpK0ljhp9flsGGAczMLheNVsGTtjDhyEpTcV9GeJD2VN55NDso3drDj+PgK3qn+RcEWLBr /cBL6+6wmRG6kw7aZ08lneGPRz+wYYg= X-Rspam-User: X-Rspamd-Queue-Id: 15F004000C Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=sDB5PJpJ; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3EeIIYwYKCBg49612F4CC492.0CA96BIL-AA8Jy08.CF4@flex--glider.bounces.google.com designates 209.85.218.73 as permitted sender) smtp.mailfrom=3EeIIYwYKCBg49612F4CC492.0CA96BIL-AA8Jy08.CF4@flex--glider.bounces.google.com X-Stat-Signature: wkn6xunu5hchgox9y4gcue4dfkjd35hj X-Rspamd-Server: rspam03 X-HE-Tag: 1661526546-28125 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Add KernelMemorySanitizer infrastructure
|
expand
|
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;