Re: [PATCH (resend)] Input: MT - limit max slots

From: Dmitry Torokhov
Date: Mon Jul 29 2024 - 16:00:34 EST


On Mon, Jul 29, 2024 at 12:27:05PM -0700, Linus Torvalds wrote:
> On Mon, 29 Jul 2024 at 12:12, Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:
> >
> > OK, if you want to have limits be it. You probably want to lower from
> > 1024 to 128 or something, because with 1024 slots the structure will be
> > larger than one page and like I said mt->red table will be 4Mb.
>
> So this is why subsystem maintainers should be involved and helpful.
> It's hard to know what practical limits are.
>
> That said, a 4MB allocation for some test code is nothing.
>
> And yes, if syzbot hits other cases where the input layer just takes
> user input without any limit sanity checking, those should be fixed
> *too*.

Hmm, maybe the checks should go into drivers/input/misc/uinput.c which
is the only place that allows userspace to create input device instances
and drive them rather than into input core logic because all other
devices are backed by real hardware.

Thanks.

--
Dmitry