From patchwork Wed Mar 25 16:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11458273 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 713A114B4 for ; Wed, 25 Mar 2020 16:14:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 30ED220740 for ; Wed, 25 Mar 2020 16:14:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="X2m/4GGS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30ED220740 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 841346B000C; Wed, 25 Mar 2020 12:14:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 81A0D6B008A; Wed, 25 Mar 2020 12:14:04 -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 6DF596B008C; Wed, 25 Mar 2020 12:14:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0163.hostedemail.com [216.40.44.163]) by kanga.kvack.org (Postfix) with ESMTP id 52E0E6B000C for ; Wed, 25 Mar 2020 12:14:04 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 34EFD18199605 for ; Wed, 25 Mar 2020 16:14:04 +0000 (UTC) X-FDA: 76634381208.07.brake54_7aca1ace00b4d X-Spam-Summary: 2,0,0,835571a2495f8ecf,d41d8cd98f00b204,3son7xgykcdkbgdyzmbjjbgz.xjhgdips-hhfqvxf.jmb@flex--glider.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:966:973:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3152:3353:3865:3867:3871:3874:4117:4250:4321:4385:5007:6261:6653:6742:6743:7774:7875:8660:9969:10004:10400:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13148:13230:13846:14093:14096:14097:14181:14394:14659:14721:21080:21365:21433:21444:21450:21451:21627:21990:30012:30054:30064,0,RBL:209.85.221.74:@flex--glider.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:10,LUA_SUMMARY:none X-HE-Tag: brake54_7aca1ace00b4d X-Filterd-Recvd-Size: 6238 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Mar 2020 16:14:03 +0000 (UTC) Received: by mail-wr1-f74.google.com with SMTP id e10so1373375wru.6 for ; Wed, 25 Mar 2020 09:14:03 -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=G1ANBkXsphASF7TIfj2U8dl4l2QWKr5exekIRkX1oFM=; b=X2m/4GGSZ8uFZEoKGkU8zeSpv0/dUPvN0REXGjc+64neEoAEHm4NU7yRzTKff9SBAf LhWBpuCrjoB6QWQApHY6HaWH7wnhJ3wn3FDT4n8DGMvca0YhDPHAsaf6sGN5kt+QD+4W xtFdVhd8yWL4kD+WQES8uSonl936PYAqCR/yA1NskKbpnYnojTR8BxdKP0igDYao37l2 Ch7qs7YTO1pSzbCbMGAg5Siri2RzkUo3VqdepyDhoc1MvF+/V3QcujTmRJ90UVoM2oC4 uK79fofbOwSgdlTKiaCXmdjgM2bEUbgEFiLSlPWVIQ5M8mQezvLnqh+p1hAlTWXl0XJa iuPA== 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=G1ANBkXsphASF7TIfj2U8dl4l2QWKr5exekIRkX1oFM=; b=X14ePmAmwm6aaABp2/IpbrscUydP7MTt+LVuwbOO66tB4LjAPxwEq39AcpTOyMDxxn ELqYj4qiiVSzjMX20GQAFbtk3Cm+DckYqfu93DJCpIpWgIc6rut7aDfMbo5e7zBhnskl 9Hk78X8FWCpQ0vkJMCVNRCWkf5yze2f7VaTB5NW8szp7qG383gTg2JfM7XA43DxvuoeP cMX8NQF50f93jQz9Cz/iLv9cvGonR4zc4jZDlDklvumCWs4OeIid+VoPt206cV3juhN6 U8r6zeFwZtzkL3FdgNbmrj/Os5HWoh4LGDe8e+m+6AlKyJFKp6IL3Vpr4h0GBO+FVkLs Tsug== X-Gm-Message-State: ANhLgQ1oURty4S8AYx5bM0fCJAQzVE8MBOYkq8hcFZR8rXkJnibsN+uX 2oE2Q3+LsR/lPVGUe5dEm6xZiSuER/k= X-Google-Smtp-Source: ADFU+vsLleCRzgvQ9l2mzah7qORL7skEMW7l2m+CtenE2/AKiBNPOYI5+w5g+O8jt2A8p7KSXr48SSh8rqo= X-Received: by 2002:adf:f309:: with SMTP id i9mr4589083wro.0.1585152842316; Wed, 25 Mar 2020 09:14:02 -0700 (PDT) Date: Wed, 25 Mar 2020 17:12:32 +0100 In-Reply-To: <20200325161249.55095-1-glider@google.com> Message-Id: <20200325161249.55095-22-glider@google.com> Mime-Version: 1.0 References: <20200325161249.55095-1-glider@google.com> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [PATCH v5 21/38] kmsan: handle task creation and exiting From: glider@google.com To: Andrew Morton , Greg Kroah-Hartman , Eric Dumazet , Wolfram Sang , Petr Mladek , Vegard Nossum , Dmitry Vyukov , Marco Elver , Andrey Konovalov , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, 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, ericvh@gmail.com, 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, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, mhocko@suse.com, monstr@monstr.eu, 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 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 To: Alexander Potapenko Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Eric Dumazet Cc: Wolfram Sang Cc: Petr Mladek Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: Marco Elver Cc: Andrey Konovalov Cc: linux-mm@kvack.org --- This patch was previously called "kmsan: call KMSAN hooks where needed" v4: - split this patch away Change-Id: I7a6a83419b0e038f8993175461255f462a430205 --- kernel/exit.c | 2 ++ kernel/fork.c | 2 ++ kernel/kthread.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/kernel/exit.c b/kernel/exit.c index e93c6197a827c..377f9edbb28fa 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -709,6 +710,7 @@ void __noreturn do_exit(long code) profile_task_exit(tsk); kcov_task_exit(tsk); + kmsan_task_exit(tsk); WARN_ON(blk_needs_flush_plug(tsk)); diff --git a/kernel/fork.c b/kernel/fork.c index d48e063a3abe7..21f7f411880d3 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -943,6 +944,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); #ifdef CONFIG_FAULT_INJECTION tsk->fail_nth = 0; diff --git a/kernel/kthread.c b/kernel/kthread.c index b262f47046ca4..33ca743ca8b54 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -350,6 +351,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data), set_cpus_allowed_ptr(task, cpu_all_mask); } kfree(create); + kmsan_task_create(task); return task; }