[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191221155659.3159-1-malteskarupke@web.de>
Date: Sat, 21 Dec 2019 10:56:58 -0500
From: Malte Skarupke <malteskarupke@....de>
To: tglx@...utronix.de, mingo@...hat.com
Cc: peterz@...radead.org, dvhart@...radead.org,
linux-kernel@...r.kernel.org, malteskarupke@...tmail.fm,
malteskarupke@....de
Subject: [PATCH] futex: Support smaller futexes of one byte or two byte size.
And hello one more time,
turns out a last minute change broke my patch for "option 2". I had moved some
lines around and didn't test the results properly... As a result I literally
woke up from a nightmare at 4am tonight, immediately knowing that there was a
bug in the code I had sent. Below you'll find a patch with the fix.
I re-emailed the whole patch to make it easier to use if you want to go with
option 2. But if you're curious what the difference is between this new
version and the last version, the diff between the two is just this:
diff --git a/kernel/futex.c b/kernel/futex.c
index e2308cea7580..ac460fd612ae 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -569,10 +569,6 @@ get_futex_key(u32 __user *uaddr, int flags, union futex_key *key, enum futex_acc
size = futex_size(flags);
key->both.offset = address % PAGE_SIZE;
- if (size == sizeof(u8))
- key->both.offset |= FUT_OFF_8_BITS;
- else if (size == sizeof(u16))
- key->both.offset |= FUT_OFF_16_BITS;
/*
* The futex address must be "naturally" aligned.
@@ -581,6 +577,11 @@ get_futex_key(u32 __user *uaddr, int flags, union futex_key *key, enum futex_acc
return -EINVAL;
address -= key->both.offset;
+ if (size == sizeof(u8))
+ key->both.offset |= FUT_OFF_8_BITS;
+ else if (size == sizeof(u16))
+ key->both.offset |= FUT_OFF_16_BITS;
+
if (unlikely(!access_ok(uaddr, size)))
return -EFAULT;
Powered by blists - more mailing lists