[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_088804E150842691191FD0021AEE8649EB0A@qq.com>
Date: Sat, 24 Feb 2024 18:25:19 +0800
From: linke li <lilinke99@...com>
To:
Cc: lilinke99@...com,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] uprobes: use READ_ONCE() to read mm->uprobes_state.xol_area in concurrent environment
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@...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)
Powered by blists - more mailing lists