From patchwork Fri Oct 18 09:43:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Potapenko X-Patchwork-Id: 11198015 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 D6A0413B1 for ; Fri, 18 Oct 2019 09:44:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A40DF21D7C for ; Fri, 18 Oct 2019 09:44:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kgdMpbU6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A40DF21D7C 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 304908E0034; Fri, 18 Oct 2019 05:44:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 211F78E0003; Fri, 18 Oct 2019 05:44:29 -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 100CA8E0034; Fri, 18 Oct 2019 05:44:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id E0A7E8E0003 for ; Fri, 18 Oct 2019 05:44:28 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 93DD6F038 for ; Fri, 18 Oct 2019 09:44:28 +0000 (UTC) X-FDA: 76056420216.17.goat81_7e5643069f748 X-Spam-Summary: 2,0,0,0225610fac23fc1f,d41d8cd98f00b204,3e4mpxqykccgkpmhivksskpi.gsqpmryb-qqozego.svk@flex--glider.bounces.google.com,:glider@google.com:vegard.nossum@oracle.com:dvyukov@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:1792:2393:2559:2562:3138:3139:3140:3141:3142:3152:3352:3865:3867:3871:4250:4321:5007:6119:6120:6261:6653:7901:7903:9969:10004:10400:11026:11232:11473:11658:11914:12043:12297:12438:12555:12895:12986:13069:13311:13357:13846:14096:14097:14181:14394:14659:14721:21080:21365:21444:21451:21627:30054:30064,0,RBL:209.85.221.73:@flex--glider.bounces.google.com:.lbl8.mailshell.net-62.18.175.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: goat81_7e5643069f748 X-Filterd-Recvd-Size: 3675 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 09:44:28 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id w10so2350613wrl.5 for ; Fri, 18 Oct 2019 02:44:28 -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=F+SkbUx7nCBevvRWhTjoMhc2XnLN3BBIN0tYS79pL9c=; b=kgdMpbU6UkL66TSoKyO6wRkyK5rV/1HIjD2Y1RzThUPOGp0ocujomKDNiciZkWHowW txrDOr0SWTniBEUHJX4X6vr49oaUypnmvIjtjlLshNbWDwl/JRordYpMYcqsVzELhUgM 1Fk/l348/QT0GaNFehouWSgw4bvlh/kDqgZxgIKvfke+ol27NNX1LbdgaO0z9L5M9n/d Ti8xoFA+BuecACq4ySwHMF5yH0nkXvvb+Et2vzHRy7Ed9eqEe9JOMIodg+pYhuHGRgoZ +HPD7uoHqDLCsSkXv7y0EsBg8OMml7FFst2fPYF1TO5pN86Ynw81qR7I615PzjD4BCER DM7Q== 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=F+SkbUx7nCBevvRWhTjoMhc2XnLN3BBIN0tYS79pL9c=; b=tITeQY0aM254HZkxxi1qcGIL8vk58r5xp4konlxFFZlvhaRaKW+YZ42U9R1UCYiow2 YYRY2vgNSgeRTXed9rpvFb9aWOx1nu3Jzaso+UcOLGMrMnDtO2CaZJ9t+KfarHN0KXih 3inFf9lu/gF6p3Y3ExZ7S2eXRuxu30W8wEr7ZoQzb5MT23K6ANPC6CRL/Fkvo/Zh993E 8fooNAgImFULleVBTe+im6EsXS2FQ5K0TBkppDevgg6driKKXQYsqelRdAVY2GYFa0qU 5XP9C+I4TlSx6FCEmFuSZCK4Sm69+GtlcnSbOAp07/9xzMCQnmZcj7v71qhijLnicm9H 7WTw== X-Gm-Message-State: APjAAAVXZ9crK2p2jhmbxvEQmBIZmhZpvV50ieNK5nqBx/RN8E8zLVSz Rz6IN7QfIDboAXeX4Fo7aJ3vM4ktJgo= X-Google-Smtp-Source: APXvYqyno7X3jieZVENfBEF0UAiT9r743xvUKsC9BRYVTTd2aDsMQ1xryKmZeYz/iTduQT7f+CROGw1RPqA= X-Received: by 2002:a5d:5011:: with SMTP id e17mr6998931wrt.160.1571391867014; Fri, 18 Oct 2019 02:44:27 -0700 (PDT) Date: Fri, 18 Oct 2019 11:43:03 +0200 In-Reply-To: <20191018094304.37056-1-glider@google.com> Message-Id: <20191018094304.37056-26-glider@google.com> Mime-Version: 1.0 References: <20191018094304.37056-1-glider@google.com> X-Mailer: git-send-email 2.23.0.866.gb869b98d4c-goog Subject: [PATCH RFC v1 25/26] kmsan: disable strscpy() optimization under KMSAN From: glider@google.com To: Alexander Potapenko Cc: Vegard Nossum , Dmitry Vyukov , linux-mm@kvack.org 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.