From patchwork Fri Jun 16 13:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 1795943 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QjLvc2jVXz20X8 for ; Sat, 17 Jun 2023 00:22:04 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QjLvc1qrzz3bvJ for ; Sat, 17 Jun 2023 00:22:04 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QjLsc73rwz3brV for ; Sat, 17 Jun 2023 00:20:20 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4QjL8W17T4z9s2Q; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EaFt0lRQC1zX; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4QjL8W0LV4z9s2L; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 06BE28B783; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id dNc3yiRAb-Dc; Fri, 16 Jun 2023 15:48:10 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.18]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C32EF8B77E; Fri, 16 Jun 2023 15:48:10 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 35GDm4CX1175654 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 15:48:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 35GDm4V01175653; Fri, 16 Jun 2023 15:48:04 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Josh Poimboeuf , Peter Zijlstra , Sathvika Vasireddy Subject: [RFC PATCH v1 1/3] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" Date: Fri, 16 Jun 2023 15:47:50 +0200 Message-Id: <8dd72199549e76e0e9c2aba1c89d5fe2b0cb1663.1686922583.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686923268; l=8556; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=ROO9AsoCT4C/bNydze6Cc3TokGL0wCdUxEkxEcjDtCU=; b=e0d12zX7a0dBl0vv1a4qulb/z/ZP8HD7YjTtx8n9Vshprjr50J8Www+rxaZO7kb3eOZudDPbO igdmR6WxXMrBLk5no+P/4clxoTfUmYTUQjsnGnvaSO4ieYRJXMObRkK X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This reverts commit 1e688dd2a3d6759d416616ff07afc4bb836c4213. That commit aimed at optimising the code around generation of WARN_ON/BUG_ON but this leads to a lot of dead code erroneously generated by GCC. text data bss dec hex filename 9551585 3627834 224376 13403795 cc8693 vmlinux.before 9535281 3628358 224376 13388015 cc48ef vmlinux.after Once this change is reverted, in a standard configuration (pmac32 + function tracer) the text is reduced by 16k which is around 1.7% Signed-off-by: Christophe Leroy Acked-by: Naveen N Rao --- arch/powerpc/include/asm/book3s/64/kup.h | 2 +- arch/powerpc/include/asm/bug.h | 67 +++---------------- arch/powerpc/include/asm/extable.h | 14 ---- arch/powerpc/include/asm/ppc_asm.h | 11 ++- arch/powerpc/kernel/misc_32.S | 2 +- arch/powerpc/kernel/traps.c | 9 +-- .../powerpc/primitives/asm/extable.h | 1 - 7 files changed, 25 insertions(+), 81 deletions(-) delete mode 120000 tools/testing/selftests/powerpc/primitives/asm/extable.h diff --git a/arch/powerpc/include/asm/book3s/64/kup.h b/arch/powerpc/include/asm/book3s/64/kup.h index 54cf46808157..c82323b864e1 100644 --- a/arch/powerpc/include/asm/book3s/64/kup.h +++ b/arch/powerpc/include/asm/book3s/64/kup.h @@ -90,7 +90,7 @@ /* Prevent access to userspace using any key values */ LOAD_REG_IMMEDIATE(\gpr2, AMR_KUAP_BLOCKED) 999: tdne \gpr1, \gpr2 - EMIT_WARN_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE) END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67) #endif .endm diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h index ef42adb44aa3..a565995fb742 100644 --- a/arch/powerpc/include/asm/bug.h +++ b/arch/powerpc/include/asm/bug.h @@ -4,14 +4,13 @@ #ifdef __KERNEL__ #include -#include #ifdef CONFIG_BUG #ifdef __ASSEMBLY__ #include #ifdef CONFIG_DEBUG_BUGVERBOSE -.macro __EMIT_BUG_ENTRY addr,file,line,flags +.macro EMIT_BUG_ENTRY addr,file,line,flags .section __bug_table,"aw" 5001: .4byte \addr - . .4byte 5002f - . @@ -23,7 +22,7 @@ .previous .endm #else -.macro __EMIT_BUG_ENTRY addr,file,line,flags +.macro EMIT_BUG_ENTRY addr,file,line,flags .section __bug_table,"aw" 5001: .4byte \addr - . .short \flags @@ -32,18 +31,6 @@ .endm #endif /* verbose */ -.macro EMIT_WARN_ENTRY addr,file,line,flags - EX_TABLE(\addr,\addr+4) - __EMIT_BUG_ENTRY \addr,\file,\line,\flags -.endm - -.macro EMIT_BUG_ENTRY addr,file,line,flags - .if \flags & 1 /* BUGFLAG_WARNING */ - .err /* Use EMIT_WARN_ENTRY for warnings */ - .endif - __EMIT_BUG_ENTRY \addr,\file,\line,\flags -.endm - #else /* !__ASSEMBLY__ */ /* _EMIT_BUG_ENTRY expects args %0,%1,%2,%3 to be FILE, LINE, flags and sizeof(struct bug_entry), respectively */ @@ -73,16 +60,6 @@ "i" (sizeof(struct bug_entry)), \ ##__VA_ARGS__) -#define WARN_ENTRY(insn, flags, label, ...) \ - asm_volatile_goto( \ - "1: " insn "\n" \ - EX_TABLE(1b, %l[label]) \ - _EMIT_BUG_ENTRY \ - : : "i" (__FILE__), "i" (__LINE__), \ - "i" (flags), \ - "i" (sizeof(struct bug_entry)), \ - ##__VA_ARGS__ : : label) - /* * BUG_ON() and WARN_ON() do their best to cooperate with compile-time * optimisations. However depending on the complexity of the condition @@ -95,16 +72,7 @@ } while (0) #define HAVE_ARCH_BUG -#define __WARN_FLAGS(flags) do { \ - __label__ __label_warn_on; \ - \ - WARN_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags), __label_warn_on); \ - barrier_before_unreachable(); \ - __builtin_unreachable(); \ - \ -__label_warn_on: \ - break; \ -} while (0) +#define __WARN_FLAGS(flags) BUG_ENTRY("twi 31, 0, 0", BUGFLAG_WARNING | (flags)) #ifdef CONFIG_PPC64 #define BUG_ON(x) do { \ @@ -117,25 +85,15 @@ __label_warn_on: \ } while (0) #define WARN_ON(x) ({ \ - bool __ret_warn_on = false; \ - do { \ - if (__builtin_constant_p((x))) { \ - if (!(x)) \ - break; \ + int __ret_warn_on = !!(x); \ + if (__builtin_constant_p(__ret_warn_on)) { \ + if (__ret_warn_on) \ __WARN(); \ - __ret_warn_on = true; \ - } else { \ - __label__ __label_warn_on; \ - \ - WARN_ENTRY(PPC_TLNEI " %4, 0", \ - BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ - __label_warn_on, \ - "r" ((__force long)(x))); \ - break; \ -__label_warn_on: \ - __ret_warn_on = true; \ - } \ - } while (0); \ + } else { \ + BUG_ENTRY(PPC_TLNEI " %4, 0", \ + BUGFLAG_WARNING | BUGFLAG_TAINT(TAINT_WARN), \ + "r" (__ret_warn_on)); \ + } \ unlikely(__ret_warn_on); \ }) @@ -148,11 +106,8 @@ __label_warn_on: \ #ifdef __ASSEMBLY__ .macro EMIT_BUG_ENTRY addr,file,line,flags .endm -.macro EMIT_WARN_ENTRY addr,file,line,flags -.endm #else /* !__ASSEMBLY__ */ #define _EMIT_BUG_ENTRY -#define _EMIT_WARN_ENTRY #endif #endif /* CONFIG_BUG */ diff --git a/arch/powerpc/include/asm/extable.h b/arch/powerpc/include/asm/extable.h index 26ce2e5c0fa8..eb91b2d2935a 100644 --- a/arch/powerpc/include/asm/extable.h +++ b/arch/powerpc/include/asm/extable.h @@ -17,8 +17,6 @@ #define ARCH_HAS_RELATIVE_EXTABLE -#ifndef __ASSEMBLY__ - struct exception_table_entry { int insn; int fixup; @@ -30,15 +28,3 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x) } #endif - -/* - * Helper macro for exception table entries - */ -#define EX_TABLE(_fault, _target) \ - stringify_in_c(.section __ex_table,"a";)\ - stringify_in_c(.balign 4;) \ - stringify_in_c(.long (_fault) - . ;) \ - stringify_in_c(.long (_target) - . ;) \ - stringify_in_c(.previous) - -#endif diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index 5f05a984b103..5555b17ed076 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h @@ -10,7 +10,6 @@ #include #include #include -#include #ifdef __ASSEMBLY__ @@ -836,6 +835,16 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96) #endif /* __ASSEMBLY__ */ +/* + * Helper macro for exception table entries + */ +#define EX_TABLE(_fault, _target) \ + stringify_in_c(.section __ex_table,"a";)\ + stringify_in_c(.balign 4;) \ + stringify_in_c(.long (_fault) - . ;) \ + stringify_in_c(.long (_target) - . ;) \ + stringify_in_c(.previous) + #define SOFT_MASK_TABLE(_start, _end) \ stringify_in_c(.section __soft_mask_table,"a";)\ stringify_in_c(.balign 8;) \ diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S index daf8f87d2372..fd11ec42df89 100644 --- a/arch/powerpc/kernel/misc_32.S +++ b/arch/powerpc/kernel/misc_32.S @@ -237,7 +237,7 @@ _GLOBAL(copy_page) addi r3,r3,-4 0: twnei r5, 0 /* WARN if r3 is not cache aligned */ - EMIT_WARN_ENTRY 0b,__FILE__,__LINE__, BUGFLAG_WARNING + EMIT_BUG_ENTRY 0b,__FILE__,__LINE__, BUGFLAG_WARNING addi r4,r4,-4 diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 9bdd79aa51cf..d3c5de9e9b4d 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c @@ -1508,13 +1508,8 @@ static void do_program_check(struct pt_regs *regs) if (!(regs->msr & MSR_PR) && /* not user-mode */ report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) { - const struct exception_table_entry *entry; - - entry = search_exception_tables(bugaddr); - if (entry) { - regs_set_return_ip(regs, extable_fixup(entry) + regs->nip - bugaddr); - return; - } + regs_add_return_ip(regs, 4); + return; } _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip); return; diff --git a/tools/testing/selftests/powerpc/primitives/asm/extable.h b/tools/testing/selftests/powerpc/primitives/asm/extable.h deleted file mode 120000 index 6385f059a951..000000000000 --- a/tools/testing/selftests/powerpc/primitives/asm/extable.h +++ /dev/null @@ -1 +0,0 @@ -../../../../../../arch/powerpc/include/asm/extable.h \ No newline at end of file From patchwork Fri Jun 16 13:47:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 1795941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QjLtK5p4Kz20X8 for ; Sat, 17 Jun 2023 00:20:57 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QjLtK53Zmz3c5H for ; Sat, 17 Jun 2023 00:20:57 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QjLsT06Lmz2xwD for ; Sat, 17 Jun 2023 00:20:12 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4QjL8Y0Qqqz9s2k; Fri, 16 Jun 2023 15:48:13 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TIGQhCp_fuDa; Fri, 16 Jun 2023 15:48:12 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4QjL8W0LTCz9s2J; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 04FDD8B780; Fri, 16 Jun 2023 15:48:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id gcgY-gbjh6On; Fri, 16 Jun 2023 15:48:10 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.18]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C25EC8B77D; Fri, 16 Jun 2023 15:48:10 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 35GDm4aw1175658 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 15:48:04 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 35GDm49R1175657; Fri, 16 Jun 2023 15:48:04 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Josh Poimboeuf , Peter Zijlstra , Sathvika Vasireddy Subject: [RFC PATCH v1 2/3] powerpc: Mark all .S files invalid for objtool Date: Fri, 16 Jun 2023 15:47:51 +0200 Message-Id: <17feb760a05edd372984bdf148c760c6f279b401.1686922583.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686923268; l=17013; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=ETCutUyxK4A9ErBsOwknAbBUu8aGkGK2n2c6mltJ1Nw=; b=TqgK4Zxzk5eF0WaLsLy5BJSolA3kU+kWwPmN7GfZpUkM7mmSwZKr/hbcc22wxd1ntjUtslDBm 4F059XN+jfzBrLo4WjAB/iybmmjeIDziAEYQDE8saE7HL+pXJ0pmaqb X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" A lot of work is required in .S files in order to get them ready for objtool checks. For the time being, exclude them from the checks. This is done with the script below: #!/bin/sh DIRS=`find arch/powerpc -name "*.S" -exec dirname {} \; | sort | uniq` for d in $DIRS do pushd $d echo >> Makefile for f in *.S do echo "OBJECT_FILES_NON_STANDARD_$f := y" | sed s/"\.S"/".o"/g done >> Makefile popd done Signed-off-by: Christophe Leroy --- arch/powerpc/boot/Makefile | 17 +++++++++ arch/powerpc/crypto/Makefile | 13 +++++++ arch/powerpc/kernel/Makefile | 44 ++++++++++++++++++++++ arch/powerpc/kernel/trace/Makefile | 4 ++ arch/powerpc/kernel/vdso/Makefile | 11 ++++++ arch/powerpc/kexec/Makefile | 2 + arch/powerpc/kvm/Makefile | 13 +++++++ arch/powerpc/lib/Makefile | 25 ++++++++++++ arch/powerpc/mm/book3s32/Makefile | 3 ++ arch/powerpc/mm/nohash/Makefile | 3 ++ arch/powerpc/perf/Makefile | 2 + arch/powerpc/platforms/44x/Makefile | 2 + arch/powerpc/platforms/52xx/Makefile | 3 ++ arch/powerpc/platforms/83xx/Makefile | 2 + arch/powerpc/platforms/cell/spufs/Makefile | 3 ++ arch/powerpc/platforms/pasemi/Makefile | 2 + arch/powerpc/platforms/powermac/Makefile | 3 ++ arch/powerpc/platforms/powernv/Makefile | 3 ++ arch/powerpc/platforms/ps3/Makefile | 2 + arch/powerpc/platforms/pseries/Makefile | 2 + arch/powerpc/purgatory/Makefile | 3 ++ arch/powerpc/sysdev/Makefile | 3 ++ arch/powerpc/xmon/Makefile | 3 ++ 23 files changed, 168 insertions(+) diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 771b79423bbc..c046eb9d341e 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -513,3 +513,20 @@ $(wrapper-installed): $(DESTDIR)$(WRAPPER_BINDIR) $(srctree)/$(obj)/wrapper | $( $(call cmd,install_wrapper) $(obj)/bootwrapper_install: $(all-installed) + +OBJECT_FILES_NON_STANDARD_crt0.o := y +OBJECT_FILES_NON_STANDARD_crtsavres.o := y +OBJECT_FILES_NON_STANDARD_div64.o := y +OBJECT_FILES_NON_STANDARD_fixed-head.o := y +OBJECT_FILES_NON_STANDARD_gamecube-head.o := y +OBJECT_FILES_NON_STANDARD_motload-head.o := y +OBJECT_FILES_NON_STANDARD_opal-calls.o := y +OBJECT_FILES_NON_STANDARD_ps3-head.o := y +OBJECT_FILES_NON_STANDARD_ps3-hvcall.o := y +OBJECT_FILES_NON_STANDARD_pseries-head.o := y +OBJECT_FILES_NON_STANDARD_string.o := y +OBJECT_FILES_NON_STANDARD_util.o := y +OBJECT_FILES_NON_STANDARD_wii-head.o := y +OBJECT_FILES_NON_STANDARD_zImage.coff.lds.o := y +OBJECT_FILES_NON_STANDARD_zImage.lds.o := y +OBJECT_FILES_NON_STANDARD_zImage.ps3.lds.o := y diff --git a/arch/powerpc/crypto/Makefile b/arch/powerpc/crypto/Makefile index 7b4f516abec1..f0381d137b06 100644 --- a/arch/powerpc/crypto/Makefile +++ b/arch/powerpc/crypto/Makefile @@ -34,3 +34,16 @@ $(obj)/aesp10-ppc.S $(obj)/ghashp10-ppc.S: $(obj)/%.S: $(src)/%.pl FORCE OBJECT_FILES_NON_STANDARD_aesp10-ppc.o := y OBJECT_FILES_NON_STANDARD_ghashp10-ppc.o := y + +OBJECT_FILES_NON_STANDARD_aes-gcm-p10.o := y +OBJECT_FILES_NON_STANDARD_aes-spe-core.o := y +OBJECT_FILES_NON_STANDARD_aes-spe-keys.o := y +OBJECT_FILES_NON_STANDARD_aes-spe-modes.o := y +OBJECT_FILES_NON_STANDARD_aes-tab-4k.o := y +OBJECT_FILES_NON_STANDARD_crc32c-vpmsum_asm.o := y +OBJECT_FILES_NON_STANDARD_crc32-vpmsum_core.o := y +OBJECT_FILES_NON_STANDARD_crct10dif-vpmsum_asm.o := y +OBJECT_FILES_NON_STANDARD_md5-asm.o := y +OBJECT_FILES_NON_STANDARD_sha1-powerpc-asm.o := y +OBJECT_FILES_NON_STANDARD_sha1-spe-asm.o := y +OBJECT_FILES_NON_STANDARD_sha256-spe-asm.o := y diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 9bf2be123093..19a2c83645e1 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -229,3 +229,47 @@ $(obj)/vdso64_wrapper.o : $(obj)/vdso/vdso64.so.dbg # for cleaning subdir- += vdso + +OBJECT_FILES_NON_STANDARD_85xx_entry_mapping.o := y +OBJECT_FILES_NON_STANDARD_cpu_setup_44x.o := y +OBJECT_FILES_NON_STANDARD_cpu_setup_6xx.o := y +OBJECT_FILES_NON_STANDARD_cpu_setup_e500.o := y +OBJECT_FILES_NON_STANDARD_cpu_setup_pa6t.o := y +OBJECT_FILES_NON_STANDARD_cpu_setup_ppc970.o := y +OBJECT_FILES_NON_STANDARD_entry_32.o := y +OBJECT_FILES_NON_STANDARD_entry_64.o := y +OBJECT_FILES_NON_STANDARD_epapr_hcalls.o := y +OBJECT_FILES_NON_STANDARD_exceptions-64e.o := y +OBJECT_FILES_NON_STANDARD_exceptions-64s.o := y +OBJECT_FILES_NON_STANDARD_fpu.o := y +OBJECT_FILES_NON_STANDARD_head_40x.o := y +OBJECT_FILES_NON_STANDARD_head_44x.o := y +OBJECT_FILES_NON_STANDARD_head_64.o := y +OBJECT_FILES_NON_STANDARD_head_85xx.o := y +OBJECT_FILES_NON_STANDARD_head_8xx.o := y +OBJECT_FILES_NON_STANDARD_head_book3s_32.o := y +OBJECT_FILES_NON_STANDARD_idle_64e.o := y +OBJECT_FILES_NON_STANDARD_idle_6xx.o := y +OBJECT_FILES_NON_STANDARD_idle_85xx.o := y +OBJECT_FILES_NON_STANDARD_idle_book3s.o := y +OBJECT_FILES_NON_STANDARD_interrupt_64.o := y +OBJECT_FILES_NON_STANDARD_kvm_emul.o := y +OBJECT_FILES_NON_STANDARD_l2cr_6xx.o := y +OBJECT_FILES_NON_STANDARD_misc_32.o := y +OBJECT_FILES_NON_STANDARD_misc_64.o := y +OBJECT_FILES_NON_STANDARD_misc.o := y +OBJECT_FILES_NON_STANDARD_note.o := y +OBJECT_FILES_NON_STANDARD_optprobes_head.o := y +OBJECT_FILES_NON_STANDARD_ppc_save_regs.o := y +OBJECT_FILES_NON_STANDARD_reloc_32.o := y +OBJECT_FILES_NON_STANDARD_reloc_64.o := y +OBJECT_FILES_NON_STANDARD_rtas_entry.o := y +OBJECT_FILES_NON_STANDARD_swsusp_32.o := y +OBJECT_FILES_NON_STANDARD_swsusp_85xx.o := y +OBJECT_FILES_NON_STANDARD_swsusp_asm64.o := y +OBJECT_FILES_NON_STANDARD_tm.o := y +OBJECT_FILES_NON_STANDARD_ucall.o := y +OBJECT_FILES_NON_STANDARD_vdso32_wrapper.o := y +OBJECT_FILES_NON_STANDARD_vdso64_wrapper.o := y +OBJECT_FILES_NON_STANDARD_vector.o := y +OBJECT_FILES_NON_STANDARD_vmlinux.lds.o := y diff --git a/arch/powerpc/kernel/trace/Makefile b/arch/powerpc/kernel/trace/Makefile index 2296bbbd775a..533c37a406e4 100644 --- a/arch/powerpc/kernel/trace/Makefile +++ b/arch/powerpc/kernel/trace/Makefile @@ -25,3 +25,7 @@ GCOV_PROFILE_ftrace.o := n KCOV_INSTRUMENT_ftrace.o := n KCSAN_SANITIZE_ftrace.o := n UBSAN_SANITIZE_ftrace.o := n + +OBJECT_FILES_NON_STANDARD_ftrace_64_pg.o := y +OBJECT_FILES_NON_STANDARD_ftrace_low.o := y +OBJECT_FILES_NON_STANDARD_ftrace_mprofile.o := y diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index 4c3f34485f08..65019ea69aa8 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -114,3 +114,14 @@ quiet_cmd_vdso64as = VDSO64A $@ cmd_vdso64as = $(VDSOCC) $(a_flags) $(AS64FLAGS) -c -o $@ $< OBJECT_FILES_NON_STANDARD := y + +OBJECT_FILES_NON_STANDARD_cacheflush.o := y +OBJECT_FILES_NON_STANDARD_datapage.o := y +OBJECT_FILES_NON_STANDARD_getcpu.o := y +OBJECT_FILES_NON_STANDARD_gettimeofday.o := y +OBJECT_FILES_NON_STANDARD_note.o := y +OBJECT_FILES_NON_STANDARD_sigtramp32.o := y +OBJECT_FILES_NON_STANDARD_sigtramp64.o := y +OBJECT_FILES_NON_STANDARD_vdso32.lds.o := y +OBJECT_FILES_NON_STANDARD_vdso64.lds.o := y +OBJECT_FILES_NON_STANDARD_vgetrandom-chacha.o := y diff --git a/arch/powerpc/kexec/Makefile b/arch/powerpc/kexec/Makefile index 0c2abe7f9908..193be003b3f0 100644 --- a/arch/powerpc/kexec/Makefile +++ b/arch/powerpc/kexec/Makefile @@ -15,3 +15,5 @@ KCOV_INSTRUMENT_core_$(BITS).o := n UBSAN_SANITIZE_core_$(BITS).o := n KASAN_SANITIZE_core.o := n KASAN_SANITIZE_core_$(BITS) := n + +OBJECT_FILES_NON_STANDARD_relocate_32.o := y diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile index 5319d889b184..f70ed57753e0 100644 --- a/arch/powerpc/kvm/Makefile +++ b/arch/powerpc/kvm/Makefile @@ -137,3 +137,16 @@ obj-y += $(kvm-book3s_64-builtin-objs-y) ifdef CONFIG_PPC_BOOK3S_64 KASAN_SANITIZE := n endif + +OBJECT_FILES_NON_STANDARD_book3s_32_sr.o := y +OBJECT_FILES_NON_STANDARD_book3s_64_entry.o := y +OBJECT_FILES_NON_STANDARD_book3s_64_slb.o := y +OBJECT_FILES_NON_STANDARD_book3s_hv_interrupts.o := y +OBJECT_FILES_NON_STANDARD_book3s_hv_rmhandlers.o := y +OBJECT_FILES_NON_STANDARD_book3s_interrupts.o := y +OBJECT_FILES_NON_STANDARD_book3s_rmhandlers.o := y +OBJECT_FILES_NON_STANDARD_book3s_segment.o := y +OBJECT_FILES_NON_STANDARD_bookehv_interrupts.o := y +OBJECT_FILES_NON_STANDARD_booke_interrupts.o := y +OBJECT_FILES_NON_STANDARD_fpu.o := y +OBJECT_FILES_NON_STANDARD_tm.o := y diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index c4db459d304a..e6a59ebbf9d5 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -81,3 +81,28 @@ CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec) CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include) obj-$(CONFIG_PPC64) += $(obj64-y) + +OBJECT_FILES_NON_STANDARD_checksum_32.o := y +OBJECT_FILES_NON_STANDARD_checksum_64.o := y +OBJECT_FILES_NON_STANDARD_copy_32.o := y +OBJECT_FILES_NON_STANDARD_copy_mc_64.o := y +OBJECT_FILES_NON_STANDARD_copypage_64.o := y +OBJECT_FILES_NON_STANDARD_copypage_power7.o := y +OBJECT_FILES_NON_STANDARD_copyuser_64.o := y +OBJECT_FILES_NON_STANDARD_copyuser_power7.o := y +OBJECT_FILES_NON_STANDARD_crtsavres.o := y +OBJECT_FILES_NON_STANDARD_div64.o := y +OBJECT_FILES_NON_STANDARD_feature-fixups-test.o := y +OBJECT_FILES_NON_STANDARD_hweight_64.o := y +OBJECT_FILES_NON_STANDARD_ldstfp.o := y +OBJECT_FILES_NON_STANDARD_mem_64.o := y +OBJECT_FILES_NON_STANDARD_memcmp_32.o := y +OBJECT_FILES_NON_STANDARD_memcmp_64.o := y +OBJECT_FILES_NON_STANDARD_memcpy_64.o := y +OBJECT_FILES_NON_STANDARD_memcpy_power7.o := y +OBJECT_FILES_NON_STANDARD_quad.o := y +OBJECT_FILES_NON_STANDARD_string_32.o := y +OBJECT_FILES_NON_STANDARD_string_64.o := y +OBJECT_FILES_NON_STANDARD_string.o := y +OBJECT_FILES_NON_STANDARD_strlen_32.o := y +OBJECT_FILES_NON_STANDARD_test_emulate_step_exec_instr.o := y diff --git a/arch/powerpc/mm/book3s32/Makefile b/arch/powerpc/mm/book3s32/Makefile index 50dd8f6bdf46..973e2d4933bb 100644 --- a/arch/powerpc/mm/book3s32/Makefile +++ b/arch/powerpc/mm/book3s32/Makefile @@ -10,3 +10,6 @@ obj-y += mmu.o mmu_context.o obj-$(CONFIG_PPC_BOOK3S_603) += nohash_low.o obj-$(CONFIG_PPC_BOOK3S_604) += hash_low.o tlb.o obj-$(CONFIG_PPC_KUAP) += kuap.o + +OBJECT_FILES_NON_STANDARD_hash_low.o := y +OBJECT_FILES_NON_STANDARD_nohash_low.o := y diff --git a/arch/powerpc/mm/nohash/Makefile b/arch/powerpc/mm/nohash/Makefile index f3894e79d5f7..d423d2759d9e 100644 --- a/arch/powerpc/mm/nohash/Makefile +++ b/arch/powerpc/mm/nohash/Makefile @@ -17,3 +17,6 @@ endif # This is necessary for booting with kcov enabled on book3e machines KCOV_INSTRUMENT_tlb.o := n KCOV_INSTRUMENT_e500.o := n + +OBJECT_FILES_NON_STANDARD_tlb_low_64e.o := y +OBJECT_FILES_NON_STANDARD_tlb_low.o := y diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile index 4f53d0b97539..a36111dd2acc 100644 --- a/arch/powerpc/perf/Makefile +++ b/arch/powerpc/perf/Makefile @@ -20,3 +20,5 @@ obj-$(CONFIG_PPC_8xx) += 8xx-pmu.o obj-$(CONFIG_PPC64) += $(obj64-y) obj-$(CONFIG_PPC32) += $(obj32-y) + +OBJECT_FILES_NON_STANDARD_bhrb.o := y diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile index 5ba031f57652..fb09005c1e7b 100644 --- a/arch/powerpc/platforms/44x/Makefile +++ b/arch/powerpc/platforms/44x/Makefile @@ -12,3 +12,5 @@ obj-$(CONFIG_CANYONLANDS)+= canyonlands.o obj-$(CONFIG_CURRITUCK) += ppc476.o obj-$(CONFIG_AKEBONO) += ppc476.o obj-$(CONFIG_FSP2) += fsp2.o + +OBJECT_FILES_NON_STANDARD_misc_44x.o := y diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile index 1b1f72d83342..6b518342cc27 100644 --- a/arch/powerpc/platforms/52xx/Makefile +++ b/arch/powerpc/platforms/52xx/Makefile @@ -14,3 +14,6 @@ obj-$(CONFIG_PM) += mpc52xx_sleep.o mpc52xx_pm.o ifdef CONFIG_PPC_LITE5200 obj-$(CONFIG_PM) += lite5200_sleep.o lite5200_pm.o endif + +OBJECT_FILES_NON_STANDARD_lite5200_sleep.o := y +OBJECT_FILES_NON_STANDARD_mpc52xx_sleep.o := y diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile index 6b4013e01b3b..bca5587e34f4 100644 --- a/arch/powerpc/platforms/83xx/Makefile +++ b/arch/powerpc/platforms/83xx/Makefile @@ -13,3 +13,5 @@ obj-$(CONFIG_MPC836x_RDK) += mpc836x_rdk.o obj-$(CONFIG_MPC837x_RDB) += mpc837x_rdb.o obj-$(CONFIG_ASP834x) += asp834x.o obj-$(CONFIG_KMETER1) += km83xx.o + +OBJECT_FILES_NON_STANDARD_suspend-asm.o := y diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile index 52e4c80ec8d0..5d44f4e7a60d 100644 --- a/arch/powerpc/platforms/cell/spufs/Makefile +++ b/arch/powerpc/platforms/cell/spufs/Makefile @@ -61,3 +61,6 @@ cmd_hexdump = ( \ quiet_cmd_hexdump = HEXDUMP $@ $(obj)/%_dump.h: $(obj)/%.bin $(call if_changed,hexdump) + +OBJECT_FILES_NON_STANDARD_spu_restore_crt0.o := y +OBJECT_FILES_NON_STANDARD_spu_save_crt0.o := y diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile index d2ce954a5055..125c77bd7da9 100644 --- a/arch/powerpc/platforms/pasemi/Makefile +++ b/arch/powerpc/platforms/pasemi/Makefile @@ -2,3 +2,5 @@ obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o dma_lib.o misc.o obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o obj-$(CONFIG_PCI_MSI) += msi.o + +OBJECT_FILES_NON_STANDARD_powersave.o := y diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile index cf85f0662d0d..963c59656654 100644 --- a/arch/powerpc/platforms/powermac/Makefile +++ b/arch/powerpc/platforms/powermac/Makefile @@ -23,3 +23,6 @@ obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o obj-$(CONFIG_NVRAM:m=y) += nvram.o obj-$(CONFIG_PPC32) += bootx_init.o obj-$(CONFIG_SMP) += smp.o + +OBJECT_FILES_NON_STANDARD_cache.o := y +OBJECT_FILES_NON_STANDARD_sleep.o := y diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile index 19f0fc5c6f1b..6b49794ff32a 100644 --- a/arch/powerpc/platforms/powernv/Makefile +++ b/arch/powerpc/platforms/powernv/Makefile @@ -31,3 +31,6 @@ obj-$(CONFIG_PPC_VAS) += vas.o vas-window.o vas-debug.o vas-fault.o obj-$(CONFIG_OCXL_BASE) += ocxl.o obj-$(CONFIG_SCOM_DEBUGFS) += opal-xscom.o obj-$(CONFIG_PPC_SECURE_BOOT) += opal-secvar.o + +OBJECT_FILES_NON_STANDARD_opal-wrappers.o := y +OBJECT_FILES_NON_STANDARD_subcore-asm.o := y diff --git a/arch/powerpc/platforms/ps3/Makefile b/arch/powerpc/platforms/ps3/Makefile index 86bf2967a8d4..fb6054aa0a33 100644 --- a/arch/powerpc/platforms/ps3/Makefile +++ b/arch/powerpc/platforms/ps3/Makefile @@ -7,3 +7,5 @@ obj-$(CONFIG_PS3GELIC_UDBG) += gelic_udbg.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SPU_BASE) += spu.o obj-y += device-init.o + +OBJECT_FILES_NON_STANDARD_hvcall.o := y diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 53c3b91af2f7..410b6e763e52 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile @@ -37,3 +37,5 @@ obj-$(CONFIG_ARCH_HAS_CC_PLATFORM) += cc_platform.o # nothing that operates in real mode is safe for KASAN KASAN_SANITIZE_ras.o := n KASAN_SANITIZE_kexec.o := n + +OBJECT_FILES_NON_STANDARD_hvCall.o := y diff --git a/arch/powerpc/purgatory/Makefile b/arch/powerpc/purgatory/Makefile index 6f5e2727963c..b39cd1badb2e 100644 --- a/arch/powerpc/purgatory/Makefile +++ b/arch/powerpc/purgatory/Makefile @@ -13,3 +13,6 @@ $(obj)/purgatory.ro: $(obj)/trampoline_$(BITS).o FORCE $(obj)/kexec-purgatory.o: $(obj)/purgatory.ro obj-y += kexec-purgatory.o + +OBJECT_FILES_NON_STANDARD_kexec-purgatory.o := y +OBJECT_FILES_NON_STANDARD_trampoline_64.o := y diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index 9cb1d029511a..178f455a6772 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile @@ -51,3 +51,6 @@ obj-$(CONFIG_PPC_XICS) += xics/ obj-$(CONFIG_PPC_XIVE) += xive/ obj-$(CONFIG_GE_FPGA) += ge/ + +OBJECT_FILES_NON_STANDARD_6xx-suspend.o := y +OBJECT_FILES_NON_STANDARD_dcr-low.o := y diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile index d334de392e6c..024e1092e4c2 100644 --- a/arch/powerpc/xmon/Makefile +++ b/arch/powerpc/xmon/Makefile @@ -24,3 +24,6 @@ ifdef CONFIG_XMON_DISASSEMBLY obj-y += ppc-dis.o ppc-opc.o obj-$(CONFIG_SPU_BASE) += spu-dis.o spu-opc.o endif + +OBJECT_FILES_NON_STANDARD_spr_access.o := y +OBJECT_FILES_NON_STANDARD_xmon_bpts.o := y From patchwork Fri Jun 16 13:47:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 1795942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QjLtv1H6bz20X8 for ; Sat, 17 Jun 2023 00:21:27 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QjLtv0Qvvz3cB7 for ; Sat, 17 Jun 2023 00:21:27 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=csgroup.eu (client-ip=93.17.236.30; helo=pegase1.c-s.fr; envelope-from=christophe.leroy@csgroup.eu; receiver=lists.ozlabs.org) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QjLsX68B2z2ygG for ; Sat, 17 Jun 2023 00:20:16 +1000 (AEST) Received: from localhost (mailhub3.si.c-s.fr [192.168.12.233]) by localhost (Postfix) with ESMTP id 4QjL8l0BHtz9s12; Fri, 16 Jun 2023 15:48:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1067xZSW2GWH; Fri, 16 Jun 2023 15:48:22 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4QjL8g6fQdz9s0s; Fri, 16 Jun 2023 15:48:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DFC958B77D; Fri, 16 Jun 2023 15:48:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 66P6jqudVMmj; Fri, 16 Jun 2023 15:48:19 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.18]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B09E78B764; Fri, 16 Jun 2023 15:48:19 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 35GDmB0X1175663 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Jun 2023 15:48:11 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 35GDmACk1175661; Fri, 16 Jun 2023 15:48:10 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Michael Ellerman , Nicholas Piggin , Josh Poimboeuf , Peter Zijlstra , Sathvika Vasireddy Subject: [RFC PATCH v1 3/3] powerpc: WIP draft support to objtool check Date: Fri, 16 Jun 2023 15:47:52 +0200 Message-Id: <8fbf16dd6a89e1b5b05244bd5e0746410674829e.1686922583.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1686923268; l=11701; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=Wg1RgV9ghOKrFYk6CuUre0qE0meV8NHuNie239IWks0=; b=FzMQ7Ae/8RiM/prENbOAaI8UYe39viWv5CyvyTyvNOMCIJ7zsvdOWo2adpJfHwPrEP+bSwnCO msOtJNs3NKkBrcvxGsAabMDI6BvlTu4q+4EJw6RtmC3T7ezsnI8WLrH X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This draft messy patch is first try to add support of objtool check for powerpc. This is in preparation of doing uaccess validation for powerpc. For the time being, this is implemented for PPC32 only breaking support for other targets eventually. Will be reworked to be more generic once a final working status has been achieved. All assembly files have been deactivated as they require huge work and are not really needed at the first place for uaccess validation. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + scripts/Makefile.lib | 2 +- tools/objtool/arch/powerpc/decode.c | 60 +++++++++++++++++-- .../arch/powerpc/include/arch/special.h | 2 +- tools/objtool/arch/powerpc/special.c | 44 +++++++++++++- tools/objtool/check.c | 29 +++++---- tools/objtool/include/objtool/elf.h | 1 + tools/objtool/include/objtool/special.h | 2 +- 8 files changed, 118 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 542be1c3c315..3bd244784af1 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -259,6 +259,7 @@ config PPC select HAVE_OPTPROBES select HAVE_OBJTOOL if PPC32 || MPROFILE_KERNEL select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL + select HAVE_UACCESS_VALIDATION if HAVE_OBJTOOL select HAVE_PERF_EVENTS select HAVE_PERF_EVENTS_NMI if PPC64 select HAVE_PERF_REGS diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 100a386fcd71..298e2656e911 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -267,7 +267,7 @@ objtool-args-$(CONFIG_RETHUNK) += --rethunk objtool-args-$(CONFIG_SLS) += --sls objtool-args-$(CONFIG_STACK_VALIDATION) += --stackval objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call -objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess +objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess --sec-address objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable objtool-args-$(CONFIG_PREFIX_SYMBOLS) += --prefix=$(CONFIG_FUNCTION_PADDING_BYTES) diff --git a/tools/objtool/arch/powerpc/decode.c b/tools/objtool/arch/powerpc/decode.c index 53b55690f320..e95c0470e34b 100644 --- a/tools/objtool/arch/powerpc/decode.c +++ b/tools/objtool/arch/powerpc/decode.c @@ -43,24 +43,72 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec unsigned long offset, unsigned int maxlen, struct instruction *insn) { - unsigned int opcode; + unsigned int opcode, xop; + unsigned int rs, ra, rb, bo, bi, to, uimm, l; enum insn_type typ; unsigned long imm; u32 ins; ins = bswap_if_needed(file->elf, *(u32 *)(sec->data->d_buf + offset)); opcode = ins >> 26; - typ = INSN_OTHER; - imm = 0; + xop = (ins >> 1) & 0x3ff; + rs = bo = to = (ins >> 21) & 0x1f; + ra = bi = (ins >> 16) & 0x1f; + rb = (ins >> 11) & 0x1f; + uimm = (ins >> 0) & 0xffff; + l = ins & 1; switch (opcode) { + case 16: /* bc[l][a] */ + if (ins & 1) /* bcl[a] */ + typ = INSN_OTHER; + else /* bc[a] */ + typ = INSN_JUMP_CONDITIONAL; + + imm = ins & 0xfffc; + if (imm & 0x8000) + imm -= 0x10000; + imm |= ins & 2; /* AA flag */ + insn->immediate = imm; + break; case 18: /* b[l][a] */ - if ((ins & 3) == 1) /* bl */ + if (ins & 1) /* bl[a] */ typ = INSN_CALL; + else /* b[a] */ + typ = INSN_JUMP_UNCONDITIONAL; imm = ins & 0x3fffffc; if (imm & 0x2000000) imm -= 0x4000000; + imm |= ins & 2; /* AA flag */ + insn->immediate = imm; + break; + case 19: + if (xop == 16 && bo == 20 && bi == 0) /* blr */ + typ = INSN_RETURN; + else if (xop == 50) /* rfi */ + typ = INSN_JUMP_DYNAMIC; + else if (xop == 528 && bo == 20 && bi ==0 && !l) /* bctr */ + typ = INSN_JUMP_DYNAMIC; + else if (xop == 528 && bo == 20 && bi ==0 && l) /* bctrl */ + typ = INSN_CALL_DYNAMIC; + else + typ = INSN_OTHER; + break; + case 24: + if (rs == 0 && ra == 0 && uimm == 0) + typ = INSN_NOP; + else + typ = INSN_OTHER; + break; + case 31: + if (xop == 4 && to == 31 && ra == 0 && rb == 0) /* trap */ + typ = INSN_BUG; + else + typ = INSN_OTHER; + break; + default: + typ = INSN_OTHER; break; } @@ -70,13 +118,15 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec insn->len = 4; insn->type = typ; - insn->immediate = imm; return 0; } unsigned long arch_jump_destination(struct instruction *insn) { + if (insn->immediate & 2) + return insn->immediate & ~2; + return insn->offset + insn->immediate; } diff --git a/tools/objtool/arch/powerpc/include/arch/special.h b/tools/objtool/arch/powerpc/include/arch/special.h index ffef9ada7133..a679b36307a9 100644 --- a/tools/objtool/arch/powerpc/include/arch/special.h +++ b/tools/objtool/arch/powerpc/include/arch/special.h @@ -6,7 +6,7 @@ #define EX_ORIG_OFFSET 0 #define EX_NEW_OFFSET 4 -#define JUMP_ENTRY_SIZE 16 +#define JUMP_ENTRY_SIZE 12 #define JUMP_ORIG_OFFSET 0 #define JUMP_NEW_OFFSET 4 #define JUMP_KEY_OFFSET 8 diff --git a/tools/objtool/arch/powerpc/special.c b/tools/objtool/arch/powerpc/special.c index d33868147196..0e301b3a5b71 100644 --- a/tools/objtool/arch/powerpc/special.c +++ b/tools/objtool/arch/powerpc/special.c @@ -13,7 +13,47 @@ bool arch_support_alt_relocation(struct special_alt *special_alt, } struct reloc *arch_find_switch_table(struct objtool_file *file, - struct instruction *insn) + struct instruction *insn, bool *is_rel) { - exit(-1); + struct reloc *text_reloc, *rodata_reloc; + struct section *table_sec; + unsigned long table_offset; + + /* look for a relocation which references .rodata */ + text_reloc = find_reloc_by_dest_range(file->elf, insn->sec, + insn->offset, insn->len); + if (!text_reloc || text_reloc->sym->type != STT_SECTION || + !text_reloc->sym->sec->rodata) + return NULL; + + table_offset = text_reloc->addend; + table_sec = text_reloc->sym->sec; + + /* + * Make sure the .rodata address isn't associated with a + * symbol. GCC jump tables are anonymous data. + * + * Also support C jump tables which are in the same format as + * switch jump tables. For objtool to recognize them, they + * need to be placed in the C_JUMP_TABLE_SECTION section. They + * have symbols associated with them. + */ + if (find_symbol_containing(table_sec, table_offset)) { + *is_rel = false; + if (strcmp(table_sec->name, C_JUMP_TABLE_SECTION)) + return NULL; + } else { + *is_rel = true; + } + + /* + * Each table entry has a rela associated with it. The rela + * should reference text in the same function as the original + * instruction. + */ + rodata_reloc = find_reloc_by_dest(file->elf, table_sec, table_offset); + if (!rodata_reloc) + return NULL; + + return rodata_reloc; } diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 0fcf99c91400..f945fe271706 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -236,6 +236,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, "x86_64_start_reservations", "xen_cpu_bringup_again", "xen_start_kernel", + "longjmp", }; if (!func) @@ -2060,13 +2061,12 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, * instruction. */ list_for_each_entry_from(reloc, &table->sec->reloc_list, list) { - /* Check for the end of the table: */ if (reloc != table && reloc->jump_table_start) break; /* Make sure the table entries are consecutive: */ - if (prev_offset && reloc->offset != prev_offset + 8) + if (prev_offset && reloc->offset != prev_offset + 4) break; /* Detect function pointers from contiguous objects: */ @@ -2074,7 +2074,10 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, reloc->addend == pfunc->offset) break; - dest_insn = find_insn(file, reloc->sym->sec, reloc->addend); + if (table->jump_table_is_rel) + dest_insn = find_insn(file, reloc->sym->sec, reloc->addend + table->offset - reloc->offset); + else + dest_insn = find_insn(file, reloc->sym->sec, reloc->addend); if (!dest_insn) break; @@ -2108,7 +2111,7 @@ static int add_jump_table(struct objtool_file *file, struct instruction *insn, */ static struct reloc *find_jump_table(struct objtool_file *file, struct symbol *func, - struct instruction *insn) + struct instruction *insn, bool *is_rel) { struct reloc *table_reloc; struct instruction *dest_insn, *orig_insn = insn; @@ -2125,14 +2128,7 @@ static struct reloc *find_jump_table(struct objtool_file *file, if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC) break; - /* allow small jumps within the range */ - if (insn->type == INSN_JUMP_UNCONDITIONAL && - insn->jump_dest && - (insn->jump_dest->offset <= insn->offset || - insn->jump_dest->offset > orig_insn->offset)) - break; - - table_reloc = arch_find_switch_table(file, insn); + table_reloc = arch_find_switch_table(file, insn, is_rel); if (!table_reloc) continue; dest_insn = find_insn(file, table_reloc->sym->sec, table_reloc->addend); @@ -2154,6 +2150,7 @@ static void mark_func_jump_tables(struct objtool_file *file, { struct instruction *insn, *last = NULL; struct reloc *reloc; + bool is_rel; func_for_each_insn(file, func, insn) { if (!last) @@ -2176,9 +2173,10 @@ static void mark_func_jump_tables(struct objtool_file *file, if (insn->type != INSN_JUMP_DYNAMIC) continue; - reloc = find_jump_table(file, func, insn); + reloc = find_jump_table(file, func, insn, &is_rel); if (reloc) { reloc->jump_table_start = true; + reloc->jump_table_is_rel = is_rel; insn->_jump_table = reloc; } } @@ -4024,6 +4022,11 @@ static bool ignore_unreachable_insn(struct objtool_file *file, struct instructio if (insn->ignore || insn->type == INSN_NOP || insn->type == INSN_TRAP) return true; + /* powerpc relocatable files have a word in front of each relocatable function */ + if ((file->elf->ehdr.e_machine == EM_PPC || file->elf->ehdr.e_machine == EM_PPC64) && + (file->elf->ehdr.e_flags & EF_PPC_RELOCATABLE_LIB) && + insn_func(next_insn_same_sec(file, insn))) + return true; /* * Ignore alternative replacement instructions. This can happen * when a whitelisted function uses one of the ALTERNATIVE macros. diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h index e1ca588eb69d..64aac87a4825 100644 --- a/tools/objtool/include/objtool/elf.h +++ b/tools/objtool/include/objtool/elf.h @@ -80,6 +80,7 @@ struct reloc { s64 addend; int idx; bool jump_table_start; + bool jump_table_is_rel; }; #define ELF_HASH_BITS 20 diff --git a/tools/objtool/include/objtool/special.h b/tools/objtool/include/objtool/special.h index 86d4af9c5aa9..803c6d3ba389 100644 --- a/tools/objtool/include/objtool/special.h +++ b/tools/objtool/include/objtool/special.h @@ -38,5 +38,5 @@ bool arch_support_alt_relocation(struct special_alt *special_alt, struct instruction *insn, struct reloc *reloc); struct reloc *arch_find_switch_table(struct objtool_file *file, - struct instruction *insn); + struct instruction *insn, bool *is_rel); #endif /* _SPECIAL_H */