From: David Miller <davem@davemloft.net>
To: yhs@fb.com
Cc: peterz@infradead.org, rostedt@goodmis.org, ast@fb.com,
daniel@iogearbox.net, netdev@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH net] bpf: one perf event close won't free bpf program attached by another perf event
Date: Wed, 20 Sep 2017 14:12:48 -0700 (PDT) [thread overview]
Message-ID: <20170920.141248.405636883631460038.davem@davemloft.net> (raw)
In-Reply-To: <20170918233836.1817062-1-yhs@fb.com>
From: Yonghong Song <yhs@fb.com>
Date: Mon, 18 Sep 2017 16:38:36 -0700
> This patch fixes a bug exhibited by the following scenario:
> 1. fd1 = perf_event_open with attr.config = ID1
> 2. attach bpf program prog1 to fd1
> 3. fd2 = perf_event_open with attr.config = ID1
> <this will be successful>
> 4. user program closes fd2 and prog1 is detached from the tracepoint.
> 5. user program with fd1 does not work properly as tracepoint
> no output any more.
>
> The issue happens at step 4. Multiple perf_event_open can be called
> successfully, but only one bpf prog pointer in the tp_event. In the
> current logic, any fd release for the same tp_event will free
> the tp_event->prog.
>
> The fix is to free tp_event->prog only when the closing fd
> corresponds to the one which registered the program.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
I've applied this and queued it up for -stable as it looks good
to me and 2 days is enough time for waiting for any other reviews.
Thanks.
next prev parent reply other threads:[~2017-09-20 21:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-18 23:38 [PATCH net] bpf: one perf event close won't free bpf program attached by another perf event Yonghong Song
2017-09-20 21:12 ` David Miller [this message]
2017-09-21 1:41 ` Steven Rostedt
2017-09-21 5:17 ` Yonghong Song
2017-09-21 5:20 ` Yonghong Song
2017-09-21 11:17 ` Peter Zijlstra
2017-09-21 14:02 ` Steven Rostedt
2017-09-21 21:53 ` Alexei Starovoitov
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=20170920.141248.405636883631460038.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=yhs@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