Martin KaFai Lau
4a9c7bbe2e
bpf: Resolve to prog->aux->dst_prog->type only for BPF_PROG_TYPE_EXT
...
The commit 7e40781cc8 ("bpf: verifier: Use target program's type for access verifications")
fixes the verifier checking for BPF_PROG_TYPE_EXT (extension)
prog such that the verifier looks for things based
on the target prog type that it is extending instead of
the BPF_PROG_TYPE_EXT itself.
The current resolve_prog_type() returns the target prog type.
It checks for nullness on prog->aux->dst_prog. However,
when loading a BPF_PROG_TYPE_TRACING prog and it is tracing another
bpf prog instead of a kernel function, prog->aux->dst_prog is not
NULL also. In this case, the verifier should still verify as the
BPF_PROG_TYPE_TRACING type instead of the traced prog type in
prog->aux->dst_prog->type.
An oops has been reported when tracing a struct_ops prog. A NULL
dereference happened in check_return_code() when accessing the
prog->aux->attach_func_proto->type and prog->aux->attach_func_proto
is NULL here because the traced struct_ops prog has the "unreliable" set.
This patch is to change the resolve_prog_type() to only
return the target prog type if the prog being verified is
BPF_PROG_TYPE_EXT.
Fixes: 7e40781cc8 ("bpf: verifier: Use target program's type for access verifications")
Signed-off-by: Martin KaFai Lau <kafai@fb.com >
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Acked-by: Yonghong Song <yhs@fb.com >
Link: https://lore.kernel.org/bpf/20220330011456.2984509-1-kafai@fb.com
2022-03-30 19:31:30 -07:00
..
2022-02-28 13:59:17 +00:00
2022-02-11 12:13:56 +01:00
2022-01-23 16:37:18 +01:00
2022-02-24 08:26:03 +01:00
2022-03-01 18:26:37 +01:00
2022-02-25 12:36:25 +01:00
2022-02-27 11:06:14 +00:00
2022-03-28 12:27:35 -07:00
2022-02-09 10:07:10 +01:00
2022-02-17 07:00:39 -06:00
2022-02-17 07:00:39 -06:00
2022-02-27 13:38:10 +00:00
2022-02-15 11:25:46 +00:00
2022-03-25 13:56:18 -07:00
2022-03-24 13:13:26 -07:00
2022-03-23 18:08:03 +01:00
2022-02-04 15:47:11 +01:00
2022-02-08 16:23:39 -08:00
2022-02-04 06:30:28 +01:00
2022-01-26 11:20:37 +00:00
2022-03-25 10:11:38 -07:00
2022-03-25 13:35:34 -07:00
2022-02-01 14:55:12 +01:00
2022-02-11 20:39:39 +11:00
2022-03-27 10:17:23 -07:00
2022-03-27 14:21:57 -07:00
2022-03-25 13:35:34 -07:00
2022-02-01 14:25:50 +02:00
2022-03-24 13:13:26 -07:00
2022-03-15 18:20:34 +01:00
2022-03-10 20:17:28 +01:00
2022-03-25 12:14:39 -07:00
2022-03-10 20:21:58 +01:00
2022-03-03 20:24:22 +01:00
2022-02-16 13:16:08 +00:00
2022-02-07 22:38:02 +09:00
2022-03-22 15:57:01 -07:00
2022-03-22 15:57:01 -07:00
2022-03-08 12:50:58 -06:00
2022-03-24 19:37:53 -07:00
2022-03-23 19:00:33 -07:00
2022-03-26 11:51:46 -07:00
2022-02-11 10:02:41 -07:00
2022-03-07 12:48:35 -07:00
2022-03-08 19:39:38 -07:00
2022-03-26 11:51:46 -07:00
2022-03-20 18:55:05 -07:00
2022-03-17 20:17:18 -07:00
2022-03-30 19:31:30 -07:00
2022-01-27 10:15:00 -08:00
2022-03-22 11:18:49 -07:00
2022-03-01 22:21:50 -05:00
2022-02-04 11:26:26 -08:00
2022-03-16 13:37:04 -04:00
2022-03-23 10:11:03 -07:00
2022-03-15 10:32:42 +01:00
2022-02-23 10:58:28 +01:00
2022-03-12 13:22:11 +01:00
2022-03-22 15:57:09 -07:00
2022-02-13 16:50:07 -08:00
2022-03-24 14:14:07 -07:00
2022-03-05 15:29:36 -08:00
2022-03-24 13:13:26 -07:00
2022-03-15 10:32:45 +01:00
2022-02-25 12:16:12 +01:00
2022-03-08 13:04:19 -06:00
2022-03-11 10:07:57 +00:00
2022-02-28 20:47:57 +01:00
2022-03-25 10:11:38 -07:00
2022-02-23 10:58:28 +01:00
2022-02-12 18:20:05 +01:00
2022-03-07 12:48:35 -07:00
2022-03-15 10:32:44 +01:00
2022-03-03 10:47:51 +12:00
2022-03-22 15:57:13 -07:00
2022-03-24 19:37:53 -07:00
2022-02-07 16:35:35 -08:00
2022-02-07 16:35:35 -08:00
2022-02-08 09:19:45 +01:00
2022-02-08 09:25:16 +01:00
2022-02-08 09:19:45 +01:00
2022-03-28 11:37:05 -07:00
2022-01-31 21:45:24 +01:00
2022-02-23 19:45:40 +01:00
2022-02-15 22:53:28 +00:00
2022-02-19 11:11:08 +01:00
2022-02-13 15:59:38 +00:00
2022-02-23 20:33:05 -08:00
2022-03-22 15:57:07 -07:00
2022-02-25 05:50:18 +10:00
2022-03-16 15:13:36 -07:00
2022-02-04 16:24:23 +01:00
2022-02-13 16:50:07 -08:00
2022-03-17 20:17:02 -07:00
2022-01-22 08:33:38 +02:00
2022-02-23 10:58:28 +01:00
2022-03-26 11:51:46 -07:00
2022-03-15 08:34:36 -04:00
2022-02-08 11:02:04 -08:00
2022-02-24 14:05:18 +01:00
2022-01-24 14:16:46 +01:00
2022-03-24 13:13:26 -07:00
2022-02-23 10:58:28 +01:00
2022-03-24 19:06:47 -07:00
2022-02-23 10:58:28 +01:00
2022-03-01 15:46:03 +01:00
2022-03-22 15:57:11 -07:00
2022-03-15 11:34:09 -06:00
2022-03-03 12:47:33 -05:00
2022-02-23 10:58:28 +01:00
2022-03-24 19:06:50 -07:00
2022-03-22 17:03:12 -07:00
2022-02-21 21:14:21 +01:00
2022-02-27 17:03:19 -08:00
2022-02-07 17:55:30 +00:00
2022-02-15 09:58:57 +01:00
2022-03-20 00:11:05 +01:00
2022-02-18 10:40:54 +02:00
2022-03-16 19:38:41 -07:00
2022-03-17 16:49:58 -07:00
2022-03-02 22:44:49 -08:00
2022-03-14 10:06:54 +00:00
2022-02-01 20:59:43 -08:00
2022-02-18 21:20:06 -08:00
2022-03-23 19:00:34 -07:00
2022-03-04 16:46:31 +01:00
2022-02-28 13:25:48 +01:00
2022-03-01 16:31:05 +02:00
2022-03-07 23:53:50 +01:00
2022-03-10 06:32:49 -07:00
2022-02-15 11:31:35 +01:00
2022-03-15 08:23:29 -04:00
2022-02-28 13:25:49 +01:00
2022-02-10 22:40:00 +01:00
2022-02-19 19:23:53 -08:00
2022-02-14 15:43:15 +01:00
2022-02-05 15:20:34 +00:00
2022-02-15 11:10:21 +00:00
2022-02-21 11:31:06 +01:00
2022-02-15 11:10:21 +00:00
2022-03-22 18:26:56 -07:00
2022-02-16 15:57:58 +01:00
2022-02-16 23:25:11 +11:00
2022-03-09 12:13:37 +00:00
2022-03-24 19:06:50 -07:00
2022-03-26 12:01:35 -07:00
2022-03-18 09:47:04 +01:00
2022-03-23 19:00:34 -07:00
2022-02-11 17:55:00 -08:00
2022-02-23 10:58:28 +01:00
2022-03-28 19:38:09 -07:00
2022-02-23 10:58:28 +01:00
2022-03-21 13:01:35 -04:00
2022-03-22 15:57:00 -07:00
2022-02-23 10:58:28 +01:00
2022-03-01 08:58:26 -05:00
2022-03-23 14:35:59 -07:00
2022-02-22 16:21:34 +00:00
2022-01-27 13:53:26 +00:00
2022-03-22 15:57:03 -07:00
2022-02-23 10:58:28 +01:00
2022-02-11 12:13:56 +01:00
2022-02-23 10:58:28 +01:00
2022-03-21 12:07:05 -07:00
2022-03-23 19:00:33 -07:00
2022-03-21 20:47:54 -07:00
2022-02-15 15:03:38 -05:00
2022-02-25 10:27:57 +01:00
2022-01-30 12:21:25 +00:00
2022-03-22 15:57:04 -07:00
2022-03-22 15:57:10 -07:00
2022-03-22 15:57:10 -07:00
2022-03-21 12:57:38 -04:00
2022-03-22 15:57:11 -07:00
2022-01-28 14:36:56 +00:00
2022-02-23 10:58:28 +01:00
2022-03-22 17:03:12 -07:00
2022-03-22 17:03:12 -07:00
2022-03-24 19:06:51 -07:00
2022-03-22 15:57:09 -07:00
2022-03-12 18:00:56 -07:00
2022-02-23 10:58:28 +01:00
2022-03-28 14:40:08 -07:00
2022-03-24 15:09:53 +01:00
2022-02-04 06:30:28 +01:00
2022-02-01 10:29:18 -06:00
2022-01-27 13:53:27 +00:00
2022-03-22 15:57:00 -07:00
2022-03-15 08:23:30 -04:00
2022-02-09 09:24:40 -05:00
2022-03-22 15:57:10 -07:00
2022-02-28 13:45:04 +02:00
2022-02-23 14:43:11 +01:00
2022-03-07 12:49:13 -07:00
2022-02-28 07:30:32 +01:00
2022-03-15 10:32:45 +01:00
2022-03-21 11:35:29 -05:00
2022-02-16 14:30:37 -08:00
2022-02-04 09:25:04 -08:00
2022-03-24 19:06:45 -07:00
2022-03-22 15:57:06 -07:00
2022-03-24 19:06:51 -07:00
2022-02-02 07:49:59 -07:00
2022-03-25 13:02:05 -07:00
2022-03-25 13:02:05 -07:00
2022-02-09 08:04:44 +01:00
2022-02-09 08:04:44 +01:00
2022-02-23 10:58:28 +01:00
2022-02-08 17:51:21 +00:00
2022-02-23 10:58:28 +01:00
2022-02-04 09:25:05 -08:00
2022-03-10 17:16:56 -08:00
2022-02-28 11:57:49 +00:00
2022-01-26 18:57:09 -08:00
2022-03-04 18:26:54 +01:00
2022-03-08 19:57:01 +01:00
2022-03-08 14:33:36 -06:00
2022-02-28 11:34:32 +01:00
2022-01-22 08:33:37 +02:00
2022-01-28 21:55:35 +01:00
2022-02-21 11:53:51 +01:00
2022-03-21 11:13:49 +01:00
2022-03-15 11:08:23 -07:00
2022-03-07 11:31:34 +00:00
2022-02-23 10:58:28 +01:00
2022-02-03 21:54:48 -06:00
2022-01-24 14:45:02 +01:00
2022-03-22 09:17:20 -07:00
2022-02-14 11:07:12 -08:00
2022-02-14 10:36:58 -08:00
2022-03-07 23:01:26 +01:00
2022-03-21 14:00:56 -07:00
2022-02-23 10:58:28 +01:00
2022-02-14 10:36:58 -08:00
2022-02-05 15:22:44 +00:00
2022-02-23 10:58:28 +01:00
2022-03-18 16:53:19 +00:00
2022-03-08 14:33:36 -06:00
2022-03-17 20:16:29 -07:00
2022-03-01 10:59:13 +01:00
2022-03-21 13:01:35 -04:00
2022-03-03 10:37:23 +00:00
2022-01-26 18:53:28 +01:00
2022-02-08 06:55:49 -07:00
2022-02-23 08:21:32 +01:00
2022-03-24 13:13:26 -07:00
2022-02-21 10:36:48 +00:00
2022-02-15 15:03:38 -05:00
2022-01-22 08:33:37 +02:00
2022-02-23 10:58:28 +01:00
2022-03-18 13:30:54 +01:00
2022-02-28 21:49:06 +01:00
2022-03-22 15:57:01 -07:00
2022-02-24 15:04:51 +00:00
2022-03-22 11:18:49 -07:00
2022-03-15 16:43:31 +01:00
2022-03-23 12:33:21 -07:00
2022-02-11 11:14:58 +00:00
2022-02-23 10:58:28 +01:00
2022-03-17 20:17:18 -07:00
2022-02-23 10:58:28 +01:00
2022-01-22 08:33:37 +02:00
2022-03-23 19:00:33 -07:00
2022-02-07 13:03:07 -08:00
2022-02-07 21:02:31 +01:00
2022-02-23 10:58:28 +01:00
2022-03-24 19:06:51 -07:00
2022-01-22 08:33:38 +02:00
2022-02-23 10:58:28 +01:00
2022-02-25 09:36:06 +01:00
2022-01-30 09:56:58 +02:00
2022-03-07 12:48:35 -07:00
2022-02-11 11:14:58 +00:00
2022-02-16 07:49:41 +01:00
2022-03-22 15:57:11 -07:00
2022-02-01 16:36:42 +01:00
2022-03-24 13:13:26 -07:00
2022-01-26 14:54:48 +01:00
2022-03-17 20:17:18 -07:00
2022-02-23 10:58:28 +01:00
2022-03-23 18:03:08 -07:00
2022-01-27 13:53:27 +00:00
2022-02-04 10:14:07 +00:00
2022-03-04 11:56:33 -05:00
2022-03-03 09:55:34 -07:00
2022-03-03 13:00:16 +02:00
2022-03-04 08:33:21 -05:00
2022-03-04 08:33:21 -05:00
2022-03-22 15:57:09 -07:00
2022-03-24 19:06:47 -07:00
2022-02-08 12:15:59 +01:00
2022-02-23 10:58:28 +01:00
2022-03-11 10:17:12 -08:00
2022-02-23 10:58:28 +01:00
2022-02-14 14:09:59 +00:00
2022-03-22 15:57:03 -07:00