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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CED93C43217 for ; Tue, 18 Oct 2022 00:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbiJRAem (ORCPT ); Mon, 17 Oct 2022 20:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbiJRAeg (ORCPT ); Mon, 17 Oct 2022 20:34:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA70BA1B0; Mon, 17 Oct 2022 17:34:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CC3B611F5; Tue, 18 Oct 2022 00:22:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F678C433C1; Tue, 18 Oct 2022 00:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666052556; bh=w8dO5flJtUJ9RxNmvELTwbRTnOO/jaWU4CHl6yTVTtY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dgU0FONrfUG14UKEzGn6NWQEdmezbNgsBKBMCAE84b4HSKux7d1CBg6+awMblpCJr b/dVyxnS6PRzGOX/bIZG2BEEQ6httxDRKW4lWTZLFVvcOIk+r9IF1JreiuEykWyTwL LohTR9JwZ9xeiYFZ5nlSTgMyfCmkhgv7SL6awThizNbNtlGjdipWYyCOHb7XCJoBTr AGYKljHxkFg6z5F3EqHUczqiZxed/czQkxuGWpeM8V39Ri9D8mXE6hSKCoubV+e2EN hIeVyo8877ZKZJJ8e7mU2+oTUR7ufsxBGWsHvJZIrgM0DWRb196QYpnAQ2a6bKl3aj QWQKsPeRTEl6Q== Date: Mon, 17 Oct 2022 17:22:33 -0700 From: Eric Biggers To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Alexander Potapenko , Alexander Viro , Alexei Starovoitov , Andrey Konovalov , Andrey Konovalov , Andy Lutomirski , 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 , Mark Rutland , Matthew Wilcox , "Michael S . Tsirkin" , Pekka Enberg , Peter Zijlstra , Petr Mladek , Stephen Rothwell , Steven Rostedt , Thomas Gleixner , Vasily Gorbik , Vegard Nossum , Vlastimil Babka , Andrew Morton , linux-block@vger.kernel.org Subject: Re: [PATCH AUTOSEL 5.4 10/13] kmsan: disable physical page merging in biovec Message-ID: References: <20221018001102.2731930-1-sashal@kernel.org> <20221018001102.2731930-10-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221018001102.2731930-10-sashal@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Mon, Oct 17, 2022 at 08:10:59PM -0400, Sasha Levin wrote: > From: Alexander Potapenko > > [ Upstream commit f630a5d0ca59a6e73b61e3f82c371dc230da99ff ] > > 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. > > Link: https://lkml.kernel.org/r/20220915150417.722975-28-glider@google.com > Signed-off-by: Alexander Potapenko > Cc: Alexander Viro > Cc: Alexei Starovoitov > Cc: Andrey Konovalov > Cc: Andrey Konovalov > Cc: Andy Lutomirski > Cc: Arnd Bergmann > Cc: Borislav Petkov > Cc: Christoph Hellwig > Cc: Christoph Lameter > Cc: David Rientjes > Cc: Dmitry Vyukov > Cc: Eric Biggers > Cc: Eric Biggers > Cc: Eric Dumazet > Cc: Greg Kroah-Hartman > Cc: Herbert Xu > Cc: Ilya Leoshkevich > Cc: Ingo Molnar > Cc: Jens Axboe > Cc: Joonsoo Kim > Cc: Kees Cook > Cc: Marco Elver > Cc: Mark Rutland > Cc: Matthew Wilcox > Cc: Michael S. Tsirkin > Cc: Pekka Enberg > Cc: Peter Zijlstra > Cc: Petr Mladek > Cc: Stephen Rothwell > Cc: Steven Rostedt > Cc: Thomas Gleixner > Cc: Vasily Gorbik > Cc: Vegard Nossum > Cc: Vlastimil Babka > Signed-off-by: Andrew Morton > Signed-off-by: Sasha Levin > --- > block/blk.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/block/blk.h b/block/blk.h > index ee3d5664d962..3358ef4244fe 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -79,6 +79,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 adjacent physical pages may not work correctly under KMSAN > + * if their metadata pages aren't adjacent. Just disable merging. > + */ > + 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)) So KMSAN is being backported to 5.4? - Eric