From patchwork Fri Nov 22 11:26:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11257923 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 E208014DB for ; Fri, 22 Nov 2019 11:28:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AD19C20674 for ; Fri, 22 Nov 2019 11:28:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="be0J0Kbz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD19C20674 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 CD2D46B04FF; Fri, 22 Nov 2019 06:28:10 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C814B6B0501; Fri, 22 Nov 2019 06:28:10 -0500 (EST) 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 B72606B0502; Fri, 22 Nov 2019 06:28:10 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id A1A856B04FF for ; Fri, 22 Nov 2019 06:28:10 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 64D6D3ABB for ; Fri, 22 Nov 2019 11:28:10 +0000 (UTC) X-FDA: 76183689540.24.fork84_d1a685012324 X-Spam-Summary: 2,0,0,259959b9d487fbb1,d41d8cd98f00b204,3scbxxqykccomrojkxmuumrk.iusrotad-ssqbgiq.uxm@flex--glider.bounces.google.com,:hch@lst.de:m.szyprowski@samsung.com:robin.murphy@arm.com:vegard.nossum@oracle.com:dvyukov@google.com::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@infradead.org: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:elver@google.com:mark.rutland@arm.com:martin.petersen@oracle.com:schwidefsky@de.ibm.com:willy@infradead.org:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:cai@lca.pw:rdunlap@infradead.org:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu :tglx@li X-HE-Tag: fork84_d1a685012324 X-Filterd-Recvd-Size: 4676 Received: from mail-qt1-f202.google.com (mail-qt1-f202.google.com [209.85.160.202]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 11:28:09 +0000 (UTC) Received: by mail-qt1-f202.google.com with SMTP id i1so4416728qtj.19 for ; Fri, 22 Nov 2019 03:28:09 -0800 (PST) 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=t/V+gTaD3gigmPAd9r9qsd9Pt13NIfL0Ozq7beD7UPU=; b=be0J0KbzasSSRAI2zFa9JHQtn6F+TVNKjg/HD8xVgeTL8+OgL6nbaY6nRPh2IzGhgN O7ocuzT47b8NFtz1/wlKyxo267Tg5FelVIrtFhF7/VpXTUEacdIlV3ptRBz4XM6d0bzj N67qh/sSK9mnIZodMsRwR+wnc04/ermNtz7EEHTUG3jWkuKrILYnSOlLl6TwoC8a2cV7 lmIhobs0yUQAcXKp5HCJudZ9kAMaQaFVrtwFUIV9xJlrEKGrauf8hKHlRgHp5pQFQVs8 t+1c7FUybgfNelGZleXy8QAyYEInPd7MdLthsruNWjsGGP9RWUB9BzKhzdKY2hfGPGGy yZJg== 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=t/V+gTaD3gigmPAd9r9qsd9Pt13NIfL0Ozq7beD7UPU=; b=uEnetNTsnK50hK3zDCSgIcPnPKlgpZ7Grk7fQY2hD9vlTNsx+9Amdhoz/MqOI1jUko 1rtWIsMWq6MpaXT9GEbasuXzHz+UGlsT2LwoeZeEIZIxxC8jmu2kcU9DIxkCYxcdCt4b iRmFwuJLl3N0n8UE4Ws7Rvb7FzfVDOyOtAKY0iy36/jinEPmxQzS4+5TCncTIgq1TjB5 rf5oZNWaJ49JqSK7GrbpXHpBdvL00QFr+HHFnQEnE0MUk69XHXxdulX1K1m5PpTin9Ru 3IG8vJaVgaLKXxJxVs6xtM7MFAABAYpZzsuFlhw8FQnl+UynjDtCmM9Eo264O0BRTgFD QZ5g== X-Gm-Message-State: APjAAAVSfSGAz4KJWiPH59NQEkOLoxYSIDVgv7TGbwf29bnMJaqkETc/ Q8yPM2gHpc12Fi1UpcAhITsTJhMgxHA= X-Google-Smtp-Source: APXvYqxDt3JJst0JE3x/srfqTp5pCSXjhHtP3+Yw+B2LJ6ZFGXxgktyRErEQcQbqYvgLJwomCOsA/uo5egs= X-Received: by 2002:a37:491:: with SMTP id 139mr11985960qke.200.1574422089085; Fri, 22 Nov 2019 03:28:09 -0800 (PST) Date: Fri, 22 Nov 2019 12:26:18 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-34-glider@google.com> Mime-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog Subject: [PATCH RFC v3 33/36] kmsan: dma: unpoison memory mapped by dma_direct_map_page() From: glider@google.com To: Christoph Hellwig , Marek Szyprowski , Robin Murphy , Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, andreyknvl@google.com, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, 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, elver@google.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de 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: KMSAN doesn't know about DMA memory writes performed by devices. We unpoison such memory when it's mapped to avoid false positive reports. Signed-off-by: Alexander Potapenko Cc: Christoph Hellwig Cc: Marek Szyprowski Cc: Robin Murphy Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: linux-mm@kvack.org --- Change-Id: Ib1019ed531fea69f88b5cdec3d1e27403f2f3d64 --- kernel/dma/direct.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 8402b29c280f..3539337f76d9 100644 --- a/kernel/dma/direct.c +++ b/kernel/dma/direct.c @@ -341,6 +341,7 @@ dma_addr_t dma_direct_map_page(struct device *dev, struct page *page, report_addr(dev, dma_addr, size); return DMA_MAPPING_ERROR; } + kmsan_handle_dma(page_address(page) + offset, size, dir); if (!dev_is_dma_coherent(dev) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) arch_sync_dma_for_device(dev, phys, size, dir);