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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa7f3c1b-7693-465c-9f24-e6176074a818@intel.com>
Date: Thu, 25 Apr 2024 11:21:57 +0200
From: Alexander Lobakin <aleksander.lobakin@...el.com>
To: "liuyuntao (F)" <liuyuntao12@...wei.com>
CC: <linux-kernel@...r.kernel.org>, <linux-kbuild@...r.kernel.org>,
	<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
	<dave.hansen@...ux.intel.com>, <hpa@...or.com>, <masahiroy@...nel.org>,
	<nathan@...nel.org>, <nicolas@...sle.eu>, <peterz@...radead.org>,
	<jpoimboe@...nel.org>, <leitao@...ian.org>, <petr.pavlu@...e.com>,
	<richard.weiyang@...il.com>, <ruanjinjie@...wei.com>,
	<ndesaulniers@...gle.com>, <jgross@...e.com>
Subject: Re: [PATCH] x86: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION

From: Liuyuntao (F) <liuyuntao12@...wei.com>
Date: Thu, 25 Apr 2024 14:37:19 +0800

> 
> 
> On 2024/4/24 19:06, Alexander Lobakin wrote:
>> From: Yuntao Liu <liuyuntao12@...wei.com>
>> Date: Mon, 22 Apr 2024 06:05:56 +0000
>>
>>> The current x86 architecture does not yet support the
>>> HAVE_LD_DEAD_CODE_DATA_ELIMINATION feature. x86 is widely used in
>>> embedded scenarios, and enabling this feature would be beneficial for
>>> reducing the size of the kernel image.
>>>
>>> In order to make this work, we keep the necessary tables by annotating
>>> them with KEEP, also it requires further changes to linker script to
>>> KEEP
>>> some tables and wildcard compiler generated sections into the right
>>> place.
>>>
>>> Enabling CONFIG_UNWINDER_ORC or CONFIG_MITIGATION_RETPOLINE will enable
>>> the objtool's --orc and --retpoline parameters, which will alter the
>>> layout of the binary file, thereby preventing gc-sections from
>>> functioning
>>> properly. Therefore, HAVE_LD_DEAD_CODE_DATA_ELIMINATION should only be
>>> selected when they are not enabled.
>>
>> Dunno, I have DCE enabled for years on my home kernel, see commit [0]
>> with both ORC and retpolines enabled, and I didn't have any issues.
>> vmlinux still shrinks well, even with Clang LTO.
>>
>>>
>>> Enabling CONFIG_LTO_CLANG or CONFIG_X86_KERNEL_IBT will use vmlinux.o
>>> instead of performing the slow LTO link again. This can also prevent
>>> gc-sections from functioning properly. Therefore, using this
>>> optimization
>>> when CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not enabled.
>>>
>>> The size comparison of zImage is as follows:
>>> x86_def_defconfig  i386_defconfig    tinyconfig
>>> 10892288           10826240          607232          no dce
>>> 10748928           10719744          529408          dce
>>> 1.3%               0.98%             12.8%           shrink
>>>
>>> When using smaller config file, there is a significant reduction in the
>>> size of the zImage.
>>
>> [0] https://github.com/solbjorn/linux/commit/25c4953ea73d
>>
>> Thanks,
>> Olek
> 
> I apply your patch, and use LLVM toolchain to compile the kernel, it not
> boot on QEMU.
> I use the following command.
>> qemu-system-x86_64  -smp 2 -m 1024M -nographic -kernel
>> mainline_linux/arch/x86/boot/bzImage -hda rootfs.img -append
>> "root=/dev/sda console=ttyS0 rootfstype=ext4 init=/linuxrc rw"
> Have you tested your patch on the latest mainline version?

Nope, it was a year ago and I haven't touched it since then. Did the
low-level code change a lot?

> Thanks.
> Yuntao.

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ