From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Alexander Gordeev <agordeev@linux.ibm.com>,
Jann Horn <jannh@google.com>,
Suren Baghdasaryan <surenb@google.com>
Subject: [PATCH] mm: do not protect VMA lock object in vma_end_read()
Date: Thu, 7 Dec 2023 10:48:44 +0100 [thread overview]
Message-ID: <20231207094844.706407-1-agordeev@linux.ibm.com> (raw)
In early discussion to the implementation of vma_end_read()
Jann Horn pointed out that up_read() could access the VMA
lock object after it has already been acquired by someone
else. As result, up_read() is protected with RCU read lock:
rcu_read_lock(); /* keeps vma alive */
up_read(&vma->lock);
rcu_read_unlock();
Since commit 3f5245538a19 ("locking/rwsem: Disable preemption
in all down_read*() and up_read() code paths") __up_read()
disables preemption internally and thus the need to protect
the VMA lock object does not exist anymore.
Link: https://lore.kernel.org/all/CAG48ez3sCwasFzKD5CsqMFA2W57-2fazd75g7r0NaA_BVNTLow@mail.gmail.com/
Cc: Jann Horn <jannh@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
include/linux/mm.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 418d26608ece..7b32bc75a4ab 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -683,9 +683,7 @@ static inline bool vma_start_read(struct vm_area_struct *vma)
static inline void vma_end_read(struct vm_area_struct *vma)
{
- rcu_read_lock(); /* keeps vma alive till the end of up_read */
up_read(&vma->vm_lock->lock);
- rcu_read_unlock();
}
/* WARNING! Can only be used if mmap_lock is expected to be write-locked */
--
2.40.1
next reply other threads:[~2023-12-07 9:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 9:48 Alexander Gordeev [this message]
2023-12-07 14:00 ` Jann Horn
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=20231207094844.706407-1-agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=surenb@google.com \
/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
all inboxes | Powered by JetHome®