public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: andrii@kernel.org, daniel@iogearbox.net, ast@kernel.org,
	olsajiri@gmail.com, quentin@isovalent.com,
	alan.maguire@oracle.com, martin.lau@linux.dev, eddyz87@gmail.com,
	song@kernel.org, yonghong.song@linux.dev,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/2] bpf: Have bpf_rdonly_cast() take a const pointer
Date: Tue, 6 Feb 2024 14:42:22 +0100	[thread overview]
Message-ID: <ZcI3Pt6Gr45wiig7@krava> (raw)
In-Reply-To: <dfd3823f11ffd2d4c838e961d61ec9ae8a646773.1707080349.git.dxu@dxuuu.xyz>

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

  parent reply	other threads:[~2024-02-06 13:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 21:06 [PATCH bpf-next v2 0/2] bpf, bpftool: Support dumping kfunc prototypes from BTF Daniel Xu
2024-02-04 21:06 ` [PATCH bpf-next v2 1/2] bpf: Have bpf_rdonly_cast() take a const pointer Daniel Xu
2024-02-05  0:32   ` Yonghong Song
2024-02-06 13:42   ` Jiri Olsa [this message]
2024-02-06 15:44     ` Daniel Xu
2024-02-06 16:03       ` Jiri Olsa
2024-02-06 17:32       ` Andrii Nakryiko
2024-02-04 21:06 ` [PATCH bpf-next v2 2/2] bpftool: Support dumping kfunc prototypes from BTF Daniel Xu
2024-02-08  0:50   ` Andrii Nakryiko
2024-03-18 18:37     ` Daniel Xu
2024-02-13 19:09 ` [PATCH bpf-next v2 0/2] bpf, " Andrii Nakryiko
2024-02-13 21:08   ` Daniel Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcI3Pt6Gr45wiig7@krava \
    --to=olsajiri@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=quentin@isovalent.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox