Skip to contentSkip to conversation

acct-fix-the-acct-needcheck-check-in-check_free_space.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 12, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled

     Subject: kernel/acct.c: fix the acct->needcheck check in check_free_space()

has been removed from the -mm tree. Its filename was
acct-fix-the-acct-needcheck-check-in-check_free_space.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Oleg Nesterov <[email protected]>
Subject: kernel/acct.c: fix the acct->needcheck check in check_free_space()

As Tsukada explains, the time_is_before_jiffies(acct->needcheck) check is very wrong, we need time_is_after_jiffies() to make sys_acct() work.

Ignoring the overflows, the code should "goto out" if needcheck > jiffies, while currently it checks "needcheck < jiffies" and thus in the likely case check_free_space() does nothing until jiffies overflow.

In particular this means that sys_acct() is simply broken, acct_on() sets acct->needcheck = jiffies and expects that check_free_space() should set acct->active = 1 after the free-space check, but this won't happen if jiffies increments in between.

This was broken by commit 32dc73086015 ("get rid of timer in kern/acct.c") in 2011, then another (correct) commit 795a2f22a8ea ("acct() should honour the limits from the very beginning") made the problem more visible.

---

 kernel/acct.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/acct.c renamed from kernel/acct.c~acct-fix-the-acct-needcheck-check-in-check_free_space +1 -1
diff -puN kernel/acct.c~acct-fix-the-acct-needcheck-check-in-check_free_space kernel/acct.c
@@ -102,7 +102,7 @@ static int check_free_space(struct bsd_a
 {
 	struct kstatfs sbuf;
 
-	if (time_is_before_jiffies(acct->needcheck))
+	if (time_is_after_jiffies(acct->needcheck))
 		goto out;
 
 	/* May block */

_

Patches currently in -mm which might be from [email protected] are