On Tue, Apr 13, 2021 at 08:54:06AM +0200, Peter Zijlstra wrote: > On Mon, Apr 12, 2021 at 01:05:09PM -0700, Kees Cook wrote: > > On Mon, Apr 12, 2021 at 10:00:16AM +0200, Peter Zijlstra wrote: > > > +struct vpr_data { > > > + int (*fn)(pte_t pte, unsigned long addr, void *data); > > > + void *data; > > > +}; > > > > Eeerg. This is likely to become an attack target itself. Stored function > > pointer with stored (3rd) argument. > > You got some further reading on that? How exactly are those exploited?
Sure, see "Executing code" in https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html I killed the entire primitive (for timer_list) https://outflux.net/blog/archives/2018/02/05/security-things-in-linux-v4-15/#v4.15-timer_list but that was a lot of work, so I'm trying to avoid seeing more things like it appear. :) (And I'm trying to get rid of similar APIs, like tasklet.) This new code is unlikely to ever be used as widely as timer_list, but I just cringe when I see the code pattern. I'll understand if there isn't a solution that doesn't require major refactoring, but I can dream. :) -- Kees Cook