mirror of https://github.com/torvalds/linux.git
bpf-fixes
-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+soXsSLHKoYyzcli6rmadz2vbToFAmiWKasACgkQ6rmadz2v bToTMhAAmAvsOqfaoYR0LfmuwPZj9F0bqg9voRRgHNnf3j1Iz0L2po65pdbJGQPs mf+KivbeWsPic8AD0mnbgPLgPXNYsunxsQ+k5LfShbtECZ+0QqUmT27EAIhsHWTr ghWmMZ6E3kq7bfsTaNAtJNjiovHCr+swqpZoJpAlwz1CxNhESDIjdDzGtarPNxHw s3ioI9gvPuH4x5vq7SblyfgeYJWNk0ZELISmdNEud1nBrdR91Ji2Iqxwkky0qhKI 4kQzN9MmjsIl4dIa1DMlQsMpKkC/sHtoFW2VEUkuHUwP+wa/YIn7iAvD7xc2k3nS 2fLzlpfZnSIdu+2piu9A7RoU4VI/XyC+tud6WmDYGN/xKgA0N7BmoBQjhgptj+uH BitpTGmFPoDuRiQDKHiGPTP6Wc4djt0Ipp6hFr89Q2ywCUCrylRafuJDpOn6xwzG VZH6yK1cMk2kIa8jArGjMtvcWiMbaMn6GwxjQaPC+Syhy6dmAWVmcyEKYXki8GAc N+gl0bBGHEGhcCCuyzxFAOLKx81CDp5C+gfoCzt3lDAXztrd1PeaZV+n9c6jtgVT VPO9TahYqnsfuLPBVDTCGSvVsTP2Fh2fIcdsEJvcF1EISBiwYBw6FGpDi4WlbOfm pisRchdT0YV6vg0V+f2U6mL5UbZr7v5w5PAfh7zXCqvfppoPD8U= =Qt6J -----END PGP SIGNATURE----- Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf Pull bpf fixes from Alexei Starovoitov: - Fix memory leak of bpf_scc_info objects (Eduard Zingerman) - Fix a regression in the 'perf' tool caused by moving UID filtering to BPF (Ilya Leoshkevich) * tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf: perf bpf-filter: Enable events manually libbpf: Add the ability to suppress perf event enablement bpf: Fix memory leak of bpf_scc_info objects
This commit is contained in:
commit
c30a13538d
|
|
@ -23114,6 +23114,8 @@ static void free_states(struct bpf_verifier_env *env)
|
|||
|
||||
for (i = 0; i < env->scc_cnt; ++i) {
|
||||
info = env->scc_info[i];
|
||||
if (!info)
|
||||
continue;
|
||||
for (j = 0; j < info->num_visits; j++)
|
||||
free_backedges(&info->visits[j]);
|
||||
kvfree(info);
|
||||
|
|
@ -24554,6 +24556,7 @@ static int compute_scc(struct bpf_verifier_env *env)
|
|||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
env->scc_cnt = next_scc_id;
|
||||
exit:
|
||||
kvfree(stack);
|
||||
kvfree(pre);
|
||||
|
|
|
|||
|
|
@ -10965,11 +10965,14 @@ struct bpf_link *bpf_program__attach_perf_event_opts(const struct bpf_program *p
|
|||
}
|
||||
link->link.fd = pfd;
|
||||
}
|
||||
if (ioctl(pfd, PERF_EVENT_IOC_ENABLE, 0) < 0) {
|
||||
err = -errno;
|
||||
pr_warn("prog '%s': failed to enable perf_event FD %d: %s\n",
|
||||
prog->name, pfd, errstr(err));
|
||||
goto err_out;
|
||||
|
||||
if (!OPTS_GET(opts, dont_enable, false)) {
|
||||
if (ioctl(pfd, PERF_EVENT_IOC_ENABLE, 0) < 0) {
|
||||
err = -errno;
|
||||
pr_warn("prog '%s': failed to enable perf_event FD %d: %s\n",
|
||||
prog->name, pfd, errstr(err));
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
return &link->link;
|
||||
|
|
|
|||
|
|
@ -499,9 +499,11 @@ struct bpf_perf_event_opts {
|
|||
__u64 bpf_cookie;
|
||||
/* don't use BPF link when attach BPF program */
|
||||
bool force_ioctl_attach;
|
||||
/* don't automatically enable the event */
|
||||
bool dont_enable;
|
||||
size_t :0;
|
||||
};
|
||||
#define bpf_perf_event_opts__last_field force_ioctl_attach
|
||||
#define bpf_perf_event_opts__last_field dont_enable
|
||||
|
||||
LIBBPF_API struct bpf_link *
|
||||
bpf_program__attach_perf_event(const struct bpf_program *prog, int pfd);
|
||||
|
|
|
|||
|
|
@ -451,6 +451,8 @@ int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target)
|
|||
struct bpf_link *link;
|
||||
struct perf_bpf_filter_entry *entry;
|
||||
bool needs_idx_hash = !target__has_cpu(target);
|
||||
DECLARE_LIBBPF_OPTS(bpf_perf_event_opts, pe_opts,
|
||||
.dont_enable = true);
|
||||
|
||||
entry = calloc(MAX_FILTERS, sizeof(*entry));
|
||||
if (entry == NULL)
|
||||
|
|
@ -522,7 +524,8 @@ int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target)
|
|||
prog = skel->progs.perf_sample_filter;
|
||||
for (x = 0; x < xyarray__max_x(evsel->core.fd); x++) {
|
||||
for (y = 0; y < xyarray__max_y(evsel->core.fd); y++) {
|
||||
link = bpf_program__attach_perf_event(prog, FD(evsel, x, y));
|
||||
link = bpf_program__attach_perf_event_opts(prog, FD(evsel, x, y),
|
||||
&pe_opts);
|
||||
if (IS_ERR(link)) {
|
||||
pr_err("Failed to attach perf sample-filter program\n");
|
||||
ret = PTR_ERR(link);
|
||||
|
|
|
|||
Loading…
Reference in New Issue