Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp792741imm; Thu, 6 Sep 2018 10:08:58 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbFr3kespemrCj6h8Aqx7YKOuhdDbPifsH+gyx6JZHzUT5PhvZuMyyNBu+CuLmdsMT+FjAJ X-Received: by 2002:a62:7590:: with SMTP id q138-v6mr4006061pfc.148.1536253738401; Thu, 06 Sep 2018 10:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536253738; cv=none; d=google.com; s=arc-20160816; b=roccvOfMGB4zUk1/OBfF9TZtteFXICLG/A0VLWmOCCziS2GoZpIuwQaHx9u1St0H2s SZQLjqKc6oyNxFXGPk38wYp5/xa/12L+6ODbFp5URae9/Ud3NRzjaR3eseA2G3yi40qG PdmblzVCnZE6Z+poL18xtD6lpWpj7qyzEE3GhoNvTjoGa61h611n9Uml8YuYBL7R7/5B GhtKwN0H2hl29lyuCYZ/Ai8eta1+jDWSr+pxvM0ZqeLFqtO18i45Mqa5kFAHvo/qazls T8mPfDpegJ1Po4l7c/gWVEDRU8/wzo6Kw6HRDl3rBG1tJwmBBguC2actfojoTm7WMp+O EZ3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=fDK8vb3aDvLAfp5YL8K3dvsDEUJOmmgCWIugaKbfPng=; b=Z6F21QG+8D8xMQJS8xQ//ZBppl/TC8a/j2jWJuMkZWQQ+JNDFFpqMYIdr0qbdztIPp bEDndrAUL2IH3XnkeGEnsagFfQ+Z3dFyRFL89yPWaS9YvlfQQbqMupAaoFOQEe6rW5fx /0Wht32mUssWPrwihJBI5VVJ0oMiFE61X957337S1FuI1PG3uivLwZtLM/W+Vi9BiFdY alF7+6us4D5Rdl3W41g8aNZadd1NWJEabvdfAVofaiUAxJBFtMToA2YYTfwhM3VEZ2qv x/KEFpx8P881rtrRgTQj1p0+5wcK1y/lKwCPB5N6QgwsxVYQWnw+8m7aWmX8qmxOg6ZO vKyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Ycudg3Pn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p33-v6si5730520pld.151.2018.09.06.10.08.38; Thu, 06 Sep 2018 10:08:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Ycudg3Pn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729913AbeIFVmP (ORCPT + 99 others); Thu, 6 Sep 2018 17:42:15 -0400 Received: from mail-eopbgr50104.outbound.protection.outlook.com ([40.107.5.104]:55375 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727770AbeIFVmP (ORCPT ); Thu, 6 Sep 2018 17:42:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fDK8vb3aDvLAfp5YL8K3dvsDEUJOmmgCWIugaKbfPng=; b=Ycudg3Pnewx7OucEzbGcTRMpj3+f27h2c237XE92DNrQPkcxuiibtjxqxsHZ9mJ2c4vKqi6c+z6YUZhj2tergqEygCseCNekAe0N1nGoKkNmUKgnRt9r2XHftbhD0/lbRplm6F9iafbSaiDtyQ6UAXajiGlhR1FCt3ypx3tYVaE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aryabinin@virtuozzo.com; Received: from i7.sw.ru (185.231.240.5) by AM0PR08MB3251.eurprd08.prod.outlook.com (2603:10a6:208:5e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Thu, 6 Sep 2018 17:05:27 +0000 From: Andrey Ryabinin To: Will Deacon , Catalin Marinas Cc: Andrew Morton , Kyeongdon Kim , Ard Biesheuvel , Alexander Potapenko , Dmitry Vyukov , kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Andrey Ryabinin Subject: [PATCH] arm64: lib: use C string functions with KASAN enabled. Date: Thu, 6 Sep 2018 20:05:33 +0300 Message-Id: <20180906170534.20726-1-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.16.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR08CA0069.eurprd08.prod.outlook.com (2603:10a6:7:2a::40) To AM0PR08MB3251.eurprd08.prod.outlook.com (2603:10a6:208:5e::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 709009f9-699a-40a2-14f1-08d6141af224 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM0PR08MB3251; X-Microsoft-Exchange-Diagnostics: 1;AM0PR08MB3251;3:JeYHk6PqtokPojOcotD27q02QxYbuYcUocUESBZkFs70cjQTGpJRJZp1XnkfxhBGC4Ws3iRAgTXuJ6jFDxeC4gZxe7OI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4FhLcUCsKeBb7M3qUPJkK+RGq7Uapg00Zs/3dKS5ads7JP/oBTM/nkFAQJfZcmeAKwE12FPJmyjW8F0nPfPkZ8O3A5k1sCrrd0JrJh6yaZoIA1kUbgoOaRnfWM9NufXnPHXgb1BdMx6nyNiW3JMNAE3KH81A8315Hg4QeSuK99Vd7kRFn5jVH4ZNAQRkcuzVqNyeeI7D+mq5ODPfjJwQpVO6qbTG04etKvG0JtJua8U153stfyO;4:Y6CeJ3UXIkvkclTOIw/ekCfM2z9x5i10iE37lCMgJR2NkTW5BjLOjlw1Yf3YhWUpDrI4MeebZjQwnZJJHTv67XITHpc2Zl9hRX99IWEuNgo7UAvCltUeGqunRQnIZoqHJFuZw8Q7ftE5jHI0ndSUOLH+kHSGlzUtgKfI6288xlrUbupLCmTu+wm8S5rHxq+wCi7eNhe7LIlwbcr25Nl0w3iG3ZNgYl5oX7jYIIqiu/rCEwDBx7xckhbiU9a6VKIPQ9H8ASHa58Sqq3eCgY6+gg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231311)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);SRVR:AM0PR08MB3251;BCL:0;PCL:0;RULEID:;SRVR:AM0PR08MB3251; X-Forefront-PRVS: 0787459938 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(346002)(396003)(366004)(376002)(136003)(39850400004)(199004)(189003)(575784001)(106356001)(6666003)(86362001)(97736004)(105586002)(81156014)(81166006)(47776003)(7736002)(7416002)(66066001)(14444005)(107886003)(5660300001)(305945005)(486006)(1076002)(52116002)(53936002)(478600001)(4326008)(8676002)(956004)(476003)(2616005)(3846002)(6116002)(50466002)(1857600001)(53416004)(6512007)(51416003)(386003)(16586007)(50226002)(110136005)(54906003)(8936002)(26005)(25786009)(316002)(6486002)(68736007)(2906002)(36756003)(16526019)(6506007)(186003)(48376002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM0PR08MB3251;H:i7.sw.ru;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM0PR08MB3251;23:A7rzFuFrJWZ/ZpHy0elzohPrH70D4saBhPezBg5yA?= =?us-ascii?Q?tFu1bAgbgSSz9drvANZFRz/Y3xgH4hoOPe6NqH6LpNKw/LPMc+zON0NoDIVO?= =?us-ascii?Q?PBESbhTVZ9vL9dypyxSOjZzy3Gx3m/AoH2XuQGqEuIEGoTvpyje4wg18Q4pN?= =?us-ascii?Q?ahEKbJNajK8BwWbYqwmIyCI8Ar0NEIM2j8IQ18dV3YpG6Gamp6UDs3KR7BLC?= =?us-ascii?Q?ihMeM+1T1lqsS0FraHRYbmwTVbUqgCpYYehKGbs93lLtSES1SesRkdJnX6aU?= =?us-ascii?Q?LBUhRyM1YY5JXhkpLoTjGX7cfLb6kKhzC+DI0gzR62oflcmP2Y97bBSyYPbo?= =?us-ascii?Q?KYpg4f164p/1mUe0AJw8M19gyTZ8G8IfIkSZdbc2/XfnvZWeRwzC61rXm4Hm?= =?us-ascii?Q?ub7Gcil2P1qZ+ykKokufoqaPzy5UJ3zbgVaKI1RyL8FafU54EWOaTEom+A9c?= =?us-ascii?Q?3ksC3/SDXb8nn9TGkL0KQ2h/KjiRCCiRFQ/gLyVMzwGN2t29eNHik+E95FLD?= =?us-ascii?Q?MYWAFkQotLzwXaPb8uYDKAx8gK/jwKEud1oKImSmuvfhx17cTznQXLu/uZZo?= =?us-ascii?Q?eLPVMOgcYmaPqglwcJ+vNFVGTfBGZvcaSubviQmrw8CV5eXDMANenwzp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57Opl1+IoixXEa5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM0PR08MB3251;20:QseaH3Kap/A+hp39o1Pr+hlVRRKuYa9OkTRHXQS4kyfElzQ5uTPA3Nx69dHVNy9DW693diiwr+dfpZQpktd0GYh0vlZ9TCRewYuDnAZuSEU5neWxCp6ldI7YpdeM1KUUOqcUVEJb2FGnzleCggx+aJKaThnkRApCzXKL5DiySAU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2018 17:05:27.3191 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 709009f9-699a-40a2-14f1-08d6141af224 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3251 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ARM64 has asm implementations of memchr(), memcmp(), str[r]chr(), str[n]cmp(), str[n]len(). KASAN don't see memory accesses in asm code, thus it can potentially miss many bugs. Ifdef out __HAVE_ARCH_* defines of these functions when KASAN is enabled, so the generic implementations from lib/string.c will be used. Declare asm functions as weak instead of removing them because they still can be used by efistub. Reported-by: Kyeongdon Kim Signed-off-by: Andrey Ryabinin --- arch/arm64/include/asm/string.h | 14 ++++++++------ arch/arm64/kernel/arm64ksyms.c | 7 +++++-- arch/arm64/lib/memchr.S | 1 + arch/arm64/lib/memcmp.S | 1 + arch/arm64/lib/strchr.S | 1 + arch/arm64/lib/strcmp.S | 1 + arch/arm64/lib/strlen.S | 1 + arch/arm64/lib/strncmp.S | 1 + arch/arm64/lib/strnlen.S | 1 + arch/arm64/lib/strrchr.S | 1 + 10 files changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/string.h b/arch/arm64/include/asm/string.h index dd95d33a5bd5..03a6c256b7ec 100644 --- a/arch/arm64/include/asm/string.h +++ b/arch/arm64/include/asm/string.h @@ -16,6 +16,7 @@ #ifndef __ASM_STRING_H #define __ASM_STRING_H +#ifndef CONFIG_KASAN #define __HAVE_ARCH_STRRCHR extern char *strrchr(const char *, int c); @@ -34,6 +35,13 @@ extern __kernel_size_t strlen(const char *); #define __HAVE_ARCH_STRNLEN extern __kernel_size_t strnlen(const char *, __kernel_size_t); +#define __HAVE_ARCH_MEMCMP +extern int memcmp(const void *, const void *, size_t); + +#define __HAVE_ARCH_MEMCHR +extern void *memchr(const void *, int, __kernel_size_t); +#endif + #define __HAVE_ARCH_MEMCPY extern void *memcpy(void *, const void *, __kernel_size_t); extern void *__memcpy(void *, const void *, __kernel_size_t); @@ -42,16 +50,10 @@ extern void *__memcpy(void *, const void *, __kernel_size_t); extern void *memmove(void *, const void *, __kernel_size_t); extern void *__memmove(void *, const void *, __kernel_size_t); -#define __HAVE_ARCH_MEMCHR -extern void *memchr(const void *, int, __kernel_size_t); - #define __HAVE_ARCH_MEMSET extern void *memset(void *, int, __kernel_size_t); extern void *__memset(void *, int, __kernel_size_t); -#define __HAVE_ARCH_MEMCMP -extern int memcmp(const void *, const void *, size_t); - #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHE void memcpy_flushcache(void *dst, const void *src, size_t cnt); diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c index d894a20b70b2..72f63a59b008 100644 --- a/arch/arm64/kernel/arm64ksyms.c +++ b/arch/arm64/kernel/arm64ksyms.c @@ -44,20 +44,23 @@ EXPORT_SYMBOL(__arch_copy_in_user); EXPORT_SYMBOL(memstart_addr); /* string / mem functions */ +#ifndef CONFIG_KASAN EXPORT_SYMBOL(strchr); EXPORT_SYMBOL(strrchr); EXPORT_SYMBOL(strcmp); EXPORT_SYMBOL(strncmp); EXPORT_SYMBOL(strlen); EXPORT_SYMBOL(strnlen); +EXPORT_SYMBOL(memcmp); +EXPORT_SYMBOL(memchr); +#endif + EXPORT_SYMBOL(memset); EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memmove); EXPORT_SYMBOL(__memset); EXPORT_SYMBOL(__memcpy); EXPORT_SYMBOL(__memmove); -EXPORT_SYMBOL(memchr); -EXPORT_SYMBOL(memcmp); /* atomic bitops */ EXPORT_SYMBOL(set_bit); diff --git a/arch/arm64/lib/memchr.S b/arch/arm64/lib/memchr.S index 4444c1d25f4b..b790ec0228f6 100644 --- a/arch/arm64/lib/memchr.S +++ b/arch/arm64/lib/memchr.S @@ -30,6 +30,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ +.weak memchr ENTRY(memchr) and w1, w1, #0xff 1: subs x2, x2, #1 diff --git a/arch/arm64/lib/memcmp.S b/arch/arm64/lib/memcmp.S index 2a4e239bd17a..de9975b0afda 100644 --- a/arch/arm64/lib/memcmp.S +++ b/arch/arm64/lib/memcmp.S @@ -58,6 +58,7 @@ pos .req x11 limit_wd .req x12 mask .req x13 +.weak memcmp ENTRY(memcmp) cbz limit, .Lret0 eor tmp1, src1, src2 diff --git a/arch/arm64/lib/strchr.S b/arch/arm64/lib/strchr.S index dae0cf5591f9..10799adb8d5f 100644 --- a/arch/arm64/lib/strchr.S +++ b/arch/arm64/lib/strchr.S @@ -29,6 +29,7 @@ * Returns: * x0 - address of first occurrence of 'c' or 0 */ +.weak strchr ENTRY(strchr) and w1, w1, #0xff 1: ldrb w2, [x0], #1 diff --git a/arch/arm64/lib/strcmp.S b/arch/arm64/lib/strcmp.S index 471fe61760ef..5629b4fa5431 100644 --- a/arch/arm64/lib/strcmp.S +++ b/arch/arm64/lib/strcmp.S @@ -60,6 +60,7 @@ tmp3 .req x9 zeroones .req x10 pos .req x11 +.weak strcmp ENTRY(strcmp) eor tmp1, src1, src2 mov zeroones, #REP8_01 diff --git a/arch/arm64/lib/strlen.S b/arch/arm64/lib/strlen.S index 55ccc8e24c08..f00df4b1b8d9 100644 --- a/arch/arm64/lib/strlen.S +++ b/arch/arm64/lib/strlen.S @@ -56,6 +56,7 @@ pos .req x12 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 +.weak strlen ENTRY(strlen) mov zeroones, #REP8_01 bic src, srcin, #15 diff --git a/arch/arm64/lib/strncmp.S b/arch/arm64/lib/strncmp.S index e267044761c6..28563ac1c19f 100644 --- a/arch/arm64/lib/strncmp.S +++ b/arch/arm64/lib/strncmp.S @@ -64,6 +64,7 @@ limit_wd .req x13 mask .req x14 endloop .req x15 +.weak strncmp ENTRY(strncmp) cbz limit, .Lret0 eor tmp1, src1, src2 diff --git a/arch/arm64/lib/strnlen.S b/arch/arm64/lib/strnlen.S index eae38da6e0bb..bdbfd41164f4 100644 --- a/arch/arm64/lib/strnlen.S +++ b/arch/arm64/lib/strnlen.S @@ -59,6 +59,7 @@ limit_wd .req x14 #define REP8_7f 0x7f7f7f7f7f7f7f7f #define REP8_80 0x8080808080808080 +.weak strnlen ENTRY(strnlen) cbz limit, .Lhit_limit mov zeroones, #REP8_01 diff --git a/arch/arm64/lib/strrchr.S b/arch/arm64/lib/strrchr.S index f8e2784d5752..31c77f605014 100644 --- a/arch/arm64/lib/strrchr.S +++ b/arch/arm64/lib/strrchr.S @@ -29,6 +29,7 @@ * Returns: * x0 - address of last occurrence of 'c' or 0 */ +.weak strrchr ENTRY(strrchr) mov x3, #0 and w1, w1, #0xff -- 2.16.4