[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27ba5785-a15a-416c-93be-c14a1c3dff17@suse.com>
Date: Tue, 14 Nov 2023 15:35:38 +0100
From: Juergen Gross <jgross@...e.com>
To: Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v4 2/5] x86/alternative: add indirect call patching
On 14.11.23 15:18, Peter Zijlstra wrote:
> On Tue, Nov 14, 2023 at 02:47:15PM +0100, Borislav Petkov wrote:
>> On Tue, Nov 14, 2023 at 01:50:28PM +0100, Peter Zijlstra wrote:
>>> This loads the function target from the pv_ops table. We can't otherwise
>>> do this.
>>
>> On Tue, Nov 14, 2023 at 01:56:37PM +0100, Juergen Gross wrote:
>>> It is replacing an _indirect_ call with a _direct_ one, taking the
>>> call target from the pointer used by the indirect call.
>>
>> Then this is not just a ALT_FLAG_CALL. This is something special. The
>> flag definition needs a better name along with an explanation what it
>> does, perhaps best with an example from the final vmlinux - not from the
>> object file:
>>
>> call *0x0(%rip)
>>
>> ==>
>>
>> call *0x0
>>
>> where the offsets haven't been linked in yet.
>
> Well, a random absolute address isn't going to be any better or worse
> than 0. But perhaps adding the relocation as a comment helps?
>
>
> ff 15 00 00 00 00 call *0x0(%rip) # R_X86_64_PC32 pv_ops+0x4
> into:
> e8 00 00 00 00 90 call +0 # R_X86_64_PC32 *(pv_ops+0x04)
>
>
>> If this is going into the generic infrastructure, then it better be
>> explained properly so that other stuff can potentially use it too.
>
> ALT_FLAG_DEREFERENCE_INDIRECT_CALL ?
ALT_FLAG_MAKE_CALL_DIRECT ?
>
> I'm going to already raise my hand and say that's too long ;-)
I think the length of the name doesn't matter that much, as it is used only
in the patching code and via the ALT_CALL() macro (at least as long as Boris
doesn't ask me to change the macro name, too).
Juergen
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3099 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists