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: <CAFULd4aFUun7+1izxbDM8nTEEta5PApysyTGsn1hjvQND=2UtQ@mail.gmail.com>
Date: Wed, 19 Mar 2025 05:57:55 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>, "H. Peter Anvin" <hpa@...or.com>, 
	linux-kernel@...r.kernel.org, Juergen Gross <jgross@...e.com>, 
	Stefano Stabellini <sstabellini@...nel.org>, "Ahmed S . Darwish" <darwi@...utronix.de>, 
	Andrew Cooper <andrew.cooper3@...rix.com>, John Ogness <john.ogness@...utronix.de>, 
	Peter Zijlstra <peterz@...radead.org>, Borislav Petkov <bp@...en8.de>, 
	Thomas Gleixner <tglx@...utronix.de>, Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH] compiler/gcc: Make asm() templates asm __inline__() by default

On Tue, Mar 18, 2025 at 9:11 PM Ingo Molnar <mingo@...nel.org> wrote:

>  #ifdef CONFIG_CC_HAS_ASM_INLINE
>  # define asm_inline __asm__ __inline
>  # define asm(...) asm_inline(__VA_ARGS__)
>  #else
>  # define asm_inline asm
>  #endif
>
> And I fixed up the places where this isn't syntactically correct:
>
>  35 files changed, 82 insertions(+), 79 deletions(-)
>
> I haven't looked at code generation much yet, but text size changes are
> minimal:
>
>       text         data     bss      dec            hex filename
>   29429076      7931870 1401196 38762142        24f769e vmlinux.before
>   29429631      7931870 1401200 38762701        24f78cd vmlinux.after
>
> Which is promising, assuming I haven't messed up anywhere.

Please use bloat-o-meter, it is more precise.

Actually, functions with the most impact (x86 locking functions and
__arch_hweight) were recently converted to asm_inline, so besides
__untagged_addr, the remaining have very little impact, if at all
(c.f. amd_clear_divider() ). There is also no need to convert asm()
without directives inside.

My proposal would be to convert the remaining few cases (the remaining
asms involving ALTERNATIVE and exceptions) "by hand" to asm_inline()
and stick a rule in checkpatch to use asm_inline() in the code
involving asm(), like we have the rule with asm volatile.

I don't think redefining an important C keyword is a good approach, it
obfuscates its meaning too much. And as has been shown by Ingo's
experiment, there is a substantial effort to fix false positives.
Instead of fixing these, we can trivially convert the remaining cases
to asm_volatile() as well, without obfuscating asm(). Checkpatch can
take care of future cases.

Thanks,
Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ