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: <CAFULd4bo15jj76v5y8pZgHmbYwuUMFPRu5iwim0spHF2pGKunA@mail.gmail.com>
Date: Sat, 8 Mar 2025 11:12:58 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: "H. Peter Anvin" <hpa@...or.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: Do not test if AC and ID eflags are changeable
 on x86_64

On Fri, Mar 7, 2025 at 3:46 PM H. Peter Anvin <hpa@...or.com> wrote:
>
> On March 7, 2025 5:45:42 AM PST, Uros Bizjak <ubizjak@...il.com> wrote:
> >On Fri, Mar 7, 2025 at 2:13 PM H. Peter Anvin <hpa@...or.com> wrote:
> >
> >> >> PUSF et al → pushf
> >> >>
> >> >> The -l and -q suffixes have been optional for a long time.
> >> >
> >> >No, not in this case. Please see the comment:
> >> >
> >> >/*
> >> >* For building the 16-bit code we want to explicitly specify 32-bit
> >> >* push/pop operations, rather than just saying 'pushf' or 'popf' and
> >> >* letting the compiler choose.
> >> >*/
> >> >
> >> >We are building 16-bit code here, and we want PUSHFL, the one with
> >> >operand size prefix 0x66.
> >> >
> >> >Please consider the following code:
> >> >
> >> >    .code16
> >> >    pushf
> >> >    pushfl
> >> >
> >> >as -o push.o push.s
> >> >
> >> >objdump -dr -Mdata16 push.o
> >> >
> >> >0000000000000000 <.text>:
> >> >  0:   9c                      pushf
> >> >  1:   66 9c                   pushfl
> >> >
> >> >Uros.
> >> >
> >>
> >> *plonk* I should have remembered (.code16gcc is different then .code16 though.) I wrote the damned things after all...
> >
> >Please note that while "gcc -m16" emits .code16gcc, "clang -m16" emits
> >.code16, so in the latter case we don't have ‘pushf’, and ‘popf’
> >instructions default to 32-bit size. So, the only solution is to
> >decorate pushfl with operand size prefix in this specific case.
> >
> >Uros.
> >
>
> Can you please beat up the clang people who do gratuitously incompatible things like this?

:)

BTW: This patch is actually the implementation you requested at some
previous discussion [1], but I took the approach similar to the
definition of have_cpuid_p() in cpuid.h [2].

[1] https://lore.kernel.org/lkml/0A743606-067F-450C-85A5-55ECE4378E22@zytor.com/#t
[2] https://elixir.bootlin.com/linux/v6.14-rc5/source/arch/x86/include/asm/cpuid.h#L32

Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ