[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG_fn=XmODMP6rocAoCUGsOhDZmxr09PG_1WZewNg+-tcLhoWg@mail.gmail.com>
Date: Thu, 3 Nov 2022 14:37:28 +0100
From: Alexander Potapenko <glider@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org
Subject: Re: [PATCH 5/5] x86/traps: avoid KMSAN bugs originating from handle_bug()
On Thu, Nov 3, 2022 at 12:18 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Wed, Nov 02, 2022 at 12:06:11PM +0100, Alexander Potapenko wrote:
>
> > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> > index 178015a820f08..d3fdec706f1d2 100644
> > --- a/arch/x86/kernel/traps.c
> > +++ b/arch/x86/kernel/traps.c
> > @@ -15,6 +15,7 @@
> > #include <linux/context_tracking.h>
> > #include <linux/interrupt.h>
> > #include <linux/kallsyms.h>
> > +#include <linux/kmsan.h>
> > #include <linux/spinlock.h>
> > #include <linux/kprobes.h>
> > #include <linux/uaccess.h>
> > @@ -301,6 +302,12 @@ static noinstr bool handle_bug(struct pt_regs *regs)
> > {
> > bool handled = false;
> >
> > + /*
> > + * Normally @regs are unpoisoned by irqentry_enter(), but handle_bug()
> > + * is a rare case that uses @regs without passing them to
> > + * irqentry_enter().
> > + */
> > + kmsan_unpoison_entry_regs(regs);
> > if (!is_valid_bugaddr(regs->ip))
> > return handled;
> >
>
> Should we place this kmsan_unpoison_entry_regs() after the
> instrumentation_begin() ?
Agreed, let me send an update.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Powered by blists - more mailing lists