[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2iCYXuQXXHmg9qevJXDuzvxDF9L=Vw+w2ZAaPk6vZZFDQ@mail.gmail.com>
Date: Thu, 11 Apr 2024 14:15:58 -0400
From: Brian Gerst <brgerst@...il.com>
To: Jason Andryuk <jason.andryuk@....com>
Cc: Juergen Gross <jgross@...e.com>, Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, Stefano Stabellini <sstabellini@...nel.org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>, Paolo Bonzini <pbonzini@...hat.com>,
xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64
On Thu, Apr 11, 2024 at 11:26 AM Jason Andryuk <jason.andryuk@....com> wrote:
>
> On 2024-04-10 17:00, Brian Gerst wrote:
> > On Wed, Apr 10, 2024 at 3:50 PM Jason Andryuk <jason.andryuk@....com> wrote:
>
> >> /* 64-bit entry point. */
> >> .code64
> >> 1:
> >> + UNWIND_HINT_END_OF_STACK
> >> +
> >> /* Set base address in stack canary descriptor. */
> >> mov $MSR_GS_BASE,%ecx
> >> - mov $_pa(canary), %eax
> >> + leal rva(canary)(%ebp), %eax
> >
> > Since this is in 64-bit mode, RIP-relative addressing can be used.
> >
> >> xor %edx, %edx
> >> wrmsr
> >>
> >> call xen_prepare_pvh
> >>
> >> /* startup_64 expects boot_params in %rsi. */
> >> - mov $_pa(pvh_bootparams), %rsi
> >> - mov $_pa(startup_64), %rax
> >> + lea rva(pvh_bootparams)(%ebp), %rsi
> >> + lea rva(startup_64)(%ebp), %rax
> >
> > RIP-relative here too.
>
> Yes, thanks for catching that. With the RIP-relative conversion, there
> is now:
> vmlinux.o: warning: objtool: pvh_start_xen+0x10d: relocation to !ENDBR:
> startup_64+0x0
>
> I guess RIP-relative made it visible. That can be quieted by adding
> ANNOTATE_NOENDBR to startup_64.
Change it to a direct jump, since branches are always RIP-relative.
Brian Gerst
Powered by blists - more mailing lists