diff mbox series

[bpf-next,v2,1/2] bpf: Have bpf_rdonly_cast() take a const pointer

Message ID dfd3823f11ffd2d4c838e961d61ec9ae8a646773.1707080349.git.dxu@dxuuu.xyz (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series bpf, bpftool: Support dumping kfunc prototypes from BTF | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for bpf-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1094 this patch: 1094
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 1066 this patch: 1066
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1111 this patch: 1111
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-17 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-18 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-36 success Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18 and -O2 optimization
bpf/vmtest-bpf-next-VM_Test-34 success Logs for x86_64-llvm-17 / veristat
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-42 success Logs for x86_64-llvm-18 / veristat
bpf/vmtest-bpf-next-VM_Test-35 success Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-30 success Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-41 success Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-37 success Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-33 success Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-31 success Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-32 success Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-40 success Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-38 success Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-39 success Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-16 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Unittests
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-13 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-15 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-10 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-17 / veristat
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17

Commit Message

Daniel Xu Feb. 4, 2024, 9:06 p.m. UTC
Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
exporting a const arg version of bpf_rdonly_cast(). This causes the
following conflicting type error when generating kfunc prototypes from
BTF:

In file included from skeleton/pid_iter.bpf.c:5:
/home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
             ^
./vmlinux.h:135625:14: note: previous declaration is here
extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;

This is b/c the kernel defines bpf_rdonly_cast() with non-const arg.
Since const arg is more permissive and thus backwards compatible, we
change the kernel definition as well to avoid conflicting type errors.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 kernel/bpf/helpers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yonghong Song Feb. 5, 2024, 12:32 a.m. UTC | #1
On 2/4/24 1:06 PM, Daniel Xu wrote:
> Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> exporting a const arg version of bpf_rdonly_cast(). This causes the
> following conflicting type error when generating kfunc prototypes from
> BTF:
>
> In file included from skeleton/pid_iter.bpf.c:5:
> /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
>               ^
> ./vmlinux.h:135625:14: note: previous declaration is here
> extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;
>
> This is b/c the kernel defines bpf_rdonly_cast() with non-const arg.
> Since const arg is more permissive and thus backwards compatible, we
> change the kernel definition as well to avoid conflicting type errors.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>

Acked-by: Yonghong Song <yonghong.song@linux.dev>
Jiri Olsa Feb. 6, 2024, 1:42 p.m. UTC | #2
On Sun, Feb 04, 2024 at 02:06:34PM -0700, Daniel Xu wrote:
> Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> exporting a const arg version of bpf_rdonly_cast(). This causes the
> following conflicting type error when generating kfunc prototypes from
> BTF:
> 
> In file included from skeleton/pid_iter.bpf.c:5:
> /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
>              ^
> ./vmlinux.h:135625:14: note: previous declaration is here
> extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;

hi,
I'm hiting more of these when compiling bpf selftests (attached),
it looks like some kfuncs declarations in bpf_kfuncs.h might be in conflict

jirka


---
  CLNG-BPF [test_maps] connect_unix_prog.bpf.o
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:11:12: error: conflicting types for 'bpf_dynptr_from_skb'
extern int bpf_dynptr_from_skb(struct __sk_buff *skb, __u64 flags,
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164853:12: note: previous declaration is here
extern int bpf_dynptr_from_skb(struct sk_buff *skb, u64 flags, struct bpf_dynptr_kern *ptr__uninit) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:19:12: error: conflicting types for 'bpf_dynptr_from_xdp'
extern int bpf_dynptr_from_xdp(struct xdp_md *xdp, __u64 flags,
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164855:12: note: previous declaration is here
extern int bpf_dynptr_from_xdp(struct xdp_buff *xdp, u64 flags, struct bpf_dynptr_kern *ptr__uninit) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:28:14: error: conflicting types for 'bpf_dynptr_slice'
extern void *bpf_dynptr_slice(const struct bpf_dynptr *ptr, __u32 offset,
             ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164747:14: note: previous declaration is here
extern void *bpf_dynptr_slice(const struct bpf_dynptr_kern *ptr, u32 offset, void *buffer__opt, u32 buffer__szk) __weak __ksym;
             ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:37:14: error: conflicting types for 'bpf_dynptr_slice_rdwr'
extern void *bpf_dynptr_slice_rdwr(const struct bpf_dynptr *ptr, __u32 offset,
             ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164749:14: note: previous declaration is here
extern void *bpf_dynptr_slice_rdwr(const struct bpf_dynptr_kern *ptr, u32 offset, void *buffer__opt, u32 buffer__szk) __weak __ksym;
             ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:40:12: error: conflicting types for 'bpf_dynptr_adjust'
extern int bpf_dynptr_adjust(const struct bpf_dynptr *ptr, __u32 start, __u32 end) __ksym __weak;
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164781:12: note: previous declaration is here
extern int bpf_dynptr_adjust(struct bpf_dynptr_kern *ptr, u32 start, u32 end) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:41:13: error: conflicting types for 'bpf_dynptr_is_null'
extern bool bpf_dynptr_is_null(const struct bpf_dynptr *ptr) __ksym __weak;
            ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164783:13: note: previous declaration is here
extern bool bpf_dynptr_is_null(struct bpf_dynptr_kern *ptr) __weak __ksym;
            ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:42:13: error: conflicting types for 'bpf_dynptr_is_rdonly'
extern bool bpf_dynptr_is_rdonly(const struct bpf_dynptr *ptr) __ksym __weak;
            ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164785:13: note: previous declaration is here
extern bool bpf_dynptr_is_rdonly(struct bpf_dynptr_kern *ptr) __weak __ksym;
            ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:43:14: error: conflicting types for 'bpf_dynptr_size'
extern __u32 bpf_dynptr_size(const struct bpf_dynptr *ptr) __ksym __weak;
             ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164787:14: note: previous declaration is here
extern __u32 bpf_dynptr_size(const struct bpf_dynptr_kern *ptr) __weak __ksym;
             ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:44:12: error: conflicting types for 'bpf_dynptr_clone'
extern int bpf_dynptr_clone(const struct bpf_dynptr *ptr, struct bpf_dynptr *clone__init) __ksym __weak;
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164789:12: note: previous declaration is here
extern int bpf_dynptr_clone(struct bpf_dynptr_kern *ptr, struct bpf_dynptr_kern *clone__uninit) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:61:12: error: conflicting types for 'bpf_sk_assign_tcp_reqsk'
extern int bpf_sk_assign_tcp_reqsk(struct __sk_buff *skb, struct sock *sk,
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164859:12: note: previous declaration is here
extern int bpf_sk_assign_tcp_reqsk(struct sk_buff *skb, struct sock *sk, struct bpf_tcp_req_attrs *attrs, int attrs__sz) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:68:12: error: conflicting types for 'bpf_get_file_xattr'
extern int bpf_get_file_xattr(struct file *file, const char *name,
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164691:12: note: previous declaration is here
extern int bpf_get_file_xattr(struct file *file, const char *name__str, struct bpf_dynptr_kern *value_ptr) __weak __ksym;
           ^
In file included from progs/connect_unix_prog.c:9:
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/bpf_kfuncs.h:75:12: error: conflicting types for 'bpf_verify_pkcs7_signature'
extern int bpf_verify_pkcs7_signature(struct bpf_dynptr *data_ptr,
           ^
/home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/tools/include/vmlinux.h:164689:12: note: previous declaration is here
extern int bpf_verify_pkcs7_signature(struct bpf_dynptr_kern *data_ptr, struct bpf_dynptr_kern *sig_ptr, struct bpf_key *trusted_keyring) __weak __ksym;
           ^
12 errors generated.
make: *** [Makefile:642: /home/jolsa/kernel/linux-qemu/tools/testing/selftests/bpf/connect_unix_prog.bpf.o] Error 1
Daniel Xu Feb. 6, 2024, 3:44 p.m. UTC | #3
Hi Jiri,

On Tue, Feb 06, 2024 at 02:42:22PM +0100, Jiri Olsa wrote:
> On Sun, Feb 04, 2024 at 02:06:34PM -0700, Daniel Xu wrote:
> > Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> > exporting a const arg version of bpf_rdonly_cast(). This causes the
> > following conflicting type error when generating kfunc prototypes from
> > BTF:
> > 
> > In file included from skeleton/pid_iter.bpf.c:5:
> > /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> > extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
> >              ^
> > ./vmlinux.h:135625:14: note: previous declaration is here
> > extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;
> 
> hi,
> I'm hiting more of these when compiling bpf selftests (attached),
> it looks like some kfuncs declarations in bpf_kfuncs.h might be in conflict

Yep, I was actually going to put that as an office hours topic on how we
want to handle that for selftests. Marking kfuncs in bpf_kfuncs.h and
bpf_experimental.h as __weak is an option. ifdef is another option.
Final option I can think of is bumping required pahole version up and
simply deleting all the kfunc definitions.

But given that pahole changes come with the feature flag, I don't see
this as a pressing issue. So I was planning on getting to that after
current outstanding patchsets (just so there's less stuff for me to
juggle).

[...]

Thanks,
Daniel
Jiri Olsa Feb. 6, 2024, 4:03 p.m. UTC | #4
On Tue, Feb 06, 2024 at 08:44:18AM -0700, Daniel Xu wrote:
> Hi Jiri,
> 
> On Tue, Feb 06, 2024 at 02:42:22PM +0100, Jiri Olsa wrote:
> > On Sun, Feb 04, 2024 at 02:06:34PM -0700, Daniel Xu wrote:
> > > Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> > > exporting a const arg version of bpf_rdonly_cast(). This causes the
> > > following conflicting type error when generating kfunc prototypes from
> > > BTF:
> > > 
> > > In file included from skeleton/pid_iter.bpf.c:5:
> > > /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> > > extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
> > >              ^
> > > ./vmlinux.h:135625:14: note: previous declaration is here
> > > extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;
> > 
> > hi,
> > I'm hiting more of these when compiling bpf selftests (attached),
> > it looks like some kfuncs declarations in bpf_kfuncs.h might be in conflict
> 
> Yep, I was actually going to put that as an office hours topic on how we
> want to handle that for selftests. Marking kfuncs in bpf_kfuncs.h and
> bpf_experimental.h as __weak is an option. ifdef is another option.
> Final option I can think of is bumping required pahole version up and
> simply deleting all the kfunc definitions.
> 
> But given that pahole changes come with the feature flag, I don't see
> this as a pressing issue. So I was planning on getting to that after
> current outstanding patchsets (just so there's less stuff for me to
> juggle).

ok, I guess if the fix goes in together with the scripts/Makefile.btf
change then we're fine

jirka
Andrii Nakryiko Feb. 6, 2024, 5:32 p.m. UTC | #5
On Tue, Feb 6, 2024 at 7:44 AM Daniel Xu <dxu@dxuuu.xyz> wrote:
>
> Hi Jiri,
>
> On Tue, Feb 06, 2024 at 02:42:22PM +0100, Jiri Olsa wrote:
> > On Sun, Feb 04, 2024 at 02:06:34PM -0700, Daniel Xu wrote:
> > > Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> > > exporting a const arg version of bpf_rdonly_cast(). This causes the
> > > following conflicting type error when generating kfunc prototypes from
> > > BTF:
> > >
> > > In file included from skeleton/pid_iter.bpf.c:5:
> > > /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> > > extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
> > >              ^
> > > ./vmlinux.h:135625:14: note: previous declaration is here
> > > extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;
> >
> > hi,
> > I'm hiting more of these when compiling bpf selftests (attached),
> > it looks like some kfuncs declarations in bpf_kfuncs.h might be in conflict
>
> Yep, I was actually going to put that as an office hours topic on how we
> want to handle that for selftests. Marking kfuncs in bpf_kfuncs.h and
> bpf_experimental.h as __weak is an option. ifdef is another option.
> Final option I can think of is bumping required pahole version up and
> simply deleting all the kfunc definitions.

I think we should mark all kfuncs in selftests as __weak. And then
audit all of them and add consts where it makes sense and make sure
that all definitions are compatible between vmlinux.h and manual
declarations. I'd rather avoid #ifdef'ing anything, it should work as
is.


>
> But given that pahole changes come with the feature flag, I don't see
> this as a pressing issue. So I was planning on getting to that after
> current outstanding patchsets (just so there's less stuff for me to
> juggle).
>
> [...]
>
> Thanks,
> Daniel
diff mbox series

Patch

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 4db1c658254c..3503949b4c1b 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2484,9 +2484,9 @@  __bpf_kfunc void *bpf_cast_to_kern_ctx(void *obj)
 	return obj;
 }
 
-__bpf_kfunc void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k)
+__bpf_kfunc void *bpf_rdonly_cast(const void *obj__ign, u32 btf_id__k)
 {
-	return obj__ign;
+	return (void *)obj__ign;
 }
 
 __bpf_kfunc void bpf_rcu_read_lock(void)