From patchwork Wed Mar 25 16:12:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11458307 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD09215AB for ; Wed, 25 Mar 2020 16:15:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6EAB720409 for ; Wed, 25 Mar 2020 16:15:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="P0RHEu8Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EAB720409 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 733A76B00B6; Wed, 25 Mar 2020 12:14:58 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6924E6B00B8; Wed, 25 Mar 2020 12:14:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55AC96B00B9; Wed, 25 Mar 2020 12:14:58 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 305AB6B00B6 for ; Wed, 25 Mar 2020 12:14:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0BFF9181FEBDB for ; Wed, 25 Mar 2020 16:14:58 +0000 (UTC) X-FDA: 76634383476.09.size84_829e7870e383b X-Spam-Summary: 2,0,0,04abafb0c6de7277,d41d8cd98f00b204,3f4n7xgykcg4sxupqdsaasxq.oayxuzgj-yywhmow.ads@flex--glider.bounces.google.com,,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1431:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3867:4321:5007:6261:6653:6742:6743:7903:9969:10004:10400:11026:11232:11658:11914:12043:12048:12296:12297:12438:12555:12895:12986:13069:13161:13229:13311:13357:13846:14096:14097:14181:14394:14659:14721:21080:21365:21444:21451:21627:21990:30054:30064,0,RBL:209.85.128.74:@flex--glider.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: size84_829e7870e383b X-Filterd-Recvd-Size: 4821 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Mar 2020 16:14:57 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id f8so1071585wmh.4 for ; Wed, 25 Mar 2020 09:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=YszzUWxckIjfyUu5TKyz3LE5GPIDGFH1V/BAc8tQyGs=; b=P0RHEu8YPElufXzUdEj32UPRGauPMWqr0dywnQW2bkIJU5qxPSjTnIniFnvT9ingRX ugsDgoWBH5ZJRRlM+5KO6BKAPuqpBrUeLW3YaOVSvH4i1KXun+Q8GeOaf7A/FXDDBYnC gsbV4n7TiEl1kdeGLI/EITmxcmbl1IqOceDBl8+NBXoRD+taWzGJ/ppK/j/TdHiyR1IB e5KkebUtrVVPYDezGZwgaXO/UroYr/qtNrKI925pGjt3ymzbWgj1g6kkgrgt3TACvTYU 87SZjCMpc/s42MwwSf8FbsmncXOCKQIlxTaZFUbEBteykR1AdpXu10OeTnNjnwrGIKXC DhlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=YszzUWxckIjfyUu5TKyz3LE5GPIDGFH1V/BAc8tQyGs=; b=PBN9RbzhtyJlbGR32MY1BCU8xeChhua+zkkbjAcXchsB4UI3XG/aad3XpvBX1HJp7+ YkoMjI4PPPqUpUE8EwzHbcPWl+0yPgbBWYiM1LfSbd2DGDG3q7QAsBhzD56mQWR8Tu0J AGfZLFD1dyUFFL/e6miu2DJU0/WHrXqyarOYWgAqgo7Py/ch2L0RYTAjfUKzQtiCS2Y1 A7Y08yTDTTJK93LS90iL8K19VM1rnWkqcLzwDg7GFvQygWJ3yIZceLGlPtBYwfjkT0u1 8UunXJQdv6IkSV7si2BOwuNlH1Ttw5WBhe1KvWrPAixSg7YP0M0r0dcQacZkSWPuxmdv GEXQ== X-Gm-Message-State: ANhLgQ219MjcprVEJXYSyTKjrZM7VOi7I466cHxPifvSrYrieykxT1Zc mZTvChNk6bbdx4McH6V75cOdvIoqSVw= X-Google-Smtp-Source: ADFU+vvMTmUd5iqI2bNDEFbvVuBLXWg5tf8Ay0akzUBugSJ75ia0RHAbWpGQA6cEwE4JsQNjQZnedM/3kXY= X-Received: by 2002:a05:6000:100f:: with SMTP id a15mr4066224wrx.382.1585152895994; Wed, 25 Mar 2020 09:14:55 -0700 (PDT) Date: Wed, 25 Mar 2020 17:12:49 +0100 In-Reply-To: <20200325161249.55095-1-glider@google.com> Message-Id: <20200325161249.55095-39-glider@google.com> Mime-Version: 1.0 References: <20200325161249.55095-1-glider@google.com> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [PATCH v5 38/38] kmsan: block: skip bio block merging logic for KMSAN From: glider@google.com To: Eric Biggers , Jens Axboe , Vegard Nossum , Dmitry Vyukov , Marco Elver , Andrey Konovalov , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, hch@lst.de, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, iii@linux.ibm.com, mingo@elte.hu, jasowang@redhat.com, m.szyprowski@samsung.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.com, mhocko@suse.com, monstr@monstr.eu, pmladek@suse.com, cai@lca.pw, rdunlap@infradead.org, robin.murphy@arm.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, gor@linux.ibm.com, wsa@the-dreams.de 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: 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 Cc: Eric Biggers Cc: Jens Axboe Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: Marco Elver Cc: Andrey Konovalov Cc: linux-mm@kvack.org --- Change-Id: Iff367f421d51fac549e31ed122365b7539642cff --- block/bio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/bio.c b/block/bio.c index 0985f34225561..09503ef00bc20 100644 --- a/block/bio.c +++ b/block/bio.c @@ -696,6 +696,8 @@ static inline bool page_is_mergeable(const struct bio_vec *bv, *same_page = ((vec_end_addr & PAGE_MASK) == page_addr); if (!*same_page && pfn_to_page(PFN_DOWN(vec_end_addr)) + 1 != page) return false; + if (!*same_page && IS_ENABLED(CONFIG_KMSAN)) + return false; return true; }