Commit 0565ff56 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf

Alexei Starovoitov says:

====================
pull-request: bpf 2021-01-07

We've added 4 non-merge commits during the last 10 day(s) which contain
a total of 4 files changed, 14 insertions(+), 7 deletions(-).

The main changes are:

1) Fix task_iter bug caused by the merge conflict resolution, from Yonghong.

2) Fix resolve_btfids for multiple type hierarchies, from Jiri.

* https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  bpftool: Fix compilation failure for net.o with older glibc
  tools/resolve_btfids: Warn when having multiple IDs for single type
  bpf: Fix a task_iter bug caused by a merge conflict resolution
  selftests/bpf: Fix a compile error for BPF_F_BPRM_SECUREEXEC
====================

Link: https://lore.kernel.org/r/20210107221555.64959-1-alexei.starovoitov@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 704a0f85 6f02b540
...@@ -159,6 +159,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info) ...@@ -159,6 +159,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
} }
/* set info->task and info->tid */ /* set info->task and info->tid */
info->task = curr_task;
if (curr_tid == info->tid) { if (curr_tid == info->tid) {
curr_fd = info->fd; curr_fd = info->fd;
} else { } else {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <bpf/bpf.h> #include <bpf/bpf.h>
#include <bpf/libbpf.h> #include <bpf/libbpf.h>
#include <net/if.h> #include <net/if.h>
#include <linux/if.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/tc_act/tc_bpf.h> #include <linux/tc_act/tc_bpf.h>
......
...@@ -139,6 +139,8 @@ int eprintf(int level, int var, const char *fmt, ...) ...@@ -139,6 +139,8 @@ int eprintf(int level, int var, const char *fmt, ...)
#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__) #define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err(fmt, ...) \ #define pr_err(fmt, ...) \
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info(fmt, ...) \
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
static bool is_btf_id(const char *name) static bool is_btf_id(const char *name)
{ {
...@@ -472,7 +474,7 @@ static int symbols_resolve(struct object *obj) ...@@ -472,7 +474,7 @@ static int symbols_resolve(struct object *obj)
int nr_funcs = obj->nr_funcs; int nr_funcs = obj->nr_funcs;
int err, type_id; int err, type_id;
struct btf *btf; struct btf *btf;
__u32 nr; __u32 nr_types;
btf = btf__parse(obj->btf ?: obj->path, NULL); btf = btf__parse(obj->btf ?: obj->path, NULL);
err = libbpf_get_error(btf); err = libbpf_get_error(btf);
...@@ -483,12 +485,12 @@ static int symbols_resolve(struct object *obj) ...@@ -483,12 +485,12 @@ static int symbols_resolve(struct object *obj)
} }
err = -1; err = -1;
nr = btf__get_nr_types(btf); nr_types = btf__get_nr_types(btf);
/* /*
* Iterate all the BTF types and search for collected symbol IDs. * Iterate all the BTF types and search for collected symbol IDs.
*/ */
for (type_id = 1; type_id <= nr; type_id++) { for (type_id = 1; type_id <= nr_types; type_id++) {
const struct btf_type *type; const struct btf_type *type;
struct rb_root *root; struct rb_root *root;
struct btf_id *id; struct btf_id *id;
...@@ -526,10 +528,15 @@ static int symbols_resolve(struct object *obj) ...@@ -526,10 +528,15 @@ static int symbols_resolve(struct object *obj)
id = btf_id__find(root, str); id = btf_id__find(root, str);
if (id) { if (id) {
if (id->id) {
pr_info("WARN: multiple IDs found for '%s': %d, %d - using %d\n",
str, id->id, type_id, id->id);
} else {
id->id = type_id; id->id = type_id;
(*nr)--; (*nr)--;
} }
} }
}
err = 0; err = 0;
out: out:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright 2020 Google LLC. * Copyright 2020 Google LLC.
*/ */
#include "vmlinux.h" #include <linux/bpf.h>
#include <errno.h> #include <errno.h>
#include <bpf/bpf_helpers.h> #include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h> #include <bpf/bpf_tracing.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment