History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

David S. Miller committed 6 years ago

Commit ed52f2c2 parents f87238d 8596a75107 files · +6086 −1728Browse files

Showing the changes to include/uapi/linux (2 of 107 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/bpf.h +80 −2
  2. include/uapi/linux/if_link.h +3 −1
include/uapi/linux/bpf.h+80−2
@@ -111,6 +111,8 @@ enum bpf_cmd { · 110 unmodified lines
111111 BPF_MAP_LOOKUP_AND_DELETE_BATCH,
112112 BPF_MAP_UPDATE_BATCH,
113113 BPF_MAP_DELETE_BATCH,
114+ BPF_LINK_CREATE,
115+ BPF_LINK_UPDATE,
114116 };
115117
116118 enum bpf_map_type {
@@ -181,6 +183,7 @@ enum bpf_prog_type { · 64 unmodified lines
181183 BPF_PROG_TYPE_TRACING,
182184 BPF_PROG_TYPE_STRUCT_OPS,
183185 BPF_PROG_TYPE_EXT,
186+ BPF_PROG_TYPE_LSM,
184187 };
185188
186189 enum bpf_attach_type {
@@ -211,6 +214,7 @@ enum bpf_attach_type { · 24 unmodified lines
211214 BPF_TRACE_FENTRY,
212215 BPF_TRACE_FEXIT,
213216 BPF_MODIFY_RETURN,
217+ BPF_LSM_MAC,
214218 __MAX_BPF_ATTACH_TYPE
215219 };
216220
@@ -539,7 +543,7 @@ union bpf_attr { · 322 unmodified lines
539543 __u32 prog_cnt;
540544 } query;
541545
542− struct {
546+ struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
543547 __u64 name;
544548 __u32 prog_fd;
545549 } raw_tracepoint;
@@ -567,6 +571,24 @@ union bpf_attr { · 21 unmodified lines
567571 __u64 probe_offset; /* output: probe_offset */
568572 __u64 probe_addr; /* output: probe_addr */
569573 } 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+
570592 } __attribute__((aligned(8)));
571593
572594 /* The description below is an attempt at providing documentation to eBPF
@@ -2950,6 +2972,59 @@ union bpf_attr { · 2377 unmodified lines
29502972 * restricted to raw_tracepoint bpf programs.
29512973 * Return
29522974 * 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).
29533028 */
29543029 #define __BPF_FUNC_MAPPER(FN) \
29553030 FN(unspec), \
@@ -3073,7 +3148,10 @@ union bpf_attr { · 117 unmodified lines
30733148 FN(jiffies64), \
30743149 FN(read_branch_records), \
30753150 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),
30773155
30783156 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
30793157 * function eBPF program intends to call
include/uapi/linux/if_link.h+3−1
@@ -974,11 +974,12 @@ enum { · 973 unmodified lines
974974 #define XDP_FLAGS_SKB_MODE (1U << 1)
975975 #define XDP_FLAGS_DRV_MODE (1U << 2)
976976 #define XDP_FLAGS_HW_MODE (1U << 3)
977+#define XDP_FLAGS_REPLACE (1U << 4)
977978 #define XDP_FLAGS_MODES (XDP_FLAGS_SKB_MODE | \
978979 XDP_FLAGS_DRV_MODE | \
979980 XDP_FLAGS_HW_MODE)
980981 #define XDP_FLAGS_MASK (XDP_FLAGS_UPDATE_IF_NOEXIST | \
981− XDP_FLAGS_MODES)
982+ XDP_FLAGS_MODES | XDP_FLAGS_REPLACE)
982983
983984 /* These are stored into IFLA_XDP_ATTACHED on dump. */
984985 enum {
@@ -998,6 +999,7 @@ enum { · 13 unmodified lines
998999 IFLA_XDP_DRV_PROG_ID,
9991000 IFLA_XDP_SKB_PROG_ID,
10001001 IFLA_XDP_HW_PROG_ID,
1002+ IFLA_XDP_EXPECTED_FD,
10011003 __IFLA_XDP_MAX,
10021004 };
10031005