Re: stop messing with set_fs in arm_sdei

From: Christoph Hellwig
Date: Mon Apr 20 2020 - 06:23:03 EST


On Tue, Apr 14, 2020 at 04:59:16PM +0100, James Morse wrote:
> Hi Christoph,
>
> On 14/04/2020 15:23, Christoph Hellwig wrote:
> > can you take a look at this series? I've been trying to figure out
> > what the set_fs in arm_sdei is good for, and could not find any
> > good reason. But I don't have any hardware implementing this interface,
> > so the changes are entirely untested.
>
> Its a firmware thing, think of it as a firmware assisted software NMI.
>
> The arch code save/restores set_fs() because the entry code does that when taking an
> exception from EL1. SDEI does the same because it doesn't come via the same entry code. It
> does it in C because that C is always run before the handler, something that isn't true
> for the regular assembly version.
>
> The regular entry code does this because any exception may have interrupted code that had
> addr_limit set to something else:
> https://bugs.chromium.org/p/project-zero/issues/detail?id=822
>
> and the patch that fixed it: commit e19a6ee2460b "arm64: kernel: Save and restore UAO and
> addr_limit on exception entry"

Can you throw in a comment documenting this better? And pick up the
first patch while we're at it - no need to expose such low-level
mechanisms to modules.