All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>, Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH] objtool: Fix SYSCALL instruction handling and INSN_CONTEXT_SWITCH
Date: Thu, 3 Apr 2025 20:15:45 +0100	[thread overview]
Message-ID: <ea4473f7-fb94-4fdc-ad4b-9d9f1f4be5de@citrix.com> (raw)
In-Reply-To: <kykaol3hdxxvpwa7drnlidgeqb5cgkrdpo7bokifihob73hwyx@cu6sfkz3z6ze>

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

  reply	other threads:[~2025-04-03 19:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 18:48 [PATCH] objtool: Fix SYSCALL instruction handling and INSN_CONTEXT_SWITCH Josh Poimboeuf
2025-04-03 18:57 ` Andrew Cooper
2025-04-03 19:05   ` Josh Poimboeuf
2025-04-03 19:15     ` Andrew Cooper [this message]
2025-04-03 19:20       ` Josh Poimboeuf
2025-04-04  7:40 ` Jürgen Groß
2025-04-04 10:49 ` Peter Zijlstra
2025-04-04 14:46   ` Josh Poimboeuf
2025-04-04 14:54     ` Peter Zijlstra
2025-04-04 15:02       ` Josh Poimboeuf
2025-04-04 15:03     ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea4473f7-fb94-4fdc-ad4b-9d9f1f4be5de@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jgross@suse.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.