linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment
@ 2024-02-24 10:25 linke li
  0 siblings, 0 replies; only message in thread
From: linke li @ 2024-02-24 10:25 UTC (permalink / raw)
  Cc: lilinke99, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel

In function get_xol_area(), mm->uprobes_state.xol_area is read using 
READ_ONCE() in line 1534

1534   area = READ_ONCE(mm->uprobes_state.xol_area); /* ^^^ */

while read directly in line 1530

1530   	if (!mm->uprobes_state.xol_area)
1531	    __create_xol_area(0);

In the same environment, reads in two places should have the same
protection.

Signed-off-by: linke li <lilinke99@qq.com>
---
 kernel/events/uprobes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 929e98c62965..e110941fbc6b 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1527,7 +1527,7 @@ static struct xol_area *get_xol_area(void)
 	struct mm_struct *mm = current->mm;
 	struct xol_area *area;
 
-	if (!mm->uprobes_state.xol_area)
+	if (!READ_ONCE(mm->uprobes_state.xol_area))
 		__create_xol_area(0);
 
 	/* Pairs with xol_add_vma() smp_store_release() */
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-24 10:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-24 10:25 [PATCH] uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment linke li

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).