In various scenarios we invoke containers with access to the kernel
keyring blocked. Let's make sure we can handle this properly: when the
invocation ID is stored in in the kernel keyring and we try to read it
and get EPERM we should handle it gracefully, like EOPNOTSUPP.
key = request_key("user", "invocation_id", NULL, 0);
if (key == -1) {
- /* Keyring support not available? No invocation key stored? */
- if (IN_SET(errno, ENOSYS, ENOKEY))
+ /* Keyring support not available? Keyring access locked down? No invocation key stored? */
+ if (ERRNO_IS_NOT_SUPPORTED(errno) ||
+ ERRNO_IS_PRIVILEGE(errno) ||
+ errno == ENOKEY)
return -ENXIO;
return -errno;