linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Malte Skarupke <malteskarupke@web.de>
To: tglx@linutronix.de, mingo@redhat.com
Cc: peterz@infradead.org, dvhart@infradead.org,
	linux-kernel@vger.kernel.org, malteskarupke@fastmail.fm,
	malteskarupke@web.de
Subject: [PATCH] futex: Support smaller futexes of one byte or two byte size.
Date: Sat, 21 Dec 2019 10:56:58 -0500	[thread overview]
Message-ID: <20191221155659.3159-1-malteskarupke@web.de> (raw)
In-Reply-To: <20191220190901.23465-3-malteskarupke@web.de>

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;




  reply	other threads:[~2019-12-21 16:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 23:52 [PATCH] futex: Support smaller futexes of one byte or two byte size Malte Skarupke
2019-12-06 15:31 ` Peter Zijlstra
2019-12-06 17:37   ` Peter Zijlstra
2019-12-08 22:18     ` Malte Skarupke
2019-12-11 13:44       ` Peter Zijlstra
2019-12-11 19:48         ` Malte Skarupke
2019-12-20 19:08 ` Malte Skarupke
2019-12-20 19:09   ` Malte Skarupke
2019-12-20 19:09     ` Malte Skarupke
2019-12-21 15:56       ` Malte Skarupke [this message]
2019-12-21 15:56         ` Malte Skarupke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191221155659.3159-1-malteskarupke@web.de \
    --to=malteskarupke@web.de \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=malteskarupke@fastmail.fm \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).