Skip to content

Commit

Permalink
Sync with latest libbpf repo (#4993)
Browse files Browse the repository at this point in the history
The top sync commit is:
  e05542003381  sync: Commit .mailmap changes from script when sync-ing repo

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
  • Loading branch information
yonghong-song authored May 8, 2024
1 parent 77c0591 commit eb7cdd2
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 10 deletions.
1 change: 1 addition & 0 deletions introspection/bps.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static const char * const map_type_strings[] = {
[BPF_MAP_TYPE_BLOOM_FILTER] = "bloom_filter",
[BPF_MAP_TYPE_USER_RINGBUF] = "user_ringbuf",
[BPF_MAP_TYPE_CGRP_STORAGE] = "cgrp_storage",
[BPF_MAP_TYPE_ARENA] = "arena",
};

#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
Expand Down
88 changes: 79 additions & 9 deletions src/cc/compat/linux/virtual_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ R"********(
#define BPF_JSGE 0x70 /* SGE is signed '>=', GE in x86 */
#define BPF_JSLT 0xc0 /* SLT is signed, '<' */
#define BPF_JSLE 0xd0 /* SLE is signed, '<=' */
#define BPF_JCOND 0xe0 /* conditional pseudo jumps: may_goto, goto_or_nop */
#define BPF_CALL 0x80 /* function call */
#define BPF_EXIT 0x90 /* function return */

Expand All @@ -51,6 +52,10 @@ R"********(
#define BPF_XCHG (0xe0 | BPF_FETCH) /* atomic exchange */
#define BPF_CMPXCHG (0xf0 | BPF_FETCH) /* atomic compare-and-write */

enum bpf_cond_pseudo_jmp {
BPF_MAY_GOTO = 0,
};

/* Register numbers */
enum {
BPF_REG_0 = 0,
Expand Down Expand Up @@ -78,12 +83,29 @@ struct bpf_insn {
__s32 imm; /* signed immediate constant */
};

/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
/* Deprecated: use struct bpf_lpm_trie_key_u8 (when the "data" member is needed for
* byte access) or struct bpf_lpm_trie_key_hdr (when using an alternative type for
* the trailing flexible array member) instead.
*/
struct bpf_lpm_trie_key {
__u32 prefixlen; /* up to 32 for AF_INET, 128 for AF_INET6 */
__u8 data[0]; /* Arbitrary size */
};

/* Header for bpf_lpm_trie_key structs */
struct bpf_lpm_trie_key_hdr {
__u32 prefixlen;
};

/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry, with trailing byte array. */
struct bpf_lpm_trie_key_u8 {
union {
struct bpf_lpm_trie_key_hdr hdr;
__u32 prefixlen;
};
__u8 data[]; /* Arbitrary size */
};

struct bpf_cgroup_storage_key {
__u64 cgroup_inode_id; /* cgroup inode id */
__u32 attach_type; /* program attach type (enum bpf_attach_type) */
Expand Down Expand Up @@ -618,7 +640,11 @@ union bpf_iter_link_info {
* to NULL to begin the batched operation. After each subsequent
* **BPF_MAP_LOOKUP_BATCH**, the caller should pass the resultant
* *out_batch* as the *in_batch* for the next operation to
* continue iteration from the current point.
* continue iteration from the current point. Both *in_batch* and
* *out_batch* must point to memory large enough to hold a key,
* except for maps of type **BPF_MAP_TYPE_{HASH, PERCPU_HASH,
* LRU_HASH, LRU_PERCPU_HASH}**, for which batch parameters
* must be at least 4 bytes wide regardless of key size.
*
* The *keys* and *values* are output parameters which must point
* to memory large enough to hold *count* items based on the key
Expand Down Expand Up @@ -984,6 +1010,7 @@ enum bpf_map_type {
BPF_MAP_TYPE_BLOOM_FILTER,
BPF_MAP_TYPE_USER_RINGBUF,
BPF_MAP_TYPE_CGRP_STORAGE,
BPF_MAP_TYPE_ARENA,
__MAX_BPF_MAP_TYPE
};

Expand Down Expand Up @@ -1089,6 +1116,7 @@ enum bpf_attach_type {
BPF_CGROUP_UNIX_GETSOCKNAME,
BPF_NETKIT_PRIMARY,
BPF_NETKIT_PEER,
BPF_TRACE_KPROBE_SESSION,
__MAX_BPF_ATTACH_TYPE
};

Expand All @@ -1109,6 +1137,7 @@ enum bpf_link_type {
BPF_LINK_TYPE_TCX = 11,
BPF_LINK_TYPE_UPROBE_MULTI = 12,
BPF_LINK_TYPE_NETKIT = 13,
BPF_LINK_TYPE_SOCKMAP = 14,
__MAX_BPF_LINK_TYPE,
};

Expand Down Expand Up @@ -1313,6 +1342,10 @@ enum {
*/
#define BPF_PSEUDO_KFUNC_CALL 2

enum bpf_addr_space_cast {
BPF_ADDR_SPACE_CAST = 1,
};

/* flags for BPF_MAP_UPDATE_ELEM command */
enum {
BPF_ANY = 0, /* create new element or update existing */
Expand Down Expand Up @@ -1371,6 +1404,12 @@ enum {

/* BPF token FD is passed in a corresponding command's token_fd field */
BPF_F_TOKEN_FD = (1U << 16),

/* When user space page faults in bpf_arena send SIGSEGV instead of inserting new page */
BPF_F_SEGV_ON_FAULT = (1U << 17),

/* Do not translate kernel bpf_arena pointers to user pointers */
BPF_F_NO_USER_CONV = (1U << 18),
};

/* Flags for BPF_PROG_QUERY. */
Expand Down Expand Up @@ -1442,6 +1481,9 @@ union bpf_attr {
* BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
* number of hash functions (if 0, the bloom filter will default
* to using 5 hash functions).
*
* BPF_MAP_TYPE_ARENA - contains the address where user space
* is going to mmap() the arena. It has to be page aligned.
*/
__u64 map_extra;

Expand Down Expand Up @@ -1623,8 +1665,10 @@ union bpf_attr {
} query;

struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
__u64 name;
__u32 prog_fd;
__u64 name;
__u32 prog_fd;
__u32 :32;
__aligned_u64 cookie;
} raw_tracepoint;

struct { /* anonymous struct for BPF_BTF_LOAD */
Expand Down Expand Up @@ -3353,6 +3397,10 @@ union bpf_attr {
* for the nexthop. If the src addr cannot be derived,
* **BPF_FIB_LKUP_RET_NO_SRC_ADDR** is returned. In this
* case, *params*->dmac and *params*->smac are not set either.
* **BPF_FIB_LOOKUP_MARK**
* Use the mark present in *params*->mark for the fib lookup.
* This option should not be used with BPF_FIB_LOOKUP_DIRECT,
* as it only has meaning for full lookups.
*
* *ctx* is either **struct xdp_md** for XDP programs or
* **struct sk_buff** tc cls_act programs.
Expand Down Expand Up @@ -4981,7 +5029,7 @@ union bpf_attr {
* bytes will be copied to *dst*
* Return
* The **hash_algo** is returned on success,
* **-EOPNOTSUP** if IMA is disabled or **-EINVAL** if
* **-EOPNOTSUPP** if IMA is disabled or **-EINVAL** if
* invalid arguments are passed.
*
* struct socket *bpf_sock_from_file(struct file *file)
Expand Down Expand Up @@ -5467,7 +5515,7 @@ union bpf_attr {
* bytes will be copied to *dst*
* Return
* The **hash_algo** is returned on success,
* **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if
* **-EOPNOTSUPP** if the hash calculation failed or **-EINVAL** if
* invalid arguments are passed.
*
* void *bpf_kptr_xchg(void *map_value, void *ptr)
Expand Down Expand Up @@ -6679,6 +6727,10 @@ struct bpf_link_info {
__u32 ifindex;
__u32 attach_type;
} netkit;
struct {
__u32 map_id;
__u32 attach_type;
} sockmap;
};
} __attribute__((aligned(8)));

Expand Down Expand Up @@ -6897,6 +6949,8 @@ enum {
* socket transition to LISTEN state.
*/
BPF_SOCK_OPS_RTT_CB, /* Called on every RTT.
* Arg1: measured RTT input (mrtt)
* Arg2: updated srtt
*/
BPF_SOCK_OPS_PARSE_HDR_OPT_CB, /* Parse the header option.
* It will be called to handle
Expand Down Expand Up @@ -7079,6 +7133,7 @@ enum {
BPF_FIB_LOOKUP_SKIP_NEIGH = (1U << 2),
BPF_FIB_LOOKUP_TBID = (1U << 3),
BPF_FIB_LOOKUP_SRC = (1U << 4),
BPF_FIB_LOOKUP_MARK = (1U << 5),
};

enum {
Expand Down Expand Up @@ -7111,7 +7166,7 @@ struct bpf_fib_lookup {

/* output: MTU value */
__u16 mtu_result;
};
} __attribute__((packed, aligned(2)));
/* input: L3 device index for lookup
* output: device index from FIB lookup
*/
Expand Down Expand Up @@ -7156,8 +7211,19 @@ struct bpf_fib_lookup {
__u32 tbid;
};

__u8 smac[6]; /* ETH_ALEN */
__u8 dmac[6]; /* ETH_ALEN */
union {
/* input */
struct {
__u32 mark; /* policy routing */
/* 2 4-byte holes for input */
};

/* output: source and dest mac */
struct {
__u8 smac[6]; /* ETH_ALEN */
__u8 dmac[6]; /* ETH_ALEN */
};
};
};

struct bpf_redir_neigh {
Expand Down Expand Up @@ -7244,6 +7310,10 @@ struct bpf_timer {
__u64 __opaque[2];
} __attribute__((aligned(8)));

struct bpf_wq {
__u64 __opaque[2];
} __attribute__((aligned(8)));

struct bpf_dynptr {
__u64 __opaque[2];
} __attribute__((aligned(8)));
Expand Down
2 changes: 1 addition & 1 deletion src/cc/libbpf
Submodule libbpf updated 72 files
+1 −1 .gitattributes
+3 −0 .github/PULL_REQUEST_TEMPLATE.md
+1 −0 .github/actions/build-selftests/build_selftests.sh
+2 −0 .github/actions/build-selftests/prepare_selftests-4.9.0.sh
+2 −0 .github/actions/build-selftests/prepare_selftests-5.5.0.sh
+80,061 −81,168 .github/actions/build-selftests/vmlinux.h
+19 −0 .github/actions/vmtest/action.yml
+3 −3 .github/workflows/build.yml
+1 −1 .github/workflows/codeql.yml
+1 −1 .github/workflows/coverity.yml
+1 −1 .github/workflows/lint.yml
+1 −1 .github/workflows/ondemand.yml
+1 −1 .github/workflows/pahole.yml
+1 −1 .github/workflows/test.yml
+17 −0 .mailmap
+6 −2 .readthedocs.yaml
+1 −1 BPF-CHECKPOINT-COMMIT
+1 −1 CHECKPOINT-COMMIT
+1 −1 README.md
+69 −0 ci/diffs/0001-arch-Kconfig-Move-SPECULATION_MITIGATIONS-to-arch-Kc.patch
+0 −70 ci/diffs/0001-s390-define-RUNTIME_DISCARD_EXIT-to-fix-link-error-w.patch
+0 −46 ci/diffs/0001-selftests-bpf-Select-CONFIG_FUNCTION_ERROR_INJECTION.patch
+56 −0 ci/diffs/0002-xdp-bonding-Fix-feature-flags-when-there-are-no-slav.patch
+1 −5 ci/vmtest/configs/ALLOWLIST-5.5.0
+14 −0 ci/vmtest/configs/DENYLIST
+2 −115 ci/vmtest/configs/DENYLIST-5.5.0
+12 −0 ci/vmtest/configs/DENYLIST-latest
+14 −0 ci/vmtest/configs/DENYLIST-latest.s390x
+10 −3 ci/vmtest/run_selftests.sh
+1 −0 docs/conf.py
+10 −0 docs/program_types.rst
+2 −1 docs/sphinx/requirements.txt
+8 −0 include/linux/filter.h
+2 −0 include/linux/kernel.h
+403 −53 include/uapi/linux/bpf.h
+8 −0 include/uapi/linux/fcntl.h
+142 −0 include/uapi/linux/if_link.h
+59 −1 include/uapi/linux/if_xdp.h
+115 −1 include/uapi/linux/netdev.h
+15 −1 include/uapi/linux/perf_event.h
+0 −47 include/uapi/linux/pkt_cls.h
+0 −109 include/uapi/linux/pkt_sched.h
+4 −3 scripts/build-fuzzers.sh
+37 −0 scripts/mailmap-update.sh
+16 −0 scripts/sync-kernel.sh
+6 −3 src/Makefile
+188 −50 src/bpf.c
+194 −31 src/bpf.h
+84 −8 src/bpf_core_read.h
+247 −225 src/bpf_helper_defs.h
+21 −6 src/bpf_helpers.h
+3 −4 src/bpf_tracing.h
+197 −8 src/btf.c
+24 −3 src/btf_dump.c
+558 −0 src/elf.c
+583 −0 src/features.c
+7 −7 src/gen_loader.c
+0 −10 src/hashmap.h
+2,016 −877 src/libbpf.c
+236 −5 src/libbpf.h
+34 −2 src/libbpf.map
+19 −0 src/libbpf_common.h
+98 −9 src/libbpf_internal.h
+24 −6 src/libbpf_probes.c
+1 −1 src/libbpf_version.h
+24 −5 src/linker.c
+6 −1 src/netlink.c
+1 −1 src/relo_core.c
+115 −19 src/ringbuf.c
+3 −0 src/str_error.h
+2 −2 src/usdt.bpf.h
+85 −41 src/usdt.c

0 comments on commit eb7cdd2

Please sign in to comment.