[LTP] lapi/keyctl.h: Add fallback definitions for extended ops

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Fri Sep 4 17:18:31 CEST 2026


Hi Andrea,

On 2026-09-04, Andrea Cervesato wrote:
> lapi/keyctl.h: Add fallback definitions for extended ops

--- [PATCH 15/33] ---

> +	/* Probe if asymmetric key type is supported */
> +	TEST(keyctl(KEYCTL_RESTRICT_KEYRING, ring_builtin,
> +		    (unsigned long)"asymmetric", (unsigned long)"bogus", 0));
> +	asym_supported = (TST_RET != -1 || TST_ERR != ENODEV);

KEYCTL_RESTRICT_KEYRING returns ENOKEY, not ENODEV, when the asymmetric
key type is absent: keyring_restrict() propagates the raw -ENOKEY from
key_type_lookup(), unlike add_key() which remaps it to ENODEV. On a
kernel without CONFIG_ASYMMETRIC_KEY_TYPE this probe therefore sets
asym_supported to true, so run() proceeds and the builtin_trusted
restriction returns ENOKEY, which is not handled as TCONF and reports
TFAIL. Use asym_supported = !(TST_RET == -1 && TST_ERR == ENOKEY);

--- [PATCH 16/33] ---

> +	TEST(keyctl(KEYCTL_RESTRICT_KEYRING, probe_ring,
> +		    (unsigned long)"asymmetric", (unsigned long)"bogus", 0));
> +	asym_supported = (TST_RET != -1 || TST_ERR != ENODEV);

Same probe defect: the absent-type errno is ENOKEY, not ENODEV, so
asym_supported is true without CONFIG_ASYMMETRIC_KEY_TYPE and the
needs_asym tcases are not skipped as intended. Use asym_supported =
!(TST_RET == -1 && TST_ERR == ENOKEY);

Verdict - Needs revision

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer


More information about the ltp mailing list