From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B81A1C433F5 for ; Wed, 15 Dec 2021 14:17:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 59E876B0071; Wed, 15 Dec 2021 09:17:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 54D736B0073; Wed, 15 Dec 2021 09:17:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4166A6B0074; Wed, 15 Dec 2021 09:17:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id 319596B0071 for ; Wed, 15 Dec 2021 09:17:30 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id F38F1894A4 for ; Wed, 15 Dec 2021 14:17:19 +0000 (UTC) X-FDA: 78920230998.08.C900DC0 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf18.hostedemail.com (Postfix) with ESMTP id DCBB21C0027 for ; Wed, 15 Dec 2021 14:17:15 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 981E4143B; Wed, 15 Dec 2021 06:17:17 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.67.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D52853F774; Wed, 15 Dec 2021 06:17:12 -0800 (PST) Date: Wed, 15 Dec 2021 14:17:09 +0000 From: Mark Rutland To: Alexander Potapenko Cc: Alexander Viro , Andrew Morton , Andrey Konovalov , Andy Lutomirski , Ard Biesheuvel , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Dumazet , Greg Kroah-Hartman , Herbert Xu , Ilya Leoshkevich , Ingo Molnar , Jens Axboe , Joonsoo Kim , Kees Cook , Marco Elver , Matthew Wilcox , "Michael S. Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 33/43] kmsan: disable physical page merging in biovec Message-ID: References: <20211214162050.660953-1-glider@google.com> <20211214162050.660953-34-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211214162050.660953-34-glider@google.com> X-Rspamd-Queue-Id: DCBB21C0027 X-Stat-Signature: w5537pao1woh7mk188acdkxaujf55p7m Authentication-Results: imf18.hostedemail.com; dkim=none; spf=pass (imf18.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam10 X-HE-Tag: 1639577835-93742 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: On Tue, Dec 14, 2021 at 05:20:40PM +0100, Alexander Potapenko wrote: > KMSAN metadata for consequent physical pages may be inconsequent, I think you mean 'adjacent'/ rather than 'consequent' here, i.e. | KMSAN metadata for adjacent physical pages may not be adjacent > therefore accessing such pages together may lead to metadata > corruption. > We disable merging pages in biovec to prevent such corruptions. > > Signed-off-by: Alexander Potapenko > --- > > Link: https://linux-review.googlesource.com/id/Iece16041be5ee47904fbc98121b105e5be5fea5c > --- > block/blk.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/block/blk.h b/block/blk.h > index ccde6e6f17360..e0c62a5d5639e 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -103,6 +103,13 @@ static inline bool biovec_phys_mergeable(struct request_queue *q, > phys_addr_t addr1 = page_to_phys(vec1->bv_page) + vec1->bv_offset; > phys_addr_t addr2 = page_to_phys(vec2->bv_page) + vec2->bv_offset; > > + /* > + * Merging consequent physical pages may not work correctly under KMSAN > + * if their metadata pages aren't consequent. Just disable merging. > + */ Likewise here. Mark. > + if (IS_ENABLED(CONFIG_KMSAN)) > + return false; > + > if (addr1 + vec1->bv_len != addr2) > return false; > if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2->bv_page)) > -- > 2.34.1.173.g76aa8bc2d0-goog >