Messages in this thread | | | From | Brian Gerst <> | Date | Thu, 26 Oct 2023 22:09:20 -0400 | Subject | Re: [PATCH v2 07/11] x86/percpu/64: Use relative percpu offsets |
| |
On Thu, Oct 26, 2023 at 2:47 PM Uros Bizjak <ubizjak@gmail.com> wrote: > > On Thu, Oct 26, 2023 at 6:01 PM Brian Gerst <brgerst@gmail.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 the 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.
Brian Gerst
| |