Message ID | 20211214162050.660953-30-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 3AB77C433F5 for <linux-mm@archiver.kernel.org>; Tue, 14 Dec 2021 16:38:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39B0E6B0071; Tue, 14 Dec 2021 11:23:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 34AA46B00A0; Tue, 14 Dec 2021 11:23:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EBC66B00A1; Tue, 14 Dec 2021 11:23:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 0CBB26B0071 for <linux-mm@kvack.org>; Tue, 14 Dec 2021 11:23:25 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CB442180DD593 for <linux-mm@kvack.org>; Tue, 14 Dec 2021 16:23:14 +0000 (UTC) X-FDA: 78916919508.29.BB44928 Received: from mail-lf1-f74.google.com (mail-lf1-f74.google.com [209.85.167.74]) by imf07.hostedemail.com (Postfix) with ESMTP id 6941F4000C for <linux-mm@kvack.org>; Tue, 14 Dec 2021 16:23:14 +0000 (UTC) Received: by mail-lf1-f74.google.com with SMTP id f15-20020a056512228f00b004037c0ab223so9014615lfu.16 for <linux-mm@kvack.org>; Tue, 14 Dec 2021 08:23:14 -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=olRZ/+DsKDaAFuaGG/j7BFeaFh0ExVig2xDV8tj79mY=; b=AZMbPv6YU75omW1PCY67bzSuU/ZVSn7oXZSZ2epvS8xVB1tmOznv1nY4Ye3LciG8CF SJbN8SvrgxgB1hrzotG9LvFYgvZrX2/O/92JBYMGvOozkVY2s7YDFK7i30mwJAStwLNU GHjq6GKC2p7ur/RolwtuvKxhB5ZzIYEBCaPUAXV7ReSn4ANGtvtEHpsOG+2+CureWcYC UhqRbNO9zV/IPkP7zKKl06hAU7vtjVbAe51+z4+t0/yP4Z/kvGehTffXMIQArgFRhFHw LhMWPx1NUKj6vZ0vF7s29kb/5xBQApSzCLXoFS6UcZ4xXjKSz6rIzJTwiNS3U3UhE152 QeIQ== 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=olRZ/+DsKDaAFuaGG/j7BFeaFh0ExVig2xDV8tj79mY=; b=IZ4VSL3Bef1BOziSN/9zXjNng44WgKDNR0JKLPg+GyA0cBOQ5der54+QPOBdwr9VkA 1YV1OHBaxLpcLPtgcpK+xKe0IlLZTknLpuULwMjYEBkmAVTdXuUymNPYlD6ts4DnZfkx Ql/pZ5DYlqGuNQo7PHmINuZqubGQbjWjUnm4+mrpPCXtXyxphfoIqxD/Jzi6L23nxfvR 1IxwhFKpVfFbHVpEvTsi7jWT/wUSd9ay9yLpQfgxOpXeaCy6p58YBIgUUX9QVe0D2+FL eEj1BL8VDdZNRAgUjenkvNVriNGxM/JQMwVCOVUjNS+s1aJTPUscB3ipNyzfjKAh0ahe fx/A== X-Gm-Message-State: AOAM531PJUKs0xCckxD3+ExiJUH/eyittXbHTj2eR0Tl9CpsE+m4ACko jymzWGJjS02zWdKQyPoFczvor5XA5AI= X-Google-Smtp-Source: ABdhPJxHTLK1yWIsE4vKmI5uGLTSba2Nc1bS0PGDcbFD0uKbOw3JLrJKYPGR2xP/idljX/8IJjgOdYVH8N8= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:357e:2b9d:5b13:a652]) (user=glider job=sendgmr) by 2002:a05:6512:2246:: with SMTP id i6mr5863432lfu.24.1639498992700; Tue, 14 Dec 2021 08:23:12 -0800 (PST) Date: Tue, 14 Dec 2021 17:20:36 +0100 In-Reply-To: <20211214162050.660953-1-glider@google.com> Message-Id: <20211214162050.660953-30-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 29/43] kmsan: handle memory sent to/from USB 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>, Ard Biesheuvel <ard.biesheuvel@linaro.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>, 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: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=AZMbPv6Y; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of 38MS4YQYKCHEVaXSTgVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--glider.bounces.google.com designates 209.85.167.74 as permitted sender) smtp.mailfrom=38MS4YQYKCHEVaXSTgVddVaT.RdbaXcjm-bbZkPRZ.dgV@flex--glider.bounces.google.com X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6941F4000C X-Stat-Signature: 1yaxeo5her4g4sq3iy7wsihm5s9oc3ds X-HE-Tag: 1639498994-159697 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/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 30727729a44cc..0e84acc9aea53 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -8,6 +8,7 @@ #include <linux/bitops.h> #include <linux/slab.h> #include <linux/log2.h> +#include <linux/kmsan-checks.h> #include <linux/usb.h> #include <linux/wait.h> #include <linux/usb/hcd.h> @@ -426,6 +427,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) URB_SETUP_MAP_SINGLE | URB_SETUP_MAP_LOCAL | URB_DMA_SG_COMBINED); urb->transfer_flags |= (is_out ? URB_DIR_OUT : URB_DIR_IN); + kmsan_handle_urb(urb, is_out); if (xfertype != USB_ENDPOINT_XFER_CONTROL && dev->state < USB_STATE_CONFIGURED)
Depending on the value of is_out kmsan_handle_urb() KMSAN either marks the data copied to the kernel from a USB device as initialized, or checks the data sent to the device for being initialized. Signed-off-by: Alexander Potapenko <glider@google.com> --- Link: https://linux-review.googlesource.com/id/Ifa67fb72015d4de14c30e971556f99fc8b2ee506 --- drivers/usb/core/urb.c | 2 ++ 1 file changed, 2 insertions(+)