[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250311123241.GB3493@redhat.com>
Date: Tue, 11 Mar 2025 13:32:42 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
linux-arm-kernel@...ts.infradead.org,
linux-trace-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
Russell King <linux@...linux.org.uk>,
Masami Hiramatsu <mhiramat@...nel.org>,
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>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
Tong Tiangen <tongtiangen@...wei.com>
Subject: Re: [PATCH -next v1 3/3] kernel/events/uprobes:
uprobe_write_opcode() rewrite
On 03/11, David Hildenbrand wrote:
>
> Regarding both questions, the code is fairly racy. Nothing would stop user
> space from (a) modifying that memory
Yes, but we don't really care. uprobes.c assumes that user-space won't play
with the probed memory.
Note that if is_register is false, then vma can be even writable. Hmm, why?
Perhaps valid_vma() should ignore is_register and nack VM_MAYWRITE ? But
this doesn't really matter, say, gdb can change this memory anyway. Again,
we don't really care.
> >do something like
> >
> > /* Walk the page tables again, to perform the actual update. */
> > ret = -EAGAIN;
> > folio = folio_walk_start(&fw, vma, vaddr, 0);
> > if (folio) {
> > if (fw.page == page) {
> > WARN_ON(is_register && !folio_test_anon(folio));
>
> Yes, that would work (we could leave the WARN_ON in __uprobe_write_opcode),
> but I am not sure if the end result is better better. No strong opinion on
> the details though.
Will, this way __uprobe_write_opcode() will look a little bit simpler...
But I won't insist, please do what you think is better.
Oleg.
Powered by blists - more mailing lists