From: Greg KH <greg@kroah.com>
To: "Zidenberg, Tsahi" <tsahee@amazon.com>
Cc: stable@vger.kernel.org
Subject: Re: [PATCH 2/2] tracing/kprobes: handle userspace access on unified probes
Date: Sat, 10 Apr 2021 13:29:27 +0200 [thread overview]
Message-ID: <YHGMFzQlHomDtZYG@kroah.com> (raw)
In-Reply-To: <ea2d7cd2-9891-573e-ebcb-bfeebd79661a@amazon.com>
On Mon, Mar 29, 2021 at 01:59:48PM +0300, Zidenberg, Tsahi wrote:
>
> commit 9de1fec50b23117f0a19f7609cc837ca72e764a6 upstream.
>
> This is an adaptation of parts from the above commit to kernel 5.4.
>
> Allow Kprobes to access userspace data correctly in architectures with no
> overlap between kernel and userspace addresses.
>
> Cc: <stable@vger.kernel.org> # 5.4.x
> Signed-off-by: Tsahi Zidenberg <tsahee@amazon.com>
> ---
> kernel/trace/trace_kprobe.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 233322c77b76..cbd72a1c9530 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -1043,6 +1043,11 @@ fetch_store_strlen(unsigned long addr)
> int ret, len = 0;
> u8 c;
>
> +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> + if (addr < TASK_SIZE)
> + return fetch_store_strlen_user(addr);
> +#endif
> +
> do {
> ret = probe_kernel_read(&c, (u8 *)addr + len, 1);
> len++;
> @@ -1071,6 +1076,11 @@ fetch_store_string(unsigned long addr, void *dest, void *base)
> void *__dest;
> long ret;
>
> +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> + if (addr < TASK_SIZE)
> + return fetch_store_string_user(addr, dest, base);
> +#endif
> +
> if (unlikely(!maxlen))
> return -ENOMEM;
>
> @@ -1114,6 +1124,11 @@ fetch_store_string_user(unsigned long addr, void *dest, void *base)
> static nokprobe_inline int
> probe_mem_read(void *dest, void *src, size_t size)
> {
> +#ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
> + if ((unsigned long)src < TASK_SIZE)
> + return probe_mem_read_user(dest, src, size);
> +#endif
> +
> return probe_kernel_read(dest, src, size);
> }
>
> --
> 2.25.1
What problem is this fixing?
thanks,
greg k-h
next prev parent reply other threads:[~2021-04-10 11:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 10:56 [PATCH 0/2] fix userspace access on arm64 for linux 5.4 Zidenberg, Tsahi
2021-03-29 10:58 ` [PATCH 1/2] bpf: fix userspace access for bpf_probe_read{, str}() Zidenberg, Tsahi
2021-03-30 17:21 ` Sasha Levin
2021-03-31 18:37 ` Zidenberg, Tsahi
2021-04-03 9:56 ` Greg KH
2021-04-04 9:13 ` Zidenberg, Tsahi
2021-04-10 11:29 ` Greg KH
2021-04-12 20:01 ` Zidenberg, Tsahi
2021-04-13 7:28 ` Greg KH
2021-03-29 10:59 ` [PATCH 2/2] tracing/kprobes: handle userspace access on unified probes Zidenberg, Tsahi
2021-04-10 11:29 ` Greg KH [this message]
2021-04-10 11:30 ` [PATCH 0/2] fix userspace access on arm64 for linux 5.4 Greg KH
2021-04-12 19:46 ` Zidenberg, Tsahi
2021-04-13 7:27 ` Greg KH
2021-04-21 13:04 ` Zidenberg, Tsahi
2021-04-21 13:26 ` Greg KH
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=YHGMFzQlHomDtZYG@kroah.com \
--to=greg@kroah.com \
--cc=stable@vger.kernel.org \
--cc=tsahee@amazon.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;
as well as URLs for NNTP newsgroup(s).