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 39709ECAAA1 for ; Thu, 15 Sep 2022 20:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbiIOU6s (ORCPT ); Thu, 15 Sep 2022 16:58:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiIOU6l (ORCPT ); Thu, 15 Sep 2022 16:58:41 -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 37A766745D; Thu, 15 Sep 2022 13:58:41 -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 BBA3D62691; Thu, 15 Sep 2022 20:58:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A6C0C433D7; Thu, 15 Sep 2022 20:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1663275520; bh=jc/TYaw+WPP6gHYLDH7WEd6O++ikGzJoRAZP9o8Co78=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AiKuJ0pUVZax0M8NxOVJiRNYB9QOB0hIswUf9Rx7aEZjIQcqyxU3YQYd1CEiHKqvx CgDQwUOrECpX+88YLy5eMnQpBd1zGGmE/Vy6xJIFuI7knZ+7XtQocgRlD+55dy1HJs wjJ5zRa15PyH0SzLmIgdWUDepJL3U0dk5p2YuWe0= Date: Thu, 15 Sep 2022 13:58:38 -0700 From: Andrew Morton To: Alexander Potapenko Cc: Alexander Viro , Alexei Starovoitov , Andrey Konovalov , Andy Lutomirski , Arnd Bergmann , Borislav Petkov , Christoph Hellwig , Christoph Lameter , David Rientjes , Dmitry Vyukov , Eric Biggers , 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 , kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 27/43] kmsan: disable physical page merging in biovec Message-Id: <20220915135838.8ad6df0363ccbd671d9641a1@linux-foundation.org> In-Reply-To: <20220915150417.722975-28-glider@google.com> References: <20220915150417.722975-1-glider@google.com> <20220915150417.722975-28-glider@google.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Sep 2022 17:04:01 +0200 Alexander Potapenko wrote: > 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. > > ... > > --- a/block/blk.h > +++ b/block/blk.h > @@ -88,6 +88,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)) What are the runtime effects of this? In other words, how much slowdown is this likely to cause in a reasonable worst-case?