Re: [PATCH v2] x86: Avoid relocation information in final vmlinux

From: Borislav Petkov
Date: Fri Nov 25 2022 - 11:41:42 EST


On Thu, Nov 24, 2022 at 04:41:11PM +0100, Borislav Petkov wrote:
> This is in both cases with your patch, once with RANDOMIZE_BASE=y and
> once with RANDOMIZE_BASE=n.
>
> IOW, your patch actually makes my vmlinux bigger by 51K.
>
> IOW, I cannot reproduce your
>
> | Configuration | With relocs | Stripped relocs |
> | x86_64_defconfig | 70 MB | 43 MB |
>
> claim, but not with a defconfig but with my specially tailored config.
>
> I guess the next thing I'll try is without your patch.

Ok, I tried reproducing your defconfig numbers first:

defconfig: vmlinux
- with patch: NEED_RELOCS=y 48053656
- with patch, NEED_RELOCS=n, 48000696
- without patch, NEED_RELOCS=n, 48000696
- without patch: NEED_RELOCS=y 83091744

So yes, I can reproduce your observation - defconfig *with* your patch
does slim down vmlinux, because, well, it is moving the reloc sections
into a separate file. Doh.

And with my .config too:

tailored config:
- with patch: NEED_RELOCS=y 377718768
- without patch, NEED_RELOCS=y 639952576

So I guess we can try it - let's see who complains.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette