From: Peter Zijlstra <peterz@infradead.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org, hpa@zystor.com,
samitolvanen@google.com, kees@kernel.org, nathan@kernel.org,
scott.d.constable@intel.com
Subject: Re: [PATCH] x86/kcfi: Optimize call sequence
Date: Wed, 17 Jun 2026 14:47:22 +0200 [thread overview]
Message-ID: <20260617124722.GN49951@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260617133637.676366e6@pumpkin>
On Wed, Jun 17, 2026 at 01:36:37PM +0100, David Laight wrote:
> I did have a local change that generated different nop*3 so I could tell
> what was lfence, stac, clac (etc).
> Trying to check the compiler output was hard when there were blocks of
> 6 nop.
You should use objtool more ;-)
$ defconfig-build/tools/objtool/objtool --disas=rseq_update_user_cs --wide defconfig-build/kernel/rseq.o
rseq_update_user_cs:
f00: rseq_update_user_cs+0x0 mov %rdi,%rax
f03: rseq_update_user_cs+0x3 mov 0x80(%rsi),%rdi
f0a: rseq_update_user_cs+0xa mov %gs:0x0(%rip),%rcx # 0xf12 <current_task>
f12: rseq_update_user_cs+0x12 testq $0x8000000,(%rcx)
f19: rseq_update_user_cs+0x19 jne 0xf27 <rseq_update_user_cs+0x27>
f1b: rseq_update_user_cs+0x1b | <alternative.f1b> | X86_FEATURE_LA57
f1b: rseq_update_user_cs+0x1b | movabs $0x7ffffffff000,%r10 | movabs $0xfffffffffff000,%r10
f25: rseq_update_user_cs+0x25 jmp 0xf3f <rseq_update_user_cs+0x3f>
f27: rseq_update_user_cs+0x27 mov $0xc0000000,%r8d
f2d: rseq_update_user_cs+0x2d lea 0x3fffe000(%r8),%r10
f34: rseq_update_user_cs+0x34 testb $0x8,0x5ab(%rcx)
f3b: rseq_update_user_cs+0x3b cmovne %r8,%r10
f3f: rseq_update_user_cs+0x3f cmp %r10,%rdx
f42: rseq_update_user_cs+0x42 jae 0xfda <rseq_update_user_cs+0xda>
f48: rseq_update_user_cs+0x48 | <jump_table.f48> | JUMP
f48: rseq_update_user_cs+0x48 | jmp 0xfe9 <rseq_update_user_cs+0xe9> | nop5
f4d: rseq_update_user_cs+0x4d movabs $0x123456789abcdef,%rcx
f57: rseq_update_user_cs+0x57 cmp %rcx,%rdx
f5a: rseq_update_user_cs+0x5a cmova %rcx,%rdx
f5e: rseq_update_user_cs+0x5e | <alternative.f5e> | X86_FEATURE_SMAP
f5e: rseq_update_user_cs+0x5e | nop*3 | stac
f61: rseq_update_user_cs+0x61 | <ex_table.f61> | EXCEPTION
f61: rseq_update_user_cs+0x61 | mov 0x8(%rdx),%r9 | resume at 0xff1 <rseq_update_user_cs+0xf1>
f65: rseq_update_user_cs+0x65 | <ex_table.f65> | EXCEPTION
f65: rseq_update_user_cs+0x65 | mov 0x10(%rdx),%r8 | resume at 0xff3 <rseq_update_user_cs+0xf3>
f69: rseq_update_user_cs+0x69 add $0x18,%rdx
f6d: rseq_update_user_cs+0x6d | <ex_table.f6d> | EXCEPTION
f6d: rseq_update_user_cs+0x6d | mov (%rdx),%rcx | resume at 0xff5 <rseq_update_user_cs+0xf5>
f70: rseq_update_user_cs+0x70 mov %rdi,%rdx
f73: rseq_update_user_cs+0x73 sub %r9,%rdx
f76: rseq_update_user_cs+0x76 cmp %r8,%rdx
f79: rseq_update_user_cs+0x79 jae 0xfbd <rseq_update_user_cs+0xbd>
f7b: rseq_update_user_cs+0x7b cmp %r10,%rcx
f7e: rseq_update_user_cs+0x7e jae 0xfd7 <rseq_update_user_cs+0xd7>
f80: rseq_update_user_cs+0x80 cmp $0x4,%rcx
f84: rseq_update_user_cs+0x84 jb 0xfd7 <rseq_update_user_cs+0xd7>
f86: rseq_update_user_cs+0x86 | <ex_table.f86> | EXCEPTION
f86: rseq_update_user_cs+0x86 | mov -0x4(%rcx),%edx | resume at 0xff7 <rseq_update_user_cs+0xf7>
f89: rseq_update_user_cs+0x89 cmp %edx,0xa9c(%rax)
f8f: rseq_update_user_cs+0x8f jne 0xfd7 <rseq_update_user_cs+0xd7>
f91: rseq_update_user_cs+0x91 mov 0xa90(%rax),%rax
f98: rseq_update_user_cs+0x98 | <ex_table.f98> | EXCEPTION
f98: rseq_update_user_cs+0x98 | movq $0x0,0x8(%rax) | resume at 0xff7 <rseq_update_user_cs+0xf7>
fa0: rseq_update_user_cs+0xa0 mov %rcx,0x80(%rsi)
fa7: rseq_update_user_cs+0xa7 | <alternative.fa7> | X86_FEATURE_SMAP
fa7: rseq_update_user_cs+0xa7 | nop*3 | clac
faa: rseq_update_user_cs+0xaa mov %r9,%rsi
fad: rseq_update_user_cs+0xad mov %r8,%rdx
fb0: rseq_update_user_cs+0xb0 call 0x150 <rseq_trace_ip_fixup>
fb5: rseq_update_user_cs+0xb5 mov $0x1,%al
fb7: rseq_update_user_cs+0xb7 cs jmp 0xfbd <__x86_return_thunk>
fbd: rseq_update_user_cs+0xbd mov 0xa90(%rax),%rax
fc4: rseq_update_user_cs+0xc4 | <ex_table.fc4> | EXCEPTION
fc4: rseq_update_user_cs+0xc4 | movq $0x0,0x8(%rax) | resume at 0xff7 <rseq_update_user_cs+0xf7>
fcc: rseq_update_user_cs+0xcc | <alternative.fcc> | X86_FEATURE_SMAP
fcc: rseq_update_user_cs+0xcc | nop*3 | clac
fcf: rseq_update_user_cs+0xcf mov $0x1,%al
fd1: rseq_update_user_cs+0xd1 cs jmp 0xfd7 <__x86_return_thunk>
fd7: rseq_update_user_cs+0xd7 | <alternative.fd7> | X86_FEATURE_SMAP
fd7: rseq_update_user_cs+0xd7 | nop*3 | clac
fda: rseq_update_user_cs+0xda movb $0x1,0xaa6(%rax)
fe1: rseq_update_user_cs+0xe1 xor %eax,%eax
fe3: rseq_update_user_cs+0xe3 cs jmp 0xfe9 <__x86_return_thunk>
fe9: rseq_update_user_cs+0xe9 mov %rax,%rdi
fec: rseq_update_user_cs+0xec jmp 0xff1 <rseq_debug_update_user_cs>
ff1: rseq_update_user_cs+0xf1 jmp 0xff7 <rseq_update_user_cs+0xf7>
ff3: rseq_update_user_cs+0xf3 jmp 0xff7 <rseq_update_user_cs+0xf7>
ff5: rseq_update_user_cs+0xf5 jmp 0xff7 <rseq_update_user_cs+0xf7>
ff7: rseq_update_user_cs+0xf7 | <alternative.ff7> | X86_FEATURE_SMAP
ff7: rseq_update_user_cs+0xf7 | nop*3 | clac
ffa: rseq_update_user_cs+0xfa xor %eax,%eax
ffc: rseq_update_user_cs+0xfc cs jmp 0x1002 <__x86_return_thunk>
prev parent reply other threads:[~2026-06-17 12:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 7:15 [PATCH] x86/kcfi: Optimize call sequence Peter Zijlstra
2026-06-16 18:55 ` Borislav Petkov
2026-06-16 20:47 ` David Laight
2026-06-17 7:08 ` Peter Zijlstra
2026-06-17 9:26 ` David Laight
2026-06-17 11:12 ` Peter Zijlstra
2026-06-17 12:36 ` David Laight
2026-06-17 12:47 ` Peter Zijlstra [this message]
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=20260617124722.GN49951@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=david.laight.linux@gmail.com \
--cc=hpa@zystor.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=samitolvanen@google.com \
--cc=scott.d.constable@intel.com \
--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.