Message ID | 20220915150417.722975-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 0D40EECAAA1 for <linux-mm@archiver.kernel.org>; Thu, 15 Sep 2022 15:05:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84A3E8001B; Thu, 15 Sep 2022 11:05:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D36380007; Thu, 15 Sep 2022 11:05:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6737D8001B; Thu, 15 Sep 2022 11:05:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5A80480007 for <linux-mm@kvack.org>; Thu, 15 Sep 2022 11:05:56 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3E84B8041B for <linux-mm@kvack.org>; Thu, 15 Sep 2022 15:05:56 +0000 (UTC) X-FDA: 79914644712.13.CA8252B Received: from mail-ed1-f73.google.com (mail-ed1-f73.google.com [209.85.208.73]) by imf19.hostedemail.com (Postfix) with ESMTP id E65C81A008F for <linux-mm@kvack.org>; Thu, 15 Sep 2022 15:05:55 +0000 (UTC) Received: by mail-ed1-f73.google.com with SMTP id b16-20020a056402279000b0044f1102e6e2so13539231ede.20 for <linux-mm@kvack.org>; Thu, 15 Sep 2022 08:05:55 -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:subject:date; bh=r3HZXk/BEn65kcaybENH+gdA6j04yycM3f96/pfDo3Y=; b=aQq72eadbZwq/GT1Z6Tvw/xmOlMUZLlJTyI0TzrhiZrves5ntWwvh+3uFDLBYpLZrJ h1ikkP9rXSVFWTA7ciUJFF1f9AUJxqJ97pqMJydqQcXAEzGr5ROFVuNaZF31wV1P7g8M nPgn0UmEt2qu/qdoDASndOpnDkzYfrDFlTkTXR1TZFGxdGAy2NWU1EHXUoqxbAKmtWHq Drjc0QS6zlbEIhSvlyonau7djr6wX8/b9A42B31BEiQEkTzvbOq7cf836X8Y6zwp4Xt2 5z7af56B6lhbyz2HnKF7iuuVKYQhx5EEMxMssHo7LL1JYSTlA627gSdeqm8QJnNMhwiu c8cg== 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:subject:date; bh=r3HZXk/BEn65kcaybENH+gdA6j04yycM3f96/pfDo3Y=; b=NQ5ESZemlwBrsfdBgjudDHMThJiOrHRlM45Xg7hPryuhb28D9ZHR2xzS81Syg7/HJJ LLcpts7XcUTuIfKEG0/nS1yyEVe1D5ogYucvPGXZVT9VZtuPvAUQQQ7iYc7ieVv/L1Zx 3TspDZJ8S4M11wz4OGSiqyHP2bO1KaCRK1QL4ZaamNAK7yRBAoZBpYw6KNjchX0RlddJ uUtEDxBMe7qXb94GvWImtc7Tfk1SD2koAAzPNITt725241N+2bMvGRHm+jrhGwNA58qB Pv6oPn5bX6G2A6i/WsAo7ku2dTie0Ky8wGlG46e8bcW5wSyg1zVXt3NFW30pbnBnDh3v ur8g== X-Gm-Message-State: ACrzQf2uQIE2srbHABQF7lGQvLMSo6RP7x92B+kFlkMIO3BPqpX+zmM7 LjhA3x+e6KuZaenN8m6zwc0IKAj02vA= X-Google-Smtp-Source: AMsMyM6uBsA7z2khpa50VHXjQ1OsQRpz1YZswt7+7yb6nCMBvzQUnbwuUJjr2s0ZO22E81AmTxMrGHgbB8I= X-Received: from glider.muc.corp.google.com ([2a00:79e0:9c:201:686d:27b5:495:85b7]) (user=glider job=sendgmr) by 2002:a17:907:b0e:b0:77a:d97d:9afc with SMTP id h14-20020a1709070b0e00b0077ad97d9afcmr287936ejl.199.1663254354566; Thu, 15 Sep 2022 08:05:54 -0700 (PDT) Date: Thu, 15 Sep 2022 17:04:02 +0200 In-Reply-To: <20220915150417.722975-1-glider@google.com> Mime-Version: 1.0 References: <20220915150417.722975-1-glider@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220915150417.722975-29-glider@google.com> Subject: [PATCH v7 28/43] block: kmsan: 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>, 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 Biggers <ebiggers@kernel.org>, 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>, Stephen Rothwell <sfr@canb.auug.org.au>, 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, Eric Biggers <ebiggers@google.com> Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aQq72ead; spf=pass (imf19.hostedemail.com: domain of 3Uj8jYwYKCH0hmjefshpphmf.dpnmjovy-nnlwbdl.psh@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3Uj8jYwYKCH0hmjefshpphmf.dpnmjovy-nnlwbdl.psh@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663254355; a=rsa-sha256; cv=none; b=ySTYUxjzlXfe1ZStnMIk0Nt7mNURIED/ph4O9NwL58lAiSWAmTpX/hvFu5sH/kn/8pa2fT 5FCxrqtrub07MS0Fg3YuKLTfAd/M25rlMyEwZjPiQdiOt22wTJlC+CW8vFYfrb6vSeeyFi hs0p5jjvqvhUIUhouBJNabpdaowKy58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663254355; 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=r3HZXk/BEn65kcaybENH+gdA6j04yycM3f96/pfDo3Y=; b=wykkJSk/PNCiF3QW3vFe4uTXpqlMVSHTxx3hZ1otXoiiRtNAbA1s70UB4OIj8YbrHmrT6A dw8n9HgbFT5Yp1RVnrNE3pAr6t/BXpADIqhC+SvnG+wqepSoJ+YRf/1gG5X6gPO7TF0DZV 0GVii7MwfdUUPJ61AjXUb/xTtwTwGjg= X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: E65C81A008F X-Rspam-User: Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aQq72ead; spf=pass (imf19.hostedemail.com: domain of 3Uj8jYwYKCH0hmjefshpphmf.dpnmjovy-nnlwbdl.psh@flex--glider.bounces.google.com designates 209.85.208.73 as permitted sender) smtp.mailfrom=3Uj8jYwYKCH0hmjefshpphmf.dpnmjovy-nnlwbdl.psh@flex--glider.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: 11o1ckrpbbjd1gosor7qq3o1o3ytwqku X-HE-Tag: 1663254355-378766 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 3d3a2678fea25..106ef14f28c2a 100644 --- a/block/bio.c +++ b/block/bio.c @@ -869,6 +869,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, *same_page = ((vec_end_addr & PAGE_MASK) == page_addr); if (*same_page) return true; + else if (IS_ENABLED(CONFIG_KMSAN)) + return false; 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> --- v4: -- swap block: and kmsan: in the subject v5: -- address Marco Elver's comments Link: https://linux-review.googlesource.com/id/Ie29cc2464c70032347c32ab2a22e1e7a0b37b905 --- block/bio.c | 2 ++ 1 file changed, 2 insertions(+)