From patchwork Fri Nov 22 11:26:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11257907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 408D16C1 for ; Fri, 22 Nov 2019 11:27:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D86620674 for ; Fri, 22 Nov 2019 11:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="TSQv8e3M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D86620674 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CD0A26B04EF; Fri, 22 Nov 2019 06:27:45 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C84816B04F1; Fri, 22 Nov 2019 06:27:45 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B49646B04F2; Fri, 22 Nov 2019 06:27:45 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 9E8BA6B04EF for ; Fri, 22 Nov 2019 06:27:45 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 610B7181AEF30 for ; Fri, 22 Nov 2019 11:27:45 +0000 (UTC) X-FDA: 76183688490.20.bread58_9764b1dcf75b X-Spam-Summary: 2,0,0,6ca5c3a0095607b6,d41d8cd98f00b204,3mmbxxqykcbex2zuv8x55x2v.t532z4be-331crt1.58x@flex--glider.bounces.google.com,:vegard.nossum@oracle.com:dvyukov@google.com::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@infradead.org:hch@lst.de:darrick.wong@oracle.com:davem@davemloft.net:dmitry.torokhov@gmail.com:ebiggers@google.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:iii@linux.ibm.com:mingo@elte.hu:jasowang@redhat.com:axboe@kernel.dk:m.szyprowski@samsung.com:elver@google.com:mark.rutland@arm.com:martin.petersen@oracle.com:schwidefsky@de.ibm.com:willy@infradead.org:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:cai@lca.pw:rdunlap@infradead.org:robin.murphy@arm.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu :tglx@li X-HE-Tag: bread58_9764b1dcf75b X-Filterd-Recvd-Size: 5009 Received: from mail-ua1-f73.google.com (mail-ua1-f73.google.com [209.85.222.73]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 11:27:44 +0000 (UTC) Received: by mail-ua1-f73.google.com with SMTP id x2so1553746uaj.21 for ; Fri, 22 Nov 2019 03:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=OrrJ7E8h9B+UdvaXrvbgsksn7xPewm3T5b3zd8ZO7Dc=; b=TSQv8e3MUkXeVPTbDG6Yn4QCyKvpEyIr/bnNHlBeNF8Z7+kPEzRiNqmB5vIINO7+5Y SSnMTpdjR0AaWPFE7Id+MvoOsY0wFq3pTKYEcQfGim2M2iyulo6lWxnXarbQbfLArt0T jc15cvSU1hsWIf9TqA+b333OcCIPbj2U30ayMMgalKrs/0fUMfhkAnendeADY5LXEnes 4btUVh9PMlBun9Q9hTK/64/CAog2kQkxXyacRWafCcYVTWbNSmcoeV5f1Oa6RbRKMeza 6phIwOJ8+6Dk2alK/GK9j5l5Zw22aUc8aMFTH14/OKubgeHIfuE5vdJ3yY8woOogB66k TrHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=OrrJ7E8h9B+UdvaXrvbgsksn7xPewm3T5b3zd8ZO7Dc=; b=BYlCjJrNReGKcWGUiSSZnQPLDqEs3VM+mmNRYTrA8tgYk2GCv2CKsRfVqAY/zK/Tkr msi09dnOl1pWomMyJA30DMlMqnaxAMh8a3RWBjpnXEcWXOUu8D20x5GShdjwbbqZpIAu nLkZ9HONbruf5u6yuLwyfvisrQ2Jro3+eWwuu9iSgQcBpa2wMngIdMA/FGHXL8KNyCe4 uav5mm8zhPCJtaX0fNzRXDm5ZIzZikSsSpu0vd5aGZwqFaV0Iv+qDsZwO8dfXmIEQt96 kLxTQWEvKUfFJvCDwOxoeqMu1tQS9qshJmXpGYt6otCu0NfCJlli9xBO+y8S5zIBiSHs djFA== X-Gm-Message-State: APjAAAWtRDQLDUaYC/I0TTsOgxNw7e/RKkMGxDLxQXcrowi7Kie891lN wbkYWocrCYAWywQf1yeIbmLAsabfI1o= X-Google-Smtp-Source: APXvYqz+khEoTiiPDLjrPTQb77Owgt1bTAZlZ2L9zDgen0vb+6eR9kqmVVhk/eUFcE1IMgtfds5i0R6vRL0= X-Received: by 2002:ab0:2618:: with SMTP id c24mr8931445uao.75.1574422064196; Fri, 22 Nov 2019 03:27:44 -0800 (PST) Date: Fri, 22 Nov 2019 12:26:10 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-26-glider@google.com> Mime-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog Subject: [PATCH RFC v3 25/36] kmsan: unpoison |tlb| in arch_tlb_gather_mmu() From: glider@google.com To: Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, hch@lst.de, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, ebiggers@google.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, iii@linux.ibm.com, mingo@elte.hu, jasowang@redhat.com, axboe@kernel.dk, m.szyprowski@samsung.com, elver@google.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de 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: This is a hack to reduce stackdepot pressure. Signed-off-by: Alexander Potapenko To: Alexander Potapenko Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: linux-mm@kvack.org --- Change-Id: I22a201e7e4f67ed74f8129072f12e5351b26103a --- mm/mmu_gather.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/mmu_gather.c b/mm/mmu_gather.c index 7d70e5c78f97..8c5ea2d2e7d5 100644 --- a/mm/mmu_gather.c +++ b/mm/mmu_gather.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -206,6 +207,15 @@ void tlb_flush_mmu(struct mmu_gather *tlb) void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, unsigned long start, unsigned long end) { + /* + * TODO(glider): 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_shadow(tlb, sizeof(*tlb)); tlb->mm = mm; /* Is it from 0 to ~0? */