[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jJ2K3SziXQsy-w5VOu9-V3H79w0OFQQFFnZiezUyc53Vg@mail.gmail.com>
Date: Fri, 9 Feb 2018 14:01:32 -0800
From: Kees Cook <keescook@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
"# 3.4.x" <stable@...r.kernel.org>, Borislav Petkov <bp@...e.de>,
Thomas Gleixner <tglx@...utronix.de>,
Rik van Riel <riel@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
David Woodhouse <dwmw2@...radead.org>,
Jiri Kosina <jikos@...nel.org>,
Andy Lutomirski <luto@...capital.net>,
Dave Hansen <dave.hansen@...el.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Paul Turner <pjt@...gle.com>,
David Woodhouse <dwmw@...zon.co.uk>,
Greg Kroah-Hartmann <gregkh@...ux-foundation.org>
Subject: Re: [PATCH 4.9 46/92] x86/alternative: Print unadorned pointers
On Fri, Feb 9, 2018 at 5:39 AM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
> 4.9-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Borislav Petkov <bp@...e.de>
>
> (cherry picked from commit 0e6c16c652cadaffd25a6bb326ec10da5bcec6b4)
>
> After commit ad67b74d2469 ("printk: hash addresses printed with %p")
> pointers are being hashed when printed. However, this makes the alternative
> debug output completely useless. Switch to %px in order to see the
> unadorned kernel pointers.
This missed a "Fixes:" tag so probably missed automated checking on
how far back to port this. It shouldn't go back beyond 4.15 (where
ad67b74d2469 first appeared).
-Kees
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Cc: riel@...hat.com
> Cc: ak@...ux.intel.com
> Cc: peterz@...radead.org
> Cc: David Woodhouse <dwmw2@...radead.org>
> Cc: jikos@...nel.org
> Cc: luto@...capital.net
> Cc: dave.hansen@...el.com
> Cc: torvalds@...ux-foundation.org
> Cc: keescook@...gle.com
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
> Cc: tim.c.chen@...ux.intel.com
> Cc: gregkh@...ux-foundation.org
> Cc: pjt@...gle.com
> Link: https://lkml.kernel.org/r/20180126121139.31959-2-bp@alien8.de
> Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> arch/x86/kernel/alternative.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> --- a/arch/x86/kernel/alternative.c
> +++ b/arch/x86/kernel/alternative.c
> @@ -298,7 +298,7 @@ recompute_jump(struct alt_instr *a, u8 *
> tgt_rip = next_rip + o_dspl;
> n_dspl = tgt_rip - orig_insn;
>
> - DPRINTK("target RIP: %p, new_displ: 0x%x", tgt_rip, n_dspl);
> + DPRINTK("target RIP: %px, new_displ: 0x%x", tgt_rip, n_dspl);
>
> if (tgt_rip - orig_insn >= 0) {
> if (n_dspl - 2 <= 127)
> @@ -352,7 +352,7 @@ static void __init_or_module optimize_no
> sync_core();
> local_irq_restore(flags);
>
> - DUMP_BYTES(instr, a->instrlen, "%p: [%d:%d) optimized NOPs: ",
> + DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ",
> instr, a->instrlen - a->padlen, a->padlen);
> }
>
> @@ -370,7 +370,7 @@ void __init_or_module apply_alternatives
> u8 *instr, *replacement;
> u8 insnbuf[MAX_PATCH_LEN];
>
> - DPRINTK("alt table %p -> %p", start, end);
> + DPRINTK("alt table %px, -> %px", start, end);
> /*
> * The scan order should be from start to end. A later scanned
> * alternative code can overwrite previously scanned alternative code.
> @@ -394,14 +394,14 @@ void __init_or_module apply_alternatives
> continue;
> }
>
> - DPRINTK("feat: %d*32+%d, old: (%p, len: %d), repl: (%p, len: %d), pad: %d",
> + DPRINTK("feat: %d*32+%d, old: (%px len: %d), repl: (%px, len: %d), pad: %d",
> a->cpuid >> 5,
> a->cpuid & 0x1f,
> instr, a->instrlen,
> replacement, a->replacementlen, a->padlen);
>
> - DUMP_BYTES(instr, a->instrlen, "%p: old_insn: ", instr);
> - DUMP_BYTES(replacement, a->replacementlen, "%p: rpl_insn: ", replacement);
> + DUMP_BYTES(instr, a->instrlen, "%px: old_insn: ", instr);
> + DUMP_BYTES(replacement, a->replacementlen, "%px: rpl_insn: ", replacement);
>
> memcpy(insnbuf, replacement, a->replacementlen);
> insnbuf_sz = a->replacementlen;
> @@ -422,7 +422,7 @@ void __init_or_module apply_alternatives
> a->instrlen - a->replacementlen);
> insnbuf_sz += a->instrlen - a->replacementlen;
> }
> - DUMP_BYTES(insnbuf, insnbuf_sz, "%p: final_insn: ", instr);
> + DUMP_BYTES(insnbuf, insnbuf_sz, "%px: final_insn: ", instr);
>
> text_poke_early(instr, insnbuf, insnbuf_sz);
> }
>
>
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists