From patchwork Wed Oct 30 14:22:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11219653 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 CA0111668 for ; Wed, 30 Oct 2019 14:24:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8BD9920656 for ; Wed, 30 Oct 2019 14:24:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="G564xCi5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BD9920656 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 961296B000D; Wed, 30 Oct 2019 10:24:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8C7AE6B0288; Wed, 30 Oct 2019 10:24:01 -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 6553F6B028A; Wed, 30 Oct 2019 10:24:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0009.hostedemail.com [216.40.44.9]) by kanga.kvack.org (Postfix) with ESMTP id 373406B000D for ; Wed, 30 Oct 2019 10:24:01 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id C5532180AD83A for ; Wed, 30 Oct 2019 14:24:00 +0000 (UTC) X-FDA: 76100670240.12.owl79_4018919f97b19 X-Spam-Summary: 2,0,0,5ce3d9f4711eb963,d41d8cd98f00b204,3_5y5xqykcbq052xyb08805y.w86527eh-664fuw4.8b0@flex--glider.bounces.google.com,:vegard.nossum@oracle.com:dvyukov@google.com::viro@zeniv.linux.org.uk:akpm@linux-foundation.org:aryabinin@virtuozzo.com:luto@kernel.org:ard.biesheuvel@linaro.org:arnd@arndb.de:hch@lst.de:dmitry.torokhov@gmail.com:edumazet@google.com:ericvh@gmail.com:gregkh@linuxfoundation.org:harry.wentland@amd.com:herbert@gondor.apana.org.au:mingo@elte.hu:axboe@kernel.dk:martin.petersen@oracle.com:schwidefsky@de.ibm.com:mst@redhat.com:monstr@monstr.eu:pmladek@suse.com:sergey.senozhatsky@gmail.com:rostedt@goodmis.org:tiwai@suse.com:tytso@mit.edu:tglx@linutronix.de:wsa@the-dreams.de:gor@linux.ibm.com:iii@linux.ibm.com:mark.rutland@arm.com:willy@infradead.org:rdunlap@infradead.org:andreyknvl@google.com:elver@google.com:glider@google.com,RULES_HIT:41:152:355:379:541:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1534:1541:1593:1594:1711:1730:1747 :1777:17 X-HE-Tag: owl79_4018919f97b19 X-Filterd-Recvd-Size: 4411 Received: from mail-vs1-f74.google.com (mail-vs1-f74.google.com [209.85.217.74]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Oct 2019 14:24:00 +0000 (UTC) Received: by mail-vs1-f74.google.com with SMTP id q8so284338vso.16 for ; Wed, 30 Oct 2019 07:24:00 -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=DjLgBhOxImo8wyDx7ZIRDkwVUdutczZPc5fAA6NR3ag=; b=G564xCi5mTolvYVdU13Btorjpx/PdDy5Re2jioFL9zjQxw3Agd8i+sdbIg6pNEXsuX w5FnEVQNVmMHYaC2OzhrCwrJBzl6NxG1PNt6kw2yxsGD8Agb/SW0l2nxSndS1KS+au4J EyQkG0Bx8KAbYi8IBoWZ7GDhfeoYnyOwqM4NnPpU/Okbk/xX0uizPPT1L2G0HsEVwlrX S540xqiKQOEc95AvsXWoPpragSnr85yke9H88Wb81+nbG7y72L7z/YKPCtMP0FecEtRV U70EEu7QA47tBLgcOe0XryJX/pEjynahyZ7NlT/GP2tO+9kPkO/4y77mEyTd6w8SXftK rbxA== 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=DjLgBhOxImo8wyDx7ZIRDkwVUdutczZPc5fAA6NR3ag=; b=UAq0NJlUXXv6SSRtt6bgPuug97UxlJzyRxzzoQp94ZnpmbWQvMCdVIB2DHK5l9aE3W i9fHLBrF3iwB38QrfibPhB4qIMkFQt/vfaVSGU1fIbDQLgvlVdAsFw4BN1JaT1dLFa9B asTS2bf3EKN9p6NHYnU6LgAqDZIWoVt7cWdBo+sAJzzGwdZurqqlZQTLa89ty/Dem6X1 2ZBSU3TMTpH1BwnBn29FC5A5JzC+5cDja6tElhaW3iZMht+DAh0rDI6pDoVcYszqezX0 0yMZA95lxAK7zfiNQbx/mIrs+P1ilwxRV5uEb3G5mMTngwdBTT4WVy0LDNOju2gT3ESj W6Ew== X-Gm-Message-State: APjAAAWq864ZdRpOxh3Bo7lj1YpVcJ/DHdF47nEVQjDpRsUMQsbktpCx KTjElC/u/oksb1jfAwPbr1xQoRe6Xds= X-Google-Smtp-Source: APXvYqz+xokYBX/34Rf8S5KcM5PzTHarp8HHmxpOSPPjWyj6uxiE0qX+RutkQdyowaVjvP29YCvdrlXkzn8= X-Received: by 2002:a9f:31a9:: with SMTP id v38mr7042326uad.33.1572445439435; Wed, 30 Oct 2019 07:23:59 -0700 (PDT) Date: Wed, 30 Oct 2019 15:22:36 +0100 In-Reply-To: <20191030142237.249532-1-glider@google.com> Message-Id: <20191030142237.249532-25-glider@google.com> Mime-Version: 1.0 References: <20191030142237.249532-1-glider@google.com> X-Mailer: git-send-email 2.24.0.rc0.303.g954a862665-goog Subject: [PATCH RFC v2 24/25] kmsan: disable strscpy() optimization under KMSAN From: glider@google.com To: Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org Cc: viro@zeniv.linux.org.uk, akpm@linux-foundation.org, aryabinin@virtuozzo.com, luto@kernel.org, ard.biesheuvel@linaro.org, arnd@arndb.de, hch@lst.de, dmitry.torokhov@gmail.com, edumazet@google.com, ericvh@gmail.com, gregkh@linuxfoundation.org, harry.wentland@amd.com, herbert@gondor.apana.org.au, mingo@elte.hu, axboe@kernel.dk, martin.petersen@oracle.com, schwidefsky@de.ibm.com, mst@redhat.com, monstr@monstr.eu, pmladek@suse.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, tiwai@suse.com, tytso@mit.edu, tglx@linutronix.de, wsa@the-dreams.de, gor@linux.ibm.com, iii@linux.ibm.com, mark.rutland@arm.com, willy@infradead.org, rdunlap@infradead.org, andreyknvl@google.com, elver@google.com, Alexander Potapenko 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.