Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()

From: Uros Bizjak
Date: Tue Oct 17 2023 - 17:06:13 EST


On Tue, Oct 17, 2023 at 9:11 PM Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> On Tue, Oct 17, 2023 at 9:00 PM Linus Torvalds
> <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Tue, 17 Oct 2023 at 00:23, Nadav Amit <namit@xxxxxxxxxx> wrote:
> > >
> > > Yes, the FPU issue is the one that caused me to crash before.
> >
> > Uros, can you verify whether that patch of mine resolves the issue you saw?
> >
> > That patch is _technically_ an actual bug-fix, although right now our
> > existing 'current' caching that depends on just CSE'ing the inline asm
> > (and is apparently limited to only doing so within single basic
> > blocks) doesn't actually trigger the bug in our __switch_to() logic in
> > practice.
>
> Unfortunately, it doesn't fix the oops :(
>
> I'm testing your patch, together with the attached patch with the
> current tip tree (that already has all necessary percpu stuff), and
> get exactly the same oops in:

But adding the attached patch on top of both patches boots OK.

Uros.
diff --git a/fs/exec.c b/fs/exec.c
index 6518e33ea813..3e810badf9ab 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1037,7 +1037,8 @@ static int exec_mmap(struct mm_struct *mm)
mmput(old_mm);
return 0;
}
- mmdrop_lazy_tlb(active_mm);
+ if (active_mm)
+ mmdrop_lazy_tlb(active_mm);
return 0;
}