YiFei Zhu
b44123b4a3
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-19 12:51:30 -08:00
..
2021-09-14 08:46:08 +02:00
2021-12-21 15:09:46 -08:00
2022-01-05 12:09:06 +01:00
2021-09-13 14:51:10 -05:00
2021-08-23 09:49:09 -07:00
2021-03-11 20:47:05 +00:00
2021-01-25 18:44:44 +01:00
2021-11-01 09:31:03 +01:00
2021-10-02 15:50:45 -04:00
2020-12-28 14:21:31 +00:00
2021-06-16 17:47:53 +02:00
2021-07-28 13:19:31 +01:00
2021-03-18 09:02:27 +01:00
2021-10-05 16:14:10 +02:00
2021-11-01 13:36:08 +00:00
2021-11-09 11:02:04 -08:00
2021-05-19 11:40:15 +02:00
2021-02-06 09:22:10 +01:00
2021-02-06 09:22:10 +01:00
2021-02-15 18:28:30 +01:00
2021-04-02 11:18:30 -06:00
2022-01-19 12:51:30 -08:00
2021-11-11 17:41:11 -08:00
2021-08-23 13:19:09 +02:00
2021-10-29 12:38:43 +02:00
2021-05-27 09:42:21 +02:00
2021-07-12 15:17:47 -05:00
2021-01-12 17:31:14 +01:00
2021-09-14 20:05:26 -06:00
2021-06-02 14:08:09 +02:00
2021-07-12 09:16:29 +02:00
2020-12-15 12:13:36 -08:00
2021-10-17 10:53:52 +01:00
2021-09-07 11:39:01 -07:00
2021-10-01 14:28:55 +01:00
2021-10-18 12:28:53 -07:00
2021-08-10 13:32:40 -04:00
2021-06-17 21:46:37 +02:00
2021-03-18 17:03:54 +01:00
2021-04-13 17:31:44 +01:00
2021-11-22 12:31:48 +00:00
2021-11-22 12:31:47 +00:00
2021-10-27 12:53:42 +02:00
2021-04-20 08:59:03 -06:00
2021-02-26 09:41:03 -08:00
2021-08-02 13:37:28 -06:00
2021-01-27 15:13:52 +01:00
2021-02-07 14:51:19 -08:00
2021-10-28 10:20:31 +02:00
2021-10-07 13:51:11 +02:00
2021-02-08 13:01:24 +01:00
2021-02-15 11:43:33 +01:00
2021-02-04 09:29:57 -08:00
2021-10-06 12:05:51 +00:00
2021-11-15 07:53:10 -08:00
2021-11-15 07:53:10 -08:00
2021-06-03 15:31:34 -07:00
2021-03-30 13:29:39 -07:00
2021-08-29 19:14:20 +05:30
2021-07-29 15:06:50 +01:00
2021-05-07 00:26:34 -07:00
2021-08-20 15:00:35 +01:00
2021-12-02 12:07:04 +00:00
2021-03-10 12:45:16 -08:00
2022-01-06 12:27:05 +00:00
2021-02-04 09:29:57 -08:00
2021-07-21 08:14:33 -07:00
2021-08-05 11:46:42 +01:00
2021-05-05 14:31:05 +02:00
2021-02-26 09:41:03 -08:00
2021-10-19 05:49:54 -06:00
2021-07-21 08:14:33 -07:00
2021-10-04 12:53:35 +01:00
2021-07-21 08:14:33 -07:00
2021-03-18 11:42:46 +01:00
2021-08-18 07:23:15 -06:00
2021-11-01 19:57:14 -07:00
2021-10-05 06:54:16 -05:00
2021-11-01 19:57:14 -07:00
2020-12-15 12:13:36 -08:00
2021-04-26 08:25:20 -07:00
2021-08-06 16:12:32 -04:00
2021-11-17 16:58:03 -05:00
2021-06-17 14:25:39 -04:00
2021-11-11 10:35:27 -05:00
2021-03-03 16:55:02 -08:00
2021-04-22 12:22:11 -07:00
2021-05-21 15:03:50 +02:00
2021-07-21 08:14:33 -07:00
2021-07-08 11:48:21 -07:00
2021-03-10 09:34:06 +01:00
2021-03-24 08:26:29 +01:00
2021-10-21 23:36:28 +02:00
2021-10-26 14:58:45 +01:00
2021-10-25 14:04:18 +01:00
2021-01-12 17:05:37 +01:00
2021-09-03 09:58:17 -07:00
2021-07-26 14:45:18 +02:00
2021-12-14 18:49:40 -08:00
2020-12-15 12:13:36 -08:00
2021-01-23 12:38:42 -08:00
2021-06-30 15:34:04 -06:00
2021-10-12 11:27:47 +01:00
2021-12-29 12:31:36 -08:00
2021-06-18 13:02:45 -07:00
2021-10-14 23:06:28 +02:00
2021-06-10 12:51:33 -07:00
2021-03-11 16:12:59 -08:00
2021-12-27 14:58:37 +00:00
2021-01-25 09:36:25 -05:00
2021-05-07 00:26:34 -07:00
2021-09-14 11:11:20 +02:00
2021-10-21 17:25:17 +02:00
2022-01-04 15:50:23 +01:00
2021-01-04 11:42:26 -05:00
2021-07-27 11:48:42 +01:00
2021-10-07 14:23:31 +01:00
2021-07-06 10:37:46 -05:00
2021-10-19 17:27:00 +02:00
2021-12-23 09:32:51 +01:00
2021-12-19 14:08:48 +00:00
2021-10-20 15:24:36 -07:00
2020-12-21 17:36:48 -08:00
2021-11-10 16:10:47 -08:00
2021-03-25 15:31:22 -07:00
2021-03-17 16:15:39 +01:00
2021-12-10 17:10:55 -08:00
2021-04-08 10:14:45 +02:00
2021-04-06 10:29:56 +02:00
2021-01-25 15:14:16 -08:00
2021-03-17 14:16:26 -05:00
2021-10-18 17:20:50 +02:00
2021-12-20 18:40:48 -08:00
2021-06-22 11:28:51 -07:00
2021-06-28 12:49:52 -07:00
2021-06-18 11:35:47 -07:00
2021-01-15 17:14:49 +01:00
2021-07-27 12:05:46 +02:00
2021-03-10 09:34:06 +01:00
2021-05-18 16:20:54 -05:00
2022-01-02 12:07:39 +00:00
2022-01-02 12:07:39 +00:00
2021-12-01 19:06:09 -08:00
2021-08-04 12:52:03 +01:00
2021-10-18 12:28:52 -07:00
2021-11-01 19:57:14 -07:00
2021-08-03 07:27:42 -04:00
2021-02-11 18:25:05 -08:00
2021-02-02 14:50:15 +01:00
2021-01-07 16:17:32 +01:00
2021-03-11 12:13:08 +01:00
2021-09-16 14:36:26 +01:00
2021-04-10 10:36:34 +02:00
2021-11-23 11:47:51 +00:00
2021-06-30 20:47:27 -07:00
2021-03-22 10:24:07 +01:00
2021-11-22 07:44:55 +00:00
2021-03-22 10:22:22 +01:00
2021-11-01 05:26:49 -04:00
2021-09-06 07:20:58 -04:00
2021-05-05 10:19:41 -06:00
2021-11-22 07:44:55 +00:00
2021-04-08 12:26:34 +02:00
2021-11-04 16:36:54 +01:00
2021-09-29 09:22:29 +02:00
2021-11-01 05:26:48 -04:00
2021-09-11 14:48:42 -07:00
2021-11-10 15:32:38 +01:00
2021-08-26 22:28:03 +02:00
2021-08-05 10:24:08 +01:00
2021-03-07 09:07:16 +01:00
2021-09-05 16:23:09 -04:00
2021-10-08 16:21:53 +01:00
2021-06-12 13:16:45 -07:00
2021-12-23 09:32:51 +01:00