From patchwork Fri Feb 24 08:59:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 13151049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39DEAC61DA3 for ; Fri, 24 Feb 2023 09:00:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 885676B0075; Fri, 24 Feb 2023 04:00:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 836F76B0078; Fri, 24 Feb 2023 04:00:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FFE86B007B; Fri, 24 Feb 2023 04:00:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 610C56B0075 for ; Fri, 24 Feb 2023 04:00:10 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2E25D416F2 for ; Fri, 24 Feb 2023 09:00:10 +0000 (UTC) X-FDA: 80501588580.14.AFD03A6 Received: from mail-ed1-f74.google.com (mail-ed1-f74.google.com [209.85.208.74]) by imf09.hostedemail.com (Postfix) with ESMTP id 52CDB14001A for ; Fri, 24 Feb 2023 09:00:08 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=EAGIOwQG; spf=pass (imf09.hostedemail.com: domain of 3lnz4YwUKCJc5CM5I7FF7C5.3FDC9ELO-DDBM13B.FI7@flex--elver.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3lnz4YwUKCJc5CM5I7FF7C5.3FDC9ELO-DDBM13B.FI7@flex--elver.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677229208; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AjV3k78q3XXhT1GHWCKfTuGEDWgoZOrO6Fv+xEYetZM=; b=KSZCCA4ziTxm3gZnhA3ZfzVMPvm7TDupveWLq4FWs237KvOnSbyff3qQpFdm29P4cIfxgH lm/2wBvrXUEbLado2pWbK9mncQ7TCYFVKPBsbiyXz+ESCer33tHqJUn0w/1AWpN7VKKL6p v5vtDH5nkEbAYH+TnsMJQVBn6sXwjWM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=EAGIOwQG; spf=pass (imf09.hostedemail.com: domain of 3lnz4YwUKCJc5CM5I7FF7C5.3FDC9ELO-DDBM13B.FI7@flex--elver.bounces.google.com designates 209.85.208.74 as permitted sender) smtp.mailfrom=3lnz4YwUKCJc5CM5I7FF7C5.3FDC9ELO-DDBM13B.FI7@flex--elver.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677229208; a=rsa-sha256; cv=none; b=6ftd04kKHpJjzyFSdTI22lcH0G0Ef9b4ipwEsqhBmrBICQi75Ujglv4lPqioUPtCEy0XdV 6Wf8AM2ORJop7Cy8qIkQk9cruHDK2U5Tw3Ts2VxjRVdNxcWTrwiR7B6KB1tqhbi/kWCXW3 vAmClgxyHPPKzI7dbburAyOq7QpPFoI= Received: by mail-ed1-f74.google.com with SMTP id da15-20020a056402176f00b004ace822b750so18883169edb.20 for ; Fri, 24 Feb 2023 01:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=AjV3k78q3XXhT1GHWCKfTuGEDWgoZOrO6Fv+xEYetZM=; b=EAGIOwQG78YZ4s5FvVIyWmJSdj/9+oRp2Z+JOiSUHX7UEHTavbHpWoSCToIN25ZVBh adJIFeTdGpgUgUlgPbR4Ed7A8vOy6wisOboBbYRYTdNzBqbwUwCAPRSSvoPl6Bh2MdOs DxBjn4j0OaOB/g65HjuRXZVQ1recSusgjrsuNkNrBC2P4Rnt9uhiw7JBjRqIzDCLljyl RPUozPvaTPHrb+3qYhJ4gLVhfC9eX0jRr0iYQ685BfQTxNz35kPbfNpdQBbihXcZZQ/x MfmXpF+Z0ozIFxGcdCWnKbZF7Ky7Dr+DKmP+UpWWa7yzYqJWwtqt9X0IGq+6o/8Df7+R thCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AjV3k78q3XXhT1GHWCKfTuGEDWgoZOrO6Fv+xEYetZM=; b=S8abL7KWM6TbBmazzdoANXzJFzVFXgBKMEf6hfaXUfvI58bDChrvMT+QZdU0hp7V8F ilRjxewyW63BD5Q/1TdmQC4kTl5+DtOoAh+4HyHQBtwFPT/YwwlCctfAvOeDwCLKvLEG ipTCzj45DkGJV0ggAuNGMAGydkmCY2/bqtJIX89YUsqG9wAJBoMhbtXkU/wwQ14bV6kd CRmtASKyGsoVe16BY+ySO4G/wnNlr9mUWtFM9+P8wibChDFKFk7bKBDxYLclvgPcd+RQ nAy0dy4CAT1hXshXhaDLv7QqweUAngvqdvuxRoepDutES0ns1a9cTDdsFr+azv7hbtXE qK5Q== X-Gm-Message-State: AO0yUKXCMfO2BeyEKQuU1nQJgrcd9jP4I/SEd2uPNCrcr0LPGdLXcHs3 fDNRjGzU4HYPW/CdM1tgpozOXA90oQ== X-Google-Smtp-Source: AK7set+F0E0+hHGoUz0EDxGYty9hHOhM9cQA2n6bHMhFaQ+TBLOYuMWa+x6cFVA/P5UZsJl9kORIJ4SYdA== X-Received: from elver.muc.corp.google.com ([2a00:79e0:9c:201:53eb:6453:f5f5:3bb9]) (user=elver job=sendgmr) by 2002:a05:6402:3216:b0:4ad:7bb2:eefb with SMTP id g22-20020a056402321600b004ad7bb2eefbmr9255387eda.3.1677229206892; Fri, 24 Feb 2023 01:00:06 -0800 (PST) Date: Fri, 24 Feb 2023 09:59:42 +0100 In-Reply-To: <20230224085942.1791837-1-elver@google.com> Mime-Version: 1.0 References: <20230224085942.1791837-1-elver@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230224085942.1791837-4-elver@google.com> Subject: [PATCH v5 4/4] kasan, x86: Don't rename memintrinsics in uninstrumented files From: Marco Elver To: elver@google.com, Andrew Morton Cc: Peter Zijlstra , Jakub Jelinek , linux-toolchains@vger.kernel.org, Alexander Potapenko , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Kees Cook , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kbuild@vger.kernel.org, linux-hardening@vger.kernel.org X-Rspamd-Queue-Id: 52CDB14001A X-Stat-Signature: yk3r8ogc1dzn7fkzozezby9mksfj1q5x X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1677229208-118752 X-HE-Meta: U2FsdGVkX1+O0i8tjg3Dann2f/fvsJWdbqW41e5yZ+GZTr+07cXGRRSV7TufIr6vIACueNLnErvnVBv1F6md44SSaA/I+SroomM/0vT7A1rL7A8mV/5KorjfSeiG5u7TvymW7TJiwL6bAKdAA832bLR6KhmTslcQTJZNsD6usoyS/KsHH8+v9Z61Qq5aqNhDeWZXNrFDIQB17e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Nu3io2XHpbodEk9rIaTkoywIdcG5ZWGTWgNkIV/6vNENutU6C6IkD8OHzE3U2IHMytKQ88U0OczXJ/J/sjAshF9SVOuiwODP+tam7BfWZ12P/IaOhpvPNOzbt31m65ZI/Jx/N1rSIr91MdI79wpvE6qSdIQNwJ7cFzv507mcxCRRCvB8TU4lf8j67F5joDm4mPb/mJ4IfJ3L1yq6n2TwxFN3Q8RX1gF/Xh4bjyo0SJK37MS91hk4Ri4/GkyUTOrcbc+xeLIpAcsnYwAATlWls9VBfB4bdopTzeIvdsFrC3LTsfKfJrqxeGtgH/+s7WeOSDiul1Ppzj0U7TedbkmQ== 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: Now that memcpy/memset/memmove are no longer overridden by KASAN, we can just use the normal symbol names in uninstrumented files. Drop the preprocessor redefinitions. Fixes: 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*() functions") Signed-off-by: Marco Elver Reviewed-by: Andrey Konovalov --- v5: * New patch. --- arch/x86/include/asm/string_64.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/arch/x86/include/asm/string_64.h b/arch/x86/include/asm/string_64.h index 888731ccf1f6..c1e14cee0722 100644 --- a/arch/x86/include/asm/string_64.h +++ b/arch/x86/include/asm/string_64.h @@ -85,25 +85,6 @@ char *strcpy(char *dest, const char *src); char *strcat(char *dest, const char *src); int strcmp(const char *cs, const char *ct); -#if (defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)) -/* - * For files that not instrumented (e.g. mm/slub.c) we - * should use not instrumented version of mem* functions. - */ - -#undef memcpy -#define memcpy(dst, src, len) __memcpy(dst, src, len) -#undef memmove -#define memmove(dst, src, len) __memmove(dst, src, len) -#undef memset -#define memset(s, c, n) __memset(s, c, n) - -#ifndef __NO_FORTIFY -#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */ -#endif - -#endif - #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE #define __HAVE_ARCH_MEMCPY_FLUSHCACHE 1 void __memcpy_flushcache(void *dst, const void *src, size_t cnt);