ARM: ftrace MODULE_PLTS warning
Subsystems (3)
v2 cover ARM: ftrace MODULE_PLTS warning
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and MODULE_PLTS enabled on ARM/Linux.
Changes in v2:
- included build fix without DYNAMIC_FTRACE
- preserved Author's original name in 4.9 submission
Alex Sverdlin (4):
ARM: 9077/1: PLT: Move struct plt_entries definition to header
ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
ARM: 9079/1: ftrace: Add MODULE_PLTS support
ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without
DYNAMIC_FTRACE
arch/arm/include/asm/ftrace.h | 3 +++ arch/arm/include/asm/insn.h | 8 +++--- arch/arm/include/asm/module.h | 10 +++++++ arch/arm/kernel/ftrace.c | 45 +++++++++++++++++++++++++++----- arch/arm/kernel/insn.c | 19 +++++++------- arch/arm/kernel/module-plts.c | 49 +++++++++++++++++++++++++++-------- 6 files changed, 103 insertions(+), 31 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/4 ARM: 9077/1: PLT: Move struct plt_entries definition to header
From: Alex Sverdlin <[email protected]>
commit 4e271701c17dee70c6e1351c4d7d42e70405c6a9 upstream
No functional change, later it will be re-used in several files.
--- arch/arm/include/asm/module.h | 9 +++++++++ arch/arm/kernel/module-plts.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/include/asm/module.h +9 -0
@@ -18,6 +18,15 @@ enum { };#endif +#define PLT_ENT_STRIDE L1_CACHE_BYTES +#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) +#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) + +struct plt_entries { +u32 ldr[PLT_ENT_COUNT ]; +u32 lit[PLT_ENT_COUNT ]; +}; +struct mod_plt_sec {struct elf32_shdr *plt;int plt_count;
arch/arm/kernel/module-plts.c +0 -9
@@ -14,10 +14,6 @@#include <asm/cache.h> #include <asm/opcodes.h> -#define PLT_ENT_STRIDE L1_CACHE_BYTES -#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) -#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) -#ifdef CONFIG_THUMB2_KERNEL #define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \ (PLT_ENT_STRIDE - 4))
@@ -26,11 +22,6 @@ (PLT_ENT_STRIDE - 8))#endif -struct plt_entries { -u32 ldr[PLT_ENT_COUNT ]; -u32 lit[PLT_ENT_COUNT ]; -}; -static bool in_init (const struct module *mod,unsigned long loc) {return loc - (u32 )mod->init_layout.base < mod->init_layout.size;
Signature · 1 line
2.25.1
Patch "ARM: 9077/1: PLT: Move struct plt_entries definition to header" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
ARM: 9077/1: PLT: Move struct plt_entries definition to header
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm-9077-1-plt-move-struct-plt_entries-definition-to-header.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Thu Sep 23 12:34:24 PM CEST 2021
From: Florian Fainelli <[email protected]>
Date: Wed, 22 Sep 2021 10:02:43 -0700
Subject: ARM: 9077/1: PLT: Move struct plt_entries definition to header
To: [email protected]
Cc: [email protected], Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>, Alex Sverdlin <[email protected]>, Russell King <[email protected]>, Florian Fainelli <[email protected]>, Steven Rostedt <[email protected]>, Ingo Molnar <[email protected]>, Russell King <[email protected]>, [email protected] (moderated list:ARM PORT)
Message-ID: <[email protected]>
From: Alex Sverdlin <[email protected]>
commit 4e271701c17dee70c6e1351c4d7d42e70405c6a9 upstream
No functional change, later it will be re-used in several files.
--- arch/arm/include/asm/module.h | 9 +++++++++ arch/arm/kernel/module-plts.c | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/include/asm/module.h +9 -0
@@ -18,6 +18,15 @@ enum { };#endif +#define PLT_ENT_STRIDE L1_CACHE_BYTES +#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) +#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) + +struct plt_entries { +u32 ldr[PLT_ENT_COUNT ]; +u32 lit[PLT_ENT_COUNT ]; +}; +struct mod_plt_sec {struct elf32_shdr *plt;int plt_count;
arch/arm/kernel/module-plts.c +0 -9
@@ -14,10 +14,6 @@#include <asm/cache.h> #include <asm/opcodes.h> -#define PLT_ENT_STRIDE L1_CACHE_BYTES -#define PLT_ENT_COUNT (PLT_ENT_STRIDE / sizeof(u32)) -#define PLT_ENT_SIZE (sizeof(struct plt_entries) / PLT_ENT_COUNT) -#ifdef CONFIG_THUMB2_KERNEL #define PLT_ENT_LDR __opcode_to_mem_thumb32(0xf8dff000 | \ (PLT_ENT_STRIDE - 4))
@@ -26,11 +22,6 @@ (PLT_ENT_STRIDE - 8))#endif -struct plt_entries { -u32 ldr[PLT_ENT_COUNT ]; -u32 lit[PLT_ENT_COUNT ]; -}; -static bool in_init (const struct module *mod,unsigned long loc) {return loc - (u32 )mod->init_layout.base < mod->init_layout.size;
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm-9098-1-ftrace-module_plt-fix-build-problem-without-dynamic_ftrace.patch queue-4.9/arm-9079-1-ftrace-add-module_plts-support.patch queue-4.9/arm-9078-1-add-warn-suppress-parameter-to-arm_gen_branch_link.patch queue-4.9/arm-9077-1-plt-move-struct-plt_entries-definition-to-header.patch
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 2/4 ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
In reply to Florian FainelliFrom: Alex Sverdlin <[email protected]>
commit 890cb057a46d323fd8c77ebecb6485476614cd21 upstream
Will be used in the following patch. No functional change.
--- arch/arm/include/asm/insn.h | 8 ++++---- arch/arm/kernel/ftrace.c | 2 +- arch/arm/kernel/insn.c | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-)
arch/arm/include/asm/insn.h +4 -4
@@ -12,18 +12,18 @@ arm_gen_nop(void) }unsigned long -__arm_gen_branch (unsigned long pc,unsigned long addr,bool link); +__arm_gen_branch (unsigned long pc,unsigned long addr,bool link,bool warn);static inline unsigned long arm_gen_branch (unsigned long pc,unsigned long addr) { -return __arm_gen_branch (pc, addr, false); +return __arm_gen_branch (pc, addr, false, true); }static inline unsigned long -arm_gen_branch_link (unsigned long pc,unsigned long addr) +arm_gen_branch_link (unsigned long pc,unsigned long addr,bool warn) { -return __arm_gen_branch (pc, addr, true); +return __arm_gen_branch (pc, addr, true, warn); }#endif
arch/arm/kernel/ftrace.c +1 -1
@@ -97,7 +97,7 @@ int ftrace_arch_code_modify_post_process(void)static unsigned long ftrace_call_replace (unsigned long pc,unsigned long addr) { -return arm_gen_branch_link (pc, addr); +return arm_gen_branch_link (pc, addr, true); } static int ftrace_modify_code(unsigned long pc, unsigned long old,
arch/arm/kernel/insn.c +10 -9
@@ -2,8 +2,9 @@#include <linux/kernel.h> #include <asm/opcodes.h> -static unsigned long -__arm_gen_branch_thumb2 (unsigned long pc,unsigned long addr,bool link) +static unsigned long __arm_gen_branch_thumb2 (unsigned long pc, +unsigned long addr,bool link, +bool warn) {unsigned long s, j1, j2, i1, i2, imm10, imm11;unsigned long first, second;
@@ -11,7 +12,7 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) offset = (long )addr - (long )(pc +4 );if (offset <-16777216 || offset >16777214 ) { -WARN_ON_ONCE (1 ); +WARN_ON_ONCE (warn);return 0 ; }
@@ -32,8 +33,8 @@ __arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)return __opcode_thumb32_compose (first, second); } -static unsigned long -__arm_gen_branch_arm (unsigned long pc,unsigned long addr,bool link) +static unsigned long __arm_gen_branch_arm (unsigned long pc,unsigned long addr, +bool link,bool warn) {unsigned long opcode =0xea000000 ;long offset;
@@ -43,7 +44,7 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) offset = (long )addr - (long )(pc +8 );if (unlikely (offset <-33554432 || offset >33554428 )) { -WARN_ON_ONCE (1 ); +WARN_ON_ONCE (warn);return 0 ; }
@@ -53,10 +54,10 @@ __arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) }unsigned long -__arm_gen_branch (unsigned long pc,unsigned long addr,bool link) +__arm_gen_branch (unsigned long pc,unsigned long addr,bool link,bool warn) {if (IS_ENABLED (CONFIG_THUMB2_KERNEL )) -return __arm_gen_branch_thumb2 (pc, addr, link); +return __arm_gen_branch_thumb2 (pc, addr, link, warn);else -return __arm_gen_branch_arm (pc, addr, link); +return __arm_gen_branch_arm (pc, addr, link, warn); }
Signature · 1 line
2.25.1
Patch "ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm-9078-1-add-warn-suppress-parameter-to-arm_gen_branch_link.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Thu Sep 23 12:34:24 PM CEST 2021
From: Florian Fainelli <[email protected]>
Date: Wed, 22 Sep 2021 10:02:44 -0700
Subject: ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link()
To: [email protected]
Cc: [email protected], Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>, Alex Sverdlin <[email protected]>, Russell King <[email protected]>, Florian Fainelli <[email protected]>, Steven Rostedt <[email protected]>, Ingo Molnar <[email protected]>, Russell King <[email protected]>, [email protected] (moderated list:ARM PORT)
Message-ID: <[email protected]>
From: Alex Sverdlin <[email protected]>
commit 890cb057a46d323fd8c77ebecb6485476614cd21 upstream
Will be used in the following patch. No functional change.
--- arch/arm/include/asm/insn.h | 8 ++++---- arch/arm/kernel/ftrace.c | 2 +- arch/arm/kernel/insn.c | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-)
arch/arm/include/asm/insn.h +4 -4
@@ -12,18 +12,18 @@ arm_gen_nop(void) }unsigned long -__arm_gen_branch (unsigned long pc,unsigned long addr,bool link); +__arm_gen_branch (unsigned long pc,unsigned long addr,bool link,bool warn);static inline unsigned long arm_gen_branch (unsigned long pc,unsigned long addr) { -return __arm_gen_branch (pc, addr, false); +return __arm_gen_branch (pc, addr, false, true); }static inline unsigned long -arm_gen_branch_link (unsigned long pc,unsigned long addr) +arm_gen_branch_link (unsigned long pc,unsigned long addr,bool warn) { -return __arm_gen_branch (pc, addr, true); +return __arm_gen_branch (pc, addr, true, warn); }#endif
arch/arm/kernel/ftrace.c +1 -1
@@ -97,7 +97,7 @@ int ftrace_arch_code_modify_post_processstatic unsigned long ftrace_call_replace (unsigned long pc,unsigned long addr) { -return arm_gen_branch_link (pc, addr); +return arm_gen_branch_link (pc, addr, true); } static int ftrace_modify_code(unsigned long pc, unsigned long old,
arch/arm/kernel/insn.c +10 -9
@@ -2,8 +2,9 @@#include <linux/kernel.h> #include <asm/opcodes.h> -static unsigned long -__arm_gen_branch_thumb2 (unsigned long pc,unsigned long addr,bool link) +static unsigned long __arm_gen_branch_thumb2 (unsigned long pc, +unsigned long addr,bool link, +bool warn) {unsigned long s, j1, j2, i1, i2, imm10, imm11;unsigned long first, second;
@@ -11,7 +12,7 @@ __arm_gen_branch_thumb2(unsigned long pc offset = (long )addr - (long )(pc +4 );if (offset <-16777216 || offset >16777214 ) { -WARN_ON_ONCE (1 ); +WARN_ON_ONCE (warn);return 0 ; }
@@ -32,8 +33,8 @@ __arm_gen_branch_thumb2(unsigned long pcreturn __opcode_thumb32_compose (first, second); } -static unsigned long -__arm_gen_branch_arm (unsigned long pc,unsigned long addr,bool link) +static unsigned long __arm_gen_branch_arm (unsigned long pc,unsigned long addr, +bool link,bool warn) {unsigned long opcode =0xea000000 ;long offset;
@@ -43,7 +44,7 @@ __arm_gen_branch_arm(unsigned long pc, u offset = (long )addr - (long )(pc +8 );if (unlikely (offset <-33554432 || offset >33554428 )) { -WARN_ON_ONCE (1 ); +WARN_ON_ONCE (warn);return 0 ; }
@@ -53,10 +54,10 @@ __arm_gen_branch_arm(unsigned long pc, u }unsigned long -__arm_gen_branch (unsigned long pc,unsigned long addr,bool link) +__arm_gen_branch (unsigned long pc,unsigned long addr,bool link,bool warn) {if (IS_ENABLED (CONFIG_THUMB2_KERNEL )) -return __arm_gen_branch_thumb2 (pc, addr, link); +return __arm_gen_branch_thumb2 (pc, addr, link, warn);else -return __arm_gen_branch_arm (pc, addr, link); +return __arm_gen_branch_arm (pc, addr, link, warn); }
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm-9098-1-ftrace-module_plt-fix-build-problem-without-dynamic_ftrace.patch queue-4.9/arm-9079-1-ftrace-add-module_plts-support.patch queue-4.9/arm-9078-1-add-warn-suppress-parameter-to-arm_gen_branch_link.patch queue-4.9/arm-9077-1-plt-move-struct-plt_entries-definition-to-header.patch
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 3/4 ARM: 9079/1: ftrace: Add MODULE_PLTS support
In reply to Florian FainelliFrom: Alex Sverdlin <[email protected]>
commit 79f32b221b18c15a98507b101ef4beb52444cc6f upstream
Teach ftrace_make_call() and ftrace_make_nop() about PLTs. Teach PLT code about FTRACE and all its callbacks. Otherwise the following might happen:
------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../arch/arm/kernel/insn.c:14 __arm_gen_branch+0x83/0x8c() ... Hardware name: LSI Axxia AXM55XX [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14) [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8) [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90) [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c) [<c03218f3>] (warn_slowpath_null) from [<c03143cf>] (__arm_gen_branch+0x83/0x8c) [<c03143cf>] (__arm_gen_branch) from [<c0314337>] (ftrace_make_nop+0xf/0x24) [<c0314337>] (ftrace_make_nop) from [<c038ebcb>] (ftrace_process_locs+0x27b/0x3e8) [<c038ebcb>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44) [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84) [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcc ]--- ------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1b1/0x234() ... Hardware name: LSI Axxia AXM55XX [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14) [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8) [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90) [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c) [<c03218f3>] (warn_slowpath_null) from [<c038e87d>] (ftrace_bug+0x1b1/0x234) [<c038e87d>] (ftrace_bug) from [<c038ebd5>] (ftrace_process_locs+0x285/0x3e8) [<c038ebd5>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44) [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84) [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcd ]---
ftrace failed to modify [<e9ef7006>] 0xe9ef7006
actual: 02:f0:3b:fa
ftrace record flags: 0
(0) expected tramp: c0314265
--- arch/arm/include/asm/ftrace.h | 3 +++ arch/arm/include/asm/module.h | 1 + arch/arm/kernel/ftrace.c | 45 +++++++++++++++++++++++++++++------ arch/arm/kernel/module-plts.c | 44 ++++++++++++++++++++++++++++++---- 4 files changed, 82 insertions(+), 11 deletions(-)
arch/arm/include/asm/ftrace.h +3 -0
@@ -14,6 +14,9 @@ struct dyn_arch_ftrace {#ifdef CONFIG_OLD_MCOUNT bool old_mcount;#endif +#ifdef CONFIG_ARM_MODULE_PLTS +struct module *mod; +#endif };static inline unsigned long ftrace_call_adjust (unsigned long addr)
arch/arm/include/asm/module.h +1 -0
@@ -29,6 +29,7 @@ struct plt_entries {struct mod_plt_sec {struct elf32_shdr *plt; +struct plt_entries *plt_ent;int plt_count; };
arch/arm/kernel/ftrace.c +38 -7
89 lines not on this page · raw message
arch/arm/kernel/module-plts.c +40 -4
85 lines not on this page · raw message
Signature · 1 line
2.25.1
Patch "ARM: 9079/1: ftrace: Add MODULE_PLTS support" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
ARM: 9079/1: ftrace: Add MODULE_PLTS support
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm-9079-1-ftrace-add-module_plts-support.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Thu Sep 23 12:34:24 PM CEST 2021
From: Florian Fainelli <[email protected]>
Date: Wed, 22 Sep 2021 10:02:45 -0700
Subject: ARM: 9079/1: ftrace: Add MODULE_PLTS support
To: [email protected]
Cc: [email protected], Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>, Alex Sverdlin <[email protected]>, Russell King <[email protected]>, Florian Fainelli <[email protected]>, Steven Rostedt <[email protected]>, Ingo Molnar <[email protected]>, Russell King <[email protected]>, [email protected] (moderated list:ARM PORT)
Message-ID: <[email protected]>
From: Alex Sverdlin <[email protected]>
commit 79f32b221b18c15a98507b101ef4beb52444cc6f upstream
Teach ftrace_make_call() and ftrace_make_nop() about PLTs. Teach PLT code about FTRACE and all its callbacks. Otherwise the following might happen:
------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../arch/arm/kernel/insn.c:14 __arm_gen_branch+0x83/0x8c() ... Hardware name: LSI Axxia AXM55XX [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14) [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8) [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90) [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c) [<c03218f3>] (warn_slowpath_null) from [<c03143cf>] (__arm_gen_branch+0x83/0x8c) [<c03143cf>] (__arm_gen_branch) from [<c0314337>] (ftrace_make_nop+0xf/0x24) [<c0314337>] (ftrace_make_nop) from [<c038ebcb>] (ftrace_process_locs+0x27b/0x3e8) [<c038ebcb>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44) [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84) [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcc ]--- ------------[ cut here ]------------ WARNING: CPU: 14 PID: 2265 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1b1/0x234() ... Hardware name: LSI Axxia AXM55XX [<c0314a49>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14) [<c03115e9>] (show_stack) from [<c0519f51>] (dump_stack+0x81/0xa8) [<c0519f51>] (dump_stack) from [<c032185d>] (warn_slowpath_common+0x69/0x90) [<c032185d>] (warn_slowpath_common) from [<c03218f3>] (warn_slowpath_null+0x17/0x1c) [<c03218f3>] (warn_slowpath_null) from [<c038e87d>] (ftrace_bug+0x1b1/0x234) [<c038e87d>] (ftrace_bug) from [<c038ebd5>] (ftrace_process_locs+0x285/0x3e8) [<c038ebd5>] (ftrace_process_locs) from [<c0378d79>] (load_module+0x11e9/0x1a44) [<c0378d79>] (load_module) from [<c037974d>] (SyS_finit_module+0x59/0x84) [<c037974d>] (SyS_finit_module) from [<c030e981>] (ret_fast_syscall+0x1/0x18) ---[ end trace e1b64ced7a89adcd ]---
ftrace failed to modify [<e9ef7006>] 0xe9ef7006
actual: 02:f0:3b:fa
ftrace record flags: 0
(0) expected tramp: c0314265
--- arch/arm/include/asm/ftrace.h | 3 ++ arch/arm/include/asm/module.h | 1 arch/arm/kernel/ftrace.c | 45 +++++++++++++++++++++++++++++++++++------- arch/arm/kernel/module-plts.c | 44 +++++++++++++++++++++++++++++++++++++---- 4 files changed, 82 insertions(+), 11 deletions(-)
arch/arm/include/asm/ftrace.h +3 -0
@@ -14,6 +14,9 @@ struct dyn_arch_ftrace {#ifdef CONFIG_OLD_MCOUNT bool old_mcount;#endif +#ifdef CONFIG_ARM_MODULE_PLTS +struct module *mod; +#endif };static inline unsigned long ftrace_call_adjust (unsigned long addr)
arch/arm/include/asm/module.h +1 -0
@@ -29,6 +29,7 @@ struct plt_entries {struct mod_plt_sec {struct elf32_shdr *plt; +struct plt_entries *plt_ent;int plt_count; };
arch/arm/kernel/ftrace.c +38 -7
89 lines not on this page · raw message
arch/arm/kernel/module-plts.c +40 -4
85 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm-9098-1-ftrace-module_plt-fix-build-problem-without-dynamic_ftrace.patch queue-4.9/arm-9079-1-ftrace-add-module_plts-support.patch queue-4.9/arm-9078-1-add-warn-suppress-parameter-to-arm_gen_branch_link.patch queue-4.9/arm-9077-1-plt-move-struct-plt_entries-definition-to-header.patch
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 4/4 ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE
In reply to Florian FainelliFrom: Alex Sverdlin <[email protected]>
commit 6fa630bf473827aee48cbf0efbbdf6f03134e890 upstream
FTRACE_ADDR is only defined when CONFIG_DYNAMIC_FTRACE is defined, the latter is even stronger requirement than CONFIG_FUNCTION_TRACER (which is enough for MCOUNT_ADDR).
--- arch/arm/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/module-plts.c +1 -1
@@ -24,7 +24,7 @@#endif static const u32 fixed_plts[] = { -#ifdef CONFIG_FUNCTION_TRACER +#ifdef CONFIG_DYNAMIC_FTRACEFTRACE_ADDR ,MCOUNT_ADDR , #endif
Signature · 1 line
2.25.1
Patch "ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE" has been added to the 4.9-stable tree
This is a note to let you know that I've just added the patch titled
ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm-9098-1-ftrace-module_plt-fix-build-problem-without-dynamic_ftrace.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
From foo@baz Thu Sep 23 12:34:24 PM CEST 2021
From: Florian Fainelli <[email protected]>
Date: Wed, 22 Sep 2021 10:02:46 -0700
Subject: ARM: 9098/1: ftrace: MODULE_PLT: Fix build problem without DYNAMIC_FTRACE
To: [email protected]
Cc: [email protected], Greg Kroah-Hartman <[email protected]>, Sasha Levin <[email protected]>, Alex Sverdlin <[email protected]>, kernel test robot <[email protected]>, Russell King <[email protected]>, Florian Fainelli <[email protected]>, Steven Rostedt <[email protected]>, Ingo Molnar <[email protected]>, Russell King <[email protected]>, [email protected] (moderated list:ARM PORT)
Message-ID: <[email protected]>
From: Alex Sverdlin <[email protected]>
commit 6fa630bf473827aee48cbf0efbbdf6f03134e890 upstream
FTRACE_ADDR is only defined when CONFIG_DYNAMIC_FTRACE is defined, the latter is even stronger requirement than CONFIG_FUNCTION_TRACER (which is enough for MCOUNT_ADDR).
--- arch/arm/kernel/module-plts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/module-plts.c +1 -1
@@ -24,7 +24,7 @@#endif static const u32 fixed_plts[] = { -#ifdef CONFIG_FUNCTION_TRACER +#ifdef CONFIG_DYNAMIC_FTRACEFTRACE_ADDR ,MCOUNT_ADDR , #endif
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/arm-9098-1-ftrace-module_plt-fix-build-problem-without-dynamic_ftrace.patch queue-4.9/arm-9079-1-ftrace-add-module_plts-support.patch queue-4.9/arm-9078-1-add-warn-suppress-parameter-to-arm_gen_branch_link.patch queue-4.9/arm-9077-1-plt-move-struct-plt_entries-definition-to-header.patch
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerQuoted 2 lines · Florian Fainelli
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and
MODULE_PLTSenabled on ARM/Linux.
All now queued up, thanks.
greg k-h
Sasha Levin
maintainerQuoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · Florian Fainelli
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and
MODULE_PLTSenabled on ARM/Linux.All now queued up, thanks.
Looks like 4.19 and older break the build:
arch/arm/kernel/ftrace.c: In function 'ftrace_update_ftrace_func':arch/arm/kernel/ftrace.c:157:9: error: too few arguments to function 'ftrace_call_replace'
157 | new = ftrace_call_replace(pc, (unsigned long)func);
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c: In function 'ftrace_make_nop':
arch/arm/kernel/ftrace.c:240:9: error: too few arguments to function 'ftrace_call_replace'
240 | old = ftrace_call_replace(ip, adjust_address(rec, addr));
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,
| ^~~~~~~~~~~~~~~~~~~make[2]: *** [scripts/Makefile.build:303: arch/arm/kernel/ftrace.o] Error 1
I've dropped them.
Signature · 2 lines
Thanks, Sasha
Hi Sasha,
Quoted 11 lines · Sasha Levin
Quoted 4 lines
Quoted 2 lines
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and MODULE_PLTS enabled on ARM/Linux.
All now queued up, thanks.
Looks like 4.19 and older break the build:
arch/arm/kernel/ftrace.c: In function 'ftrace_update_ftrace_func':
arch/arm/kernel/ftrace.c:157:9: error: too few arguments to function 'ftrace_call_replace' 157 | new = ftrace_call_replace(pc, (unsigned long)func);
| ^~~~~~~~~~~~~~~~~~~
in principle you can add ", true" as a third argument in all these ftrace_call_replace() call-sites which still have two args.
Quoted 13 lines
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, | ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c: In function 'ftrace_make_nop':
arch/arm/kernel/ftrace.c:240:9: error: too few arguments to function 'ftrace_call_replace' 240 | old = ftrace_call_replace(ip, adjust_address(rec, addr));
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, | ^~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:303: arch/arm/kernel/ftrace.o] Error 1I've dropped them.
Signature · 2 lines
Best regards, Alexander Sverdlin.
Quoted 10 lines · Alexander Sverdlin
Hi Sasha,
Quoted 7 lines · Sasha Levin
Quoted 4 lines
Quoted 2 lines
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and MODULE_PLTS enabled on ARM/Linux.
All now queued up, thanks.
Looks like 4.19 and older break the build:
Quoted 7 lines
Quoted 4 lines
arch/arm/kernel/ftrace.c: In function 'ftrace_update_ftrace_func':
arch/arm/kernel/ftrace.c:157:9: error: too few arguments to function 'ftrace_call_replace' 157 | new = ftrace_call_replace(pc, (unsigned long)func);
| ^~~~~~~~~~~~~~~~~~~in principle you can add ", true" as a third argument in all these
ftrace_call_replace()call-sites which still have two args.
Sasha, what configuration failed to build? I build tested with mutli_v7_defconfig which does enable FTRACE by default and then ensured that CONFIG_ARM_MODULE_PLTS was enabled. From there I will re-submit, sorry about that.
Quoted 15 lines
Quoted 14 lines
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, | ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c: In function 'ftrace_make_nop':
arch/arm/kernel/ftrace.c:240:9: error: too few arguments to function 'ftrace_call_replace' 240 | old = ftrace_call_replace(ip, adjust_address(rec, addr));
| ^~~~~~~~~~~~~~~~~~~
arch/arm/kernel/ftrace.c:99:22: note: declared here
99 | static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr, | ^~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:303: arch/arm/kernel/ftrace.o] Error 1I've dropped them.
Signature · 1 line
Florian
Sasha Levin
maintainerQuoted 16 lines · Florian Fainelli
Quoted 15 lines · Alexander Sverdlin
Hi Sasha,
Quoted 11 lines · Sasha Levin
Quoted 4 lines
Quoted 2 lines
This patch series is present in v5.14 and fixes warnings seen at insmod with FTRACE and MODULE_PLTS enabled on ARM/Linux.
All now queued up, thanks.
Looks like 4.19 and older break the build:
arch/arm/kernel/ftrace.c: In function 'ftrace_update_ftrace_func':
arch/arm/kernel/ftrace.c:157:9: error: too few arguments to function 'ftrace_call_replace' 157 | new = ftrace_call_replace(pc, (unsigned long)func);
| ^~~~~~~~~~~~~~~~~~~
Quoted 7 lines
Quoted 2 lines
in principle you can add ", true" as a third argument in all these
ftrace_call_replace()call-sites which still have two args.Sasha, what configuration failed to build? I build tested with
mutli_v7_defconfigwhich does enable FTRACE by default and then ensured thatCONFIG_ARM_MODULE_PLTSwas enabled. From there I will re-submit, sorry about that.
allmodconfig seemed to have hit that.
Signature · 2 lines
Thanks, Sasha