Showing the changes to include/uapi/linux (2 of 107 files). Show all
Unified · Split
| @@ -111,6 +111,8 @@ enum bpf_cmd { · 110 unmodified lines | ||
| 111 | 111 | BPF_MAP_LOOKUP_AND_DELETE_BATCH, |
| 112 | 112 | BPF_MAP_UPDATE_BATCH, |
| 113 | 113 | BPF_MAP_DELETE_BATCH, |
| 114 | + BPF_LINK_CREATE, | |
| 115 | + BPF_LINK_UPDATE, | |
| 114 | 116 | }; |
| 115 | 117 | |
| 116 | 118 | enum bpf_map_type { |
| @@ -181,6 +183,7 @@ enum bpf_prog_type { · 64 unmodified lines | ||
| 181 | 183 | BPF_PROG_TYPE_TRACING, |
| 182 | 184 | BPF_PROG_TYPE_STRUCT_OPS, |
| 183 | 185 | BPF_PROG_TYPE_EXT, |
| 186 | + BPF_PROG_TYPE_LSM, | |
| 184 | 187 | }; |
| 185 | 188 | |
| 186 | 189 | enum bpf_attach_type { |
| @@ -211,6 +214,7 @@ enum bpf_attach_type { · 24 unmodified lines | ||
| 211 | 214 | BPF_TRACE_FENTRY, |
| 212 | 215 | BPF_TRACE_FEXIT, |
| 213 | 216 | BPF_MODIFY_RETURN, |
| 217 | + BPF_LSM_MAC, | |
| 214 | 218 | __MAX_BPF_ATTACH_TYPE |
| 215 | 219 | }; |
| 216 | 220 | |
| @@ -539,7 +543,7 @@ union bpf_attr { · 322 unmodified lines | ||
| 539 | 543 | __u32 prog_cnt; |
| 540 | 544 | } query; |
| 541 | 545 | |
| 542 | − struct { | |
| 546 | + struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ | |
| 543 | 547 | __u64 name; |
| 544 | 548 | __u32 prog_fd; |
| 545 | 549 | } raw_tracepoint; |
| @@ -567,6 +571,24 @@ union bpf_attr { · 21 unmodified lines | ||
| 567 | 571 | __u64 probe_offset; /* output: probe_offset */ |
| 568 | 572 | __u64 probe_addr; /* output: probe_addr */ |
| 569 | 573 | } task_fd_query; |
| 574 | + | |
| 575 | + struct { /* struct used by BPF_LINK_CREATE command */ | |
| 576 | + __u32 prog_fd; /* eBPF program to attach */ | |
| 577 | + __u32 target_fd; /* object to attach to */ | |
| 578 | + __u32 attach_type; /* attach type */ | |
| 579 | + __u32 flags; /* extra flags */ | |
| 580 | + } link_create; | |
| 581 | + | |
| 582 | + struct { /* struct used by BPF_LINK_UPDATE command */ | |
| 583 | + __u32 link_fd; /* link fd */ | |
| 584 | + /* new program fd to update link with */ | |
| 585 | + __u32 new_prog_fd; | |
| 586 | + __u32 flags; /* extra flags */ | |
| 587 | + /* expected link's program fd; is specified only if | |
| 588 | + * BPF_F_REPLACE flag is set in flags */ | |
| 589 | + __u32 old_prog_fd; | |
| 590 | + } link_update; | |
| 591 | + | |
| 570 | 592 | } __attribute__((aligned(8))); |
| 571 | 593 | |
| 572 | 594 | /* The description below is an attempt at providing documentation to eBPF |
| @@ -2950,6 +2972,59 @@ union bpf_attr { · 2377 unmodified lines | ||
| 2950 | 2972 | * restricted to raw_tracepoint bpf programs. |
| 2951 | 2973 | * Return |
| 2952 | 2974 | * 0 on success, or a negative error in case of failure. |
| 2975 | + * | |
| 2976 | + * u64 bpf_get_netns_cookie(void *ctx) | |
| 2977 | + * Description | |
| 2978 | + * Retrieve the cookie (generated by the kernel) of the network | |
| 2979 | + * namespace the input *ctx* is associated with. The network | |
| 2980 | + * namespace cookie remains stable for its lifetime and provides | |
| 2981 | + * a global identifier that can be assumed unique. If *ctx* is | |
| 2982 | + * NULL, then the helper returns the cookie for the initial | |
| 2983 | + * network namespace. The cookie itself is very similar to that | |
| 2984 | + * of bpf_get_socket_cookie() helper, but for network namespaces | |
| 2985 | + * instead of sockets. | |
| 2986 | + * Return | |
| 2987 | + * A 8-byte long opaque number. | |
| 2988 | + * | |
| 2989 | + * u64 bpf_get_current_ancestor_cgroup_id(int ancestor_level) | |
| 2990 | + * Description | |
| 2991 | + * Return id of cgroup v2 that is ancestor of the cgroup associated | |
| 2992 | + * with the current task at the *ancestor_level*. The root cgroup | |
| 2993 | + * is at *ancestor_level* zero and each step down the hierarchy | |
| 2994 | + * increments the level. If *ancestor_level* == level of cgroup | |
| 2995 | + * associated with the current task, then return value will be the | |
| 2996 | + * same as that of **bpf_get_current_cgroup_id**\ (). | |
| 2997 | + * | |
| 2998 | + * The helper is useful to implement policies based on cgroups | |
| 2999 | + * that are upper in hierarchy than immediate cgroup associated | |
| 3000 | + * with the current task. | |
| 3001 | + * | |
| 3002 | + * The format of returned id and helper limitations are same as in | |
| 3003 | + * **bpf_get_current_cgroup_id**\ (). | |
| 3004 | + * Return | |
| 3005 | + * The id is returned or 0 in case the id could not be retrieved. | |
| 3006 | + * | |
| 3007 | + * int bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags) | |
| 3008 | + * Description | |
| 3009 | + * Assign the *sk* to the *skb*. When combined with appropriate | |
| 3010 | + * routing configuration to receive the packet towards the socket, | |
| 3011 | + * will cause *skb* to be delivered to the specified socket. | |
| 3012 | + * Subsequent redirection of *skb* via **bpf_redirect**\ (), | |
| 3013 | + * **bpf_clone_redirect**\ () or other methods outside of BPF may | |
| 3014 | + * interfere with successful delivery to the socket. | |
| 3015 | + * | |
| 3016 | + * This operation is only valid from TC ingress path. | |
| 3017 | + * | |
| 3018 | + * The *flags* argument must be zero. | |
| 3019 | + * Return | |
| 3020 | + * 0 on success, or a negative errno in case of failure. | |
| 3021 | + * | |
| 3022 | + * * **-EINVAL** Unsupported flags specified. | |
| 3023 | + * * **-ENOENT** Socket is unavailable for assignment. | |
| 3024 | + * * **-ENETUNREACH** Socket is unreachable (wrong netns). | |
| 3025 | + * * **-EOPNOTSUPP** Unsupported operation, for example a | |
| 3026 | + * call from outside of TC ingress. | |
| 3027 | + * * **-ESOCKTNOSUPPORT** Socket type not supported (reuseport). | |
| 2953 | 3028 | */ |
| 2954 | 3029 | #define __BPF_FUNC_MAPPER(FN) \ |
| 2955 | 3030 | FN(unspec), \ |
| @@ -3073,7 +3148,10 @@ union bpf_attr { · 117 unmodified lines | ||
| 3073 | 3148 | FN(jiffies64), \ |
| 3074 | 3149 | FN(read_branch_records), \ |
| 3075 | 3150 | FN(get_ns_current_pid_tgid), \ |
| 3076 | − FN(xdp_output), | |
| 3151 | + FN(xdp_output), \ | |
| 3152 | + FN(get_netns_cookie), \ | |
| 3153 | + FN(get_current_ancestor_cgroup_id), \ | |
| 3154 | + FN(sk_assign), | |
| 3077 | 3155 | |
| 3078 | 3156 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 3079 | 3157 | * function eBPF program intends to call |
| @@ -974,11 +974,12 @@ enum { · 973 unmodified lines | ||
| 974 | 974 | #define XDP_FLAGS_SKB_MODE (1U << 1) |
| 975 | 975 | #define XDP_FLAGS_DRV_MODE (1U << 2) |
| 976 | 976 | #define XDP_FLAGS_HW_MODE (1U << 3) |
| 977 | +#define XDP_FLAGS_REPLACE (1U << 4) | |
| 977 | 978 | #define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \ |
| 978 | 979 | XDP_FLAGS_DRV_MODE | \ |
| 979 | 980 | XDP_FLAGS_HW_MODE) |
| 980 | 981 | #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \ |
| 981 | − XDP_FLAGS_MODES) | |
| 982 | + XDP_FLAGS_MODES | XDP_FLAGS_REPLACE) | |
| 982 | 983 | |
| 983 | 984 | /* These are stored into IFLA_XDP_ATTACHED on dump. */ |
| 984 | 985 | enum { |
| @@ -998,6 +999,7 @@ enum { · 13 unmodified lines | ||
| 998 | 999 | IFLA_XDP_DRV_PROG_ID, |
| 999 | 1000 | IFLA_XDP_SKB_PROG_ID, |
| 1000 | 1001 | IFLA_XDP_HW_PROG_ID, |
| 1002 | + IFLA_XDP_EXPECTED_FD, | |
| 1001 | 1003 | __IFLA_XDP_MAX, |
| 1002 | 1004 | }; |
| 1003 | 1005 | |