History

bpf: Switch most helper return values from 32-bit int to 64-bit long

Switch most of BPF helper definitions from returning int to long. These definitions are coming from comments in BPF UAPI header and are used to generate bpf_helper_defs.h (under libbpf) to be later included and used from BPF programs. In actual in-kernel implementation, all the helpers are defined as returning u64, but due to some historical reasons, most of them are actually defined as returning int in UAPI (usually, to return 0 on success, and negative value on error). This actually causes Clang to quite often generate sub-optimal code, because compiler believes that return value is 32-bit, and in a lot of cases has to be up-converted (usually with a pair of 32-bit bit shifts) to 64-bit values, before they can be used further in BPF code. Besides just "polluting" the code, these 32-bit shifts quite often cause problems for cases in which return value matters. This is especially the case for the family of bpf_probe_read_str() functions. There are few other similar helpers (e.g., bpf_read_branch_records()), in which return value is used by BPF program logic to record variable-length data and process it. For such cases, BPF program logic carefully manages offsets within some array or map to read variable-length data. For such uses, it's crucial for BPF verifier to track possible range of register values to prove that all the accesses happen within given memory bounds. Those extraneous zero-extending bit shifts, inserted by Clang (and quite often interleaved with other code, which makes the issues even more challenging and sometimes requires employing extra per-variable compiler barriers), throws off verifier logic and makes it mark registers as having unknown variable offset. We'll study this pattern a bit later below. Another common pattern is to check return of BPF helper for non-zero state to detect error conditions and attempt alternative actions in such case. Even in this simple and straightforward case, this 32-bit vs BPF's native 64-bit mode quite often leads to sub-optimal and unnecessary extra code. We'll look at this pattern as well. Clang's BPF target supports two modes of code generation: ALU32, in which it is capable of using lower 32-bit parts of registers, and no-ALU32, in which only full 64-bit registers are being used. ALU32 mode somewhat mitigates the above described problems, but not in all cases. This patch switches all the cases in which BPF helpers return 0 or negative error from returning int to returning long. It is shown below that such change in definition leads to equivalent or better code. No-ALU32 mode benefits more, but ALU32 mode doesn't degrade or still gets improved code generation. Another class of cases switched from int to long are bpf_probe_read_str()-like helpers, which encode successful case as non-negative values, while still returning negative value for errors. In all of such cases, correctness is preserved due to two's complement encoding of negative values and the fact that all helpers return values with 32-bit absolute value. Two's complement ensures that for negative values higher 32 bits are all ones and when truncated, leave valid negative 32-bit value with the same value. Non-negative values have upper 32 bits set to zero and similarly preserve value when high 32 bits are truncated. This means that just casting to int/u32 is correct and efficient (and in ALU32 mode doesn't require any extra shifts). To minimize the chances of regressions, two code patterns were investigated, as mentioned above. For both patterns, BPF assembly was analyzed in ALU32/NO-ALU32 compiler modes, both with current 32-bit int return type and new 64-bit long return type. Case 1. Variable-length data reading and concatenation. This is quite ubiquitous pattern in tracing/monitoring applications, reading data like process's environment variables, file path, etc. In such case, many pieces of string-like variable-length data are read into a single big buffer, and at the end of the process, only a part of array containing actual data is sent to user-space for further processing. This case is tested in test_varlen.c selftest (in the next patch). Code flow is roughly as follows: void *payload = &sample->payload; u64 len; len = bpf_probe_read_kernel_str(payload, MAX_SZ1, &source_data1); if (len <= MAX_SZ1) { payload += len; sample->len1 = len; } len = bpf_probe_read_kernel_str(payload, MAX_SZ2, &source_data2); if (len <= MAX_SZ2) { payload += len; sample->len2 = len; } /* and so on */ sample->total_len = payload - &sample->payload; /* send over, e.g., perf buffer */ There could be two variations with slightly different code generated: when len is 64-bit integer and when it is 32-bit integer. Both variations were analysed. BPF assembly instructions between two successive invocations of bpf_probe_read_kernel_str() were used to check code regressions. Results are below, followed by short analysis. Left side is using helpers with int return type, the right one is after the switch to long. ALU32 + INT ALU32 + LONG =========== ============ 64-BIT (13 insns): 64-BIT (10 insns): ------------------------------------ ------------------------------------ 17: call 115 17: call 115 18: if w0 > 256 goto +9 <LBB0_4> 18: if r0 > 256 goto +6 <LBB0_4> 19: w1 = w0 19: r1 = 0 ll 20: r1 <<= 32 21: *(u64 *)(r1 + 0) = r0 21: r1 s>>= 32 22: r6 = 0 ll 22: r2 = 0 ll 24: r6 += r0 24: *(u64 *)(r2 + 0) = r1 00000000000000c8 <LBB0_4>: 25: r6 = 0 ll 25: r1 = r6 27: r6 += r1 26: w2 = 256 00000000000000e0 <LBB0_4>: 27: r3 = 0 ll 28: r1 = r6 29: call 115 29: w2 = 256 30: r3 = 0 ll 32: call 115 32-BIT (11 insns): 32-BIT (12 insns): ------------------------------------ ------------------------------------ 17: call 115 17: call 115 18: if w0 > 256 goto +7 <LBB1_4> 18: if w0 > 256 goto +8 <LBB1_4> 19: r1 = 0 ll 19: r1 = 0 ll 21: *(u32 *)(r1 + 0) = r0 21: *(u32 *)(r1 + 0) = r0 22: w1 = w0 22: r0 <<= 32 23: r6 = 0 ll 23: r0 >>= 32 25: r6 += r1 24: r6 = 0 ll 00000000000000d0 <LBB1_4>: 26: r6 += r0 26: r1 = r6 00000000000000d8 <LBB1_4>: 27: w2 = 256 27: r1 = r6 28: r3 = 0 ll 28: w2 = 256 30: call 115 29: r3 = 0 ll 31: call 115 In ALU32 mode, the variant using 64-bit length variable clearly wins and avoids unnecessary zero-extension bit shifts. In practice, this is even more important and good, because BPF code won't need to do extra checks to "prove" that payload/len are within good bounds. 32-bit len is one instruction longer. Clang decided to do 64-to-32 casting with two bit shifts, instead of equivalent `w1 = w0` assignment. The former uses extra register. The latter might potentially lose some range information, but not for 32-bit value. So in this case, verifier infers that r0 is [0, 256] after check at 18:, and shifting 32 bits left/right keeps that range intact. We should probably look into Clang's logic and see why it chooses bitshifts over sub-register assignments for this. NO-ALU32 + INT NO-ALU32 + LONG ============== =============== 64-BIT (14 insns): 64-BIT (10 insns): ------------------------------------ ------------------------------------ 17: call 115 17: call 115 18: r0 <<= 32 18: if r0 > 256 goto +6 <LBB0_4> 19: r1 = r0 19: r1 = 0 ll 20: r1 >>= 32 21: *(u64 *)(r1 + 0) = r0 21: if r1 > 256 goto +7 <LBB0_4> 22: r6 = 0 ll 22: r0 s>>= 32 24: r6 += r0 23: r1 = 0 ll 00000000000000c8 <LBB0_4>: 25: *(u64 *)(r1 + 0) = r0 25: r1 = r6 26: r6 = 0 ll 26: r2 = 256 28: r6 += r0 27: r3 = 0 ll 00000000000000e8 <LBB0_4>: 29: call 115 29: r1 = r6 30: r2 = 256 31: r3 = 0 ll 33: call 115 32-BIT (13 insns): 32-BIT (13 insns): ------------------------------------ ------------------------------------ 17: call 115 17: call 115 18: r1 = r0 18: r1 = r0 19: r1 <<= 32 19: r1 <<= 32 20: r1 >>= 32 20: r1 >>= 32 21: if r1 > 256 goto +6 <LBB1_4> 21: if r1 > 256 goto +6 <LBB1_4> 22: r2 = 0 ll 22: r2 = 0 ll 24: *(u32 *)(r2 + 0) = r0 24: *(u32 *)(r2 + 0) = r0 25: r6 = 0 ll 25: r6 = 0 ll 27: r6 += r1 27: r6 += r1 00000000000000e0 <LBB1_4>: 00000000000000e0 <LBB1_4>: 28: r1 = r6 28: r1 = r6 29: r2 = 256 29: r2 = 256 30: r3 = 0 ll 30: r3 = 0 ll 32: call 115 32: call 115 In NO-ALU32 mode, for the case of 64-bit len variable, Clang generates much superior code, as expected, eliminating unnecessary bit shifts. For 32-bit len, code is identical. So overall, only ALU-32 32-bit len case is more-or-less equivalent and the difference stems from internal Clang decision, rather than compiler lacking enough information about types. Case 2. Let's look at the simpler case of checking return result of BPF helper for errors. The code is very simple: long bla; if (bpf_probe_read_kenerl(&bla, sizeof(bla), 0)) return 1; else return 0; ALU32 + CHECK (9 insns) ALU32 + CHECK (9 insns) ==================================== ==================================== 0: r1 = r10 0: r1 = r10 1: r1 += -8 1: r1 += -8 2: w2 = 8 2: w2 = 8 3: r3 = 0 3: r3 = 0 4: call 113 4: call 113 5: w1 = w0 5: r1 = r0 6: w0 = 1 6: w0 = 1 7: if w1 != 0 goto +1 <LBB2_2> 7: if r1 != 0 goto +1 <LBB2_2> 8: w0 = 0 8: w0 = 0 0000000000000048 <LBB2_2>: 0000000000000048 <LBB2_2>: 9: exit 9: exit Almost identical code, the only difference is the use of full register assignment (r1 = r0) vs half-registers (w1 = w0) in instruction #5. On 32-bit architectures, new BPF assembly might be slightly less optimal, in theory. But one can argue that's not a big issue, given that use of full registers is still prevalent (e.g., for parameter passing). NO-ALU32 + CHECK (11 insns) NO-ALU32 + CHECK (9 insns) ==================================== ==================================== 0: r1 = r10 0: r1 = r10 1: r1 += -8 1: r1 += -8 2: r2 = 8 2: r2 = 8 3: r3 = 0 3: r3 = 0 4: call 113 4: call 113 5: r1 = r0 5: r1 = r0 6: r1 <<= 32 6: r0 = 1 7: r1 >>= 32 7: if r1 != 0 goto +1 <LBB2_2> 8: r0 = 1 8: r0 = 0 9: if r1 != 0 goto +1 <LBB2_2> 0000000000000048 <LBB2_2>: 10: r0 = 0 9: exit 0000000000000058 <LBB2_2>: 11: exit NO-ALU32 is a clear improvement, getting rid of unnecessary zero-extension bit shifts.

Andrii Nakryiko committed 6 years ago

Commit bdb7b791 parent b3eece02 files · +192 −192Browse files

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

Unified · Split

include/uapi/linux/bpf.h+96−96
@@ -653,7 +653,7 @@ union bpf_attr { · 652 unmodified lines
653653 * Map value associated to *key*, or **NULL** if no entry was
654654 * found.
655655 *
656− * int bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
656+ * long bpf_map_update_elem(struct bpf_map *map, const void *key, const void *value, u64 flags)
657657 * Description
658658 * Add or update the value of the entry associated to *key* in
659659 * *map* with *value*. *flags* is one of:
@@ -671,13 +671,13 @@ union bpf_attr { · 11 unmodified lines
671671 * Return
672672 * 0 on success, or a negative error in case of failure.
673673 *
674− * int bpf_map_delete_elem(struct bpf_map *map, const void *key)
674+ * long bpf_map_delete_elem(struct bpf_map *map, const void *key)
675675 * Description
676676 * Delete entry with *key* from *map*.
677677 * Return
678678 * 0 on success, or a negative error in case of failure.
679679 *
680− * int bpf_probe_read(void *dst, u32 size, const void *unsafe_ptr)
680+ * long bpf_probe_read(void *dst, u32 size, const void *unsafe_ptr)
681681 * Description
682682 * For tracing programs, safely attempt to read *size* bytes from
683683 * kernel space address *unsafe_ptr* and store the data in *dst*.
@@ -695,7 +695,7 @@ union bpf_attr { · 11 unmodified lines
695695 * Return
696696 * Current *ktime*.
697697 *
698− * int bpf_trace_printk(const char *fmt, u32 fmt_size, ...)
698+ * long bpf_trace_printk(const char *fmt, u32 fmt_size, ...)
699699 * Description
700700 * This helper is a "printk()-like" facility for debugging. It
701701 * prints a message defined by format *fmt* (of size *fmt_size*)
@@ -775,7 +775,7 @@ union bpf_attr { · 73 unmodified lines
775775 * Return
776776 * The SMP id of the processor running the program.
777777 *
778− * int bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
778+ * long bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
779779 * Description
780780 * Store *len* bytes from address *from* into the packet
781781 * associated to *skb*, at *offset*. *flags* are a combination of
@@ -792,7 +792,7 @@ union bpf_attr { · 10 unmodified lines
792792 * Return
793793 * 0 on success, or a negative error in case of failure.
794794 *
795− * int bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size)
795+ * long bpf_l3_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 size)
796796 * Description
797797 * Recompute the layer 3 (e.g. IP) checksum for the packet
798798 * associated to *skb*. Computation is incremental, so the helper
@@ -817,7 +817,7 @@ union bpf_attr { · 18 unmodified lines
817817 * Return
818818 * 0 on success, or a negative error in case of failure.
819819 *
820− * int bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags)
820+ * long bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags)
821821 * Description
822822 * Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the
823823 * packet associated to *skb*. Computation is incremental, so the
@@ -849,7 +849,7 @@ union bpf_attr { · 25 unmodified lines
849849 * Return
850850 * 0 on success, or a negative error in case of failure.
851851 *
852− * int bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index)
852+ * long bpf_tail_call(void *ctx, struct bpf_map *prog_array_map, u32 index)
853853 * Description
854854 * This special helper is used to trigger a "tail call", or in
855855 * other words, to jump into another eBPF program. The same stack
@@ -880,7 +880,7 @@ union bpf_attr { · 24 unmodified lines
880880 * Return
881881 * 0 on success, or a negative error in case of failure.
882882 *
883− * int bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags)
883+ * long bpf_clone_redirect(struct sk_buff *skb, u32 ifindex, u64 flags)
884884 * Description
885885 * Clone and redirect the packet associated to *skb* to another
886886 * net device of index *ifindex*. Both ingress and egress
@@ -916,7 +916,7 @@ union bpf_attr { · 29 unmodified lines
916916 * A 64-bit integer containing the current GID and UID, and
917917 * created as such: *current_gid* **<< 32 \|** *current_uid*.
918918 *
919− * int bpf_get_current_comm(void *buf, u32 size_of_buf)
919+ * long bpf_get_current_comm(void *buf, u32 size_of_buf)
920920 * Description
921921 * Copy the **comm** attribute of the current task into *buf* of
922922 * *size_of_buf*. The **comm** attribute contains the name of
@@ -953,7 +953,7 @@ union bpf_attr { · 30 unmodified lines
953953 * Return
954954 * The classid, or 0 for the default unconfigured classid.
955955 *
956− * int bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
956+ * long bpf_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
957957 * Description
958958 * Push a *vlan_tci* (VLAN tag control information) of protocol
959959 * *vlan_proto* to the packet associated to *skb*, then update
@@ -969,7 +969,7 @@ union bpf_attr { · 9 unmodified lines
969969 * Return
970970 * 0 on success, or a negative error in case of failure.
971971 *
972− * int bpf_skb_vlan_pop(struct sk_buff *skb)
972+ * long bpf_skb_vlan_pop(struct sk_buff *skb)
973973 * Description
974974 * Pop a VLAN header from the packet associated to *skb*.
975975 *
@@ -981,7 +981,7 @@ union bpf_attr { · 5 unmodified lines
981981 * Return
982982 * 0 on success, or a negative error in case of failure.
983983 *
984− * int bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
984+ * long bpf_skb_get_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
985985 * Description
986986 * Get tunnel metadata. This helper takes a pointer *key* to an
987987 * empty **struct bpf_tunnel_key** of **size**, that will be
@@ -1032,7 +1032,7 @@ union bpf_attr { · 44 unmodified lines
10321032 * Return
10331033 * 0 on success, or a negative error in case of failure.
10341034 *
1035− * int bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
1035+ * long bpf_skb_set_tunnel_key(struct sk_buff *skb, struct bpf_tunnel_key *key, u32 size, u64 flags)
10361036 * Description
10371037 * Populate tunnel metadata for packet associated to *skb.* The
10381038 * tunnel metadata is set to the contents of *key*, of *size*. The
@@ -1098,7 +1098,7 @@ union bpf_attr { · 59 unmodified lines
10981098 * The value of the perf event counter read from the map, or a
10991099 * negative error code in case of failure.
11001100 *
1101− * int bpf_redirect(u32 ifindex, u64 flags)
1101+ * long bpf_redirect(u32 ifindex, u64 flags)
11021102 * Description
11031103 * Redirect the packet to another net device of index *ifindex*.
11041104 * This helper is somewhat similar to **bpf_clone_redirect**\
@@ -1145,7 +1145,7 @@ union bpf_attr { · 40 unmodified lines
11451145 * The realm of the route for the packet associated to *skb*, or 0
11461146 * if none was found.
11471147 *
1148− * int bpf_perf_event_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
1148+ * long bpf_perf_event_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
11491149 * Description
11501150 * Write raw *data* blob into a special BPF perf event held by
11511151 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
@@ -1190,7 +1190,7 @@ union bpf_attr { · 38 unmodified lines
11901190 * Return
11911191 * 0 on success, or a negative error in case of failure.
11921192 *
1193− * int bpf_skb_load_bytes(const void *skb, u32 offset, void *to, u32 len)
1193+ * long bpf_skb_load_bytes(const void *skb, u32 offset, void *to, u32 len)
11941194 * Description
11951195 * This helper was provided as an easy way to load data from a
11961196 * packet. It can be used to load *len* bytes from *offset* from
@@ -1207,7 +1207,7 @@ union bpf_attr { · 10 unmodified lines
12071207 * Return
12081208 * 0 on success, or a negative error in case of failure.
12091209 *
1210− * int bpf_get_stackid(void *ctx, struct bpf_map *map, u64 flags)
1210+ * long bpf_get_stackid(void *ctx, struct bpf_map *map, u64 flags)
12111211 * Description
12121212 * Walk a user or a kernel stack and return its id. To achieve
12131213 * this, the helper needs *ctx*, which is a pointer to the context
@@ -1276,7 +1276,7 @@ union bpf_attr { · 62 unmodified lines
12761276 * The checksum result, or a negative error code in case of
12771277 * failure.
12781278 *
1279− * int bpf_skb_get_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
1279+ * long bpf_skb_get_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
12801280 * Description
12811281 * Retrieve tunnel options metadata for the packet associated to
12821282 * *skb*, and store the raw tunnel option data to the buffer *opt*
@@ -1294,7 +1294,7 @@ union bpf_attr { · 11 unmodified lines
12941294 * Return
12951295 * The size of the option data retrieved.
12961296 *
1297− * int bpf_skb_set_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
1297+ * long bpf_skb_set_tunnel_opt(struct sk_buff *skb, void *opt, u32 size)
12981298 * Description
12991299 * Set tunnel options metadata for the packet associated to *skb*
13001300 * to the option data contained in the raw buffer *opt* of *size*.
@@ -1304,7 +1304,7 @@ union bpf_attr { · 3 unmodified lines
13041304 * Return
13051305 * 0 on success, or a negative error in case of failure.
13061306 *
1307− * int bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags)
1307+ * long bpf_skb_change_proto(struct sk_buff *skb, __be16 proto, u64 flags)
13081308 * Description
13091309 * Change the protocol of the *skb* to *proto*. Currently
13101310 * supported are transition from IPv4 to IPv6, and from IPv6 to
@@ -1331,7 +1331,7 @@ union bpf_attr { · 20 unmodified lines
13311331 * Return
13321332 * 0 on success, or a negative error in case of failure.
13331333 *
1334− * int bpf_skb_change_type(struct sk_buff *skb, u32 type)
1334+ * long bpf_skb_change_type(struct sk_buff *skb, u32 type)
13351335 * Description
13361336 * Change the packet type for the packet associated to *skb*. This
13371337 * comes down to setting *skb*\ **->pkt_type** to *type*, except
@@ -1358,7 +1358,7 @@ union bpf_attr { · 20 unmodified lines
13581358 * Return
13591359 * 0 on success, or a negative error in case of failure.
13601360 *
1361− * int bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index)
1361+ * long bpf_skb_under_cgroup(struct sk_buff *skb, struct bpf_map *map, u32 index)
13621362 * Description
13631363 * Check whether *skb* is a descendant of the cgroup2 held by
13641364 * *map* of type **BPF_MAP_TYPE_CGROUP_ARRAY**, at *index*.
@@ -1389,7 +1389,7 @@ union bpf_attr { · 24 unmodified lines
13891389 * Return
13901390 * A pointer to the current task struct.
13911391 *
1392− * int bpf_probe_write_user(void *dst, const void *src, u32 len)
1392+ * long bpf_probe_write_user(void *dst, const void *src, u32 len)
13931393 * Description
13941394 * Attempt in a safe way to write *len* bytes from the buffer
13951395 * *src* to *dst* in memory. It only works for threads that are in
@@ -1408,7 +1408,7 @@ union bpf_attr { · 12 unmodified lines
14081408 * Return
14091409 * 0 on success, or a negative error in case of failure.
14101410 *
1411− * int bpf_current_task_under_cgroup(struct bpf_map *map, u32 index)
1411+ * long bpf_current_task_under_cgroup(struct bpf_map *map, u32 index)
14121412 * Description
14131413 * Check whether the probe is being run is the context of a given
14141414 * subset of the cgroup2 hierarchy. The cgroup2 to test is held by
@@ -1420,7 +1420,7 @@ union bpf_attr { · 5 unmodified lines
14201420 * * 1, if the *skb* task does not belong to the cgroup2.
14211421 * * A negative error code, if an error occurred.
14221422 *
1423− * int bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
1423+ * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
14241424 * Description
14251425 * Resize (trim or grow) the packet associated to *skb* to the
14261426 * new *len*. The *flags* are reserved for future usage, and must
@@ -1444,7 +1444,7 @@ union bpf_attr { · 17 unmodified lines
14441444 * Return
14451445 * 0 on success, or a negative error in case of failure.
14461446 *
1447− * int bpf_skb_pull_data(struct sk_buff *skb, u32 len)
1447+ * long bpf_skb_pull_data(struct sk_buff *skb, u32 len)
14481448 * Description
14491449 * Pull in non-linear data in case the *skb* is non-linear and not
14501450 * all of *len* are part of the linear section. Make *len* bytes
@@ -1500,7 +1500,7 @@ union bpf_attr { · 49 unmodified lines
15001500 * recalculation the next time the kernel tries to access this
15011501 * hash or when the **bpf_get_hash_recalc**\ () helper is called.
15021502 *
1503− * int bpf_get_numa_node_id(void)
1503+ * long bpf_get_numa_node_id(void)
15041504 * Description
15051505 * Return the id of the current NUMA node. The primary use case
15061506 * for this helper is the selection of sockets for the local NUMA
@@ -1511,7 +1511,7 @@ union bpf_attr { · 4 unmodified lines
15111511 * Return
15121512 * The id of current NUMA node.
15131513 *
1514− * int bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags)
1514+ * long bpf_skb_change_head(struct sk_buff *skb, u32 len, u64 flags)
15151515 * Description
15161516 * Grows headroom of packet associated to *skb* and adjusts the
15171517 * offset of the MAC header accordingly, adding *len* bytes of
@@ -1532,7 +1532,7 @@ union bpf_attr { · 14 unmodified lines
15321532 * Return
15331533 * 0 on success, or a negative error in case of failure.
15341534 *
1535− * int bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta)
1535+ * long bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta)
15361536 * Description
15371537 * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
15381538 * it is possible to use a negative value for *delta*. This helper
@@ -1547,7 +1547,7 @@ union bpf_attr { · 8 unmodified lines
15471547 * Return
15481548 * 0 on success, or a negative error in case of failure.
15491549 *
1550− * int bpf_probe_read_str(void *dst, u32 size, const void *unsafe_ptr)
1550+ * long bpf_probe_read_str(void *dst, u32 size, const void *unsafe_ptr)
15511551 * Description
15521552 * Copy a NUL terminated string from an unsafe kernel address
15531553 * *unsafe_ptr* to *dst*. See **bpf_probe_read_kernel_str**\ () for
@@ -1595,14 +1595,14 @@ union bpf_attr { · 41 unmodified lines
15951595 * is returned (note that **overflowuid** might also be the actual
15961596 * UID value for the socket).
15971597 *
1598− * u32 bpf_set_hash(struct sk_buff *skb, u32 hash)
1598+ * long bpf_set_hash(struct sk_buff *skb, u32 hash)
15991599 * Description
16001600 * Set the full hash for *skb* (set the field *skb*\ **->hash**)
16011601 * to value *hash*.
16021602 * Return
16031603 * 0
16041604 *
1605− * int bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
1605+ * long bpf_setsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
16061606 * Description
16071607 * Emulate a call to **setsockopt()** on the socket associated to
16081608 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1630,7 +1630,7 @@ union bpf_attr { · 21 unmodified lines
16301630 * Return
16311631 * 0 on success, or a negative error in case of failure.
16321632 *
1633− * int bpf_skb_adjust_room(struct sk_buff *skb, s32 len_diff, u32 mode, u64 flags)
1633+ * long bpf_skb_adjust_room(struct sk_buff *skb, s32 len_diff, u32 mode, u64 flags)
16341634 * Description
16351635 * Grow or shrink the room for data in the packet associated to
16361636 * *skb* by *len_diff*, and according to the selected *mode*.
@@ -1676,7 +1676,7 @@ union bpf_attr { · 39 unmodified lines
16761676 * Return
16771677 * 0 on success, or a negative error in case of failure.
16781678 *
1679− * int bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags)
1679+ * long bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags)
16801680 * Description
16811681 * Redirect the packet to the endpoint referenced by *map* at
16821682 * index *key*. Depending on its type, this *map* can contain
@@ -1697,7 +1697,7 @@ union bpf_attr { · 14 unmodified lines
16971697 * **XDP_REDIRECT** on success, or the value of the two lower bits
16981698 * of the *flags* argument on error.
16991699 *
1700− * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
1700+ * long bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
17011701 * Description
17021702 * Redirect the packet to the socket referenced by *map* (of type
17031703 * **BPF_MAP_TYPE_SOCKMAP**) at index *key*. Both ingress and
@@ -1708,7 +1708,7 @@ union bpf_attr { · 4 unmodified lines
17081708 * Return
17091709 * **SK_PASS** on success, or **SK_DROP** on error.
17101710 *
1711− * int bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
1711+ * long bpf_sock_map_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
17121712 * Description
17131713 * Add an entry to, or update a *map* referencing sockets. The
17141714 * *skops* is used as a new value for the entry associated to
@@ -1727,7 +1727,7 @@ union bpf_attr { · 12 unmodified lines
17271727 * Return
17281728 * 0 on success, or a negative error in case of failure.
17291729 *
1730− * int bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta)
1730+ * long bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta)
17311731 * Description
17321732 * Adjust the address pointed by *xdp_md*\ **->data_meta** by
17331733 * *delta* (which can be positive or negative). Note that this
@@ -1756,7 +1756,7 @@ union bpf_attr { · 22 unmodified lines
17561756 * Return
17571757 * 0 on success, or a negative error in case of failure.
17581758 *
1759− * int bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size)
1759+ * long bpf_perf_event_read_value(struct bpf_map *map, u64 flags, struct bpf_perf_event_value *buf, u32 buf_size)
17601760 * Description
17611761 * Read the value of a perf event counter, and store it into *buf*
17621762 * of size *buf_size*. This helper relies on a *map* of type
@@ -1806,7 +1806,7 @@ union bpf_attr { · 43 unmodified lines
18061806 * Return
18071807 * 0 on success, or a negative error in case of failure.
18081808 *
1809− * int bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
1809+ * long bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size)
18101810 * Description
18111811 * For en eBPF program attached to a perf event, retrieve the
18121812 * value of the event counter associated to *ctx* and store it in
@@ -1817,7 +1817,7 @@ union bpf_attr { · 4 unmodified lines
18171817 * Return
18181818 * 0 on success, or a negative error in case of failure.
18191819 *
1820− * int bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
1820+ * long bpf_getsockopt(void *bpf_socket, int level, int optname, void *optval, int optlen)
18211821 * Description
18221822 * Emulate a call to **getsockopt()** on the socket associated to
18231823 * *bpf_socket*, which must be a full socket. The *level* at
@@ -1842,7 +1842,7 @@ union bpf_attr { · 18 unmodified lines
18421842 * Return
18431843 * 0 on success, or a negative error in case of failure.
18441844 *
1845− * int bpf_override_return(struct pt_regs *regs, u64 rc)
1845+ * long bpf_override_return(struct pt_regs *regs, u64 rc)
18461846 * Description
18471847 * Used for error injection, this helper uses kprobes to override
18481848 * the return value of the probed function, and to set it to *rc*.
@@ -1867,7 +1867,7 @@ union bpf_attr { · 18 unmodified lines
18671867 * Return
18681868 * 0
18691869 *
1870− * int bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
1870+ * long bpf_sock_ops_cb_flags_set(struct bpf_sock_ops *bpf_sock, int argval)
18711871 * Description
18721872 * Attempt to set the value of the **bpf_sock_ops_cb_flags** field
18731873 * for the full TCP socket associated to *bpf_sock_ops* to
@@ -1911,7 +1911,7 @@ union bpf_attr { · 37 unmodified lines
19111911 * be set is returned (which comes down to 0 if all bits were set
19121912 * as required).
19131913 *
1914− * int bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags)
1914+ * long bpf_msg_redirect_map(struct sk_msg_buff *msg, struct bpf_map *map, u32 key, u64 flags)
19151915 * Description
19161916 * This helper is used in programs implementing policies at the
19171917 * socket level. If the message *msg* is allowed to pass (i.e. if
@@ -1925,7 +1925,7 @@ union bpf_attr { · 7 unmodified lines
19251925 * Return
19261926 * **SK_PASS** on success, or **SK_DROP** on error.
19271927 *
1928− * int bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes)
1928+ * long bpf_msg_apply_bytes(struct sk_msg_buff *msg, u32 bytes)
19291929 * Description
19301930 * For socket policies, apply the verdict of the eBPF program to
19311931 * the next *bytes* (number of bytes) of message *msg*.
@@ -1959,7 +1959,7 @@ union bpf_attr { · 27 unmodified lines
19591959 * Return
19601960 * 0
19611961 *
1962− * int bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes)
1962+ * long bpf_msg_cork_bytes(struct sk_msg_buff *msg, u32 bytes)
19631963 * Description
19641964 * For socket policies, prevent the execution of the verdict eBPF
19651965 * program for message *msg* until *bytes* (byte number) have been
@@ -1977,7 +1977,7 @@ union bpf_attr { · 11 unmodified lines
19771977 * Return
19781978 * 0
19791979 *
1980− * int bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags)
1980+ * long bpf_msg_pull_data(struct sk_msg_buff *msg, u32 start, u32 end, u64 flags)
19811981 * Description
19821982 * For socket policies, pull in non-linear data from user space
19831983 * for *msg* and set pointers *msg*\ **->data** and *msg*\
@@ -2008,7 +2008,7 @@ union bpf_attr { · 24 unmodified lines
20082008 * Return
20092009 * 0 on success, or a negative error in case of failure.
20102010 *
2011− * int bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
2011+ * long bpf_bind(struct bpf_sock_addr *ctx, struct sockaddr *addr, int addr_len)
20122012 * Description
20132013 * Bind the socket associated to *ctx* to the address pointed by
20142014 * *addr*, of length *addr_len*. This allows for making outgoing
@@ -2026,7 +2026,7 @@ union bpf_attr { · 11 unmodified lines
20262026 * Return
20272027 * 0 on success, or a negative error in case of failure.
20282028 *
2029− * int bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
2029+ * long bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
20302030 * Description
20312031 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
20322032 * possible to both shrink and grow the packet tail.
@@ -2040,7 +2040,7 @@ union bpf_attr { · 7 unmodified lines
20402040 * Return
20412041 * 0 on success, or a negative error in case of failure.
20422042 *
2043− * int bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags)
2043+ * long bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags)
20442044 * Description
20452045 * Retrieve the XFRM state (IP transform framework, see also
20462046 * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
@@ -2056,7 +2056,7 @@ union bpf_attr { · 9 unmodified lines
20562056 * Return
20572057 * 0 on success, or a negative error in case of failure.
20582058 *
2059− * int bpf_get_stack(void *ctx, void *buf, u32 size, u64 flags)
2059+ * long bpf_get_stack(void *ctx, void *buf, u32 size, u64 flags)
20602060 * Description
20612061 * Return a user or a kernel stack in bpf program provided buffer.
20622062 * To achieve this, the helper needs *ctx*, which is a pointer
@@ -2089,7 +2089,7 @@ union bpf_attr { · 26 unmodified lines
20892089 * A non-negative value equal to or less than *size* on success,
20902090 * or a negative error in case of failure.
20912091 *
2092− * int bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
2092+ * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header)
20932093 * Description
20942094 * This helper is similar to **bpf_skb_load_bytes**\ () in that
20952095 * it provides an easy way to load *len* bytes from *offset*
@@ -2111,7 +2111,7 @@ union bpf_attr { · 15 unmodified lines
21112111 * Return
21122112 * 0 on success, or a negative error in case of failure.
21132113 *
2114− * int bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags)
2114+ * long bpf_fib_lookup(void *ctx, struct bpf_fib_lookup *params, int plen, u32 flags)
21152115 * Description
21162116 * Do FIB lookup in kernel tables using parameters in *params*.
21172117 * If lookup is successful and result shows packet is to be
@@ -2142,7 +2142,7 @@ union bpf_attr { · 24 unmodified lines
21422142 * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
21432143 * packet is not forwarded or needs assist from full stack
21442144 *
2145− * int bpf_sock_hash_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
2145+ * long bpf_sock_hash_update(struct bpf_sock_ops *skops, struct bpf_map *map, void *key, u64 flags)
21462146 * Description
21472147 * Add an entry to, or update a sockhash *map* referencing sockets.
21482148 * The *skops* is used as a new value for the entry associated to
@@ -2161,7 +2161,7 @@ union bpf_attr { · 12 unmodified lines
21612161 * Return
21622162 * 0 on success, or a negative error in case of failure.
21632163 *
2164− * int bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags)
2164+ * long bpf_msg_redirect_hash(struct sk_msg_buff *msg, struct bpf_map *map, void *key, u64 flags)
21652165 * Description
21662166 * This helper is used in programs implementing policies at the
21672167 * socket level. If the message *msg* is allowed to pass (i.e. if
@@ -2175,7 +2175,7 @@ union bpf_attr { · 7 unmodified lines
21752175 * Return
21762176 * **SK_PASS** on success, or **SK_DROP** on error.
21772177 *
2178− * int bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags)
2178+ * long bpf_sk_redirect_hash(struct sk_buff *skb, struct bpf_map *map, void *key, u64 flags)
21792179 * Description
21802180 * This helper is used in programs implementing policies at the
21812181 * skb socket level. If the sk_buff *skb* is allowed to pass (i.e.
@@ -2189,7 +2189,7 @@ union bpf_attr { · 7 unmodified lines
21892189 * Return
21902190 * **SK_PASS** on success, or **SK_DROP** on error.
21912191 *
2192− * int bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len)
2192+ * long bpf_lwt_push_encap(struct sk_buff *skb, u32 type, void *hdr, u32 len)
21932193 * Description
21942194 * Encapsulate the packet associated to *skb* within a Layer 3
21952195 * protocol header. This header is provided in the buffer at
@@ -2226,7 +2226,7 @@ union bpf_attr { · 30 unmodified lines
22262226 * Return
22272227 * 0 on success, or a negative error in case of failure.
22282228 *
2229− * int bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len)
2229+ * long bpf_lwt_seg6_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len)
22302230 * Description
22312231 * Store *len* bytes from address *from* into the packet
22322232 * associated to *skb*, at *offset*. Only the flags, tag and TLVs
@@ -2241,7 +2241,7 @@ union bpf_attr { · 8 unmodified lines
22412241 * Return
22422242 * 0 on success, or a negative error in case of failure.
22432243 *
2244− * int bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta)
2244+ * long bpf_lwt_seg6_adjust_srh(struct sk_buff *skb, u32 offset, s32 delta)
22452245 * Description
22462246 * Adjust the size allocated to TLVs in the outermost IPv6
22472247 * Segment Routing Header contained in the packet associated to
@@ -2257,7 +2257,7 @@ union bpf_attr { · 9 unmodified lines
22572257 * Return
22582258 * 0 on success, or a negative error in case of failure.
22592259 *
2260− * int bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len)
2260+ * long bpf_lwt_seg6_action(struct sk_buff *skb, u32 action, void *param, u32 param_len)
22612261 * Description
22622262 * Apply an IPv6 Segment Routing action of type *action* to the
22632263 * packet associated to *skb*. Each action takes a parameter
@@ -2286,7 +2286,7 @@ union bpf_attr { · 22 unmodified lines
22862286 * Return
22872287 * 0 on success, or a negative error in case of failure.
22882288 *
2289− * int bpf_rc_repeat(void *ctx)
2289+ * long bpf_rc_repeat(void *ctx)
22902290 * Description
22912291 * This helper is used in programs implementing IR decoding, to
22922292 * report a successfully decoded repeat key message. This delays
@@ -2305,7 +2305,7 @@ union bpf_attr { · 12 unmodified lines
23052305 * Return
23062306 * 0
23072307 *
2308− * int bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle)
2308+ * long bpf_rc_keydown(void *ctx, u32 protocol, u64 scancode, u32 toggle)
23092309 * Description
23102310 * This helper is used in programs implementing IR decoding, to
23112311 * report a successfully decoded key press with *scancode*,
@@ -2370,7 +2370,7 @@ union bpf_attr { · 58 unmodified lines
23702370 * Return
23712371 * A pointer to the local storage area.
23722372 *
2373− * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
2373+ * long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
23742374 * Description
23752375 * Select a **SO_REUSEPORT** socket from a
23762376 * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
@@ -2471,7 +2471,7 @@ union bpf_attr { · 94 unmodified lines
24712471 * result is from *reuse*\ **->socks**\ [] using the hash of the
24722472 * tuple.
24732473 *
2474− * int bpf_sk_release(struct bpf_sock *sock)
2474+ * long bpf_sk_release(struct bpf_sock *sock)
24752475 * Description
24762476 * Release the reference held by *sock*. *sock* must be a
24772477 * non-**NULL** pointer that was returned from
@@ -2479,7 +2479,7 @@ union bpf_attr { · 1 unmodified line
24792479 * Return
24802480 * 0 on success, or a negative error in case of failure.
24812481 *
2482− * int bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)
2482+ * long bpf_map_push_elem(struct bpf_map *map, const void *value, u64 flags)
24832483 * Description
24842484 * Push an element *value* in *map*. *flags* is one of:
24852485 *
@@ -2489,19 +2489,19 @@ union bpf_attr { · 3 unmodified lines
24892489 * Return
24902490 * 0 on success, or a negative error in case of failure.
24912491 *
2492− * int bpf_map_pop_elem(struct bpf_map *map, void *value)
2492+ * long bpf_map_pop_elem(struct bpf_map *map, void *value)
24932493 * Description
24942494 * Pop an element from *map*.
24952495 * Return
24962496 * 0 on success, or a negative error in case of failure.
24972497 *
2498− * int bpf_map_peek_elem(struct bpf_map *map, void *value)
2498+ * long bpf_map_peek_elem(struct bpf_map *map, void *value)
24992499 * Description
25002500 * Get an element from *map* without removing it.
25012501 * Return
25022502 * 0 on success, or a negative error in case of failure.
25032503 *
2504− * int bpf_msg_push_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
2504+ * long bpf_msg_push_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
25052505 * Description
25062506 * For socket policies, insert *len* bytes into *msg* at offset
25072507 * *start*.
@@ -2517,7 +2517,7 @@ union bpf_attr { · 9 unmodified lines
25172517 * Return
25182518 * 0 on success, or a negative error in case of failure.
25192519 *
2520− * int bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
2520+ * long bpf_msg_pop_data(struct sk_msg_buff *msg, u32 start, u32 len, u64 flags)
25212521 * Description
25222522 * Will remove *len* bytes from a *msg* starting at byte *start*.
25232523 * This may result in **ENOMEM** errors under certain situations if
@@ -2529,7 +2529,7 @@ union bpf_attr { · 5 unmodified lines
25292529 * Return
25302530 * 0 on success, or a negative error in case of failure.
25312531 *
2532− * int bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y)
2532+ * long bpf_rc_pointer_rel(void *ctx, s32 rel_x, s32 rel_y)
25332533 * Description
25342534 * This helper is used in programs implementing IR decoding, to
25352535 * report a successfully decoded pointer movement.
@@ -2543,7 +2543,7 @@ union bpf_attr { · 7 unmodified lines
25432543 * Return
25442544 * 0
25452545 *
2546− * int bpf_spin_lock(struct bpf_spin_lock *lock)
2546+ * long bpf_spin_lock(struct bpf_spin_lock *lock)
25472547 * Description
25482548 * Acquire a spinlock represented by the pointer *lock*, which is
25492549 * stored as part of a value of a map. Taking the lock allows to
@@ -2591,7 +2591,7 @@ union bpf_attr { · 41 unmodified lines
25912591 * Return
25922592 * 0
25932593 *
2594− * int bpf_spin_unlock(struct bpf_spin_lock *lock)
2594+ * long bpf_spin_unlock(struct bpf_spin_lock *lock)
25952595 * Description
25962596 * Release the *lock* previously locked by a call to
25972597 * **bpf_spin_lock**\ (\ *lock*\ ).
@@ -2614,7 +2614,7 @@ union bpf_attr { · 16 unmodified lines
26142614 * A **struct bpf_tcp_sock** pointer on success, or **NULL** in
26152615 * case of failure.
26162616 *
2617− * int bpf_skb_ecn_set_ce(struct sk_buff *skb)
2617+ * long bpf_skb_ecn_set_ce(struct sk_buff *skb)
26182618 * Description
26192619 * Set ECN (Explicit Congestion Notification) field of IP header
26202620 * to **CE** (Congestion Encountered) if current value is **ECT**
@@ -2651,7 +2651,7 @@ union bpf_attr { · 30 unmodified lines
26512651 * result is from *reuse*\ **->socks**\ [] using the hash of the
26522652 * tuple.
26532653 *
2654− * int bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
2654+ * long bpf_tcp_check_syncookie(struct bpf_sock *sk, void *iph, u32 iph_len, struct tcphdr *th, u32 th_len)
26552655 * Description
26562656 * Check whether *iph* and *th* contain a valid SYN cookie ACK for
26572657 * the listening socket in *sk*.
@@ -2666,7 +2666,7 @@ union bpf_attr { · 8 unmodified lines
26662666 * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative
26672667 * error otherwise.
26682668 *
2669− * int bpf_sysctl_get_name(struct bpf_sysctl *ctx, char *buf, size_t buf_len, u64 flags)
2669+ * long bpf_sysctl_get_name(struct bpf_sysctl *ctx, char *buf, size_t buf_len, u64 flags)
26702670 * Description
26712671 * Get name of sysctl in /proc/sys/ and copy it into provided by
26722672 * program buffer *buf* of size *buf_len*.
@@ -2682,7 +2682,7 @@ union bpf_attr { · 9 unmodified lines
26822682 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
26832683 * truncated name in this case).
26842684 *
2685− * int bpf_sysctl_get_current_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
2685+ * long bpf_sysctl_get_current_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
26862686 * Description
26872687 * Get current value of sysctl as it is presented in /proc/sys
26882688 * (incl. newline, etc), and copy it as a string into provided
@@ -2701,7 +2701,7 @@ union bpf_attr { · 12 unmodified lines
27012701 * **-EINVAL** if current value was unavailable, e.g. because
27022702 * sysctl is uninitialized and read returns -EIO for it.
27032703 *
2704− * int bpf_sysctl_get_new_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
2704+ * long bpf_sysctl_get_new_value(struct bpf_sysctl *ctx, char *buf, size_t buf_len)
27052705 * Description
27062706 * Get new value being written by user space to sysctl (before
27072707 * the actual write happens) and copy it as a string into
@@ -2718,7 +2718,7 @@ union bpf_attr { · 10 unmodified lines
27182718 *
27192719 * **-EINVAL** if sysctl is being read.
27202720 *
2721− * int bpf_sysctl_set_new_value(struct bpf_sysctl *ctx, const char *buf, size_t buf_len)
2721+ * long bpf_sysctl_set_new_value(struct bpf_sysctl *ctx, const char *buf, size_t buf_len)
27222722 * Description
27232723 * Override new value being written by user space to sysctl with
27242724 * value provided by program in buffer *buf* of size *buf_len*.
@@ -2735,7 +2735,7 @@ union bpf_attr { · 10 unmodified lines
27352735 *
27362736 * **-EINVAL** if sysctl is being read.
27372737 *
2738− * int bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res)
2738+ * long bpf_strtol(const char *buf, size_t buf_len, u64 flags, long *res)
27392739 * Description
27402740 * Convert the initial part of the string from buffer *buf* of
27412741 * size *buf_len* to a long integer according to the given base
@@ -2759,7 +2759,7 @@ union bpf_attr { · 17 unmodified lines
27592759 *
27602760 * **-ERANGE** if resulting value was out of range.
27612761 *
2762− * int bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res)
2762+ * long bpf_strtoul(const char *buf, size_t buf_len, u64 flags, unsigned long *res)
27632763 * Description
27642764 * Convert the initial part of the string from buffer *buf* of
27652765 * size *buf_len* to an unsigned long integer according to the
@@ -2810,7 +2810,7 @@ union bpf_attr { · 44 unmodified lines
28102810 * **NULL** if not found or there was an error in adding
28112811 * a new bpf-local-storage.
28122812 *
2813− * int bpf_sk_storage_delete(struct bpf_map *map, struct bpf_sock *sk)
2813+ * long bpf_sk_storage_delete(struct bpf_map *map, struct bpf_sock *sk)
28142814 * Description
28152815 * Delete a bpf-local-storage from a *sk*.
28162816 * Return
@@ -2818,7 +2818,7 @@ union bpf_attr { · 1 unmodified line
28182818 *
28192819 * **-ENOENT** if the bpf-local-storage cannot be found.
28202820 *
2821− * int bpf_send_signal(u32 sig)
2821+ * long bpf_send_signal(u32 sig)
28222822 * Description
28232823 * Send signal *sig* to the process of the current task.
28242824 * The signal may be delivered to any of this process's threads.
@@ -2859,7 +2859,7 @@ union bpf_attr { · 34 unmodified lines
28592859 *
28602860 * **-EPROTONOSUPPORT** IP packet version is not 4 or 6
28612861 *
2862− * int bpf_skb_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
2862+ * long bpf_skb_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
28632863 * Description
28642864 * Write raw *data* blob into a special BPF perf event held by
28652865 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
@@ -2883,21 +2883,21 @@ union bpf_attr { · 17 unmodified lines
28832883 * Return
28842884 * 0 on success, or a negative error in case of failure.
28852885 *
2886− * int bpf_probe_read_user(void *dst, u32 size, const void *unsafe_ptr)
2886+ * long bpf_probe_read_user(void *dst, u32 size, const void *unsafe_ptr)
28872887 * Description
28882888 * Safely attempt to read *size* bytes from user space address
28892889 * *unsafe_ptr* and store the data in *dst*.
28902890 * Return
28912891 * 0 on success, or a negative error in case of failure.
28922892 *
2893− * int bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
2893+ * long bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr)
28942894 * Description
28952895 * Safely attempt to read *size* bytes from kernel space address
28962896 * *unsafe_ptr* and store the data in *dst*.
28972897 * Return
28982898 * 0 on success, or a negative error in case of failure.
28992899 *
2900− * int bpf_probe_read_user_str(void *dst, u32 size, const void *unsafe_ptr)
2900+ * long bpf_probe_read_user_str(void *dst, u32 size, const void *unsafe_ptr)
29012901 * Description
29022902 * Copy a NUL terminated string from an unsafe user address
29032903 * *unsafe_ptr* to *dst*. The *size* should include the
@@ -2941,7 +2941,7 @@ union bpf_attr { · 37 unmodified lines
29412941 * including the trailing NUL character. On error, a negative
29422942 * value.
29432943 *
2944− * int bpf_probe_read_kernel_str(void *dst, u32 size, const void *unsafe_ptr)
2944+ * long bpf_probe_read_kernel_str(void *dst, u32 size, const void *unsafe_ptr)
29452945 * Description
29462946 * Copy a NUL terminated string from an unsafe kernel address *unsafe_ptr*
29472947 * to *dst*. Same semantics as with **bpf_probe_read_user_str**\ () apply.
@@ -2949,14 +2949,14 @@ union bpf_attr { · 1 unmodified line
29492949 * On success, the strictly positive length of the string, including
29502950 * the trailing NUL character. On error, a negative value.
29512951 *
2952− * int bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
2952+ * long bpf_tcp_send_ack(void *tp, u32 rcv_nxt)
29532953 * Description
29542954 * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
29552955 * *rcv_nxt* is the ack_seq to be sent out.
29562956 * Return
29572957 * 0 on success, or a negative error in case of failure.
29582958 *
2959− * int bpf_send_signal_thread(u32 sig)
2959+ * long bpf_send_signal_thread(u32 sig)
29602960 * Description
29612961 * Send signal *sig* to the thread corresponding to the current task.
29622962 * Return
@@ -2976,7 +2976,7 @@ union bpf_attr { · 13 unmodified lines
29762976 * Return
29772977 * The 64 bit jiffies
29782978 *
2979− * int bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags)
2979+ * long bpf_read_branch_records(struct bpf_perf_event_data *ctx, void *buf, u32 size, u64 flags)
29802980 * Description
29812981 * For an eBPF program attached to a perf event, retrieve the
29822982 * branch records (**struct perf_branch_entry**) associated to *ctx*
@@ -2995,7 +2995,7 @@ union bpf_attr { · 12 unmodified lines
29952995 *
29962996 * **-ENOENT** if architecture does not support branch records.
29972997 *
2998− * int bpf_get_ns_current_pid_tgid(u64 dev, u64 ino, struct bpf_pidns_info *nsdata, u32 size)
2998+ * long bpf_get_ns_current_pid_tgid(u64 dev, u64 ino, struct bpf_pidns_info *nsdata, u32 size)
29992999 * Description
30003000 * Returns 0 on success, values for *pid* and *tgid* as seen from the current
30013001 * *namespace* will be returned in *nsdata*.
@@ -3007,7 +3007,7 @@ union bpf_attr { · 5 unmodified lines
30073007 *
30083008 * **-ENOENT** if pidns does not exists for the current task.
30093009 *
3010− * int bpf_xdp_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
3010+ * long bpf_xdp_output(void *ctx, struct bpf_map *map, u64 flags, void *data, u64 size)
30113011 * Description
30123012 * Write raw *data* blob into a special BPF perf event held by
30133013 * *map* of type **BPF_MAP_TYPE_PERF_EVENT_ARRAY**. This perf
@@ -3062,7 +3062,7 @@ union bpf_attr { · 48 unmodified lines
30623062 * Return
30633063 * The id is returned or 0 in case the id could not be retrieved.
30643064 *
3065− * int bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
3065+ * long bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
30663066 * Description
30673067 * Assign the *sk* to the *skb*. When combined with appropriate
30683068 * routing configuration to receive the packet towards the socket,
@@ -3097,7 +3097,7 @@ union bpf_attr { · 28 unmodified lines
30973097 * Return
30983098 * Current *ktime*.
30993099 *
3100− * int bpf_seq_printf(struct seq_file *m, const char *fmt, u32 fmt_size, const void *data, u32 data_len)
3100+ * long bpf_seq_printf(struct seq_file *m, const char *fmt, u32 fmt_size, const void *data, u32 data_len)
31013101 * Description
31023102 * **bpf_seq_printf**\ () uses seq_file **seq_printf**\ () to print
31033103 * out the format string.
@@ -3126,7 +3126,7 @@ union bpf_attr { · 22 unmodified lines
31263126 *
31273127 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
31283128 *
3129− * int bpf_seq_write(struct seq_file *m, const void *data, u32 len)
3129+ * long bpf_seq_write(struct seq_file *m, const void *data, u32 len)
31303130 * Description
31313131 * **bpf_seq_write**\ () uses seq_file **seq_write**\ () to write the data.
31323132 * The *m* represents the seq_file. The *data* and *len* represent the
@@ -3221,7 +3221,7 @@ union bpf_attr { · 88 unmodified lines
32213221 * Return
32223222 * Requested value, or 0, if flags are not recognized.
32233223 *
3224− * int bpf_csum_level(struct sk_buff *skb, u64 level)
3224+ * long bpf_csum_level(struct sk_buff *skb, u64 level)
32253225 * Description
32263226 * Change the skbs checksum level by one layer up or down, or
32273227 * reset it entirely to none in order to have the stack perform