]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
bpf: Clarify error expectations from bpf_clone_redirect
authorStanislav Fomichev <sdf@google.com>
Mon, 11 Sep 2023 19:47:30 +0000 (12:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 19:46:40 +0000 (21:46 +0200)
[ Upstream commit 7cb779a6867fea00b4209bcf6de2f178a743247d ]

Commit 151e887d8ff9 ("veth: Fixing transmit return status for dropped
packets") exposed the fact that bpf_clone_redirect is capable of
returning raw NET_XMIT_XXX return codes.

This is in the conflict with its UAPI doc which says the following:
"0 on success, or a negative error in case of failure."

Update the UAPI to reflect the fact that bpf_clone_redirect can
return positive error numbers, but don't explicitly define
their meaning.

Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20230911194731.286342-1-sdf@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h

index cb0631098f9187b5a80cd2c5371bd118cffd7617..e5250a9b813d6c3219232113fa7ed2f8362952da 100644 (file)
@@ -780,7 +780,9 @@ union bpf_attr {
  *             performed again, if the helper is used in combination with
  *             direct packet access.
  *     Return
- *             0 on success, or a negative error in case of failure.
+ *             0 on success, or a negative error in case of failure. Positive
+ *             error indicates a potential drop or congestion in the target
+ *             device. The particular positive error codes are not defined.
  *
  * u64 bpf_get_current_pid_tgid(void)
  *     Return
index cb0631098f9187b5a80cd2c5371bd118cffd7617..e5250a9b813d6c3219232113fa7ed2f8362952da 100644 (file)
@@ -780,7 +780,9 @@ union bpf_attr {
  *             performed again, if the helper is used in combination with
  *             direct packet access.
  *     Return
- *             0 on success, or a negative error in case of failure.
+ *             0 on success, or a negative error in case of failure. Positive
+ *             error indicates a potential drop or congestion in the target
+ *             device. The particular positive error codes are not defined.
  *
  * u64 bpf_get_current_pid_tgid(void)
  *     Return