From patchwork Fri Nov 22 11:26:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11257919 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 985336C1 for ; Fri, 22 Nov 2019 11:28:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B29420672 for ; Fri, 22 Nov 2019 11:28:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BCmFvAWD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B29420672 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 88C5C6B04FB; Fri, 22 Nov 2019 06:28:04 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7ED876B04FD; Fri, 22 Nov 2019 06:28:04 -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 68FF26B04FE; Fri, 22 Nov 2019 06:28:04 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 4CF4A6B04FB for ; Fri, 22 Nov 2019 06:28:04 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 14CA3180AD81C for ; Fri, 22 Nov 2019 11:28:04 +0000 (UTC) X-FDA: 76183689288.27.straw23_c2b8edff562c X-Spam-Summary: 2,0,0,7aca3f710ebf9890,d41d8cd98f00b204,3qsbxxqykccmfkhcdqfnnfkd.bnlkhmtw-llju9bj.nqf@flex--glider.bounces.google.com,:vegard.nossum@oracle.com:dvyukov@google.com::glider@google.com:viro@zeniv.linux.org.uk:adilger.kernel@dilger.ca:akpm@linux-foundation.org:andreyknvl@google.com: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: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:axboe@kernel.dk: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: straw23_c2b8edff562c X-Filterd-Recvd-Size: 4585 Received: from mail-vk1-f202.google.com (mail-vk1-f202.google.com [209.85.221.202]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Nov 2019 11:28:03 +0000 (UTC) Received: by mail-vk1-f202.google.com with SMTP id m72so331779vka.20 for ; Fri, 22 Nov 2019 03:28:03 -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=xlmuVFx5FAVYht7dDhFx+15C9rTClhUqmm+qlJjafVc=; b=BCmFvAWDRbDP4oA68eGL+gRWs6s32zN5uoT7GGW4dyf+5Vjqg6kp0MO02C6DVh+G94 5kpg1XbRKZcR0+gFXeqp3bYfgcuPdyiWqKsvK+v07kdlQhjoBIuJoBnZ7uSycEp9b7pi ByAqNvkEfxJtnvSMYun5iBwJnB+XCaX1w841gESQeItWwi/i0u4XQt7857rz86u70ri0 Cv4DgpCUrF8i/eYgdYYXL6lzO3jnR/8E5ecam8xK3hXzB0yzpcphy6mCIXxmSJvx2Ejz xcJlRZTkRuAfvDeTAc18gbccrgX+p4BIGOvkmbTJUdukmOSc9IsdO4JnEBxFsBf9xaPZ DdMw== 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=xlmuVFx5FAVYht7dDhFx+15C9rTClhUqmm+qlJjafVc=; b=B5XdJ/jS7Tvyj/CDTHabUTj5y5OzndFdDKZKXIOwvJHyzL/REUJfw033YDzAEiLpHU 9Z+IKwLTC2vD9lECSHge8B9wzflORXVtT91ae0b+hEy85x0d9YcQt+SjqCaE2zgxM3W9 dUoitTmVZiCFx3A2ymyScUWKKTGwqsvlkjgs4ee+B6g7+FzuV1FxyFXGh6Ji2R5qNdHd c00DXycYJ+/DHCtelwklkzTaD9VQ7/oqVhmgOqm77ycBAWqCqHnL358GXP4f+ZU7h8JA sh5h9HehkyHFljB8VuN9+4hg5oO1NtKGJa0fpNBzxEuQAT5HFp+WvjHkDx6LGbaQZec9 /tZQ== X-Gm-Message-State: APjAAAVKAyMCF/XdOB40JeLh5iiEwmxlKpPVQGBzYagsbrZoRcRB7raJ StnccKPraaNZfbeuv+7EkWm6qJPsjIU= X-Google-Smtp-Source: APXvYqxmHYDGzMqxGhiddLX3YlXQNNJgs1A9UfecoCJptsTxtWyaZyQki6wPlPlTGkfcNDys8TxHg8/U1nc= X-Received: by 2002:ac5:c7b1:: with SMTP id d17mr8915300vkn.90.1574422082878; Fri, 22 Nov 2019 03:28:02 -0800 (PST) Date: Fri, 22 Nov 2019 12:26:16 +0100 In-Reply-To: <20191122112621.204798-1-glider@google.com> Message-Id: <20191122112621.204798-32-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 31/36] kmsan: disable strscpy() optimization under KMSAN From: glider@google.com To: Vegard Nossum , Dmitry Vyukov , 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, 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, 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, axboe@kernel.dk, 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: Disable the efficient 8-byte reading under KMSAN to avoid false positives. Signed-off-by: Alexander Potapenko To: Alexander Potapenko Cc: Vegard Nossum Cc: Dmitry Vyukov Cc: linux-mm@kvack.org --- Change-Id: I25d1acf5c3df6eff85894cd94f5ddbe93308271c --- lib/string.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/string.c b/lib/string.c index 08ec58cc673b..15efdc51bda6 100644 --- a/lib/string.c +++ b/lib/string.c @@ -186,7 +186,10 @@ ssize_t strscpy(char *dest, const char *src, size_t count) if (count == 0 || WARN_ON_ONCE(count > INT_MAX)) return -E2BIG; -#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS +/** + * Disable the efficient 8-byte reading under KMSAN to avoid false positives. + */ +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && !defined(CONFIG_KMSAN) /* * If src is unaligned, don't cross a page boundary, * since we don't know if the next page is mapped.