Message ID | 20220701142310.2188015-29-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 30E85C43334 for <linux-mm@archiver.kernel.org>; Fri, 1 Jul 2022 14:24:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA0126B007D; Fri, 1 Jul 2022 10:24:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B28876B0082; Fri, 1 Jul 2022 10:24:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C99B6B0083; Fri, 1 Jul 2022 10:24:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 88D5B6B007D for <linux-mm@kvack.org>; Fri, 1 Jul 2022 10:24:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 6A9F6603A7 for <linux-mm@kvack.org>; Fri, 1 Jul 2022 14:24:35 +0000 (UTC) X-FDA: 79638751710.02.562B3DC Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf22.hostedemail.com (Postfix) with ESMTP id 21204C0009 for <linux-mm@kvack.org>; Fri, 1 Jul 2022 14:24:34 +0000 (UTC) Received: by mail-ed1-f74.google.com with SMTP id z13-20020a056402274d00b004357fcdd51fso1870463edd.17 for <linux-mm@kvack.org>; Fri, 01 Jul 2022 07:24:34 -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=tSPSuwfCBJYINsR4GH3IgbP5patOgmYnzcC5xbF5jrk=; b=fBpJ5slqI8D0FOXlutf00Q01e2/qkKGZMnWH0QFqV3SMTrnSjxCWOU4Pqh88ufv3NQ IfRJI3UQIhuhwdip4JvVQMQ0GmgbHCP23qV+TLI5z5xixX0f7GhYWJ0KQ1im+NF7L5qc Pkq7nAOUgfMsrQqnSYEqcjeYwLR5EOBvpP0TGKGBvfsM2Tv2Ix3OAW1CAWsOCQoKqQ9c em6kSS3mBnEDJKreuud9sUY6SkRHrCFbsdOQdD/6Y3m3J12I9+Y2wd+Aam71SXnA0koY C8Wt7O96xHpDNeJE2AG92PtC1SizglmTVKICFmvWSO765naM8cDe6vlSu0NadfhbBuA2 mElQ== 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=tSPSuwfCBJYINsR4GH3IgbP5patOgmYnzcC5xbF5jrk=; b=YqdQQc85lrk4DSDJFFfNPn1HTF71QsVnI/rHf92xfLxd9KsyNImfuwAoVhxXt6R8nL qwDobsVCAeGtzrcm/Iz8chRC6X5kRQwRSAuw9UNg9tlR7AAzR9GHi7tR1yDsKP193Kwv C8Oo2HBXz355U/B31Rgf1GX9eI0BMMT2mpnO1IydpEbkRHWmLL2+vOfTzG9bcqONtKhB FyZtDgyaQ2aOn8P3u4jUAygDjBmx95Pe1gSB/1G8hpnvsZxEwysBr9cpR07KcxPYvb4N o1lJZkhudRaAXfIcvZqzXYoXG/vF/amb6/EAuLZXLBkZ0LRHUtWGncdnSsGIvGcxQ9S+ CfeQ== X-Gm-Message-State: AJIora8HXzQFJ7n0jVKdkmsWirxUgic30ZmpZY1gAEqY9x0OPkRSMKew FU6+hS9ohh2bkmMv2GViF//ZmgCNdZU= X-Google-Smtp-Source: AGRyM1vbbcq8j11xYn5VJA0O5txvAR43cAqjEC618P5YqGVKcV6s6WBbHTsxKY+3oiObUtk4x14dSKdPgts= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:a6f5:f713:759c:abb6]) (user=glider job=sendgmr) by 2002:a05:6402:1f15:b0:435:8a5a:e69c with SMTP id b21-20020a0564021f1500b004358a5ae69cmr19068159edb.90.1656685473944; Fri, 01 Jul 2022 07:24:33 -0700 (PDT) Date: Fri, 1 Jul 2022 16:22:53 +0200 In-Reply-To: <20220701142310.2188015-1-glider@google.com> Message-Id: <20220701142310.2188015-29-glider@google.com> Mime-Version: 1.0 References: <20220701142310.2188015-1-glider@google.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog Subject: [PATCH v4 28/45] kmsan: disable physical page merging in biovec From: Alexander Potapenko <glider@google.com> To: glider@google.com Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Alexei Starovoitov <ast@kernel.org>, 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>, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656685475; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tSPSuwfCBJYINsR4GH3IgbP5patOgmYnzcC5xbF5jrk=; b=3npuWybUI+lqarXYy03yyomSuJAIcN1WIwPDQoybXQMIKKUueiGXX4lW5pAOuZHwyCpIGw yxayMBabYUlyutXzQkqxs1HMnyIm+PJ96CQ8TwjeKgvRYCtXX8b4hoQNkyS91vkZsJMTMQ NLpWpSACWpcPkRGAxg6LbHHgYbuS1ks= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656685475; a=rsa-sha256; cv=none; b=IN/5SOJ19OF0KsBdEs0zfjIqCmTJ9STRuli8K4QdqRxK+ZN7i+9zSexI6M3dGQmvYpVJT4 LpCZj0kNvcnWVyp6k+YzuHypH8nnra8gAOOT8fZUZMVIBSHy5N4s890USxRDNuzv8WDACf fNkHZljYugx0Yg1R6Acq5M3weRKMUPQ= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fBpJ5slq; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf22.hostedemail.com: domain of 3oQO_YgYKCMAmrojkxmuumrk.iusrot03-ssq1giq.uxm@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3oQO_YgYKCMAmrojkxmuumrk.iusrot03-ssq1giq.uxm@flex--glider.bounces.google.com Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=fBpJ5slq; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf22.hostedemail.com: domain of 3oQO_YgYKCMAmrojkxmuumrk.iusrot03-ssq1giq.uxm@flex--glider.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3oQO_YgYKCMAmrojkxmuumrk.iusrot03-ssq1giq.uxm@flex--glider.bounces.google.com X-Rspamd-Server: rspam03 X-Rspam-User: X-Stat-Signature: kgtgo9soc59iewn83xijk9k8zr885juj X-Rspamd-Queue-Id: 21204C0009 X-HE-Tag: 1656685474-158063 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/blk.h b/block/blk.h index 434017701403f..96309a98a60e3 100644 --- a/block/blk.h +++ b/block/blk.h @@ -93,6 +93,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))
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. Signed-off-by: Alexander Potapenko <glider@google.com> --- Link: https://linux-review.googlesource.com/id/Iece16041be5ee47904fbc98121b105e5be5fea5c --- block/blk.h | 7 +++++++ 1 file changed, 7 insertions(+)