All of lore.kernel.org
 help / color / mirror / Atom feed
* Allowing empty keys? or: setting attributes on keys safely
@ 2024-02-17 18:20 Linus Heckemann
  2024-02-19 19:47 ` Jarkko Sakkinen
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Heckemann @ 2024-02-17 18:20 UTC (permalink / raw)
  To: keyrings; +Cc: maximilian

Hi all,

We've been fiddling with the keyring functionality; I want to set up a
key with an expiry time safely -- i.e. the key data should never be
loaded without the expiry time being set.

I'd expect that I could create a user key with an empty payload, e.g.

add_key("user", "some-key", NULL, 0, KEY_SPEC_SESSION_KEYRING);

or

add_key("user", "some-key", "", 0, KEY_SPEC_SESSION_KEYRING);

in order to use keyctl_set_timeout to apply a timeout _before_ the
payload is populated using keyctl_update. However, both of these add_key
calls return -EINVAL.

I found [1] which removed documentation that suggested that this would
be allowed, but the reason for not allowing an empty payload is unclear
to me; I think it would make sense for my exact use case, and placing a
dummy nonempty payload in the keyring first seems like it would be more
semantically weird and painful to deal with when reading from the keyring.

Is there any reason why this restriction is in place, and is there a
more sensible way to apply the timeout before a payload is loaded?

Cheers
Linus

[1]: https://lore.kernel.org/all/alpine.LNX.2.00.1603281843250.15978@sisyphus/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-23 13:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-17 18:20 Allowing empty keys? or: setting attributes on keys safely Linus Heckemann
2024-02-19 19:47 ` Jarkko Sakkinen
2024-02-20  9:28   ` Linus Heckemann
2024-02-20 17:49     ` Jarkko Sakkinen
2024-02-20 17:52       ` Jarkko Sakkinen
2024-03-23 13:44   ` Maximilian Bosch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.