Re: [PATCH net-next v2 1/2] tun: tun_chr_open(): correctly initialize socket uid

From: Pietro Borrello
Date: Fri Feb 03 2023 - 10:17:16 EST


On Fri, 3 Feb 2023 at 15:58, Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>
> This seems very fragile...
> "struct inode" could be made bigger, and __randomize_layout could move i_uid
> at the end of it.
>
> KASAN could then detect an out-of-bound access in sock_init_data()
>
> I would rather add a wrapper like this [1], then change tun/tap to use
> sock_init_data_uid()
>

I agree this is a much cleaner solution.
I'll wait the usual 24h for further comments, and send a patch like this in v3.

Best regards,
Pietro