From patchwork Tue Dec 14 16:20:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 12676363 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 D8EA0C4332F for ; Tue, 14 Dec 2021 16:31:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4DF76B0092; Tue, 14 Dec 2021 11:22:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BFE946B0093; Tue, 14 Dec 2021 11:22:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9F016B0095; Tue, 14 Dec 2021 11:22:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0002.hostedemail.com [216.40.44.2]) by kanga.kvack.org (Postfix) with ESMTP id 99F7C6B0092 for ; Tue, 14 Dec 2021 11:22:55 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 618FF88CC7 for ; Tue, 14 Dec 2021 16:22:45 +0000 (UTC) X-FDA: 78916918290.16.B8FF642 Received: from mail-lj1-f202.google.com (mail-lj1-f202.google.com [209.85.208.202]) by imf30.hostedemail.com (Postfix) with ESMTP id 633A68001E for ; Tue, 14 Dec 2021 16:22:41 +0000 (UTC) Received: by mail-lj1-f202.google.com with SMTP id p1-20020a2e7401000000b00218d0d11e91so5596245ljc.15 for ; Tue, 14 Dec 2021 08:22:41 -0800 (PST) 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=ue972WbBd9grr+IhEpVqeTCdlW/8PMCymIUxIIoyED4=; b=Vr7vmjXO/ZQNUilyHT6HA/4buGSLSIYLl/qRHTXk31zD+EY7VC067MV2GQ1gcTKpSL 34PYjt2oZaAHuR1Fn95QkJiDKtzO0ehg1sLaVJ3mV9Y/Q8LNlPIsbFpa/FZvil+9C22s RghE2q3Ejxg6cCW4gIHjwKLyaeOXsYQgRcgWD67OGB4gKUL2V1URRinmICyKUNyEpVoH YKwBGln2CVKOxUWHj7Mi81ouKRz2wk5IcSIbyOVRKabXX5rqPMETegoTJdq7sPCtpPmD xJeoztIdPUYuXWvmGaaEgBf6cjVJ0hyqY+1sd85pw7pOleo8UCuNLkXCZnmUeWgy27o7 ZsKw== 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=ue972WbBd9grr+IhEpVqeTCdlW/8PMCymIUxIIoyED4=; b=cZCugBbELGNGw8MAipFhY+yppHEfowmgcRrKvzVa5f1tjamE1bsNYGdaiSplblhbxm dfLRHUB3kdwzOl9Ly0BVjLhlrYAstZZaBcswbn1f13+kOuwppr59Np6Bh0ifTL4B7Cxk w5/UK7xvnNX+LkndUhSgbosB0luUeMPxCciHZtpkbL2SaMecbCXP4PZv/GTG4KB0g2HD Ywo/BpJ8jQr2EHf3zjKvoL6dkGr7MHx/37OEyW1FSuIwqIqKQiAM/Biv9WoVlRecUMs4 2OBxCQhOyCpK8NcLZZ4r4TBJ+I34uc5q+UwvmbvCWoA2/dsCMcAPjdnak4wnHUb6aBJr PreA== X-Gm-Message-State: AOAM533rhbj1TSpb5/6AIgEKODJqQ6nE1N5eUBPB/SV47FIsrTFFzahs /+5yRtPji7scnXibe8EZ+jVew8jYR4c= X-Google-Smtp-Source: ABdhPJwof4yAzLY6jvFwcb35lrlAFHi9TWhnsoYR/pbbpZnrib18G9NF9LFXSvNYzy5cHEt+ggjwBFIkk8g= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:357e:2b9d:5b13:a652]) (user=glider job=sendgmr) by 2002:ac2:5110:: with SMTP id q16mr5605822lfb.56.1639498959625; Tue, 14 Dec 2021 08:22:39 -0800 (PST) Date: Tue, 14 Dec 2021 17:20:24 +0100 In-Reply-To: <20211214162050.660953-1-glider@google.com> Message-Id: <20211214162050.660953-18-glider@google.com> Mime-Version: 1.0 References: <20211214162050.660953-1-glider@google.com> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog Subject: [PATCH 17/43] kmsan: handle task creation and exiting From: Alexander Potapenko To: glider@google.com Cc: Alexander Viro , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Ard Biesheuvel , 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 , 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 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 633A68001E X-Stat-Signature: e7113xrtyhsdzfw9r845ct4ta4wkpoxw Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Vr7vmjXO; spf=pass (imf30.hostedemail.com: domain of 3z8S4YQYKCFAy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com designates 209.85.208.202 as permitted sender) smtp.mailfrom=3z8S4YQYKCFAy30vw9y66y3w.u64305CF-442Dsu2.69y@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1639498961-784215 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: Tell KMSAN that a new task is created, so the tool creates a backing metadata structure for that task. Signed-off-by: Alexander Potapenko --- Link: https://linux-review.googlesource.com/id/I0f41c3a1c7d66f7e14aabcfdfc7c69addb945805 --- kernel/exit.c | 2 ++ kernel/fork.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/kernel/exit.c b/kernel/exit.c index f702a6a63686e..a276f6716dcd5 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -767,6 +768,7 @@ void __noreturn do_exit(long code) profile_task_exit(tsk); kcov_task_exit(tsk); + kmsan_task_exit(tsk); coredump_task_exit(tsk); ptrace_event(PTRACE_EVENT_EXIT, code); diff --git a/kernel/fork.c b/kernel/fork.c index 3244cc56b697d..5d53ffab2cda7 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -955,6 +956,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) account_kernel_stack(tsk, 1); kcov_task_init(tsk); + kmsan_task_create(tsk); kmap_local_fork(tsk); #ifdef CONFIG_FAULT_INJECTION