Re: propagating vmgenid outward and upward

From: Jason A. Donenfeld
Date: Wed Mar 02 2022 - 09:35:54 EST


Hey again,

On Tue, Mar 01, 2022 at 04:42:47PM +0100, Jason A. Donenfeld wrote:
> For (B), it's a little bit trickier. But I think our options follow the
> same rubric. We can expose a generation counter in the vDSO, with
> semantics akin to the extern integer I described above. Or we could
> expose that counter in a file that userspace could poll() on and receive
> notifications that way. Or perhaps a third way. I'm all ears here.
> Alex's team from Amazon last year proposed something similar to the vDSO
> idea, except using mmap on a sysfs file, though from what I can tell,
> that wound up being kind of complicated. Due to the fact that we're
> _already_ racy, I think I'm most inclined at this point toward the
> poll() approach for the same reasons as I prefer a notifier_block. But
> on userspace I could be convinced otherwise, and I'd be interested in
> totally different ideas here too.

I implemented the poll() case here in 15 lines of code and found it
remarkably simple to do:

https://lore.kernel.org/lkml/20220302143331.654426-1-Jason@xxxxxxxxx/

This is just a PoC/RFC for the sake of having something tangible to look
at for this thread. It is notable to me, though, that implementing this
was so minimal.

Regards,
Jason