Revert "x86/orc: Make it callthunk aware"
authorJosh Poimboeuf <jpoimboe@kernel.org>
Tue, 16 May 2023 13:56:46 +0000 (06:56 -0700)
committerJosh Poimboeuf <jpoimboe@kernel.org>
Wed, 7 Jun 2023 16:48:57 +0000 (09:48 -0700)
Commit 396e0b8e09e8 ("x86/orc: Make it callthunk aware") attempted to
deal with the fact that function prefix code didn't have ORC coverage.
However, it didn't work as advertised.  Use of the "null" ORC entry just
caused affected unwinds to end early.

The root cause has now been fixed with commit 5743654f5e2e ("objtool:
Generate ORC data for __pfx code").

Revert most of commit 396e0b8e09e8 ("x86/orc: Make it callthunk aware").
The is_callthunk() function remains as it's now used by other code.

Link: https://lore.kernel.org/r/a05b916ef941da872cbece1ab3593eceabd05a79.1684245404.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
arch/x86/include/asm/alternative.h
arch/x86/kernel/callthunks.c
arch/x86/kernel/unwind_orc.c

index d7da28fada87a35445c2c9740dda83c589a23de0..6c15a622ad6096e61efe89a95305156a2f5b6f2c 100644 (file)
@@ -113,7 +113,6 @@ extern void callthunks_patch_builtin_calls(void);
 extern void callthunks_patch_module_calls(struct callthunk_sites *sites,
                                          struct module *mod);
 extern void *callthunks_translate_call_dest(void *dest);
-extern bool is_callthunk(void *addr);
 extern int x86_call_depth_emit_accounting(u8 **pprog, void *func);
 #else
 static __always_inline void callthunks_patch_builtin_calls(void) {}
@@ -124,10 +123,6 @@ static __always_inline void *callthunks_translate_call_dest(void *dest)
 {
        return dest;
 }
-static __always_inline bool is_callthunk(void *addr)
-{
-       return false;
-}
 static __always_inline int x86_call_depth_emit_accounting(u8 **pprog,
                                                          void *func)
 {
index 22ab139664271a5860ac0ebe62b2f8a762a701d9..8e0a9b637e23f8cb09fbc53452fdc038abaed369 100644 (file)
@@ -293,7 +293,7 @@ void *callthunks_translate_call_dest(void *dest)
        return target ? : dest;
 }
 
-bool is_callthunk(void *addr)
+static bool is_callthunk(void *addr)
 {
        unsigned int tmpl_size = SKL_TMPL_SIZE;
        void *tmpl = skl_call_thunk_template;
index 7891727f534e9c59c959399718a7f84895ef40bf..4ee16b02628a93fa0d554607aff5808d6d8595ca 100644 (file)
@@ -183,21 +183,6 @@ static struct orc_entry null_orc_entry = {
        .type = ORC_TYPE_CALL
 };
 
-#ifdef CONFIG_CALL_THUNKS
-static struct orc_entry *orc_callthunk_find(unsigned long ip)
-{
-       if (!is_callthunk((void *)ip))
-               return NULL;
-
-       return &null_orc_entry;
-}
-#else
-static struct orc_entry *orc_callthunk_find(unsigned long ip)
-{
-       return NULL;
-}
-#endif
-
 /* Fake frame pointer entry -- used as a fallback for generated code */
 static struct orc_entry orc_fp_entry = {
        .type           = ORC_TYPE_CALL,
@@ -250,11 +235,7 @@ static struct orc_entry *orc_find(unsigned long ip)
        if (orc)
                return orc;
 
-       orc =  orc_ftrace_find(ip);
-       if (orc)
-               return orc;
-
-       return orc_callthunk_find(ip);
+       return orc_ftrace_find(ip);
 }
 
 #ifdef CONFIG_MODULES