Skip to contentSkip to conversation

KEYS: Have the garbage collector set its timer for live expired keys

PATCH In review David Howells 3 participants 5 messages Sep 16, 2009 – Sep 17, 2009

Subsystems (2)
lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 KEYS: Have the garbage collector set its timer for live expired keys

The key garbage collector sets a timer to start a new collection cycle at the point the earliest key to expire should be considered garbage. However, it currently only does this if the key it is considering hasn't yet expired.

If the key being considering has expired, but hasn't yet reached the collection time then it is ignored, and won't be collected until some other key provokes a round of collection.

Make the garbage collector set the timer for the earliest key that hasn't yet passed its collection time, rather than the earliest key that hasn't yet expired.

---

 security/keys/gc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
security/keys/gc.c +2 -2
index 485fc62..4770be3 100644
@@ -169,9 +169,9 @@ static void key_garbage_collector(struct work_struct *work)
 
 	/* trawl through the keys looking for keyrings */
 	for (;;) {
-		if (key->expiry > now && key->expiry < new_timer) {
+		if (key->expiry > limit && key->expiry < new_timer) {
 			kdebug("will expire %x in %ld",
-			       key_serial(key), key->expiry - now);
+			       key_serial(key), key->expiry - limit);
 			new_timer = key->expiry;
 		}
 
#1 lore raw
Quoted 8 lines · David Howells

The key garbage collector sets a timer to start a new collection cycle at the point the earliest key to expire should be considered garbage. However, it currently only does this if the key it is considering hasn't yet expired.

If the key being considering has expired, but hasn't yet reached the collection time then it is ignored, and won't be collected until some other key provokes a round of collection.

Quoted 5 lines

Make the garbage collector set the timer for the earliest key that hasn't yet passed its collection time, rather than the earliest key that hasn't yet expired.

Is this in response to my bugreport? (If yes then the changelog is quite vague about the circumstances of the bug, its effects, which tools were used to find it, etc. etc.)

Ingo

author maintainer
#2 lore raw
Quoted 3 lines · Ingo Molnar

Is this in response to my bugreport? (If yes then the changelog is quite vague about the circumstances of the bug, its effects, which tools were used to find it, etc. etc.)

No.

David

maintainer
#3 lore raw
Quoted 7 lines · David Howells
Quoted 3 lines · Ingo Molnar

Is this in response to my bugreport? (If yes then the changelog is quite vague about the circumstances of the bug, its effects, which tools were used to find it, etc. etc.)

No.

Is it a bugfix, or an enhancement?

Signature · 2 lines
James Morris
<[email protected]>
author maintainer
#4 lore raw
Quoted 1 line · James Morris

Is it a bugfix, or an enhancement?

Bug fix.

David