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: <3E2205B3-C2D9-4D4C-9847-1CF0BFF68D72@zytor.com>
Date: Wed, 17 Jul 2024 23:58:52 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Uros Bizjak <ubizjak@...il.com>
CC: x86@...nel.org, linux-kernel@...r.kernel.org,
        Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...nel.org>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [PATCH] x86/boot: Use __ASM_SIZE() to reduce ifdeffery in cpuflags.c

On July 17, 2024 11:46:57 PM PDT, Uros Bizjak <ubizjak@...il.com> wrote:
>On Thu, Jul 18, 2024 at 8:36 AM H. Peter Anvin <hpa@...or.com> wrote:
>>
>> On July 17, 2024 11:32:18 PM PDT, Uros Bizjak <ubizjak@...il.com> wrote:
>> >Use __ASM_SIZE() macro to add correct insn suffix to pushf/popf.
>> >
>> >Signed-off-by: Uros Bizjak <ubizjak@...il.com>
>> >Cc: Thomas Gleixner <tglx@...utronix.de>
>> >Cc: Ingo Molnar <mingo@...nel.org>
>> >Cc: Borislav Petkov <bp@...en8.de>
>> >Cc: Dave Hansen <dave.hansen@...ux.intel.com>
>> >Cc: "H. Peter Anvin" <hpa@...or.com>
>> >---
>> > arch/x86/boot/cpuflags.c | 10 +++-------
>> > 1 file changed, 3 insertions(+), 7 deletions(-)
>> >
>> >diff --git a/arch/x86/boot/cpuflags.c b/arch/x86/boot/cpuflags.c
>> >index d75237ba7ce9..aacabe431fd5 100644
>> >--- a/arch/x86/boot/cpuflags.c
>> >+++ b/arch/x86/boot/cpuflags.c
>> >@@ -2,6 +2,7 @@
>> > #include <linux/types.h>
>> > #include "bitops.h"
>> >
>> >+#include <asm/asm.h>
>> > #include <asm/processor-flags.h>
>> > #include <asm/required-features.h>
>> > #include <asm/msr-index.h>
>> >@@ -36,13 +37,8 @@ static int has_fpu(void)
>> >  * compressed/ directory where it may be 64-bit code, and thus needs
>> >  * to be 'pushfq' or 'popfq' in that case.
>> >  */
>> >-#ifdef __x86_64__
>> >-#define PUSHF "pushfq"
>> >-#define POPF "popfq"
>> >-#else
>> >-#define PUSHF "pushfl"
>> >-#define POPF "popfl"
>> >-#endif
>> >+#define PUSHF __ASM_SIZE(pushf)
>> >+#define POPF __ASM_SIZE(popf)
>> >
>> > int has_eflag(unsigned long mask)
>> > {
>>
>> Just use pushf/popf. gas hasn't needed that suffix for a long time as far as I know.
>
>Yes, this works, too. So I guess we can also remove the comment
>explaining the reason for explicit suffixes?
>
>Thanks,
>Uros.
>

Yeah. You may want to check the version of binutils that fixed it and put that in the comments.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ