Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-28 Thread Eduard Zingerman
On Tue, 2023-11-28 at 10:13 -0600, Daniel Xu wrote: [...] > > One thing for sure is memory layout of bitfields should be the same > > for both clang and gcc as it is determined by C standard. Register > > representation and how to manipulate could be different for different > > compilers. > > I

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-28 Thread Daniel Xu
On Tue, Nov 28, 2023 at 10:13:50AM -0600, Daniel Xu wrote: > On Mon, Nov 27, 2023 at 08:06:01PM -0800, Yonghong Song wrote: > > > > On 11/27/23 7:01 PM, Daniel Xu wrote: > > > On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: > > > > On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-28 Thread Daniel Xu
On Mon, Nov 27, 2023 at 08:06:01PM -0800, Yonghong Song wrote: > > On 11/27/23 7:01 PM, Daniel Xu wrote: > > On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: > > > On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: > > > > On 11/27/23 12:44 AM, Yonghong Song wrote: > > > > >

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-28 Thread Andrii Nakryiko
On Mon, Nov 27, 2023 at 8:06 PM Yonghong Song wrote: > > > On 11/27/23 7:01 PM, Daniel Xu wrote: > > On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: > >> On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: > >>> On 11/27/23 12:44 AM, Yonghong Song wrote: > On 11/26/23

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-27 Thread Yonghong Song
On 11/27/23 7:01 PM, Daniel Xu wrote: On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: On 11/27/23 12:44 AM, Yonghong Song wrote: On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-27 Thread Daniel Xu
On Mon, Nov 27, 2023 at 02:45:11PM -0600, Daniel Xu wrote: > On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: > > > > On 11/27/23 12:44 AM, Yonghong Song wrote: > > > > > > On 11/26/23 8:52 PM, Eduard Zingerman wrote: > > > > On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: > >

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-27 Thread Daniel Xu
On Sun, Nov 26, 2023 at 09:53:04PM -0800, Yonghong Song wrote: > > On 11/27/23 12:44 AM, Yonghong Song wrote: > > > > On 11/26/23 8:52 PM, Eduard Zingerman wrote: > > > On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: > > > [...] > > > > > Tbh I'm not sure. This test passes with

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/27/23 12:44 AM, Yonghong Song wrote: On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: [...] Tbh I'm not sure. This test passes with preserve_static_offset because it suppresses preserve_access_index. In general clang translates bitfield

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/26/23 8:52 PM, Eduard Zingerman wrote: On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: [...] Tbh I'm not sure. This test passes with preserve_static_offset because it suppresses preserve_access_index. In general clang translates bitfield access to a set of IR statements like: C:

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Yonghong Song
On 11/26/23 3:14 PM, Eduard Zingerman wrote: On Sat, 2023-11-25 at 20:22 -0800, Yonghong Song wrote: [...] --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c @@ -6,7 +6,10 @@ * modify it under the terms of version 2 of the

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Eduard Zingerman
On Sun, 2023-11-26 at 18:04 -0600, Daniel Xu wrote: [...] > > Tbh I'm not sure. This test passes with preserve_static_offset > > because it suppresses preserve_access_index. In general clang > > translates bitfield access to a set of IR statements like: > > > > C: > > struct foo { > >

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Daniel Xu
Hi, On Sun, Nov 26, 2023 at 10:14:21PM +0200, Eduard Zingerman wrote: > On Sat, 2023-11-25 at 20:22 -0800, Yonghong Song wrote: > [...] > > --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > > +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > > @@ -6,7 +6,10 @@ > >*

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-26 Thread Eduard Zingerman
On Sat, 2023-11-25 at 20:22 -0800, Yonghong Song wrote: [...] > --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > @@ -6,7 +6,10 @@ >* modify it under the terms of version 2 of the GNU General Public >* License as

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-25 Thread Yonghong Song
On 11/25/23 7:54 PM, Alexei Starovoitov wrote: On Sat, Nov 25, 2023 at 4:52 PM Yonghong Song wrote: diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c index 3065a716544d..ec7e04e012ae 100644 ---

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-25 Thread Alexei Starovoitov
On Sat, Nov 25, 2023 at 4:52 PM Yonghong Song wrote: > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > > b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c > > index 3065a716544d..ec7e04e012ae 100644 > > --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c >

Re: [PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-25 Thread Yonghong Song
On 11/22/23 1:20 PM, Daniel Xu wrote: Switching to vmlinux.h definitions seems to make the verifier very unhappy with bitfield accesses. The error is: ; md.u.md2.dir = direction; 33: (69) r1 = *(u16 *)(r2 +11) misaligned stack access off (0x0; 0x0)+-64+11 size 2 It looks like

[PATCH ipsec-next v1 6/7] bpf: selftests: test_tunnel: Disable CO-RE relocations

2023-11-22 Thread Daniel Xu
Switching to vmlinux.h definitions seems to make the verifier very unhappy with bitfield accesses. The error is: ; md.u.md2.dir = direction; 33: (69) r1 = *(u16 *)(r2 +11) misaligned stack access off (0x0; 0x0)+-64+11 size 2 It looks like disabling CO-RE relocations seem to make the