From: Joe Damato <jdamato@fastly.com>
To: Kyle Huey <me@kylehuey.com>
Cc: Jiri Olsa <olsajiri@gmail.com>,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
netdev@vger.kernel.org, acme@kernel.org,
andrii.nakryiko@gmail.com, elver@google.com, khuey@kylehuey.com,
mingo@kernel.org, namhyung@kernel.org, peterz@infradead.org,
robert@ocallahan.org, yonghong.song@linux.dev,
mkarsten@uwaterloo.ca, kuba@kernel.org
Subject: Re: [bpf?] [net-next ?] [RESEND] possible bpf overflow/output bug introduced in 6.10rc1 ?
Date: Fri, 12 Jul 2024 17:45:54 -0700 [thread overview]
Message-ID: <ZpHOQoyEE7Rl1ky8@LQ3V64L9R2> (raw)
In-Reply-To: <CAP045AqqfU3g2+-groEHzzdJvO3nyHPM5_faUao5UdbSOtK48A@mail.gmail.com>
On Fri, Jul 12, 2024 at 04:30:31PM -0700, Kyle Huey wrote:
> Joe, can you test this?
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 8f908f077935..f0d7119585dc 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -9666,6 +9666,8 @@ static inline void
> perf_event_free_bpf_handler(struct perf_event *event)
> * Generic event overflow handling, sampling.
> */
>
> +static bool perf_event_is_tracing(struct perf_event *event);
> +
> static int __perf_event_overflow(struct perf_event *event,
> int throttle, struct perf_sample_data *data,
> struct pt_regs *regs)
> @@ -9682,7 +9684,9 @@ static int __perf_event_overflow(struct perf_event *event,
>
> ret = __perf_event_account_interrupt(event, throttle);
>
> - if (event->prog && !bpf_overflow_handler(event, data, regs))
> + if (event->prog &&
> + !perf_event_is_tracing(event) &&
> + !bpf_overflow_handler(event, data, regs))
> return ret;
>
> /*
> @@ -10612,6 +10616,11 @@ void perf_event_free_bpf_prog(struct perf_event *event)
>
> #else
>
> +static inline bool perf_event_is_tracing(struct perf_event *event)
> +{
> + return false;
> +}
> +
> static inline void perf_tp_register(void)
> {
> }
>
Thank you!
I've applied the above patch on top of commit 338a93cf4a18 ("net:
mctp-i2c: invalidate flows immediately on TX errors"), which seems
to be latest on net-next/main.
I built and booted that kernel on my mlx5 test machine and re-ran
the same bpftrace invocation:
bpftrace -e 'tracepoint:napi:napi_poll { @[args->work] = count(); }'
I then scp-ed a 100MiB zero filled file to the target 48 times back
to back (e.g. scp zeroes target:~/ && scp zeroes target:~/ && ... )
and the bpftrace output seems reasonable; there are no negative
numbers and the values output *look* reasonable to me.
The patch seems reasonable, as well, with the major caveat that I've
only hacked on drivers and networking stuff and know absolutely
nothing about bpf internals.
All that said:
Tested-by: Joe Damato <jdamato@fastly.com>
next prev parent reply other threads:[~2024-07-13 0:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 16:53 [bpf?] [net-next ?] [RESEND] possible bpf overflow/output bug introduced in 6.10rc1 ? Joe Damato
2024-07-12 22:18 ` Jiri Olsa
2024-07-12 22:39 ` Jiri Olsa
2024-07-12 22:49 ` Kyle Huey
2024-07-12 23:05 ` Kyle Huey
2024-07-12 23:30 ` Kyle Huey
2024-07-13 0:45 ` Joe Damato [this message]
2024-07-13 4:47 ` Kyle Huey
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=ZpHOQoyEE7Rl1ky8@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=acme@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=elver@google.com \
--cc=khuey@kylehuey.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@kylehuey.com \
--cc=mingo@kernel.org \
--cc=mkarsten@uwaterloo.ca \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olsajiri@gmail.com \
--cc=peterz@infradead.org \
--cc=robert@ocallahan.org \
--cc=yonghong.song@linux.dev \
/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