Re: [PATCH v2] kbuild: treat char as always unsigned

From: Kees Cook
Date: Thu Oct 20 2022 - 14:41:39 EST


On Wed, Oct 19, 2022 at 05:38:55PM -0700, Linus Torvalds wrote:
> Having some scripting automation that just notices "this changes code
> generation in function X" might actually be interesting, and judging
> by my quick tests might not be *too* verbose.

On the reproducible build comparison system[1] we use for checking a lot
of the KSPP work for .text deltas, an allmodconfig finds a fair bit for
this change. Out of 33900 .o files, 1005 have changes.

Spot checking matches a lot of what you found already...

u64 flags = how->flags;
...
fs/open.c:1123:
int acc_mode = ACC_MODE(flags);
- 1c86: movsbl 0x0(%rdx),%edx
+ 1c86: movzbl 0x0(%rdx),%edx

#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])

Ignoring those, it goes down to 625, and spot checking those is more
difficult, but looks to be mostly register selection changes dominating
the delta. The resulting vmlinux sizes are identical, though.

-Kees

[1] A fancier version of:
https://outflux.net/blog/archives/2022/06/24/finding-binary-differences/

--
Kees Cook