Message ID | 20220826150807.723137-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 E9809ECAAA3 for <linux-mm@archiver.kernel.org>; Fri, 26 Aug 2022 15:09:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 80EEF940009; Fri, 26 Aug 2022 11:09:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7976D940007; Fri, 26 Aug 2022 11:09:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EC36940009; Fri, 26 Aug 2022 11:09:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4D01A940007 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 11:09:32 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 340F740E3E for <linux-mm@kvack.org>; Fri, 26 Aug 2022 15:09:32 +0000 (UTC) X-FDA: 79842077784.04.DF5C1D8 Received: from mail-ej1-f74.google.com (mail-ej1-f74.google.com [209.85.218.74]) by imf15.hostedemail.com (Postfix) with ESMTP id D7778A0027 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 15:09:31 +0000 (UTC) Received: by mail-ej1-f74.google.com with SMTP id mp41-20020a1709071b2900b0073d84b11981so731143ejc.23 for <linux-mm@kvack.org>; Fri, 26 Aug 2022 08:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=+5QrT5xfdlDeiLaqkJXiB84dUzsqj5PxvneJHk/QPSg=; b=psU325BcC9yCrTgirTaG4c6+Xtt5yEuOoqBDgzPyoh8Hu/P8wcF78qEe5Fv8Uq6mxM 5keARp+YcPeQ8kw2cba6I1H8TcR6qm0KRbaLOkU+IfLk8PtK83FSP/gowyt+6cMWfvxZ fE9laQ1Snqp2aoMqiOY1YPig7tDAMkED/KaWIJ682ZVuc6+uGvL4n3H/HrRhkL0dFAfP qPPg29aXbvpDPvKUJJFkWAZ+F418Tz4/xxZqjZPJP6QnWJRDQgXx2bOBAWB+HjiGP74T HU0Ev+YyOY48tZD9hgwrs4RkUWaxRCmaLSAihTVflh5YMg0/YJxLiIdMMS9B8R/uWWUE aznw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=+5QrT5xfdlDeiLaqkJXiB84dUzsqj5PxvneJHk/QPSg=; b=YjORjUZC70Om+LbAzwSMBAo6fM/HqV8RcIsEoac3ghw0RyBoKAb0+4mLrnXZRUokyU UnDXsSgU2WGej23MEgtxSwbvhSSjC0Tf4gqulvIezq5M6HZQyF530DODmCaLRg6R2KTN LGWhI2ldDVi+VlgCIAzCy+VJMNgnsAf5WXZcEDqe/u0gS4wqaXIl/akBQom5kIXMCuRp /EWJMnIzMtf4nt0YMoDWW4dmBTL3tB7sJ5ou8I+JSCOgimoxolW0TCzB6PQaAIOr8h26 m7mtD+VdzS8QxTNvJnPNN3/+HkMW3+TVtVMnE/7/bE1BzJeQS/KCnYOjbDBzc/o3QmxM LqoQ== X-Gm-Message-State: ACgBeo1AS83zG35GuRmsXxEapeJIKE3soTYv/EWwAycoXofvXUFQwBN5 yNR/7/Bd80yrdVw287BB9tgDu/FQSbM= X-Google-Smtp-Source: AA6agR64mNuFawO1j56e/34eHqe4IGdV2CngnQTQuYSPV0pxJ0eEBVtcq2c/F1Fd/CUKRPUFcQzSoaSzSas= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:5207:ac36:fdd3:502d]) (user=glider job=sendgmr) by 2002:a05:6402:496:b0:443:a5f5:d3b with SMTP id k22-20020a056402049600b00443a5f50d3bmr7388597edv.331.1661526570674; Fri, 26 Aug 2022 08:09:30 -0700 (PDT) Date: Fri, 26 Aug 2022 17:07:51 +0200 In-Reply-To: <20220826150807.723137-1-glider@google.com> Mime-Version: 1.0 References: <20220826150807.723137-1-glider@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826150807.723137-29-glider@google.com> Subject: [PATCH v5 28/44] 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=1661526571; 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=+5QrT5xfdlDeiLaqkJXiB84dUzsqj5PxvneJHk/QPSg=; b=N3pPIpEudr1cLN7klLnozmAsqXfN6wenIQQRUcfsgQHsN+q3tuXpZEVpBjNORfuvQGNg9K fgw135MS9HwQnwCipTF2TAVNfvcuaor58K6jTx/f6PGBSx6HXHn3WKkO6P7YBTXU2EfJ0x qC2Y1t++GkTo78Ugo571+B12Ow7NUTI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=psU325Bc; spf=pass (imf15.hostedemail.com: domain of 3KuIIYwYKCDETYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com designates 209.85.218.74 as permitted sender) smtp.mailfrom=3KuIIYwYKCDETYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661526571; a=rsa-sha256; cv=none; b=iedK29VMn7NHAv4RhxN5TycvZVTsDz4HrI3vY8WmbYw2H5pVCSesEEhO1DAUEJ/dLe3vO/ NSPdLYOrx8afOTXtKan9Ww5VjqaCQxKTGMdWJWL3yhMVohKEtmknMJhot9Ece7Dn5GFJ67 AjDJ5uCPDiz9kO9eburX646aDPtrlmw= X-Rspam-User: Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=psU325Bc; spf=pass (imf15.hostedemail.com: domain of 3KuIIYwYKCDETYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com designates 209.85.218.74 as permitted sender) smtp.mailfrom=3KuIIYwYKCDETYVQReTbbTYR.PbZYVahk-ZZXiNPX.beT@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Stat-Signature: 1mebhaex7hqymbbbaxgyiauwkjpy7cmd X-Rspamd-Queue-Id: D7778A0027 X-HE-Tag: 1661526571-644535 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 d7142c4d2fefb..af02b93c1dba5 100644 --- 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))
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(+)