2024-04-09 13:34:42

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] net/socket: Ensure length of input socket option param >= sizeof(int)

Hi,

On Tue, Apr 9, 2024 at 9:07 AM Eric Dumazet <[email protected]> wrote:
>
>
> On 4/9/24 14:15, Edward Adam Davis wrote:
> > The optlen value passed by syzbot to _sys_setsockopt() is 2, which results in
> > only 2 bytes being allocated when allocating memory to kernel_optval, and the
> > optval size passed when calling the function copy_from_sockptr() is 4 bytes.
> > Here, optlen is determined uniformly in the entry function __sys_setsockopt().
> > If its value is less than 4, the parameter is considered invalid.
> >
> > Reported-by: [email protected]
> > Reported-by: [email protected]
> > Reported-by: [email protected]
> > Signed-off-by: Edward Adam Davis <[email protected]>
>
>
> I think I gave my feedback already.
>
> Please do not ignore maintainers feedback.
>
> This patch is absolutely wrong.
>
> Some setsockopt() deal with optlen == 1 just fine, thank you very much.

+1, I don't think the setsockopt interface has a fixed minimum of
sizeof(int), so this is a nak from me as well.

--
Luiz Augusto von Dentz