tracing: Have the user copy of synthetic event address use correct context
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 31 Oct 2023 19:10:33 +0000 (15:10 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 2 Nov 2023 03:46:05 +0000 (23:46 -0400)
commit4f7969bcd6d33042d62e249b41b5578161e4c868
tree4a016504c1d0c2e2c2421ed30346769329483566
parent77bc4d4921bd3497678ba8e7f4e480de35692f05
tracing: Have the user copy of synthetic event address use correct context

A synthetic event is created by the synthetic event interface that can
read both user or kernel address memory. In reality, it reads any
arbitrary memory location from within the kernel. If the address space is
in USER (where CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE is set) then
it uses strncpy_from_user_nofault() to copy strings otherwise it uses
strncpy_from_kernel_nofault().

But since both functions use the same variable there's no annotation to
what that variable is (ie. __user). This makes sparse complain.

Quiet sparse by typecasting the strncpy_from_user_nofault() variable to
a __user pointer.

Link: https://lore.kernel.org/linux-trace-kernel/20231031151033.73c42e23@gandalf.local.home
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Fixes: 0934ae9977c2 ("tracing: Fix reading strings from synthetic events");
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202311010013.fm8WTxa5-lkp@intel.com/
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_synth.c