Skip to contentSkip to conversation

kernel-sysctl-ignore-out-of-range-taint-bits-introduced-via-kerneltainted.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 8, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: kernel/sysctl.c: ignore out-of-range taint bits introduced via kernel.tainted
has been removed from the -mm tree. Its filename was
kernel-sysctl-ignore-out-of-range-taint-bits-introduced-via-kerneltainted.patch

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

------------------------------------------------------
From: Rafael Aquini <[email protected]>
Subject: kernel/sysctl.c: ignore out-of-range taint bits introduced via kernel.tainted

Users with SYS_ADMIN capability can add arbitrary taint flags to the running kernel by writing to /proc/sys/kernel/tainted or issuing the command 'sysctl -w kernel.tainted=...'. This interface, however, is open for any integer value and this might cause an invalid set of flags being committed to the tainted_mask bitset.

This patch introduces a simple way for proc_taint() to ignore any eventual invalid bit coming from the user input before committing those bits to the kernel tainted_mask.

---

 kernel/sysctl.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/sysctl.c renamed from kernel/sysctl.c~kernel-sysctl-ignore-out-of-range-taint-bits-introduced-via-kerneltainted +2 -3
@@ -880,10 +880,9 @@ static int proc_taint(struct ctl_table *
 		 * Poor man's atomic or. Not worth adding a primitive
 		 * to everyone's atomic.h for this
 		 */
-		for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
-			if ((tmptaint >> i) & 1)
+		for (i = 0; i < TAINT_FLAGS_COUNT; i++)
+			if ((1UL << i) & tmptaint)
 				add_taint(i, LOCKDEP_STILL_OK);
-		}
 	}
 
 	return err;

_

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