Alan Maguire
323084d77d
selftests/bpf: fix static assert compilation issue for test_cls_*.c
...
[ Upstream commit 416c6d01244ecbf0abfdb898fd091b50ef951b48 ]
commit bdeeed3498c7 ("libbpf: fix offsetof() and container_of() to work with CO-RE")
...was backported to stable trees such as 5.15. The problem is that with older
LLVM/clang (14/15) - which is often used for older kernels - we see compilation
failures in BPF selftests now:
In file included from progs/test_cls_redirect_subprogs.c:2:
progs/test_cls_redirect.c:90:2: error: static assertion expression is not an integral constant expression
sizeof(flow_ports_t) !=
^~~~~~~~~~~~~~~~~~~~~~~
progs/test_cls_redirect.c:91:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
offsetofend(struct bpf_sock_tuple, ipv4.dport) -
^
progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
(offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
^
tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:86:33: note: expanded from macro 'offsetof'
^
In file included from progs/test_cls_redirect_subprogs.c:2:
progs/test_cls_redirect.c:95:2: error: static assertion expression is not an integral constant expression
sizeof(flow_ports_t) !=
^~~~~~~~~~~~~~~~~~~~~~~
progs/test_cls_redirect.c:96:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
offsetofend(struct bpf_sock_tuple, ipv6.dport) -
^
progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
(offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
^
tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:86:33: note: expanded from macro 'offsetof'
^
2 errors generated.
make: *** [Makefile:594: tools/testing/selftests/bpf/test_cls_redirect_subprogs.bpf.o] Error 1
The problem is the new offsetof() does not play nice with static asserts.
Given that the context is a static assert (and CO-RE relocation is not
needed at compile time), offsetof() usage can be replaced by restoring
the original offsetof() definition as __builtin_offsetof().
Fixes: bdeeed3498c7 ("libbpf: fix offsetof() and container_of() to work with CO-RE")
Reported-by: Colm Harrington <colm.harrington@oracle.com >
Signed-off-by: Alan Maguire <alan.maguire@oracle.com >
Tested-by: Yipeng Zou <zouyipeng@huawei.com >
Acked-by: Yonghong Song <yonghong.song@linux.dev >
Link: https://lore.kernel.org/r/20230802073906.3197480-1-alan.maguire@oracle.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2023-09-19 12:20:08 +02:00
..
2020-09-25 13:58:02 -07:00
2020-09-25 13:58:02 -07:00
2020-09-30 11:50:35 -07:00
2020-07-25 20:16:34 -07:00
2020-09-03 17:36:41 -07:00
2020-06-24 18:37:59 -07:00
2020-07-25 20:16:34 -07:00
2020-07-25 20:16:33 -07:00
2020-07-25 20:16:34 -07:00
2020-06-24 18:37:59 -07:00
2020-07-21 13:26:26 -07:00
2020-09-28 16:48:02 -07:00
2020-09-28 18:26:58 -07:00
2020-09-02 16:40:33 +02:00
2020-07-03 23:25:40 +02:00
2021-08-08 09:05:24 +02:00
2021-09-15 09:50:37 +02:00
2020-07-21 13:26:26 -07:00
2020-05-09 17:05:27 -07:00
2020-05-09 17:05:27 -07:00
2020-06-24 18:37:59 -07:00
2020-06-24 18:37:59 -07:00
2020-07-25 20:16:34 -07:00
2020-07-31 00:43:49 +02:00
2020-06-24 18:37:59 -07:00
2020-07-21 13:26:26 -07:00
2020-07-21 13:26:26 -07:00
2020-09-29 11:10:48 -07:00
2020-06-24 18:37:59 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-12-15 16:53:51 -08:00
2019-12-15 16:53:51 -08:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-11-04 16:06:56 +01:00
2019-12-15 16:53:51 -08:00
2019-08-07 14:43:49 -07:00
2019-11-04 16:06:56 +01:00
2019-11-04 16:06:56 +01:00
2019-11-04 16:06:56 +01:00
2019-11-04 16:06:56 +01:00
2019-11-04 16:06:56 +01:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2019-10-15 16:06:05 -07:00
2021-05-14 09:50:44 +02:00
2019-10-15 16:06:05 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-08-07 14:43:49 -07:00
2019-11-04 16:06:56 +01:00
2020-08-18 18:12:46 -07:00
2019-11-04 16:06:56 +01:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-08-19 14:19:39 -07:00
2020-07-13 10:42:03 -07:00
2023-04-05 11:23:52 +02:00
2019-05-24 14:05:58 -07:00
2019-05-24 14:05:58 -07:00
2019-05-24 14:05:58 -07:00
2023-04-05 11:23:52 +02:00
2023-04-05 11:23:52 +02:00
2022-06-09 10:20:56 +02:00
2020-09-29 11:10:48 -07:00
2020-07-25 20:16:35 -07:00
2020-07-25 20:16:36 -07:00
2020-07-25 20:16:36 -07:00
2020-07-25 20:16:35 -07:00
2020-05-14 18:41:08 -07:00
2023-08-16 18:20:59 +02:00
2020-01-20 16:37:45 -08:00
2020-05-19 11:32:04 -07:00
2020-05-19 11:32:04 -07:00
2021-05-14 09:50:44 +02:00
2020-01-20 16:37:45 -08:00
2020-06-30 22:21:29 +02:00
2020-03-02 16:25:14 -08:00
2020-08-26 12:47:56 -07:00
2020-06-30 22:21:29 +02:00
2020-09-29 13:09:24 -07:00
2020-08-26 12:47:56 -07:00
2020-08-26 12:47:56 -07:00
2020-04-24 17:34:30 -07:00
2020-08-26 12:47:56 -07:00
2020-09-29 13:09:24 -07:00
2020-01-20 16:37:45 -08:00
2020-03-02 16:25:14 -08:00
2020-06-11 16:05:56 +02:00
2020-12-30 11:53:03 +01:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-31 23:03:57 +02:00
2020-09-08 18:04:07 -07:00
2020-09-15 18:28:27 -07:00
2020-09-15 18:28:27 -07:00
2020-03-04 13:41:06 -08:00
2020-01-20 16:37:45 -08:00
2021-03-17 17:06:12 +01:00
2020-07-25 20:16:35 -07:00
2020-06-01 14:38:22 -07:00
2020-10-09 22:03:06 +02:00
2020-10-09 22:03:06 +02:00
2020-10-09 22:03:06 +02:00
2020-10-09 22:03:06 +02:00
2021-01-23 16:03:57 +01:00
2019-05-23 16:20:57 +02:00
2019-05-23 16:20:57 +02:00
2019-05-23 16:20:57 +02:00
2019-06-19 02:22:52 +02:00
2019-06-19 02:22:52 +02:00
2020-01-10 17:20:07 +01:00
2020-09-03 17:14:40 -07:00
2020-09-03 17:14:40 -07:00
2020-06-01 14:38:22 -07:00
2020-01-20 16:37:45 -08:00
2019-02-11 20:31:38 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-03-17 19:28:27 +01:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2023-07-27 08:43:37 +02:00
2019-06-19 02:22:52 +02:00
2019-06-19 02:22:52 +02:00
2020-09-03 17:14:40 -07:00
2019-06-19 02:22:52 +02:00
2021-11-18 14:04:32 +01:00
2020-09-30 11:50:35 -07:00
2020-09-30 11:50:35 -07:00
2020-09-30 11:50:35 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-09-30 11:50:35 -07:00
2020-09-30 11:50:35 -07:00
2020-09-30 11:50:35 -07:00
2020-09-30 11:50:35 -07:00
2020-01-20 16:37:45 -08:00
2020-03-02 16:25:14 -08:00
2020-06-28 10:06:53 -07:00
2020-04-24 17:47:40 -07:00
2020-10-11 10:21:04 -07:00
2020-04-24 17:47:40 -07:00
2020-04-24 17:47:40 -07:00
2020-09-25 13:58:02 -07:00
2020-03-30 17:36:41 -07:00
2020-09-03 17:14:40 -07:00
2020-09-03 17:14:40 -07:00
2023-09-19 12:20:08 +02:00
2021-09-15 09:50:40 +02:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-19 14:19:39 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-19 14:19:39 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-19 14:19:39 -07:00
2020-08-20 16:45:09 +02:00
2020-08-01 23:10:42 -07:00
2020-09-21 16:18:00 -07:00
2020-05-01 10:36:32 -07:00
2020-07-01 09:06:12 +02:00
2020-03-30 15:00:30 -07:00
2020-06-24 11:10:59 -07:00
2020-03-30 01:17:35 +02:00
2020-01-20 16:37:45 -08:00
2020-01-10 17:20:07 +01:00
2020-01-20 16:37:45 -08:00
2020-01-10 17:20:07 +01:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-11-14 08:17:27 -08:00
2019-07-03 15:06:33 +02:00
2020-10-19 15:57:42 -07:00
2020-10-02 15:00:49 -07:00
2020-06-22 17:01:48 -07:00
2020-09-03 17:14:40 -07:00
2020-01-20 16:37:45 -08:00
2020-03-02 22:06:27 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-11-05 19:55:57 -08:00
2020-01-20 16:37:45 -08:00
2020-10-15 20:53:15 +02:00
2020-05-20 20:21:53 -07:00
2020-03-12 17:40:47 -07:00
2020-04-28 17:27:08 -07:00
2020-09-28 17:20:28 -07:00
2020-09-30 23:21:06 -07:00
2020-03-02 16:25:14 -08:00
2020-07-09 00:44:45 +02:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-26 12:47:56 -07:00
2020-01-20 16:37:45 -08:00
2020-11-19 11:58:15 -08:00
2020-03-02 16:25:14 -08:00
2019-02-11 20:31:38 -08:00
2020-01-20 16:37:45 -08:00
2020-09-28 21:33:38 -07:00
2020-01-20 16:37:45 -08:00
2020-06-01 14:38:22 -07:00
2020-06-01 14:38:22 -07:00
2020-01-20 16:37:45 -08:00
2020-01-24 22:12:13 +01:00
2020-03-05 14:02:41 -08:00
2023-08-16 18:20:59 +02:00
2023-08-16 18:20:59 +02:00
2020-05-21 17:44:25 -07:00
2021-11-18 14:04:12 +01:00
2020-01-20 16:37:45 -08:00
2020-03-03 16:23:59 -08:00
2020-06-01 14:38:21 -07:00
2020-07-13 17:07:43 -07:00
2020-06-01 14:38:20 -07:00
2022-08-11 13:06:44 +02:00
2019-02-11 20:31:38 -08:00
2020-08-21 15:16:12 -07:00
2019-02-11 20:31:38 -08:00
2022-03-02 11:42:48 +01:00
2020-02-21 22:29:46 +01:00
2020-08-21 15:16:12 -07:00
2020-01-20 16:37:45 -08:00
2019-02-11 20:31:38 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-11-12 09:13:49 -08:00
2020-09-03 17:14:40 -07:00
2020-09-09 11:21:34 -07:00
2020-09-09 11:21:34 -07:00
2020-09-10 20:01:53 -07:00
2020-01-20 16:37:45 -08:00
2020-10-22 01:30:00 +02:00
2020-10-22 01:30:00 +02:00
2020-10-11 10:21:04 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-10-02 11:34:48 -07:00
2020-08-13 22:40:43 +02:00
2020-01-20 16:37:45 -08:00
2020-09-29 13:09:24 -07:00
2020-09-29 13:09:24 -07:00
2020-01-20 16:37:45 -08:00
2020-03-02 16:25:14 -08:00
2021-03-30 14:31:58 +02:00
2020-08-13 16:45:41 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-08-18 17:16:15 -07:00
2020-05-14 21:21:57 -07:00
2020-05-14 21:21:57 -07:00
2020-03-12 17:47:38 -07:00
2020-06-09 11:36:19 -07:00
2020-07-25 20:37:02 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-09-03 17:14:40 -07:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2020-07-16 17:00:32 +02:00
2020-06-25 22:36:00 +02:00
2020-01-20 16:37:45 -08:00
2020-07-13 16:55:49 -07:00
2020-08-28 21:20:33 +02:00
2020-07-31 00:43:49 +02:00
2020-01-20 16:37:45 -08:00
2020-01-20 16:37:45 -08:00
2021-09-18 13:40:27 +02:00
2020-01-20 16:37:45 -08:00