Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp1335823rwn; Thu, 15 Sep 2022 14:13:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76ddLTPmx6r98ZbtlJUp6N8Ns1uJB/LevG+7ZD1CQFOvScdUxsjO2Bd1pg3HOLJ7Qv6u8t X-Received: by 2002:a17:902:cf0e:b0:172:60b7:777c with SMTP id i14-20020a170902cf0e00b0017260b7777cmr1389605plg.132.1663276417034; Thu, 15 Sep 2022 14:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663276417; cv=none; d=google.com; s=arc-20160816; b=wvrKQuWuZEKudHIK6uRAu6vy5dGnr7F2phS0nGj9eoH1ecsG7sT/z4VQT58gOCeXee xjE9AkbEcb0itwpAzehzueOTfBaopSydQrbQmouUbDhy4cNwMRyWCX0uPy5nRLQ8Q9Ks ZmyIBXY5rJufpsP5ZWIaj2COOiZd/gItGulWE/52rTBTHn9Hlypcl4wnXzRkN0fuInw+ OYfNfmj2deSvs/SOn+FYap5+pyCv7JpKCHv/3VQ0VUCWPH06d2D2KkhTHsIuwjzlTEu6 2Qiuv9qZ1B8yWbQYcAPL1BwbrfY3uJVNBRNMaFTiw9VmpUwIeP9FGlb1ejx76pRY5IWd /Edg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WAzq6T4IcWcpMCLuyAzl7o0sCBrlUXNcyNpqxHsFyQ0=; b=0Esa9SPfACMQeSpPZu2oudqVe8Ojzgxzpsm2RtX/bgCaryd1rNs4BCDWE/MEj9EdTR zpj2OpQrpPkVU+C6wy7nj+M/KBpD/n8eNfRVaVovIXNEWHXcvABAaDerZJavK4BAP2Oz NgedW8yviILDETlvW6I2X9U/nl82Mb5ZCzW53eRTlnQQmhPXbP/KtCNmvR07EPXUd4w1 MQhMeTo1D4hfz8OthdHI6/x8ZurDh8gce63NrlxDQRbiaBbJ5q9KgAyfDW5AJ+QN88DE ZwcDTKTZ+WGhkx4EAFlg2/EeZ6sHvW15cg7sEXUUKm808BuBLvwWVbIcuOwhKmCJmD7W QNYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=AiKuJ0pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi19-20020a17090b1e5300b001fb1bec57casi301723pjb.61.2022.09.15.14.13.17; Thu, 15 Sep 2022 14:13:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=AiKuJ0pU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiIOU6q (ORCPT + 99 others); Thu, 15 Sep 2022 16:58:46 -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 X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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?