[LTP] [PATCH v2 14/33] keyctl22: Test KEYCTL_RESTRICT_KEYRING reject-all

Cyril Hrubis chrubis@suse.cz
Fri Sep 11 14:13:40 CEST 2026


Hi!
> +/*\
> + * Test ``KEYCTL_RESTRICT_KEYRING`` reject-all of :manpage:`keyctl(2)`,
> + * added in Linux 4.12.
> + *
> + * [Algorithm]
> + *
> + * - restrict a keyring with ``NULL`` type and ``NULL`` restriction (reject all links),
> + *   verify subsequent links and add_key fail with ``EPERM``
> + */
> +
> +#include "keyctl_common.h"
> +
> +#define PAYLOAD		"payload"
> +
> +static key_serial_t ring_reject;
> +static key_serial_t user_key;
> +
> +static void setup(void)
> +{
> +	SAFE_KEYCTL(KEYCTL_JOIN_SESSION_KEYRING, 0, 0, 0, 0);
> +
> +	ring_reject = new_ring("ltpkeyctl22_reject");
> +	user_key = new_user_key("k", PAYLOAD, sizeof(PAYLOAD),
> +				KEY_SPEC_PROCESS_KEYRING);

Here as well.

Otherwise it looks good.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list