Skip to content

Commit

Permalink
Sync with latest libbpf repo
Browse files Browse the repository at this point in the history
Sync with latest libbpf repo upto commit:
   94a49850c5ee Makefile: enforce gnu89 standard

Signed-off-by: Yonghong Song <[email protected]>
  • Loading branch information
yonghong-song committed Nov 18, 2021
1 parent b4043cc commit 9d6776b
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/kernel-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_current_task_under_cgroup()` | 4.9 | | [`60d20f9195b2`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=60d20f9195b260bdf0ac10c275ae9f6016f9c069)
`BPF_FUNC_d_path()` | 5.10 | | [`6e22ab9da793`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=6e22ab9da79343532cd3cde39df25e5a5478c692)
`BPF_FUNC_fib_lookup()` | 4.18 | GPL | [`87f5fc7e48dd`](https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=87f5fc7e48dd3175b30dd03b41564e1a8e136323)
`BPF_FUNC_find_vma()` | 5.17 | | [`7c7e3d31e785`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=7c7e3d31e7856a8260a254f8c71db416f7f9f5a1)
`BPF_FUNC_for_each_map_elem()` | 5.13 | | [`69c087ba6225`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=69c087ba6225b574afb6e505b72cb75242a3d844)
`BPF_FUNC_get_attach_cookie()` | 5.15 | | [`7adfc6c9b315`](https://github.com/torvalds/linux/commit/7adfc6c9b315e174cf8743b21b7b691c8766791b)
`BPF_FUNC_get_branch_snapshot()` | 5.16 | GPL | [`856c02dbce4f`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit?id=856c02dbce4f8d6a5644083db22c11750aa11481)
Expand Down Expand Up @@ -249,6 +250,7 @@ Helper | Kernel version | License | Commit |
`BPF_FUNC_inode_storage_delete()` | 5.10 | | [`8ea636848aca`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=8ea636848aca35b9f97c5b5dee30225cf2dd0fe6)
`BPF_FUNC_inode_storage_get()` | 5.10 | | [`8ea636848aca`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=8ea636848aca35b9f97c5b5dee30225cf2dd0fe6)
`BPF_FUNC_jiffies64()` | 5.5 | | [`5576b991e9c1`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=5576b991e9c1a11d2cc21c4b94fc75ec27603896)
`BPF_FUNC_kallsyms_lookup_name()` | 5.16 | | [`d6aef08a872b`](https://github.com/torvalds/linux/commit/d6aef08a872b9e23eecc92d0e92393473b13c497)
`BPF_FUNC_ktime_get_boot_ns()` | 5.7 | GPL | [`71d19214776e`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next/+/71d19214776e61b33da48f7c1b46e522c7f78221)
`BPF_FUNC_ktime_get_coarse_ns()` | 5.11 | GPL | [`d05512618056`](https://github.com/torvalds/linux/commit/d055126180564a57fe533728a4e93d0cb53d49b3)
`BPF_FUNC_ktime_get_ns()` | 4.1 | GPL | [`d9847d310ab4`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d9847d310ab4003725e6ed1822682e24bd406908)
Expand Down
1 change: 1 addition & 0 deletions introspection/bps.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static const char * const map_type_strings[] = {
[BPF_MAP_TYPE_RINGBUF] = "ringbuf",
[BPF_MAP_TYPE_INODE_STORAGE] = "inode_storage",
[BPF_MAP_TYPE_TASK_STORAGE] = "task_storage",
[BPF_MAP_TYPE_BLOOM_FILTER] = "bloom_filter",
};

#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
Expand Down
49 changes: 48 additions & 1 deletion src/cc/compat/linux/virtual_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ enum bpf_map_type {
BPF_MAP_TYPE_RINGBUF,
BPF_MAP_TYPE_INODE_STORAGE,
BPF_MAP_TYPE_TASK_STORAGE,
BPF_MAP_TYPE_BLOOM_FILTER,
};

/* Note that tracing related programs such as
Expand Down Expand Up @@ -1275,6 +1276,13 @@ union bpf_attr {
* struct stored as the
* map value
*/
/* Any per-map-type extra fields
*
* BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
* number of hash functions (if 0, the bloom filter will default
* to using 5 hash functions).
*/
__u64 map_extra;
};

struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
Expand Down Expand Up @@ -1737,7 +1745,7 @@ union bpf_attr {
* if the maximum number of tail calls has been reached for this
* chain of programs. This limit is defined in the kernel by the
* macro **MAX_TAIL_CALL_CNT** (not accessible to user space),
* which is currently set to 32.
* which is currently set to 33.
* Return
* 0 on success, or a negative error in case of failure.
*
Expand Down Expand Up @@ -4916,6 +4924,40 @@ union bpf_attr {
* Dynamically cast a *sk* pointer to a *unix_sock* pointer.
* Return
* *sk* if casting is valid, or **NULL** otherwise.
*
* long bpf_kallsyms_lookup_name(const char *name, int name_sz, int flags, u64 *res)
* Description
* Get the address of a kernel symbol, returned in *res*. *res* is
* set to 0 if the symbol is not found.
* Return
* On success, zero. On error, a negative value.
*
* **-EINVAL** if *flags* is not zero.
*
* **-EINVAL** if string *name* is not the same size as *name_sz*.
*
* **-ENOENT** if symbol is not found.
*
* **-EPERM** if caller does not have permission to obtain kernel address.
*
* long bpf_find_vma(struct task_struct *task, u64 addr, void *callback_fn, void *callback_ctx, u64 flags)
* Description
* Find vma of *task* that contains *addr*, call *callback_fn*
* function with *task*, *vma*, and *callback_ctx*.
* The *callback_fn* should be a static function and
* the *callback_ctx* should be a pointer to the stack.
* The *flags* is used to control certain aspects of the helper.
* Currently, the *flags* must be 0.
*
* The expected callback signature is
*
* long (\*callback_fn)(struct task_struct \*task, struct vm_area_struct \*vma, void \*callback_ctx);
*
* Return
* 0 on success.
* **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
* **-EBUSY** if failed to try lock mmap_lock.
* **-EINVAL** for invalid **flags**.
*/
#define __BPF_FUNC_MAPPER(FN) \
FN(unspec), \
Expand Down Expand Up @@ -5097,6 +5139,8 @@ union bpf_attr {
FN(get_branch_snapshot), \
FN(trace_vprintk), \
FN(skc_to_unix_sock), \
FN(kallsyms_lookup_name), \
FN(find_vma), \
/* */

/* integer value in 'imm' field of BPF_CALL instruction selects which helper
Expand Down Expand Up @@ -5639,6 +5683,8 @@ struct bpf_map_info {
__u32 btf_id;
__u32 btf_key_type_id;
__u32 btf_value_type_id;
__u32 :32; /* alignment pad */
__u64 map_extra;
} __attribute__((aligned(8)));

struct bpf_btf_info {
Expand Down Expand Up @@ -6271,6 +6317,7 @@ struct bpf_sk_lookup {
__u32 local_ip4; /* Network byte order */
__u32 local_ip6[4]; /* Network byte order */
__u32 local_port; /* Host byte order */
__u32 ingress_ifindex; /* The arriving interface. Determined by inet_iif. */
};

/*
Expand Down
6 changes: 6 additions & 0 deletions src/cc/export/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ static long (*bpf_trace_vprintk)(const char *fmt, __u32 fmt_size, const void *da
(void *)BPF_FUNC_trace_vprintk;
static struct unix_sock *(*bpf_skc_to_unix_sock)(void *sk) =
(void *)BPF_FUNC_skc_to_unix_sock;
static long (*bpf_kallsyms_lookup_name)(const char *name, int name_sz, int flags,
__u64 *res) =
(void *)BPF_FUNC_kallsyms_lookup_name;
static long (*bpf_find_vma)(struct task_struct *task, __u64 addr, void *callback_fn,
void *callback_ctx, __u64 flags) =
(void *)BPF_FUNC_find_vma;

/* llvm builtin functions that eBPF C program may use to
* emit BPF_LD_ABS and BPF_LD_IND instructions
Expand Down
2 changes: 1 addition & 1 deletion src/cc/libbpf
Submodule libbpf updated 49 files
+1 −1 .github/actions/setup/action.yml
+7 −2 .github/workflows/test.yml
+1 −1 BPF-CHECKPOINT-COMMIT
+1 −1 CHECKPOINT-COMMIT
+8 −0 include/linux/filter.h
+48 −1 include/uapi/linux/bpf.h
+2 −1 include/uapi/linux/btf.h
+2 −2 src/Makefile
+151 −81 src/bpf.c
+71 −3 src/bpf.h
+1 −1 src/bpf_core_read.h
+18 −8 src/bpf_gen_internal.h
+43 −1 src/bpf_helper_defs.h
+32 −0 src/bpf_tracing.h
+55 −22 src/btf.c
+71 −9 src/btf.h
+35 −13 src/btf_dump.c
+166 −49 src/gen_loader.c
+300 −185 src/libbpf.c
+128 −21 src/libbpf.h
+17 −0 src/libbpf.map
+13 −1 src/libbpf_common.h
+46 −28 src/libbpf_internal.h
+7 −0 src/libbpf_legacy.h
+10 −12 src/libbpf_probes.c
+11 −9 src/linker.c
+1 −1 src/relo_core.c
+14 −26 src/xsk.c
+52 −38 src/xsk.h
+2 −2 travis-ci/vmtest/build_selftests.sh
+8 −7 travis-ci/vmtest/configs/INDEX
+3 −0 travis-ci/vmtest/configs/blacklist/BLACKLIST-5.5.0
+52 −0 travis-ci/vmtest/configs/blacklist/BLACKLIST-latest.s390x
+2,703 −0 travis-ci/vmtest/configs/config-latest.s390x
+0 −0 travis-ci/vmtest/configs/config-latest.x86_64
+2 −0 travis-ci/vmtest/helpers.sh
+1 −53 travis-ci/vmtest/mkrootfs_arch.sh
+40 −0 travis-ci/vmtest/mkrootfs_debian.sh
+61 −0 travis-ci/vmtest/mkrootfs_tweak.sh
+1 −1 travis-ci/vmtest/prepare_selftests.sh
+122 −63 travis-ci/vmtest/run.sh
+11 −10 travis-ci/vmtest/run_selftests.sh
+1 −1 travis-ci/vmtest/run_vmtest.sh
+72 −0 travis-ci/vmtest/s390x-self-hosted-builder/README.md
+48 −0 travis-ci/vmtest/s390x-self-hosted-builder/actions-runner-libbpf.Dockerfile
+24 −0 travis-ci/vmtest/s390x-self-hosted-builder/actions-runner-libbpf.service
+40 −0 travis-ci/vmtest/s390x-self-hosted-builder/fs/usr/bin/actions-runner
+35 −0 travis-ci/vmtest/s390x-self-hosted-builder/fs/usr/bin/entrypoint
+11 −0 travis-ci/vmtest/s390x-self-hosted-builder/qemu-user-static.service
2 changes: 2 additions & 0 deletions src/cc/libbpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ static struct bpf_helper helpers[] = {
{"get_branch_snapshot", "5.16"},
{"trace_vprintk", "5.16"},
{"skc_to_unix_sock", "5.16"},
{"kallsyms_lookup_name", "5.16"},
{"find_vma", "5.17"},
};

static uint64_t ptr_to_u64(void *ptr)
Expand Down

0 comments on commit 9d6776b

Please sign in to comment.