Skip to content

Commit 0565ff5

Browse files
committed
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/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 704a0f8 + 6f02b54 commit 0565ff5

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

kernel/bpf/task_iter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
159159
}
160160

161161
/* set info->task and info->tid */
162+
info->task = curr_task;
162163
if (curr_tid == info->tid) {
163164
curr_fd = info->fd;
164165
} else {

tools/bpf/bpftool/net.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <bpf/bpf.h>
1212
#include <bpf/libbpf.h>
1313
#include <net/if.h>
14-
#include <linux/if.h>
1514
#include <linux/rtnetlink.h>
1615
#include <linux/socket.h>
1716
#include <linux/tc_act/tc_bpf.h>

tools/bpf/resolve_btfids/main.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ int eprintf(int level, int var, const char *fmt, ...)
139139
#define pr_debug2(fmt, ...) pr_debugN(2, pr_fmt(fmt), ##__VA_ARGS__)
140140
#define pr_err(fmt, ...) \
141141
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
142+
#define pr_info(fmt, ...) \
143+
eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__)
142144

143145
static bool is_btf_id(const char *name)
144146
{
@@ -472,7 +474,7 @@ static int symbols_resolve(struct object *obj)
472474
int nr_funcs = obj->nr_funcs;
473475
int err, type_id;
474476
struct btf *btf;
475-
__u32 nr;
477+
__u32 nr_types;
476478

477479
btf = btf__parse(obj->btf ?: obj->path, NULL);
478480
err = libbpf_get_error(btf);
@@ -483,12 +485,12 @@ static int symbols_resolve(struct object *obj)
483485
}
484486

485487
err = -1;
486-
nr = btf__get_nr_types(btf);
488+
nr_types = btf__get_nr_types(btf);
487489

488490
/*
489491
* Iterate all the BTF types and search for collected symbol IDs.
490492
*/
491-
for (type_id = 1; type_id <= nr; type_id++) {
493+
for (type_id = 1; type_id <= nr_types; type_id++) {
492494
const struct btf_type *type;
493495
struct rb_root *root;
494496
struct btf_id *id;
@@ -526,8 +528,13 @@ static int symbols_resolve(struct object *obj)
526528

527529
id = btf_id__find(root, str);
528530
if (id) {
529-
id->id = type_id;
530-
(*nr)--;
531+
if (id->id) {
532+
pr_info("WARN: multiple IDs found for '%s': %d, %d - using %d\n",
533+
str, id->id, type_id, id->id);
534+
} else {
535+
id->id = type_id;
536+
(*nr)--;
537+
}
531538
}
532539
}
533540

tools/testing/selftests/bpf/progs/bprm_opts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright 2020 Google LLC.
55
*/
66

7-
#include "vmlinux.h"
7+
#include <linux/bpf.h>
88
#include <errno.h>
99
#include <bpf/bpf_helpers.h>
1010
#include <bpf/bpf_tracing.h>

0 commit comments

Comments
 (0)