Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: Clarify error expectations from bpf_clone_redirect

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

authored by

Stanislav Fomichev and committed by
Daniel Borkmann
7cb779a6 9458964a

+6 -2
+3 -1
include/uapi/linux/bpf.h
··· 1962 1962 * performed again, if the helper is used in combination with 1963 1963 * direct packet access. 1964 1964 * Return 1965 - * 0 on success, or a negative error in case of failure. 1965 + * 0 on success, or a negative error in case of failure. Positive 1966 + * error indicates a potential drop or congestion in the target 1967 + * device. The particular positive error codes are not defined. 1966 1968 * 1967 1969 * u64 bpf_get_current_pid_tgid(void) 1968 1970 * Description
+3 -1
tools/include/uapi/linux/bpf.h
··· 1962 1962 * performed again, if the helper is used in combination with 1963 1963 * direct packet access. 1964 1964 * Return 1965 - * 0 on success, or a negative error in case of failure. 1965 + * 0 on success, or a negative error in case of failure. Positive 1966 + * error indicates a potential drop or congestion in the target 1967 + * device. The particular positive error codes are not defined. 1966 1968 * 1967 1969 * u64 bpf_get_current_pid_tgid(void) 1968 1970 * Description