Re: [RFC PATCH] keys: flush work when accessing /proc/key-users

From: David Howells
Date: Wed Dec 06 2023 - 11:13:20 EST


Luis Henriques <lhenriques@xxxxxxx> wrote:

> This patch is mostly for getting some feedback on how to fix an fstest
> failing for ext4/fscrypt (generic/581). Basically, the test relies on the
> data read from /proc/key-users to be up-to-date regarding the number of
> keys a given user currently has. However, this file can't be trusted
> because it races against the keys GC.

Unfortunately, I don't think your patch helps. If the GC hasn't started yet,
it won't achieve anything and the GC can still be triggered at any time after
the flush and thus race.

What is it you're actually trying to determine?

And is it only for doing the test?

David