From patchwork Tue Mar 29 12:40:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12794781 Return-Path: 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 ; 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 ; 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 ; 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 ; Tue, 29 Mar 2022 12:41:53 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id c22-20020a50f616000000b004196649d144so10957446edn.10 for ; 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 To: glider@google.com Cc: Alexander Viro , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Mark Rutland , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org 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: 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 --- Link: https://linux-review.googlesource.com/id/Iadb72036ff6868b1d7c9f1ed6630a66be6c57a42 --- kernel/Makefile | 5 +++++ 1 file changed, 5 insertions(+) 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