[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2ix+b++kuWBMcpD1HfsGKGWxJBeRuvzvV+gvCUJOhFP_A@mail.gmail.com>
Date: Fri, 27 Oct 2023 12:55:28 -0400
From: Brian Gerst <brgerst@...il.com>
To: Uros Bizjak <ubizjak@...il.com>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v2 07/11] x86/percpu/64: Use relative percpu offsets
On Fri, Oct 27, 2023 at 2:09 AM Uros Bizjak <ubizjak@...il.com> wrote:
>
> On Fri, Oct 27, 2023 at 4:09 AM Brian Gerst <brgerst@...il.com> wrote:
> >
> > On Thu, Oct 26, 2023 at 2:47 PM Uros Bizjak <ubizjak@...il.com> wrote:
> > >
> > > On Thu, Oct 26, 2023 at 6:01 PM Brian Gerst <brgerst@...il.com> wrote:
> > > >
> > > > The percpu section is currently linked at virtual address 0, because
> > > > older compilers hardcoded the stack protector canary value at a fixed
> > > > offset from the start of the GS segment. Now that the canary is a
> > > > normal percpu variable, the percpu section can be linked normally.
> > > > This means that x86-64 will calculate percpu offsets like most other
> > > > architectures, as the delta between the initial percpu address and the
> > > > dynamically allocated memory.
> > >
> > > The comments above MSR_GS_BASE setup should be reviewed or removed. I
> > > don't think they need to be set up to access stack canary, they are
> > > just clearing MSR now.
> >
> > GSBASE is deliberately set to zero offset on SMP for boot because we
> > want any percpu accesses (including stack protector) to use the4
> > initial percpu area until the full percpu memory is allocated. It's
> > possible that more stack protector checks could sneak back into the
> > early boot code, and after the conversion to relative percpu offsets
> > they would work properly again. I just didn't reenable them because
> > they are unnecessary that early.
>
> Thanks for the explanation, perhaps this non-obvious fact should be
> mentioned in the comment .
I will update the comments if I need to send a v3 for some other
reason, otherwise I'll do a followup patch.
Brian Gerst
Powered by blists - more mailing lists