Skip to contentSkip to conversation

Patch "futex: Prevent overflow by strengthen input validation" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Jan 18, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

futex: Prevent overflow by strengthen input validation

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
futex-prevent-overflow-by-strengthen-input-validation.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From fbe0e839d1e22d88810f3ee3e2f1479be4c0aa4a Mon Sep 17 00:00:00 2001

From: Li Jinyue <[email protected]>
Date: Thu, 14 Dec 2017 17:04:54 +0800
Subject: futex: Prevent overflow by strengthen input validation

From: Li Jinyue <[email protected]>

commit fbe0e839d1e22d88810f3ee3e2f1479be4c0aa4a upstream.

UBSAN reports signed integer overflow in kernel/futex.c:

 UBSAN: Undefined behaviour in kernel/futex.c:2041:18
 signed integer overflow:
 0 - -2147483648 cannot be represented in type 'int'

Add a sanity check to catch negative values of nr_wake and nr_requeue.

---
 kernel/futex.c |    3 +++
 1 file changed, 3 insertions(+)
kernel/futex.c +3 -0
@@ -1878,6 +1878,9 @@ static int futex_requeue(u32 __user *uad
 	struct futex_q *this, *next;
 	DEFINE_WAKE_Q(wake_q);
 
+	if (nr_wake < 0 || nr_requeue < 0)
+		return -EINVAL;
+
 	/*
 	 * When PI not supported: return -ENOSYS if requeue_pi is true,
 	 * consequently the compiler knows requeue_pi is always false past

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

queue-4.14/futex-prevent-overflow-by-strengthen-input-validation.patch