Message ID | 20220329124017.737571-36-glider@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 E740BC433EF for <linux-mm@archiver.kernel.org>; Tue, 29 Mar 2022 12:42:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 803858D0014; Tue, 29 Mar 2022 08:42:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7B27E8D0002; Tue, 29 Mar 2022 08:42:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6515E8D0014; Tue, 29 Mar 2022 08:42:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 58D2C8D0002 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 08:42:05 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1C7848248D52 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 12:42:05 +0000 (UTC) X-FDA: 79297386210.29.30F4472 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) by imf03.hostedemail.com (Postfix) with ESMTP id 8E9792000C for <linux-mm@kvack.org>; Tue, 29 Mar 2022 12:42:04 +0000 (UTC) Received: by mail-ej1-f74.google.com with SMTP id de52-20020a1709069bf400b006dffb966922so8125421ejc.2 for <linux-mm@kvack.org>; Tue, 29 Mar 2022 05:42:04 -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=/KmrLQz2B9LUGG5T0s5DB1smaxsYg6k7avQ3Zjj3eGk=; b=nf15GMhub2RWppTwCYZIrWIlhESGQRfc/W+NIYyqHWkrAY5ZTdWS9tNg5R+WFNEwDR ws+bWlr0jAPjLQgTU8HBYWK/xBDV/+Z4gS8/E0xP18HFUtngLfocVvFSvgaAAKlkp4H3 kXATs/dpgLrmitCYFBWHPxmJvSrUCCPUNzG/KXTkCq2AyohIUvlifgXGdxppP4apBE5A LAliLdtfENt0IXvOlwHuX/jsHQwOwjSPAiUrAj6DAH7RdyI9h/hc7xkf9IhqtKQUhdA7 KWoj2cicXsXsWzrnFpLIgQlZXdwXJns/c+61ORU+3rxi9tyOWn8w7u20i5xnvlynULyv A3iw== 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=/KmrLQz2B9LUGG5T0s5DB1smaxsYg6k7avQ3Zjj3eGk=; b=0D5N7MoR7k3XDvIajRgddh+a/qZ35JcDNcv1049UoYN/QAPffntguHWz8VtIB0rKfW 17Ys+6JywnCp5cLcaR2WEl+YAIllK++H4VqBvhiknIqYz+5lJmxvlAMOoml669hpyxrq aZADszHPoRqhU91eXOq6WuhxIjOYcfM5iE1uGVKBitGejmccFxBpmd5pNjK21G1b93hx yjooLabli3hlIXNN/pweB2aCI++eXZzCtR0QbgaaS7S+bcnyq5GBljr9WroEMuWOLGfP 2hr+y8yeeSh+vbRvfhy9UvJNFj06V/Vy9OoCE9McBmCm6sX5xBLZBV/+xZutyds4dlu0 952A== X-Gm-Message-State: AOAM531Kc3YfVV7Img/SQRONeIT4Ym07lvpl8aJSF6Y3TRKFnxgw3BRm YLsiXpPJUqxmr+BEUggM7YNsKVK2DTo= X-Google-Smtp-Source: ABdhPJxVb0eTOD5/UioVaLlWvIUvUDI3ZO47Rl6mwf+HN91ZLWrwoGAWiWD7v0UD4gilbb/v2zNMV7AgqQo= X-Received: from glider.muc.corp.google.com ([2a00:79e0:15:13:36eb:759:798f:98c3]) (user=glider job=sendgmr) by 2002:a17:906:3583:b0:6d1:c07:fac0 with SMTP id o3-20020a170906358300b006d10c07fac0mr34312763ejb.749.1648557723241; Tue, 29 Mar 2022 05:42:03 -0700 (PDT) Date: Tue, 29 Mar 2022 14:40:04 +0200 In-Reply-To: <20220329124017.737571-1-glider@google.com> Message-Id: <20220329124017.737571-36-glider@google.com> Mime-Version: 1.0 References: <20220329124017.737571-1-glider@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 35/48] kmsan: block: skip bio block merging logic for KMSAN From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Andrew Morton <akpm@linux-foundation.org>, Andrey Konovalov <andreyknvl@google.com>, Andy Lutomirski <luto@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Borislav Petkov <bp@alien8.de>, Christoph Hellwig <hch@lst.de>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Dmitry Vyukov <dvyukov@google.com>, Eric Dumazet <edumazet@google.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Herbert Xu <herbert@gondor.apana.org.au>, Ilya Leoshkevich <iii@linux.ibm.com>, Ingo Molnar <mingo@redhat.com>, Jens Axboe <axboe@kernel.dk>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Kees Cook <keescook@chromium.org>, Marco Elver <elver@google.com>, Mark Rutland <mark.rutland@arm.com>, Matthew Wilcox <willy@infradead.org>, "Michael S. Tsirkin" <mst@redhat.com>, Pekka Enberg <penberg@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Petr Mladek <pmladek@suse.com>, Steven Rostedt <rostedt@goodmis.org>, Thomas Gleixner <tglx@linutronix.de>, Vasily Gorbik <gor@linux.ibm.com>, Vegard Nossum <vegard.nossum@oracle.com>, Vlastimil Babka <vbabka@suse.cz>, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Biggers <ebiggers@google.com> Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8E9792000C X-Stat-Signature: 3do8sxtogfdph4hpoa6xoxz4e1t1hpj5 X-Rspam-User: Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=nf15GMhu; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of 3m_5CYgYKCLwinkfgtiqqing.eqonkpwz-oomxcem.qti@flex--glider.bounces.google.com designates 209.85.218.74 as permitted sender) smtp.mailfrom=3m_5CYgYKCLwinkfgtiqqing.eqonkpwz-oomxcem.qti@flex--glider.bounces.google.com X-HE-Tag: 1648557724-754779 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: <linux-mm.kvack.org> |
Series |
Add KernelMemorySanitizer infrastructure
|
expand
|
diff --git a/block/bio.c b/block/bio.c index 4312a8085396b..3c8806bbe3a81 100644 --- a/block/bio.c +++ b/block/bio.c @@ -808,6 +808,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);
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 <ebiggers@google.com> Signed-off-by: Alexander Potapenko <glider@google.com> --- Link: https://linux-review.googlesource.com/id/Ie29cc2464c70032347c32ab2a22e1e7a0b37b905 --- block/bio.c | 2 ++ 1 file changed, 2 insertions(+)