[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea4473f7-fb94-4fdc-ad4b-9d9f1f4be5de@citrix.com>
Date: Thu, 3 Apr 2025 20:15:45 +0100
From: Andrew Cooper <andrew.cooper3@...rix.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...nel.org>,
Juergen Gross <jgross@...e.com>
Subject: Re: [PATCH] objtool: Fix SYSCALL instruction handling and
INSN_CONTEXT_SWITCH
On 03/04/2025 8:05 pm, Josh Poimboeuf wrote:
> On Thu, Apr 03, 2025 at 07:57:42PM +0100, Andrew Cooper wrote:
>> On 03/04/2025 7:48 pm, Josh Poimboeuf wrote:
>>> With SYSCALL and SYSENTER, INSN_CONTEXT_SWITCH now has a sane
>>> well-defined return semantic.
>> Do you mean "without" here?
> I was just testing to see if anybody actually read all the way to the
> bottom. Congratulations, you passed the test!
A likely story, methinks...
>
>>> diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
>>> index 33d861c04ebd..628c2c8a0f6a 100644
>>> --- a/tools/objtool/arch/x86/decode.c
>>> +++ b/tools/objtool/arch/x86/decode.c
>>> @@ -535,10 +535,9 @@ int arch_decode_instruction(struct objtool_file *file, const struct section *sec
>>>
>>> insn->type = INSN_JUMP_CONDITIONAL;
>>>
>>> - } else if (op2 == 0x05 || op2 == 0x07 || op2 == 0x34 ||
>>> - op2 == 0x35) {
>>> + } else if (op2 == 0x07) {
>>>
>>> - /* sysenter, sysret */
>>> + /* sysret */
>>> insn->type = INSN_CONTEXT_SWITCH;
>> Linux doesn't use SYSEXIT, but it's conceptually like SYSRET/ERETx so
>> perhaps worth keeping the 0x35 here?
> In theory yes, but objtool will never support x86-32. Note I also
> removed retf and jmpf, I'm thinking it's simpler to just stick to the
> instructions we actually use.
>
Perhaps, but they'll now become INSN_OTHER, won't they?
If they're instructions genuinely expected never to encounter, wouldn't
it be better to make a hard error rather than to add another fallthrough
case?
~Andrew
Powered by blists - more mailing lists