From patchwork Fri Nov 22 11:26:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11257925 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 ABD4D6C1 for ; Fri, 22 Nov 2019 11:28:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7864520672 for ; Fri, 22 Nov 2019 11:28:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="AkVv7fTu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7864520672 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 7A3366B0501; Fri, 22 Nov 2019 06:28:14 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 703DE6B0503; Fri, 22 Nov 2019 06:28:14 -0500 (EST) 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 619886B0504; Fri, 22 Nov 2019 06:28:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0131.hostedemail.com [216.40.44.131]) by kanga.kvack.org (Postfix) with ESMTP id 4B8A66B0501 for ; Fri, 22 Nov 2019 06:28:14 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 228023ABB for ; Fri, 22 Nov 2019 11:28:14 +0000 (UTC) X-FDA: 76183689708.21.wind27_da13bec56e4c X-Spam-Summary: 2,0,0,93e7f9d9c30760c5,d41d8cd98f00b204,3tmbxxqykcc0purmnapxxpun.lxvurwdg-vvtejlt.xap@flex--glider.bounces.google.com,:axboe@kernel.dk:luto@kernel.org:vegard.nossum@oracle.com:dvyukov@google.com:hch@lst.de::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com:aryabinin@virtuozzo.com:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@infradead.org:darrick.wong@oracle.com:davem@davemloft.net:dmitry.torokhov@gmail.com:ebiggers@google.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:elver@google.com:mark.rutland@arm.com:martin.petersen@oracle.com:schwidefsky@de.ibm.com:willy@infradead.org:mst@redhat.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@li X-HE-Tag: wind27_da13bec56e4c X-Filterd-Recvd-Size: 4929 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 11:28:13 +0000 (UTC) Received: by mail-wm1-f74.google.com with SMTP id i23so2943519wmb.3 for ; Fri, 22 Nov 2019 03:28:13 -0800 (PST) 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=U9YgSeBtmgopx6xZ9Zo9odjAu1mgOmQXZv3LHgbkGE4=; b=AkVv7fTuZATkdKXIxyU0UJx4ujLX9W6EkQ/jZw+jr0QMo4chD2Gs9UziKUca5bk1FI +5XnfKdnuJ4aVGNSMD4cRqyJ+xIqKnZCm2RF+ILhBfy0S0+NascYAVUC/c+k9TdbxAq6 p8VsK2WF1YsCD5XCjdfBVa8jF4Sh5KkJDgjzxi/IAF+eutPSUtHskI2PEk1l86mOoI1P 2UVmO+JqCfz7X/8GttyuAowJMYwSNZ0bbAkcOuXFlz/VxQoYxYvavODTYbFaHJi9DHb/ A3+3Lu9bqf+eCCkNdSOrywp4NaAQRBLEMX/3BxefwB89A8WvUk1PT30iQz4JTlr19qtp 1xrA== 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=U9YgSeBtmgopx6xZ9Zo9odjAu1mgOmQXZv3LHgbkGE4=; b=VDlvVy1yn5JF01elliyW9EKLnd4T5IEnJXJBMhoOxAdxAkWv50z+2PXzJFfn6tIhnA ENKT0URi0YKTkaRbL1nSvykFyt6VBzZTNHans+65h52Yp9aeQBq5vXngbsCxFJGlpiX/ J+TAIOZAdtjgDtuDlsm3wSc4GTScWZF4p/muQRIZ/ETia/BLGRFMRbRqN8IRifbBhIhc pv7C9+Zu26erMkRIl8usMDj4pTynZa6SigX8+KuKKTziCbOlElFhiXMf/9J407eOawAV spxcFlJMiZFM2PWCpO3fMbN+KfRJeCshmIzwdpkuaEt3lbHdErt2eTeGI5yOTVt8gPYb 40HA== X-Gm-Message-State: APjAAAVQF3lh5o7UI2BXA5XtqKTThn6rE3cyj8Us1r1jSgOIvzCEPp/s F1eJQVDKhqwVyA9x7jPkIk7UlE3CdtM= X-Google-Smtp-Source: APXvYqysZQRY9xFQ7//7sBKP7XGtZZjkaf6QaKyZc7w7Vkx2wfzguwUl191eOOBzra3KPq3zdc32j030Uxw= X-Received: by 2002:adf:f4c9:: with SMTP id h9mr16992120wrp.354.1574422092204; Fri, 22 Nov 2019 03:28:12 -0800 (PST) Date: Fri, 22 Nov 2019 12:26:19 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-35-glider@google.com> Mime-Version: 1.0 References: <20191122112621.204798-1-glider@google.com> X-Mailer: git-send-email 2.24.0.432.g9d3f5f5b63-goog Subject: [PATCH RFC v3 34/36] kmsan: disable physical page merging in biovec From: glider@google.com To: Jens Axboe , Andy Lutomirski , Vegard Nossum , Dmitry Vyukov , Christoph Hellwig , linux-mm@kvack.org Cc: glider@google.com, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, akpm@linux-foundation.org, andreyknvl@google.com, aryabinin@virtuozzo.com, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@infradead.org, darrick.wong@oracle.com, davem@davemloft.net, dmitry.torokhov@gmail.com, ebiggers@google.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, elver@google.com, mark.rutland@arm.com, martin.petersen@oracle.com, schwidefsky@de.ibm.com, willy@infradead.org, mst@redhat.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 metadata for consequent physical pages may be inconsequent, 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 To: Alexander Potapenko Cc: Jens Axboe Cc: Andy Lutomirski Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: Christoph Hellwig Cc: linux-mm@kvack.org --- Change-Id: Id2f2babaf662ac44675c4f2790f4a80ddc328fa7 --- block/blk.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/block/blk.h b/block/blk.h index 47fba9362e60..9ee271a22423 100644 --- a/block/blk.h +++ b/block/blk.h @@ -78,6 +78,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; +#ifdef CONFIG_KMSAN + /* + * Merging consequent physical pages may not work correctly under KMSAN + * if their metadata pages aren't consequent. Just disable merging. + */ + return false; +#endif if (addr1 + vec1->bv_len != addr2) return false; if (xen_domain() && !xen_biovec_phys_mergeable(vec1, vec2->bv_page))