common/encrypt: use a sub-keyring within the session keyring
Make the encryption tests create and use a named keyring "xfstests" in
the session keyring that the tests happen to be running under, rather
than replace the session keyring using 'keyctl new_session'.
Unfortunately, the latter doesn't work when the session keyring is owned
by a non-root user, which (depending on the Linux distro) can happen if
xfstests is run in a sudo "session" rather than in a real root session.
This isn't a great solution, as the lifetime of the keyring will no
longer be tied to the tests as it should be, but it should work. The
alternative would be the weird hack of making the 'check' script
re-execute itself using something like 'keyctl session - $0 $@'.
Reported-by: Ritesh Harjani <ritesh.list@gmail.com> Signed-off-by: Eric Biggers <ebiggers@google.com>