Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4427828ioa; Wed, 27 Apr 2022 03:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRxTBSp34yMQVHeUorTfABe44rr1wQsfa5ev9Kr0wJkZ1+e8U5+DlGNHIsXA+bBDiR5+3K X-Received: by 2002:a17:90a:e517:b0:1d7:5bbd:f9f0 with SMTP id t23-20020a17090ae51700b001d75bbdf9f0mr31782800pjy.77.1651056346183; Wed, 27 Apr 2022 03:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651056346; cv=none; d=google.com; s=arc-20160816; b=mJ2zSNyQZ0G8UchhTXKTwnf018yY3JUpwaaI74wnajWbTcC7QsHD8nd8qWJTZ25cPG GDTYhM/1M6E5R04CTKMNR0xATxJIWTKjRBpYNDwCrkqLH5XICamVtwrNGGBlljQnBPIY fAaGo+/JxYbl0f7uf1xdsFv7ObQLbumGu0yWNgFSWhjR5oJZvcLeHAkDiAccixpIrVXM y7BdQhXVSkh8aQRRHdpypX9aVnTEM8GLjPHUBwBI6psiAENt73YNeWIeGUMqSEhQUMN7 eo116QZ6tNm6YdMd39Q8HrWmXSTNtJ5G/kEbmaeGXXh3SQRQk/0rTyH2MUygjZD4aHWh ZC4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=GtiQESdTzDECedHCE4txXpUZH3/tDa3FQ07WXH5OYuQ=; b=DQZ3OzBGZkuBbPQWwpeCG1gngW/49ilkkWqHVHHQbCbapJtCz5mFHvwjglYv3rE9Zp UEOmkRMlBSenfbDhguCcCKNSdjWobIxUkRb+A+2+LESe+kCFvxUhcgcjW0UuYNTfl0GW MkiU8UZ13ZwSSwsV6gzP3nDyfZ9IiABGuDUcAHA4qdTnJFTXYMObX5L9MsnDz7Kbtxx3 BrdMCVkfSaToLMURR376eEYXztE4iWmcCMrd6YlRPQFj+IpkNuY8zcFgTPLLonb50zrm zBwfQZZpZ57Am3tZD82sdCznANG9qPwjQJsTarAZU4TX01L3vQ2z9/yhY0MuycI+pHUL aybQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=UW3AswRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b0015d04ca90d7si1300247plg.18.2022.04.27.03.45.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:45:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=UW3AswRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CCE7407EE9; Wed, 27 Apr 2022 02:54:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353516AbiDZQww (ORCPT + 99 others); Tue, 26 Apr 2022 12:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353345AbiDZQup (ORCPT ); Tue, 26 Apr 2022 12:50:45 -0400 Received: from mail-lj1-x24a.google.com (mail-lj1-x24a.google.com [IPv6:2a00:1450:4864:20::24a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A4F748315 for ; Tue, 26 Apr 2022 09:45:47 -0700 (PDT) Received: by mail-lj1-x24a.google.com with SMTP id 23-20020a05651c00d700b0024f12064717so1744783ljr.15 for ; Tue, 26 Apr 2022 09:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=GtiQESdTzDECedHCE4txXpUZH3/tDa3FQ07WXH5OYuQ=; b=UW3AswRaq6F3AUzKmXnr7cPkQ0g2XLtpFenEmpgWjfvp2fOauRXzdotOTeUNyWSyYs 4tmhw8qwzpN9wiAWPxJUMCVxV1rWcYuXS49a+1tCMi0Oc5SG780CX3I+mnAa6/MfcB77 6+gdBv5jHg6AKYvKP7kA5u9scJwMLXdv1i19bLKNouK41RBdBrSMPPJuqKL61o2W1+Ho pFIgSZPybW4jMIEebVa0EuG05Nils5rY1Bzl3+5j5IX62oqraNKPX3IyM6K8LuZYgWcI qaxMdheHooD/KCw39MnxjCE+Vv1BhdJnZkIOIVorHWlt4oOjs2wI7s6rPQyDKu5idJkG PQRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=GtiQESdTzDECedHCE4txXpUZH3/tDa3FQ07WXH5OYuQ=; b=aZ7R5N0q+z0Kt4BIG8z/gVrIBbtsGsyzzAyKs8bPHkpX/ScXKjoJoRtyEfLNWxbuVR c0XjUTZS/c2v82DzAnYdGlP1rymNZB0Xx1pSPhm9gT/8wVq658i7+JyJqixJU9BV/dxe u/GLSk1mPUJVmcxSKfllSCh6xrkH03wkkqvJTZBr2LrxSjQgH7dLuHvNRwFayVeb5LeL x6kXneO7DHm33gDBLhZpoYSWQK0Vqenp8GKshPbb8VOeqXzY0mMvWGVbTZo4OX9R0y6S m5afapPq9Hx6Y08FITXVhOdvA8sO825Czhnj5+AsgctYQM6wypQ2PnuxULxCV7+K45tA jTKw== X-Gm-Message-State: AOAM533lqKm+aHjc6FlxjP2y73osUEO/JvHU1oSQxCx1PGpBZzBnw+BG IVKgyRZW7EITygJfrmpa2kt0PpaKqoM= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:d580:abeb:bf6d:5726]) (user=glider job=sendgmr) by 2002:a05:6512:20c6:b0:471:fdba:1480 with SMTP id u6-20020a05651220c600b00471fdba1480mr10896844lfr.425.1650991546042; Tue, 26 Apr 2022 09:45:46 -0700 (PDT) Date: Tue, 26 Apr 2022 18:43:02 +0200 In-Reply-To: <20220426164315.625149-1-glider@google.com> Message-Id: <20220426164315.625149-34-glider@google.com> Mime-Version: 1.0 References: <20220426164315.625149-1-glider@google.com> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH v3 33/46] kmsan: block: skip bio block merging logic for KMSAN From: Alexander Potapenko To: glider@google.com Cc: Alexander Viro , Andrew Morton , 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 , 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, Eric Biggers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,USER_IN_DEF_DKIM_WL autolearn=no 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 KMSAN doesn't allow treating adjacent memory pages as such, if they were allocated by different alloc_pages() calls. The block layer however does so: adjacent pages end up being used together. To prevent this, make page_is_mergeable() return false under KMSAN. Suggested-by: Eric Biggers Signed-off-by: Alexander Potapenko --- Link: https://linux-review.googlesource.com/id/Ie29cc2464c70032347c32ab2a22e1e7a0b37b905 --- block/bio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/bio.c b/block/bio.c index 4259125e16ab2..db56090c00bae 100644 --- a/block/bio.c +++ b/block/bio.c @@ -836,6 +836,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, return false; *same_page = ((vec_end_addr & PAGE_MASK) == page_addr); + if (!*same_page && IS_ENABLED(CONFIG_KMSAN)) + return false; if (*same_page) return true; return (bv->bv_page + bv_end / PAGE_SIZE) == (page + off / PAGE_SIZE); -- 2.36.0.rc2.479.g8af0fa9b8e-goog