third_party_libbpf/include/uapi/linux
YiFei Zhu ab022c8eb4 bpf: Add cgroup helpers bpf_{get,set}_retval to get/set syscall return value
The helpers continue to use int for retval because all the hooks
are int-returning rather than long-returning. The return value of
bpf_set_retval is int for future-proofing, in case in the future
there may be errors trying to set the retval.

After the previous patch, if a program rejects a syscall by
returning 0, an -EPERM will be generated no matter if the retval
is already set to -err. This patch change it being forced only if
retval is not -err. This is because we want to support, for
example, invoking bpf_set_retval(-EINVAL) and return 0, and have
the syscall return value be -EINVAL not -EPERM.

For BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY, the prior behavior is
that, if the return value is NET_XMIT_DROP, the packet is silently
dropped. We preserve this behavior for backward compatibility
reasons, so even if an errno is set, the errno does not return to
caller. However, setting a non-err to retval cannot propagate so
this is not allowed and we return a -EFAULT in that case.

Signed-off-by: YiFei Zhu <zhuyifei@google.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/r/b4013fd5d16bed0b01977c1fafdeae12e1de61fb.1639619851.git.zhuyifei@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2022-01-21 16:54:32 -08:00
..
bpf_common.h mirror uapi/linux/bpf_common.h file (#2) 2018-10-12 12:57:55 -07:00
bpf.h bpf: Add cgroup helpers bpf_{get,set}_retval to get/set syscall return value 2022-01-21 16:54:32 -08:00
btf.h bpf: Support BTF_KIND_TYPE_TAG for btf_type_tag attributes 2021-11-12 23:46:09 -08:00
if_link.h gro: add ability to control gro max packet size 2022-01-14 22:08:26 -08:00
if_xdp.h xsk: Add new statistics 2020-07-28 14:03:17 -07:00
netlink.h sync with latest bpf-next (#6) 2019-01-03 12:44:33 -08:00
pkt_cls.h include: initial sync of pkt_cls.h and pkt_sched.h 2021-07-16 14:22:07 -07:00
pkt_sched.h include: initial sync of pkt_cls.h and pkt_sched.h 2021-07-16 14:22:07 -07:00