Re: [PATCH 7/8] vdso/align: Preserve object size through PTR_ALIGN()

From: Jack Wallner

Date: Sun Nov 29 2026 - 15:47:57 EST


Hi David,

On Sun, 29 Nov 2026 17:38:16 +0000 David Laight wrote:
> scripts/bloat-o-meter will tell you exactly where the changes are.
> It might be that the code is actually larger in a few places.

You're right, it is. I rebuilt every C file that calls PTR_ALIGN() for
the seven compiler and architecture pairs in the changelog (allmodconfig
with KASAN, UBSAN and KCOV off), once on the base tree and once with the
series applied, and compared each object. Function text, leaving out the
new test:

x86-64 GCC +1394 bytes (+0.07%)
i386 GCC +980 bytes (+0.05%)
x86-64 Clang +758 bytes (+0.04%)
arm64 Clang +536 bytes (+0.02%)
powerpc Clang +1524 bytes (+0.06%)
arm Clang +7860 bytes (+0.38%)
riscv Clang +7496 bytes (+0.39%)

Every architecture gets 12 to 18 new __fortify_panic() call sites (153
to 166 on x86-64 GCC). Those are the checks the patch is meant to
enable, and on x86, arm64 and powerpc the functions that gained one
account for most of the growth; ovpn_aead_decrypt() gains two, for
example. The two largest growths on x86-64 GCC have no new check,
though: ath12k_dp_reoq_lut_setup() grows by 416 bytes and ismt_access()
by 256.

On 32-bit arm and riscv the checks are a small part of it. There the
growth is spread over hundreds of functions (834 grow on arm, 351 on
riscv), and on arm 7360 of the 7860 bytes are in functions that gained
no check; gf128mul_lle() is the largest, at 184 bytes. So the changelog
is wrong to put the growth down to the object size. I don't know the
cause yet and will find out before v2.

> How did that happen?
> Why isn't it just ((x) & ~((a) - 1))

It is older than this series. ed067d4a859f ("linux/kernel.h: Add
ALIGN_DOWN macro", 2017) replaced three local versions, the metag one
being the mask form, and kept the udl form, ALIGN(x - (a - 1), a).

The mask form would need a cast to typeof(x), or an unsigned 32-bit a
clears the top half of a 64-bit x:

((x) & ~((typeof(x))(a) - 1))

I'd rather keep that out of this series, but I can send it as a
separate patch if you think it is worth doing.

> Too long.

Cut down to:

/*
* Add the padding to @p instead of casting an integer back to a pointer,
* so the compiler still knows the size of the object @p points into.
* Use ALIGN() for integers.
*/

> Doesn't belong here at all.

Dropped. That reasoning stays in the changelog only.

Both will be in v2.

Thanks,
Jack