Re: [PATCH v2] x86/dumpstack: don't dump kernel memory based on usermode RIP

From: Borislav Petkov
Date: Wed Aug 29 2018 - 10:02:44 EST


On Wed, Aug 29, 2018 at 03:55:32PM +0200, Jann Horn wrote:
> > > diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> > > index 9c8652974f8e..14b337582b6f 100644
> > > --- a/arch/x86/kernel/dumpstack.c
> > > +++ b/arch/x86/kernel/dumpstack.c
> > > @@ -89,14 +89,21 @@ static void printk_stack_address(unsigned long address, int reliable,
> > > * Thus, the 2/3rds prologue and 64 byte OPCODE_BUFSIZE is just a random
> > > * guesstimate in attempt to achieve all of the above.
> > > */
> > > -void show_opcodes(u8 *rip, const char *loglvl)
> > > +void show_opcodes(struct pt_regs *regs, const char *loglvl)
> > > {
> > > #define PROLOGUE_SIZE 42
> > > #define EPILOGUE_SIZE 21
> > > #define OPCODE_BUFSIZE (PROLOGUE_SIZE + 1 + EPILOGUE_SIZE)
> > > u8 opcodes[OPCODE_BUFSIZE];
> > > + u8 *prologue = (u8 *)(regs->ip - PROLOGUE_SIZE);
> >
> > Just a nitpick:
> >
> > <--- newline here.
>
> The code below this point is still part of the declarations. Do you
> want a newline here anyway? If you say yes, I'll adjust and resend.

Yeah, but I'd like the comment to separate out better. As I said, just a
nitpick.

But no need to resend - I believe tglx is (still) nice enough to fix it
up while applying.

:-)))

Thx.

--
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix ImendÃrffer, Jane Smithard, Graham Norton, HRB 21284 (AG NÃrnberg)
--