lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176891088183.510.8607818928752445249.tip-bot2@tip-bot2>
Date: Tue, 20 Jan 2026 12:08:01 -0000
From: "tip-bot2 for Uros Bizjak" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>, "Borislav Petkov (AMD)" <bp@...en8.de>,
 "H. Peter Anvin (Intel)" <hpa@...or.com>,
 Michael Kelley <mhklinux@...look.com>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject:
 [tip: x86/cleanups] x86/segment: Use MOVL when reading segment registers

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     53ed3d91a141f5c8b3bce45b0004fbbfefe77956
Gitweb:        https://git.kernel.org/tip/53ed3d91a141f5c8b3bce45b0004fbbfefe77956
Author:        Uros Bizjak <ubizjak@...il.com>
AuthorDate:    Mon, 05 Jan 2026 10:02:32 +01:00
Committer:     Borislav Petkov (AMD) <bp@...en8.de>
CommitterDate: Tue, 20 Jan 2026 12:34:58 +01:00

x86/segment: Use MOVL when reading segment registers

Use MOVL when reading segment registers to avoid 0x66 operand-size override
insn prefix. The segment value is always 16-bit and gets zero-extended to the
full 32-bit size.

Example:

  4e4:       66 8c c0                mov    %es,%ax
  4e7:       66 89 83 80 0b 00 00    mov    %ax,0xb80(%rbx)

  4e4:       8c c0                   mov    %es,%eax
  4e6:       66 89 83 80 0b 00 00    mov    %ax,0xb80(%rbx)

Also, use the %k0 modifier which generates the SImode (signed integer)
register name for the target register.

  [ bp: Extend and clarify commit message. ]

Signed-off-by: Uros Bizjak <ubizjak@...il.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Reviewed-by: H. Peter Anvin (Intel) <hpa@...or.com>
Tested-by: Michael Kelley <mhklinux@...look.com>
Link: https://patch.msgid.link/20260105090422.6243-1-ubizjak@gmail.com
---
 arch/x86/include/asm/segment.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index f59ae71..9f5be2b 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -348,7 +348,7 @@ static inline void __loadsegment_fs(unsigned short value)
  * Save a segment register away:
  */
 #define savesegment(seg, value)				\
-	asm("mov %%" #seg ",%0":"=r" (value) : : "memory")
+	asm("movl %%" #seg ",%k0" : "=r" (value) : : "memory")
 
 #endif /* !__ASSEMBLER__ */
 #endif /* __KERNEL__ */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ