Message ID | 20200325161249.55095-38-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=qMZt=5K=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 74B61913 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 25 Mar 2020 16:15:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4286120409 for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 25 Mar 2020 16:15:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GjV7/tps" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4286120409 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 421106B00B4; Wed, 25 Mar 2020 12:14:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3AAAB6B00B6; Wed, 25 Mar 2020 12:14:55 -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 1D6CF6B00B7; Wed, 25 Mar 2020 12:14:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id F064B6B00B4 for <linux-mm@kvack.org>; Wed, 25 Mar 2020 12:14:54 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D98BB1800D3F1 for <linux-mm@kvack.org>; Wed, 25 Mar 2020 16:14:54 +0000 (UTC) X-FDA: 76634383308.14.cat74_822ac67224e4d X-Spam-Summary: 2,0,0,3d4b5db5d841ddb8,d41d8cd98f00b204,3fyn7xgykcgwqvsnobqyyqvo.mywvsxeh-wwufkmu.ybq@flex--glider.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1535:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3152:3352:3866:3867:3868:3870:4250:4321:5007:6261:6653:6742:6743:7875:9969:10004:10400:11026:11232:11658:11914:12043:12048:12114:12296:12297:12438:12555:12895:13069:13255:13311:13357:13846:13972:14093:14096:14097:14181:14394:14659:14721:21080:21365:21433:21444:21451:21627:21990:30045:30054:30064:30090,0,RBL:209.85.221.73:@flex--glider.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.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:16,LUA_SUMMARY:none X-HE-Tag: cat74_822ac67224e4d X-Filterd-Recvd-Size: 5399 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf05.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Wed, 25 Mar 2020 16:14:54 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id f15so1383473wrt.4 for <linux-mm@kvack.org>; Wed, 25 Mar 2020 09:14:54 -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=055LzJgLhVLC5ZMf8m0EmpggO79F1ITnh6Ud/1KeVsw=; b=GjV7/tpshigj3LZmXdUb6+JA4lSxu7/UaFQE6cc3VdH0a0a57/1q7Fhbn3FctF/Njo WPx4LAugBPy2Im/bJVS9jL/P3uBr0w9VYM+2iKqCgVXEddax1PaO6Oh41CJnqBB9cznY 3H/YbjCROooAEBL5eo3Zezh+79YSyN83x06+fGNcdNAmSpckQS+bWeDq8n7BL2WHkeck FeZBjySKIj5iMyyuwTatjNFir9m55mjWDIAk22QMVinRcwsy18d25QCS5R2AxbmelOpZ qAZKWdi2NVEErqdgfr7f3Y+84LqAw8pmbTLun7wjNlpdxl5sDG9GAF5+/k2wfgsnvBbN Ljzw== 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=055LzJgLhVLC5ZMf8m0EmpggO79F1ITnh6Ud/1KeVsw=; b=s/Ky1Q0Fu24ChHEI5UXbYZk/durBtprho4JUoqvswUFRzFrXQZYOOttJHvj96d3jus Hv0z+bACPRLipvRQerMIYTCRUTRVSN7sujX1GlXVZPD76WQxyg4qD0oULvgjzoalOkDI RdNQHI+//M6qZI2L7L8YbKOvgc1+agmX2gMfAAZ/yImyCxJg+b/uzTySFCV6Jh4/BpeX 4AcsoUV4TkfpbRxcQAZIr8tSHhBpNy557S8sBV+hYk156H+KZ/QpMX2qp8A7UMEgFNfp wVxFXuUZSyoddUb0leXOOi+gLQGaSX5019f45RZaE0N+eye7OzUcfqmX2R9CDmaFEFvC rpDA== X-Gm-Message-State: ANhLgQ3ThWFzddnJDssFyoAnL1u1cjBmkFN2xFe0sJ60oVGZz/uQpkQB YO2YB0VONecgbHu+LJWLXsSX0uvcZfQ= X-Google-Smtp-Source: ADFU+vs0z4rY8HwfBn/pDoSCVUX+dnac0GECuda43gq7mk7FGEbrmTBS6WzOyzPoWl5bENu+oowvsx6OmWE= X-Received: by 2002:adf:a1d6:: with SMTP id v22mr4326563wrv.416.1585152893000; Wed, 25 Mar 2020 09:14:53 -0700 (PDT) Date: Wed, 25 Mar 2020 17:12:48 +0100 In-Reply-To: <20200325161249.55095-1-glider@google.com> Message-Id: <20200325161249.55095-38-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 37/38] kmsan: x86/uprobes: unpoison regs in arch_uprobe_exception_notify() From: glider@google.com To: Thomas Gleixner <tglx@linutronix.de>, Andrew Morton <akpm@linux-foundation.org>, Vegard Nossum <vegard.nossum@oracle.com>, Dmitry Vyukov <dvyukov@google.com>, Marco Elver <elver@google.com>, Andrey Konovalov <andreyknvl@google.com>, 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, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, 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, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, gor@linux.ibm.com, wsa@the-dreams.de 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/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 15e5aad8ac2c1..bc156b016dc57 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c @@ -8,6 +8,7 @@ * Jim Keniston */ #include <linux/kernel.h> +#include <linux/kmsan-checks.h> #include <linux/sched.h> #include <linux/ptrace.h> #include <linux/uprobes.h> @@ -997,9 +998,13 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data) { struct die_args *args = data; - struct pt_regs *regs = args->regs; + struct pt_regs *regs; int ret = NOTIFY_DONE; + kmsan_unpoison_shadow(args, sizeof(*args)); + regs = args->regs; + if (regs) + kmsan_unpoison_shadow(regs, sizeof(*regs)); /* We are only interested in userspace traps */ if (regs && !user_mode(regs)) return NOTIFY_DONE;
arch_uprobe_exception_notify() may receive register state without valid KMSAN metadata, which will lead to false positives. Explicitly unpoison args and args->regs to avoid this. Signed-off-by: Alexander Potapenko <glider@google.com> To: Alexander Potapenko <glider@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Marco Elver <elver@google.com> Cc: Andrey Konovalov <andreyknvl@google.com> Cc: linux-mm@kvack.org --- This patch was split from "kmsan: disable instrumentation of certain functions" v4: - split this patch away Change-Id: I466ef628b00362ab5eb1852c76baa8cdb06736d9 --- arch/x86/kernel/uprobes.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)