Re: [PATCH v2 6/6] KEYS: Verify the key identity in __keyctl_unlink

From
Jarkko Sakkinen <jarkko@kernel.org>
Date
2026-10-19 21:06:34
Also in
keyrings, lkml, stable
Reply to
Eric Biggers, 2026-10-19
On Mon, Oct 19, 2026 at 12:35:02PM -0700, Eric Biggers wrote:
On Mon, Oct 19, 2026 at 09:17:26PM +0300, Jarkko Sakkinen wrote:
quoted
[PATCH v2 6/6] KEYS: Verify the key identity in __keyctl_unlink
There is no __keyctl_unlink.  Seems you mean __key_unlink_begin.
This is definitely my typo :-) I was looking at the implementation
in other terminal while writing this and apparently lost focus.
quoted
Let's define the following preconditions:

- Two keys: A and B.
- R is a keyring.
- Both have the same type/description/domain.

Then:

1. KEYCTL_LINK(A, R) => {A}
1. KEYCTL_LINK(B, R) => {B}
2. KEYCTL_UNLINK(A, R) => {}
Should be 1, 2, and 3?
I tried to describe the scenarion but apparently was not so successful.

I.e. unlinking A removes B given the match in attributes while you would
expect getting -ENOENT and B retained. Or this is the idea.
quoted
Instead, verify key tidentity before unlinking, and return -ENOENT on
tidentity => identity

Also should explicitly say what the bug is.
I tried and failed... But yeah, the bug is illict successful removal
so there is nothing unclear on that side.

Is clearer description enough or should I supplement this keyctl
snippet?
- Eric
Br, Jarkko
Thread (32 messages) 32 messages, 3 authors, last reply 29d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help