From: Noah Goldstein <goldstein.w.n@gmail.com>
To: libc-alpha@sourceware.org
Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com, carlos@systemhalted.org
Subject: x86: Fixup some nits in longjmp asm implementation
Date: Fri, 5 Jan 2024 11:12:40 -0800 [thread overview]
Message-ID: <20240105191240.3646771-1-goldstein.w.n@gmail.com> (raw)
In-Reply-To: <20240104221634.3612621-1-goldstein.w.n@gmail.com>
Replace a stray `nop` with a `.p2align` directive.
---
.../unix/sysv/linux/x86_64/____longjmp_chk.S | 2 +-
sysdeps/x86_64/dl-machine.h | 31 +++++++++----------
2 files changed, 16 insertions(+), 17 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..9d9732afdc 100644
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
@@ -57,8 +57,8 @@ longjmp_msg:
cfi_def_cfa_offset(16); \
LOAD_MSG; \
call HIDDEN_JUMPTARGET(__fortify_fail); \
- nop; \
cfi_restore_state; \
+ .p2align 3, 5; \
.Lok2: \
movq %r10, %rdi; \
cfi_restore (%rdi); \
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index adcc0f7113..7ef6e24eb5 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -618,25 +618,24 @@ x86_64_rewrite_plt (struct link_map *map, ElfW(Addr) plt_rewrite)
if (((uint64_t) disp + (uint64_t) ((uint32_t) INT32_MIN))
<= (uint64_t) UINT32_MAX)
{
- pad = branch_start + JMP32_INSN_SIZE;
+ pad = branch_start + JMP32_INSN_SIZE;
- if (__glibc_unlikely (pad > plt_end))
- continue;
+ if (__glibc_unlikely (pad > plt_end))
+ continue;
- /* If the target branch can be reached with a direct branch,
- rewrite the PLT entry with a direct branch. */
- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS))
- {
- const char *sym_name = x86_64_reloc_symbol_name (map,
- reloc);
- _dl_debug_printf ("changing '%s' PLT entry in '%s' to "
- "direct branch\n", sym_name,
- DSO_FILENAME (map->l_name));
- }
+ /* If the target branch can be reached with a direct branch,
+ rewrite the PLT entry with a direct branch. */
+ if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_BINDINGS))
+ {
+ const char *sym_name = x86_64_reloc_symbol_name (map, reloc);
+ _dl_debug_printf ("changing '%s' PLT entry in '%s' to "
+ "direct branch\n",
+ sym_name, DSO_FILENAME (map->l_name));
+ }
- /* Write out direct branch. */
- *(uint8_t *) branch_start = JMP32_INSN_OPCODE;
- *((uint32_t *) (branch_start + 1)) = disp;
+ /* Write out direct branch. */
+ *(uint8_t *) branch_start = JMP32_INSN_OPCODE;
+ *((uint32_t *) (branch_start + 1)) = disp;
}
else
{
--
2.34.1
next prev parent reply other threads:[~2024-01-05 19:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 22:16 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 [this message]
2024-01-05 20:09 ` H.J. Lu
2024-01-05 22:00 ` Noah Goldstein
2024-01-05 22:29 ` H.J. Lu
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=20240105191240.3646771-1-goldstein.w.n@gmail.com \
--to=goldstein.w.n@gmail.com \
--cc=carlos@systemhalted.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.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 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).