Re: [PATCH 1/2] perf: Add closing sibling events' file descriptors

From: Andi Kleen
Date: Thu Aug 06 2020 - 13:45:57 EST

> > This adds an opt-in flag to the perf_event_open() syscall to retain
> > sibling events after their file descriptors are closed. In this case, the
> > actual events will be closed with the group leader.
> So having the 1:1 relation with filedesc imposes a resource limit on
> userspace.
> This patch breaks that and enables a user to basically DoS the system by
> creating unbound events.

The idea was to account the events in the locked memory allocation too.
Not sure that made it into the patch though.

It has a minor issue that it might break some existing setups that rely
on the mmap fitting exactly into the mmap allocation, but that could
be solved by allowing a little slack, since the existing setups
likely don't have that many events.

There's also a secondary issue of DoS the kernel by creating very long
lists to iterate, but I suppose this is already quite possible, so probably
not a new issue.