From: Yonghong Song <yhs@fb.com>
To: Song Liu <songliubraving@fb.com>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <peterz@infradead.org>, <ast@kernel.org>, <daniel@iogearbox.net>,
<kernel-team@fb.com>, <john.fastabend@gmail.com>,
<kpsingh@chromium.org>
Subject: Re: [Potential Spoof] [PATCH v2 bpf-next 3/4] bpf: allow %pB in bpf_seq_printf() and bpf_trace_printk()
Date: Fri, 26 Jun 2020 08:44:16 -0700 [thread overview]
Message-ID: <808e5374-564f-da07-86d6-2636e79331ce@fb.com> (raw)
In-Reply-To: <20200626001332.1554603-4-songliubraving@fb.com>
On 6/25/20 5:13 PM, Song Liu wrote:
> This makes it easy to dump stack trace in text.
>
> Signed-off-by: Song Liu <songliubraving@fb.com>
Ack with a small nit below.
Acked-by: Yonghong Song <yhs@fb.com>
> ---
> kernel/trace/bpf_trace.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 65fa62723e2f8..1cb90b0868817 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -376,7 +376,7 @@ static void bpf_trace_copy_string(char *buf, void *unsafe_ptr, char fmt_ptype,
>
> /*
> * Only limited trace_printk() conversion specifiers allowed:
> - * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %pks %pus %s
> + * %d %i %u %x %ld %li %lu %lx %lld %lli %llu %llx %p %pB %pks %pus %s
> */
> BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
> u64, arg2, u64, arg3)
> @@ -420,6 +420,11 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
> goto fmt_str;
> }
>
> + if (fmt[i + 1] == 'B') {
> + i++;
> + goto fmt_next;
> + }
> +
> /* disallow any further format extensions */
> if (fmt[i + 1] != 0 &&
> !isspace(fmt[i + 1]) &&
> @@ -479,7 +484,7 @@ BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
> #define __BPF_TP_EMIT() __BPF_ARG3_TP()
> #define __BPF_TP(...) \
> __trace_printk(0 /* Fake ip */, \
> - fmt, ##__VA_ARGS__)
> + fmt, ##__VA_ARGS__)\
Accidental change?
>
> #define __BPF_ARG1_TP(...) \
> ((mod[0] == 2 || (mod[0] == 1 && __BITS_PER_LONG == 64)) \
> @@ -636,7 +641,8 @@ BPF_CALL_5(bpf_seq_printf, struct seq_file *, m, char *, fmt, u32, fmt_size,
> if (fmt[i] == 'p') {
> if (fmt[i + 1] == 0 ||
> fmt[i + 1] == 'K' ||
> - fmt[i + 1] == 'x') {
> + fmt[i + 1] == 'x' ||
> + fmt[i + 1] == 'B') {
> /* just kernel pointers */
> params[fmt_cnt] = args[fmt_cnt];
> fmt_cnt++;
>
next prev parent reply other threads:[~2020-06-26 15:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-26 0:13 [PATCH v2 bpf-next 0/4] bpf: introduce bpf_get_task_stack() Song Liu
2020-06-26 0:13 ` [PATCH v2 bpf-next 1/4] perf: export get/put_chain_entry() Song Liu
2020-06-26 11:00 ` Peter Zijlstra
2020-06-26 20:06 ` Andrii Nakryiko
2020-06-26 21:38 ` Song Liu
2020-06-26 21:29 ` Song Liu
2020-06-26 0:13 ` [PATCH v2 bpf-next 2/4] bpf: introduce helper bpf_get_task_stak() Song Liu
2020-06-26 15:40 ` Yonghong Song
2020-06-26 22:37 ` Song Liu
2020-06-26 20:17 ` Andrii Nakryiko
2020-06-26 20:22 ` Andrii Nakryiko
2020-06-26 22:45 ` Song Liu
2020-06-26 22:51 ` Andrii Nakryiko
2020-06-26 23:47 ` Song Liu
2020-06-27 0:06 ` Andrii Nakryiko
2020-06-26 0:13 ` [PATCH v2 bpf-next 3/4] bpf: allow %pB in bpf_seq_printf() and bpf_trace_printk() Song Liu
2020-06-26 15:44 ` Yonghong Song [this message]
2020-06-26 0:13 ` [PATCH v2 bpf-next 4/4] selftests/bpf: add bpf_iter test with bpf_get_task_stack() Song Liu
2020-06-26 15:52 ` Yonghong Song
2020-06-26 20:21 ` Andrii Nakryiko
2020-06-26 23:05 ` Song Liu
2020-06-26 23:11 ` Andrii Nakryiko
2020-06-26 23:40 ` Song Liu
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=808e5374-564f-da07-86d6-2636e79331ce@fb.com \
--to=yhs@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@fb.com \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.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).