Re: [PATCH RFC 00/43] x86/pie: Make kernel image's virtual address flexible

From: Hou Wenlong
Date: Sat May 06 2023 - 03:19:21 EST


On Fri, Apr 28, 2023 at 11:22:06PM +0800, Peter Zijlstra wrote:
>
> For some raison I didn't get 0/n but did get all of the others. Please
> keep your Cc list consistent.
>
Sorry, I'll pay attention next time.

> On Fri, Apr 28, 2023 at 05:50:40PM +0800, Hou Wenlong wrote:
>
> > - It is not allowed to reference global variables in an alternative
> > section since RIP-relative addressing is not fixed in
> > apply_alternatives(). Fortunately, all disallowed relocations in the
> > alternative section can be captured by objtool. I believe that this
> > issue can also be fixed by using objtool.
>
> https://lkml.kernel.org/r/Y9py2a5Xw0xbB8ou@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Thank you for your patch. However, it's more complicated for call depth
tracking case. Although, the per-cpu variable in the alternative section
is relocated, but the content of the "skl_call_thunk_template" is copied
into another place, so the offset is still incorrect. I'm not sure if
this case is common or not. Since the destination is clear, I could do
relocation here as well, but it would make the code more complicated.

Thanks!