You are not logged in.

#1 2022-10-04 08:32:44

abc12345
Member
Registered: 2022-03-30
Posts: 57

[SOLVED] Kernel compiles different sizes with SAME .config

I compile a linux kernel version 5.x with a .config file. Then I reboot and compile kernel once again using the *very same* .config. The resulting bzImage size is different by some ~200-2000 bytes (each time different)! Another time gets different size! Same config!
What's the rooted cause of this problem? How to fix this??

Last edited by abc12345 (2022-10-04 10:04:59)

Offline

#2 2022-10-04 09:14:10

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Kernel compiles different sizes with SAME .config


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2022-10-04 10:04:45

abc12345
Member
Registered: 2022-03-30
Posts: 57

Re: [SOLVED] Kernel compiles different sizes with SAME .config

Thanks for the link.

Offline

#4 2022-10-04 11:38:50

abc12345
Member
Registered: 2022-03-30
Posts: 57

Re: [SOLVED] Kernel compiles different sizes with SAME .config

By extension, it should be an imperative security protocol for all Linux users to randomize kernel structure prior to each and every single boot. It is a quick endeavor - you just run this in the kernel source's directory:

scripts/./gen-randstruct-seed.sh FORCE include/generated/randstruct_hash.h
make

and boom, you are uber secure™
This literally just generates a new random seed for randomized linking. It's also a very quick make because it just relinks everything you already compiled and takes only a couple of seconds. Put the newly randomized structurally kernel into your boot folder before every boot under the correct name (vmlinuz-xxx) and you are hardened more.

Last edited by abc12345 (2022-10-04 11:40:54)

Offline

Board footer

Powered by FluxBB