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]
Date:   Sun, 12 May 2019 20:55:54 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     linux-kernel@...r.kernel.org, x86@...nel.org,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Borislav Petkov <bp@...en8.de>,
        Andy Lutomirski <luto@...nel.org>
Subject: Re: FYI -ffreestanding shrinks kernel by 2% on x86_64

On Sun, May 12, 2019 at 11:32:28AM +0200, Ingo Molnar wrote:
> 
> * Alexey Dobriyan <adobriyan@...il.com> wrote:
> 
> > On Sat, May 11, 2019 at 11:02:24PM +0300, Alexey Dobriyan wrote:
> > > I compiled current F29 kernel config on x86_64 (5.0.13-200.fc29.x86_64)
> > > with -ffreestanding. The results are interesting :^):
> > > 
> > > 	add/remove: 30/22 grow/shrink: 1290/46867 up/down: 33658/-1778055 (-1744397)
> > > 	Total: Before=83298859, After=81554462, chg -2.09% (!)
> > > 
> > > That's original config with modules compiled built-in.
> > 
> > Argh, it's the other way: adding -ffreestanding shrinks kernel by 2%.
> 
> This is a very interesting finding, as we've seen numerous code 
> generation artifacts from GCC assuming libgcc things.
> 
> Has anyone investigated by any chance where the -ffreestanding space 
> savings come from mostly - is it mostly in cold paths, or does it make or 
> hot codepaths more efficient as well?
> 
> If it's the latter then the kernel would be directly faster as well 
> (fewer instructions executed), not just indirectly from better cache 
> packing, I suppse?

Turns out -ffreestanding completely disables stack protector :-\

F29				83298859
-ffreestanding			-1744397	-2.09%
STACKPROTECTOR_STRONG=n		-1369949	-1.64%

Builtin function are in noise, e.g -fno-builtin-sprintf is only -14KB.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ