Skip to content

Commit 07881cc

Browse files
FlorentRevestAlexei Starovoitov
authored andcommitted
bpf: Be less specific about socket cookies guarantees
Since "92acdc58ab11 bpf, net: Rework cookie generator as per-cpu one" socket cookies are not guaranteed to be non-decreasing. The bpf_get_socket_cookie helper descriptions are currently specifying that cookies are non-decreasing but we don't want users to rely on that. Reported-by: Daniel Borkmann <[email protected]> Signed-off-by: Florent Revest <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: KP Singh <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 0e1aa62 commit 07881cc

File tree

2 files changed

+8
-8
lines changed
  • include/uapi/linux
  • tools/include/uapi/linux

2 files changed

+8
-8
lines changed

include/uapi/linux/bpf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,22 +1656,22 @@ union bpf_attr {
16561656
* networking traffic statistics as it provides a global socket
16571657
* identifier that can be assumed unique.
16581658
* Return
1659-
* A 8-byte long non-decreasing number on success, or 0 if the
1660-
* socket field is missing inside *skb*.
1659+
* A 8-byte long unique number on success, or 0 if the socket
1660+
* field is missing inside *skb*.
16611661
*
16621662
* u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx)
16631663
* Description
16641664
* Equivalent to bpf_get_socket_cookie() helper that accepts
16651665
* *skb*, but gets socket from **struct bpf_sock_addr** context.
16661666
* Return
1667-
* A 8-byte long non-decreasing number.
1667+
* A 8-byte long unique number.
16681668
*
16691669
* u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx)
16701670
* Description
16711671
* Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
16721672
* *skb*, but gets socket from **struct bpf_sock_ops** context.
16731673
* Return
1674-
* A 8-byte long non-decreasing number.
1674+
* A 8-byte long unique number.
16751675
*
16761676
* u32 bpf_get_socket_uid(struct sk_buff *skb)
16771677
* Return

tools/include/uapi/linux/bpf.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,22 +1656,22 @@ union bpf_attr {
16561656
* networking traffic statistics as it provides a global socket
16571657
* identifier that can be assumed unique.
16581658
* Return
1659-
* A 8-byte long non-decreasing number on success, or 0 if the
1660-
* socket field is missing inside *skb*.
1659+
* A 8-byte long unique number on success, or 0 if the socket
1660+
* field is missing inside *skb*.
16611661
*
16621662
* u64 bpf_get_socket_cookie(struct bpf_sock_addr *ctx)
16631663
* Description
16641664
* Equivalent to bpf_get_socket_cookie() helper that accepts
16651665
* *skb*, but gets socket from **struct bpf_sock_addr** context.
16661666
* Return
1667-
* A 8-byte long non-decreasing number.
1667+
* A 8-byte long unique number.
16681668
*
16691669
* u64 bpf_get_socket_cookie(struct bpf_sock_ops *ctx)
16701670
* Description
16711671
* Equivalent to **bpf_get_socket_cookie**\ () helper that accepts
16721672
* *skb*, but gets socket from **struct bpf_sock_ops** context.
16731673
* Return
1674-
* A 8-byte long non-decreasing number.
1674+
* A 8-byte long unique number.
16751675
*
16761676
* u32 bpf_get_socket_uid(struct sk_buff *skb)
16771677
* Return

0 commit comments

Comments
 (0)