Re: [PATCH] pipe_fs_i.h: add pipe_buf_init()
From: Max Kellermann
Date: Tue Sep 19 2023 - 09:55:54 EST
On Tue, Sep 19, 2023 at 3:45 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
> So pipe_buf->private may now contain garbage.
NULL is just as garbage as the other 2^64-1 possible pointer values.
NULL isn't special here, nobody checks the field for NULL. This field
is specially crafted for exactly one user, and initializing it with
NULL for all others will at best only add unnecessary overhead, and at
worst will hide initialization bugs from sanitiziers who now think
it's indeed properly initialized.
> Does the helper buy us that much overall?
This is about introducing a safer coding style. The lack of a central
initializer function is what caused CVE-2022-0847, which was the worst
security vulnerability in a decade or two.