mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-23 09:49:07 +08:00
Compare commits
206 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
051a4009f9 | ||
|
|
a3a5e9688a | ||
|
|
5569404346 | ||
|
|
e05f9be4f4 | ||
|
|
4d3535ff7b | ||
|
|
c66a9770e3 | ||
|
|
8262be6034 | ||
|
|
182e9dde0d | ||
|
|
30e2c16571 | ||
|
|
ebcae62e7e | ||
|
|
252ad1f3eb | ||
|
|
3e68c60659 | ||
|
|
42baefba71 | ||
|
|
46ecf7aef3 | ||
|
|
2981bb8d26 | ||
|
|
2042df2fed | ||
|
|
8c2c4c3451 | ||
|
|
21ae7bb113 | ||
|
|
b2a34784b2 | ||
|
|
d95b12da56 | ||
|
|
a1fd6dab54 | ||
|
|
fde1be5a9c | ||
|
|
6b08519a69 | ||
|
|
aff8028b6e | ||
|
|
10e321f100 | ||
|
|
8051a539d8 | ||
|
|
691c22dc0c | ||
|
|
5fe9c1217a | ||
|
|
78c76a1015 | ||
|
|
a741bc6479 | ||
|
|
65e4be6f5d | ||
|
|
3a2739aa8a | ||
|
|
dd2369d2a8 | ||
|
|
39f5b2e75e | ||
|
|
6969a44914 | ||
|
|
de2edae80d | ||
|
|
2ea4ba9c96 | ||
|
|
2dd5965052 | ||
|
|
ef8820fea8 | ||
|
|
eae38a781c | ||
|
|
83c2c20acb | ||
|
|
00ae5bac8f | ||
|
|
f99c252cbc | ||
|
|
5ae2a2621c | ||
|
|
5af3d86b5a | ||
|
|
c55abf0752 | ||
|
|
e30f758aab | ||
|
|
8caff995c7 | ||
|
|
539aa6bea5 | ||
|
|
224db2db07 | ||
|
|
e6725d2467 | ||
|
|
658ac1ec19 | ||
|
|
dd36215834 | ||
|
|
2811d54f8b | ||
|
|
be2dc73ee2 | ||
|
|
4953827790 | ||
|
|
d1fd50d475 | ||
|
|
f0c6b6bdfb | ||
|
|
475ee87969 | ||
|
|
f754860e35 | ||
|
|
78d61150e9 | ||
|
|
49280406a2 | ||
|
|
de58d0cccf | ||
|
|
6fa81d4dbe | ||
|
|
bc94c2b82f | ||
|
|
d47094a2ce | ||
|
|
4672fb6790 | ||
|
|
a8a505a36f | ||
|
|
e3b9cf7aaa | ||
|
|
76764b891b | ||
|
|
8ef6a6e709 | ||
|
|
44d5bc1709 | ||
|
|
95848b59b9 | ||
|
|
1bc08143b5 | ||
|
|
b9682e291d | ||
|
|
54fe2f1e26 | ||
|
|
fd28e0130a | ||
|
|
f908087023 | ||
|
|
b3b297aa16 | ||
|
|
6d0fcc3bd5 | ||
|
|
3706bf773b | ||
|
|
09718f4ecd | ||
|
|
8205f37a56 | ||
|
|
ecbd504994 | ||
|
|
b6dd2f2b7d | ||
|
|
a132697261 | ||
|
|
2d0aa12ea3 | ||
|
|
317ef1c295 | ||
|
|
80c7838600 | ||
|
|
750801a0d5 | ||
|
|
b5fd4c774d | ||
|
|
5a10cd2060 | ||
|
|
ff797cc905 | ||
|
|
21ea184818 | ||
|
|
760f71ec87 | ||
|
|
91e666c94c | ||
|
|
e40af4de0c | ||
|
|
5e359219aa | ||
|
|
488110df60 | ||
|
|
f007a6bfdf | ||
|
|
6f90197ab0 | ||
|
|
a388fcb0f5 | ||
|
|
2654268c79 | ||
|
|
e7647823a1 | ||
|
|
3cfff16611 | ||
|
|
7ac1547f32 | ||
|
|
897a0e79bd | ||
|
|
063eed6105 | ||
|
|
71e8af71c5 | ||
|
|
4023fbd99e | ||
|
|
b2e50daea8 | ||
|
|
b6f1385458 | ||
|
|
146bdd7535 | ||
|
|
76ee807ee3 | ||
|
|
32e5add48f | ||
|
|
120e99ccd8 | ||
|
|
3cf3c6cd26 | ||
|
|
f38fccf3cc | ||
|
|
08dc84e54a | ||
|
|
0102f65d72 | ||
|
|
f700cf6667 | ||
|
|
99921245f0 | ||
|
|
37c5973bb7 | ||
|
|
2200fefd87 | ||
|
|
5f50b4b8c9 | ||
|
|
787abf721e | ||
|
|
820813bd1b | ||
|
|
8333e57e91 | ||
|
|
8052936468 | ||
|
|
8b14cb43ff | ||
|
|
011700e68d | ||
|
|
106e7dcf58 | ||
|
|
3a2ebfc21e | ||
|
|
91001a9923 | ||
|
|
6384ee1968 | ||
|
|
3f9447bf92 | ||
|
|
3b80b6c77e | ||
|
|
78cdb58bdf | ||
|
|
4b60f82516 | ||
|
|
2b28b4fa4d | ||
|
|
448789ba27 | ||
|
|
a3abae5122 | ||
|
|
bb5e70706a | ||
|
|
994aae7fc8 | ||
|
|
a6e9cf1532 | ||
|
|
06ae1b0e38 | ||
|
|
b228eb84f1 | ||
|
|
5bd7cae11d | ||
|
|
a454a08f53 | ||
|
|
829e50fc15 | ||
|
|
66780a46cb | ||
|
|
7bc52e6602 | ||
|
|
7267270f5f | ||
|
|
b16bc44bd3 | ||
|
|
4cdad1b34b | ||
|
|
f557d9e1fc | ||
|
|
e82da07e2d | ||
|
|
c42c140954 | ||
|
|
e565f2bfe9 | ||
|
|
2bd0d158d4 | ||
|
|
bbe442da7a | ||
|
|
3f7b5b32b8 | ||
|
|
5a913e9401 | ||
|
|
cead23ac75 | ||
|
|
66091d267c | ||
|
|
2819b00b74 | ||
|
|
cb4d6d6f1a | ||
|
|
4f160ed607 | ||
|
|
647df00570 | ||
|
|
44fdfd8e6e | ||
|
|
75d2adfe84 | ||
|
|
f0f75f36a7 | ||
|
|
a8fa8b6eea | ||
|
|
8a1acb7dfe | ||
|
|
b6e179e67c | ||
|
|
d81d872279 | ||
|
|
4001a658e0 | ||
|
|
dc1cd8503f | ||
|
|
9a3a42608d | ||
|
|
63c78982c7 | ||
|
|
28e26bdc3e | ||
|
|
7297e38474 | ||
|
|
a44116bb1f | ||
|
|
4069acb787 | ||
|
|
c7d2b1f31b | ||
|
|
b06fb2312c | ||
|
|
1e2c7823f5 | ||
|
|
160917756a | ||
|
|
4a2f7ac55f | ||
|
|
a8a3089b5e | ||
|
|
475843fbf4 | ||
|
|
f89dab0903 | ||
|
|
cdb21b05e5 | ||
|
|
a734ef0803 | ||
|
|
3c4954d5a6 | ||
|
|
c3b1c66810 | ||
|
|
dc70da9c70 | ||
|
|
9106c3028b | ||
|
|
3bde6ca8e8 | ||
|
|
d13e96ee32 | ||
|
|
dc1b3e2a45 | ||
|
|
30c61391bf | ||
|
|
e6f118dddd | ||
|
|
5d4075553b | ||
|
|
5205159359 | ||
|
|
87d7f1a32b |
@@ -1 +1 @@
|
|||||||
3fb1a96a91120877488071a167d26d76be4be977
|
1a3449c19407a28f7019a887cdf0d6ba2444751a
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
06a4ec1d9dc652e17ee3ac2ceb6c7cf6c2b75cdd
|
3db1a3fa98808aa90f95ec3e0fa2fc7abf28f5c9
|
||||||
|
|||||||
42
README.md
42
README.md
@@ -1,17 +1,11 @@
|
|||||||
This is a mirror of [bpf-next Linux source
|
BPF/libbpf usage and questions
|
||||||
tree](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next)'s
|
==============================
|
||||||
`tools/lib/bpf` directory plus its supporting header files.
|
|
||||||
|
|
||||||
All the gory details of syncing can be found in `scripts/sync-kernel.sh`
|
Please check out [libbpf-bootstrap](https://github.com/libbpf/libbpf-bootstrap)
|
||||||
script.
|
and [the companion blog post](https://nakryiko.com/posts/libbpf-bootstrap/) for
|
||||||
|
the examples of building BPF applications with libbpf.
|
||||||
Some header files in this repo (`include/linux/*.h`) are reduced versions of
|
[libbpf-tools](https://github.com/iovisor/bcc/tree/master/libbpf-tools) are also
|
||||||
their counterpart files at
|
a good source of the real-world libbpf-based tracing tools.
|
||||||
[bpf-next](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/)'s
|
|
||||||
`tools/include/linux/*.h` to make compilation successful.
|
|
||||||
|
|
||||||
BPF questions
|
|
||||||
=============
|
|
||||||
|
|
||||||
All general BPF questions, including kernel functionality, libbpf APIs and
|
All general BPF questions, including kernel functionality, libbpf APIs and
|
||||||
their application, should be sent to bpf@vger.kernel.org mailing list. You can
|
their application, should be sent to bpf@vger.kernel.org mailing list. You can
|
||||||
@@ -26,7 +20,7 @@ should be opened only for dealing with issues pertaining to specific way this
|
|||||||
libbpf mirror repo is set up and organized.
|
libbpf mirror repo is set up and organized.
|
||||||
|
|
||||||
Build
|
Build
|
||||||
[](https://travis-ci.org/libbpf/libbpf)
|
[](https://travis-ci.com/github/libbpf/libbpf)
|
||||||
[](https://lgtm.com/projects/g/libbpf/libbpf/alerts/)
|
[](https://lgtm.com/projects/g/libbpf/libbpf/alerts/)
|
||||||
[](https://scan.coverity.com/projects/libbpf)
|
[](https://scan.coverity.com/projects/libbpf)
|
||||||
=====
|
=====
|
||||||
@@ -67,8 +61,9 @@ Distributions
|
|||||||
Distributions packaging libbpf from this mirror:
|
Distributions packaging libbpf from this mirror:
|
||||||
- [Fedora](https://src.fedoraproject.org/rpms/libbpf)
|
- [Fedora](https://src.fedoraproject.org/rpms/libbpf)
|
||||||
- [Gentoo](https://packages.gentoo.org/packages/dev-libs/libbpf)
|
- [Gentoo](https://packages.gentoo.org/packages/dev-libs/libbpf)
|
||||||
- [Debian](https://packages.debian.org/sid/libbpf-dev)
|
- [Debian](https://packages.debian.org/source/sid/libbpf)
|
||||||
- [Arch](https://www.archlinux.org/packages/extra/x86_64/libbpf/)
|
- [Arch](https://www.archlinux.org/packages/extra/x86_64/libbpf/)
|
||||||
|
- [Ubuntu](https://packages.ubuntu.com/source/groovy/libbpf)
|
||||||
|
|
||||||
Benefits of packaging from the mirror over packaging from kernel sources:
|
Benefits of packaging from the mirror over packaging from kernel sources:
|
||||||
- Consistent versioning across distributions.
|
- Consistent versioning across distributions.
|
||||||
@@ -102,6 +97,7 @@ Some major Linux distributions come with kernel BTF already built in:
|
|||||||
- RHEL 8.2+
|
- RHEL 8.2+
|
||||||
- OpenSUSE Tumbleweed (in the next release, as of 2020-06-04)
|
- OpenSUSE Tumbleweed (in the next release, as of 2020-06-04)
|
||||||
- Arch Linux (from kernel 5.7.1.arch1-1)
|
- Arch Linux (from kernel 5.7.1.arch1-1)
|
||||||
|
- Ubuntu 20.10
|
||||||
|
|
||||||
If your kernel doesn't come with BTF built-in, you'll need to build custom
|
If your kernel doesn't come with BTF built-in, you'll need to build custom
|
||||||
kernel. You'll need:
|
kernel. You'll need:
|
||||||
@@ -121,6 +117,8 @@ distributions have Clang/LLVM 10+ packaged by default:
|
|||||||
- Fedora 32+
|
- Fedora 32+
|
||||||
- Ubuntu 20.04+
|
- Ubuntu 20.04+
|
||||||
- Arch Linux
|
- Arch Linux
|
||||||
|
- Ubuntu 20.10 (LLVM 11)
|
||||||
|
- Debian 11 (LLVM 11)
|
||||||
|
|
||||||
Otherwise, please make sure to update it on your system.
|
Otherwise, please make sure to update it on your system.
|
||||||
|
|
||||||
@@ -133,6 +131,20 @@ use it:
|
|||||||
converting some more to both contribute to the BPF community and gain some
|
converting some more to both contribute to the BPF community and gain some
|
||||||
more experience with it.
|
more experience with it.
|
||||||
|
|
||||||
|
Details
|
||||||
|
=======
|
||||||
|
This is a mirror of [bpf-next Linux source
|
||||||
|
tree](https://kernel.googlesource.com/pub/scm/linux/kernel/git/bpf/bpf-next)'s
|
||||||
|
`tools/lib/bpf` directory plus its supporting header files.
|
||||||
|
|
||||||
|
All the gory details of syncing can be found in `scripts/sync-kernel.sh`
|
||||||
|
script.
|
||||||
|
|
||||||
|
Some header files in this repo (`include/linux/*.h`) are reduced versions of
|
||||||
|
their counterpart files at
|
||||||
|
[bpf-next](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/)'s
|
||||||
|
`tools/include/linux/*.h` to make compilation successful.
|
||||||
|
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,14 @@
|
|||||||
|
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
|
|
||||||
|
#define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \
|
||||||
|
((struct bpf_insn) { \
|
||||||
|
.code = CODE, \
|
||||||
|
.dst_reg = DST, \
|
||||||
|
.src_reg = SRC, \
|
||||||
|
.off = OFF, \
|
||||||
|
.imm = IMM })
|
||||||
|
|
||||||
#define BPF_ALU64_IMM(OP, DST, IMM) \
|
#define BPF_ALU64_IMM(OP, DST, IMM) \
|
||||||
((struct bpf_insn) { \
|
((struct bpf_insn) { \
|
||||||
.code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
|
.code = BPF_ALU64 | BPF_OP(OP) | BPF_K, \
|
||||||
|
|||||||
@@ -72,11 +72,20 @@ static inline void list_del(struct list_head *entry)
|
|||||||
entry->prev = LIST_POISON2;
|
entry->prev = LIST_POISON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int list_empty(const struct list_head *head)
|
||||||
|
{
|
||||||
|
return head->next == head;
|
||||||
|
}
|
||||||
|
|
||||||
#define list_entry(ptr, type, member) \
|
#define list_entry(ptr, type, member) \
|
||||||
container_of(ptr, type, member)
|
container_of(ptr, type, member)
|
||||||
#define list_first_entry(ptr, type, member) \
|
#define list_first_entry(ptr, type, member) \
|
||||||
list_entry((ptr)->next, type, member)
|
list_entry((ptr)->next, type, member)
|
||||||
#define list_next_entry(pos, member) \
|
#define list_next_entry(pos, member) \
|
||||||
list_entry((pos)->member.next, typeof(*(pos)), member)
|
list_entry((pos)->member.next, typeof(*(pos)), member)
|
||||||
|
#define list_for_each_entry(pos, head, member) \
|
||||||
|
for (pos = list_first_entry(head, typeof(*pos), member); \
|
||||||
|
&pos->member != (head); \
|
||||||
|
pos = list_next_entry(pos, member))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
|
|
||||||
/* Copyright (C) 2018 Netronome Systems, Inc. */
|
|
||||||
|
|
||||||
#ifndef __TOOLS_LIBC_COMPAT_H
|
|
||||||
#define __TOOLS_LIBC_COMPAT_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <linux/overflow.h>
|
|
||||||
|
|
||||||
#ifdef COMPAT_NEED_REALLOCARRAY
|
|
||||||
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
size_t bytes;
|
|
||||||
|
|
||||||
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
|
|
||||||
return NULL;
|
|
||||||
return realloc(ptr, bytes);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -409,6 +409,8 @@ enum {
|
|||||||
IFLA_MACVLAN_MACADDR,
|
IFLA_MACVLAN_MACADDR,
|
||||||
IFLA_MACVLAN_MACADDR_DATA,
|
IFLA_MACVLAN_MACADDR_DATA,
|
||||||
IFLA_MACVLAN_MACADDR_COUNT,
|
IFLA_MACVLAN_MACADDR_COUNT,
|
||||||
|
IFLA_MACVLAN_BC_QUEUE_LEN,
|
||||||
|
IFLA_MACVLAN_BC_QUEUE_LEN_USED,
|
||||||
__IFLA_MACVLAN_MAX,
|
__IFLA_MACVLAN_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Usage: check-reallocarray.sh cc_path [cc_args...]
|
|
||||||
|
|
||||||
tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c)
|
|
||||||
ofile=${tfile%.c}.o
|
|
||||||
|
|
||||||
cat > $tfile <<EOL
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
return !!reallocarray(NULL, 1, 1);
|
|
||||||
}
|
|
||||||
EOL
|
|
||||||
|
|
||||||
"$@" $tfile -o $ofile >/dev/null 2>&1
|
|
||||||
if [ $? -ne 0 ]; then echo "FAIL"; fi
|
|
||||||
/bin/rm -f $tfile $ofile
|
|
||||||
@@ -6,7 +6,6 @@ usage () {
|
|||||||
echo "Set BPF_NEXT_BASELINE to override bpf-next tree commit, otherwise read from <libbpf-repo>/CHECKPOINT-COMMIT."
|
echo "Set BPF_NEXT_BASELINE to override bpf-next tree commit, otherwise read from <libbpf-repo>/CHECKPOINT-COMMIT."
|
||||||
echo "Set BPF_BASELINE to override bpf tree commit, otherwise read from <libbpf-repo>/BPF-CHECKPOINT-COMMIT."
|
echo "Set BPF_BASELINE to override bpf tree commit, otherwise read from <libbpf-repo>/BPF-CHECKPOINT-COMMIT."
|
||||||
echo "Set MANUAL_MODE to 1 to manually control every cherry-picked commits."
|
echo "Set MANUAL_MODE to 1 to manually control every cherry-picked commits."
|
||||||
echo "Set IGNORE_CONSISTENCY to 1 to ignore failed contents consistency check."
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +45,12 @@ PATH_MAP=( \
|
|||||||
[tools/include/uapi/linux/if_link.h]=include/uapi/linux/if_link.h \
|
[tools/include/uapi/linux/if_link.h]=include/uapi/linux/if_link.h \
|
||||||
[tools/include/uapi/linux/if_xdp.h]=include/uapi/linux/if_xdp.h \
|
[tools/include/uapi/linux/if_xdp.h]=include/uapi/linux/if_xdp.h \
|
||||||
[tools/include/uapi/linux/netlink.h]=include/uapi/linux/netlink.h \
|
[tools/include/uapi/linux/netlink.h]=include/uapi/linux/netlink.h \
|
||||||
[tools/include/tools/libc_compat.h]=include/tools/libc_compat.h \
|
|
||||||
)
|
)
|
||||||
|
|
||||||
LIBBPF_PATHS="${!PATH_MAP[@]} :^tools/lib/bpf/Makefile :^tools/lib/bpf/Build :^tools/lib/bpf/.gitignore"
|
LIBBPF_PATHS="${!PATH_MAP[@]} :^tools/lib/bpf/Makefile :^tools/lib/bpf/Build :^tools/lib/bpf/.gitignore :^tools/include/tools/libc_compat.h"
|
||||||
LIBBPF_VIEW_PATHS="${PATH_MAP[@]}"
|
LIBBPF_VIEW_PATHS="${PATH_MAP[@]}"
|
||||||
LIBBPF_VIEW_EXCLUDE_REGEX='^src/(Makefile|Build|test_libbpf\.c|bpf_helper_defs\.h|\.gitignore)$'
|
LIBBPF_VIEW_EXCLUDE_REGEX='^src/(Makefile|Build|test_libbpf\.c|bpf_helper_defs\.h|\.gitignore)$'
|
||||||
|
LINUX_VIEW_EXCLUDE_REGEX='^include/tools/libc_compat.h$'
|
||||||
|
|
||||||
LIBBPF_TREE_FILTER="mkdir -p __libbpf/include/uapi/linux __libbpf/include/tools && "$'\\\n'
|
LIBBPF_TREE_FILTER="mkdir -p __libbpf/include/uapi/linux __libbpf/include/tools && "$'\\\n'
|
||||||
for p in "${!PATH_MAP[@]}"; do
|
for p in "${!PATH_MAP[@]}"; do
|
||||||
@@ -137,6 +136,7 @@ cherry_pick_commits()
|
|||||||
echo "Warning! Cherry-picking '${desc} failed, checking if it's non-libbpf files causing problems..."
|
echo "Warning! Cherry-picking '${desc} failed, checking if it's non-libbpf files causing problems..."
|
||||||
libbpf_conflict_cnt=$(git diff --name-only --diff-filter=U -- ${LIBBPF_PATHS[@]} | wc -l)
|
libbpf_conflict_cnt=$(git diff --name-only --diff-filter=U -- ${LIBBPF_PATHS[@]} | wc -l)
|
||||||
conflict_cnt=$(git diff --name-only | wc -l)
|
conflict_cnt=$(git diff --name-only | wc -l)
|
||||||
|
prompt_resolution=1
|
||||||
|
|
||||||
if ((${libbpf_conflict_cnt} == 0)); then
|
if ((${libbpf_conflict_cnt} == 0)); then
|
||||||
echo "Looks like only non-libbpf files have conflicts, ignoring..."
|
echo "Looks like only non-libbpf files have conflicts, ignoring..."
|
||||||
@@ -152,15 +152,37 @@ cherry_pick_commits()
|
|||||||
echo "Error! That still failed! Please resolve manually."
|
echo "Error! That still failed! Please resolve manually."
|
||||||
else
|
else
|
||||||
echo "Success! All cherry-pick conflicts were resolved for '${desc}'!"
|
echo "Success! All cherry-pick conflicts were resolved for '${desc}'!"
|
||||||
continue
|
prompt_resolution=0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "Error! Cherry-picking '${desc}' failed, please fix manually and press <return> to proceed..."
|
if ((${prompt_resolution} == 1)); then
|
||||||
|
read -p "Error! Cherry-picking '${desc}' failed, please fix manually and press <return> to proceed..."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Append signature of just cherry-picked commit to avoid
|
||||||
|
# potentially cherry-picking the same commit twice later when
|
||||||
|
# processing bpf tree commits. At this point we don't know yet
|
||||||
|
# the final commit sha in libbpf repo, so we record Linux SHA
|
||||||
|
# instead as LINUX_<sha>.
|
||||||
|
echo LINUX_$(git log --pretty='%h' -n1) "${signature}" >> ${TMP_DIR}/libbpf_commits.txt
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup()
|
||||||
|
{
|
||||||
|
echo "Cleaning up..."
|
||||||
|
rm -r ${TMP_DIR}
|
||||||
|
cd_to ${LINUX_REPO}
|
||||||
|
git checkout ${TIP_SYM_REF}
|
||||||
|
git branch -D ${BASELINE_TAG} ${TIP_TAG} ${BPF_BASELINE_TAG} ${BPF_TIP_TAG} \
|
||||||
|
${SQUASH_BASE_TAG} ${SQUASH_TIP_TAG} ${VIEW_TAG} || true
|
||||||
|
|
||||||
|
cd_to .
|
||||||
|
echo "DONE."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cd_to ${LIBBPF_REPO}
|
cd_to ${LIBBPF_REPO}
|
||||||
GITHUB_ABS_DIR=$(pwd)
|
GITHUB_ABS_DIR=$(pwd)
|
||||||
echo "Dumping existing libbpf commit signatures..."
|
echo "Dumping existing libbpf commit signatures..."
|
||||||
@@ -226,6 +248,7 @@ FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --prune-empty -f --subdirector
|
|||||||
COMMIT_CNT=$(git rev-list --count ${SQUASH_BASE_TAG}..${SQUASH_TIP_TAG})
|
COMMIT_CNT=$(git rev-list --count ${SQUASH_BASE_TAG}..${SQUASH_TIP_TAG})
|
||||||
if ((${COMMIT_CNT} <= 0)); then
|
if ((${COMMIT_CNT} <= 0)); then
|
||||||
echo "No new changes to apply, we are done!"
|
echo "No new changes to apply, we are done!"
|
||||||
|
cleanup
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -237,7 +260,7 @@ cd_to ${LIBBPF_REPO}
|
|||||||
git checkout -b ${LIBBPF_SYNC_TAG}
|
git checkout -b ${LIBBPF_SYNC_TAG}
|
||||||
|
|
||||||
for patch in $(ls -1 ${TMP_DIR}/patches | tail -n +2); do
|
for patch in $(ls -1 ${TMP_DIR}/patches | tail -n +2); do
|
||||||
if ! git am --committer-date-is-author-date "${TMP_DIR}/patches/${patch}"; then
|
if ! git am --3way --committer-date-is-author-date "${TMP_DIR}/patches/${patch}"; then
|
||||||
read -p "Applying ${TMP_DIR}/patches/${patch} failed, please resolve manually and press <return> to proceed..."
|
read -p "Applying ${TMP_DIR}/patches/${patch} failed, please resolve manually and press <return> to proceed..."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -286,7 +309,7 @@ cd_to ${LINUX_REPO}
|
|||||||
git checkout -b ${VIEW_TAG} ${TIP_COMMIT}
|
git checkout -b ${VIEW_TAG} ${TIP_COMMIT}
|
||||||
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --tree-filter "${LIBBPF_TREE_FILTER}" ${VIEW_TAG}^..${VIEW_TAG}
|
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --tree-filter "${LIBBPF_TREE_FILTER}" ${VIEW_TAG}^..${VIEW_TAG}
|
||||||
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --subdirectory-filter __libbpf ${VIEW_TAG}^..${VIEW_TAG}
|
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --subdirectory-filter __libbpf ${VIEW_TAG}^..${VIEW_TAG}
|
||||||
git ls-files -- ${LIBBPF_VIEW_PATHS[@]} > ${TMP_DIR}/linux-view.ls
|
git ls-files -- ${LIBBPF_VIEW_PATHS[@]} | grep -v -E "${LINUX_VIEW_EXCLUDE_REGEX}" > ${TMP_DIR}/linux-view.ls
|
||||||
|
|
||||||
cd_to ${LIBBPF_REPO}
|
cd_to ${LIBBPF_REPO}
|
||||||
git ls-files -- ${LIBBPF_VIEW_PATHS[@]} | grep -v -E "${LIBBPF_VIEW_EXCLUDE_REGEX}" > ${TMP_DIR}/github-view.ls
|
git ls-files -- ${LIBBPF_VIEW_PATHS[@]} | grep -v -E "${LIBBPF_VIEW_EXCLUDE_REGEX}" > ${TMP_DIR}/github-view.ls
|
||||||
@@ -304,19 +327,17 @@ done
|
|||||||
if ((${CONSISTENT} == 1)); then
|
if ((${CONSISTENT} == 1)); then
|
||||||
echo "Great! Content is identical!"
|
echo "Great! Content is identical!"
|
||||||
else
|
else
|
||||||
echo "Unfortunately, there are consistency problems!"
|
ignore_inconsistency=n
|
||||||
if ((${IGNORE_CONSISTENCY-0} != 1)); then
|
echo "Unfortunately, there are some inconsistencies, please double check."
|
||||||
exit 4
|
read -p "Does everything look good? [y/N]: " ignore_inconsistency
|
||||||
fi
|
case "${ignore_inconsistency}" in
|
||||||
|
"y" | "Y")
|
||||||
|
echo "Ok, proceeding..."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Oops, exiting with error..."
|
||||||
|
exit 4
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Cleaning up..."
|
cleanup
|
||||||
rm -r ${TMP_DIR}
|
|
||||||
cd_to ${LINUX_REPO}
|
|
||||||
git checkout ${TIP_SYM_REF}
|
|
||||||
git branch -D ${BASELINE_TAG} ${TIP_TAG} ${BPF_BASELINE_TAG} ${BPF_TIP_TAG} \
|
|
||||||
${SQUASH_BASE_TAG} ${SQUASH_TIP_TAG} ${VIEW_TAG}
|
|
||||||
|
|
||||||
cd_to .
|
|
||||||
echo "DONE."
|
|
||||||
|
|
||||||
|
|||||||
83
src/Makefile
83
src/Makefile
@@ -1,5 +1,13 @@
|
|||||||
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
|
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
|
||||||
|
|
||||||
|
ifeq ($(V),1)
|
||||||
|
Q =
|
||||||
|
msg =
|
||||||
|
else
|
||||||
|
Q = @
|
||||||
|
msg = @printf ' %-8s %s%s\n' "$(1)" "$(notdir $(2))" "$(if $(3), $(3))";
|
||||||
|
endif
|
||||||
|
|
||||||
LIBBPF_VERSION := $(shell \
|
LIBBPF_VERSION := $(shell \
|
||||||
grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
|
grep -oE '^LIBBPF_([0-9.]+)' libbpf.map | \
|
||||||
sort -rV | head -n1 | cut -d'_' -f2)
|
sort -rV | head -n1 | cut -d'_' -f2)
|
||||||
@@ -10,11 +18,6 @@ TOPDIR = ..
|
|||||||
INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
|
INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi
|
||||||
ALL_CFLAGS := $(INCLUDES)
|
ALL_CFLAGS := $(INCLUDES)
|
||||||
|
|
||||||
FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh $(CC))
|
|
||||||
ifneq ($(FEATURE_REALLOCARRAY),)
|
|
||||||
ALL_CFLAGS += -DCOMPAT_NEED_REALLOCARRAY
|
|
||||||
endif
|
|
||||||
|
|
||||||
SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED
|
SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED
|
||||||
|
|
||||||
CFLAGS ?= -g -O2 -Werror -Wall
|
CFLAGS ?= -g -O2 -Werror -Wall
|
||||||
@@ -24,8 +27,8 @@ ifdef NO_PKG_CONFIG
|
|||||||
ALL_LDFLAGS += -lelf -lz
|
ALL_LDFLAGS += -lelf -lz
|
||||||
else
|
else
|
||||||
PKG_CONFIG ?= pkg-config
|
PKG_CONFIG ?= pkg-config
|
||||||
ALL_CFLAGS += $(shell $(PKG_CONFIG) --cflags libelf)
|
ALL_CFLAGS += $(shell $(PKG_CONFIG) --cflags libelf zlib)
|
||||||
ALL_LDFLAGS += $(shell $(PKG_CONFIG) --libs libelf)
|
ALL_LDFLAGS += $(shell $(PKG_CONFIG) --libs libelf zlib)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJDIR ?= .
|
OBJDIR ?= .
|
||||||
@@ -63,6 +66,13 @@ else
|
|||||||
LIBSUBDIR := lib
|
LIBSUBDIR := lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# By default let the pc file itself use ${prefix} in includedir/libdir so that
|
||||||
|
# the prefix can be overridden at runtime (eg: --define-prefix)
|
||||||
|
ifndef LIBDIR
|
||||||
|
LIBDIR_PC := $$\{prefix\}/$(LIBSUBDIR)
|
||||||
|
else
|
||||||
|
LIBDIR_PC := $(LIBDIR)
|
||||||
|
endif
|
||||||
PREFIX ?= /usr
|
PREFIX ?= /usr
|
||||||
LIBDIR ?= $(PREFIX)/$(LIBSUBDIR)
|
LIBDIR ?= $(PREFIX)/$(LIBSUBDIR)
|
||||||
INCLUDEDIR ?= $(PREFIX)/include
|
INCLUDEDIR ?= $(PREFIX)/include
|
||||||
@@ -73,50 +83,54 @@ TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags)
|
|||||||
all: $(STATIC_LIBS) $(SHARED_LIBS) $(PC_FILE)
|
all: $(STATIC_LIBS) $(SHARED_LIBS) $(PC_FILE)
|
||||||
|
|
||||||
$(OBJDIR)/libbpf.a: $(STATIC_OBJS)
|
$(OBJDIR)/libbpf.a: $(STATIC_OBJS)
|
||||||
$(AR) rcs $@ $^
|
$(call msg,AR,$@)
|
||||||
|
$(Q)$(AR) rcs $@ $^
|
||||||
|
|
||||||
$(OBJDIR)/libbpf.so: $(OBJDIR)/libbpf.so.$(LIBBPF_MAJOR_VERSION)
|
$(OBJDIR)/libbpf.so: $(OBJDIR)/libbpf.so.$(LIBBPF_MAJOR_VERSION)
|
||||||
ln -sf $(^F) $@
|
$(Q)ln -sf $(^F) $@
|
||||||
|
|
||||||
$(OBJDIR)/libbpf.so.$(LIBBPF_MAJOR_VERSION): $(OBJDIR)/libbpf.so.$(LIBBPF_VERSION)
|
$(OBJDIR)/libbpf.so.$(LIBBPF_MAJOR_VERSION): $(OBJDIR)/libbpf.so.$(LIBBPF_VERSION)
|
||||||
ln -sf $(^F) $@
|
$(Q)ln -sf $(^F) $@
|
||||||
|
|
||||||
$(OBJDIR)/libbpf.so.$(LIBBPF_VERSION): $(SHARED_OBJS)
|
$(OBJDIR)/libbpf.so.$(LIBBPF_VERSION): $(SHARED_OBJS)
|
||||||
$(CC) -shared -Wl,--version-script=$(VERSION_SCRIPT) \
|
$(call msg,CC,$@)
|
||||||
-Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
|
$(Q)$(CC) -shared -Wl,--version-script=$(VERSION_SCRIPT) \
|
||||||
$^ $(ALL_LDFLAGS) -o $@
|
-Wl,-soname,libbpf.so.$(LIBBPF_MAJOR_VERSION) \
|
||||||
|
$^ $(ALL_LDFLAGS) -o $@
|
||||||
|
|
||||||
$(OBJDIR)/libbpf.pc:
|
$(OBJDIR)/libbpf.pc:
|
||||||
sed -e "s|@PREFIX@|$(PREFIX)|" \
|
$(Q)sed -e "s|@PREFIX@|$(PREFIX)|" \
|
||||||
-e "s|@LIBDIR@|$(LIBDIR)|" \
|
-e "s|@LIBDIR@|$(LIBDIR_PC)|" \
|
||||||
-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
|
-e "s|@VERSION@|$(LIBBPF_VERSION)|" \
|
||||||
< libbpf.pc.template > $@
|
< libbpf.pc.template > $@
|
||||||
|
|
||||||
$(STATIC_OBJDIR):
|
$(STATIC_OBJDIR) $(SHARED_OBJDIR):
|
||||||
mkdir -p $(STATIC_OBJDIR)
|
$(call msg,MKDIR,$@)
|
||||||
|
$(Q)mkdir -p $@
|
||||||
$(SHARED_OBJDIR):
|
|
||||||
mkdir -p $(SHARED_OBJDIR)
|
|
||||||
|
|
||||||
$(STATIC_OBJDIR)/%.o: %.c | $(STATIC_OBJDIR)
|
$(STATIC_OBJDIR)/%.o: %.c | $(STATIC_OBJDIR)
|
||||||
$(CC) $(ALL_CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(call msg,CC,$@)
|
||||||
|
$(Q)$(CC) $(ALL_CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(SHARED_OBJDIR)/%.o: %.c | $(SHARED_OBJDIR)
|
$(SHARED_OBJDIR)/%.o: %.c | $(SHARED_OBJDIR)
|
||||||
$(CC) $(ALL_CFLAGS) $(SHARED_CFLAGS) $(CPPFLAGS) -c $< -o $@
|
$(call msg,CC,$@)
|
||||||
|
$(Q)$(CC) $(ALL_CFLAGS) $(SHARED_CFLAGS) $(CPPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
define do_install
|
define do_install
|
||||||
if [ ! -d '$(DESTDIR)$2' ]; then \
|
$(call msg,INSTALL,$1)
|
||||||
|
$(Q)if [ ! -d '$(DESTDIR)$2' ]; then \
|
||||||
$(INSTALL) -d -m 755 '$(DESTDIR)$2'; \
|
$(INSTALL) -d -m 755 '$(DESTDIR)$2'; \
|
||||||
fi; \
|
fi;
|
||||||
$(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR)$2'
|
$(Q)$(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR)$2'
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Preserve symlinks at installation.
|
# Preserve symlinks at installation.
|
||||||
define do_s_install
|
define do_s_install
|
||||||
if [ ! -d '$(DESTDIR)$2' ]; then \
|
$(call msg,INSTALL,$1)
|
||||||
|
$(Q)if [ ! -d '$(DESTDIR)$2' ]; then \
|
||||||
$(INSTALL) -d -m 755 '$(DESTDIR)$2'; \
|
$(INSTALL) -d -m 755 '$(DESTDIR)$2'; \
|
||||||
fi; \
|
fi;
|
||||||
cp -fpR $1 '$(DESTDIR)$2'
|
$(Q)cp -fpR $1 '$(DESTDIR)$2'
|
||||||
endef
|
endef
|
||||||
|
|
||||||
install: all install_headers install_pkgconfig
|
install: all install_headers install_pkgconfig
|
||||||
@@ -134,13 +148,16 @@ install_pkgconfig: $(PC_FILE)
|
|||||||
$(call do_install,$(PC_FILE),$(LIBDIR)/pkgconfig,644)
|
$(call do_install,$(PC_FILE),$(LIBDIR)/pkgconfig,644)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o *.a *.so *.so.* *.pc $(SHARED_OBJDIR) $(STATIC_OBJDIR)
|
$(call msg,CLEAN)
|
||||||
|
$(Q)rm -rf *.o *.a *.so *.so.* *.pc $(SHARED_OBJDIR) $(STATIC_OBJDIR)
|
||||||
|
|
||||||
.PHONY: cscope tags
|
.PHONY: cscope tags
|
||||||
cscope:
|
cscope:
|
||||||
ls *.c *.h > cscope.files
|
$(call msg,CSCOPE)
|
||||||
cscope -b -q -f cscope.out
|
$(Q)ls *.c *.h > cscope.files
|
||||||
|
$(Q)cscope -b -q -f cscope.out
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
rm -f TAGS tags
|
$(call msg,CTAGS)
|
||||||
ls *.c *.h | xargs $(TAGS_PROG) -a
|
$(Q)rm -f TAGS tags
|
||||||
|
$(Q)ls *.c *.h | xargs $(TAGS_PROG) -a
|
||||||
|
|||||||
174
src/bpf.c
174
src/bpf.c
@@ -32,9 +32,6 @@
|
|||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When building perf, unistd.h is overridden. __NR_bpf is
|
* When building perf, unistd.h is overridden. __NR_bpf is
|
||||||
* required to be defined explicitly.
|
* required to be defined explicitly.
|
||||||
@@ -70,11 +67,12 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
|
|||||||
|
|
||||||
static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size)
|
static inline int sys_bpf_prog_load(union bpf_attr *attr, unsigned int size)
|
||||||
{
|
{
|
||||||
|
int retries = 5;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fd = sys_bpf(BPF_PROG_LOAD, attr, size);
|
fd = sys_bpf(BPF_PROG_LOAD, attr, size);
|
||||||
} while (fd < 0 && errno == EAGAIN);
|
} while (fd < 0 && errno == EAGAIN && retries-- > 0);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -217,59 +215,55 @@ alloc_zero_tailing_info(const void *orecord, __u32 cnt,
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
|
int libbpf__bpf_prog_load(const struct bpf_prog_load_params *load_attr)
|
||||||
char *log_buf, size_t log_buf_sz)
|
|
||||||
{
|
{
|
||||||
void *finfo = NULL, *linfo = NULL;
|
void *finfo = NULL, *linfo = NULL;
|
||||||
union bpf_attr attr;
|
union bpf_attr attr;
|
||||||
__u32 log_level;
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!load_attr || !log_buf != !log_buf_sz)
|
if (!load_attr->log_buf != !load_attr->log_buf_sz)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
log_level = load_attr->log_level;
|
if (load_attr->log_level > (4 | 2 | 1) || (load_attr->log_level && !load_attr->log_buf))
|
||||||
if (log_level > (4 | 2 | 1) || (log_level && !log_buf))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
memset(&attr, 0, sizeof(attr));
|
memset(&attr, 0, sizeof(attr));
|
||||||
attr.prog_type = load_attr->prog_type;
|
attr.prog_type = load_attr->prog_type;
|
||||||
attr.expected_attach_type = load_attr->expected_attach_type;
|
attr.expected_attach_type = load_attr->expected_attach_type;
|
||||||
if (attr.prog_type == BPF_PROG_TYPE_STRUCT_OPS ||
|
|
||||||
attr.prog_type == BPF_PROG_TYPE_LSM) {
|
if (load_attr->attach_prog_fd)
|
||||||
attr.attach_btf_id = load_attr->attach_btf_id;
|
|
||||||
} else if (attr.prog_type == BPF_PROG_TYPE_TRACING ||
|
|
||||||
attr.prog_type == BPF_PROG_TYPE_EXT) {
|
|
||||||
attr.attach_btf_id = load_attr->attach_btf_id;
|
|
||||||
attr.attach_prog_fd = load_attr->attach_prog_fd;
|
attr.attach_prog_fd = load_attr->attach_prog_fd;
|
||||||
} else {
|
else
|
||||||
attr.prog_ifindex = load_attr->prog_ifindex;
|
attr.attach_btf_obj_fd = load_attr->attach_btf_obj_fd;
|
||||||
attr.kern_version = load_attr->kern_version;
|
attr.attach_btf_id = load_attr->attach_btf_id;
|
||||||
}
|
|
||||||
attr.insn_cnt = (__u32)load_attr->insns_cnt;
|
attr.prog_ifindex = load_attr->prog_ifindex;
|
||||||
|
attr.kern_version = load_attr->kern_version;
|
||||||
|
|
||||||
|
attr.insn_cnt = (__u32)load_attr->insn_cnt;
|
||||||
attr.insns = ptr_to_u64(load_attr->insns);
|
attr.insns = ptr_to_u64(load_attr->insns);
|
||||||
attr.license = ptr_to_u64(load_attr->license);
|
attr.license = ptr_to_u64(load_attr->license);
|
||||||
|
|
||||||
attr.log_level = log_level;
|
attr.log_level = load_attr->log_level;
|
||||||
if (log_level) {
|
if (attr.log_level) {
|
||||||
attr.log_buf = ptr_to_u64(log_buf);
|
attr.log_buf = ptr_to_u64(load_attr->log_buf);
|
||||||
attr.log_size = log_buf_sz;
|
attr.log_size = load_attr->log_buf_sz;
|
||||||
} else {
|
|
||||||
attr.log_buf = ptr_to_u64(NULL);
|
|
||||||
attr.log_size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
attr.prog_btf_fd = load_attr->prog_btf_fd;
|
attr.prog_btf_fd = load_attr->prog_btf_fd;
|
||||||
|
attr.prog_flags = load_attr->prog_flags;
|
||||||
|
|
||||||
attr.func_info_rec_size = load_attr->func_info_rec_size;
|
attr.func_info_rec_size = load_attr->func_info_rec_size;
|
||||||
attr.func_info_cnt = load_attr->func_info_cnt;
|
attr.func_info_cnt = load_attr->func_info_cnt;
|
||||||
attr.func_info = ptr_to_u64(load_attr->func_info);
|
attr.func_info = ptr_to_u64(load_attr->func_info);
|
||||||
|
|
||||||
attr.line_info_rec_size = load_attr->line_info_rec_size;
|
attr.line_info_rec_size = load_attr->line_info_rec_size;
|
||||||
attr.line_info_cnt = load_attr->line_info_cnt;
|
attr.line_info_cnt = load_attr->line_info_cnt;
|
||||||
attr.line_info = ptr_to_u64(load_attr->line_info);
|
attr.line_info = ptr_to_u64(load_attr->line_info);
|
||||||
|
|
||||||
if (load_attr->name)
|
if (load_attr->name)
|
||||||
memcpy(attr.prog_name, load_attr->name,
|
memcpy(attr.prog_name, load_attr->name,
|
||||||
min(strlen(load_attr->name), BPF_OBJ_NAME_LEN - 1));
|
min(strlen(load_attr->name), (size_t)BPF_OBJ_NAME_LEN - 1));
|
||||||
attr.prog_flags = load_attr->prog_flags;
|
|
||||||
|
|
||||||
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
@@ -309,19 +303,19 @@ int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_level || !log_buf)
|
if (load_attr->log_level || !load_attr->log_buf)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* Try again with log */
|
/* Try again with log */
|
||||||
attr.log_buf = ptr_to_u64(log_buf);
|
attr.log_buf = ptr_to_u64(load_attr->log_buf);
|
||||||
attr.log_size = log_buf_sz;
|
attr.log_size = load_attr->log_buf_sz;
|
||||||
attr.log_level = 1;
|
attr.log_level = 1;
|
||||||
log_buf[0] = 0;
|
load_attr->log_buf[0] = 0;
|
||||||
|
|
||||||
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
fd = sys_bpf_prog_load(&attr, sizeof(attr));
|
||||||
done:
|
done:
|
||||||
free(finfo);
|
free(finfo);
|
||||||
@@ -329,6 +323,49 @@ done:
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bpf_load_program_xattr(const struct bpf_load_program_attr *load_attr,
|
||||||
|
char *log_buf, size_t log_buf_sz)
|
||||||
|
{
|
||||||
|
struct bpf_prog_load_params p = {};
|
||||||
|
|
||||||
|
if (!load_attr || !log_buf != !log_buf_sz)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
p.prog_type = load_attr->prog_type;
|
||||||
|
p.expected_attach_type = load_attr->expected_attach_type;
|
||||||
|
switch (p.prog_type) {
|
||||||
|
case BPF_PROG_TYPE_STRUCT_OPS:
|
||||||
|
case BPF_PROG_TYPE_LSM:
|
||||||
|
p.attach_btf_id = load_attr->attach_btf_id;
|
||||||
|
break;
|
||||||
|
case BPF_PROG_TYPE_TRACING:
|
||||||
|
case BPF_PROG_TYPE_EXT:
|
||||||
|
p.attach_btf_id = load_attr->attach_btf_id;
|
||||||
|
p.attach_prog_fd = load_attr->attach_prog_fd;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
p.prog_ifindex = load_attr->prog_ifindex;
|
||||||
|
p.kern_version = load_attr->kern_version;
|
||||||
|
}
|
||||||
|
p.insn_cnt = load_attr->insns_cnt;
|
||||||
|
p.insns = load_attr->insns;
|
||||||
|
p.license = load_attr->license;
|
||||||
|
p.log_level = load_attr->log_level;
|
||||||
|
p.log_buf = log_buf;
|
||||||
|
p.log_buf_sz = log_buf_sz;
|
||||||
|
p.prog_btf_fd = load_attr->prog_btf_fd;
|
||||||
|
p.func_info_rec_size = load_attr->func_info_rec_size;
|
||||||
|
p.func_info_cnt = load_attr->func_info_cnt;
|
||||||
|
p.func_info = load_attr->func_info;
|
||||||
|
p.line_info_rec_size = load_attr->line_info_rec_size;
|
||||||
|
p.line_info_cnt = load_attr->line_info_cnt;
|
||||||
|
p.line_info = load_attr->line_info;
|
||||||
|
p.name = load_attr->name;
|
||||||
|
p.prog_flags = load_attr->prog_flags;
|
||||||
|
|
||||||
|
return libbpf__bpf_prog_load(&p);
|
||||||
|
}
|
||||||
|
|
||||||
int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
|
int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
|
||||||
size_t insns_cnt, const char *license,
|
size_t insns_cnt, const char *license,
|
||||||
__u32 kern_version, char *log_buf,
|
__u32 kern_version, char *log_buf,
|
||||||
@@ -589,19 +626,31 @@ int bpf_link_create(int prog_fd, int target_fd,
|
|||||||
enum bpf_attach_type attach_type,
|
enum bpf_attach_type attach_type,
|
||||||
const struct bpf_link_create_opts *opts)
|
const struct bpf_link_create_opts *opts)
|
||||||
{
|
{
|
||||||
|
__u32 target_btf_id, iter_info_len;
|
||||||
union bpf_attr attr;
|
union bpf_attr attr;
|
||||||
|
|
||||||
if (!OPTS_VALID(opts, bpf_link_create_opts))
|
if (!OPTS_VALID(opts, bpf_link_create_opts))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
iter_info_len = OPTS_GET(opts, iter_info_len, 0);
|
||||||
|
target_btf_id = OPTS_GET(opts, target_btf_id, 0);
|
||||||
|
|
||||||
|
if (iter_info_len && target_btf_id)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
memset(&attr, 0, sizeof(attr));
|
memset(&attr, 0, sizeof(attr));
|
||||||
attr.link_create.prog_fd = prog_fd;
|
attr.link_create.prog_fd = prog_fd;
|
||||||
attr.link_create.target_fd = target_fd;
|
attr.link_create.target_fd = target_fd;
|
||||||
attr.link_create.attach_type = attach_type;
|
attr.link_create.attach_type = attach_type;
|
||||||
attr.link_create.flags = OPTS_GET(opts, flags, 0);
|
attr.link_create.flags = OPTS_GET(opts, flags, 0);
|
||||||
attr.link_create.iter_info =
|
|
||||||
ptr_to_u64(OPTS_GET(opts, iter_info, (void *)0));
|
if (iter_info_len) {
|
||||||
attr.link_create.iter_info_len = OPTS_GET(opts, iter_info_len, 0);
|
attr.link_create.iter_info =
|
||||||
|
ptr_to_u64(OPTS_GET(opts, iter_info, (void *)0));
|
||||||
|
attr.link_create.iter_info_len = iter_info_len;
|
||||||
|
} else if (target_btf_id) {
|
||||||
|
attr.link_create.target_btf_id = target_btf_id;
|
||||||
|
}
|
||||||
|
|
||||||
return sys_bpf(BPF_LINK_CREATE, &attr, sizeof(attr));
|
return sys_bpf(BPF_LINK_CREATE, &attr, sizeof(attr));
|
||||||
}
|
}
|
||||||
@@ -715,6 +764,37 @@ int bpf_prog_test_run_xattr(struct bpf_prog_test_run_attr *test_attr)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bpf_prog_test_run_opts(int prog_fd, struct bpf_test_run_opts *opts)
|
||||||
|
{
|
||||||
|
union bpf_attr attr;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!OPTS_VALID(opts, bpf_test_run_opts))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memset(&attr, 0, sizeof(attr));
|
||||||
|
attr.test.prog_fd = prog_fd;
|
||||||
|
attr.test.cpu = OPTS_GET(opts, cpu, 0);
|
||||||
|
attr.test.flags = OPTS_GET(opts, flags, 0);
|
||||||
|
attr.test.repeat = OPTS_GET(opts, repeat, 0);
|
||||||
|
attr.test.duration = OPTS_GET(opts, duration, 0);
|
||||||
|
attr.test.ctx_size_in = OPTS_GET(opts, ctx_size_in, 0);
|
||||||
|
attr.test.ctx_size_out = OPTS_GET(opts, ctx_size_out, 0);
|
||||||
|
attr.test.data_size_in = OPTS_GET(opts, data_size_in, 0);
|
||||||
|
attr.test.data_size_out = OPTS_GET(opts, data_size_out, 0);
|
||||||
|
attr.test.ctx_in = ptr_to_u64(OPTS_GET(opts, ctx_in, NULL));
|
||||||
|
attr.test.ctx_out = ptr_to_u64(OPTS_GET(opts, ctx_out, NULL));
|
||||||
|
attr.test.data_in = ptr_to_u64(OPTS_GET(opts, data_in, NULL));
|
||||||
|
attr.test.data_out = ptr_to_u64(OPTS_GET(opts, data_out, NULL));
|
||||||
|
|
||||||
|
ret = sys_bpf(BPF_PROG_TEST_RUN, &attr, sizeof(attr));
|
||||||
|
OPTS_SET(opts, data_size_out, attr.test.data_size_out);
|
||||||
|
OPTS_SET(opts, ctx_size_out, attr.test.ctx_size_out);
|
||||||
|
OPTS_SET(opts, duration, attr.test.duration);
|
||||||
|
OPTS_SET(opts, retval, attr.test.retval);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int bpf_obj_get_next_id(__u32 start_id, __u32 *next_id, int cmd)
|
static int bpf_obj_get_next_id(__u32 start_id, __u32 *next_id, int cmd)
|
||||||
{
|
{
|
||||||
union bpf_attr attr;
|
union bpf_attr attr;
|
||||||
@@ -818,7 +898,7 @@ int bpf_raw_tracepoint_open(const char *name, int prog_fd)
|
|||||||
return sys_bpf(BPF_RAW_TRACEPOINT_OPEN, &attr, sizeof(attr));
|
return sys_bpf(BPF_RAW_TRACEPOINT_OPEN, &attr, sizeof(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
int bpf_load_btf(void *btf, __u32 btf_size, char *log_buf, __u32 log_buf_size,
|
int bpf_load_btf(const void *btf, __u32 btf_size, char *log_buf, __u32 log_buf_size,
|
||||||
bool do_log)
|
bool do_log)
|
||||||
{
|
{
|
||||||
union bpf_attr attr = {};
|
union bpf_attr attr = {};
|
||||||
@@ -875,3 +955,19 @@ int bpf_enable_stats(enum bpf_stats_type type)
|
|||||||
|
|
||||||
return sys_bpf(BPF_ENABLE_STATS, &attr, sizeof(attr));
|
return sys_bpf(BPF_ENABLE_STATS, &attr, sizeof(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bpf_prog_bind_map(int prog_fd, int map_fd,
|
||||||
|
const struct bpf_prog_bind_opts *opts)
|
||||||
|
{
|
||||||
|
union bpf_attr attr;
|
||||||
|
|
||||||
|
if (!OPTS_VALID(opts, bpf_prog_bind_opts))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
memset(&attr, 0, sizeof(attr));
|
||||||
|
attr.prog_bind_map.prog_fd = prog_fd;
|
||||||
|
attr.prog_bind_map.map_fd = map_fd;
|
||||||
|
attr.prog_bind_map.flags = OPTS_GET(opts, flags, 0);
|
||||||
|
|
||||||
|
return sys_bpf(BPF_PROG_BIND_MAP, &attr, sizeof(attr));
|
||||||
|
}
|
||||||
|
|||||||
39
src/bpf.h
39
src/bpf.h
@@ -174,8 +174,9 @@ struct bpf_link_create_opts {
|
|||||||
__u32 flags;
|
__u32 flags;
|
||||||
union bpf_iter_link_info *iter_info;
|
union bpf_iter_link_info *iter_info;
|
||||||
__u32 iter_info_len;
|
__u32 iter_info_len;
|
||||||
|
__u32 target_btf_id;
|
||||||
};
|
};
|
||||||
#define bpf_link_create_opts__last_field iter_info_len
|
#define bpf_link_create_opts__last_field target_btf_id
|
||||||
|
|
||||||
LIBBPF_API int bpf_link_create(int prog_fd, int target_fd,
|
LIBBPF_API int bpf_link_create(int prog_fd, int target_fd,
|
||||||
enum bpf_attach_type attach_type,
|
enum bpf_attach_type attach_type,
|
||||||
@@ -234,7 +235,7 @@ LIBBPF_API int bpf_prog_query(int target_fd, enum bpf_attach_type type,
|
|||||||
__u32 query_flags, __u32 *attach_flags,
|
__u32 query_flags, __u32 *attach_flags,
|
||||||
__u32 *prog_ids, __u32 *prog_cnt);
|
__u32 *prog_ids, __u32 *prog_cnt);
|
||||||
LIBBPF_API int bpf_raw_tracepoint_open(const char *name, int prog_fd);
|
LIBBPF_API int bpf_raw_tracepoint_open(const char *name, int prog_fd);
|
||||||
LIBBPF_API int bpf_load_btf(void *btf, __u32 btf_size, char *log_buf,
|
LIBBPF_API int bpf_load_btf(const void *btf, __u32 btf_size, char *log_buf,
|
||||||
__u32 log_buf_size, bool do_log);
|
__u32 log_buf_size, bool do_log);
|
||||||
LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf,
|
LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf,
|
||||||
__u32 *buf_len, __u32 *prog_id, __u32 *fd_type,
|
__u32 *buf_len, __u32 *prog_id, __u32 *fd_type,
|
||||||
@@ -243,6 +244,40 @@ LIBBPF_API int bpf_task_fd_query(int pid, int fd, __u32 flags, char *buf,
|
|||||||
enum bpf_stats_type; /* defined in up-to-date linux/bpf.h */
|
enum bpf_stats_type; /* defined in up-to-date linux/bpf.h */
|
||||||
LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type);
|
LIBBPF_API int bpf_enable_stats(enum bpf_stats_type type);
|
||||||
|
|
||||||
|
struct bpf_prog_bind_opts {
|
||||||
|
size_t sz; /* size of this struct for forward/backward compatibility */
|
||||||
|
__u32 flags;
|
||||||
|
};
|
||||||
|
#define bpf_prog_bind_opts__last_field flags
|
||||||
|
|
||||||
|
LIBBPF_API int bpf_prog_bind_map(int prog_fd, int map_fd,
|
||||||
|
const struct bpf_prog_bind_opts *opts);
|
||||||
|
|
||||||
|
struct bpf_test_run_opts {
|
||||||
|
size_t sz; /* size of this struct for forward/backward compatibility */
|
||||||
|
const void *data_in; /* optional */
|
||||||
|
void *data_out; /* optional */
|
||||||
|
__u32 data_size_in;
|
||||||
|
__u32 data_size_out; /* in: max length of data_out
|
||||||
|
* out: length of data_out
|
||||||
|
*/
|
||||||
|
const void *ctx_in; /* optional */
|
||||||
|
void *ctx_out; /* optional */
|
||||||
|
__u32 ctx_size_in;
|
||||||
|
__u32 ctx_size_out; /* in: max length of ctx_out
|
||||||
|
* out: length of cxt_out
|
||||||
|
*/
|
||||||
|
__u32 retval; /* out: return code of the BPF program */
|
||||||
|
int repeat;
|
||||||
|
__u32 duration; /* out: average per repetition in ns */
|
||||||
|
__u32 flags;
|
||||||
|
__u32 cpu;
|
||||||
|
};
|
||||||
|
#define bpf_test_run_opts__last_field cpu
|
||||||
|
|
||||||
|
LIBBPF_API int bpf_prog_test_run_opts(int prog_fd,
|
||||||
|
struct bpf_test_run_opts *opts);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,32 +19,52 @@ enum bpf_field_info_kind {
|
|||||||
BPF_FIELD_RSHIFT_U64 = 5,
|
BPF_FIELD_RSHIFT_U64 = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* second argument to __builtin_btf_type_id() built-in */
|
||||||
|
enum bpf_type_id_kind {
|
||||||
|
BPF_TYPE_ID_LOCAL = 0, /* BTF type ID in local program */
|
||||||
|
BPF_TYPE_ID_TARGET = 1, /* BTF type ID in target kernel */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* second argument to __builtin_preserve_type_info() built-in */
|
||||||
|
enum bpf_type_info_kind {
|
||||||
|
BPF_TYPE_EXISTS = 0, /* type existence in target kernel */
|
||||||
|
BPF_TYPE_SIZE = 1, /* type size in target kernel */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* second argument to __builtin_preserve_enum_value() built-in */
|
||||||
|
enum bpf_enum_value_kind {
|
||||||
|
BPF_ENUMVAL_EXISTS = 0, /* enum value existence in kernel */
|
||||||
|
BPF_ENUMVAL_VALUE = 1, /* enum value value relocation */
|
||||||
|
};
|
||||||
|
|
||||||
#define __CORE_RELO(src, field, info) \
|
#define __CORE_RELO(src, field, info) \
|
||||||
__builtin_preserve_field_info((src)->field, BPF_FIELD_##info)
|
__builtin_preserve_field_info((src)->field, BPF_FIELD_##info)
|
||||||
|
|
||||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
#define __CORE_BITFIELD_PROBE_READ(dst, src, fld) \
|
#define __CORE_BITFIELD_PROBE_READ(dst, src, fld) \
|
||||||
bpf_probe_read((void *)dst, \
|
bpf_probe_read_kernel( \
|
||||||
__CORE_RELO(src, fld, BYTE_SIZE), \
|
(void *)dst, \
|
||||||
(const void *)src + __CORE_RELO(src, fld, BYTE_OFFSET))
|
__CORE_RELO(src, fld, BYTE_SIZE), \
|
||||||
|
(const void *)src + __CORE_RELO(src, fld, BYTE_OFFSET))
|
||||||
#else
|
#else
|
||||||
/* semantics of LSHIFT_64 assumes loading values into low-ordered bytes, so
|
/* semantics of LSHIFT_64 assumes loading values into low-ordered bytes, so
|
||||||
* for big-endian we need to adjust destination pointer accordingly, based on
|
* for big-endian we need to adjust destination pointer accordingly, based on
|
||||||
* field byte size
|
* field byte size
|
||||||
*/
|
*/
|
||||||
#define __CORE_BITFIELD_PROBE_READ(dst, src, fld) \
|
#define __CORE_BITFIELD_PROBE_READ(dst, src, fld) \
|
||||||
bpf_probe_read((void *)dst + (8 - __CORE_RELO(src, fld, BYTE_SIZE)), \
|
bpf_probe_read_kernel( \
|
||||||
__CORE_RELO(src, fld, BYTE_SIZE), \
|
(void *)dst + (8 - __CORE_RELO(src, fld, BYTE_SIZE)), \
|
||||||
(const void *)src + __CORE_RELO(src, fld, BYTE_OFFSET))
|
__CORE_RELO(src, fld, BYTE_SIZE), \
|
||||||
|
(const void *)src + __CORE_RELO(src, fld, BYTE_OFFSET))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extract bitfield, identified by s->field, and return its value as u64.
|
* Extract bitfield, identified by s->field, and return its value as u64.
|
||||||
* All this is done in relocatable manner, so bitfield changes such as
|
* All this is done in relocatable manner, so bitfield changes such as
|
||||||
* signedness, bit size, offset changes, this will be handled automatically.
|
* signedness, bit size, offset changes, this will be handled automatically.
|
||||||
* This version of macro is using bpf_probe_read() to read underlying integer
|
* This version of macro is using bpf_probe_read_kernel() to read underlying
|
||||||
* storage. Macro functions as an expression and its return type is
|
* integer storage. Macro functions as an expression and its return type is
|
||||||
* bpf_probe_read()'s return value: 0, on success, <0 on error.
|
* bpf_probe_read_kernel()'s return value: 0, on success, <0 on error.
|
||||||
*/
|
*/
|
||||||
#define BPF_CORE_READ_BITFIELD_PROBED(s, field) ({ \
|
#define BPF_CORE_READ_BITFIELD_PROBED(s, field) ({ \
|
||||||
unsigned long long val = 0; \
|
unsigned long long val = 0; \
|
||||||
@@ -92,15 +112,75 @@ enum bpf_field_info_kind {
|
|||||||
__builtin_preserve_field_info(field, BPF_FIELD_EXISTS)
|
__builtin_preserve_field_info(field, BPF_FIELD_EXISTS)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convenience macro to get byte size of a field. Works for integers,
|
* Convenience macro to get the byte size of a field. Works for integers,
|
||||||
* struct/unions, pointers, arrays, and enums.
|
* struct/unions, pointers, arrays, and enums.
|
||||||
*/
|
*/
|
||||||
#define bpf_core_field_size(field) \
|
#define bpf_core_field_size(field) \
|
||||||
__builtin_preserve_field_info(field, BPF_FIELD_BYTE_SIZE)
|
__builtin_preserve_field_info(field, BPF_FIELD_BYTE_SIZE)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_core_read() abstracts away bpf_probe_read() call and captures offset
|
* Convenience macro to get BTF type ID of a specified type, using a local BTF
|
||||||
* relocation for source address using __builtin_preserve_access_index()
|
* information. Return 32-bit unsigned integer with type ID from program's own
|
||||||
|
* BTF. Always succeeds.
|
||||||
|
*/
|
||||||
|
#define bpf_core_type_id_local(type) \
|
||||||
|
__builtin_btf_type_id(*(typeof(type) *)0, BPF_TYPE_ID_LOCAL)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convenience macro to get BTF type ID of a target kernel's type that matches
|
||||||
|
* specified local type.
|
||||||
|
* Returns:
|
||||||
|
* - valid 32-bit unsigned type ID in kernel BTF;
|
||||||
|
* - 0, if no matching type was found in a target kernel BTF.
|
||||||
|
*/
|
||||||
|
#define bpf_core_type_id_kernel(type) \
|
||||||
|
__builtin_btf_type_id(*(typeof(type) *)0, BPF_TYPE_ID_TARGET)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convenience macro to check that provided named type
|
||||||
|
* (struct/union/enum/typedef) exists in a target kernel.
|
||||||
|
* Returns:
|
||||||
|
* 1, if such type is present in target kernel's BTF;
|
||||||
|
* 0, if no matching type is found.
|
||||||
|
*/
|
||||||
|
#define bpf_core_type_exists(type) \
|
||||||
|
__builtin_preserve_type_info(*(typeof(type) *)0, BPF_TYPE_EXISTS)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convenience macro to get the byte size of a provided named type
|
||||||
|
* (struct/union/enum/typedef) in a target kernel.
|
||||||
|
* Returns:
|
||||||
|
* >= 0 size (in bytes), if type is present in target kernel's BTF;
|
||||||
|
* 0, if no matching type is found.
|
||||||
|
*/
|
||||||
|
#define bpf_core_type_size(type) \
|
||||||
|
__builtin_preserve_type_info(*(typeof(type) *)0, BPF_TYPE_SIZE)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convenience macro to check that provided enumerator value is defined in
|
||||||
|
* a target kernel.
|
||||||
|
* Returns:
|
||||||
|
* 1, if specified enum type and its enumerator value are present in target
|
||||||
|
* kernel's BTF;
|
||||||
|
* 0, if no matching enum and/or enum value within that enum is found.
|
||||||
|
*/
|
||||||
|
#define bpf_core_enum_value_exists(enum_type, enum_value) \
|
||||||
|
__builtin_preserve_enum_value(*(typeof(enum_type) *)enum_value, BPF_ENUMVAL_EXISTS)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convenience macro to get the integer value of an enumerator value in
|
||||||
|
* a target kernel.
|
||||||
|
* Returns:
|
||||||
|
* 64-bit value, if specified enum type and its enumerator value are
|
||||||
|
* present in target kernel's BTF;
|
||||||
|
* 0, if no matching enum and/or enum value within that enum is found.
|
||||||
|
*/
|
||||||
|
#define bpf_core_enum_value(enum_type, enum_value) \
|
||||||
|
__builtin_preserve_enum_value(*(typeof(enum_type) *)enum_value, BPF_ENUMVAL_VALUE)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_core_read() abstracts away bpf_probe_read_kernel() call and captures
|
||||||
|
* offset relocation for source address using __builtin_preserve_access_index()
|
||||||
* built-in, provided by Clang.
|
* built-in, provided by Clang.
|
||||||
*
|
*
|
||||||
* __builtin_preserve_access_index() takes as an argument an expression of
|
* __builtin_preserve_access_index() takes as an argument an expression of
|
||||||
@@ -115,8 +195,8 @@ enum bpf_field_info_kind {
|
|||||||
* (local) BTF, used to record relocation.
|
* (local) BTF, used to record relocation.
|
||||||
*/
|
*/
|
||||||
#define bpf_core_read(dst, sz, src) \
|
#define bpf_core_read(dst, sz, src) \
|
||||||
bpf_probe_read(dst, sz, \
|
bpf_probe_read_kernel(dst, sz, \
|
||||||
(const void *)__builtin_preserve_access_index(src))
|
(const void *)__builtin_preserve_access_index(src))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_core_read_str() is a thin wrapper around bpf_probe_read_str()
|
* bpf_core_read_str() is a thin wrapper around bpf_probe_read_str()
|
||||||
@@ -124,8 +204,8 @@ enum bpf_field_info_kind {
|
|||||||
* argument.
|
* argument.
|
||||||
*/
|
*/
|
||||||
#define bpf_core_read_str(dst, sz, src) \
|
#define bpf_core_read_str(dst, sz, src) \
|
||||||
bpf_probe_read_str(dst, sz, \
|
bpf_probe_read_kernel_str(dst, sz, \
|
||||||
(const void *)__builtin_preserve_access_index(src))
|
(const void *)__builtin_preserve_access_index(src))
|
||||||
|
|
||||||
#define ___concat(a, b) a ## b
|
#define ___concat(a, b) a ## b
|
||||||
#define ___apply(fn, n) ___concat(fn, n)
|
#define ___apply(fn, n) ___concat(fn, n)
|
||||||
@@ -239,15 +319,17 @@ enum bpf_field_info_kind {
|
|||||||
* int x = BPF_CORE_READ(s, a.b.c, d.e, f, g);
|
* int x = BPF_CORE_READ(s, a.b.c, d.e, f, g);
|
||||||
*
|
*
|
||||||
* BPF_CORE_READ will decompose above statement into 4 bpf_core_read (BPF
|
* BPF_CORE_READ will decompose above statement into 4 bpf_core_read (BPF
|
||||||
* CO-RE relocatable bpf_probe_read() wrapper) calls, logically equivalent to:
|
* CO-RE relocatable bpf_probe_read_kernel() wrapper) calls, logically
|
||||||
|
* equivalent to:
|
||||||
* 1. const void *__t = s->a.b.c;
|
* 1. const void *__t = s->a.b.c;
|
||||||
* 2. __t = __t->d.e;
|
* 2. __t = __t->d.e;
|
||||||
* 3. __t = __t->f;
|
* 3. __t = __t->f;
|
||||||
* 4. return __t->g;
|
* 4. return __t->g;
|
||||||
*
|
*
|
||||||
* Equivalence is logical, because there is a heavy type casting/preservation
|
* Equivalence is logical, because there is a heavy type casting/preservation
|
||||||
* involved, as well as all the reads are happening through bpf_probe_read()
|
* involved, as well as all the reads are happening through
|
||||||
* calls using __builtin_preserve_access_index() to emit CO-RE relocations.
|
* bpf_probe_read_kernel() calls using __builtin_preserve_access_index() to
|
||||||
|
* emit CO-RE relocations.
|
||||||
*
|
*
|
||||||
* N.B. Only up to 9 "field accessors" are supported, which should be more
|
* N.B. Only up to 9 "field accessors" are supported, which should be more
|
||||||
* than enough for any practical purpose.
|
* than enough for any practical purpose.
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ struct bpf_sk_lookup;
|
|||||||
struct bpf_perf_event_data;
|
struct bpf_perf_event_data;
|
||||||
struct bpf_perf_event_value;
|
struct bpf_perf_event_value;
|
||||||
struct bpf_pidns_info;
|
struct bpf_pidns_info;
|
||||||
|
struct bpf_redir_neigh;
|
||||||
struct bpf_sock;
|
struct bpf_sock;
|
||||||
struct bpf_sock_addr;
|
struct bpf_sock_addr;
|
||||||
struct bpf_sock_ops;
|
struct bpf_sock_ops;
|
||||||
@@ -15,6 +16,7 @@ struct bpf_sysctl;
|
|||||||
struct bpf_tcp_sock;
|
struct bpf_tcp_sock;
|
||||||
struct bpf_tunnel_key;
|
struct bpf_tunnel_key;
|
||||||
struct bpf_xfrm_state;
|
struct bpf_xfrm_state;
|
||||||
|
struct linux_binprm;
|
||||||
struct pt_regs;
|
struct pt_regs;
|
||||||
struct sk_reuseport_md;
|
struct sk_reuseport_md;
|
||||||
struct sockaddr;
|
struct sockaddr;
|
||||||
@@ -29,6 +31,11 @@ struct task_struct;
|
|||||||
struct __sk_buff;
|
struct __sk_buff;
|
||||||
struct sk_msg_md;
|
struct sk_msg_md;
|
||||||
struct xdp_md;
|
struct xdp_md;
|
||||||
|
struct path;
|
||||||
|
struct btf_ptr;
|
||||||
|
struct inode;
|
||||||
|
struct socket;
|
||||||
|
struct file;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_map_lookup_elem
|
* bpf_map_lookup_elem
|
||||||
@@ -150,7 +157,7 @@ static __u64 (*bpf_ktime_get_ns)(void) = (void *) 5;
|
|||||||
*
|
*
|
||||||
* Also, note that **bpf_trace_printk**\ () is slow, and should
|
* Also, note that **bpf_trace_printk**\ () is slow, and should
|
||||||
* only be used for debugging purposes. For this reason, a notice
|
* only be used for debugging purposes. For this reason, a notice
|
||||||
* bloc (spanning several lines) is printed to kernel logs and
|
* block (spanning several lines) is printed to kernel logs and
|
||||||
* states that the helper should not be used "for production use"
|
* states that the helper should not be used "for production use"
|
||||||
* the first time this helper is used (or more precisely, when
|
* the first time this helper is used (or more precisely, when
|
||||||
* **trace_printk**\ () buffers are allocated). For passing values
|
* **trace_printk**\ () buffers are allocated). For passing values
|
||||||
@@ -604,7 +611,7 @@ static long (*bpf_redirect)(__u32 ifindex, __u64 flags) = (void *) 23;
|
|||||||
*
|
*
|
||||||
* Retrieve the realm or the route, that is to say the
|
* Retrieve the realm or the route, that is to say the
|
||||||
* **tclassid** field of the destination for the *skb*. The
|
* **tclassid** field of the destination for the *skb*. The
|
||||||
* indentifier retrieved is a user-provided tag, similar to the
|
* identifier retrieved is a user-provided tag, similar to the
|
||||||
* one used with the net_cls cgroup (see description for
|
* one used with the net_cls cgroup (see description for
|
||||||
* **bpf_get_cgroup_classid**\ () helper), but here this tag is
|
* **bpf_get_cgroup_classid**\ () helper), but here this tag is
|
||||||
* held by a route (a destination entry), not by a task.
|
* held by a route (a destination entry), not by a task.
|
||||||
@@ -949,8 +956,8 @@ static long (*bpf_probe_write_user)(void *dst, const void *src, __u32 len) = (vo
|
|||||||
* Returns
|
* Returns
|
||||||
* The return value depends on the result of the test, and can be:
|
* The return value depends on the result of the test, and can be:
|
||||||
*
|
*
|
||||||
* * 0, if the *skb* task belongs to the cgroup2.
|
* * 0, if current task belongs to the cgroup2.
|
||||||
* * 1, if the *skb* task does not belong to the cgroup2.
|
* * 1, if current task does not belong to the cgroup2.
|
||||||
* * A negative error code, if an error occurred.
|
* * A negative error code, if an error occurred.
|
||||||
*/
|
*/
|
||||||
static long (*bpf_current_task_under_cgroup)(void *map, __u32 index) = (void *) 37;
|
static long (*bpf_current_task_under_cgroup)(void *map, __u32 index) = (void *) 37;
|
||||||
@@ -1194,7 +1201,7 @@ static long (*bpf_set_hash)(struct __sk_buff *skb, __u32 hash) = (void *) 48;
|
|||||||
* **TCP_CONGESTION**, **TCP_BPF_IW**,
|
* **TCP_CONGESTION**, **TCP_BPF_IW**,
|
||||||
* **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
|
* **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**,
|
||||||
* **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
|
* **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**,
|
||||||
* **TCP_SYNCNT**, **TCP_USER_TIMEOUT**.
|
* **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**.
|
||||||
* * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
|
* * **IPPROTO_IP**, which supports *optname* **IP_TOS**.
|
||||||
* * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
|
* * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**.
|
||||||
*
|
*
|
||||||
@@ -1841,7 +1848,7 @@ static long (*bpf_msg_redirect_hash)(struct sk_msg_md *msg, void *map, void *key
|
|||||||
*
|
*
|
||||||
* This helper is used in programs implementing policies at the
|
* This helper is used in programs implementing policies at the
|
||||||
* skb socket level. If the sk_buff *skb* is allowed to pass (i.e.
|
* skb socket level. If the sk_buff *skb* is allowed to pass (i.e.
|
||||||
* if the verdeict eBPF program returns **SK_PASS**), redirect it
|
* if the verdict eBPF program returns **SK_PASS**), redirect it
|
||||||
* to the socket referenced by *map* (of type
|
* to the socket referenced by *map* (of type
|
||||||
* **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
|
* **BPF_MAP_TYPE_SOCKHASH**) using hash *key*. Both ingress and
|
||||||
* egress interfaces can be used for redirection. The
|
* egress interfaces can be used for redirection. The
|
||||||
@@ -2199,7 +2206,7 @@ static struct bpf_sock *(*bpf_sk_lookup_udp)(void *ctx, struct bpf_sock_tuple *t
|
|||||||
* Returns
|
* Returns
|
||||||
* 0 on success, or a negative error in case of failure.
|
* 0 on success, or a negative error in case of failure.
|
||||||
*/
|
*/
|
||||||
static long (*bpf_sk_release)(struct bpf_sock *sock) = (void *) 86;
|
static long (*bpf_sk_release)(void *sock) = (void *) 86;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_map_push_elem
|
* bpf_map_push_elem
|
||||||
@@ -2442,7 +2449,7 @@ static struct bpf_sock *(*bpf_skc_lookup_tcp)(void *ctx, struct bpf_sock_tuple *
|
|||||||
* 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
|
* 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
|
||||||
* error otherwise.
|
* error otherwise.
|
||||||
*/
|
*/
|
||||||
static long (*bpf_tcp_check_syncookie)(struct bpf_sock *sk, void *iph, __u32 iph_len, struct tcphdr *th, __u32 th_len) = (void *) 100;
|
static long (*bpf_tcp_check_syncookie)(void *sk, void *iph, __u32 iph_len, struct tcphdr *th, __u32 th_len) = (void *) 100;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_sysctl_get_name
|
* bpf_sysctl_get_name
|
||||||
@@ -2601,6 +2608,9 @@ static long (*bpf_strtoul)(const char *buf, unsigned long buf_len, __u64 flags,
|
|||||||
* "type". The bpf-local-storage "type" (i.e. the *map*) is
|
* "type". The bpf-local-storage "type" (i.e. the *map*) is
|
||||||
* searched against all bpf-local-storages residing at *sk*.
|
* searched against all bpf-local-storages residing at *sk*.
|
||||||
*
|
*
|
||||||
|
* *sk* is a kernel **struct sock** pointer for LSM program.
|
||||||
|
* *sk* is a **struct bpf_sock** pointer for other program types.
|
||||||
|
*
|
||||||
* An optional *flags* (**BPF_SK_STORAGE_GET_F_CREATE**) can be
|
* An optional *flags* (**BPF_SK_STORAGE_GET_F_CREATE**) can be
|
||||||
* used such that a new bpf-local-storage will be
|
* used such that a new bpf-local-storage will be
|
||||||
* created if one does not exist. *value* can be used
|
* created if one does not exist. *value* can be used
|
||||||
@@ -2614,7 +2624,7 @@ static long (*bpf_strtoul)(const char *buf, unsigned long buf_len, __u64 flags,
|
|||||||
* **NULL** if not found or there was an error in adding
|
* **NULL** if not found or there was an error in adding
|
||||||
* a new bpf-local-storage.
|
* a new bpf-local-storage.
|
||||||
*/
|
*/
|
||||||
static void *(*bpf_sk_storage_get)(void *map, struct bpf_sock *sk, void *value, __u64 flags) = (void *) 107;
|
static void *(*bpf_sk_storage_get)(void *map, void *sk, void *value, __u64 flags) = (void *) 107;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_sk_storage_delete
|
* bpf_sk_storage_delete
|
||||||
@@ -2625,8 +2635,9 @@ static void *(*bpf_sk_storage_get)(void *map, struct bpf_sock *sk, void *value,
|
|||||||
* 0 on success.
|
* 0 on success.
|
||||||
*
|
*
|
||||||
* **-ENOENT** if the bpf-local-storage cannot be found.
|
* **-ENOENT** if the bpf-local-storage cannot be found.
|
||||||
|
* **-EINVAL** if sk is not a fullsock (e.g. a request_sock).
|
||||||
*/
|
*/
|
||||||
static long (*bpf_sk_storage_delete)(void *map, struct bpf_sock *sk) = (void *) 108;
|
static long (*bpf_sk_storage_delete)(void *map, void *sk) = (void *) 108;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_send_signal
|
* bpf_send_signal
|
||||||
@@ -2675,7 +2686,7 @@ static long (*bpf_send_signal)(__u32 sig) = (void *) 109;
|
|||||||
*
|
*
|
||||||
* **-EPROTONOSUPPORT** IP packet version is not 4 or 6
|
* **-EPROTONOSUPPORT** IP packet version is not 4 or 6
|
||||||
*/
|
*/
|
||||||
static __s64 (*bpf_tcp_gen_syncookie)(struct bpf_sock *sk, void *iph, __u32 iph_len, struct tcphdr *th, __u32 th_len) = (void *) 110;
|
static __s64 (*bpf_tcp_gen_syncookie)(void *sk, void *iph, __u32 iph_len, struct tcphdr *th, __u32 th_len) = (void *) 110;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_skb_output
|
* bpf_skb_output
|
||||||
@@ -2965,7 +2976,7 @@ static __u64 (*bpf_get_current_ancestor_cgroup_id)(int ancestor_level) = (void *
|
|||||||
* **-ESOCKTNOSUPPORT** if the socket type is not supported
|
* **-ESOCKTNOSUPPORT** if the socket type is not supported
|
||||||
* (reuseport).
|
* (reuseport).
|
||||||
*/
|
*/
|
||||||
static long (*bpf_sk_assign)(void *ctx, struct bpf_sock *sk, __u64 flags) = (void *) 124;
|
static long (*bpf_sk_assign)(void *ctx, void *sk, __u64 flags) = (void *) 124;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_ktime_get_boot_ns
|
* bpf_ktime_get_boot_ns
|
||||||
@@ -3031,7 +3042,7 @@ static long (*bpf_seq_write)(struct seq_file *m, const void *data, __u32 len) =
|
|||||||
*
|
*
|
||||||
* Return the cgroup v2 id of the socket *sk*.
|
* Return the cgroup v2 id of the socket *sk*.
|
||||||
*
|
*
|
||||||
* *sk* must be a non-**NULL** pointer to a full socket, e.g. one
|
* *sk* must be a non-**NULL** pointer to a socket, e.g. one
|
||||||
* returned from **bpf_sk_lookup_xxx**\ (),
|
* returned from **bpf_sk_lookup_xxx**\ (),
|
||||||
* **bpf_sk_fullsock**\ (), etc. The format of returned id is
|
* **bpf_sk_fullsock**\ (), etc. The format of returned id is
|
||||||
* same as in **bpf_skb_cgroup_id**\ ().
|
* same as in **bpf_skb_cgroup_id**\ ().
|
||||||
@@ -3042,7 +3053,7 @@ static long (*bpf_seq_write)(struct seq_file *m, const void *data, __u32 len) =
|
|||||||
* Returns
|
* Returns
|
||||||
* The id is returned or 0 in case the id could not be retrieved.
|
* The id is returned or 0 in case the id could not be retrieved.
|
||||||
*/
|
*/
|
||||||
static __u64 (*bpf_sk_cgroup_id)(struct bpf_sock *sk) = (void *) 128;
|
static __u64 (*bpf_sk_cgroup_id)(void *sk) = (void *) 128;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_sk_ancestor_cgroup_id
|
* bpf_sk_ancestor_cgroup_id
|
||||||
@@ -3064,7 +3075,7 @@ static __u64 (*bpf_sk_cgroup_id)(struct bpf_sock *sk) = (void *) 128;
|
|||||||
* Returns
|
* Returns
|
||||||
* The id is returned or 0 in case the id could not be retrieved.
|
* The id is returned or 0 in case the id could not be retrieved.
|
||||||
*/
|
*/
|
||||||
static __u64 (*bpf_sk_ancestor_cgroup_id)(struct bpf_sock *sk, int ancestor_level) = (void *) 129;
|
static __u64 (*bpf_sk_ancestor_cgroup_id)(void *sk, int ancestor_level) = (void *) 129;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bpf_ringbuf_output
|
* bpf_ringbuf_output
|
||||||
@@ -3182,7 +3193,7 @@ static long (*bpf_csum_level)(struct __sk_buff *skb, __u64 level) = (void *) 135
|
|||||||
* Dynamically cast a *sk* pointer to a *tcp6_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *tcp6_sock* pointer.
|
||||||
*
|
*
|
||||||
* Returns
|
* Returns
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or **NULL** otherwise.
|
||||||
*/
|
*/
|
||||||
static struct tcp6_sock *(*bpf_skc_to_tcp6_sock)(void *sk) = (void *) 136;
|
static struct tcp6_sock *(*bpf_skc_to_tcp6_sock)(void *sk) = (void *) 136;
|
||||||
|
|
||||||
@@ -3192,7 +3203,7 @@ static struct tcp6_sock *(*bpf_skc_to_tcp6_sock)(void *sk) = (void *) 136;
|
|||||||
* Dynamically cast a *sk* pointer to a *tcp_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *tcp_sock* pointer.
|
||||||
*
|
*
|
||||||
* Returns
|
* Returns
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or **NULL** otherwise.
|
||||||
*/
|
*/
|
||||||
static struct tcp_sock *(*bpf_skc_to_tcp_sock)(void *sk) = (void *) 137;
|
static struct tcp_sock *(*bpf_skc_to_tcp_sock)(void *sk) = (void *) 137;
|
||||||
|
|
||||||
@@ -3202,7 +3213,7 @@ static struct tcp_sock *(*bpf_skc_to_tcp_sock)(void *sk) = (void *) 137;
|
|||||||
* Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *tcp_timewait_sock* pointer.
|
||||||
*
|
*
|
||||||
* Returns
|
* Returns
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or **NULL** otherwise.
|
||||||
*/
|
*/
|
||||||
static struct tcp_timewait_sock *(*bpf_skc_to_tcp_timewait_sock)(void *sk) = (void *) 138;
|
static struct tcp_timewait_sock *(*bpf_skc_to_tcp_timewait_sock)(void *sk) = (void *) 138;
|
||||||
|
|
||||||
@@ -3212,7 +3223,7 @@ static struct tcp_timewait_sock *(*bpf_skc_to_tcp_timewait_sock)(void *sk) = (vo
|
|||||||
* Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *tcp_request_sock* pointer.
|
||||||
*
|
*
|
||||||
* Returns
|
* Returns
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or **NULL** otherwise.
|
||||||
*/
|
*/
|
||||||
static struct tcp_request_sock *(*bpf_skc_to_tcp_request_sock)(void *sk) = (void *) 139;
|
static struct tcp_request_sock *(*bpf_skc_to_tcp_request_sock)(void *sk) = (void *) 139;
|
||||||
|
|
||||||
@@ -3222,7 +3233,7 @@ static struct tcp_request_sock *(*bpf_skc_to_tcp_request_sock)(void *sk) = (void
|
|||||||
* Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
|
* Dynamically cast a *sk* pointer to a *udp6_sock* pointer.
|
||||||
*
|
*
|
||||||
* Returns
|
* Returns
|
||||||
* *sk* if casting is valid, or NULL otherwise.
|
* *sk* if casting is valid, or **NULL** otherwise.
|
||||||
*/
|
*/
|
||||||
static struct udp6_sock *(*bpf_skc_to_udp6_sock)(void *sk) = (void *) 140;
|
static struct udp6_sock *(*bpf_skc_to_udp6_sock)(void *sk) = (void *) 140;
|
||||||
|
|
||||||
@@ -3231,8 +3242,8 @@ static struct udp6_sock *(*bpf_skc_to_udp6_sock)(void *sk) = (void *) 140;
|
|||||||
*
|
*
|
||||||
* Return a user or a kernel stack in bpf program provided buffer.
|
* Return a user or a kernel stack in bpf program provided buffer.
|
||||||
* To achieve this, the helper needs *task*, which is a valid
|
* To achieve this, the helper needs *task*, which is a valid
|
||||||
* pointer to struct task_struct. To store the stacktrace, the
|
* pointer to **struct task_struct**. To store the stacktrace, the
|
||||||
* bpf program provides *buf* with a nonnegative *size*.
|
* bpf program provides *buf* with a nonnegative *size*.
|
||||||
*
|
*
|
||||||
* The last argument, *flags*, holds the number of stack frames to
|
* The last argument, *flags*, holds the number of stack frames to
|
||||||
* skip (from 0 to 255), masked with
|
* skip (from 0 to 255), masked with
|
||||||
@@ -3262,4 +3273,462 @@ static struct udp6_sock *(*bpf_skc_to_udp6_sock)(void *sk) = (void *) 140;
|
|||||||
*/
|
*/
|
||||||
static long (*bpf_get_task_stack)(struct task_struct *task, void *buf, __u32 size, __u64 flags) = (void *) 141;
|
static long (*bpf_get_task_stack)(struct task_struct *task, void *buf, __u32 size, __u64 flags) = (void *) 141;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_load_hdr_opt
|
||||||
|
*
|
||||||
|
* Load header option. Support reading a particular TCP header
|
||||||
|
* option for bpf program (**BPF_PROG_TYPE_SOCK_OPS**).
|
||||||
|
*
|
||||||
|
* If *flags* is 0, it will search the option from the
|
||||||
|
* *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops**
|
||||||
|
* has details on what skb_data contains under different
|
||||||
|
* *skops*\ **->op**.
|
||||||
|
*
|
||||||
|
* The first byte of the *searchby_res* specifies the
|
||||||
|
* kind that it wants to search.
|
||||||
|
*
|
||||||
|
* If the searching kind is an experimental kind
|
||||||
|
* (i.e. 253 or 254 according to RFC6994). It also
|
||||||
|
* needs to specify the "magic" which is either
|
||||||
|
* 2 bytes or 4 bytes. It then also needs to
|
||||||
|
* specify the size of the magic by using
|
||||||
|
* the 2nd byte which is "kind-length" of a TCP
|
||||||
|
* header option and the "kind-length" also
|
||||||
|
* includes the first 2 bytes "kind" and "kind-length"
|
||||||
|
* itself as a normal TCP header option also does.
|
||||||
|
*
|
||||||
|
* For example, to search experimental kind 254 with
|
||||||
|
* 2 byte magic 0xeB9F, the searchby_res should be
|
||||||
|
* [ 254, 4, 0xeB, 0x9F, 0, 0, .... 0 ].
|
||||||
|
*
|
||||||
|
* To search for the standard window scale option (3),
|
||||||
|
* the *searchby_res* should be [ 3, 0, 0, .... 0 ].
|
||||||
|
* Note, kind-length must be 0 for regular option.
|
||||||
|
*
|
||||||
|
* Searching for No-Op (0) and End-of-Option-List (1) are
|
||||||
|
* not supported.
|
||||||
|
*
|
||||||
|
* *len* must be at least 2 bytes which is the minimal size
|
||||||
|
* of a header option.
|
||||||
|
*
|
||||||
|
* Supported flags:
|
||||||
|
*
|
||||||
|
* * **BPF_LOAD_HDR_OPT_TCP_SYN** to search from the
|
||||||
|
* saved_syn packet or the just-received syn packet.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* > 0 when found, the header option is copied to *searchby_res*.
|
||||||
|
* The return value is the total length copied. On failure, a
|
||||||
|
* negative error code is returned:
|
||||||
|
*
|
||||||
|
* **-EINVAL** if a parameter is invalid.
|
||||||
|
*
|
||||||
|
* **-ENOMSG** if the option is not found.
|
||||||
|
*
|
||||||
|
* **-ENOENT** if no syn packet is available when
|
||||||
|
* **BPF_LOAD_HDR_OPT_TCP_SYN** is used.
|
||||||
|
*
|
||||||
|
* **-ENOSPC** if there is not enough space. Only *len* number of
|
||||||
|
* bytes are copied.
|
||||||
|
*
|
||||||
|
* **-EFAULT** on failure to parse the header options in the
|
||||||
|
* packet.
|
||||||
|
*
|
||||||
|
* **-EPERM** if the helper cannot be used under the current
|
||||||
|
* *skops*\ **->op**.
|
||||||
|
*/
|
||||||
|
static long (*bpf_load_hdr_opt)(struct bpf_sock_ops *skops, void *searchby_res, __u32 len, __u64 flags) = (void *) 142;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_store_hdr_opt
|
||||||
|
*
|
||||||
|
* Store header option. The data will be copied
|
||||||
|
* from buffer *from* with length *len* to the TCP header.
|
||||||
|
*
|
||||||
|
* The buffer *from* should have the whole option that
|
||||||
|
* includes the kind, kind-length, and the actual
|
||||||
|
* option data. The *len* must be at least kind-length
|
||||||
|
* long. The kind-length does not have to be 4 byte
|
||||||
|
* aligned. The kernel will take care of the padding
|
||||||
|
* and setting the 4 bytes aligned value to th->doff.
|
||||||
|
*
|
||||||
|
* This helper will check for duplicated option
|
||||||
|
* by searching the same option in the outgoing skb.
|
||||||
|
*
|
||||||
|
* This helper can only be called during
|
||||||
|
* **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success, or negative error in case of failure:
|
||||||
|
*
|
||||||
|
* **-EINVAL** If param is invalid.
|
||||||
|
*
|
||||||
|
* **-ENOSPC** if there is not enough space in the header.
|
||||||
|
* Nothing has been written
|
||||||
|
*
|
||||||
|
* **-EEXIST** if the option already exists.
|
||||||
|
*
|
||||||
|
* **-EFAULT** on failrue to parse the existing header options.
|
||||||
|
*
|
||||||
|
* **-EPERM** if the helper cannot be used under the current
|
||||||
|
* *skops*\ **->op**.
|
||||||
|
*/
|
||||||
|
static long (*bpf_store_hdr_opt)(struct bpf_sock_ops *skops, const void *from, __u32 len, __u64 flags) = (void *) 143;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_reserve_hdr_opt
|
||||||
|
*
|
||||||
|
* Reserve *len* bytes for the bpf header option. The
|
||||||
|
* space will be used by **bpf_store_hdr_opt**\ () later in
|
||||||
|
* **BPF_SOCK_OPS_WRITE_HDR_OPT_CB**.
|
||||||
|
*
|
||||||
|
* If **bpf_reserve_hdr_opt**\ () is called multiple times,
|
||||||
|
* the total number of bytes will be reserved.
|
||||||
|
*
|
||||||
|
* This helper can only be called during
|
||||||
|
* **BPF_SOCK_OPS_HDR_OPT_LEN_CB**.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success, or negative error in case of failure:
|
||||||
|
*
|
||||||
|
* **-EINVAL** if a parameter is invalid.
|
||||||
|
*
|
||||||
|
* **-ENOSPC** if there is not enough space in the header.
|
||||||
|
*
|
||||||
|
* **-EPERM** if the helper cannot be used under the current
|
||||||
|
* *skops*\ **->op**.
|
||||||
|
*/
|
||||||
|
static long (*bpf_reserve_hdr_opt)(struct bpf_sock_ops *skops, __u32 len, __u64 flags) = (void *) 144;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_inode_storage_get
|
||||||
|
*
|
||||||
|
* Get a bpf_local_storage from an *inode*.
|
||||||
|
*
|
||||||
|
* Logically, it could be thought of as getting the value from
|
||||||
|
* a *map* with *inode* as the **key**. From this
|
||||||
|
* perspective, the usage is not much different from
|
||||||
|
* **bpf_map_lookup_elem**\ (*map*, **&**\ *inode*) except this
|
||||||
|
* helper enforces the key must be an inode and the map must also
|
||||||
|
* be a **BPF_MAP_TYPE_INODE_STORAGE**.
|
||||||
|
*
|
||||||
|
* Underneath, the value is stored locally at *inode* instead of
|
||||||
|
* the *map*. The *map* is used as the bpf-local-storage
|
||||||
|
* "type". The bpf-local-storage "type" (i.e. the *map*) is
|
||||||
|
* searched against all bpf_local_storage residing at *inode*.
|
||||||
|
*
|
||||||
|
* An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
|
||||||
|
* used such that a new bpf_local_storage will be
|
||||||
|
* created if one does not exist. *value* can be used
|
||||||
|
* together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
|
||||||
|
* the initial value of a bpf_local_storage. If *value* is
|
||||||
|
* **NULL**, the new bpf_local_storage will be zero initialized.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* A bpf_local_storage pointer is returned on success.
|
||||||
|
*
|
||||||
|
* **NULL** if not found or there was an error in adding
|
||||||
|
* a new bpf_local_storage.
|
||||||
|
*/
|
||||||
|
static void *(*bpf_inode_storage_get)(void *map, void *inode, void *value, __u64 flags) = (void *) 145;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_inode_storage_delete
|
||||||
|
*
|
||||||
|
* Delete a bpf_local_storage from an *inode*.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success.
|
||||||
|
*
|
||||||
|
* **-ENOENT** if the bpf_local_storage cannot be found.
|
||||||
|
*/
|
||||||
|
static int (*bpf_inode_storage_delete)(void *map, void *inode) = (void *) 146;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_d_path
|
||||||
|
*
|
||||||
|
* Return full path for given **struct path** object, which
|
||||||
|
* needs to be the kernel BTF *path* object. The path is
|
||||||
|
* returned in the provided buffer *buf* of size *sz* and
|
||||||
|
* is zero terminated.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* On success, the strictly positive length of the string,
|
||||||
|
* including the trailing NUL character. On error, a negative
|
||||||
|
* value.
|
||||||
|
*/
|
||||||
|
static long (*bpf_d_path)(struct path *path, char *buf, __u32 sz) = (void *) 147;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_copy_from_user
|
||||||
|
*
|
||||||
|
* Read *size* bytes from user space address *user_ptr* and store
|
||||||
|
* the data in *dst*. This is a wrapper of **copy_from_user**\ ().
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success, or a negative error in case of failure.
|
||||||
|
*/
|
||||||
|
static long (*bpf_copy_from_user)(void *dst, __u32 size, const void *user_ptr) = (void *) 148;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_snprintf_btf
|
||||||
|
*
|
||||||
|
* Use BTF to store a string representation of *ptr*->ptr in *str*,
|
||||||
|
* using *ptr*->type_id. This value should specify the type
|
||||||
|
* that *ptr*->ptr points to. LLVM __builtin_btf_type_id(type, 1)
|
||||||
|
* can be used to look up vmlinux BTF type ids. Traversing the
|
||||||
|
* data structure using BTF, the type information and values are
|
||||||
|
* stored in the first *str_size* - 1 bytes of *str*. Safe copy of
|
||||||
|
* the pointer data is carried out to avoid kernel crashes during
|
||||||
|
* operation. Smaller types can use string space on the stack;
|
||||||
|
* larger programs can use map data to store the string
|
||||||
|
* representation.
|
||||||
|
*
|
||||||
|
* The string can be subsequently shared with userspace via
|
||||||
|
* bpf_perf_event_output() or ring buffer interfaces.
|
||||||
|
* bpf_trace_printk() is to be avoided as it places too small
|
||||||
|
* a limit on string size to be useful.
|
||||||
|
*
|
||||||
|
* *flags* is a combination of
|
||||||
|
*
|
||||||
|
* **BTF_F_COMPACT**
|
||||||
|
* no formatting around type information
|
||||||
|
* **BTF_F_NONAME**
|
||||||
|
* no struct/union member names/types
|
||||||
|
* **BTF_F_PTR_RAW**
|
||||||
|
* show raw (unobfuscated) pointer values;
|
||||||
|
* equivalent to printk specifier %px.
|
||||||
|
* **BTF_F_ZERO**
|
||||||
|
* show zero-valued struct/union members; they
|
||||||
|
* are not displayed by default
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* The number of bytes that were written (or would have been
|
||||||
|
* written if output had to be truncated due to string size),
|
||||||
|
* or a negative error in cases of failure.
|
||||||
|
*/
|
||||||
|
static long (*bpf_snprintf_btf)(char *str, __u32 str_size, struct btf_ptr *ptr, __u32 btf_ptr_size, __u64 flags) = (void *) 149;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_seq_printf_btf
|
||||||
|
*
|
||||||
|
* Use BTF to write to seq_write a string representation of
|
||||||
|
* *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf().
|
||||||
|
* *flags* are identical to those used for bpf_snprintf_btf.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success or a negative error in case of failure.
|
||||||
|
*/
|
||||||
|
static long (*bpf_seq_printf_btf)(struct seq_file *m, struct btf_ptr *ptr, __u32 ptr_size, __u64 flags) = (void *) 150;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_skb_cgroup_classid
|
||||||
|
*
|
||||||
|
* See **bpf_get_cgroup_classid**\ () for the main description.
|
||||||
|
* This helper differs from **bpf_get_cgroup_classid**\ () in that
|
||||||
|
* the cgroup v1 net_cls class is retrieved only from the *skb*'s
|
||||||
|
* associated socket instead of the current process.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* The id is returned or 0 in case the id could not be retrieved.
|
||||||
|
*/
|
||||||
|
static __u64 (*bpf_skb_cgroup_classid)(struct __sk_buff *skb) = (void *) 151;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_redirect_neigh
|
||||||
|
*
|
||||||
|
* Redirect the packet to another net device of index *ifindex*
|
||||||
|
* and fill in L2 addresses from neighboring subsystem. This helper
|
||||||
|
* is somewhat similar to **bpf_redirect**\ (), except that it
|
||||||
|
* populates L2 addresses as well, meaning, internally, the helper
|
||||||
|
* relies on the neighbor lookup for the L2 address of the nexthop.
|
||||||
|
*
|
||||||
|
* The helper will perform a FIB lookup based on the skb's
|
||||||
|
* networking header to get the address of the next hop, unless
|
||||||
|
* this is supplied by the caller in the *params* argument. The
|
||||||
|
* *plen* argument indicates the len of *params* and should be set
|
||||||
|
* to 0 if *params* is NULL.
|
||||||
|
*
|
||||||
|
* The *flags* argument is reserved and must be 0. The helper is
|
||||||
|
* currently only supported for tc BPF program types, and enabled
|
||||||
|
* for IPv4 and IPv6 protocols.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* The helper returns **TC_ACT_REDIRECT** on success or
|
||||||
|
* **TC_ACT_SHOT** on error.
|
||||||
|
*/
|
||||||
|
static long (*bpf_redirect_neigh)(__u32 ifindex, struct bpf_redir_neigh *params, int plen, __u64 flags) = (void *) 152;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_per_cpu_ptr
|
||||||
|
*
|
||||||
|
* Take a pointer to a percpu ksym, *percpu_ptr*, and return a
|
||||||
|
* pointer to the percpu kernel variable on *cpu*. A ksym is an
|
||||||
|
* extern variable decorated with '__ksym'. For ksym, there is a
|
||||||
|
* global var (either static or global) defined of the same name
|
||||||
|
* in the kernel. The ksym is percpu if the global var is percpu.
|
||||||
|
* The returned pointer points to the global percpu var on *cpu*.
|
||||||
|
*
|
||||||
|
* bpf_per_cpu_ptr() has the same semantic as per_cpu_ptr() in the
|
||||||
|
* kernel, except that bpf_per_cpu_ptr() may return NULL. This
|
||||||
|
* happens if *cpu* is larger than nr_cpu_ids. The caller of
|
||||||
|
* bpf_per_cpu_ptr() must check the returned value.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* A pointer pointing to the kernel percpu variable on *cpu*, or
|
||||||
|
* NULL, if *cpu* is invalid.
|
||||||
|
*/
|
||||||
|
static void *(*bpf_per_cpu_ptr)(const void *percpu_ptr, __u32 cpu) = (void *) 153;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_this_cpu_ptr
|
||||||
|
*
|
||||||
|
* Take a pointer to a percpu ksym, *percpu_ptr*, and return a
|
||||||
|
* pointer to the percpu kernel variable on this cpu. See the
|
||||||
|
* description of 'ksym' in **bpf_per_cpu_ptr**\ ().
|
||||||
|
*
|
||||||
|
* bpf_this_cpu_ptr() has the same semantic as this_cpu_ptr() in
|
||||||
|
* the kernel. Different from **bpf_per_cpu_ptr**\ (), it would
|
||||||
|
* never return NULL.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* A pointer pointing to the kernel percpu variable on this cpu.
|
||||||
|
*/
|
||||||
|
static void *(*bpf_this_cpu_ptr)(const void *percpu_ptr) = (void *) 154;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_redirect_peer
|
||||||
|
*
|
||||||
|
* Redirect the packet to another net device of index *ifindex*.
|
||||||
|
* This helper is somewhat similar to **bpf_redirect**\ (), except
|
||||||
|
* that the redirection happens to the *ifindex*' peer device and
|
||||||
|
* the netns switch takes place from ingress to ingress without
|
||||||
|
* going through the CPU's backlog queue.
|
||||||
|
*
|
||||||
|
* The *flags* argument is reserved and must be 0. The helper is
|
||||||
|
* currently only supported for tc BPF program types at the ingress
|
||||||
|
* hook and for veth device types. The peer device must reside in a
|
||||||
|
* different network namespace.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* The helper returns **TC_ACT_REDIRECT** on success or
|
||||||
|
* **TC_ACT_SHOT** on error.
|
||||||
|
*/
|
||||||
|
static long (*bpf_redirect_peer)(__u32 ifindex, __u64 flags) = (void *) 155;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_task_storage_get
|
||||||
|
*
|
||||||
|
* Get a bpf_local_storage from the *task*.
|
||||||
|
*
|
||||||
|
* Logically, it could be thought of as getting the value from
|
||||||
|
* a *map* with *task* as the **key**. From this
|
||||||
|
* perspective, the usage is not much different from
|
||||||
|
* **bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this
|
||||||
|
* helper enforces the key must be an task_struct and the map must also
|
||||||
|
* be a **BPF_MAP_TYPE_TASK_STORAGE**.
|
||||||
|
*
|
||||||
|
* Underneath, the value is stored locally at *task* instead of
|
||||||
|
* the *map*. The *map* is used as the bpf-local-storage
|
||||||
|
* "type". The bpf-local-storage "type" (i.e. the *map*) is
|
||||||
|
* searched against all bpf_local_storage residing at *task*.
|
||||||
|
*
|
||||||
|
* An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be
|
||||||
|
* used such that a new bpf_local_storage will be
|
||||||
|
* created if one does not exist. *value* can be used
|
||||||
|
* together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify
|
||||||
|
* the initial value of a bpf_local_storage. If *value* is
|
||||||
|
* **NULL**, the new bpf_local_storage will be zero initialized.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* A bpf_local_storage pointer is returned on success.
|
||||||
|
*
|
||||||
|
* **NULL** if not found or there was an error in adding
|
||||||
|
* a new bpf_local_storage.
|
||||||
|
*/
|
||||||
|
static void *(*bpf_task_storage_get)(void *map, struct task_struct *task, void *value, __u64 flags) = (void *) 156;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_task_storage_delete
|
||||||
|
*
|
||||||
|
* Delete a bpf_local_storage from a *task*.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* 0 on success.
|
||||||
|
*
|
||||||
|
* **-ENOENT** if the bpf_local_storage cannot be found.
|
||||||
|
*/
|
||||||
|
static long (*bpf_task_storage_delete)(void *map, struct task_struct *task) = (void *) 157;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_get_current_task_btf
|
||||||
|
*
|
||||||
|
* Return a BTF pointer to the "current" task.
|
||||||
|
* This pointer can also be used in helpers that accept an
|
||||||
|
* *ARG_PTR_TO_BTF_ID* of type *task_struct*.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* Pointer to the current task.
|
||||||
|
*/
|
||||||
|
static struct task_struct *(*bpf_get_current_task_btf)(void) = (void *) 158;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_bprm_opts_set
|
||||||
|
*
|
||||||
|
* Set or clear certain options on *bprm*:
|
||||||
|
*
|
||||||
|
* **BPF_F_BPRM_SECUREEXEC** Set the secureexec bit
|
||||||
|
* which sets the **AT_SECURE** auxv for glibc. The bit
|
||||||
|
* is cleared if the flag is not specified.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* **-EINVAL** if invalid *flags* are passed, zero otherwise.
|
||||||
|
*/
|
||||||
|
static long (*bpf_bprm_opts_set)(struct linux_binprm *bprm, __u64 flags) = (void *) 159;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_ktime_get_coarse_ns
|
||||||
|
*
|
||||||
|
* Return a coarse-grained version of the time elapsed since
|
||||||
|
* system boot, in nanoseconds. Does not include time the system
|
||||||
|
* was suspended.
|
||||||
|
*
|
||||||
|
* See: **clock_gettime**\ (**CLOCK_MONOTONIC_COARSE**)
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* Current *ktime*.
|
||||||
|
*/
|
||||||
|
static __u64 (*bpf_ktime_get_coarse_ns)(void) = (void *) 160;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_ima_inode_hash
|
||||||
|
*
|
||||||
|
* Returns the stored IMA hash of the *inode* (if it's avaialable).
|
||||||
|
* If the hash is larger than *size*, then only *size*
|
||||||
|
* bytes will be copied to *dst*
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* The **hash_algo** is returned on success,
|
||||||
|
* **-EOPNOTSUP** if IMA is disabled or **-EINVAL** if
|
||||||
|
* invalid arguments are passed.
|
||||||
|
*/
|
||||||
|
static long (*bpf_ima_inode_hash)(struct inode *inode, void *dst, __u32 size) = (void *) 161;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bpf_sock_from_file
|
||||||
|
*
|
||||||
|
* If the given file represents a socket, returns the associated
|
||||||
|
* socket.
|
||||||
|
*
|
||||||
|
* Returns
|
||||||
|
* A pointer to a struct socket on success or NULL if the file is
|
||||||
|
* not a socket.
|
||||||
|
*/
|
||||||
|
static struct socket *(*bpf_sock_from_file)(struct file *file) = (void *) 162;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
#ifndef __always_inline
|
#ifndef __always_inline
|
||||||
#define __always_inline __attribute__((always_inline))
|
#define __always_inline __attribute__((always_inline))
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef __noinline
|
||||||
|
#define __noinline __attribute__((noinline))
|
||||||
|
#endif
|
||||||
#ifndef __weak
|
#ifndef __weak
|
||||||
#define __weak __attribute__((weak))
|
#define __weak __attribute__((weak))
|
||||||
#endif
|
#endif
|
||||||
@@ -50,6 +53,54 @@
|
|||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper macro to throw a compilation error if __bpf_unreachable() gets
|
||||||
|
* built into the resulting code. This works given BPF back end does not
|
||||||
|
* implement __builtin_trap(). This is useful to assert that certain paths
|
||||||
|
* of the program code are never used and hence eliminated by the compiler.
|
||||||
|
*
|
||||||
|
* For example, consider a switch statement that covers known cases used by
|
||||||
|
* the program. __bpf_unreachable() can then reside in the default case. If
|
||||||
|
* the program gets extended such that a case is not covered in the switch
|
||||||
|
* statement, then it will throw a build error due to the default case not
|
||||||
|
* being compiled out.
|
||||||
|
*/
|
||||||
|
#ifndef __bpf_unreachable
|
||||||
|
# define __bpf_unreachable() __builtin_trap()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Helper function to perform a tail call with a constant/immediate map slot.
|
||||||
|
*/
|
||||||
|
#if __clang_major__ >= 8 && defined(__bpf__)
|
||||||
|
static __always_inline void
|
||||||
|
bpf_tail_call_static(void *ctx, const void *map, const __u32 slot)
|
||||||
|
{
|
||||||
|
if (!__builtin_constant_p(slot))
|
||||||
|
__bpf_unreachable();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provide a hard guarantee that LLVM won't optimize setting r2 (map
|
||||||
|
* pointer) and r3 (constant map index) from _different paths_ ending
|
||||||
|
* up at the _same_ call insn as otherwise we won't be able to use the
|
||||||
|
* jmpq/nopl retpoline-free patching by the x86-64 JIT in the kernel
|
||||||
|
* given they mismatch. See also d2e4c1e6c294 ("bpf: Constant map key
|
||||||
|
* tracking for prog array pokes") for details on verifier tracking.
|
||||||
|
*
|
||||||
|
* Note on clobber list: we need to stay in-line with BPF calling
|
||||||
|
* convention, so even if we don't end up using r0, r4, r5, we need
|
||||||
|
* to mark them as clobber so that LLVM doesn't end up using them
|
||||||
|
* before / after the call.
|
||||||
|
*/
|
||||||
|
asm volatile("r1 = %[ctx]\n\t"
|
||||||
|
"r2 = %[map]\n\t"
|
||||||
|
"r3 = %[slot]\n\t"
|
||||||
|
"call 12"
|
||||||
|
:: [ctx]"r"(ctx), [map]"r"(map), [slot]"i"(slot)
|
||||||
|
: "r0", "r1", "r2", "r3", "r4", "r5");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper structure used by eBPF C program
|
* Helper structure used by eBPF C program
|
||||||
* to describe BPF map attributes to libbpf loader
|
* to describe BPF map attributes to libbpf loader
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
struct bpf_prog_linfo {
|
struct bpf_prog_linfo {
|
||||||
void *raw_linfo;
|
void *raw_linfo;
|
||||||
void *raw_jited_linfo;
|
void *raw_jited_linfo;
|
||||||
|
|||||||
@@ -289,9 +289,9 @@ struct pt_regs;
|
|||||||
#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP
|
#define BPF_KRETPROBE_READ_RET_IP BPF_KPROBE_READ_RET_IP
|
||||||
#else
|
#else
|
||||||
#define BPF_KPROBE_READ_RET_IP(ip, ctx) \
|
#define BPF_KPROBE_READ_RET_IP(ip, ctx) \
|
||||||
({ bpf_probe_read(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx)); })
|
({ bpf_probe_read_kernel(&(ip), sizeof(ip), (void *)PT_REGS_RET(ctx)); })
|
||||||
#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) \
|
#define BPF_KRETPROBE_READ_RET_IP(ip, ctx) \
|
||||||
({ bpf_probe_read(&(ip), sizeof(ip), \
|
({ bpf_probe_read_kernel(&(ip), sizeof(ip), \
|
||||||
(void *)(PT_REGS_FP(ctx) + sizeof(ip))); })
|
(void *)(PT_REGS_FP(ctx) + sizeof(ip))); })
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
112
src/btf.h
112
src/btf.h
@@ -5,6 +5,7 @@
|
|||||||
#define __LIBBPF_BTF_H
|
#define __LIBBPF_BTF_H
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <linux/btf.h>
|
#include <linux/btf.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
@@ -24,49 +25,25 @@ struct btf_type;
|
|||||||
|
|
||||||
struct bpf_object;
|
struct bpf_object;
|
||||||
|
|
||||||
/*
|
enum btf_endianness {
|
||||||
* The .BTF.ext ELF section layout defined as
|
BTF_LITTLE_ENDIAN = 0,
|
||||||
* struct btf_ext_header
|
BTF_BIG_ENDIAN = 1,
|
||||||
* func_info subsection
|
|
||||||
*
|
|
||||||
* The func_info subsection layout:
|
|
||||||
* record size for struct bpf_func_info in the func_info subsection
|
|
||||||
* struct btf_sec_func_info for section #1
|
|
||||||
* a list of bpf_func_info records for section #1
|
|
||||||
* where struct bpf_func_info mimics one in include/uapi/linux/bpf.h
|
|
||||||
* but may not be identical
|
|
||||||
* struct btf_sec_func_info for section #2
|
|
||||||
* a list of bpf_func_info records for section #2
|
|
||||||
* ......
|
|
||||||
*
|
|
||||||
* Note that the bpf_func_info record size in .BTF.ext may not
|
|
||||||
* be the same as the one defined in include/uapi/linux/bpf.h.
|
|
||||||
* The loader should ensure that record_size meets minimum
|
|
||||||
* requirement and pass the record as is to the kernel. The
|
|
||||||
* kernel will handle the func_info properly based on its contents.
|
|
||||||
*/
|
|
||||||
struct btf_ext_header {
|
|
||||||
__u16 magic;
|
|
||||||
__u8 version;
|
|
||||||
__u8 flags;
|
|
||||||
__u32 hdr_len;
|
|
||||||
|
|
||||||
/* All offsets are in bytes relative to the end of this header */
|
|
||||||
__u32 func_info_off;
|
|
||||||
__u32 func_info_len;
|
|
||||||
__u32 line_info_off;
|
|
||||||
__u32 line_info_len;
|
|
||||||
|
|
||||||
/* optional part of .BTF.ext header */
|
|
||||||
__u32 field_reloc_off;
|
|
||||||
__u32 field_reloc_len;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LIBBPF_API void btf__free(struct btf *btf);
|
LIBBPF_API void btf__free(struct btf *btf);
|
||||||
|
|
||||||
LIBBPF_API struct btf *btf__new(const void *data, __u32 size);
|
LIBBPF_API struct btf *btf__new(const void *data, __u32 size);
|
||||||
|
LIBBPF_API struct btf *btf__new_split(const void *data, __u32 size, struct btf *base_btf);
|
||||||
|
LIBBPF_API struct btf *btf__new_empty(void);
|
||||||
|
LIBBPF_API struct btf *btf__new_empty_split(struct btf *base_btf);
|
||||||
|
|
||||||
LIBBPF_API struct btf *btf__parse(const char *path, struct btf_ext **btf_ext);
|
LIBBPF_API struct btf *btf__parse(const char *path, struct btf_ext **btf_ext);
|
||||||
|
LIBBPF_API struct btf *btf__parse_split(const char *path, struct btf *base_btf);
|
||||||
LIBBPF_API struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext);
|
LIBBPF_API struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext);
|
||||||
|
LIBBPF_API struct btf *btf__parse_elf_split(const char *path, struct btf *base_btf);
|
||||||
LIBBPF_API struct btf *btf__parse_raw(const char *path);
|
LIBBPF_API struct btf *btf__parse_raw(const char *path);
|
||||||
|
LIBBPF_API struct btf *btf__parse_raw_split(const char *path, struct btf *base_btf);
|
||||||
|
|
||||||
LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf);
|
LIBBPF_API int btf__finalize_data(struct bpf_object *obj, struct btf *btf);
|
||||||
LIBBPF_API int btf__load(struct btf *btf);
|
LIBBPF_API int btf__load(struct btf *btf);
|
||||||
LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
|
LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
|
||||||
@@ -74,10 +51,13 @@ LIBBPF_API __s32 btf__find_by_name(const struct btf *btf,
|
|||||||
LIBBPF_API __s32 btf__find_by_name_kind(const struct btf *btf,
|
LIBBPF_API __s32 btf__find_by_name_kind(const struct btf *btf,
|
||||||
const char *type_name, __u32 kind);
|
const char *type_name, __u32 kind);
|
||||||
LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
|
LIBBPF_API __u32 btf__get_nr_types(const struct btf *btf);
|
||||||
|
LIBBPF_API const struct btf *btf__base_btf(const struct btf *btf);
|
||||||
LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
|
LIBBPF_API const struct btf_type *btf__type_by_id(const struct btf *btf,
|
||||||
__u32 id);
|
__u32 id);
|
||||||
LIBBPF_API size_t btf__pointer_size(const struct btf *btf);
|
LIBBPF_API size_t btf__pointer_size(const struct btf *btf);
|
||||||
LIBBPF_API int btf__set_pointer_size(struct btf *btf, size_t ptr_sz);
|
LIBBPF_API int btf__set_pointer_size(struct btf *btf, size_t ptr_sz);
|
||||||
|
LIBBPF_API enum btf_endianness btf__endianness(const struct btf *btf);
|
||||||
|
LIBBPF_API int btf__set_endianness(struct btf *btf, enum btf_endianness endian);
|
||||||
LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
|
LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
|
||||||
LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
|
LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
|
||||||
LIBBPF_API int btf__align_of(const struct btf *btf, __u32 id);
|
LIBBPF_API int btf__align_of(const struct btf *btf, __u32 id);
|
||||||
@@ -85,6 +65,7 @@ LIBBPF_API int btf__fd(const struct btf *btf);
|
|||||||
LIBBPF_API void btf__set_fd(struct btf *btf, int fd);
|
LIBBPF_API void btf__set_fd(struct btf *btf, int fd);
|
||||||
LIBBPF_API const void *btf__get_raw_data(const struct btf *btf, __u32 *size);
|
LIBBPF_API const void *btf__get_raw_data(const struct btf *btf, __u32 *size);
|
||||||
LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
|
LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
|
||||||
|
LIBBPF_API const char *btf__str_by_offset(const struct btf *btf, __u32 offset);
|
||||||
LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
|
LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
|
||||||
LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
|
LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
|
||||||
__u32 expected_key_size,
|
__u32 expected_key_size,
|
||||||
@@ -95,19 +76,62 @@ LIBBPF_API struct btf_ext *btf_ext__new(__u8 *data, __u32 size);
|
|||||||
LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext);
|
LIBBPF_API void btf_ext__free(struct btf_ext *btf_ext);
|
||||||
LIBBPF_API const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext,
|
LIBBPF_API const void *btf_ext__get_raw_data(const struct btf_ext *btf_ext,
|
||||||
__u32 *size);
|
__u32 *size);
|
||||||
LIBBPF_API int btf_ext__reloc_func_info(const struct btf *btf,
|
LIBBPF_API LIBBPF_DEPRECATED("btf_ext__reloc_func_info was never meant as a public API and has wrong assumptions embedded in it; it will be removed in the future libbpf versions")
|
||||||
const struct btf_ext *btf_ext,
|
int btf_ext__reloc_func_info(const struct btf *btf,
|
||||||
const char *sec_name, __u32 insns_cnt,
|
const struct btf_ext *btf_ext,
|
||||||
void **func_info, __u32 *cnt);
|
const char *sec_name, __u32 insns_cnt,
|
||||||
LIBBPF_API int btf_ext__reloc_line_info(const struct btf *btf,
|
void **func_info, __u32 *cnt);
|
||||||
const struct btf_ext *btf_ext,
|
LIBBPF_API LIBBPF_DEPRECATED("btf_ext__reloc_line_info was never meant as a public API and has wrong assumptions embedded in it; it will be removed in the future libbpf versions")
|
||||||
const char *sec_name, __u32 insns_cnt,
|
int btf_ext__reloc_line_info(const struct btf *btf,
|
||||||
void **line_info, __u32 *cnt);
|
const struct btf_ext *btf_ext,
|
||||||
|
const char *sec_name, __u32 insns_cnt,
|
||||||
|
void **line_info, __u32 *cnt);
|
||||||
LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
|
LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
|
||||||
LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);
|
LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);
|
||||||
|
|
||||||
LIBBPF_API struct btf *libbpf_find_kernel_btf(void);
|
LIBBPF_API struct btf *libbpf_find_kernel_btf(void);
|
||||||
|
|
||||||
|
LIBBPF_API int btf__find_str(struct btf *btf, const char *s);
|
||||||
|
LIBBPF_API int btf__add_str(struct btf *btf, const char *s);
|
||||||
|
|
||||||
|
LIBBPF_API int btf__add_int(struct btf *btf, const char *name, size_t byte_sz, int encoding);
|
||||||
|
LIBBPF_API int btf__add_ptr(struct btf *btf, int ref_type_id);
|
||||||
|
LIBBPF_API int btf__add_array(struct btf *btf,
|
||||||
|
int index_type_id, int elem_type_id, __u32 nr_elems);
|
||||||
|
/* struct/union construction APIs */
|
||||||
|
LIBBPF_API int btf__add_struct(struct btf *btf, const char *name, __u32 sz);
|
||||||
|
LIBBPF_API int btf__add_union(struct btf *btf, const char *name, __u32 sz);
|
||||||
|
LIBBPF_API int btf__add_field(struct btf *btf, const char *name, int field_type_id,
|
||||||
|
__u32 bit_offset, __u32 bit_size);
|
||||||
|
|
||||||
|
/* enum construction APIs */
|
||||||
|
LIBBPF_API int btf__add_enum(struct btf *btf, const char *name, __u32 bytes_sz);
|
||||||
|
LIBBPF_API int btf__add_enum_value(struct btf *btf, const char *name, __s64 value);
|
||||||
|
|
||||||
|
enum btf_fwd_kind {
|
||||||
|
BTF_FWD_STRUCT = 0,
|
||||||
|
BTF_FWD_UNION = 1,
|
||||||
|
BTF_FWD_ENUM = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
LIBBPF_API int btf__add_fwd(struct btf *btf, const char *name, enum btf_fwd_kind fwd_kind);
|
||||||
|
LIBBPF_API int btf__add_typedef(struct btf *btf, const char *name, int ref_type_id);
|
||||||
|
LIBBPF_API int btf__add_volatile(struct btf *btf, int ref_type_id);
|
||||||
|
LIBBPF_API int btf__add_const(struct btf *btf, int ref_type_id);
|
||||||
|
LIBBPF_API int btf__add_restrict(struct btf *btf, int ref_type_id);
|
||||||
|
|
||||||
|
/* func and func_proto construction APIs */
|
||||||
|
LIBBPF_API int btf__add_func(struct btf *btf, const char *name,
|
||||||
|
enum btf_func_linkage linkage, int proto_type_id);
|
||||||
|
LIBBPF_API int btf__add_func_proto(struct btf *btf, int ret_type_id);
|
||||||
|
LIBBPF_API int btf__add_func_param(struct btf *btf, const char *name, int type_id);
|
||||||
|
|
||||||
|
/* var & datasec construction APIs */
|
||||||
|
LIBBPF_API int btf__add_var(struct btf *btf, const char *name, int linkage, int type_id);
|
||||||
|
LIBBPF_API int btf__add_datasec(struct btf *btf, const char *name, __u32 byte_sz);
|
||||||
|
LIBBPF_API int btf__add_datasec_var_info(struct btf *btf, int var_type_id,
|
||||||
|
__u32 offset, __u32 byte_sz);
|
||||||
|
|
||||||
struct btf_dedup_opts {
|
struct btf_dedup_opts {
|
||||||
unsigned int dedup_table_size;
|
unsigned int dedup_table_size;
|
||||||
bool dont_resolve_fwds;
|
bool dont_resolve_fwds;
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
static const char PREFIXES[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
static const char PREFIXES[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
||||||
static const size_t PREFIX_CNT = sizeof(PREFIXES) - 1;
|
static const size_t PREFIX_CNT = sizeof(PREFIXES) - 1;
|
||||||
|
|
||||||
@@ -63,11 +60,14 @@ struct btf_dump {
|
|||||||
struct btf_dump_opts opts;
|
struct btf_dump_opts opts;
|
||||||
int ptr_sz;
|
int ptr_sz;
|
||||||
bool strip_mods;
|
bool strip_mods;
|
||||||
|
int last_id;
|
||||||
|
|
||||||
/* per-type auxiliary state */
|
/* per-type auxiliary state */
|
||||||
struct btf_dump_type_aux_state *type_states;
|
struct btf_dump_type_aux_state *type_states;
|
||||||
|
size_t type_states_cap;
|
||||||
/* per-type optional cached unique name, must be freed, if present */
|
/* per-type optional cached unique name, must be freed, if present */
|
||||||
const char **cached_names;
|
const char **cached_names;
|
||||||
|
size_t cached_names_cap;
|
||||||
|
|
||||||
/* topo-sorted list of dependent type definitions */
|
/* topo-sorted list of dependent type definitions */
|
||||||
__u32 *emit_queue;
|
__u32 *emit_queue;
|
||||||
@@ -93,14 +93,7 @@ struct btf_dump {
|
|||||||
|
|
||||||
static size_t str_hash_fn(const void *key, void *ctx)
|
static size_t str_hash_fn(const void *key, void *ctx)
|
||||||
{
|
{
|
||||||
const char *s = key;
|
return str_hash(key);
|
||||||
size_t h = 0;
|
|
||||||
|
|
||||||
while (*s) {
|
|
||||||
h = h * 31 + *s;
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
return h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool str_equal_fn(const void *a, const void *b, void *ctx)
|
static bool str_equal_fn(const void *a, const void *b, void *ctx)
|
||||||
@@ -123,6 +116,7 @@ static void btf_dump_printf(const struct btf_dump *d, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int btf_dump_mark_referenced(struct btf_dump *d);
|
static int btf_dump_mark_referenced(struct btf_dump *d);
|
||||||
|
static int btf_dump_resize(struct btf_dump *d);
|
||||||
|
|
||||||
struct btf_dump *btf_dump__new(const struct btf *btf,
|
struct btf_dump *btf_dump__new(const struct btf *btf,
|
||||||
const struct btf_ext *btf_ext,
|
const struct btf_ext *btf_ext,
|
||||||
@@ -154,25 +148,8 @@ struct btf_dump *btf_dump__new(const struct btf *btf,
|
|||||||
d->ident_names = NULL;
|
d->ident_names = NULL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
d->type_states = calloc(1 + btf__get_nr_types(d->btf),
|
|
||||||
sizeof(d->type_states[0]));
|
|
||||||
if (!d->type_states) {
|
|
||||||
err = -ENOMEM;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
d->cached_names = calloc(1 + btf__get_nr_types(d->btf),
|
|
||||||
sizeof(d->cached_names[0]));
|
|
||||||
if (!d->cached_names) {
|
|
||||||
err = -ENOMEM;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* VOID is special */
|
err = btf_dump_resize(d);
|
||||||
d->type_states[0].order_state = ORDERED;
|
|
||||||
d->type_states[0].emit_state = EMITTED;
|
|
||||||
|
|
||||||
/* eagerly determine referenced types for anon enums */
|
|
||||||
err = btf_dump_mark_referenced(d);
|
|
||||||
if (err)
|
if (err)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@@ -182,9 +159,38 @@ err:
|
|||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int btf_dump_resize(struct btf_dump *d)
|
||||||
|
{
|
||||||
|
int err, last_id = btf__get_nr_types(d->btf);
|
||||||
|
|
||||||
|
if (last_id <= d->last_id)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (btf_ensure_mem((void **)&d->type_states, &d->type_states_cap,
|
||||||
|
sizeof(*d->type_states), last_id + 1))
|
||||||
|
return -ENOMEM;
|
||||||
|
if (btf_ensure_mem((void **)&d->cached_names, &d->cached_names_cap,
|
||||||
|
sizeof(*d->cached_names), last_id + 1))
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
if (d->last_id == 0) {
|
||||||
|
/* VOID is special */
|
||||||
|
d->type_states[0].order_state = ORDERED;
|
||||||
|
d->type_states[0].emit_state = EMITTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* eagerly determine referenced types for anon enums */
|
||||||
|
err = btf_dump_mark_referenced(d);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
d->last_id = last_id;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void btf_dump__free(struct btf_dump *d)
|
void btf_dump__free(struct btf_dump *d)
|
||||||
{
|
{
|
||||||
int i, cnt;
|
int i;
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(d))
|
if (IS_ERR_OR_NULL(d))
|
||||||
return;
|
return;
|
||||||
@@ -192,7 +198,7 @@ void btf_dump__free(struct btf_dump *d)
|
|||||||
free(d->type_states);
|
free(d->type_states);
|
||||||
if (d->cached_names) {
|
if (d->cached_names) {
|
||||||
/* any set cached name is owned by us and should be freed */
|
/* any set cached name is owned by us and should be freed */
|
||||||
for (i = 0, cnt = btf__get_nr_types(d->btf); i <= cnt; i++) {
|
for (i = 0; i <= d->last_id; i++) {
|
||||||
if (d->cached_names[i])
|
if (d->cached_names[i])
|
||||||
free((void *)d->cached_names[i]);
|
free((void *)d->cached_names[i]);
|
||||||
}
|
}
|
||||||
@@ -232,6 +238,10 @@ int btf_dump__dump_type(struct btf_dump *d, __u32 id)
|
|||||||
if (id > btf__get_nr_types(d->btf))
|
if (id > btf__get_nr_types(d->btf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
err = btf_dump_resize(d);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
d->emit_queue_cnt = 0;
|
d->emit_queue_cnt = 0;
|
||||||
err = btf_dump_order_type(d, id, false);
|
err = btf_dump_order_type(d, id, false);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
@@ -261,7 +271,7 @@ static int btf_dump_mark_referenced(struct btf_dump *d)
|
|||||||
const struct btf_type *t;
|
const struct btf_type *t;
|
||||||
__u16 vlen;
|
__u16 vlen;
|
||||||
|
|
||||||
for (i = 1; i <= n; i++) {
|
for (i = d->last_id + 1; i <= n; i++) {
|
||||||
t = btf__type_by_id(d->btf, i);
|
t = btf__type_by_id(d->btf, i);
|
||||||
vlen = btf_vlen(t);
|
vlen = btf_vlen(t);
|
||||||
|
|
||||||
@@ -316,6 +326,7 @@ static int btf_dump_mark_referenced(struct btf_dump *d)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int btf_dump_add_emit_queue_id(struct btf_dump *d, __u32 id)
|
static int btf_dump_add_emit_queue_id(struct btf_dump *d, __u32 id)
|
||||||
{
|
{
|
||||||
__u32 *new_queue;
|
__u32 *new_queue;
|
||||||
@@ -323,8 +334,7 @@ static int btf_dump_add_emit_queue_id(struct btf_dump *d, __u32 id)
|
|||||||
|
|
||||||
if (d->emit_queue_cnt >= d->emit_queue_cap) {
|
if (d->emit_queue_cnt >= d->emit_queue_cap) {
|
||||||
new_cap = max(16, d->emit_queue_cap * 3 / 2);
|
new_cap = max(16, d->emit_queue_cap * 3 / 2);
|
||||||
new_queue = realloc(d->emit_queue,
|
new_queue = libbpf_reallocarray(d->emit_queue, new_cap, sizeof(new_queue[0]));
|
||||||
new_cap * sizeof(new_queue[0]));
|
|
||||||
if (!new_queue)
|
if (!new_queue)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
d->emit_queue = new_queue;
|
d->emit_queue = new_queue;
|
||||||
@@ -1003,8 +1013,7 @@ static int btf_dump_push_decl_stack_id(struct btf_dump *d, __u32 id)
|
|||||||
|
|
||||||
if (d->decl_stack_cnt >= d->decl_stack_cap) {
|
if (d->decl_stack_cnt >= d->decl_stack_cap) {
|
||||||
new_cap = max(16, d->decl_stack_cap * 3 / 2);
|
new_cap = max(16, d->decl_stack_cap * 3 / 2);
|
||||||
new_stack = realloc(d->decl_stack,
|
new_stack = libbpf_reallocarray(d->decl_stack, new_cap, sizeof(new_stack[0]));
|
||||||
new_cap * sizeof(new_stack[0]));
|
|
||||||
if (!new_stack)
|
if (!new_stack)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
d->decl_stack = new_stack;
|
d->decl_stack = new_stack;
|
||||||
@@ -1061,11 +1070,15 @@ int btf_dump__emit_type_decl(struct btf_dump *d, __u32 id,
|
|||||||
const struct btf_dump_emit_type_decl_opts *opts)
|
const struct btf_dump_emit_type_decl_opts *opts)
|
||||||
{
|
{
|
||||||
const char *fname;
|
const char *fname;
|
||||||
int lvl;
|
int lvl, err;
|
||||||
|
|
||||||
if (!OPTS_VALID(opts, btf_dump_emit_type_decl_opts))
|
if (!OPTS_VALID(opts, btf_dump_emit_type_decl_opts))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
err = btf_dump_resize(d);
|
||||||
|
if (err)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
fname = OPTS_GET(opts, field_name, "");
|
fname = OPTS_GET(opts, field_name, "");
|
||||||
lvl = OPTS_GET(opts, indent_level, 0);
|
lvl = OPTS_GET(opts, indent_level, 0);
|
||||||
d->strip_mods = OPTS_GET(opts, strip_mods, false);
|
d->strip_mods = OPTS_GET(opts, strip_mods, false);
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
||||||
|
|
||||||
|
/* prevent accidental re-addition of reallocarray() */
|
||||||
|
#pragma GCC poison reallocarray
|
||||||
|
|
||||||
/* start with 4 buckets */
|
/* start with 4 buckets */
|
||||||
#define HASHMAP_MIN_CAP_BITS 2
|
#define HASHMAP_MIN_CAP_BITS 2
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
static inline size_t hash_bits(size_t h, int bits)
|
static inline size_t hash_bits(size_t h, int bits)
|
||||||
{
|
{
|
||||||
/* shuffle bits and return requested number of upper bits */
|
/* shuffle bits and return requested number of upper bits */
|
||||||
|
if (bits == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
#if (__SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__)
|
#if (__SIZEOF_SIZE_T__ == __SIZEOF_LONG_LONG__)
|
||||||
/* LP64 case */
|
/* LP64 case */
|
||||||
return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
|
return (h * 11400714819323198485llu) >> (__SIZEOF_LONG_LONG__ * 8 - bits);
|
||||||
@@ -25,6 +28,18 @@ static inline size_t hash_bits(size_t h, int bits)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* generic C-string hashing function */
|
||||||
|
static inline size_t str_hash(const char *s)
|
||||||
|
{
|
||||||
|
size_t h = 0;
|
||||||
|
|
||||||
|
while (*s) {
|
||||||
|
h = h * 31 + *s;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
|
typedef size_t (*hashmap_hash_fn)(const void *key, void *ctx);
|
||||||
typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx);
|
typedef bool (*hashmap_equal_fn)(const void *key1, const void *key2, void *ctx);
|
||||||
|
|
||||||
@@ -162,17 +177,17 @@ bool hashmap__find(const struct hashmap *map, const void *key, void **value);
|
|||||||
* @key: key to iterate entries for
|
* @key: key to iterate entries for
|
||||||
*/
|
*/
|
||||||
#define hashmap__for_each_key_entry(map, cur, _key) \
|
#define hashmap__for_each_key_entry(map, cur, _key) \
|
||||||
for (cur = ({ size_t bkt = hash_bits(map->hash_fn((_key), map->ctx),\
|
for (cur = map->buckets \
|
||||||
map->cap_bits); \
|
? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
|
||||||
map->buckets ? map->buckets[bkt] : NULL; }); \
|
: NULL; \
|
||||||
cur; \
|
cur; \
|
||||||
cur = cur->next) \
|
cur = cur->next) \
|
||||||
if (map->equal_fn(cur->key, (_key), map->ctx))
|
if (map->equal_fn(cur->key, (_key), map->ctx))
|
||||||
|
|
||||||
#define hashmap__for_each_key_entry_safe(map, cur, tmp, _key) \
|
#define hashmap__for_each_key_entry_safe(map, cur, tmp, _key) \
|
||||||
for (cur = ({ size_t bkt = hash_bits(map->hash_fn((_key), map->ctx),\
|
for (cur = map->buckets \
|
||||||
map->cap_bits); \
|
? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
|
||||||
cur = map->buckets ? map->buckets[bkt] : NULL; }); \
|
: NULL; \
|
||||||
cur && ({ tmp = cur->next; true; }); \
|
cur && ({ tmp = cur->next; true; }); \
|
||||||
cur = tmp) \
|
cur = tmp) \
|
||||||
if (map->equal_fn(cur->key, (_key), map->ctx))
|
if (map->equal_fn(cur->key, (_key), map->ctx))
|
||||||
|
|||||||
3963
src/libbpf.c
3963
src/libbpf.c
File diff suppressed because it is too large
Load Diff
13
src/libbpf.h
13
src/libbpf.h
@@ -198,8 +198,9 @@ LIBBPF_API void bpf_program__set_ifindex(struct bpf_program *prog,
|
|||||||
__u32 ifindex);
|
__u32 ifindex);
|
||||||
|
|
||||||
LIBBPF_API const char *bpf_program__name(const struct bpf_program *prog);
|
LIBBPF_API const char *bpf_program__name(const struct bpf_program *prog);
|
||||||
LIBBPF_API const char *bpf_program__title(const struct bpf_program *prog,
|
LIBBPF_API const char *bpf_program__section_name(const struct bpf_program *prog);
|
||||||
bool needs_copy);
|
LIBBPF_API LIBBPF_DEPRECATED("BPF program title is confusing term; please use bpf_program__section_name() instead")
|
||||||
|
const char *bpf_program__title(const struct bpf_program *prog, bool needs_copy);
|
||||||
LIBBPF_API bool bpf_program__autoload(const struct bpf_program *prog);
|
LIBBPF_API bool bpf_program__autoload(const struct bpf_program *prog);
|
||||||
LIBBPF_API int bpf_program__set_autoload(struct bpf_program *prog, bool autoload);
|
LIBBPF_API int bpf_program__set_autoload(struct bpf_program *prog, bool autoload);
|
||||||
|
|
||||||
@@ -260,6 +261,9 @@ LIBBPF_API struct bpf_link *
|
|||||||
bpf_program__attach_netns(struct bpf_program *prog, int netns_fd);
|
bpf_program__attach_netns(struct bpf_program *prog, int netns_fd);
|
||||||
LIBBPF_API struct bpf_link *
|
LIBBPF_API struct bpf_link *
|
||||||
bpf_program__attach_xdp(struct bpf_program *prog, int ifindex);
|
bpf_program__attach_xdp(struct bpf_program *prog, int ifindex);
|
||||||
|
LIBBPF_API struct bpf_link *
|
||||||
|
bpf_program__attach_freplace(struct bpf_program *prog,
|
||||||
|
int target_fd, const char *attach_func_name);
|
||||||
|
|
||||||
struct bpf_map;
|
struct bpf_map;
|
||||||
|
|
||||||
@@ -532,6 +536,7 @@ LIBBPF_API int ring_buffer__add(struct ring_buffer *rb, int map_fd,
|
|||||||
ring_buffer_sample_fn sample_cb, void *ctx);
|
ring_buffer_sample_fn sample_cb, void *ctx);
|
||||||
LIBBPF_API int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms);
|
LIBBPF_API int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms);
|
||||||
LIBBPF_API int ring_buffer__consume(struct ring_buffer *rb);
|
LIBBPF_API int ring_buffer__consume(struct ring_buffer *rb);
|
||||||
|
LIBBPF_API int ring_buffer__epoll_fd(const struct ring_buffer *rb);
|
||||||
|
|
||||||
/* Perf buffer APIs */
|
/* Perf buffer APIs */
|
||||||
struct perf_buffer;
|
struct perf_buffer;
|
||||||
@@ -588,8 +593,12 @@ perf_buffer__new_raw(int map_fd, size_t page_cnt,
|
|||||||
const struct perf_buffer_raw_opts *opts);
|
const struct perf_buffer_raw_opts *opts);
|
||||||
|
|
||||||
LIBBPF_API void perf_buffer__free(struct perf_buffer *pb);
|
LIBBPF_API void perf_buffer__free(struct perf_buffer *pb);
|
||||||
|
LIBBPF_API int perf_buffer__epoll_fd(const struct perf_buffer *pb);
|
||||||
LIBBPF_API int perf_buffer__poll(struct perf_buffer *pb, int timeout_ms);
|
LIBBPF_API int perf_buffer__poll(struct perf_buffer *pb, int timeout_ms);
|
||||||
LIBBPF_API int perf_buffer__consume(struct perf_buffer *pb);
|
LIBBPF_API int perf_buffer__consume(struct perf_buffer *pb);
|
||||||
|
LIBBPF_API int perf_buffer__consume_buffer(struct perf_buffer *pb, size_t buf_idx);
|
||||||
|
LIBBPF_API size_t perf_buffer__buffer_cnt(const struct perf_buffer *pb);
|
||||||
|
LIBBPF_API int perf_buffer__buffer_fd(const struct perf_buffer *pb, size_t buf_idx);
|
||||||
|
|
||||||
typedef enum bpf_perf_event_ret
|
typedef enum bpf_perf_event_ret
|
||||||
(*bpf_perf_event_print_t)(struct perf_event_header *hdr,
|
(*bpf_perf_event_print_t)(struct perf_event_header *hdr,
|
||||||
|
|||||||
@@ -299,3 +299,54 @@ LIBBPF_0.1.0 {
|
|||||||
btf__set_fd;
|
btf__set_fd;
|
||||||
btf__set_pointer_size;
|
btf__set_pointer_size;
|
||||||
} LIBBPF_0.0.9;
|
} LIBBPF_0.0.9;
|
||||||
|
|
||||||
|
LIBBPF_0.2.0 {
|
||||||
|
global:
|
||||||
|
bpf_prog_bind_map;
|
||||||
|
bpf_prog_test_run_opts;
|
||||||
|
bpf_program__attach_freplace;
|
||||||
|
bpf_program__section_name;
|
||||||
|
btf__add_array;
|
||||||
|
btf__add_const;
|
||||||
|
btf__add_enum;
|
||||||
|
btf__add_enum_value;
|
||||||
|
btf__add_datasec;
|
||||||
|
btf__add_datasec_var_info;
|
||||||
|
btf__add_field;
|
||||||
|
btf__add_func;
|
||||||
|
btf__add_func_param;
|
||||||
|
btf__add_func_proto;
|
||||||
|
btf__add_fwd;
|
||||||
|
btf__add_int;
|
||||||
|
btf__add_ptr;
|
||||||
|
btf__add_restrict;
|
||||||
|
btf__add_str;
|
||||||
|
btf__add_struct;
|
||||||
|
btf__add_typedef;
|
||||||
|
btf__add_union;
|
||||||
|
btf__add_var;
|
||||||
|
btf__add_volatile;
|
||||||
|
btf__endianness;
|
||||||
|
btf__find_str;
|
||||||
|
btf__new_empty;
|
||||||
|
btf__set_endianness;
|
||||||
|
btf__str_by_offset;
|
||||||
|
perf_buffer__buffer_cnt;
|
||||||
|
perf_buffer__buffer_fd;
|
||||||
|
perf_buffer__epoll_fd;
|
||||||
|
perf_buffer__consume_buffer;
|
||||||
|
xsk_socket__create_shared;
|
||||||
|
} LIBBPF_0.1.0;
|
||||||
|
|
||||||
|
LIBBPF_0.3.0 {
|
||||||
|
global:
|
||||||
|
btf__base_btf;
|
||||||
|
btf__parse_elf_split;
|
||||||
|
btf__parse_raw_split;
|
||||||
|
btf__parse_split;
|
||||||
|
btf__new_empty_split;
|
||||||
|
btf__new_split;
|
||||||
|
ring_buffer__epoll_fd;
|
||||||
|
xsk_setup_xdp_prog;
|
||||||
|
xsk_socket__update_xskmap;
|
||||||
|
} LIBBPF_0.2.0;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#define LIBBPF_API __attribute__((visibility("default")))
|
#define LIBBPF_API __attribute__((visibility("default")))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define LIBBPF_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||||
|
|
||||||
/* Helper macro to declare and initialize libbpf options struct
|
/* Helper macro to declare and initialize libbpf options struct
|
||||||
*
|
*
|
||||||
* This dance with uninitialized declaration, followed by memset to zero,
|
* This dance with uninitialized declaration, followed by memset to zero,
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
#ifndef __LIBBPF_LIBBPF_INTERNAL_H
|
#ifndef __LIBBPF_LIBBPF_INTERNAL_H
|
||||||
#define __LIBBPF_LIBBPF_INTERNAL_H
|
#define __LIBBPF_LIBBPF_INTERNAL_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
||||||
|
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
||||||
|
|
||||||
|
/* prevent accidental re-addition of reallocarray() */
|
||||||
|
#pragma GCC poison reallocarray
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
|
|
||||||
#define BTF_INFO_ENC(kind, kind_flag, vlen) \
|
#define BTF_INFO_ENC(kind, kind_flag, vlen) \
|
||||||
@@ -23,6 +32,12 @@
|
|||||||
#define BTF_PARAM_ENC(name, type) (name), (type)
|
#define BTF_PARAM_ENC(name, type) (name), (type)
|
||||||
#define BTF_VAR_SECINFO_ENC(type, offset, size) (type), (offset), (size)
|
#define BTF_VAR_SECINFO_ENC(type, offset, size) (type), (offset), (size)
|
||||||
|
|
||||||
|
#ifndef likely
|
||||||
|
#define likely(x) __builtin_expect(!!(x), 1)
|
||||||
|
#endif
|
||||||
|
#ifndef unlikely
|
||||||
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
#endif
|
||||||
#ifndef min
|
#ifndef min
|
||||||
# define min(x, y) ((x) < (y) ? (x) : (y))
|
# define min(x, y) ((x) < (y) ? (x) : (y))
|
||||||
#endif
|
#endif
|
||||||
@@ -63,6 +78,37 @@ do { \
|
|||||||
#define pr_info(fmt, ...) __pr(LIBBPF_INFO, fmt, ##__VA_ARGS__)
|
#define pr_info(fmt, ...) __pr(LIBBPF_INFO, fmt, ##__VA_ARGS__)
|
||||||
#define pr_debug(fmt, ...) __pr(LIBBPF_DEBUG, fmt, ##__VA_ARGS__)
|
#define pr_debug(fmt, ...) __pr(LIBBPF_DEBUG, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
#ifndef __has_builtin
|
||||||
|
#define __has_builtin(x) 0
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* Re-implement glibc's reallocarray() for libbpf internal-only use.
|
||||||
|
* reallocarray(), unfortunately, is not available in all versions of glibc,
|
||||||
|
* so requires extra feature detection and using reallocarray() stub from
|
||||||
|
* <tools/libc_compat.h> and COMPAT_NEED_REALLOCARRAY. All this complicates
|
||||||
|
* build of libbpf unnecessarily and is just a maintenance burden. Instead,
|
||||||
|
* it's trivial to implement libbpf-specific internal version and use it
|
||||||
|
* throughout libbpf.
|
||||||
|
*/
|
||||||
|
static inline void *libbpf_reallocarray(void *ptr, size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
size_t total;
|
||||||
|
|
||||||
|
#if __has_builtin(__builtin_mul_overflow)
|
||||||
|
if (unlikely(__builtin_mul_overflow(nmemb, size, &total)))
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
|
if (size == 0 || nmemb > ULONG_MAX / size)
|
||||||
|
return NULL;
|
||||||
|
total = nmemb * size;
|
||||||
|
#endif
|
||||||
|
return realloc(ptr, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *btf_add_mem(void **data, size_t *cap_cnt, size_t elem_sz,
|
||||||
|
size_t cur_cnt, size_t max_cnt, size_t add_cnt);
|
||||||
|
int btf_ensure_mem(void **data, size_t *cap_cnt, size_t elem_sz, size_t need_cnt);
|
||||||
|
|
||||||
static inline bool libbpf_validate_opts(const char *opts,
|
static inline bool libbpf_validate_opts(const char *opts,
|
||||||
size_t opts_sz, size_t user_sz,
|
size_t opts_sz, size_t user_sz,
|
||||||
const char *type_name)
|
const char *type_name)
|
||||||
@@ -94,28 +140,52 @@ static inline bool libbpf_validate_opts(const char *opts,
|
|||||||
((opts) && opts->sz >= offsetofend(typeof(*(opts)), field))
|
((opts) && opts->sz >= offsetofend(typeof(*(opts)), field))
|
||||||
#define OPTS_GET(opts, field, fallback_value) \
|
#define OPTS_GET(opts, field, fallback_value) \
|
||||||
(OPTS_HAS(opts, field) ? (opts)->field : fallback_value)
|
(OPTS_HAS(opts, field) ? (opts)->field : fallback_value)
|
||||||
|
#define OPTS_SET(opts, field, value) \
|
||||||
|
do { \
|
||||||
|
if (OPTS_HAS(opts, field)) \
|
||||||
|
(opts)->field = value; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
int parse_cpu_mask_str(const char *s, bool **mask, int *mask_sz);
|
int parse_cpu_mask_str(const char *s, bool **mask, int *mask_sz);
|
||||||
int parse_cpu_mask_file(const char *fcpu, bool **mask, int *mask_sz);
|
int parse_cpu_mask_file(const char *fcpu, bool **mask, int *mask_sz);
|
||||||
int libbpf__load_raw_btf(const char *raw_types, size_t types_len,
|
int libbpf__load_raw_btf(const char *raw_types, size_t types_len,
|
||||||
const char *str_sec, size_t str_len);
|
const char *str_sec, size_t str_len);
|
||||||
|
|
||||||
|
struct bpf_prog_load_params {
|
||||||
|
enum bpf_prog_type prog_type;
|
||||||
|
enum bpf_attach_type expected_attach_type;
|
||||||
|
const char *name;
|
||||||
|
const struct bpf_insn *insns;
|
||||||
|
size_t insn_cnt;
|
||||||
|
const char *license;
|
||||||
|
__u32 kern_version;
|
||||||
|
__u32 attach_prog_fd;
|
||||||
|
__u32 attach_btf_obj_fd;
|
||||||
|
__u32 attach_btf_id;
|
||||||
|
__u32 prog_ifindex;
|
||||||
|
__u32 prog_btf_fd;
|
||||||
|
__u32 prog_flags;
|
||||||
|
|
||||||
|
__u32 func_info_rec_size;
|
||||||
|
const void *func_info;
|
||||||
|
__u32 func_info_cnt;
|
||||||
|
|
||||||
|
__u32 line_info_rec_size;
|
||||||
|
const void *line_info;
|
||||||
|
__u32 line_info_cnt;
|
||||||
|
|
||||||
|
__u32 log_level;
|
||||||
|
char *log_buf;
|
||||||
|
size_t log_buf_sz;
|
||||||
|
};
|
||||||
|
|
||||||
|
int libbpf__bpf_prog_load(const struct bpf_prog_load_params *load_attr);
|
||||||
|
|
||||||
int bpf_object__section_size(const struct bpf_object *obj, const char *name,
|
int bpf_object__section_size(const struct bpf_object *obj, const char *name,
|
||||||
__u32 *size);
|
__u32 *size);
|
||||||
int bpf_object__variable_offset(const struct bpf_object *obj, const char *name,
|
int bpf_object__variable_offset(const struct bpf_object *obj, const char *name,
|
||||||
__u32 *off);
|
__u32 *off);
|
||||||
|
struct btf *btf_get_from_fd(int btf_fd, struct btf *base_btf);
|
||||||
struct nlattr;
|
|
||||||
typedef int (*libbpf_dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb);
|
|
||||||
int libbpf_netlink_open(unsigned int *nl_pid);
|
|
||||||
int libbpf_nl_get_link(int sock, unsigned int nl_pid,
|
|
||||||
libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie);
|
|
||||||
int libbpf_nl_get_class(int sock, unsigned int nl_pid, int ifindex,
|
|
||||||
libbpf_dump_nlmsg_t dump_class_nlmsg, void *cookie);
|
|
||||||
int libbpf_nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
|
|
||||||
libbpf_dump_nlmsg_t dump_qdisc_nlmsg, void *cookie);
|
|
||||||
int libbpf_nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle,
|
|
||||||
libbpf_dump_nlmsg_t dump_filter_nlmsg, void *cookie);
|
|
||||||
|
|
||||||
struct btf_ext_info {
|
struct btf_ext_info {
|
||||||
/*
|
/*
|
||||||
@@ -138,6 +208,44 @@ struct btf_ext_info {
|
|||||||
i < (sec)->num_info; \
|
i < (sec)->num_info; \
|
||||||
i++, rec = (void *)rec + (seg)->rec_size)
|
i++, rec = (void *)rec + (seg)->rec_size)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The .BTF.ext ELF section layout defined as
|
||||||
|
* struct btf_ext_header
|
||||||
|
* func_info subsection
|
||||||
|
*
|
||||||
|
* The func_info subsection layout:
|
||||||
|
* record size for struct bpf_func_info in the func_info subsection
|
||||||
|
* struct btf_sec_func_info for section #1
|
||||||
|
* a list of bpf_func_info records for section #1
|
||||||
|
* where struct bpf_func_info mimics one in include/uapi/linux/bpf.h
|
||||||
|
* but may not be identical
|
||||||
|
* struct btf_sec_func_info for section #2
|
||||||
|
* a list of bpf_func_info records for section #2
|
||||||
|
* ......
|
||||||
|
*
|
||||||
|
* Note that the bpf_func_info record size in .BTF.ext may not
|
||||||
|
* be the same as the one defined in include/uapi/linux/bpf.h.
|
||||||
|
* The loader should ensure that record_size meets minimum
|
||||||
|
* requirement and pass the record as is to the kernel. The
|
||||||
|
* kernel will handle the func_info properly based on its contents.
|
||||||
|
*/
|
||||||
|
struct btf_ext_header {
|
||||||
|
__u16 magic;
|
||||||
|
__u8 version;
|
||||||
|
__u8 flags;
|
||||||
|
__u32 hdr_len;
|
||||||
|
|
||||||
|
/* All offsets are in bytes relative to the end of this header */
|
||||||
|
__u32 func_info_off;
|
||||||
|
__u32 func_info_len;
|
||||||
|
__u32 line_info_off;
|
||||||
|
__u32 line_info_len;
|
||||||
|
|
||||||
|
/* optional part of .BTF.ext header */
|
||||||
|
__u32 core_relo_off;
|
||||||
|
__u32 core_relo_len;
|
||||||
|
};
|
||||||
|
|
||||||
struct btf_ext {
|
struct btf_ext {
|
||||||
union {
|
union {
|
||||||
struct btf_ext_header *hdr;
|
struct btf_ext_header *hdr;
|
||||||
@@ -145,7 +253,7 @@ struct btf_ext {
|
|||||||
};
|
};
|
||||||
struct btf_ext_info func_info;
|
struct btf_ext_info func_info;
|
||||||
struct btf_ext_info line_info;
|
struct btf_ext_info line_info;
|
||||||
struct btf_ext_info field_reloc_info;
|
struct btf_ext_info core_relo_info;
|
||||||
__u32 data_size;
|
__u32 data_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -170,32 +278,40 @@ struct bpf_line_info_min {
|
|||||||
__u32 line_col;
|
__u32 line_col;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* bpf_field_info_kind encodes which aspect of captured field has to be
|
/* bpf_core_relo_kind encodes which aspect of captured field/type/enum value
|
||||||
* adjusted by relocations. Currently supported values are:
|
* has to be adjusted by relocations.
|
||||||
* - BPF_FIELD_BYTE_OFFSET: field offset (in bytes);
|
|
||||||
* - BPF_FIELD_EXISTS: field existence (1, if field exists; 0, otherwise);
|
|
||||||
*/
|
*/
|
||||||
enum bpf_field_info_kind {
|
enum bpf_core_relo_kind {
|
||||||
BPF_FIELD_BYTE_OFFSET = 0, /* field byte offset */
|
BPF_FIELD_BYTE_OFFSET = 0, /* field byte offset */
|
||||||
BPF_FIELD_BYTE_SIZE = 1,
|
BPF_FIELD_BYTE_SIZE = 1, /* field size in bytes */
|
||||||
BPF_FIELD_EXISTS = 2, /* field existence in target kernel */
|
BPF_FIELD_EXISTS = 2, /* field existence in target kernel */
|
||||||
BPF_FIELD_SIGNED = 3,
|
BPF_FIELD_SIGNED = 3, /* field signedness (0 - unsigned, 1 - signed) */
|
||||||
BPF_FIELD_LSHIFT_U64 = 4,
|
BPF_FIELD_LSHIFT_U64 = 4, /* bitfield-specific left bitshift */
|
||||||
BPF_FIELD_RSHIFT_U64 = 5,
|
BPF_FIELD_RSHIFT_U64 = 5, /* bitfield-specific right bitshift */
|
||||||
|
BPF_TYPE_ID_LOCAL = 6, /* type ID in local BPF object */
|
||||||
|
BPF_TYPE_ID_TARGET = 7, /* type ID in target kernel */
|
||||||
|
BPF_TYPE_EXISTS = 8, /* type existence in target kernel */
|
||||||
|
BPF_TYPE_SIZE = 9, /* type size in bytes */
|
||||||
|
BPF_ENUMVAL_EXISTS = 10, /* enum value existence in target kernel */
|
||||||
|
BPF_ENUMVAL_VALUE = 11, /* enum value integer value */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The minimum bpf_field_reloc checked by the loader
|
/* The minimum bpf_core_relo checked by the loader
|
||||||
*
|
*
|
||||||
* Field relocation captures the following data:
|
* CO-RE relocation captures the following data:
|
||||||
* - insn_off - instruction offset (in bytes) within a BPF program that needs
|
* - insn_off - instruction offset (in bytes) within a BPF program that needs
|
||||||
* its insn->imm field to be relocated with actual field info;
|
* its insn->imm field to be relocated with actual field info;
|
||||||
* - type_id - BTF type ID of the "root" (containing) entity of a relocatable
|
* - type_id - BTF type ID of the "root" (containing) entity of a relocatable
|
||||||
* field;
|
* type or field;
|
||||||
* - access_str_off - offset into corresponding .BTF string section. String
|
* - access_str_off - offset into corresponding .BTF string section. String
|
||||||
* itself encodes an accessed field using a sequence of field and array
|
* interpretation depends on specific relocation kind:
|
||||||
* indicies, separated by colon (:). It's conceptually very close to LLVM's
|
* - for field-based relocations, string encodes an accessed field using
|
||||||
* getelementptr ([0]) instruction's arguments for identifying offset to
|
* a sequence of field and array indices, separated by colon (:). It's
|
||||||
* a field.
|
* conceptually very close to LLVM's getelementptr ([0]) instruction's
|
||||||
|
* arguments for identifying offset to a field.
|
||||||
|
* - for type-based relocations, strings is expected to be just "0";
|
||||||
|
* - for enum value-based relocations, string contains an index of enum
|
||||||
|
* value within its enum type;
|
||||||
*
|
*
|
||||||
* Example to provide a better feel.
|
* Example to provide a better feel.
|
||||||
*
|
*
|
||||||
@@ -226,11 +342,11 @@ enum bpf_field_info_kind {
|
|||||||
*
|
*
|
||||||
* [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
|
* [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
|
||||||
*/
|
*/
|
||||||
struct bpf_field_reloc {
|
struct bpf_core_relo {
|
||||||
__u32 insn_off;
|
__u32 insn_off;
|
||||||
__u32 type_id;
|
__u32 type_id;
|
||||||
__u32 access_str_off;
|
__u32 access_str_off;
|
||||||
enum bpf_field_info_kind kind;
|
enum bpf_core_relo_kind kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __LIBBPF_LIBBPF_INTERNAL_H */
|
#endif /* __LIBBPF_LIBBPF_INTERNAL_H */
|
||||||
|
|||||||
@@ -17,9 +17,6 @@
|
|||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
static bool grep(const char *buffer, const char *pattern)
|
static bool grep(const char *buffer, const char *pattern)
|
||||||
{
|
{
|
||||||
return !!strstr(buffer, pattern);
|
return !!strstr(buffer, pattern);
|
||||||
@@ -173,7 +170,7 @@ int libbpf__load_raw_btf(const char *raw_types, size_t types_len,
|
|||||||
return btf_fd;
|
return btf_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int load_sk_storage_btf(void)
|
static int load_local_storage_btf(void)
|
||||||
{
|
{
|
||||||
const char strs[] = "\0bpf_spin_lock\0val\0cnt\0l";
|
const char strs[] = "\0bpf_spin_lock\0val\0cnt\0l";
|
||||||
/* struct bpf_spin_lock {
|
/* struct bpf_spin_lock {
|
||||||
@@ -232,12 +229,14 @@ bool bpf_probe_map_type(enum bpf_map_type map_type, __u32 ifindex)
|
|||||||
key_size = 0;
|
key_size = 0;
|
||||||
break;
|
break;
|
||||||
case BPF_MAP_TYPE_SK_STORAGE:
|
case BPF_MAP_TYPE_SK_STORAGE:
|
||||||
|
case BPF_MAP_TYPE_INODE_STORAGE:
|
||||||
|
case BPF_MAP_TYPE_TASK_STORAGE:
|
||||||
btf_key_type_id = 1;
|
btf_key_type_id = 1;
|
||||||
btf_value_type_id = 3;
|
btf_value_type_id = 3;
|
||||||
value_size = 8;
|
value_size = 8;
|
||||||
max_entries = 0;
|
max_entries = 0;
|
||||||
map_flags = BPF_F_NO_PREALLOC;
|
map_flags = BPF_F_NO_PREALLOC;
|
||||||
btf_fd = load_sk_storage_btf();
|
btf_fd = load_local_storage_btf();
|
||||||
if (btf_fd < 0)
|
if (btf_fd < 0)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
128
src/netlink.c
128
src/netlink.c
@@ -15,13 +15,12 @@
|
|||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
#include "nlattr.h"
|
#include "nlattr.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
#ifndef SOL_NETLINK
|
#ifndef SOL_NETLINK
|
||||||
#define SOL_NETLINK 270
|
#define SOL_NETLINK 270
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef int (*libbpf_dump_nlmsg_t)(void *cookie, void *msg, struct nlattr **tb);
|
||||||
|
|
||||||
typedef int (*__dump_nlmsg_t)(struct nlmsghdr *nlmsg, libbpf_dump_nlmsg_t,
|
typedef int (*__dump_nlmsg_t)(struct nlmsghdr *nlmsg, libbpf_dump_nlmsg_t,
|
||||||
void *cookie);
|
void *cookie);
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ struct xdp_id_md {
|
|||||||
struct xdp_link_info info;
|
struct xdp_link_info info;
|
||||||
};
|
};
|
||||||
|
|
||||||
int libbpf_netlink_open(__u32 *nl_pid)
|
static int libbpf_netlink_open(__u32 *nl_pid)
|
||||||
{
|
{
|
||||||
struct sockaddr_nl sa;
|
struct sockaddr_nl sa;
|
||||||
socklen_t addrlen;
|
socklen_t addrlen;
|
||||||
@@ -283,6 +282,9 @@ static int get_xdp_info(void *cookie, void *msg, struct nlattr **tb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int libbpf_nl_get_link(int sock, unsigned int nl_pid,
|
||||||
|
libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie);
|
||||||
|
|
||||||
int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info,
|
int bpf_get_link_xdp_info(int ifindex, struct xdp_link_info *info,
|
||||||
size_t info_size, __u32 flags)
|
size_t info_size, __u32 flags)
|
||||||
{
|
{
|
||||||
@@ -368,121 +370,3 @@ int libbpf_nl_get_link(int sock, unsigned int nl_pid,
|
|||||||
return bpf_netlink_recv(sock, nl_pid, seq, __dump_link_nlmsg,
|
return bpf_netlink_recv(sock, nl_pid, seq, __dump_link_nlmsg,
|
||||||
dump_link_nlmsg, cookie);
|
dump_link_nlmsg, cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __dump_class_nlmsg(struct nlmsghdr *nlh,
|
|
||||||
libbpf_dump_nlmsg_t dump_class_nlmsg,
|
|
||||||
void *cookie)
|
|
||||||
{
|
|
||||||
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
||||||
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
|
|
||||||
attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
|
|
||||||
if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
|
|
||||||
return -LIBBPF_ERRNO__NLPARSE;
|
|
||||||
|
|
||||||
return dump_class_nlmsg(cookie, t, tb);
|
|
||||||
}
|
|
||||||
|
|
||||||
int libbpf_nl_get_class(int sock, unsigned int nl_pid, int ifindex,
|
|
||||||
libbpf_dump_nlmsg_t dump_class_nlmsg, void *cookie)
|
|
||||||
{
|
|
||||||
struct {
|
|
||||||
struct nlmsghdr nlh;
|
|
||||||
struct tcmsg t;
|
|
||||||
} req = {
|
|
||||||
.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
.nlh.nlmsg_type = RTM_GETTCLASS,
|
|
||||||
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
|
|
||||||
.t.tcm_family = AF_UNSPEC,
|
|
||||||
.t.tcm_ifindex = ifindex,
|
|
||||||
};
|
|
||||||
int seq = time(NULL);
|
|
||||||
|
|
||||||
req.nlh.nlmsg_seq = seq;
|
|
||||||
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
return bpf_netlink_recv(sock, nl_pid, seq, __dump_class_nlmsg,
|
|
||||||
dump_class_nlmsg, cookie);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __dump_qdisc_nlmsg(struct nlmsghdr *nlh,
|
|
||||||
libbpf_dump_nlmsg_t dump_qdisc_nlmsg,
|
|
||||||
void *cookie)
|
|
||||||
{
|
|
||||||
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
||||||
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
|
|
||||||
attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
|
|
||||||
if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
|
|
||||||
return -LIBBPF_ERRNO__NLPARSE;
|
|
||||||
|
|
||||||
return dump_qdisc_nlmsg(cookie, t, tb);
|
|
||||||
}
|
|
||||||
|
|
||||||
int libbpf_nl_get_qdisc(int sock, unsigned int nl_pid, int ifindex,
|
|
||||||
libbpf_dump_nlmsg_t dump_qdisc_nlmsg, void *cookie)
|
|
||||||
{
|
|
||||||
struct {
|
|
||||||
struct nlmsghdr nlh;
|
|
||||||
struct tcmsg t;
|
|
||||||
} req = {
|
|
||||||
.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
.nlh.nlmsg_type = RTM_GETQDISC,
|
|
||||||
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
|
|
||||||
.t.tcm_family = AF_UNSPEC,
|
|
||||||
.t.tcm_ifindex = ifindex,
|
|
||||||
};
|
|
||||||
int seq = time(NULL);
|
|
||||||
|
|
||||||
req.nlh.nlmsg_seq = seq;
|
|
||||||
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
return bpf_netlink_recv(sock, nl_pid, seq, __dump_qdisc_nlmsg,
|
|
||||||
dump_qdisc_nlmsg, cookie);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __dump_filter_nlmsg(struct nlmsghdr *nlh,
|
|
||||||
libbpf_dump_nlmsg_t dump_filter_nlmsg,
|
|
||||||
void *cookie)
|
|
||||||
{
|
|
||||||
struct nlattr *tb[TCA_MAX + 1], *attr;
|
|
||||||
struct tcmsg *t = NLMSG_DATA(nlh);
|
|
||||||
int len;
|
|
||||||
|
|
||||||
len = nlh->nlmsg_len - NLMSG_LENGTH(sizeof(*t));
|
|
||||||
attr = (struct nlattr *) ((void *) t + NLMSG_ALIGN(sizeof(*t)));
|
|
||||||
if (libbpf_nla_parse(tb, TCA_MAX, attr, len, NULL) != 0)
|
|
||||||
return -LIBBPF_ERRNO__NLPARSE;
|
|
||||||
|
|
||||||
return dump_filter_nlmsg(cookie, t, tb);
|
|
||||||
}
|
|
||||||
|
|
||||||
int libbpf_nl_get_filter(int sock, unsigned int nl_pid, int ifindex, int handle,
|
|
||||||
libbpf_dump_nlmsg_t dump_filter_nlmsg, void *cookie)
|
|
||||||
{
|
|
||||||
struct {
|
|
||||||
struct nlmsghdr nlh;
|
|
||||||
struct tcmsg t;
|
|
||||||
} req = {
|
|
||||||
.nlh.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)),
|
|
||||||
.nlh.nlmsg_type = RTM_GETTFILTER,
|
|
||||||
.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST,
|
|
||||||
.t.tcm_family = AF_UNSPEC,
|
|
||||||
.t.tcm_ifindex = ifindex,
|
|
||||||
.t.tcm_parent = handle,
|
|
||||||
};
|
|
||||||
int seq = time(NULL);
|
|
||||||
|
|
||||||
req.nlh.nlmsg_seq = seq;
|
|
||||||
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
return bpf_netlink_recv(sock, nl_pid, seq, __dump_filter_nlmsg,
|
|
||||||
dump_filter_nlmsg, cookie);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -7,14 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "nlattr.h"
|
|
||||||
#include "libbpf_internal.h"
|
|
||||||
#include <linux/rtnetlink.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <linux/rtnetlink.h>
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
#include "nlattr.h"
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
#include "libbpf_internal.h"
|
||||||
|
|
||||||
static uint16_t nla_attr_minlen[LIBBPF_NLA_TYPE_MAX+1] = {
|
static uint16_t nla_attr_minlen[LIBBPF_NLA_TYPE_MAX+1] = {
|
||||||
[LIBBPF_NLA_U8] = sizeof(uint8_t),
|
[LIBBPF_NLA_U8] = sizeof(uint8_t),
|
||||||
|
|||||||
@@ -16,15 +16,11 @@
|
|||||||
#include <asm/barrier.h>
|
#include <asm/barrier.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <tools/libc_compat.h>
|
|
||||||
|
|
||||||
#include "libbpf.h"
|
#include "libbpf.h"
|
||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
#include "bpf.h"
|
#include "bpf.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
struct ring {
|
struct ring {
|
||||||
ring_buffer_sample_fn sample_cb;
|
ring_buffer_sample_fn sample_cb;
|
||||||
void *ctx;
|
void *ctx;
|
||||||
@@ -82,12 +78,12 @@ int ring_buffer__add(struct ring_buffer *rb, int map_fd,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = reallocarray(rb->rings, rb->ring_cnt + 1, sizeof(*rb->rings));
|
tmp = libbpf_reallocarray(rb->rings, rb->ring_cnt + 1, sizeof(*rb->rings));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rb->rings = tmp;
|
rb->rings = tmp;
|
||||||
|
|
||||||
tmp = reallocarray(rb->events, rb->ring_cnt + 1, sizeof(*rb->events));
|
tmp = libbpf_reallocarray(rb->events, rb->ring_cnt + 1, sizeof(*rb->events));
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
rb->events = tmp;
|
rb->events = tmp;
|
||||||
@@ -282,7 +278,13 @@ int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms)
|
|||||||
err = ringbuf_process_ring(ring);
|
err = ringbuf_process_ring(ring);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
res += cnt;
|
res += err;
|
||||||
}
|
}
|
||||||
return cnt < 0 ? -errno : res;
|
return cnt < 0 ? -errno : res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get an fd that can be used to sleep until data is available in the ring(s) */
|
||||||
|
int ring_buffer__epoll_fd(const struct ring_buffer *rb)
|
||||||
|
{
|
||||||
|
return rb->epoll_fd;
|
||||||
|
}
|
||||||
|
|||||||
478
src/xsk.c
478
src/xsk.c
@@ -20,6 +20,8 @@
|
|||||||
#include <linux/if_ether.h>
|
#include <linux/if_ether.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <linux/if_xdp.h>
|
#include <linux/if_xdp.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/list.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -32,9 +34,6 @@
|
|||||||
#include "libbpf_internal.h"
|
#include "libbpf_internal.h"
|
||||||
#include "xsk.h"
|
#include "xsk.h"
|
||||||
|
|
||||||
/* make sure libbpf doesn't use kernel-only integer typedefs */
|
|
||||||
#pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
|
|
||||||
|
|
||||||
#ifndef SOL_XDP
|
#ifndef SOL_XDP
|
||||||
#define SOL_XDP 283
|
#define SOL_XDP 283
|
||||||
#endif
|
#endif
|
||||||
@@ -48,26 +47,35 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct xsk_umem {
|
struct xsk_umem {
|
||||||
struct xsk_ring_prod *fill;
|
struct xsk_ring_prod *fill_save;
|
||||||
struct xsk_ring_cons *comp;
|
struct xsk_ring_cons *comp_save;
|
||||||
char *umem_area;
|
char *umem_area;
|
||||||
struct xsk_umem_config config;
|
struct xsk_umem_config config;
|
||||||
int fd;
|
int fd;
|
||||||
int refcount;
|
int refcount;
|
||||||
|
struct list_head ctx_list;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct xsk_ctx {
|
||||||
|
struct xsk_ring_prod *fill;
|
||||||
|
struct xsk_ring_cons *comp;
|
||||||
|
__u32 queue_id;
|
||||||
|
struct xsk_umem *umem;
|
||||||
|
int refcount;
|
||||||
|
int ifindex;
|
||||||
|
struct list_head list;
|
||||||
|
int prog_fd;
|
||||||
|
int xsks_map_fd;
|
||||||
|
char ifname[IFNAMSIZ];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xsk_socket {
|
struct xsk_socket {
|
||||||
struct xsk_ring_cons *rx;
|
struct xsk_ring_cons *rx;
|
||||||
struct xsk_ring_prod *tx;
|
struct xsk_ring_prod *tx;
|
||||||
__u64 outstanding_tx;
|
__u64 outstanding_tx;
|
||||||
struct xsk_umem *umem;
|
struct xsk_ctx *ctx;
|
||||||
struct xsk_socket_config config;
|
struct xsk_socket_config config;
|
||||||
int fd;
|
int fd;
|
||||||
int ifindex;
|
|
||||||
int prog_fd;
|
|
||||||
int xsks_map_fd;
|
|
||||||
__u32 queue_id;
|
|
||||||
char ifname[IFNAMSIZ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xsk_nl_info {
|
struct xsk_nl_info {
|
||||||
@@ -203,15 +211,73 @@ static int xsk_get_mmap_offsets(int fd, struct xdp_mmap_offsets *off)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int xsk_create_umem_rings(struct xsk_umem *umem, int fd,
|
||||||
|
struct xsk_ring_prod *fill,
|
||||||
|
struct xsk_ring_cons *comp)
|
||||||
|
{
|
||||||
|
struct xdp_mmap_offsets off;
|
||||||
|
void *map;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = setsockopt(fd, SOL_XDP, XDP_UMEM_FILL_RING,
|
||||||
|
&umem->config.fill_size,
|
||||||
|
sizeof(umem->config.fill_size));
|
||||||
|
if (err)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
err = setsockopt(fd, SOL_XDP, XDP_UMEM_COMPLETION_RING,
|
||||||
|
&umem->config.comp_size,
|
||||||
|
sizeof(umem->config.comp_size));
|
||||||
|
if (err)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
err = xsk_get_mmap_offsets(fd, &off);
|
||||||
|
if (err)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
map = mmap(NULL, off.fr.desc + umem->config.fill_size * sizeof(__u64),
|
||||||
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd,
|
||||||
|
XDP_UMEM_PGOFF_FILL_RING);
|
||||||
|
if (map == MAP_FAILED)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
fill->mask = umem->config.fill_size - 1;
|
||||||
|
fill->size = umem->config.fill_size;
|
||||||
|
fill->producer = map + off.fr.producer;
|
||||||
|
fill->consumer = map + off.fr.consumer;
|
||||||
|
fill->flags = map + off.fr.flags;
|
||||||
|
fill->ring = map + off.fr.desc;
|
||||||
|
fill->cached_cons = umem->config.fill_size;
|
||||||
|
|
||||||
|
map = mmap(NULL, off.cr.desc + umem->config.comp_size * sizeof(__u64),
|
||||||
|
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, fd,
|
||||||
|
XDP_UMEM_PGOFF_COMPLETION_RING);
|
||||||
|
if (map == MAP_FAILED) {
|
||||||
|
err = -errno;
|
||||||
|
goto out_mmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
comp->mask = umem->config.comp_size - 1;
|
||||||
|
comp->size = umem->config.comp_size;
|
||||||
|
comp->producer = map + off.cr.producer;
|
||||||
|
comp->consumer = map + off.cr.consumer;
|
||||||
|
comp->flags = map + off.cr.flags;
|
||||||
|
comp->ring = map + off.cr.desc;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_mmap:
|
||||||
|
munmap(map, off.fr.desc + umem->config.fill_size * sizeof(__u64));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area,
|
int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area,
|
||||||
__u64 size, struct xsk_ring_prod *fill,
|
__u64 size, struct xsk_ring_prod *fill,
|
||||||
struct xsk_ring_cons *comp,
|
struct xsk_ring_cons *comp,
|
||||||
const struct xsk_umem_config *usr_config)
|
const struct xsk_umem_config *usr_config)
|
||||||
{
|
{
|
||||||
struct xdp_mmap_offsets off;
|
|
||||||
struct xdp_umem_reg mr;
|
struct xdp_umem_reg mr;
|
||||||
struct xsk_umem *umem;
|
struct xsk_umem *umem;
|
||||||
void *map;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!umem_area || !umem_ptr || !fill || !comp)
|
if (!umem_area || !umem_ptr || !fill || !comp)
|
||||||
@@ -230,6 +296,7 @@ int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area,
|
|||||||
}
|
}
|
||||||
|
|
||||||
umem->umem_area = umem_area;
|
umem->umem_area = umem_area;
|
||||||
|
INIT_LIST_HEAD(&umem->ctx_list);
|
||||||
xsk_set_umem_config(&umem->config, usr_config);
|
xsk_set_umem_config(&umem->config, usr_config);
|
||||||
|
|
||||||
memset(&mr, 0, sizeof(mr));
|
memset(&mr, 0, sizeof(mr));
|
||||||
@@ -244,71 +311,16 @@ int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area,
|
|||||||
err = -errno;
|
err = -errno;
|
||||||
goto out_socket;
|
goto out_socket;
|
||||||
}
|
}
|
||||||
err = setsockopt(umem->fd, SOL_XDP, XDP_UMEM_FILL_RING,
|
|
||||||
&umem->config.fill_size,
|
err = xsk_create_umem_rings(umem, umem->fd, fill, comp);
|
||||||
sizeof(umem->config.fill_size));
|
if (err)
|
||||||
if (err) {
|
|
||||||
err = -errno;
|
|
||||||
goto out_socket;
|
goto out_socket;
|
||||||
}
|
|
||||||
err = setsockopt(umem->fd, SOL_XDP, XDP_UMEM_COMPLETION_RING,
|
|
||||||
&umem->config.comp_size,
|
|
||||||
sizeof(umem->config.comp_size));
|
|
||||||
if (err) {
|
|
||||||
err = -errno;
|
|
||||||
goto out_socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = xsk_get_mmap_offsets(umem->fd, &off);
|
|
||||||
if (err) {
|
|
||||||
err = -errno;
|
|
||||||
goto out_socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
map = mmap(NULL, off.fr.desc + umem->config.fill_size * sizeof(__u64),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, umem->fd,
|
|
||||||
XDP_UMEM_PGOFF_FILL_RING);
|
|
||||||
if (map == MAP_FAILED) {
|
|
||||||
err = -errno;
|
|
||||||
goto out_socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
umem->fill = fill;
|
|
||||||
fill->mask = umem->config.fill_size - 1;
|
|
||||||
fill->size = umem->config.fill_size;
|
|
||||||
fill->producer = map + off.fr.producer;
|
|
||||||
fill->consumer = map + off.fr.consumer;
|
|
||||||
fill->flags = map + off.fr.flags;
|
|
||||||
fill->ring = map + off.fr.desc;
|
|
||||||
fill->cached_prod = *fill->producer;
|
|
||||||
/* cached_cons is "size" bigger than the real consumer pointer
|
|
||||||
* See xsk_prod_nb_free
|
|
||||||
*/
|
|
||||||
fill->cached_cons = *fill->consumer + umem->config.fill_size;
|
|
||||||
|
|
||||||
map = mmap(NULL, off.cr.desc + umem->config.comp_size * sizeof(__u64),
|
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE, umem->fd,
|
|
||||||
XDP_UMEM_PGOFF_COMPLETION_RING);
|
|
||||||
if (map == MAP_FAILED) {
|
|
||||||
err = -errno;
|
|
||||||
goto out_mmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
umem->comp = comp;
|
|
||||||
comp->mask = umem->config.comp_size - 1;
|
|
||||||
comp->size = umem->config.comp_size;
|
|
||||||
comp->producer = map + off.cr.producer;
|
|
||||||
comp->consumer = map + off.cr.consumer;
|
|
||||||
comp->flags = map + off.cr.flags;
|
|
||||||
comp->ring = map + off.cr.desc;
|
|
||||||
comp->cached_prod = *comp->producer;
|
|
||||||
comp->cached_cons = *comp->consumer;
|
|
||||||
|
|
||||||
|
umem->fill_save = fill;
|
||||||
|
umem->comp_save = comp;
|
||||||
*umem_ptr = umem;
|
*umem_ptr = umem;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_mmap:
|
|
||||||
munmap(map, off.fr.desc + umem->config.fill_size * sizeof(__u64));
|
|
||||||
out_socket:
|
out_socket:
|
||||||
close(umem->fd);
|
close(umem->fd);
|
||||||
out_umem_alloc:
|
out_umem_alloc:
|
||||||
@@ -342,6 +354,7 @@ DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4)
|
|||||||
static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
static const int log_buf_size = 16 * 1024;
|
static const int log_buf_size = 16 * 1024;
|
||||||
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
char log_buf[log_buf_size];
|
char log_buf[log_buf_size];
|
||||||
int err, prog_fd;
|
int err, prog_fd;
|
||||||
|
|
||||||
@@ -369,7 +382,7 @@ static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
|||||||
/* *(u32 *)(r10 - 4) = r2 */
|
/* *(u32 *)(r10 - 4) = r2 */
|
||||||
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_2, -4),
|
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_2, -4),
|
||||||
/* r1 = xskmap[] */
|
/* r1 = xskmap[] */
|
||||||
BPF_LD_MAP_FD(BPF_REG_1, xsk->xsks_map_fd),
|
BPF_LD_MAP_FD(BPF_REG_1, ctx->xsks_map_fd),
|
||||||
/* r3 = XDP_PASS */
|
/* r3 = XDP_PASS */
|
||||||
BPF_MOV64_IMM(BPF_REG_3, 2),
|
BPF_MOV64_IMM(BPF_REG_3, 2),
|
||||||
/* call bpf_redirect_map */
|
/* call bpf_redirect_map */
|
||||||
@@ -381,7 +394,7 @@ static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
|||||||
/* r2 += -4 */
|
/* r2 += -4 */
|
||||||
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4),
|
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4),
|
||||||
/* r1 = xskmap[] */
|
/* r1 = xskmap[] */
|
||||||
BPF_LD_MAP_FD(BPF_REG_1, xsk->xsks_map_fd),
|
BPF_LD_MAP_FD(BPF_REG_1, ctx->xsks_map_fd),
|
||||||
/* call bpf_map_lookup_elem */
|
/* call bpf_map_lookup_elem */
|
||||||
BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
|
BPF_EMIT_CALL(BPF_FUNC_map_lookup_elem),
|
||||||
/* r1 = r0 */
|
/* r1 = r0 */
|
||||||
@@ -393,7 +406,7 @@ static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
|||||||
/* r2 = *(u32 *)(r10 - 4) */
|
/* r2 = *(u32 *)(r10 - 4) */
|
||||||
BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_10, -4),
|
BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_10, -4),
|
||||||
/* r1 = xskmap[] */
|
/* r1 = xskmap[] */
|
||||||
BPF_LD_MAP_FD(BPF_REG_1, xsk->xsks_map_fd),
|
BPF_LD_MAP_FD(BPF_REG_1, ctx->xsks_map_fd),
|
||||||
/* r3 = 0 */
|
/* r3 = 0 */
|
||||||
BPF_MOV64_IMM(BPF_REG_3, 0),
|
BPF_MOV64_IMM(BPF_REG_3, 0),
|
||||||
/* call bpf_redirect_map */
|
/* call bpf_redirect_map */
|
||||||
@@ -411,19 +424,21 @@ static int xsk_load_xdp_prog(struct xsk_socket *xsk)
|
|||||||
return prog_fd;
|
return prog_fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bpf_set_link_xdp_fd(xsk->ifindex, prog_fd, xsk->config.xdp_flags);
|
err = bpf_set_link_xdp_fd(xsk->ctx->ifindex, prog_fd,
|
||||||
|
xsk->config.xdp_flags);
|
||||||
if (err) {
|
if (err) {
|
||||||
close(prog_fd);
|
close(prog_fd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
xsk->prog_fd = prog_fd;
|
ctx->prog_fd = prog_fd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xsk_get_max_queues(struct xsk_socket *xsk)
|
static int xsk_get_max_queues(struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS };
|
struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS };
|
||||||
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
struct ifreq ifr = {};
|
struct ifreq ifr = {};
|
||||||
int fd, err, ret;
|
int fd, err, ret;
|
||||||
|
|
||||||
@@ -432,7 +447,7 @@ static int xsk_get_max_queues(struct xsk_socket *xsk)
|
|||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
ifr.ifr_data = (void *)&channels;
|
ifr.ifr_data = (void *)&channels;
|
||||||
memcpy(ifr.ifr_name, xsk->ifname, IFNAMSIZ - 1);
|
memcpy(ifr.ifr_name, ctx->ifname, IFNAMSIZ - 1);
|
||||||
ifr.ifr_name[IFNAMSIZ - 1] = '\0';
|
ifr.ifr_name[IFNAMSIZ - 1] = '\0';
|
||||||
err = ioctl(fd, SIOCETHTOOL, &ifr);
|
err = ioctl(fd, SIOCETHTOOL, &ifr);
|
||||||
if (err && errno != EOPNOTSUPP) {
|
if (err && errno != EOPNOTSUPP) {
|
||||||
@@ -460,6 +475,7 @@ out:
|
|||||||
|
|
||||||
static int xsk_create_bpf_maps(struct xsk_socket *xsk)
|
static int xsk_create_bpf_maps(struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
int max_queues;
|
int max_queues;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@@ -472,15 +488,17 @@ static int xsk_create_bpf_maps(struct xsk_socket *xsk)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
xsk->xsks_map_fd = fd;
|
ctx->xsks_map_fd = fd;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xsk_delete_bpf_maps(struct xsk_socket *xsk)
|
static void xsk_delete_bpf_maps(struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
bpf_map_delete_elem(xsk->xsks_map_fd, &xsk->queue_id);
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
close(xsk->xsks_map_fd);
|
|
||||||
|
bpf_map_delete_elem(ctx->xsks_map_fd, &ctx->queue_id);
|
||||||
|
close(ctx->xsks_map_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
||||||
@@ -488,10 +506,11 @@ static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
|||||||
__u32 i, *map_ids, num_maps, prog_len = sizeof(struct bpf_prog_info);
|
__u32 i, *map_ids, num_maps, prog_len = sizeof(struct bpf_prog_info);
|
||||||
__u32 map_len = sizeof(struct bpf_map_info);
|
__u32 map_len = sizeof(struct bpf_map_info);
|
||||||
struct bpf_prog_info prog_info = {};
|
struct bpf_prog_info prog_info = {};
|
||||||
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
struct bpf_map_info map_info;
|
struct bpf_map_info map_info;
|
||||||
int fd, err;
|
int fd, err;
|
||||||
|
|
||||||
err = bpf_obj_get_info_by_fd(xsk->prog_fd, &prog_info, &prog_len);
|
err = bpf_obj_get_info_by_fd(ctx->prog_fd, &prog_info, &prog_len);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -505,11 +524,11 @@ static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
|||||||
prog_info.nr_map_ids = num_maps;
|
prog_info.nr_map_ids = num_maps;
|
||||||
prog_info.map_ids = (__u64)(unsigned long)map_ids;
|
prog_info.map_ids = (__u64)(unsigned long)map_ids;
|
||||||
|
|
||||||
err = bpf_obj_get_info_by_fd(xsk->prog_fd, &prog_info, &prog_len);
|
err = bpf_obj_get_info_by_fd(ctx->prog_fd, &prog_info, &prog_len);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_map_ids;
|
goto out_map_ids;
|
||||||
|
|
||||||
xsk->xsks_map_fd = -1;
|
ctx->xsks_map_fd = -1;
|
||||||
|
|
||||||
for (i = 0; i < prog_info.nr_map_ids; i++) {
|
for (i = 0; i < prog_info.nr_map_ids; i++) {
|
||||||
fd = bpf_map_get_fd_by_id(map_ids[i]);
|
fd = bpf_map_get_fd_by_id(map_ids[i]);
|
||||||
@@ -523,7 +542,7 @@ static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(map_info.name, "xsks_map")) {
|
if (!strcmp(map_info.name, "xsks_map")) {
|
||||||
xsk->xsks_map_fd = fd;
|
ctx->xsks_map_fd = fd;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -531,7 +550,7 @@ static int xsk_lookup_bpf_maps(struct xsk_socket *xsk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
||||||
if (xsk->xsks_map_fd == -1)
|
if (ctx->xsks_map_fd == -1)
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
|
|
||||||
out_map_ids:
|
out_map_ids:
|
||||||
@@ -541,16 +560,46 @@ out_map_ids:
|
|||||||
|
|
||||||
static int xsk_set_bpf_maps(struct xsk_socket *xsk)
|
static int xsk_set_bpf_maps(struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
return bpf_map_update_elem(xsk->xsks_map_fd, &xsk->queue_id,
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
|
|
||||||
|
return bpf_map_update_elem(ctx->xsks_map_fd, &ctx->queue_id,
|
||||||
&xsk->fd, 0);
|
&xsk->fd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xsk_setup_xdp_prog(struct xsk_socket *xsk)
|
static int xsk_create_xsk_struct(int ifindex, struct xsk_socket *xsk)
|
||||||
{
|
{
|
||||||
|
char ifname[IFNAMSIZ];
|
||||||
|
struct xsk_ctx *ctx;
|
||||||
|
char *interface;
|
||||||
|
|
||||||
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
if (!ctx)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
interface = if_indextoname(ifindex, &ifname[0]);
|
||||||
|
if (!interface) {
|
||||||
|
free(ctx);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->ifindex = ifindex;
|
||||||
|
memcpy(ctx->ifname, ifname, IFNAMSIZ -1);
|
||||||
|
ctx->ifname[IFNAMSIZ - 1] = 0;
|
||||||
|
|
||||||
|
xsk->ctx = ctx;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __xsk_setup_xdp_prog(struct xsk_socket *_xdp,
|
||||||
|
int *xsks_map_fd)
|
||||||
|
{
|
||||||
|
struct xsk_socket *xsk = _xdp;
|
||||||
|
struct xsk_ctx *ctx = xsk->ctx;
|
||||||
__u32 prog_id = 0;
|
__u32 prog_id = 0;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = bpf_get_link_xdp_id(xsk->ifindex, &prog_id,
|
err = bpf_get_link_xdp_id(ctx->ifindex, &prog_id,
|
||||||
xsk->config.xdp_flags);
|
xsk->config.xdp_flags);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
@@ -562,41 +611,173 @@ static int xsk_setup_xdp_prog(struct xsk_socket *xsk)
|
|||||||
|
|
||||||
err = xsk_load_xdp_prog(xsk);
|
err = xsk_load_xdp_prog(xsk);
|
||||||
if (err) {
|
if (err) {
|
||||||
xsk_delete_bpf_maps(xsk);
|
goto err_load_xdp_prog;
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xsk->prog_fd = bpf_prog_get_fd_by_id(prog_id);
|
ctx->prog_fd = bpf_prog_get_fd_by_id(prog_id);
|
||||||
if (xsk->prog_fd < 0)
|
if (ctx->prog_fd < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
err = xsk_lookup_bpf_maps(xsk);
|
err = xsk_lookup_bpf_maps(xsk);
|
||||||
if (err) {
|
if (err) {
|
||||||
close(xsk->prog_fd);
|
close(ctx->prog_fd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xsk->rx)
|
if (xsk->rx) {
|
||||||
err = xsk_set_bpf_maps(xsk);
|
err = xsk_set_bpf_maps(xsk);
|
||||||
if (err) {
|
if (err) {
|
||||||
xsk_delete_bpf_maps(xsk);
|
if (!prog_id) {
|
||||||
close(xsk->prog_fd);
|
goto err_set_bpf_maps;
|
||||||
return err;
|
} else {
|
||||||
|
close(ctx->prog_fd);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (xsks_map_fd)
|
||||||
|
*xsks_map_fd = ctx->xsks_map_fd;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_set_bpf_maps:
|
||||||
|
close(ctx->prog_fd);
|
||||||
|
bpf_set_link_xdp_fd(ctx->ifindex, -1, 0);
|
||||||
|
err_load_xdp_prog:
|
||||||
|
xsk_delete_bpf_maps(xsk);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex,
|
||||||
__u32 queue_id, struct xsk_umem *umem,
|
__u32 queue_id)
|
||||||
struct xsk_ring_cons *rx, struct xsk_ring_prod *tx,
|
{
|
||||||
const struct xsk_socket_config *usr_config)
|
struct xsk_ctx *ctx;
|
||||||
|
|
||||||
|
if (list_empty(&umem->ctx_list))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
list_for_each_entry(ctx, &umem->ctx_list, list) {
|
||||||
|
if (ctx->ifindex == ifindex && ctx->queue_id == queue_id) {
|
||||||
|
ctx->refcount++;
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xsk_put_ctx(struct xsk_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct xsk_umem *umem = ctx->umem;
|
||||||
|
struct xdp_mmap_offsets off;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (--ctx->refcount == 0) {
|
||||||
|
err = xsk_get_mmap_offsets(umem->fd, &off);
|
||||||
|
if (!err) {
|
||||||
|
munmap(ctx->fill->ring - off.fr.desc,
|
||||||
|
off.fr.desc + umem->config.fill_size *
|
||||||
|
sizeof(__u64));
|
||||||
|
munmap(ctx->comp->ring - off.cr.desc,
|
||||||
|
off.cr.desc + umem->config.comp_size *
|
||||||
|
sizeof(__u64));
|
||||||
|
}
|
||||||
|
|
||||||
|
list_del(&ctx->list);
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct xsk_ctx *xsk_create_ctx(struct xsk_socket *xsk,
|
||||||
|
struct xsk_umem *umem, int ifindex,
|
||||||
|
const char *ifname, __u32 queue_id,
|
||||||
|
struct xsk_ring_prod *fill,
|
||||||
|
struct xsk_ring_cons *comp)
|
||||||
|
{
|
||||||
|
struct xsk_ctx *ctx;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
ctx = calloc(1, sizeof(*ctx));
|
||||||
|
if (!ctx)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (!umem->fill_save) {
|
||||||
|
err = xsk_create_umem_rings(umem, xsk->fd, fill, comp);
|
||||||
|
if (err) {
|
||||||
|
free(ctx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else if (umem->fill_save != fill || umem->comp_save != comp) {
|
||||||
|
/* Copy over rings to new structs. */
|
||||||
|
memcpy(fill, umem->fill_save, sizeof(*fill));
|
||||||
|
memcpy(comp, umem->comp_save, sizeof(*comp));
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->ifindex = ifindex;
|
||||||
|
ctx->refcount = 1;
|
||||||
|
ctx->umem = umem;
|
||||||
|
ctx->queue_id = queue_id;
|
||||||
|
memcpy(ctx->ifname, ifname, IFNAMSIZ - 1);
|
||||||
|
ctx->ifname[IFNAMSIZ - 1] = '\0';
|
||||||
|
|
||||||
|
umem->fill_save = NULL;
|
||||||
|
umem->comp_save = NULL;
|
||||||
|
ctx->fill = fill;
|
||||||
|
ctx->comp = comp;
|
||||||
|
list_add(&ctx->list, &umem->ctx_list);
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void xsk_destroy_xsk_struct(struct xsk_socket *xsk)
|
||||||
|
{
|
||||||
|
free(xsk->ctx);
|
||||||
|
free(xsk);
|
||||||
|
}
|
||||||
|
|
||||||
|
int xsk_socket__update_xskmap(struct xsk_socket *xsk, int fd)
|
||||||
|
{
|
||||||
|
xsk->ctx->xsks_map_fd = fd;
|
||||||
|
return xsk_set_bpf_maps(xsk);
|
||||||
|
}
|
||||||
|
|
||||||
|
int xsk_setup_xdp_prog(int ifindex, int *xsks_map_fd)
|
||||||
|
{
|
||||||
|
struct xsk_socket *xsk;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
xsk = calloc(1, sizeof(*xsk));
|
||||||
|
if (!xsk)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
res = xsk_create_xsk_struct(ifindex, xsk);
|
||||||
|
if (res) {
|
||||||
|
free(xsk);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = __xsk_setup_xdp_prog(xsk, xsks_map_fd);
|
||||||
|
|
||||||
|
xsk_destroy_xsk_struct(xsk);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int xsk_socket__create_shared(struct xsk_socket **xsk_ptr,
|
||||||
|
const char *ifname,
|
||||||
|
__u32 queue_id, struct xsk_umem *umem,
|
||||||
|
struct xsk_ring_cons *rx,
|
||||||
|
struct xsk_ring_prod *tx,
|
||||||
|
struct xsk_ring_prod *fill,
|
||||||
|
struct xsk_ring_cons *comp,
|
||||||
|
const struct xsk_socket_config *usr_config)
|
||||||
{
|
{
|
||||||
void *rx_map = NULL, *tx_map = NULL;
|
void *rx_map = NULL, *tx_map = NULL;
|
||||||
struct sockaddr_xdp sxdp = {};
|
struct sockaddr_xdp sxdp = {};
|
||||||
struct xdp_mmap_offsets off;
|
struct xdp_mmap_offsets off;
|
||||||
struct xsk_socket *xsk;
|
struct xsk_socket *xsk;
|
||||||
int err;
|
struct xsk_ctx *ctx;
|
||||||
|
int err, ifindex;
|
||||||
|
|
||||||
if (!umem || !xsk_ptr || !(rx || tx))
|
if (!umem || !xsk_ptr || !(rx || tx))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@@ -609,10 +790,10 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
if (err)
|
if (err)
|
||||||
goto out_xsk_alloc;
|
goto out_xsk_alloc;
|
||||||
|
|
||||||
if (umem->refcount &&
|
xsk->outstanding_tx = 0;
|
||||||
!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) {
|
ifindex = if_nametoindex(ifname);
|
||||||
pr_warn("Error: shared umems not supported by libbpf supplied XDP program.\n");
|
if (!ifindex) {
|
||||||
err = -EBUSY;
|
err = -errno;
|
||||||
goto out_xsk_alloc;
|
goto out_xsk_alloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -626,16 +807,21 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
xsk->fd = umem->fd;
|
xsk->fd = umem->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
xsk->outstanding_tx = 0;
|
ctx = xsk_get_ctx(umem, ifindex, queue_id);
|
||||||
xsk->queue_id = queue_id;
|
if (!ctx) {
|
||||||
xsk->umem = umem;
|
if (!fill || !comp) {
|
||||||
xsk->ifindex = if_nametoindex(ifname);
|
err = -EFAULT;
|
||||||
if (!xsk->ifindex) {
|
goto out_socket;
|
||||||
err = -errno;
|
}
|
||||||
goto out_socket;
|
|
||||||
|
ctx = xsk_create_ctx(xsk, umem, ifindex, ifname, queue_id,
|
||||||
|
fill, comp);
|
||||||
|
if (!ctx) {
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto out_socket;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memcpy(xsk->ifname, ifname, IFNAMSIZ - 1);
|
xsk->ctx = ctx;
|
||||||
xsk->ifname[IFNAMSIZ - 1] = '\0';
|
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING,
|
err = setsockopt(xsk->fd, SOL_XDP, XDP_RX_RING,
|
||||||
@@ -643,7 +829,7 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
sizeof(xsk->config.rx_size));
|
sizeof(xsk->config.rx_size));
|
||||||
if (err) {
|
if (err) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
goto out_socket;
|
goto out_put_ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tx) {
|
if (tx) {
|
||||||
@@ -652,14 +838,14 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
sizeof(xsk->config.tx_size));
|
sizeof(xsk->config.tx_size));
|
||||||
if (err) {
|
if (err) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
goto out_socket;
|
goto out_put_ctx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = xsk_get_mmap_offsets(xsk->fd, &off);
|
err = xsk_get_mmap_offsets(xsk->fd, &off);
|
||||||
if (err) {
|
if (err) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
goto out_socket;
|
goto out_put_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rx) {
|
if (rx) {
|
||||||
@@ -669,7 +855,7 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
xsk->fd, XDP_PGOFF_RX_RING);
|
xsk->fd, XDP_PGOFF_RX_RING);
|
||||||
if (rx_map == MAP_FAILED) {
|
if (rx_map == MAP_FAILED) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
goto out_socket;
|
goto out_put_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
rx->mask = xsk->config.rx_size - 1;
|
rx->mask = xsk->config.rx_size - 1;
|
||||||
@@ -708,10 +894,10 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
xsk->tx = tx;
|
xsk->tx = tx;
|
||||||
|
|
||||||
sxdp.sxdp_family = PF_XDP;
|
sxdp.sxdp_family = PF_XDP;
|
||||||
sxdp.sxdp_ifindex = xsk->ifindex;
|
sxdp.sxdp_ifindex = ctx->ifindex;
|
||||||
sxdp.sxdp_queue_id = xsk->queue_id;
|
sxdp.sxdp_queue_id = ctx->queue_id;
|
||||||
if (umem->refcount > 1) {
|
if (umem->refcount > 1) {
|
||||||
sxdp.sxdp_flags = XDP_SHARED_UMEM;
|
sxdp.sxdp_flags |= XDP_SHARED_UMEM;
|
||||||
sxdp.sxdp_shared_umem_fd = umem->fd;
|
sxdp.sxdp_shared_umem_fd = umem->fd;
|
||||||
} else {
|
} else {
|
||||||
sxdp.sxdp_flags = xsk->config.bind_flags;
|
sxdp.sxdp_flags = xsk->config.bind_flags;
|
||||||
@@ -723,10 +909,10 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
|||||||
goto out_mmap_tx;
|
goto out_mmap_tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
xsk->prog_fd = -1;
|
ctx->prog_fd = -1;
|
||||||
|
|
||||||
if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) {
|
if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) {
|
||||||
err = xsk_setup_xdp_prog(xsk);
|
err = __xsk_setup_xdp_prog(xsk, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_mmap_tx;
|
goto out_mmap_tx;
|
||||||
}
|
}
|
||||||
@@ -742,6 +928,8 @@ out_mmap_rx:
|
|||||||
if (rx)
|
if (rx)
|
||||||
munmap(rx_map, off.rx.desc +
|
munmap(rx_map, off.rx.desc +
|
||||||
xsk->config.rx_size * sizeof(struct xdp_desc));
|
xsk->config.rx_size * sizeof(struct xdp_desc));
|
||||||
|
out_put_ctx:
|
||||||
|
xsk_put_ctx(ctx);
|
||||||
out_socket:
|
out_socket:
|
||||||
if (--umem->refcount)
|
if (--umem->refcount)
|
||||||
close(xsk->fd);
|
close(xsk->fd);
|
||||||
@@ -750,25 +938,24 @@ out_xsk_alloc:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
|
||||||
|
__u32 queue_id, struct xsk_umem *umem,
|
||||||
|
struct xsk_ring_cons *rx, struct xsk_ring_prod *tx,
|
||||||
|
const struct xsk_socket_config *usr_config)
|
||||||
|
{
|
||||||
|
return xsk_socket__create_shared(xsk_ptr, ifname, queue_id, umem,
|
||||||
|
rx, tx, umem->fill_save,
|
||||||
|
umem->comp_save, usr_config);
|
||||||
|
}
|
||||||
|
|
||||||
int xsk_umem__delete(struct xsk_umem *umem)
|
int xsk_umem__delete(struct xsk_umem *umem)
|
||||||
{
|
{
|
||||||
struct xdp_mmap_offsets off;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (!umem)
|
if (!umem)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (umem->refcount)
|
if (umem->refcount)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
err = xsk_get_mmap_offsets(umem->fd, &off);
|
|
||||||
if (!err) {
|
|
||||||
munmap(umem->fill->ring - off.fr.desc,
|
|
||||||
off.fr.desc + umem->config.fill_size * sizeof(__u64));
|
|
||||||
munmap(umem->comp->ring - off.cr.desc,
|
|
||||||
off.cr.desc + umem->config.comp_size * sizeof(__u64));
|
|
||||||
}
|
|
||||||
|
|
||||||
close(umem->fd);
|
close(umem->fd);
|
||||||
free(umem);
|
free(umem);
|
||||||
|
|
||||||
@@ -779,14 +966,18 @@ void xsk_socket__delete(struct xsk_socket *xsk)
|
|||||||
{
|
{
|
||||||
size_t desc_sz = sizeof(struct xdp_desc);
|
size_t desc_sz = sizeof(struct xdp_desc);
|
||||||
struct xdp_mmap_offsets off;
|
struct xdp_mmap_offsets off;
|
||||||
|
struct xsk_umem *umem;
|
||||||
|
struct xsk_ctx *ctx;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!xsk)
|
if (!xsk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xsk->prog_fd != -1) {
|
ctx = xsk->ctx;
|
||||||
|
umem = ctx->umem;
|
||||||
|
if (ctx->prog_fd != -1) {
|
||||||
xsk_delete_bpf_maps(xsk);
|
xsk_delete_bpf_maps(xsk);
|
||||||
close(xsk->prog_fd);
|
close(ctx->prog_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = xsk_get_mmap_offsets(xsk->fd, &off);
|
err = xsk_get_mmap_offsets(xsk->fd, &off);
|
||||||
@@ -799,14 +990,15 @@ void xsk_socket__delete(struct xsk_socket *xsk)
|
|||||||
munmap(xsk->tx->ring - off.tx.desc,
|
munmap(xsk->tx->ring - off.tx.desc,
|
||||||
off.tx.desc + xsk->config.tx_size * desc_sz);
|
off.tx.desc + xsk->config.tx_size * desc_sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xsk->umem->refcount--;
|
xsk_put_ctx(ctx);
|
||||||
|
|
||||||
|
umem->refcount--;
|
||||||
/* Do not close an fd that also has an associated umem connected
|
/* Do not close an fd that also has an associated umem connected
|
||||||
* to it.
|
* to it.
|
||||||
*/
|
*/
|
||||||
if (xsk->fd != xsk->umem->fd)
|
if (xsk->fd != umem->fd)
|
||||||
close(xsk->fd);
|
close(xsk->fd);
|
||||||
free(xsk);
|
free(xsk);
|
||||||
}
|
}
|
||||||
|
|||||||
31
src/xsk.h
31
src/xsk.h
@@ -113,8 +113,7 @@ static inline __u32 xsk_cons_nb_avail(struct xsk_ring_cons *r, __u32 nb)
|
|||||||
return (entries > nb) ? nb : entries;
|
return (entries > nb) ? nb : entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t xsk_ring_prod__reserve(struct xsk_ring_prod *prod,
|
static inline __u32 xsk_ring_prod__reserve(struct xsk_ring_prod *prod, __u32 nb, __u32 *idx)
|
||||||
size_t nb, __u32 *idx)
|
|
||||||
{
|
{
|
||||||
if (xsk_prod_nb_free(prod, nb) < nb)
|
if (xsk_prod_nb_free(prod, nb) < nb)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -125,7 +124,7 @@ static inline size_t xsk_ring_prod__reserve(struct xsk_ring_prod *prod,
|
|||||||
return nb;
|
return nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void xsk_ring_prod__submit(struct xsk_ring_prod *prod, size_t nb)
|
static inline void xsk_ring_prod__submit(struct xsk_ring_prod *prod, __u32 nb)
|
||||||
{
|
{
|
||||||
/* Make sure everything has been written to the ring before indicating
|
/* Make sure everything has been written to the ring before indicating
|
||||||
* this to the kernel by writing the producer pointer.
|
* this to the kernel by writing the producer pointer.
|
||||||
@@ -135,10 +134,9 @@ static inline void xsk_ring_prod__submit(struct xsk_ring_prod *prod, size_t nb)
|
|||||||
*prod->producer += nb;
|
*prod->producer += nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t xsk_ring_cons__peek(struct xsk_ring_cons *cons,
|
static inline __u32 xsk_ring_cons__peek(struct xsk_ring_cons *cons, __u32 nb, __u32 *idx)
|
||||||
size_t nb, __u32 *idx)
|
|
||||||
{
|
{
|
||||||
size_t entries = xsk_cons_nb_avail(cons, nb);
|
__u32 entries = xsk_cons_nb_avail(cons, nb);
|
||||||
|
|
||||||
if (entries > 0) {
|
if (entries > 0) {
|
||||||
/* Make sure we do not speculatively read the data before
|
/* Make sure we do not speculatively read the data before
|
||||||
@@ -153,7 +151,12 @@ static inline size_t xsk_ring_cons__peek(struct xsk_ring_cons *cons,
|
|||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void xsk_ring_cons__release(struct xsk_ring_cons *cons, size_t nb)
|
static inline void xsk_ring_cons__cancel(struct xsk_ring_cons *cons, __u32 nb)
|
||||||
|
{
|
||||||
|
cons->cached_cons -= nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void xsk_ring_cons__release(struct xsk_ring_cons *cons, __u32 nb)
|
||||||
{
|
{
|
||||||
/* Make sure data has been read before indicating we are done
|
/* Make sure data has been read before indicating we are done
|
||||||
* with the entries by updating the consumer pointer.
|
* with the entries by updating the consumer pointer.
|
||||||
@@ -201,6 +204,11 @@ struct xsk_umem_config {
|
|||||||
__u32 flags;
|
__u32 flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
LIBBPF_API int xsk_setup_xdp_prog(int ifindex,
|
||||||
|
int *xsks_map_fd);
|
||||||
|
LIBBPF_API int xsk_socket__update_xskmap(struct xsk_socket *xsk,
|
||||||
|
int xsks_map_fd);
|
||||||
|
|
||||||
/* Flags for the libbpf_flags field. */
|
/* Flags for the libbpf_flags field. */
|
||||||
#define XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD (1 << 0)
|
#define XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD (1 << 0)
|
||||||
|
|
||||||
@@ -234,6 +242,15 @@ LIBBPF_API int xsk_socket__create(struct xsk_socket **xsk,
|
|||||||
struct xsk_ring_cons *rx,
|
struct xsk_ring_cons *rx,
|
||||||
struct xsk_ring_prod *tx,
|
struct xsk_ring_prod *tx,
|
||||||
const struct xsk_socket_config *config);
|
const struct xsk_socket_config *config);
|
||||||
|
LIBBPF_API int
|
||||||
|
xsk_socket__create_shared(struct xsk_socket **xsk_ptr,
|
||||||
|
const char *ifname,
|
||||||
|
__u32 queue_id, struct xsk_umem *umem,
|
||||||
|
struct xsk_ring_cons *rx,
|
||||||
|
struct xsk_ring_prod *tx,
|
||||||
|
struct xsk_ring_prod *fill,
|
||||||
|
struct xsk_ring_cons *comp,
|
||||||
|
const struct xsk_socket_config *config);
|
||||||
|
|
||||||
/* Returns 0 for success and -EBUSY if the umem is still in use. */
|
/* Returns 0 for success and -EBUSY if the umem is still in use. */
|
||||||
LIBBPF_API int xsk_umem__delete(struct xsk_umem *umem);
|
LIBBPF_API int xsk_umem__delete(struct xsk_umem *umem);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eux
|
set -eu
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
|
travis_fold start build_pahole "Building pahole"
|
||||||
|
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
REPO_PATH=$1
|
REPO_PATH=$1
|
||||||
@@ -23,3 +27,4 @@ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:/usr/local/lib
|
|||||||
ldd $(which pahole)
|
ldd $(which pahole)
|
||||||
pahole --version
|
pahole --version
|
||||||
|
|
||||||
|
travis_fold end build_pahole
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euxo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
|
travis_fold start prepare_selftests "Building selftests"
|
||||||
|
|
||||||
LLVM_VER=12
|
LLVM_VER=12
|
||||||
LIBBPF_PATH="${REPO_ROOT}"
|
LIBBPF_PATH="${REPO_ROOT}"
|
||||||
@@ -33,3 +37,5 @@ rm selftests/bpf/.gitignore
|
|||||||
git add selftests
|
git add selftests
|
||||||
|
|
||||||
git add "${VMTEST_ROOT}/configs/blacklist"
|
git add "${VMTEST_ROOT}/configs/blacklist"
|
||||||
|
|
||||||
|
travis_fold end prepare_selftests
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eux
|
set -eu
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
CWD=$(pwd)
|
CWD=$(pwd)
|
||||||
LIBBPF_PATH=$(pwd)
|
LIBBPF_PATH=$(pwd)
|
||||||
@@ -14,11 +16,13 @@ echo REPO_PATH = ${REPO_PATH}
|
|||||||
echo LINUX_SHA = ${LINUX_SHA}
|
echo LINUX_SHA = ${LINUX_SHA}
|
||||||
|
|
||||||
if [ ! -d "${REPO_PATH}" ]; then
|
if [ ! -d "${REPO_PATH}" ]; then
|
||||||
|
echo
|
||||||
|
travis_fold start pull_kernel_srcs "Fetching kernel sources"
|
||||||
|
|
||||||
mkdir -p $(dirname "${REPO_PATH}")
|
mkdir -p $(dirname "${REPO_PATH}")
|
||||||
cd $(dirname "${REPO_PATH}")
|
cd $(dirname "${REPO_PATH}")
|
||||||
# attempt to fetch desired bpf-next repo snapshot
|
# attempt to fetch desired bpf-next repo snapshot
|
||||||
if wget ${SNAPSHOT_URL} ; then
|
if wget ${SNAPSHOT_URL} && tar xf bpf-next-${LINUX_SHA}.tar.gz ; then
|
||||||
tar xf bpf-next-${LINUX_SHA}.tar.gz
|
|
||||||
mv bpf-next-${LINUX_SHA} $(basename ${REPO_PATH})
|
mv bpf-next-${LINUX_SHA} $(basename ${REPO_PATH})
|
||||||
else
|
else
|
||||||
# but fallback to git fetch approach if that fails
|
# but fallback to git fetch approach if that fails
|
||||||
@@ -35,4 +39,6 @@ if [ ! -d "${REPO_PATH}" ]; then
|
|||||||
fi
|
fi
|
||||||
git reset --hard ${LINUX_SHA}
|
git reset --hard ${LINUX_SHA}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
travis_fold end pull_kernel_srcs
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
INDEX https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/INDEX
|
INDEX https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/INDEX
|
||||||
libbpf-vmtest-rootfs-2020.03.11.tar.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/libbpf-vmtest-rootfs-2020.03.11.tar.zst
|
libbpf-vmtest-rootfs-2020.09.27.tar.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/libbpf-vmtest-rootfs-2020.09.27.tar.zst
|
||||||
vmlinux-4.9.0.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-4.9.0.zst
|
vmlinux-4.9.0.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-4.9.0.zst
|
||||||
vmlinux-5.5.0-rc6.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-5.5.0-rc6.zst
|
vmlinux-5.5.0-rc6.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-5.5.0-rc6.zst
|
||||||
vmlinux-5.5.0.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-5.5.0.zst
|
vmlinux-5.5.0.zst https://libbpf-vmtest.s3-us-west-1.amazonaws.com/x86_64/vmlinux-5.5.0.zst
|
||||||
|
|||||||
@@ -3,19 +3,15 @@ align # verifier output format changed
|
|||||||
bpf_iter # bpf_iter support is missing
|
bpf_iter # bpf_iter support is missing
|
||||||
bpf_obj_id # bpf_link support missing for GET_OBJ_INFO, GET_FD_BY_ID, etc
|
bpf_obj_id # bpf_link support missing for GET_OBJ_INFO, GET_FD_BY_ID, etc
|
||||||
bpf_tcp_ca # STRUCT_OPS is missing
|
bpf_tcp_ca # STRUCT_OPS is missing
|
||||||
|
|
||||||
# latest Clang generates code that fails to verify
|
|
||||||
bpf_verif_scale
|
|
||||||
#bpf_verif_scale/strobemeta.o
|
|
||||||
#bpf_verif_scale/strobemeta_nounroll1.o
|
|
||||||
#bpf_verif_scale/strobemeta_nounroll2.o
|
|
||||||
btf_map_in_map # inner map leak fixed in 5.8
|
btf_map_in_map # inner map leak fixed in 5.8
|
||||||
|
btf_skc_cls_ingress # v5.10+ functionality
|
||||||
cg_storage_multi # v5.9+ functionality
|
cg_storage_multi # v5.9+ functionality
|
||||||
cgroup_attach_multi # BPF_F_REPLACE_PROG missing
|
cgroup_attach_multi # BPF_F_REPLACE_PROG missing
|
||||||
cgroup_link # LINK_CREATE is missing
|
cgroup_link # LINK_CREATE is missing
|
||||||
cgroup_skb_sk_lookup # bpf_sk_lookup_tcp() helper is missing
|
cgroup_skb_sk_lookup # bpf_sk_lookup_tcp() helper is missing
|
||||||
|
cls_redirect # bpf_csum_level() helper is missing
|
||||||
connect_force_port # cgroup/get{peer,sock}name{4,6} support is missing
|
connect_force_port # cgroup/get{peer,sock}name{4,6} support is missing
|
||||||
|
d_path # v5.10+ feature
|
||||||
enable_stats # BPF_ENABLE_STATS support is missing
|
enable_stats # BPF_ENABLE_STATS support is missing
|
||||||
fentry_fexit # bpf_prog_test_tracing missing
|
fentry_fexit # bpf_prog_test_tracing missing
|
||||||
fentry_test # bpf_prog_test_tracing missing
|
fentry_test # bpf_prog_test_tracing missing
|
||||||
@@ -24,14 +20,25 @@ fexit_test # bpf_prog_test_tracing missing
|
|||||||
flow_dissector # bpf_link-based flow dissector is in 5.8+
|
flow_dissector # bpf_link-based flow dissector is in 5.8+
|
||||||
flow_dissector_reattach
|
flow_dissector_reattach
|
||||||
get_stack_raw_tp # exercising BPF verifier bug causing infinite loop
|
get_stack_raw_tp # exercising BPF verifier bug causing infinite loop
|
||||||
|
hash_large_key # v5.11+
|
||||||
|
ima # v5.11+
|
||||||
|
kfree_skb # 32-bit pointer arith in test_pkt_access
|
||||||
ksyms # __start_BTF has different name
|
ksyms # __start_BTF has different name
|
||||||
link_pinning # bpf_link is missing
|
link_pinning # bpf_link is missing
|
||||||
load_bytes_relative # new functionality in 5.8
|
load_bytes_relative # new functionality in 5.8
|
||||||
|
map_init # per-CPU LRU missing
|
||||||
map_ptr # test uses BPF_MAP_TYPE_RINGBUF, added in 5.8
|
map_ptr # test uses BPF_MAP_TYPE_RINGBUF, added in 5.8
|
||||||
|
metadata # v5.10+
|
||||||
mmap # 5.5 kernel is too permissive with re-mmaping
|
mmap # 5.5 kernel is too permissive with re-mmaping
|
||||||
modify_return # fmod_ret support is missing
|
modify_return # fmod_ret support is missing
|
||||||
|
module_attach # module BTF support missing (v5.11+)
|
||||||
ns_current_pid_tgid # bpf_get_ns_current_pid_tgid() helper is missing
|
ns_current_pid_tgid # bpf_get_ns_current_pid_tgid() helper is missing
|
||||||
|
pe_preserve_elems # v5.10+
|
||||||
perf_branches # bpf_read_branch_records() helper is missing
|
perf_branches # bpf_read_branch_records() helper is missing
|
||||||
|
pkt_access # 32-bit pointer arith in test_pkt_access
|
||||||
|
probe_read_user_str # kernel bug with garbage bytes at the end
|
||||||
|
prog_run_xattr # 32-bit pointer arith in test_pkt_access
|
||||||
|
raw_tp_test_run # v5.10+
|
||||||
ringbuf # BPF_MAP_TYPE_RINGBUF is supported in 5.8+
|
ringbuf # BPF_MAP_TYPE_RINGBUF is supported in 5.8+
|
||||||
|
|
||||||
# bug in verifier w/ tracking references
|
# bug in verifier w/ tracking references
|
||||||
@@ -39,16 +46,28 @@ ringbuf # BPF_MAP_TYPE_RINGBUF is supported in 5.8+
|
|||||||
reference_tracking
|
reference_tracking
|
||||||
|
|
||||||
select_reuseport # UDP support is missing
|
select_reuseport # UDP support is missing
|
||||||
|
send_signal # bpf_send_signal_thread() helper is missing
|
||||||
sk_assign # bpf_sk_assign helper missing
|
sk_assign # bpf_sk_assign helper missing
|
||||||
skb_helpers # helpers added in 5.8+
|
skb_helpers # helpers added in 5.8+
|
||||||
|
sk_storage_tracing # missing bpf_sk_storage_get() helper
|
||||||
|
snprintf_btf # v5.10+
|
||||||
|
sock_fields # v5.10+
|
||||||
sockmap_basic # uses new socket fields, 5.8+
|
sockmap_basic # uses new socket fields, 5.8+
|
||||||
sockmap_listen # no listen socket supportin SOCKMAP
|
sockmap_listen # no listen socket supportin SOCKMAP
|
||||||
sockopt_sk
|
sockopt_sk
|
||||||
sk_lookup # v5.9+
|
sk_lookup # v5.9+
|
||||||
skb_ctx # ctx_{size, }_{in, out} in BPF_PROG_TEST_RUN is missing
|
skb_ctx # ctx_{size, }_{in, out} in BPF_PROG_TEST_RUN is missing
|
||||||
|
tcp_hdr_options # v5.10+, new TCP header options feature in BPF
|
||||||
|
tcpbpf_user # LINK_CREATE is missing
|
||||||
|
test_bpffs # v5.10+, new CONFIG_BPF_PRELOAD=y and CONFIG_BPF_PRELOAD_UMG=y|m
|
||||||
|
test_bprm_opts # v5.11+
|
||||||
test_global_funcs # kernel doesn't support BTF linkage=global on FUNCs
|
test_global_funcs # kernel doesn't support BTF linkage=global on FUNCs
|
||||||
|
test_local_storage # v5.10+ feature
|
||||||
test_lsm # no BPF_LSM support
|
test_lsm # no BPF_LSM support
|
||||||
test_overhead # no fmod_ret support
|
test_overhead # no fmod_ret support
|
||||||
|
test_profiler # needs verifier logic improvements from v5.10+
|
||||||
|
test_skb_pkt_end # v5.11+
|
||||||
|
trace_ext # v5.10+
|
||||||
udp_limit # no cgroup/sock_release BPF program type (5.9+)
|
udp_limit # no cgroup/sock_release BPF program type (5.9+)
|
||||||
varlen # verifier bug fixed in later kernels
|
varlen # verifier bug fixed in later kernels
|
||||||
vmlinux # hrtimer_nanosleep() signature changed incompatibly
|
vmlinux # hrtimer_nanosleep() signature changed incompatibly
|
||||||
@@ -59,7 +78,6 @@ xdp_cpumap_attach # v5.9+
|
|||||||
xdp_devmap_attach # new feature in 5.8
|
xdp_devmap_attach # new feature in 5.8
|
||||||
xdp_link # v5.9+
|
xdp_link # v5.9+
|
||||||
|
|
||||||
|
# SUBTESTS FAILING (block entire test until blocking subtests works properly)
|
||||||
# TEMPORARILY DISABLED
|
btf # "size check test", "func (Non zero vlen)"
|
||||||
send_signal # flaky
|
tailcalls # tailcall_bpf2bpf_1, tailcall_bpf2bpf_2, tailcall_bpf2bpf_3
|
||||||
cls_redirect # latest Clang breaks BPF verification
|
|
||||||
|
|||||||
@@ -1,7 +1 @@
|
|||||||
# TEMPORARILY DISABLED
|
# TEMPORARY
|
||||||
send_signal # flaky
|
|
||||||
test_lsm # semi-working
|
|
||||||
sk_assign # needs better setup in Travis CI
|
|
||||||
sk_lookup
|
|
||||||
core_reloc # temporary test breakage
|
|
||||||
bpf_verif_scale # clang regression
|
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/x86 5.6.0-rc3 Kernel Configuration
|
# Linux/x86 5.9.0-rc1 Kernel Configuration
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Compiler: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
|
|
||||||
#
|
#
|
||||||
|
CONFIG_CC_VERSION_TEXT="gcc (GCC) 8.2.1 20180801 (Red Hat 8.2.1-2)"
|
||||||
CONFIG_CC_IS_GCC=y
|
CONFIG_CC_IS_GCC=y
|
||||||
CONFIG_GCC_VERSION=40805
|
CONFIG_GCC_VERSION=80201
|
||||||
|
CONFIG_LD_VERSION=230000000
|
||||||
CONFIG_CLANG_VERSION=0
|
CONFIG_CLANG_VERSION=0
|
||||||
CONFIG_CC_CAN_LINK=y
|
CONFIG_CC_CAN_LINK=y
|
||||||
|
CONFIG_CC_CAN_LINK_STATIC=y
|
||||||
CONFIG_CC_HAS_ASM_GOTO=y
|
CONFIG_CC_HAS_ASM_GOTO=y
|
||||||
CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y
|
|
||||||
CONFIG_CC_DISABLE_WARN_MAYBE_UNINITIALIZED=y
|
|
||||||
CONFIG_IRQ_WORK=y
|
CONFIG_IRQ_WORK=y
|
||||||
CONFIG_BUILDTIME_TABLE_SORT=y
|
CONFIG_BUILDTIME_TABLE_SORT=y
|
||||||
CONFIG_THREAD_INFO_IN_TASK=y
|
CONFIG_THREAD_INFO_IN_TASK=y
|
||||||
@@ -31,22 +28,27 @@ CONFIG_HAVE_KERNEL_LZMA=y
|
|||||||
CONFIG_HAVE_KERNEL_XZ=y
|
CONFIG_HAVE_KERNEL_XZ=y
|
||||||
CONFIG_HAVE_KERNEL_LZO=y
|
CONFIG_HAVE_KERNEL_LZO=y
|
||||||
CONFIG_HAVE_KERNEL_LZ4=y
|
CONFIG_HAVE_KERNEL_LZ4=y
|
||||||
|
CONFIG_HAVE_KERNEL_ZSTD=y
|
||||||
CONFIG_KERNEL_GZIP=y
|
CONFIG_KERNEL_GZIP=y
|
||||||
# CONFIG_KERNEL_BZIP2 is not set
|
# CONFIG_KERNEL_BZIP2 is not set
|
||||||
# CONFIG_KERNEL_LZMA is not set
|
# CONFIG_KERNEL_LZMA is not set
|
||||||
# CONFIG_KERNEL_XZ is not set
|
# CONFIG_KERNEL_XZ is not set
|
||||||
# CONFIG_KERNEL_LZO is not set
|
# CONFIG_KERNEL_LZO is not set
|
||||||
# CONFIG_KERNEL_LZ4 is not set
|
# CONFIG_KERNEL_LZ4 is not set
|
||||||
|
# CONFIG_KERNEL_ZSTD is not set
|
||||||
|
CONFIG_DEFAULT_INIT=""
|
||||||
CONFIG_DEFAULT_HOSTNAME="(none)"
|
CONFIG_DEFAULT_HOSTNAME="(none)"
|
||||||
CONFIG_SWAP=y
|
CONFIG_SWAP=y
|
||||||
CONFIG_SYSVIPC=y
|
CONFIG_SYSVIPC=y
|
||||||
CONFIG_SYSVIPC_SYSCTL=y
|
CONFIG_SYSVIPC_SYSCTL=y
|
||||||
CONFIG_POSIX_MQUEUE=y
|
CONFIG_POSIX_MQUEUE=y
|
||||||
CONFIG_POSIX_MQUEUE_SYSCTL=y
|
CONFIG_POSIX_MQUEUE_SYSCTL=y
|
||||||
|
# CONFIG_WATCH_QUEUE is not set
|
||||||
CONFIG_CROSS_MEMORY_ATTACH=y
|
CONFIG_CROSS_MEMORY_ATTACH=y
|
||||||
# CONFIG_USELIB is not set
|
# CONFIG_USELIB is not set
|
||||||
# CONFIG_AUDIT is not set
|
CONFIG_AUDIT=y
|
||||||
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
|
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
|
||||||
|
CONFIG_AUDITSYSCALL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# IRQ subsystem
|
# IRQ subsystem
|
||||||
@@ -56,6 +58,7 @@ CONFIG_GENERIC_IRQ_SHOW=y
|
|||||||
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
|
CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
|
||||||
CONFIG_GENERIC_PENDING_IRQ=y
|
CONFIG_GENERIC_PENDING_IRQ=y
|
||||||
CONFIG_GENERIC_IRQ_MIGRATION=y
|
CONFIG_GENERIC_IRQ_MIGRATION=y
|
||||||
|
CONFIG_HARDIRQS_SW_RESEND=y
|
||||||
CONFIG_IRQ_DOMAIN=y
|
CONFIG_IRQ_DOMAIN=y
|
||||||
CONFIG_IRQ_DOMAIN_HIERARCHY=y
|
CONFIG_IRQ_DOMAIN_HIERARCHY=y
|
||||||
CONFIG_GENERIC_MSI_IRQ=y
|
CONFIG_GENERIC_MSI_IRQ=y
|
||||||
@@ -68,7 +71,6 @@ CONFIG_SPARSE_IRQ=y
|
|||||||
# end of IRQ subsystem
|
# end of IRQ subsystem
|
||||||
|
|
||||||
CONFIG_CLOCKSOURCE_WATCHDOG=y
|
CONFIG_CLOCKSOURCE_WATCHDOG=y
|
||||||
CONFIG_ARCH_CLOCKSOURCE_DATA=y
|
|
||||||
CONFIG_ARCH_CLOCKSOURCE_INIT=y
|
CONFIG_ARCH_CLOCKSOURCE_INIT=y
|
||||||
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
|
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
|
||||||
CONFIG_GENERIC_TIME_VSYSCALL=y
|
CONFIG_GENERIC_TIME_VSYSCALL=y
|
||||||
@@ -76,6 +78,8 @@ CONFIG_GENERIC_CLOCKEVENTS=y
|
|||||||
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
|
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
|
||||||
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
|
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
|
||||||
CONFIG_GENERIC_CMOS_UPDATE=y
|
CONFIG_GENERIC_CMOS_UPDATE=y
|
||||||
|
CONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=y
|
||||||
|
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Timers subsystem
|
# Timers subsystem
|
||||||
@@ -120,7 +124,9 @@ CONFIG_PREEMPT_RCU=y
|
|||||||
# CONFIG_RCU_EXPERT is not set
|
# CONFIG_RCU_EXPERT is not set
|
||||||
CONFIG_SRCU=y
|
CONFIG_SRCU=y
|
||||||
CONFIG_TREE_SRCU=y
|
CONFIG_TREE_SRCU=y
|
||||||
|
CONFIG_TASKS_RCU_GENERIC=y
|
||||||
CONFIG_TASKS_RCU=y
|
CONFIG_TASKS_RCU=y
|
||||||
|
CONFIG_TASKS_RUDE_RCU=y
|
||||||
CONFIG_RCU_STALL_COMMON=y
|
CONFIG_RCU_STALL_COMMON=y
|
||||||
CONFIG_RCU_NEED_SEGCBLIST=y
|
CONFIG_RCU_NEED_SEGCBLIST=y
|
||||||
# end of RCU Subsystem
|
# end of RCU Subsystem
|
||||||
@@ -136,6 +142,7 @@ CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
|
|||||||
#
|
#
|
||||||
# Scheduler features
|
# Scheduler features
|
||||||
#
|
#
|
||||||
|
# CONFIG_UCLAMP_TASK is not set
|
||||||
# end of Scheduler features
|
# end of Scheduler features
|
||||||
|
|
||||||
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
|
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
|
||||||
@@ -148,7 +155,6 @@ CONFIG_CGROUPS=y
|
|||||||
CONFIG_PAGE_COUNTER=y
|
CONFIG_PAGE_COUNTER=y
|
||||||
CONFIG_MEMCG=y
|
CONFIG_MEMCG=y
|
||||||
CONFIG_MEMCG_SWAP=y
|
CONFIG_MEMCG_SWAP=y
|
||||||
CONFIG_MEMCG_SWAP_ENABLED=y
|
|
||||||
CONFIG_MEMCG_KMEM=y
|
CONFIG_MEMCG_KMEM=y
|
||||||
CONFIG_BLK_CGROUP=y
|
CONFIG_BLK_CGROUP=y
|
||||||
CONFIG_CGROUP_WRITEBACK=y
|
CONFIG_CGROUP_WRITEBACK=y
|
||||||
@@ -187,6 +193,7 @@ CONFIG_RD_LZMA=y
|
|||||||
CONFIG_RD_XZ=y
|
CONFIG_RD_XZ=y
|
||||||
CONFIG_RD_LZO=y
|
CONFIG_RD_LZO=y
|
||||||
CONFIG_RD_LZ4=y
|
CONFIG_RD_LZ4=y
|
||||||
|
CONFIG_RD_ZSTD=y
|
||||||
CONFIG_BOOT_CONFIG=y
|
CONFIG_BOOT_CONFIG=y
|
||||||
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
|
CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
|
||||||
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
|
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
|
||||||
@@ -221,10 +228,14 @@ CONFIG_KALLSYMS=y
|
|||||||
CONFIG_KALLSYMS_ALL=y
|
CONFIG_KALLSYMS_ALL=y
|
||||||
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
|
CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y
|
||||||
CONFIG_KALLSYMS_BASE_RELATIVE=y
|
CONFIG_KALLSYMS_BASE_RELATIVE=y
|
||||||
|
CONFIG_BPF_LSM=y
|
||||||
CONFIG_BPF_SYSCALL=y
|
CONFIG_BPF_SYSCALL=y
|
||||||
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
|
CONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
|
||||||
CONFIG_BPF_JIT_ALWAYS_ON=y
|
CONFIG_BPF_JIT_ALWAYS_ON=y
|
||||||
CONFIG_BPF_JIT_DEFAULT_ON=y
|
CONFIG_BPF_JIT_DEFAULT_ON=y
|
||||||
|
CONFIG_USERMODE_DRIVER=y
|
||||||
|
CONFIG_BPF_PRELOAD=y
|
||||||
|
CONFIG_BPF_PRELOAD_UMD=y
|
||||||
# CONFIG_USERFAULTFD is not set
|
# CONFIG_USERFAULTFD is not set
|
||||||
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
|
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
|
||||||
CONFIG_RSEQ=y
|
CONFIG_RSEQ=y
|
||||||
@@ -261,7 +272,6 @@ CONFIG_X86_64=y
|
|||||||
CONFIG_X86=y
|
CONFIG_X86=y
|
||||||
CONFIG_INSTRUCTION_DECODER=y
|
CONFIG_INSTRUCTION_DECODER=y
|
||||||
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
|
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
|
||||||
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
|
|
||||||
CONFIG_LOCKDEP_SUPPORT=y
|
CONFIG_LOCKDEP_SUPPORT=y
|
||||||
CONFIG_STACKTRACE_SUPPORT=y
|
CONFIG_STACKTRACE_SUPPORT=y
|
||||||
CONFIG_MMU=y
|
CONFIG_MMU=y
|
||||||
@@ -379,7 +389,6 @@ CONFIG_X86_DIRECT_GBPAGES=y
|
|||||||
CONFIG_NUMA=y
|
CONFIG_NUMA=y
|
||||||
CONFIG_AMD_NUMA=y
|
CONFIG_AMD_NUMA=y
|
||||||
CONFIG_X86_64_ACPI_NUMA=y
|
CONFIG_X86_64_ACPI_NUMA=y
|
||||||
CONFIG_NODES_SPAN_OTHER_NODES=y
|
|
||||||
# CONFIG_NUMA_EMU is not set
|
# CONFIG_NUMA_EMU is not set
|
||||||
CONFIG_NODES_SHIFT=6
|
CONFIG_NODES_SHIFT=6
|
||||||
CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
||||||
@@ -452,12 +461,12 @@ CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT=y
|
|||||||
# CONFIG_ACPI_DEBUGGER is not set
|
# CONFIG_ACPI_DEBUGGER is not set
|
||||||
# CONFIG_ACPI_SPCR_TABLE is not set
|
# CONFIG_ACPI_SPCR_TABLE is not set
|
||||||
CONFIG_ACPI_LPIT=y
|
CONFIG_ACPI_LPIT=y
|
||||||
# CONFIG_ACPI_PROCFS_POWER is not set
|
|
||||||
# CONFIG_ACPI_REV_OVERRIDE_POSSIBLE is not set
|
# CONFIG_ACPI_REV_OVERRIDE_POSSIBLE is not set
|
||||||
# CONFIG_ACPI_EC_DEBUGFS is not set
|
# CONFIG_ACPI_EC_DEBUGFS is not set
|
||||||
# CONFIG_ACPI_AC is not set
|
# CONFIG_ACPI_AC is not set
|
||||||
# CONFIG_ACPI_BATTERY is not set
|
# CONFIG_ACPI_BATTERY is not set
|
||||||
# CONFIG_ACPI_BUTTON is not set
|
# CONFIG_ACPI_BUTTON is not set
|
||||||
|
# CONFIG_ACPI_TINY_POWER_BUTTON is not set
|
||||||
# CONFIG_ACPI_VIDEO is not set
|
# CONFIG_ACPI_VIDEO is not set
|
||||||
# CONFIG_ACPI_FAN is not set
|
# CONFIG_ACPI_FAN is not set
|
||||||
# CONFIG_ACPI_DOCK is not set
|
# CONFIG_ACPI_DOCK is not set
|
||||||
@@ -510,7 +519,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
|
|||||||
CONFIG_CPU_FREQ_GOV_USERSPACE=y
|
CONFIG_CPU_FREQ_GOV_USERSPACE=y
|
||||||
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
|
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
|
||||||
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
|
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
|
||||||
# CONFIG_CPU_FREQ_GOV_SCHEDUTIL is not set
|
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# CPU frequency scaling drivers
|
# CPU frequency scaling drivers
|
||||||
@@ -580,6 +589,7 @@ CONFIG_EFI_ESRT=y
|
|||||||
CONFIG_EFI_RUNTIME_MAP=y
|
CONFIG_EFI_RUNTIME_MAP=y
|
||||||
# CONFIG_EFI_FAKE_MEMMAP is not set
|
# CONFIG_EFI_FAKE_MEMMAP is not set
|
||||||
CONFIG_EFI_RUNTIME_WRAPPERS=y
|
CONFIG_EFI_RUNTIME_WRAPPERS=y
|
||||||
|
CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y
|
||||||
# CONFIG_EFI_CAPSULE_LOADER is not set
|
# CONFIG_EFI_CAPSULE_LOADER is not set
|
||||||
# CONFIG_EFI_TEST is not set
|
# CONFIG_EFI_TEST is not set
|
||||||
# CONFIG_APPLE_PROPERTIES is not set
|
# CONFIG_APPLE_PROPERTIES is not set
|
||||||
@@ -599,8 +609,10 @@ CONFIG_EFI_EARLYCON=y
|
|||||||
CONFIG_HAVE_KVM=y
|
CONFIG_HAVE_KVM=y
|
||||||
CONFIG_VIRTUALIZATION=y
|
CONFIG_VIRTUALIZATION=y
|
||||||
# CONFIG_KVM is not set
|
# CONFIG_KVM is not set
|
||||||
# CONFIG_VHOST_NET is not set
|
CONFIG_KVM_WERROR=y
|
||||||
# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set
|
CONFIG_AS_AVX512=y
|
||||||
|
CONFIG_AS_SHA1_NI=y
|
||||||
|
CONFIG_AS_SHA256_NI=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# General architecture-dependent options
|
# General architecture-dependent options
|
||||||
@@ -608,6 +620,7 @@ CONFIG_VIRTUALIZATION=y
|
|||||||
CONFIG_CRASH_CORE=y
|
CONFIG_CRASH_CORE=y
|
||||||
CONFIG_KEXEC_CORE=y
|
CONFIG_KEXEC_CORE=y
|
||||||
CONFIG_HOTPLUG_SMT=y
|
CONFIG_HOTPLUG_SMT=y
|
||||||
|
CONFIG_GENERIC_ENTRY=y
|
||||||
# CONFIG_OPROFILE is not set
|
# CONFIG_OPROFILE is not set
|
||||||
CONFIG_HAVE_OPROFILE=y
|
CONFIG_HAVE_OPROFILE=y
|
||||||
CONFIG_OPROFILE_NMI_TIMER=y
|
CONFIG_OPROFILE_NMI_TIMER=y
|
||||||
@@ -639,7 +652,6 @@ CONFIG_HAVE_ASM_MODVERSIONS=y
|
|||||||
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
|
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
|
||||||
CONFIG_HAVE_RSEQ=y
|
CONFIG_HAVE_RSEQ=y
|
||||||
CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y
|
CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y
|
||||||
CONFIG_HAVE_CLK=y
|
|
||||||
CONFIG_HAVE_HW_BREAKPOINT=y
|
CONFIG_HAVE_HW_BREAKPOINT=y
|
||||||
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
|
CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y
|
||||||
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
|
CONFIG_HAVE_USER_RETURN_NOTIFIER=y
|
||||||
@@ -657,7 +669,6 @@ CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
|
|||||||
CONFIG_SECCOMP_FILTER=y
|
CONFIG_SECCOMP_FILTER=y
|
||||||
CONFIG_HAVE_ARCH_STACKLEAK=y
|
CONFIG_HAVE_ARCH_STACKLEAK=y
|
||||||
CONFIG_HAVE_STACKPROTECTOR=y
|
CONFIG_HAVE_STACKPROTECTOR=y
|
||||||
CONFIG_CC_HAS_STACKPROTECTOR_NONE=y
|
|
||||||
# CONFIG_STACKPROTECTOR is not set
|
# CONFIG_STACKPROTECTOR is not set
|
||||||
CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y
|
CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y
|
||||||
CONFIG_HAVE_CONTEXT_TRACKING=y
|
CONFIG_HAVE_CONTEXT_TRACKING=y
|
||||||
@@ -671,12 +682,10 @@ CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
|
|||||||
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
|
CONFIG_HAVE_ARCH_SOFT_DIRTY=y
|
||||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||||
CONFIG_MODULES_USE_ELF_RELA=y
|
CONFIG_MODULES_USE_ELF_RELA=y
|
||||||
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y
|
|
||||||
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
||||||
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
|
CONFIG_HAVE_ARCH_MMAP_RND_BITS=y
|
||||||
CONFIG_HAVE_EXIT_THREAD=y
|
CONFIG_HAVE_EXIT_THREAD=y
|
||||||
CONFIG_ARCH_MMAP_RND_BITS=28
|
CONFIG_ARCH_MMAP_RND_BITS=28
|
||||||
CONFIG_HAVE_COPY_THREAD_TLS=y
|
|
||||||
CONFIG_HAVE_STACK_VALIDATION=y
|
CONFIG_HAVE_STACK_VALIDATION=y
|
||||||
CONFIG_HAVE_RELIABLE_STACKTRACE=y
|
CONFIG_HAVE_RELIABLE_STACKTRACE=y
|
||||||
CONFIG_COMPAT_32BIT_TIME=y
|
CONFIG_COMPAT_32BIT_TIME=y
|
||||||
@@ -698,7 +707,6 @@ CONFIG_ARCH_HAS_MEM_ENCRYPT=y
|
|||||||
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
|
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
|
||||||
# end of GCOV-based kernel profiling
|
# end of GCOV-based kernel profiling
|
||||||
|
|
||||||
CONFIG_PLUGIN_HOSTCC=""
|
|
||||||
CONFIG_HAVE_GCC_PLUGINS=y
|
CONFIG_HAVE_GCC_PLUGINS=y
|
||||||
# end of General architecture-dependent options
|
# end of General architecture-dependent options
|
||||||
|
|
||||||
@@ -732,6 +740,7 @@ CONFIG_BLK_CGROUP_IOLATENCY=y
|
|||||||
# CONFIG_BLK_CGROUP_IOCOST is not set
|
# CONFIG_BLK_CGROUP_IOCOST is not set
|
||||||
CONFIG_BLK_DEBUG_FS=y
|
CONFIG_BLK_DEBUG_FS=y
|
||||||
# CONFIG_BLK_SED_OPAL is not set
|
# CONFIG_BLK_SED_OPAL is not set
|
||||||
|
# CONFIG_BLK_INLINE_ENCRYPTION is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Partition Types
|
# Partition Types
|
||||||
@@ -779,6 +788,7 @@ CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
|
|||||||
CONFIG_QUEUED_SPINLOCKS=y
|
CONFIG_QUEUED_SPINLOCKS=y
|
||||||
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
|
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
|
||||||
CONFIG_QUEUED_RWLOCKS=y
|
CONFIG_QUEUED_RWLOCKS=y
|
||||||
|
CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=y
|
||||||
CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y
|
CONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=y
|
||||||
CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
|
CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
|
||||||
CONFIG_FREEZER=y
|
CONFIG_FREEZER=y
|
||||||
@@ -801,11 +811,9 @@ CONFIG_SELECT_MEMORY_MODEL=y
|
|||||||
CONFIG_SPARSEMEM_MANUAL=y
|
CONFIG_SPARSEMEM_MANUAL=y
|
||||||
CONFIG_SPARSEMEM=y
|
CONFIG_SPARSEMEM=y
|
||||||
CONFIG_NEED_MULTIPLE_NODES=y
|
CONFIG_NEED_MULTIPLE_NODES=y
|
||||||
CONFIG_HAVE_MEMORY_PRESENT=y
|
|
||||||
CONFIG_SPARSEMEM_EXTREME=y
|
CONFIG_SPARSEMEM_EXTREME=y
|
||||||
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
|
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
|
||||||
CONFIG_SPARSEMEM_VMEMMAP=y
|
CONFIG_SPARSEMEM_VMEMMAP=y
|
||||||
CONFIG_HAVE_MEMBLOCK_NODE_MAP=y
|
|
||||||
CONFIG_HAVE_FAST_GUP=y
|
CONFIG_HAVE_FAST_GUP=y
|
||||||
CONFIG_MEMORY_ISOLATION=y
|
CONFIG_MEMORY_ISOLATION=y
|
||||||
# CONFIG_MEMORY_HOTPLUG is not set
|
# CONFIG_MEMORY_HOTPLUG is not set
|
||||||
@@ -813,6 +821,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
|
|||||||
CONFIG_MEMORY_BALLOON=y
|
CONFIG_MEMORY_BALLOON=y
|
||||||
CONFIG_BALLOON_COMPACTION=y
|
CONFIG_BALLOON_COMPACTION=y
|
||||||
CONFIG_COMPACTION=y
|
CONFIG_COMPACTION=y
|
||||||
|
CONFIG_PAGE_REPORTING=y
|
||||||
CONFIG_MIGRATION=y
|
CONFIG_MIGRATION=y
|
||||||
CONFIG_CONTIG_ALLOC=y
|
CONFIG_CONTIG_ALLOC=y
|
||||||
CONFIG_PHYS_ADDR_T_64BIT=y
|
CONFIG_PHYS_ADDR_T_64BIT=y
|
||||||
@@ -828,7 +837,6 @@ CONFIG_TRANSPARENT_HUGEPAGE=y
|
|||||||
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
|
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
|
||||||
CONFIG_ARCH_WANTS_THP_SWAP=y
|
CONFIG_ARCH_WANTS_THP_SWAP=y
|
||||||
CONFIG_THP_SWAP=y
|
CONFIG_THP_SWAP=y
|
||||||
CONFIG_TRANSPARENT_HUGE_PAGECACHE=y
|
|
||||||
# CONFIG_CLEANCACHE is not set
|
# CONFIG_CLEANCACHE is not set
|
||||||
# CONFIG_FRONTSWAP is not set
|
# CONFIG_FRONTSWAP is not set
|
||||||
CONFIG_CMA=y
|
CONFIG_CMA=y
|
||||||
@@ -949,6 +957,7 @@ CONFIG_IPV6_SUBTREES=y
|
|||||||
CONFIG_IPV6_SEG6_LWTUNNEL=y
|
CONFIG_IPV6_SEG6_LWTUNNEL=y
|
||||||
# CONFIG_IPV6_SEG6_HMAC is not set
|
# CONFIG_IPV6_SEG6_HMAC is not set
|
||||||
CONFIG_IPV6_SEG6_BPF=y
|
CONFIG_IPV6_SEG6_BPF=y
|
||||||
|
# CONFIG_IPV6_RPL_LWTUNNEL is not set
|
||||||
CONFIG_NETLABEL=y
|
CONFIG_NETLABEL=y
|
||||||
# CONFIG_MPTCP is not set
|
# CONFIG_MPTCP is not set
|
||||||
CONFIG_NETWORK_SECMARK=y
|
CONFIG_NETWORK_SECMARK=y
|
||||||
@@ -979,6 +988,7 @@ CONFIG_NETFILTER_XTABLES=y
|
|||||||
#
|
#
|
||||||
# Xtables targets
|
# Xtables targets
|
||||||
#
|
#
|
||||||
|
# CONFIG_NETFILTER_XT_TARGET_AUDIT is not set
|
||||||
# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
|
# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
|
||||||
# CONFIG_NETFILTER_XT_TARGET_HMARK is not set
|
# CONFIG_NETFILTER_XT_TARGET_HMARK is not set
|
||||||
# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
|
# CONFIG_NETFILTER_XT_TARGET_IDLETIMER is not set
|
||||||
@@ -1182,6 +1192,7 @@ CONFIG_NET_ACT_BPF=y
|
|||||||
# CONFIG_NET_ACT_SKBMOD is not set
|
# CONFIG_NET_ACT_SKBMOD is not set
|
||||||
# CONFIG_NET_ACT_IFE is not set
|
# CONFIG_NET_ACT_IFE is not set
|
||||||
# CONFIG_NET_ACT_TUNNEL_KEY is not set
|
# CONFIG_NET_ACT_TUNNEL_KEY is not set
|
||||||
|
# CONFIG_NET_ACT_GATE is not set
|
||||||
CONFIG_NET_TC_SKB_EXT=y
|
CONFIG_NET_TC_SKB_EXT=y
|
||||||
CONFIG_NET_SCH_FIFO=y
|
CONFIG_NET_SCH_FIFO=y
|
||||||
CONFIG_DCB=y
|
CONFIG_DCB=y
|
||||||
@@ -1197,6 +1208,7 @@ CONFIG_MPLS=y
|
|||||||
# CONFIG_HSR is not set
|
# CONFIG_HSR is not set
|
||||||
# CONFIG_NET_SWITCHDEV is not set
|
# CONFIG_NET_SWITCHDEV is not set
|
||||||
# CONFIG_NET_L3_MASTER_DEV is not set
|
# CONFIG_NET_L3_MASTER_DEV is not set
|
||||||
|
# CONFIG_QRTR is not set
|
||||||
# CONFIG_NET_NCSI is not set
|
# CONFIG_NET_NCSI is not set
|
||||||
CONFIG_RPS=y
|
CONFIG_RPS=y
|
||||||
CONFIG_RFS_ACCEL=y
|
CONFIG_RFS_ACCEL=y
|
||||||
@@ -1295,6 +1307,11 @@ CONFIG_PCI_LABEL=y
|
|||||||
# CONFIG_PCI_MESON is not set
|
# CONFIG_PCI_MESON is not set
|
||||||
# end of DesignWare PCI Core Support
|
# end of DesignWare PCI Core Support
|
||||||
|
|
||||||
|
#
|
||||||
|
# Mobiveil PCIe Core Support
|
||||||
|
#
|
||||||
|
# end of Mobiveil PCIe Core Support
|
||||||
|
|
||||||
#
|
#
|
||||||
# Cadence PCIe controllers support
|
# Cadence PCIe controllers support
|
||||||
#
|
#
|
||||||
@@ -1350,6 +1367,7 @@ CONFIG_DMA_SHARED_BUFFER=y
|
|||||||
#
|
#
|
||||||
# Bus devices
|
# Bus devices
|
||||||
#
|
#
|
||||||
|
# CONFIG_MHI_BUS is not set
|
||||||
# end of Bus devices
|
# end of Bus devices
|
||||||
|
|
||||||
# CONFIG_CONNECTOR is not set
|
# CONFIG_CONNECTOR is not set
|
||||||
@@ -1370,7 +1388,7 @@ CONFIG_BLK_DEV=y
|
|||||||
# CONFIG_BLK_DEV_FD is not set
|
# CONFIG_BLK_DEV_FD is not set
|
||||||
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
|
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
|
||||||
# CONFIG_BLK_DEV_UMEM is not set
|
# CONFIG_BLK_DEV_UMEM is not set
|
||||||
# CONFIG_BLK_DEV_LOOP is not set
|
CONFIG_BLK_DEV_LOOP=y
|
||||||
# CONFIG_BLK_DEV_DRBD is not set
|
# CONFIG_BLK_DEV_DRBD is not set
|
||||||
# CONFIG_BLK_DEV_NBD is not set
|
# CONFIG_BLK_DEV_NBD is not set
|
||||||
# CONFIG_BLK_DEV_SKD is not set
|
# CONFIG_BLK_DEV_SKD is not set
|
||||||
@@ -1577,23 +1595,7 @@ CONFIG_HW_CONSOLE=y
|
|||||||
CONFIG_VT_HW_CONSOLE_BINDING=y
|
CONFIG_VT_HW_CONSOLE_BINDING=y
|
||||||
CONFIG_UNIX98_PTYS=y
|
CONFIG_UNIX98_PTYS=y
|
||||||
# CONFIG_LEGACY_PTYS is not set
|
# CONFIG_LEGACY_PTYS is not set
|
||||||
CONFIG_SERIAL_NONSTANDARD=y
|
|
||||||
# CONFIG_ROCKETPORT is not set
|
|
||||||
# CONFIG_CYCLADES is not set
|
|
||||||
# CONFIG_MOXA_INTELLIO is not set
|
|
||||||
# CONFIG_MOXA_SMARTIO is not set
|
|
||||||
# CONFIG_SYNCLINK is not set
|
|
||||||
# CONFIG_SYNCLINKMP is not set
|
|
||||||
# CONFIG_SYNCLINK_GT is not set
|
|
||||||
# CONFIG_NOZOMI is not set
|
|
||||||
# CONFIG_ISI is not set
|
|
||||||
# CONFIG_N_HDLC is not set
|
|
||||||
# CONFIG_N_GSM is not set
|
|
||||||
# CONFIG_TRACE_SINK is not set
|
|
||||||
# CONFIG_NULL_TTY is not set
|
|
||||||
CONFIG_LDISC_AUTOLOAD=y
|
CONFIG_LDISC_AUTOLOAD=y
|
||||||
CONFIG_DEVMEM=y
|
|
||||||
CONFIG_DEVKMEM=y
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Serial drivers
|
# Serial drivers
|
||||||
@@ -1626,6 +1628,7 @@ CONFIG_SERIAL_8250_RSA=y
|
|||||||
CONFIG_SERIAL_CORE=y
|
CONFIG_SERIAL_CORE=y
|
||||||
CONFIG_SERIAL_CORE_CONSOLE=y
|
CONFIG_SERIAL_CORE_CONSOLE=y
|
||||||
# CONFIG_SERIAL_JSM is not set
|
# CONFIG_SERIAL_JSM is not set
|
||||||
|
# CONFIG_SERIAL_LANTIQ is not set
|
||||||
# CONFIG_SERIAL_SCCNXP is not set
|
# CONFIG_SERIAL_SCCNXP is not set
|
||||||
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
|
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
|
||||||
# CONFIG_SERIAL_ALTERA_UART is not set
|
# CONFIG_SERIAL_ALTERA_UART is not set
|
||||||
@@ -1633,18 +1636,36 @@ CONFIG_SERIAL_CORE_CONSOLE=y
|
|||||||
# CONFIG_SERIAL_RP2 is not set
|
# CONFIG_SERIAL_RP2 is not set
|
||||||
# CONFIG_SERIAL_FSL_LPUART is not set
|
# CONFIG_SERIAL_FSL_LPUART is not set
|
||||||
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
|
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
|
||||||
|
# CONFIG_SERIAL_SPRD is not set
|
||||||
# end of Serial drivers
|
# end of Serial drivers
|
||||||
|
|
||||||
|
CONFIG_SERIAL_NONSTANDARD=y
|
||||||
|
# CONFIG_ROCKETPORT is not set
|
||||||
|
# CONFIG_CYCLADES is not set
|
||||||
|
# CONFIG_MOXA_INTELLIO is not set
|
||||||
|
# CONFIG_MOXA_SMARTIO is not set
|
||||||
|
# CONFIG_SYNCLINK is not set
|
||||||
|
# CONFIG_SYNCLINKMP is not set
|
||||||
|
# CONFIG_SYNCLINK_GT is not set
|
||||||
|
# CONFIG_ISI is not set
|
||||||
|
# CONFIG_N_HDLC is not set
|
||||||
|
# CONFIG_N_GSM is not set
|
||||||
|
# CONFIG_NOZOMI is not set
|
||||||
|
# CONFIG_NULL_TTY is not set
|
||||||
|
# CONFIG_TRACE_SINK is not set
|
||||||
|
CONFIG_HVC_DRIVER=y
|
||||||
# CONFIG_SERIAL_DEV_BUS is not set
|
# CONFIG_SERIAL_DEV_BUS is not set
|
||||||
# CONFIG_TTY_PRINTK is not set
|
# CONFIG_TTY_PRINTK is not set
|
||||||
CONFIG_HVC_DRIVER=y
|
|
||||||
CONFIG_VIRTIO_CONSOLE=y
|
CONFIG_VIRTIO_CONSOLE=y
|
||||||
# CONFIG_IPMI_HANDLER is not set
|
# CONFIG_IPMI_HANDLER is not set
|
||||||
# CONFIG_HW_RANDOM is not set
|
# CONFIG_HW_RANDOM is not set
|
||||||
# CONFIG_NVRAM is not set
|
|
||||||
# CONFIG_APPLICOM is not set
|
# CONFIG_APPLICOM is not set
|
||||||
# CONFIG_MWAVE is not set
|
# CONFIG_MWAVE is not set
|
||||||
|
CONFIG_DEVMEM=y
|
||||||
|
CONFIG_DEVKMEM=y
|
||||||
|
# CONFIG_NVRAM is not set
|
||||||
# CONFIG_RAW_DRIVER is not set
|
# CONFIG_RAW_DRIVER is not set
|
||||||
|
CONFIG_DEVPORT=y
|
||||||
CONFIG_HPET=y
|
CONFIG_HPET=y
|
||||||
# CONFIG_HPET_MMAP is not set
|
# CONFIG_HPET_MMAP is not set
|
||||||
# CONFIG_HANGCHECK_TIMER is not set
|
# CONFIG_HANGCHECK_TIMER is not set
|
||||||
@@ -1657,7 +1678,6 @@ CONFIG_TCG_TIS=y
|
|||||||
CONFIG_TCG_CRB=y
|
CONFIG_TCG_CRB=y
|
||||||
# CONFIG_TCG_VTPM_PROXY is not set
|
# CONFIG_TCG_VTPM_PROXY is not set
|
||||||
# CONFIG_TELCLOCK is not set
|
# CONFIG_TELCLOCK is not set
|
||||||
CONFIG_DEVPORT=y
|
|
||||||
# CONFIG_XILLYBUS is not set
|
# CONFIG_XILLYBUS is not set
|
||||||
# end of Character devices
|
# end of Character devices
|
||||||
|
|
||||||
@@ -1713,6 +1733,7 @@ CONFIG_POWER_SUPPLY=y
|
|||||||
# CONFIG_CHARGER_MAX8903 is not set
|
# CONFIG_CHARGER_MAX8903 is not set
|
||||||
# CONFIG_HWMON is not set
|
# CONFIG_HWMON is not set
|
||||||
CONFIG_THERMAL=y
|
CONFIG_THERMAL=y
|
||||||
|
# CONFIG_THERMAL_NETLINK is not set
|
||||||
# CONFIG_THERMAL_STATISTICS is not set
|
# CONFIG_THERMAL_STATISTICS is not set
|
||||||
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
|
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
|
||||||
CONFIG_THERMAL_WRITABLE_TRIPS=y
|
CONFIG_THERMAL_WRITABLE_TRIPS=y
|
||||||
@@ -1771,6 +1792,7 @@ CONFIG_BCMA_POSSIBLE=y
|
|||||||
|
|
||||||
# CONFIG_REGULATOR is not set
|
# CONFIG_REGULATOR is not set
|
||||||
# CONFIG_RC_CORE is not set
|
# CONFIG_RC_CORE is not set
|
||||||
|
# CONFIG_MEDIA_CEC_SUPPORT is not set
|
||||||
# CONFIG_MEDIA_SUPPORT is not set
|
# CONFIG_MEDIA_SUPPORT is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -1792,11 +1814,6 @@ CONFIG_VGA_ARB_MAX_GPUS=16
|
|||||||
#
|
#
|
||||||
# end of ARM devices
|
# end of ARM devices
|
||||||
|
|
||||||
#
|
|
||||||
# ACP (Audio CoProcessor) Configuration
|
|
||||||
#
|
|
||||||
# end of ACP (Audio CoProcessor) Configuration
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Frame buffer Devices
|
# Frame buffer Devices
|
||||||
#
|
#
|
||||||
@@ -1862,7 +1879,6 @@ CONFIG_FB_VESA=y
|
|||||||
#
|
#
|
||||||
# CONFIG_LCD_CLASS_DEVICE is not set
|
# CONFIG_LCD_CLASS_DEVICE is not set
|
||||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||||
CONFIG_BACKLIGHT_GENERIC=y
|
|
||||||
# CONFIG_BACKLIGHT_APPLE is not set
|
# CONFIG_BACKLIGHT_APPLE is not set
|
||||||
# CONFIG_BACKLIGHT_QCOM_WLED is not set
|
# CONFIG_BACKLIGHT_QCOM_WLED is not set
|
||||||
# CONFIG_BACKLIGHT_SAHARA is not set
|
# CONFIG_BACKLIGHT_SAHARA is not set
|
||||||
@@ -1922,6 +1938,7 @@ CONFIG_HID_DRAGONRISE=y
|
|||||||
CONFIG_HID_EZKEY=y
|
CONFIG_HID_EZKEY=y
|
||||||
# CONFIG_HID_GEMBIRD is not set
|
# CONFIG_HID_GEMBIRD is not set
|
||||||
# CONFIG_HID_GFRM is not set
|
# CONFIG_HID_GFRM is not set
|
||||||
|
# CONFIG_HID_GLORIOUS is not set
|
||||||
# CONFIG_HID_KEYTOUCH is not set
|
# CONFIG_HID_KEYTOUCH is not set
|
||||||
CONFIG_HID_KYE=y
|
CONFIG_HID_KYE=y
|
||||||
# CONFIG_HID_WALTOP is not set
|
# CONFIG_HID_WALTOP is not set
|
||||||
@@ -2001,6 +2018,7 @@ CONFIG_RTC_MC146818_LIB=y
|
|||||||
CONFIG_SYNC_FILE=y
|
CONFIG_SYNC_FILE=y
|
||||||
# CONFIG_SW_SYNC is not set
|
# CONFIG_SW_SYNC is not set
|
||||||
# CONFIG_UDMABUF is not set
|
# CONFIG_UDMABUF is not set
|
||||||
|
# CONFIG_DMABUF_MOVE_NOTIFY is not set
|
||||||
# CONFIG_DMABUF_SELFTESTS is not set
|
# CONFIG_DMABUF_SELFTESTS is not set
|
||||||
# CONFIG_DMABUF_HEAPS is not set
|
# CONFIG_DMABUF_HEAPS is not set
|
||||||
# end of DMABUF options
|
# end of DMABUF options
|
||||||
@@ -2016,6 +2034,10 @@ CONFIG_VIRTIO_PCI_LEGACY=y
|
|||||||
CONFIG_VIRTIO_BALLOON=y
|
CONFIG_VIRTIO_BALLOON=y
|
||||||
# CONFIG_VIRTIO_INPUT is not set
|
# CONFIG_VIRTIO_INPUT is not set
|
||||||
# CONFIG_VIRTIO_MMIO is not set
|
# CONFIG_VIRTIO_MMIO is not set
|
||||||
|
# CONFIG_VDPA is not set
|
||||||
|
CONFIG_VHOST_MENU=y
|
||||||
|
# CONFIG_VHOST_NET is not set
|
||||||
|
# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# Microsoft Hyper-V guest support
|
# Microsoft Hyper-V guest support
|
||||||
@@ -2029,15 +2051,10 @@ CONFIG_PMC_ATOM=y
|
|||||||
# CONFIG_MFD_CROS_EC is not set
|
# CONFIG_MFD_CROS_EC is not set
|
||||||
# CONFIG_CHROME_PLATFORMS is not set
|
# CONFIG_CHROME_PLATFORMS is not set
|
||||||
# CONFIG_MELLANOX_PLATFORM is not set
|
# CONFIG_MELLANOX_PLATFORM is not set
|
||||||
|
CONFIG_HAVE_CLK=y
|
||||||
CONFIG_CLKDEV_LOOKUP=y
|
CONFIG_CLKDEV_LOOKUP=y
|
||||||
CONFIG_HAVE_CLK_PREPARE=y
|
CONFIG_HAVE_CLK_PREPARE=y
|
||||||
CONFIG_COMMON_CLK=y
|
CONFIG_COMMON_CLK=y
|
||||||
|
|
||||||
#
|
|
||||||
# Common Clock Framework
|
|
||||||
#
|
|
||||||
# end of Common Clock Framework
|
|
||||||
|
|
||||||
# CONFIG_HWSPINLOCK is not set
|
# CONFIG_HWSPINLOCK is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2231,12 +2248,13 @@ CONFIG_INOTIFY_USER=y
|
|||||||
# end of CD-ROM/DVD Filesystems
|
# end of CD-ROM/DVD Filesystems
|
||||||
|
|
||||||
#
|
#
|
||||||
# DOS/FAT/NT Filesystems
|
# DOS/FAT/EXFAT/NT Filesystems
|
||||||
#
|
#
|
||||||
# CONFIG_MSDOS_FS is not set
|
# CONFIG_MSDOS_FS is not set
|
||||||
# CONFIG_VFAT_FS is not set
|
# CONFIG_VFAT_FS is not set
|
||||||
|
# CONFIG_EXFAT_FS is not set
|
||||||
# CONFIG_NTFS_FS is not set
|
# CONFIG_NTFS_FS is not set
|
||||||
# end of DOS/FAT/NT Filesystems
|
# end of DOS/FAT/EXFAT/NT Filesystems
|
||||||
|
|
||||||
#
|
#
|
||||||
# Pseudo filesystems
|
# Pseudo filesystems
|
||||||
@@ -2252,6 +2270,7 @@ CONFIG_SYSFS=y
|
|||||||
CONFIG_TMPFS=y
|
CONFIG_TMPFS=y
|
||||||
CONFIG_TMPFS_POSIX_ACL=y
|
CONFIG_TMPFS_POSIX_ACL=y
|
||||||
CONFIG_TMPFS_XATTR=y
|
CONFIG_TMPFS_XATTR=y
|
||||||
|
# CONFIG_TMPFS_INODE64 is not set
|
||||||
CONFIG_HUGETLBFS=y
|
CONFIG_HUGETLBFS=y
|
||||||
CONFIG_HUGETLB_PAGE=y
|
CONFIG_HUGETLB_PAGE=y
|
||||||
CONFIG_MEMFD_CREATE=y
|
CONFIG_MEMFD_CREATE=y
|
||||||
@@ -2332,7 +2351,6 @@ CONFIG_IO_WQ=y
|
|||||||
CONFIG_KEYS=y
|
CONFIG_KEYS=y
|
||||||
# CONFIG_KEYS_REQUEST_CACHE is not set
|
# CONFIG_KEYS_REQUEST_CACHE is not set
|
||||||
# CONFIG_PERSISTENT_KEYRINGS is not set
|
# CONFIG_PERSISTENT_KEYRINGS is not set
|
||||||
# CONFIG_BIG_KEYS is not set
|
|
||||||
# CONFIG_TRUSTED_KEYS is not set
|
# CONFIG_TRUSTED_KEYS is not set
|
||||||
# CONFIG_ENCRYPTED_KEYS is not set
|
# CONFIG_ENCRYPTED_KEYS is not set
|
||||||
# CONFIG_KEY_DH_OPERATIONS is not set
|
# CONFIG_KEY_DH_OPERATIONS is not set
|
||||||
@@ -2343,10 +2361,19 @@ CONFIG_SECURITY_NETWORK=y
|
|||||||
CONFIG_PAGE_TABLE_ISOLATION=y
|
CONFIG_PAGE_TABLE_ISOLATION=y
|
||||||
# CONFIG_SECURITY_NETWORK_XFRM is not set
|
# CONFIG_SECURITY_NETWORK_XFRM is not set
|
||||||
# CONFIG_SECURITY_PATH is not set
|
# CONFIG_SECURITY_PATH is not set
|
||||||
|
CONFIG_LSM_MMAP_MIN_ADDR=65536
|
||||||
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
|
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
|
||||||
# CONFIG_HARDENED_USERCOPY is not set
|
# CONFIG_HARDENED_USERCOPY is not set
|
||||||
# CONFIG_FORTIFY_SOURCE is not set
|
# CONFIG_FORTIFY_SOURCE is not set
|
||||||
# CONFIG_STATIC_USERMODEHELPER is not set
|
# CONFIG_STATIC_USERMODEHELPER is not set
|
||||||
|
CONFIG_SECURITY_SELINUX=y
|
||||||
|
# CONFIG_SECURITY_SELINUX_BOOTPARAM is not set
|
||||||
|
# CONFIG_SECURITY_SELINUX_DISABLE is not set
|
||||||
|
CONFIG_SECURITY_SELINUX_DEVELOP=y
|
||||||
|
CONFIG_SECURITY_SELINUX_AVC_STATS=y
|
||||||
|
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=0
|
||||||
|
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9
|
||||||
|
CONFIG_SECURITY_SELINUX_SID2STR_CACHE_SIZE=256
|
||||||
# CONFIG_SECURITY_SMACK is not set
|
# CONFIG_SECURITY_SMACK is not set
|
||||||
# CONFIG_SECURITY_TOMOYO is not set
|
# CONFIG_SECURITY_TOMOYO is not set
|
||||||
# CONFIG_SECURITY_APPARMOR is not set
|
# CONFIG_SECURITY_APPARMOR is not set
|
||||||
@@ -2356,8 +2383,10 @@ CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
|
|||||||
# CONFIG_SECURITY_LOCKDOWN_LSM is not set
|
# CONFIG_SECURITY_LOCKDOWN_LSM is not set
|
||||||
CONFIG_INTEGRITY=y
|
CONFIG_INTEGRITY=y
|
||||||
# CONFIG_INTEGRITY_SIGNATURE is not set
|
# CONFIG_INTEGRITY_SIGNATURE is not set
|
||||||
|
CONFIG_INTEGRITY_AUDIT=y
|
||||||
CONFIG_IMA=y
|
CONFIG_IMA=y
|
||||||
CONFIG_IMA_MEASURE_PCR_IDX=10
|
CONFIG_IMA_MEASURE_PCR_IDX=10
|
||||||
|
CONFIG_IMA_LSM_RULES=y
|
||||||
# CONFIG_IMA_TEMPLATE is not set
|
# CONFIG_IMA_TEMPLATE is not set
|
||||||
CONFIG_IMA_NG_TEMPLATE=y
|
CONFIG_IMA_NG_TEMPLATE=y
|
||||||
# CONFIG_IMA_SIG_TEMPLATE is not set
|
# CONFIG_IMA_SIG_TEMPLATE is not set
|
||||||
@@ -2365,17 +2394,16 @@ CONFIG_IMA_DEFAULT_TEMPLATE="ima-ng"
|
|||||||
CONFIG_IMA_DEFAULT_HASH_SHA1=y
|
CONFIG_IMA_DEFAULT_HASH_SHA1=y
|
||||||
# CONFIG_IMA_DEFAULT_HASH_SHA256 is not set
|
# CONFIG_IMA_DEFAULT_HASH_SHA256 is not set
|
||||||
CONFIG_IMA_DEFAULT_HASH="sha1"
|
CONFIG_IMA_DEFAULT_HASH="sha1"
|
||||||
# CONFIG_IMA_WRITE_POLICY is not set
|
CONFIG_IMA_WRITE_POLICY=y
|
||||||
# CONFIG_IMA_READ_POLICY is not set
|
CONFIG_IMA_READ_POLICY=y
|
||||||
# CONFIG_IMA_APPRAISE is not set
|
# CONFIG_IMA_APPRAISE is not set
|
||||||
CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y
|
CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS=y
|
||||||
CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y
|
CONFIG_IMA_QUEUE_EARLY_BOOT_KEYS=y
|
||||||
|
# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set
|
||||||
# CONFIG_EVM is not set
|
# CONFIG_EVM is not set
|
||||||
|
# CONFIG_DEFAULT_SECURITY_SELINUX is not set
|
||||||
CONFIG_DEFAULT_SECURITY_DAC=y
|
CONFIG_DEFAULT_SECURITY_DAC=y
|
||||||
CONFIG_LSM="selinux,bpf"
|
CONFIG_LSM="selinux,bpf,integrity"
|
||||||
CONFIG_BPF_LSM=y
|
|
||||||
CONFIG_AUDIT=y
|
|
||||||
CONFIG_SECURITY_SELINUX=y
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Kernel hardening options
|
# Kernel hardening options
|
||||||
@@ -2623,11 +2651,13 @@ CONFIG_GENERIC_STRNLEN_USER=y
|
|||||||
CONFIG_GENERIC_NET_UTILS=y
|
CONFIG_GENERIC_NET_UTILS=y
|
||||||
CONFIG_GENERIC_FIND_FIRST_BIT=y
|
CONFIG_GENERIC_FIND_FIRST_BIT=y
|
||||||
# CONFIG_CORDIC is not set
|
# CONFIG_CORDIC is not set
|
||||||
|
# CONFIG_PRIME_NUMBERS is not set
|
||||||
CONFIG_RATIONAL=y
|
CONFIG_RATIONAL=y
|
||||||
CONFIG_GENERIC_PCI_IOMAP=y
|
CONFIG_GENERIC_PCI_IOMAP=y
|
||||||
CONFIG_GENERIC_IOMAP=y
|
CONFIG_GENERIC_IOMAP=y
|
||||||
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
|
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
|
||||||
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
|
CONFIG_ARCH_HAS_FAST_MULTIPLIER=y
|
||||||
|
CONFIG_ARCH_USE_SYM_ANNOTATIONS=y
|
||||||
CONFIG_CRC_CCITT=y
|
CONFIG_CRC_CCITT=y
|
||||||
CONFIG_CRC16=y
|
CONFIG_CRC16=y
|
||||||
CONFIG_CRC_T10DIF=y
|
CONFIG_CRC_T10DIF=y
|
||||||
@@ -2648,6 +2678,7 @@ CONFIG_XXHASH=y
|
|||||||
CONFIG_ZLIB_INFLATE=y
|
CONFIG_ZLIB_INFLATE=y
|
||||||
CONFIG_LZO_DECOMPRESS=y
|
CONFIG_LZO_DECOMPRESS=y
|
||||||
CONFIG_LZ4_DECOMPRESS=y
|
CONFIG_LZ4_DECOMPRESS=y
|
||||||
|
CONFIG_ZSTD_DECOMPRESS=y
|
||||||
CONFIG_XZ_DEC=y
|
CONFIG_XZ_DEC=y
|
||||||
CONFIG_XZ_DEC_X86=y
|
CONFIG_XZ_DEC_X86=y
|
||||||
# CONFIG_XZ_DEC_POWERPC is not set
|
# CONFIG_XZ_DEC_POWERPC is not set
|
||||||
@@ -2663,12 +2694,14 @@ CONFIG_DECOMPRESS_LZMA=y
|
|||||||
CONFIG_DECOMPRESS_XZ=y
|
CONFIG_DECOMPRESS_XZ=y
|
||||||
CONFIG_DECOMPRESS_LZO=y
|
CONFIG_DECOMPRESS_LZO=y
|
||||||
CONFIG_DECOMPRESS_LZ4=y
|
CONFIG_DECOMPRESS_LZ4=y
|
||||||
|
CONFIG_DECOMPRESS_ZSTD=y
|
||||||
CONFIG_GENERIC_ALLOCATOR=y
|
CONFIG_GENERIC_ALLOCATOR=y
|
||||||
CONFIG_XARRAY_MULTI=y
|
CONFIG_XARRAY_MULTI=y
|
||||||
CONFIG_ASSOCIATIVE_ARRAY=y
|
CONFIG_ASSOCIATIVE_ARRAY=y
|
||||||
CONFIG_HAS_IOMEM=y
|
CONFIG_HAS_IOMEM=y
|
||||||
CONFIG_HAS_IOPORT_MAP=y
|
CONFIG_HAS_IOPORT_MAP=y
|
||||||
CONFIG_HAS_DMA=y
|
CONFIG_HAS_DMA=y
|
||||||
|
CONFIG_DMA_OPS=y
|
||||||
CONFIG_NEED_SG_DMA_LENGTH=y
|
CONFIG_NEED_SG_DMA_LENGTH=y
|
||||||
CONFIG_NEED_DMA_MAP_STATE=y
|
CONFIG_NEED_DMA_MAP_STATE=y
|
||||||
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
||||||
@@ -2736,6 +2769,7 @@ CONFIG_CONSOLE_LOGLEVEL_QUIET=4
|
|||||||
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
|
||||||
# CONFIG_BOOT_PRINTK_DELAY is not set
|
# CONFIG_BOOT_PRINTK_DELAY is not set
|
||||||
# CONFIG_DYNAMIC_DEBUG is not set
|
# CONFIG_DYNAMIC_DEBUG is not set
|
||||||
|
# CONFIG_DYNAMIC_DEBUG_CORE is not set
|
||||||
CONFIG_SYMBOLIC_ERRNAME=y
|
CONFIG_SYMBOLIC_ERRNAME=y
|
||||||
CONFIG_DEBUG_BUGVERBOSE=y
|
CONFIG_DEBUG_BUGVERBOSE=y
|
||||||
# end of printk and dmesg options
|
# end of printk and dmesg options
|
||||||
@@ -2745,6 +2779,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
|
|||||||
#
|
#
|
||||||
CONFIG_DEBUG_INFO=y
|
CONFIG_DEBUG_INFO=y
|
||||||
# CONFIG_DEBUG_INFO_REDUCED is not set
|
# CONFIG_DEBUG_INFO_REDUCED is not set
|
||||||
|
# CONFIG_DEBUG_INFO_COMPRESSED is not set
|
||||||
# CONFIG_DEBUG_INFO_SPLIT is not set
|
# CONFIG_DEBUG_INFO_SPLIT is not set
|
||||||
# CONFIG_DEBUG_INFO_DWARF4 is not set
|
# CONFIG_DEBUG_INFO_DWARF4 is not set
|
||||||
CONFIG_DEBUG_INFO_BTF=y
|
CONFIG_DEBUG_INFO_BTF=y
|
||||||
@@ -2754,9 +2789,9 @@ CONFIG_FRAME_WARN=2048
|
|||||||
# CONFIG_STRIP_ASM_SYMS is not set
|
# CONFIG_STRIP_ASM_SYMS is not set
|
||||||
# CONFIG_READABLE_ASM is not set
|
# CONFIG_READABLE_ASM is not set
|
||||||
# CONFIG_HEADERS_INSTALL is not set
|
# CONFIG_HEADERS_INSTALL is not set
|
||||||
CONFIG_OPTIMIZE_INLINING=y
|
|
||||||
# CONFIG_DEBUG_SECTION_MISMATCH is not set
|
# CONFIG_DEBUG_SECTION_MISMATCH is not set
|
||||||
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
|
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
|
||||||
|
# CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_32B is not set
|
||||||
CONFIG_STACK_VALIDATION=y
|
CONFIG_STACK_VALIDATION=y
|
||||||
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
|
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
|
||||||
# end of Compile-time checks and compiler options
|
# end of Compile-time checks and compiler options
|
||||||
@@ -2767,12 +2802,15 @@ CONFIG_STACK_VALIDATION=y
|
|||||||
CONFIG_MAGIC_SYSRQ=y
|
CONFIG_MAGIC_SYSRQ=y
|
||||||
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
|
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1
|
||||||
CONFIG_MAGIC_SYSRQ_SERIAL=y
|
CONFIG_MAGIC_SYSRQ_SERIAL=y
|
||||||
|
CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE=""
|
||||||
CONFIG_DEBUG_FS=y
|
CONFIG_DEBUG_FS=y
|
||||||
|
CONFIG_DEBUG_FS_ALLOW_ALL=y
|
||||||
|
# CONFIG_DEBUG_FS_DISALLOW_MOUNT is not set
|
||||||
|
# CONFIG_DEBUG_FS_ALLOW_NONE is not set
|
||||||
CONFIG_HAVE_ARCH_KGDB=y
|
CONFIG_HAVE_ARCH_KGDB=y
|
||||||
# CONFIG_KGDB is not set
|
# CONFIG_KGDB is not set
|
||||||
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
|
CONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
|
||||||
# CONFIG_UBSAN is not set
|
# CONFIG_UBSAN is not set
|
||||||
CONFIG_UBSAN_ALIGNMENT=y
|
|
||||||
# end of Generic Kernel Debugging Instruments
|
# end of Generic Kernel Debugging Instruments
|
||||||
|
|
||||||
CONFIG_DEBUG_KERNEL=y
|
CONFIG_DEBUG_KERNEL=y
|
||||||
@@ -2787,6 +2825,8 @@ CONFIG_DEBUG_MISC=y
|
|||||||
# CONFIG_PAGE_POISONING is not set
|
# CONFIG_PAGE_POISONING is not set
|
||||||
# CONFIG_DEBUG_PAGE_REF is not set
|
# CONFIG_DEBUG_PAGE_REF is not set
|
||||||
# CONFIG_DEBUG_RODATA_TEST is not set
|
# CONFIG_DEBUG_RODATA_TEST is not set
|
||||||
|
CONFIG_ARCH_HAS_DEBUG_WX=y
|
||||||
|
# CONFIG_DEBUG_WX is not set
|
||||||
CONFIG_GENERIC_PTDUMP=y
|
CONFIG_GENERIC_PTDUMP=y
|
||||||
# CONFIG_PTDUMP_DEBUGFS is not set
|
# CONFIG_PTDUMP_DEBUGFS is not set
|
||||||
# CONFIG_DEBUG_OBJECTS is not set
|
# CONFIG_DEBUG_OBJECTS is not set
|
||||||
@@ -2796,14 +2836,16 @@ CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
|||||||
# CONFIG_DEBUG_KMEMLEAK is not set
|
# CONFIG_DEBUG_KMEMLEAK is not set
|
||||||
# CONFIG_DEBUG_STACK_USAGE is not set
|
# CONFIG_DEBUG_STACK_USAGE is not set
|
||||||
CONFIG_SCHED_STACK_END_CHECK=y
|
CONFIG_SCHED_STACK_END_CHECK=y
|
||||||
|
CONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
|
||||||
# CONFIG_DEBUG_VM is not set
|
# CONFIG_DEBUG_VM is not set
|
||||||
|
# CONFIG_DEBUG_VM_PGTABLE is not set
|
||||||
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
|
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
|
||||||
# CONFIG_DEBUG_VIRTUAL is not set
|
# CONFIG_DEBUG_VIRTUAL is not set
|
||||||
CONFIG_DEBUG_MEMORY_INIT=y
|
CONFIG_DEBUG_MEMORY_INIT=y
|
||||||
# CONFIG_DEBUG_PER_CPU_MAPS is not set
|
# CONFIG_DEBUG_PER_CPU_MAPS is not set
|
||||||
CONFIG_HAVE_ARCH_KASAN=y
|
CONFIG_HAVE_ARCH_KASAN=y
|
||||||
CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
|
CONFIG_HAVE_ARCH_KASAN_VMALLOC=y
|
||||||
CONFIG_KASAN_STACK=1
|
CONFIG_CC_HAS_KASAN_GENERIC=y
|
||||||
# end of Memory Debugging
|
# end of Memory Debugging
|
||||||
|
|
||||||
# CONFIG_DEBUG_SHIRQ is not set
|
# CONFIG_DEBUG_SHIRQ is not set
|
||||||
@@ -2828,6 +2870,7 @@ CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
|
|||||||
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
|
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
|
||||||
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
|
CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
|
||||||
# CONFIG_WQ_WATCHDOG is not set
|
# CONFIG_WQ_WATCHDOG is not set
|
||||||
|
# CONFIG_TEST_LOCKUP is not set
|
||||||
# end of Debug Oops, Lockups and Hangs
|
# end of Debug Oops, Lockups and Hangs
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -2846,6 +2889,7 @@ CONFIG_DEBUG_PREEMPT=y
|
|||||||
#
|
#
|
||||||
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||||
CONFIG_PROVE_LOCKING=y
|
CONFIG_PROVE_LOCKING=y
|
||||||
|
# CONFIG_PROVE_RAW_LOCK_NESTING is not set
|
||||||
# CONFIG_LOCK_STAT is not set
|
# CONFIG_LOCK_STAT is not set
|
||||||
CONFIG_DEBUG_RT_MUTEXES=y
|
CONFIG_DEBUG_RT_MUTEXES=y
|
||||||
CONFIG_DEBUG_SPINLOCK=y
|
CONFIG_DEBUG_SPINLOCK=y
|
||||||
@@ -2862,6 +2906,7 @@ CONFIG_DEBUG_ATOMIC_SLEEP=y
|
|||||||
# end of Lock Debugging (spinlocks, mutexes, etc...)
|
# end of Lock Debugging (spinlocks, mutexes, etc...)
|
||||||
|
|
||||||
CONFIG_TRACE_IRQFLAGS=y
|
CONFIG_TRACE_IRQFLAGS=y
|
||||||
|
CONFIG_TRACE_IRQFLAGS_NMI=y
|
||||||
CONFIG_STACKTRACE=y
|
CONFIG_STACKTRACE=y
|
||||||
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
|
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
|
||||||
# CONFIG_DEBUG_KOBJECT is not set
|
# CONFIG_DEBUG_KOBJECT is not set
|
||||||
@@ -2884,6 +2929,7 @@ CONFIG_DEBUG_CREDENTIALS=y
|
|||||||
CONFIG_PROVE_RCU=y
|
CONFIG_PROVE_RCU=y
|
||||||
# CONFIG_RCU_PERF_TEST is not set
|
# CONFIG_RCU_PERF_TEST is not set
|
||||||
# CONFIG_RCU_TORTURE_TEST is not set
|
# CONFIG_RCU_TORTURE_TEST is not set
|
||||||
|
# CONFIG_RCU_REF_SCALE_TEST is not set
|
||||||
CONFIG_RCU_CPU_STALL_TIMEOUT=60
|
CONFIG_RCU_CPU_STALL_TIMEOUT=60
|
||||||
# CONFIG_RCU_TRACE is not set
|
# CONFIG_RCU_TRACE is not set
|
||||||
# CONFIG_RCU_EQS_DEBUG is not set
|
# CONFIG_RCU_EQS_DEBUG is not set
|
||||||
@@ -2921,7 +2967,6 @@ CONFIG_DYNAMIC_FTRACE_WITH_REGS=y
|
|||||||
CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y
|
CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=y
|
||||||
# CONFIG_FUNCTION_PROFILER is not set
|
# CONFIG_FUNCTION_PROFILER is not set
|
||||||
# CONFIG_STACK_TRACER is not set
|
# CONFIG_STACK_TRACER is not set
|
||||||
# CONFIG_PREEMPTIRQ_EVENTS is not set
|
|
||||||
# CONFIG_IRQSOFF_TRACER is not set
|
# CONFIG_IRQSOFF_TRACER is not set
|
||||||
# CONFIG_PREEMPT_TRACER is not set
|
# CONFIG_PREEMPT_TRACER is not set
|
||||||
# CONFIG_SCHED_TRACER is not set
|
# CONFIG_SCHED_TRACER is not set
|
||||||
@@ -2941,6 +2986,7 @@ CONFIG_DYNAMIC_EVENTS=y
|
|||||||
CONFIG_PROBE_EVENTS=y
|
CONFIG_PROBE_EVENTS=y
|
||||||
CONFIG_BPF_KPROBE_OVERRIDE=y
|
CONFIG_BPF_KPROBE_OVERRIDE=y
|
||||||
CONFIG_FTRACE_MCOUNT_RECORD=y
|
CONFIG_FTRACE_MCOUNT_RECORD=y
|
||||||
|
# CONFIG_SYNTH_EVENTS is not set
|
||||||
# CONFIG_HIST_TRIGGERS is not set
|
# CONFIG_HIST_TRIGGERS is not set
|
||||||
# CONFIG_TRACE_EVENT_INJECT is not set
|
# CONFIG_TRACE_EVENT_INJECT is not set
|
||||||
# CONFIG_TRACEPOINT_BENCHMARK is not set
|
# CONFIG_TRACEPOINT_BENCHMARK is not set
|
||||||
@@ -2952,6 +2998,7 @@ CONFIG_FTRACE_MCOUNT_RECORD=y
|
|||||||
# CONFIG_KPROBE_EVENT_GEN_TEST is not set
|
# CONFIG_KPROBE_EVENT_GEN_TEST is not set
|
||||||
# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
|
# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
|
||||||
# CONFIG_SAMPLES is not set
|
# CONFIG_SAMPLES is not set
|
||||||
|
CONFIG_HAVE_ARCH_KCSAN=y
|
||||||
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
|
CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
|
||||||
# CONFIG_STRICT_DEVMEM is not set
|
# CONFIG_STRICT_DEVMEM is not set
|
||||||
|
|
||||||
@@ -2959,13 +3006,12 @@ CONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
|
|||||||
# x86 Debugging
|
# x86 Debugging
|
||||||
#
|
#
|
||||||
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
|
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
|
||||||
|
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
|
||||||
CONFIG_X86_VERBOSE_BOOTUP=y
|
CONFIG_X86_VERBOSE_BOOTUP=y
|
||||||
CONFIG_EARLY_PRINTK=y
|
CONFIG_EARLY_PRINTK=y
|
||||||
# CONFIG_EARLY_PRINTK_DBGP is not set
|
# CONFIG_EARLY_PRINTK_DBGP is not set
|
||||||
# CONFIG_EARLY_PRINTK_USB_XDBC is not set
|
# CONFIG_EARLY_PRINTK_USB_XDBC is not set
|
||||||
# CONFIG_EFI_PGT_DUMP is not set
|
# CONFIG_EFI_PGT_DUMP is not set
|
||||||
# CONFIG_DEBUG_WX is not set
|
|
||||||
CONFIG_DOUBLEFAULT=y
|
|
||||||
# CONFIG_DEBUG_TLBFLUSH is not set
|
# CONFIG_DEBUG_TLBFLUSH is not set
|
||||||
# CONFIG_IOMMU_DEBUG is not set
|
# CONFIG_IOMMU_DEBUG is not set
|
||||||
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
|
CONFIG_HAVE_MMIOTRACE_SUPPORT=y
|
||||||
@@ -2992,9 +3038,16 @@ CONFIG_UNWINDER_ORC=y
|
|||||||
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
|
# CONFIG_NOTIFIER_ERROR_INJECTION is not set
|
||||||
CONFIG_FUNCTION_ERROR_INJECTION=y
|
CONFIG_FUNCTION_ERROR_INJECTION=y
|
||||||
CONFIG_FAULT_INJECTION=y
|
CONFIG_FAULT_INJECTION=y
|
||||||
|
# CONFIG_FAILSLAB is not set
|
||||||
|
# CONFIG_FAIL_PAGE_ALLOC is not set
|
||||||
|
# CONFIG_FAIL_MAKE_REQUEST is not set
|
||||||
|
# CONFIG_FAIL_IO_TIMEOUT is not set
|
||||||
|
# CONFIG_FAIL_FUTEX is not set
|
||||||
CONFIG_FAULT_INJECTION_DEBUG_FS=y
|
CONFIG_FAULT_INJECTION_DEBUG_FS=y
|
||||||
CONFIG_FAIL_FUNCTION=y
|
CONFIG_FAIL_FUNCTION=y
|
||||||
CONFIG_ARCH_HAS_KCOV=y
|
CONFIG_ARCH_HAS_KCOV=y
|
||||||
|
CONFIG_CC_HAS_SANCOV_TRACE_PC=y
|
||||||
|
# CONFIG_KCOV is not set
|
||||||
# CONFIG_RUNTIME_TESTING_MENU is not set
|
# CONFIG_RUNTIME_TESTING_MENU is not set
|
||||||
# CONFIG_MEMTEST is not set
|
# CONFIG_MEMTEST is not set
|
||||||
# end of Kernel Testing and Coverage
|
# end of Kernel Testing and Coverage
|
||||||
|
|||||||
12
travis-ci/vmtest/helpers.sh
Normal file
12
travis-ci/vmtest/helpers.sh
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# $1 - start or end
|
||||||
|
# $2 - fold identifier, no spaces
|
||||||
|
# $3 - fold section description
|
||||||
|
travis_fold() {
|
||||||
|
local YELLOW='\033[1;33m'
|
||||||
|
local NOCOLOR='\033[0m'
|
||||||
|
echo travis_fold:$1:$2
|
||||||
|
if [ ! -z "${3:-}" ]; then
|
||||||
|
echo -e "${YELLOW}$3${NOCOLOR}"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
}
|
||||||
@@ -81,6 +81,7 @@ packages=(
|
|||||||
binutils
|
binutils
|
||||||
elfutils
|
elfutils
|
||||||
glibc
|
glibc
|
||||||
|
iproute2
|
||||||
# selftests test_verifier dependencies.
|
# selftests test_verifier dependencies.
|
||||||
libcap
|
libcap
|
||||||
)
|
)
|
||||||
@@ -101,15 +102,6 @@ rm -rf "$root/usr/share/{doc,help,man,texinfo}"
|
|||||||
|
|
||||||
chroot "${root}" /bin/busybox --install
|
chroot "${root}" /bin/busybox --install
|
||||||
|
|
||||||
cat > "$root/etc/fstab" << "EOF"
|
|
||||||
dev /dev devtmpfs rw,nosuid 0 0
|
|
||||||
proc /proc proc rw,nosuid,nodev,noexec 0 0
|
|
||||||
sys /sys sysfs rw,nosuid,nodev,noexec 0 0
|
|
||||||
debugfs /sys/kernel/debug debugfs mode=755,realtime 0 0
|
|
||||||
bpffs /sys/fs/bpf bpf realtime 0 0
|
|
||||||
EOF
|
|
||||||
chmod 644 "$root/etc/fstab"
|
|
||||||
|
|
||||||
cat > "$root/etc/inittab" << "EOF"
|
cat > "$root/etc/inittab" << "EOF"
|
||||||
::sysinit:/etc/init.d/rcS
|
::sysinit:/etc/init.d/rcS
|
||||||
::ctrlaltdel:/sbin/reboot
|
::ctrlaltdel:/sbin/reboot
|
||||||
@@ -123,13 +115,29 @@ mkdir -m 755 "$root/etc/init.d" "$root/etc/rcS.d"
|
|||||||
cat > "$root/etc/rcS.d/S10-mount" << "EOF"
|
cat > "$root/etc/rcS.d/S10-mount" << "EOF"
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
/bin/mount -a
|
set -eux
|
||||||
|
|
||||||
|
/bin/mount proc /proc -t proc
|
||||||
|
|
||||||
|
# Mount devtmpfs if not mounted
|
||||||
|
if [[ -z $(/bin/mount -l -t devtmpfs) ]]; then
|
||||||
|
/bin/mount devtmpfs /dev -t devtmpfs
|
||||||
|
fi
|
||||||
|
|
||||||
|
/bin/mount sysfs /sys -t sysfs
|
||||||
|
/bin/mount bpffs /sys/fs/bpf -t bpf
|
||||||
|
/bin/mount debugfs /sys/kernel/debug -t debugfs
|
||||||
|
|
||||||
|
echo 'Listing currently mounted file systems'
|
||||||
|
/bin/mount
|
||||||
EOF
|
EOF
|
||||||
chmod 755 "$root/etc/rcS.d/S10-mount"
|
chmod 755 "$root/etc/rcS.d/S10-mount"
|
||||||
|
|
||||||
cat > "$root/etc/rcS.d/S40-network" << "EOF"
|
cat > "$root/etc/rcS.d/S40-network" << "EOF"
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
ip link set lo up
|
ip link set lo up
|
||||||
EOF
|
EOF
|
||||||
chmod 755 "$root/etc/rcS.d/S40-network"
|
chmod 755 "$root/etc/rcS.d/S40-network"
|
||||||
@@ -137,6 +145,8 @@ chmod 755 "$root/etc/rcS.d/S40-network"
|
|||||||
cat > "$root/etc/init.d/rcS" << "EOF"
|
cat > "$root/etc/init.d/rcS" << "EOF"
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eux
|
||||||
|
|
||||||
for path in /etc/rcS.d/S*; do
|
for path in /etc/rcS.d/S*; do
|
||||||
[ -x "$path" ] && "$path"
|
[ -x "$path" ] && "$path"
|
||||||
done
|
done
|
||||||
|
|||||||
3
travis-ci/vmtest/prepare_selftests-4.9.0.sh
Executable file
3
travis-ci/vmtest/prepare_selftests-4.9.0.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
printf "all:\n\ttouch bpf_testmod.ko\n\nclean:\n" > bpf_testmod/Makefile
|
||||||
3
travis-ci/vmtest/prepare_selftests-5.5.0.sh
Executable file
3
travis-ci/vmtest/prepare_selftests-5.5.0.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
printf "all:\n\ttouch bpf_testmod.ko\n\nclean:\n" > bpf_testmod/Makefile
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eux
|
set -eu
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
REPO_PATH=$1
|
REPO_PATH=$1
|
||||||
|
|
||||||
@@ -8,7 +10,11 @@ ${VMTEST_ROOT}/checkout_latest_kernel.sh ${REPO_PATH}
|
|||||||
cd ${REPO_PATH}
|
cd ${REPO_PATH}
|
||||||
|
|
||||||
if [[ "${KERNEL}" = 'LATEST' ]]; then
|
if [[ "${KERNEL}" = 'LATEST' ]]; then
|
||||||
|
travis_fold start build_kernel "Kernel build"
|
||||||
|
|
||||||
cp ${VMTEST_ROOT}/configs/latest.config .config
|
cp ${VMTEST_ROOT}/configs/latest.config .config
|
||||||
make -j $((4*$(nproc))) olddefconfig all
|
make -j $((4*$(nproc))) olddefconfig all
|
||||||
|
|
||||||
|
travis_fold end build_kernel
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
trap 'exit 2' ERR
|
trap 'exit 2' ERR
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
USAGE_STRING="usage: $0 [-k KERNELRELEASE|-b DIR] [[-r ROOTFSVERSION] [-fo]|-I] [-Si] [-d DIR] IMG
|
USAGE_STRING="usage: $0 [-k KERNELRELEASE|-b DIR] [[-r ROOTFSVERSION] [-fo]|-I] [-Si] [-d DIR] IMG
|
||||||
$0 [-k KERNELRELEASE] -l
|
$0 [-k KERNELRELEASE] -l
|
||||||
@@ -275,6 +277,10 @@ if [[ $SKIPIMG -eq 0 && ! -v ROOTFSVERSION ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Kernel release: $KERNELRELEASE" >&2
|
echo "Kernel release: $KERNELRELEASE" >&2
|
||||||
|
echo
|
||||||
|
|
||||||
|
travis_fold start vmlinux_setup "Preparing Linux image"
|
||||||
|
|
||||||
if (( SKIPIMG )); then
|
if (( SKIPIMG )); then
|
||||||
echo "Not extracting root filesystem" >&2
|
echo "Not extracting root filesystem" >&2
|
||||||
else
|
else
|
||||||
@@ -366,11 +372,15 @@ else
|
|||||||
sudo chmod 644 "$vmlinux"
|
sudo chmod 644 "$vmlinux"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
travis_fold end vmlinux_setup
|
||||||
|
|
||||||
LIBBPF_PATH="${REPO_ROOT}" \
|
LIBBPF_PATH="${REPO_ROOT}" \
|
||||||
REPO_PATH="travis-ci/vmtest/bpf-next" \
|
REPO_PATH="travis-ci/vmtest/bpf-next" \
|
||||||
VMTEST_ROOT="${VMTEST_ROOT}" \
|
VMTEST_ROOT="${VMTEST_ROOT}" \
|
||||||
VMLINUX_BTF=${vmlinux} ${VMTEST_ROOT}/build_selftests.sh
|
VMLINUX_BTF=${vmlinux} ${VMTEST_ROOT}/build_selftests.sh
|
||||||
|
|
||||||
|
travis_fold start vm_init "Starting virtual machine..."
|
||||||
|
|
||||||
if (( SKIPSOURCE )); then
|
if (( SKIPSOURCE )); then
|
||||||
echo "Not copying source files..." >&2
|
echo "Not copying source files..." >&2
|
||||||
else
|
else
|
||||||
@@ -401,7 +411,7 @@ if [[ ! -z SETUPCMD ]]; then
|
|||||||
if [[ -v BUILDDIR ]]; then kernel='latest'; fi
|
if [[ -v BUILDDIR ]]; then kernel='latest'; fi
|
||||||
setup_envvars="export KERNEL=${kernel}"
|
setup_envvars="export KERNEL=${kernel}"
|
||||||
setup_script=$(printf "#!/bin/sh
|
setup_script=$(printf "#!/bin/sh
|
||||||
set -e
|
set -eux
|
||||||
|
|
||||||
echo 'Running setup commands'
|
echo 'Running setup commands'
|
||||||
%s
|
%s
|
||||||
@@ -415,15 +425,19 @@ sudo chmod 755 "$mnt/etc/rcS.d/S50-run-tests"
|
|||||||
|
|
||||||
poweroff_script="#!/bin/sh
|
poweroff_script="#!/bin/sh
|
||||||
|
|
||||||
|
echo travis_fold:start:shutdown
|
||||||
|
echo -e '\033[1;33mShutdown\033[0m\n'
|
||||||
|
|
||||||
poweroff"
|
poweroff"
|
||||||
echo "${poweroff_script}" | sudo tee "$mnt/etc/rcS.d/S99-poweroff" > /dev/null
|
echo "${poweroff_script}" | sudo tee "$mnt/etc/rcS.d/S99-poweroff" > /dev/null
|
||||||
sudo chmod 755 "$mnt/etc/rcS.d/S99-poweroff"
|
sudo chmod 755 "$mnt/etc/rcS.d/S99-poweroff"
|
||||||
|
|
||||||
sudo umount "$mnt"
|
sudo umount "$mnt"
|
||||||
|
|
||||||
echo "Starting virtual machine..." >&2
|
echo "Starting VM with $(nproc) CPUs..."
|
||||||
|
|
||||||
qemu-system-x86_64 -nodefaults -display none -serial mon:stdio \
|
qemu-system-x86_64 -nodefaults -display none -serial mon:stdio \
|
||||||
-cpu kvm64 -enable-kvm -smp "$(nproc)" -m 2G \
|
-cpu kvm64 -enable-kvm -smp "$(nproc)" -m 4G \
|
||||||
-drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \
|
-drive file="$IMG",format=raw,index=1,media=disk,if=virtio,cache=none \
|
||||||
-kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200$APPEND"
|
-kernel "$vmlinuz" -append "root=/dev/vda rw console=ttyS0,115200$APPEND"
|
||||||
|
|
||||||
@@ -435,4 +449,7 @@ else
|
|||||||
exitstatus=1
|
exitstatus=1
|
||||||
fi
|
fi
|
||||||
sudo umount "$mnt"
|
sudo umount "$mnt"
|
||||||
|
|
||||||
|
travis_fold end shutdown
|
||||||
|
|
||||||
exit "$exitstatus"
|
exit "$exitstatus"
|
||||||
|
|||||||
@@ -1,27 +1,35 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euxo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
test_progs() {
|
test_progs() {
|
||||||
if [[ "${KERNEL}" != '4.9.0' ]]; then
|
if [[ "${KERNEL}" != '4.9.0' ]]; then
|
||||||
echo TEST_PROGS
|
travis_fold start test_progs "Testing test_progs"
|
||||||
./test_progs ${BLACKLIST:+-b$BLACKLIST} ${WHITELIST:+-t$WHITELIST}
|
./test_progs ${BLACKLIST:+-b$BLACKLIST} ${WHITELIST:+-t$WHITELIST}
|
||||||
|
travis_fold end test_progs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo TEST_PROGS-NO_ALU32
|
travis_fold start test_progs-no_alu32 "Testing test_progs-no_alu32"
|
||||||
./test_progs-no_alu32 ${BLACKLIST:+-b$BLACKLIST} ${WHITELIST:+-t$WHITELIST}
|
./test_progs-no_alu32 ${BLACKLIST:+-b$BLACKLIST} ${WHITELIST:+-t$WHITELIST}
|
||||||
|
travis_fold end test_progs-no_alu32
|
||||||
}
|
}
|
||||||
|
|
||||||
test_maps() {
|
test_maps() {
|
||||||
echo TEST_MAPS
|
travis_fold start test_maps "Testing test_maps"
|
||||||
./test_maps
|
./test_maps
|
||||||
|
travis_fold end test_maps
|
||||||
}
|
}
|
||||||
|
|
||||||
test_verifier() {
|
test_verifier() {
|
||||||
echo TEST_VERIFIER
|
travis_fold start test_verifier "Testing test_verifier"
|
||||||
./test_verifier
|
./test_verifier
|
||||||
|
travis_fold end test_verifier
|
||||||
}
|
}
|
||||||
|
|
||||||
|
travis_fold end vm_init
|
||||||
|
|
||||||
configs_path='libbpf/travis-ci/vmtest/configs'
|
configs_path='libbpf/travis-ci/vmtest/configs'
|
||||||
blacklist_path="$configs_path/blacklist/BLACKLIST-${KERNEL}"
|
blacklist_path="$configs_path/blacklist/BLACKLIST-${KERNEL}"
|
||||||
if [[ -s "${blacklist_path}" ]]; then
|
if [[ -s "${blacklist_path}" ]]; then
|
||||||
@@ -38,6 +46,6 @@ cd libbpf/selftests/bpf
|
|||||||
test_progs
|
test_progs
|
||||||
|
|
||||||
if [[ "${KERNEL}" == 'latest' ]]; then
|
if [[ "${KERNEL}" == 'latest' ]]; then
|
||||||
test_maps
|
#test_maps
|
||||||
test_verifier
|
test_verifier
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eux
|
set -eu
|
||||||
|
|
||||||
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
||||||
|
|
||||||
VMTEST_SETUPCMD="PROJECT_NAME=${PROJECT_NAME} ./${PROJECT_NAME}/travis-ci/vmtest/run_selftests.sh"
|
VMTEST_SETUPCMD="PROJECT_NAME=${PROJECT_NAME} ./${PROJECT_NAME}/travis-ci/vmtest/run_selftests.sh"
|
||||||
|
|
||||||
echo "KERNEL: $KERNEL"
|
echo "KERNEL: $KERNEL"
|
||||||
|
echo
|
||||||
|
|
||||||
# Build latest pahole
|
# Build latest pahole
|
||||||
${VMTEST_ROOT}/build_pahole.sh travis-ci/vmtest/pahole
|
${VMTEST_ROOT}/build_pahole.sh travis-ci/vmtest/pahole
|
||||||
|
|
||||||
|
travis_fold start install_clang "Installing Clang/LLVM"
|
||||||
|
|
||||||
# Install required packages
|
# Install required packages
|
||||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a /etc/apt/sources.list
|
echo "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" | sudo tee -a /etc/apt/sources.list
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install clang-12 lld-12 llvm-12
|
sudo apt-get -y install clang-12 lld-12 llvm-12
|
||||||
|
sudo apt-get -y install python-docutils # for rst2man
|
||||||
|
|
||||||
|
travis_fold end install_clang
|
||||||
|
|
||||||
# Build selftests (and latest kernel, if necessary)
|
# Build selftests (and latest kernel, if necessary)
|
||||||
KERNEL="${KERNEL}" ${VMTEST_ROOT}/prepare_selftests.sh travis-ci/vmtest/bpf-next
|
KERNEL="${KERNEL}" ${VMTEST_ROOT}/prepare_selftests.sh travis-ci/vmtest/bpf-next
|
||||||
|
|||||||
102125
travis-ci/vmtest/vmlinux.h
102125
travis-ci/vmtest/vmlinux.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user