From: gregkh@linuxfoundation.org
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Thomas Schoebel-Theuer <tst@1und1.de>,
Thomas Gleixner <tglx@linutronix.de>,
Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 4.4 2/7] futex: fix spin_lock() / spin_unlock_irq() imbalance
Date: Wed, 10 Mar 2021 14:25:15 +0100 [thread overview]
Message-ID: <20210310132319.239999799@linuxfoundation.org> (raw)
In-Reply-To: <20210310132319.155338551@linuxfoundation.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
From: Thomas Schoebel-Theuer <tst@1und1.de>
This patch and problem analysis is specific for 4.4 LTS, due to incomplete
backporting of other fixes. Later LTS series have different backports.
The following is obviously incorrect:
static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this,
struct futex_hash_bucket *hb)
{
[...]
raw_spin_lock(&pi_state->pi_mutex.wait_lock);
[...]
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
[...]
}
The 4.4-specific fix should probably go in the direction of
b4abf91047c,
making everything irq-safe.
Probably, backporting of b4abf91047c
to 4.4 LTS could thus be another good idea.
However, this might involve some more 4.4-specific work and
require thorough testing:
> git log --oneline v4.4..b4abf91047c -- kernel/futex.c kernel/locking/rtmutex.c | wc -l
10
So this patch is just an obvious quickfix for now.
Hint: the lock order is documented in 4.9.y and later. A similar
documenting is missing in 4.4.y. Please somebody either backport also,
or write a new description, if there would be some differences I cannot
easily see at the moment. Without reliable docs,
inspection of the locking correctness may become a pain.
Signed-off-by: Thomas Schoebel-Theuer <tst@1und1.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Lee Jones <lee.jones@linaro.org>
Fixes: 394fc4981426 ("futex: Rework inconsistent rt_mutex/futex_q state")
Fixes: 6510e4a2d04f ("futex,rt_mutex: Provide futex specific rt_mutex API")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/futex.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1408,7 +1408,7 @@ static int wake_futex_pi(u32 __user *uad
if (pi_state->owner != current)
return -EINVAL;
- raw_spin_lock(&pi_state->pi_mutex.wait_lock);
+ raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock);
new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
/*
next prev parent reply other threads:[~2021-03-10 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 13:25 [PATCH 4.4 0/7] 4.4.261-rc1 review gregkh
2021-03-10 13:25 ` [PATCH 4.4 1/7] futex: fix irq self-deadlock and satisfy assertion gregkh
2021-03-10 13:25 ` gregkh [this message]
2021-03-10 13:25 ` [PATCH 4.4 3/7] ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits gregkh
2021-03-10 13:25 ` [PATCH 4.4 4/7] rsxx: Return -EFAULT if copy_to_user() fails gregkh
2021-03-10 13:25 ` [PATCH 4.4 5/7] dm table: fix iterate_devices based device capability checks gregkh
2021-03-10 13:25 ` [PATCH 4.4 6/7] platform/x86: acer-wmi: Add new force_caps module parameter gregkh
2021-03-10 13:25 ` [PATCH 4.4 7/7] PCI: Add function 1 DMA alias quirk for Marvell 9215 SATA controller gregkh
2021-03-10 20:20 ` [PATCH 4.4 0/7] 4.4.261-rc1 review Pavel Machek
2021-03-10 22:01 ` Shuah Khan
2021-03-10 23:50 ` Guenter Roeck
2021-03-11 8:38 ` Naresh Kamboju
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=20210310132319.239999799@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tst@1und1.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