Re: [LTP] [PATCH 1/2] safe_keyctl: Skip with TCONF on EOPNOTSUPP

Petr Vorel
2025-12-09T19:48:36Z

...
> +++ b/include/lapi/keyctl.h
> @@ -209,10 +209,11 @@ static inline long safe_keyctl(const char *file, const int lineno,
> {
> long rval;
> int failure = 0;
> + int res = errno == EOPNOTSUPP ? TCONF : TBROK | TERRNO;

Obviously set variable before calling keyctl() is wrong,
as Mingyu Li reported
https://lore.kernel.org/ltp/20251209124041.216542-1-simplemessager@163.com/

Therefore his patch which does not store value before use should be used:
https://patchwork.ozlabs.org/project/ltp/patch/20251209122937.212641-2-simplemessager@163.com/
https://lore.kernel.org/ltp/20251209124041.216542-2-simplemessager@163.com/

Kind regards,
Petr

> rval = keyctl(cmd, arg2, arg3, arg4, arg5);
> if (rval == -1) {
> - tst_brk_(file, lineno, TBROK | TERRNO,
> + tst_brk_(file, lineno, res,
> "keyctl(%d, %lu, %lu, %lu, %lu)",
> cmd, arg2, arg3, arg4, arg5);
> }