Message ID | 20220329124017.737571-32-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 32D86C433F5 for <linux-mm@archiver.kernel.org>; Tue, 29 Mar 2022 12:41:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C20528D000E; Tue, 29 Mar 2022 08:41:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B83328D000A; Tue, 29 Mar 2022 08:41:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FBC98D000E; Tue, 29 Mar 2022 08:41:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 920748D000A for <linux-mm@kvack.org>; Tue, 29 Mar 2022 08:41:54 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 502F5A4A77 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 12:41:54 +0000 (UTC) X-FDA: 79297385748.16.CE9C799 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf27.hostedemail.com (Postfix) with ESMTP id D9D7040009 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 12:41:53 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id c22-20020a50f616000000b004196649d144so10957446edn.10 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 05:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=enpw47tW5AlKxiO7mK8zQaDRtxatFy2+pOtakd8BlZk=; b=mCwjmjg5IEjrVFruDI8qNciYEOnA2jiLkX9pLqN6BnRcekJoE0XFuHwS9ksz9BZuKY n2Vq+3ICaYrPhLsEY2JcrP3sAWEO8412GRb/cLfojFWc/Jv/zfHf6VmhfoHQDyibrhRx 8IC9UaRnp3e1xpCjw97idSW8aarWoqZh0n2KfPjUQhED20Y5dJyYXlGP9d7TDcAtLJjJ tGVXH5XRlRg71IARaSa3IaKomYbSYugJMCjnDyryrStOIVf7B/EHB5TBnzADPTie1FVi apknmdO2z63KmAh6CYf0AHjMa0AeJ4eU4IOL9/Ql/UgZ21OFy1M4gXnTW1xPdquE8NbE svEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=enpw47tW5AlKxiO7mK8zQaDRtxatFy2+pOtakd8BlZk=; b=ys8do+tO28NEeOFLsE0W+3ZQuRSEQBpINJkMnqE0HqnofROuRqa30gyt8efj156Akj 4rw1a5JfJNRRXh+nmcDuGgkxqXQtk3OVqtlk1geaVZRBTWTpAiUxp2iIF50bwRUmGRWX pOFqqcQmu+LuAcekZ8pxwH+RYqSbG8+QzYq8HmYMraeh4mxrmLxvcprXbwWAkgCJad7b 1OjDUrpLdKromgs3FOJjPwGebeEnqJmJQfOIujJnwyLTy9wQ5BlcvzrnP8YSTBoghjJL JO5ooHE3Nka14rRaXYFoIomciLBjfWWV4RVEM2Fn6/hcQeTrzDj9StE4SPXUQKLOcBFw 4eAQ== X-Gm-Message-State: AOAM532DzAuOxu85TTEXlLbNXPQ8p6RAy+RFEqstoLbc0WXsq2DQoSXc ihfgZdloXaGWEuyUjpSn9JhA3vtRvjI= X-Google-Smtp-Source: ABdhPJyvopsmMnmkArFS+YVZS01vYvUWgOoKNLhFelQAgUTgMKFm4yxx2n/LM5t8wnbOjIRaXG8/wiLoWwo= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:36eb:759:798f:98c3]) (user=glider job=sendgmr) by 2002:a17:907:6297:b0:6da:6388:dc58 with SMTP id nd23-20020a170907629700b006da6388dc58mr35414945ejc.472.1648557712510; Tue, 29 Mar 2022 05:41:52 -0700 (PDT) Date: Tue, 29 Mar 2022 14:40:00 +0200 In-Reply-To: <20220329124017.737571-1-glider@google.com> Message-Id: <20220329124017.737571-32-glider@google.com> Mime-Version: 1.0 References: <20220329124017.737571-1-glider@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 31/48] kernel: kmsan: don't instrument stacktrace.c From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: Alexander Viro <viro@zeniv.linux.org.uk>, 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>, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=mCwjmjg5; spf=pass (imf27.hostedemail.com: domain of 3kP5CYgYKCLEXcZUViXffXcV.TfdcZelo-ddbmRTb.fiX@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3kP5CYgYKCLEXcZUViXffXcV.TfdcZelo-ddbmRTb.fiX@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: D9D7040009 X-Stat-Signature: g3yhzfrqthysesdxqahrbwgdwynzz9h4 X-HE-Tag: 1648557713-38835 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
|
On Tue, Mar 29, 2022 at 2:41 PM Alexander Potapenko <glider@google.com> wrote: > > When unwinding stack traces, the kernel may pick uninitialized data from > the stack. To avoid false reports on that data, we do not instrument > stacktrace.c This patch is not needed anymore if we unpoison the stack traces passed to __stack_depot_save() from KMSAN core.
diff --git a/kernel/Makefile b/kernel/Makefile index 80f6cfb60c020..1147f0bd6e022 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -40,6 +40,11 @@ KASAN_SANITIZE_kcov.o := n KCSAN_SANITIZE_kcov.o := n UBSAN_SANITIZE_kcov.o := n KMSAN_SANITIZE_kcov.o := n + +# Code in stactrace.c may branch on random values taken from the stack. +# Prevent KMSAN false positives by not instrumenting this file. +KMSAN_SANITIZE_stacktrace.o := n + CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack) -fno-stack-protector # Don't instrument error handlers
When unwinding stack traces, the kernel may pick uninitialized data from the stack. To avoid false reports on that data, we do not instrument stacktrace.c Signed-off-by: Alexander Potapenko <glider@google.com> --- Link: https://linux-review.googlesource.com/id/Iadb72036ff6868b1d7c9f1ed6630a66be6c57a42 --- kernel/Makefile | 5 +++++ 1 file changed, 5 insertions(+)