-
Notifications
You must be signed in to change notification settings - Fork 336
ppc64le: Fix wrong offset for destination symbols in create_klp_relasecs_and_syms() #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Commit 5888f31 ("create-klp-module: support unbundled symbols") breaks the livepatch modules build on ppc64le, with stalls after module load: INFO: rcu_sched self-detected stall on CPU 5-...: (21002 ticks this GP) idle=7ba/140000000000001/0 softirq=97524/97524 fqs=10499 (t=21003 jiffies g=23955 c=23954 q=2203) NMI backtrace for cpu 5 CPU: 5 PID: 22188 Comm: cat Tainted: G OE K 4.14.0-rc7+ dynup#3 Call Trace: dump_stack+0xb0/0xf0 (unreliable) nmi_cpu_backtrace+0x208/0x210 nmi_trigger_cpumask_backtrace+0x1c0/0x200 arch_trigger_cpumask_backtrace+0x28/0x40 rcu_dump_cpu_stacks+0xec/0x14c rcu_check_callbacks+0x908/0xb10 update_process_times+0x48/0x90 tick_sched_handle.isra.5+0x4c/0x80 tick_sched_timer+0x60/0xe0 __hrtimer_run_queues+0xf8/0x360 hrtimer_interrupt+0xf8/0x330 __timer_interrupt+0x94/0x270 timer_interrupt+0xa4/0xe0 decrementer_common+0x114/0x120 --- interrupt: 901 at meminfo_proc_show+0x4c/0xd40 [livepatch_meminfo_string] LR = meminfo_proc_show+0x50/0xd40 [livepatch_meminfo_string] meminfo_proc_show+0x44/0xd40 [livepatch_meminfo_string] (unreliable) klp_stub_insn_end+0x4/0x38 proc_reg_read+0x88/0xd0 __vfs_read+0x44/0x1b0 vfs_read+0xbc/0x1b0 SyS_read+0x68/0x110 system_call+0x58/0x6c With GCC6+, every local function symbol has the value of 0x8 and appending the symbol value to destination symbol, mis-calculates the offset. Fix the offset calculation, by subtracting symbol value 0x8 for every destination functions, those are local functions as well. Fixes: 5888f31 ("create-klp-module: support unbundled symbols") Cc: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
|
Sorry for breaking this. I compiled on ppc, but I neglected to run it. We're working on some automated regression testing which should catch these types of regressions in the future. At first glance, I think this patch will break x86 for cases like #700, where st_value can be nonzero on x86. I need to look into this a little deeper, as I think I may see a way to simplify create_klp_relasecs_and_syms() a little bit for more commonality between x86 and ppc. I might post a followup pull request. |
|
@kamalesh-babulal One question: looking at create_klp_relasecs_and_syms(), it appears to have some GCC 6 specific code (in two different places, including this patch). Does that mean that GCC 5 and older won't work? |
|
My bad. Yes, it will break #700, you might need some like below for powerpc. Where |
Thanks for working on it. This issue is not seen, with just livepatch module load but only after issuing
It will just work for GCC 5 and lesser versions, but the adjuments are required with GCC 6, where the Consider the $ gcc --version |
|
I think your new patch isn't quite right, as I think it breaks #700 for ppc64le. In #700, the one-function-per-section assumption is broken. There are two I need to think some more about how to get it to work for both GCC5 and GCC 6. |
When creating .kpatch.relocations, there's no reason to convert the relocation destinations to symbols. In fact, it's actively harmful because it makes it harder for create-klp-module to deal with the GCC 6+ 8-byte localentry gap. Fixes dynup#754. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
When creating .kpatch.relocations, there's no reason to convert the relocation destinations to symbols. In fact, it's actively harmful because it makes it harder for create-klp-module to deal with the GCC 6+ 8-byte localentry gap. This also fixes a regression which was introduced in 5888f31, which broke ppc64le relocations. Fixes dynup#754. Fixes: 5888f31 ("create-klp-module: support unbundled symbols") Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
|
Let's continue the discussion in #757. |
When creating .kpatch.relocations, there's no reason to convert the relocation destinations to symbols. In fact, it's actively harmful because it makes it harder for create-klp-module to deal with the GCC 6+ 8-byte localentry gap. This also fixes a regression which was introduced in 5888f31, which broke ppc64le relocations. Fixes dynup#754. Fixes: 5888f31 ("create-klp-module: support unbundled symbols") Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Commit 5888f31 ("create-klp-module: support unbundled symbols")
breaks the livepatch modules build on ppc64le, with stalls after
module load:
INFO: rcu_sched self-detected stall on CPU
5-...: (21002 ticks this GP) idle=7ba/140000000000001/0
softirq=97524/97524 fqs=10499
(t=21003 jiffies g=23955 c=23954 q=2203)
NMI backtrace for cpu 5
CPU: 5 PID: 22188 Comm: cat Tainted: G OE K 4.14.0-rc7+ #3
Call Trace:
dump_stack+0xb0/0xf0 (unreliable)
nmi_cpu_backtrace+0x208/0x210
nmi_trigger_cpumask_backtrace+0x1c0/0x200
arch_trigger_cpumask_backtrace+0x28/0x40
rcu_dump_cpu_stacks+0xec/0x14c
rcu_check_callbacks+0x908/0xb10
update_process_times+0x48/0x90
tick_sched_handle.isra.5+0x4c/0x80
tick_sched_timer+0x60/0xe0
__hrtimer_run_queues+0xf8/0x360
hrtimer_interrupt+0xf8/0x330
__timer_interrupt+0x94/0x270
timer_interrupt+0xa4/0xe0
decrementer_common+0x114/0x120
--- interrupt: 901 at meminfo_proc_show+0x4c/0xd40
[livepatch_meminfo_string]
LR = meminfo_proc_show+0x50/0xd40 [livepatch_meminfo_string]
meminfo_proc_show+0x44/0xd40 [livepatch_meminfo_string] (unreliable)
klp_stub_insn_end+0x4/0x38
proc_reg_read+0x88/0xd0
__vfs_read+0x44/0x1b0
vfs_read+0xbc/0x1b0
SyS_read+0x68/0x110
system_call+0x58/0x6c
With GCC6+, every local function symbol has the value of 0x8 and
appending the symbol value to destination symbol miscalculates
the offset.
Fix the offset calculation, by subtracting symbol value 0x8 for
every destination functions, those are local functions as well.
Fixes: 5888f31 ("create-klp-module: support unbundled symbols")
Cc: Josh Poimboeuf jpoimboe@redhat.com
Signed-off-by: Kamalesh Babulal kamalesh@linux.vnet.ibm.com