From bf06aa2452b25bcae0006ee5e5a06702fc656f90 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 12 May 2020 15:27:18 +0200 Subject: [PATCH] 4.9-stable patches added patches: objtool-fix-stack-offset-tracking-for-indirect-cfas.patch scripts-decodecode-fix-trapping-instruction-formatting.patch --- ...ck-offset-tracking-for-indirect-cfas.patch | 50 +++++++++++++++++++ ...-fix-trapping-instruction-formatting.patch | 46 +++++++++++++++++ queue-4.9/series | 2 + 3 files changed, 98 insertions(+) create mode 100644 queue-4.9/objtool-fix-stack-offset-tracking-for-indirect-cfas.patch create mode 100644 queue-4.9/scripts-decodecode-fix-trapping-instruction-formatting.patch diff --git a/queue-4.9/objtool-fix-stack-offset-tracking-for-indirect-cfas.patch b/queue-4.9/objtool-fix-stack-offset-tracking-for-indirect-cfas.patch new file mode 100644 index 00000000000..f8b716d935a --- /dev/null +++ b/queue-4.9/objtool-fix-stack-offset-tracking-for-indirect-cfas.patch @@ -0,0 +1,50 @@ +From d8dd25a461e4eec7190cb9d66616aceacc5110ad Mon Sep 17 00:00:00 2001 +From: Josh Poimboeuf +Date: Sat, 25 Apr 2020 05:03:00 -0500 +Subject: objtool: Fix stack offset tracking for indirect CFAs + +From: Josh Poimboeuf + +commit d8dd25a461e4eec7190cb9d66616aceacc5110ad upstream. + +When the current frame address (CFA) is stored on the stack (i.e., +cfa->base == CFI_SP_INDIRECT), objtool neglects to adjust the stack +offset when there are subsequent pushes or pops. This results in bad +ORC data at the end of the ENTER_IRQ_STACK macro, when it puts the +previous stack pointer on the stack and does a subsequent push. + +This fixes the following unwinder warning: + + WARNING: can't dereference registers at 00000000f0a6bdba for ip interrupt_entry+0x9f/0xa0 + +Fixes: 627fce14809b ("objtool: Add ORC unwind table generation") +Reported-by: Vince Weaver +Reported-by: Dave Jones +Reported-by: Steven Rostedt +Reported-by: Vegard Nossum +Reported-by: Joe Mario +Reviewed-by: Miroslav Benes +Signed-off-by: Josh Poimboeuf +Signed-off-by: Ingo Molnar +Cc: Andy Lutomirski +Cc: Jann Horn +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Link: https://lore.kernel.org/r/853d5d691b29e250333332f09b8e27410b2d9924.1587808742.git.jpoimboe@redhat.com +Signed-off-by: Greg Kroah-Hartman + +--- + tools/objtool/check.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/objtool/check.c ++++ b/tools/objtool/check.c +@@ -1264,7 +1264,7 @@ static int update_insn_state_regs(struct + struct cfi_reg *cfa = &state->cfa; + struct stack_op *op = &insn->stack_op; + +- if (cfa->base != CFI_SP) ++ if (cfa->base != CFI_SP && cfa->base != CFI_SP_INDIRECT) + return 0; + + /* push */ diff --git a/queue-4.9/scripts-decodecode-fix-trapping-instruction-formatting.patch b/queue-4.9/scripts-decodecode-fix-trapping-instruction-formatting.patch new file mode 100644 index 00000000000..86762484969 --- /dev/null +++ b/queue-4.9/scripts-decodecode-fix-trapping-instruction-formatting.patch @@ -0,0 +1,46 @@ +From e08df079b23e2e982df15aa340bfbaf50f297504 Mon Sep 17 00:00:00 2001 +From: Ivan Delalande +Date: Thu, 7 May 2020 18:35:53 -0700 +Subject: scripts/decodecode: fix trapping instruction formatting + +From: Ivan Delalande + +commit e08df079b23e2e982df15aa340bfbaf50f297504 upstream. + +If the trapping instruction contains a ':', for a memory access through +segment registers for example, the sed substitution will insert the '*' +marker in the middle of the instruction instead of the line address: + + 2b: 65 48 0f c7 0f cmpxchg16b %gs:*(%rdi) <-- trapping instruction + +I started to think I had forgotten some quirk of the assembly syntax +before noticing that it was actually coming from the script. Fix it to +add the address marker at the right place for these instructions: + + 28: 49 8b 06 mov (%r14),%rax + 2b:* 65 48 0f c7 0f cmpxchg16b %gs:(%rdi) <-- trapping instruction + 30: 0f 94 c0 sete %al + +Fixes: 18ff44b189e2 ("scripts/decodecode: make faulting insn ptr more robust") +Signed-off-by: Ivan Delalande +Signed-off-by: Andrew Morton +Reviewed-by: Borislav Petkov +Link: http://lkml.kernel.org/r/20200419223653.GA31248@visor +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/decodecode | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/scripts/decodecode ++++ b/scripts/decodecode +@@ -98,7 +98,7 @@ faultlinenum=$(( $(wc -l $T.oo | cut -d + faultline=`cat $T.dis | head -1 | cut -d":" -f2-` + faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` + +-cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/" ++cat $T.oo | sed -e "${faultlinenum}s/^\([^:]*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/" + echo + cat $T.aa + cleanup diff --git a/queue-4.9/series b/queue-4.9/series index 37a9364956f..6d5e517c6f0 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -20,3 +20,5 @@ batman-adv-fix-batadv_nc_random_weight_tq.patch batman-adv-fix-refcnt-leak-in-batadv_show_throughput_override.patch batman-adv-fix-refcnt-leak-in-batadv_store_throughput_override.patch batman-adv-fix-refcnt-leak-in-batadv_v_ogm_process.patch +objtool-fix-stack-offset-tracking-for-indirect-cfas.patch +scripts-decodecode-fix-trapping-instruction-formatting.patch -- 2.47.3