public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* x86: Fixup some nits in longjmp asm implementation
@ 2024-01-04 22:16 Noah Goldstein
  2024-01-04 22:22 ` H.J. Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Noah Goldstein @ 2024-01-04 22:16 UTC (permalink / raw)
  To: libc-alpha; +Cc: goldstein.w.n, hjl.tools, carlos

1) Replace `jne` with `jb`. This is generally safer incase either
   r10/rcx are misaligned.

2) Replace a stray `nop` with a `.p2align` directive.
---
 sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S | 2 +-
 sysdeps/x86_64/__longjmp.S                       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
index 9aa24620b9..083ffb33f2 100644
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
@@ -57,7 +57,7 @@ longjmp_msg:
 	cfi_def_cfa_offset(16);						\
 	LOAD_MSG;							\
 	call	HIDDEN_JUMPTARGET(__fortify_fail);			\
-	nop;								\
+	.p2align 3, 5;								\
 	cfi_restore_state;						\
 .Lok2:									\
 	movq	%r10, %rdi;						\
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index 22fedc4997..d38ace7512 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -89,7 +89,7 @@ L(find_restore_token_loop):
 	subq $8, %rcx
 	/* Stop if the current ssp is found.  */
 	cmpq %rcx, %r10
-	jne L(find_restore_token_loop)
+	jb L(find_restore_token_loop)
 	jmp L(no_shadow_stack_token)
 
 L(restore_shadow_stack):
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-01-05 22:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 22:16 x86: Fixup some nits in longjmp asm implementation Noah Goldstein
2024-01-04 22:22 ` H.J. Lu
2024-01-04 22:40   ` Andreas Schwab
2024-01-04 23:07     ` Noah Goldstein
2024-01-04 23:42     ` H.J. Lu
2024-01-05 11:18       ` Andreas Schwab
2024-01-05 15:22         ` H.J. Lu
2024-01-05 16:42           ` Andreas Schwab
2024-01-04 23:25 ` Noah Goldstein
2024-01-05 16:33   ` H.J. Lu
2024-01-05 19:12 ` Noah Goldstein
2024-01-05 20:09   ` H.J. Lu
2024-01-05 22:00 ` Noah Goldstein
2024-01-05 22:29   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).