From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81607239E7E for ; Wed, 17 Jun 2026 12:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781700450; cv=none; b=pAg5n/gUBxx4XJB0A2lTjGhkQVtzIwnfAUVi8pYYtRMifeMXou3qpvu5LlTGG+VZYCeC1g3f9EraDNpkvKC2gWTXIpBrjPLoesEJg9bBQsFjCgK3UkkhF+EMk0nesSMVM7N8Wdtra6JRTwvK+xH4uzp4l9Ak4EfFS12EivC/JBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781700450; c=relaxed/simple; bh=x6cjQgcBr1HgwChn9Ls9BkTXNB+evG/294Ch0CUlZLw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KGOgAg7iVQM8EKepZeqh7DtxigJLFX1HYMEpUZYjHKNgCMNGAAOPIOQ6mhDir7ZPWp3wHotBNeDNMo1/haSGNQSeDW/tLpjRdOHu5/5lioFamAxm9enuoI6DWYIjmFNFCvEthb85ImLdu3B3k4hrKNC/t/UBqakN5bfkFiPTpyo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=jU9VzJ6i; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jU9VzJ6i" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uO3hIjZMOIyEOw/r4bkaQqMjz5GN+go6TjpXR+76rKY=; b=jU9VzJ6iqrzfe32Q/W2zLz5WB/ splb20e8Fg9991c/n9SFeGlxZHccHTLa4MI44lj6zsJxeZJO6KLGf9bSIlwPmgvzybMaaBWIR8C9g n5j9Uw4guuM80+XAZ/4HD7RWJR2Uiy3dGhbVK+u3YYD1hA0UhJDkngbCGWTjRP7ACUk4+h0I9DRXK KUGOYIlfCsPlAxWXDFSO4eJzGHhR4T5vRFMB2dID22lUk91G08e8x0RY4RJfIc55sxaNgITsiAsD1 tArbT+BXvpnOnI7VKyeKcwfOHxshEjO8kvO0jprqs6qRAqX4wq/6u3K+SMfeS+E2sQp7OPiXYN0At tJ4c3inw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wZpfv-0000000CdkB-1ra7; Wed, 17 Jun 2026 12:47:23 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id DC8EC30036F; Wed, 17 Jun 2026 14:47:22 +0200 (CEST) Date: Wed, 17 Jun 2026 14:47:22 +0200 From: Peter Zijlstra To: David Laight 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 Message-ID: <20260617124722.GN49951@noisy.programming.kicks-ass.net> References: <20260612071506.GQ187714@noisy.programming.kicks-ass.net> <20260616214722.7742e394@pumpkin> <20260617070813.GI49951@noisy.programming.kicks-ass.net> <20260617102643.5b343e64@pumpkin> <20260617111207.GJ49951@noisy.programming.kicks-ass.net> <20260617133637.676366e6@pumpkin> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 f12: rseq_update_user_cs+0x12 testq $0x8000000,(%rcx) f19: rseq_update_user_cs+0x19 jne 0xf27 f1b: rseq_update_user_cs+0x1b | | X86_FEATURE_LA57 f1b: rseq_update_user_cs+0x1b | movabs $0x7ffffffff000,%r10 | movabs $0xfffffffffff000,%r10 f25: rseq_update_user_cs+0x25 jmp 0xf3f 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 f48: rseq_update_user_cs+0x48 | | JUMP f48: rseq_update_user_cs+0x48 | jmp 0xfe9 | 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 | | X86_FEATURE_SMAP f5e: rseq_update_user_cs+0x5e | nop*3 | stac f61: rseq_update_user_cs+0x61 | | EXCEPTION f61: rseq_update_user_cs+0x61 | mov 0x8(%rdx),%r9 | resume at 0xff1 f65: rseq_update_user_cs+0x65 | | EXCEPTION f65: rseq_update_user_cs+0x65 | mov 0x10(%rdx),%r8 | resume at 0xff3 f69: rseq_update_user_cs+0x69 add $0x18,%rdx f6d: rseq_update_user_cs+0x6d | | EXCEPTION f6d: rseq_update_user_cs+0x6d | mov (%rdx),%rcx | resume at 0xff5 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 f7b: rseq_update_user_cs+0x7b cmp %r10,%rcx f7e: rseq_update_user_cs+0x7e jae 0xfd7 f80: rseq_update_user_cs+0x80 cmp $0x4,%rcx f84: rseq_update_user_cs+0x84 jb 0xfd7 f86: rseq_update_user_cs+0x86 | | EXCEPTION f86: rseq_update_user_cs+0x86 | mov -0x4(%rcx),%edx | resume at 0xff7 f89: rseq_update_user_cs+0x89 cmp %edx,0xa9c(%rax) f8f: rseq_update_user_cs+0x8f jne 0xfd7 f91: rseq_update_user_cs+0x91 mov 0xa90(%rax),%rax f98: rseq_update_user_cs+0x98 | | EXCEPTION f98: rseq_update_user_cs+0x98 | movq $0x0,0x8(%rax) | resume at 0xff7 fa0: rseq_update_user_cs+0xa0 mov %rcx,0x80(%rsi) fa7: rseq_update_user_cs+0xa7 | | 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 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 | | EXCEPTION fc4: rseq_update_user_cs+0xc4 | movq $0x0,0x8(%rax) | resume at 0xff7 fcc: rseq_update_user_cs+0xcc | | 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 | | 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 ff1: rseq_update_user_cs+0xf1 jmp 0xff7 ff3: rseq_update_user_cs+0xf3 jmp 0xff7 ff5: rseq_update_user_cs+0xf5 jmp 0xff7 ff7: rseq_update_user_cs+0xf7 | | 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>