[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1809061524170.1570@nanos.tec.linutronix.de>
Date: Thu, 6 Sep 2018 15:32:00 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Andy Lutomirski <luto@...nel.org>
cc: x86@...nel.org, Borislav Petkov <bp@...en8.de>,
LKML <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] x86/fault: Decode page fault OOPSes better
On Fri, 31 Aug 2018, Andy Lutomirski wrote:
> @@ -671,6 +705,48 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
> address < PAGE_SIZE ? "NULL pointer dereference" : "paging request",
> (void *)address);
>
> + errcode[0] = 0;
error_code vs. errcode ? errtxt perhaps?
> +#define ERRSTR(x) if (error_code & X86_PF_##x) strcat(errcode, " " #x)
> + ERRSTR(PROT);
> + ERRSTR(WRITE);
> + ERRSTR(USER);
> + ERRSTR(RSVD);
> + ERRSTR(INSTR);
> + ERRSTR(PK);
> +#undef ERRSTR
Eeew. That's too ugly to live.
static inline errstr(unsigned long ec, char *buf, unsigned long mask,
const char *txt)
{
....
}
and then
errstr(error_code, errtxt, X86_PF_PROT, "PROT");
Yes, it's slightly more to type but this macro mess in the middle of the
code just makes my eyes bleed.
Thanks,
tglx
Powered by blists - more mailing lists