Message ID | 20191030142237.249532-21-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=AzKR=YX=kvack.org=owner-linux-mm@kernel.org> 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 A62331668 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 30 Oct 2019 14:23:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7268D20656 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 30 Oct 2019 14:23:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iFw5x4jE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7268D20656 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 D5F5B6B0003; Wed, 30 Oct 2019 10:23:48 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C1EC66B0279; Wed, 30 Oct 2019 10:23:48 -0400 (EDT) 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 AE6376B027B; Wed, 30 Oct 2019 10:23:48 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id 86F456B0279 for <linux-mm@kvack.org>; Wed, 30 Oct 2019 10:23:48 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 332E4824999B for <linux-mm@kvack.org>; Wed, 30 Oct 2019 14:23:48 +0000 (UTC) X-FDA: 76100669736.07.pets22_3e41da9c06b3e X-Spam-Summary: 2,0,0,57f7382b6d85fe27,d41d8cd98f00b204,38py5xqykcacnspklynvvnsl.jvtspu14-ttr2hjr.vyn@flex--glider.bounces.google.com,:vegard.nossum@oracle.com:dvyukov@google.com::viro@zeniv.linux.org.uk:akpm@linux-foundation.org:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@lst.de:dmitry.torokhov@gmail.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:mingo@elte.hu:axboe@kernel.dk:martin.petersen@oracle.com:schwidefsky@de.ibm.com:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu:tglx@linutronix.de:wsa@the-dreams.de:gor@linux.ibm.com:iii@linux.ibm.com:mark.rutland@arm.com:willy@infradead.org:rdunlap@infradead.org:andreyknvl@google.com:elver@google.com:glider@google.com,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747 :1777:17 X-HE-Tag: pets22_3e41da9c06b3e X-Filterd-Recvd-Size: 4838 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf39.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Wed, 30 Oct 2019 14:23:47 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id n15so679593wmc.3 for <linux-mm@kvack.org>; Wed, 30 Oct 2019 07:23:47 -0700 (PDT) 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=i0Ie74SM2sNjD7EzrzgEhVZsFkM1WnCABTXFFFbssjQ=; b=iFw5x4jEIXJpnPCObOp9edi0dyNJiDmJvPifiAbS2Iqg9E2Jtv0rSthNxerRIfaGvB MixCUaYd1S+eGC/3QGBaDFT8m0I5Rb6bEnyF9i8mSKWZk+8WOuBpjhDLOVue5iqVfVNB U4lhLBnT7MPyfTJwAjGwE6ZE2U2VfPgd6aJT4i0BN7Vh+hR2qQJ+Ds8/uRbTTTO8fqo4 kD1B0DhGdMy5k1/4p4OcIM4C7AnEudaq5wMG1MHtRa1KN6tpA7C1qXS4T9fzAgeFIHj5 Rn9QswCIwHx2tRDCG3W/PbOK2foCrQTd1WMX+KbG5dcv2Dn6zy7GmIzqFj0BvuWbazJp lVLQ== 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=i0Ie74SM2sNjD7EzrzgEhVZsFkM1WnCABTXFFFbssjQ=; b=pdW1OrFc1yuiaPVvU9grGlMOdrNM0MpuYMZrz6mD/NZulIUH1scexIJhVgSb6/JbmX XDZ1clo06HqQ60rG+/I7bi0NtY6iGEevkbUkeJbFGevly+sGWahtHGC6hIi5DR6d9Jc2 5Y7bBFaCiLhvfTWx5ku8zf7Z35wPz3rvfUfk2dec1pBGDfcbdkKcByhB9xVOpjV+PLxc p/247aoM8Z/8vpT2v6pl8sDHwdJuRHJpWyD+xrr8SLkLtx9rb8nqkSj9XtHT03R28KIf k3bS4pIWwVdoH4np52L4ItTbH24zxenBZVwn4CB5dMb/HQeZTL7HiZp8SHDRyohAbz6p +iHw== X-Gm-Message-State: APjAAAVvYYdH0zju+UgMn4DnfAFYa1kNzYOleZwFgrbVKeBp48VwEuqZ aWmQdJDgQmgILZTyzbfmEbTkCIEtoHQ= X-Google-Smtp-Source: APXvYqwwTRTjwGk13hTEDvRXOJxRzzHPyaLs8Lvew0WBVDXcPCCJRdF8xGK4/GFNZfluDlaXizFbiKvBC2s= X-Received: by 2002:adf:ee03:: with SMTP id y3mr141216wrn.116.1572445426114; Wed, 30 Oct 2019 07:23:46 -0700 (PDT) Date: Wed, 30 Oct 2019 15:22:32 +0100 In-Reply-To: <20191030142237.249532-1-glider@google.com> Message-Id: <20191030142237.249532-21-glider@google.com> Mime-Version: 1.0 References: <20191030142237.249532-1-glider@google.com> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH RFC v2 20/25] kmsan: unpoison |tlb| in arch_tlb_gather_mmu() From: glider@google.com To: Vegard Nossum <vegard.nossum@oracle.com>, Dmitry Vyukov <dvyukov@google.com>, linux-mm@kvack.org Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@lst.de, dmitry.torokhov@gmail.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, mingo@elte.hu, axboe@kernel.dk, martin.petersen@oracle.com, schwidefsky@de.ibm.com, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, wsa@the-dreams.de, gor@linux.ibm.com, iii@linux.ibm.com, mark.rutland@arm.com, willy@infradead.org, rdunlap@infradead.org, andreyknvl@google.com, elver@google.com, Alexander Potapenko <glider@google.com> Content-Type: text/plain; charset="UTF-8" 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 7d70e5c78f97..8c5ea2d2e7d5 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/pagemap.h> @@ -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? */
This is a hack to reduce stackdepot pressure. Signed-off-by: Alexander Potapenko <glider@google.com> To: Alexander Potapenko <glider@google.com> Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: linux-mm@kvack.org --- Change-Id: I22a201e7e4f67ed74f8129072f12e5351b26103a --- mm/mmu_gather.c | 10 ++++++++++ 1 file changed, 10 insertions(+)