On Thu, Jan 6, 2022 at 4:14 PM Eric Biggers <ebiggers@xxxxxxxxxx> wrote: > > I had to make the following changes to Linus's patch: Ack. Thanks. > This is one way to fix the use-after-free, but the fact that it allows anyone > who can write to a /proc/pressure/* file to cause the kernel to allocate an > unbounded number of 'struct psi_trigger' structs is still really broken. Yeah, I agree. Very non-optimal - that patch really was trying to just keep the status quo, and fixing the immediate problems. Modifying that patch to only allow a previous NULL value in psi_trigger_replace() would be fairly simple - it would basically just get rid of the "stale_trigger" list (and the loops it creates). You'd still want the psi_trigger_release() model to separate that whole "release" from "new trigger". But that does require that nobody ever does more than a single write to one file. Debian code search finds those "/proc/pressure/xyz" files mentioned at least by systemd and the chromium chrome browser sources. Whether they actually write triggers to them, I can't say. Maybe we just need to try. Linus