From patchwork Wed Mar 25 16:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11458271 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 B5A0914B4 for ; Wed, 25 Mar 2020 16:14:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E68A20774 for ; Wed, 25 Mar 2020 16:14:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nCNz5mGq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E68A20774 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 9058D6B0088; Wed, 25 Mar 2020 12:14:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8B5226B0089; Wed, 25 Mar 2020 12:14:01 -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 6BE0F6B008A; Wed, 25 Mar 2020 12:14:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 52ACE6B0088 for ; Wed, 25 Mar 2020 12:14:01 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 291448248047 for ; Wed, 25 Mar 2020 16:14:01 +0000 (UTC) X-FDA: 76634381082.08.skin79_7a58ca484f941 X-Spam-Summary: 2,0,0,de5e47b2552a3b6d,d41d8cd98f00b204,3r4n7xgykcdyydavwjyggydw.ugedafmp-eecnsuc.gjy@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:2559:2562:3138:3139:3140:3141:3142:3152:3352:3740:3865:3866:3867:4250:4321:5007:6261:6653:6742:6743:7875:8660:9969:10004:10400:11026:11232:11473:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13069:13148:13230:13311:13357:13846:14096:14097:14181:14394:14659:14721:21080:21324:21365:21444:21451:21611:21627:21990:30045:30054:30064,0,RBL:209.85.128.74:@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:22,LUA_SUMMARY:none X-HE-Tag: skin79_7a58ca484f941 X-Filterd-Recvd-Size: 5318 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Mar 2020 16:14:00 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id w9so869499wmi.2 for ; Wed, 25 Mar 2020 09:14:00 -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=kztRBTTWc3oyP+MYIjwGq6CzMPRNXmFizN5qYVB0f+A=; b=nCNz5mGqQ1/xB7t3CbqD7Z7ucAqPvLNBKtFkRP7CRJSWb9m6C6MGjFs1LKEb6vvJiH 2teFoRNDpe90K1b3Zcvhlz6VgQFjL4LC+hanR/A5T72l7gDCjztGF1p0FbCDGT+g2zy2 y1sqxmArJ1Kcf5Z60Wj2gmlwX5iQR/zKCCwMqaa5GiCuZymX/Y1WL6+GBC3s4eJ4DxPs mO8WGhAEH5uvte6Mi/hnOsDU61B6XfXCoEd3E2VSg0c+A2Rr1U+DFGDJgyIN9/vh+Tvv kqIep/PBZTfHo7lVId+p11aoGXRyUYUZ0k2NUF2erbf+lyUMQzddVds88zaAq01vX9wN MzMg== 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=kztRBTTWc3oyP+MYIjwGq6CzMPRNXmFizN5qYVB0f+A=; b=pi4nIT48QDwAdlFdrRMV3yWSeRI8BXoz+iHRqjQ/VkqAmyniQ3rYFaL8RAyF1biSsT SeReds1DAtUkIS9jvdkpGfIMC/GYyYoFy+ImZoazaTdgeKGSWvn98FtfbgOHRud8+gCT jtsBCRSu9+qNquttqsNAc86PxZQ/HTlzTIJJ33f4iC31Tix5JI6WckIekZrhcH/2AMJF QExPaDvws2QHEF2pXwnbkV21mH2Aa8HgjdtcPPtrbLPBwVl3WSKdVqgafwqdXESSiJHc vWHMWVJxOqLzQ8oABJMenumdXs2I+RgoMzbxLYkEt6x3wpZdsSFwL6k08ehy4mgoTzQc yq1Q== X-Gm-Message-State: ANhLgQ26f8nkf9u8ba4S++Kw57Tp1AY/2XzGQXwVcem4Bndl+H/JHj/l 6UrlDLz3KzW7/uM7gea+e7OAwUDXHuM= X-Google-Smtp-Source: ADFU+vunqqhs/V5QbFSweHy95rVys8n9wJL4i9VuYGsXCu3TNY3e2DhRXllDI0dcGKem0gIISriWvploG9M= X-Received: by 2002:adf:bbcd:: with SMTP id z13mr4184690wrg.389.1585152839184; Wed, 25 Mar 2020 09:13:59 -0700 (PDT) Date: Wed, 25 Mar 2020 17:12:31 +0100 In-Reply-To: <20200325161249.55095-1-glider@google.com> Message-Id: <20200325161249.55095-21-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 20/38] kmsan: handle memory sent to/from USB 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: 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 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: Idd0f8ce858975112285706ffb7286f570bd3007b --- drivers/usb/core/urb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index da923ec176122..4a0b0ac0f52f9 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -402,6 +403,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)