Re: [PATCH bpf-next v2] lib/buildid: Avoid wraparound when aligning ELF note sizes
From: Alexei Starovoitov
Date: Sat Dec 05 2026 - 11:34:54 EST
On Sat, Dec 05, 2026 at 05:11 AM Thorsten Blum <blum@xxxxxxxxxx> wrote:
> For u32 note sizes, ALIGN() wraps the values 0xfffffffd through
> 0xffffffff to 0 before check_add_overflow() runs. Parsing can then
> continue as if the affected size were 0.
>
> Use u64 for name_sz and desc_sz to avoid alignment wraparound, allowing
> check_add_overflow() to reject these malformed notes early.
The code is the same as in v1. Only the log changed.
The reason for rejection is the same as before: nothing is broken.
It doesn't harden anything either. The owner of the file writes 0
instead of 0xffffffff and gets the same walk. Size 0 is valid.
I don't think we need this patch.
pw-bot: cr