Re: [PATCH 2/9] ARM: traps: use get_kernel_nofault instead of set_fs()

From: Arnd Bergmann
Date: Fri Sep 18 2020 - 08:36:43 EST


On Fri, Sep 18, 2020 at 9:42 AM Russell King - ARM Linux admin
<linux@xxxxxxxxxxxxxxx> wrote:
>
> On Thu, Sep 17, 2020 at 07:29:37PM +0200, Arnd Bergmann wrote:
> > On Tue, Sep 8, 2020 at 8:15 AM Christoph Hellwig <hch@xxxxxx> wrote:
> >
> > I looked through the history now and the only code path I could
> > find that would arrive here this way is from bad_mode(), indicating
> > that there is probably a hardware bug or the contents of *regs are
> > corrupted.
>
> Yes, that's correct. It isn't something entirely theoretical, although
> we never see it now, it used to happen in the distant past due to saved
> regs corruption. If bad_mode() ever gets called, all bets are off and
> we're irrecoverably crashing.
>
> Note that in that case, while user_mode(regs) may return true or false,
> regs->ARM_sp and regs->ARM_lr are always the SVC mode stack and return
> address after regs has been stacked, and not the expected values for
> the parent context (which we have most likely long since destroyed.)

Ok, I have rewritten the patch and my changelog text accordingly, sending
an updated version now.

Thanks,

Arnd