lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d530dec-e6c2-5e3a-ccf2-d65039a9969d@linux.dev>
Date:   Wed, 16 Aug 2023 20:38:40 -0700
From:   Yonghong Song <yonghong.song@...ux.dev>
To:     David Vernet <void@...ifault.com>, bpf@...r.kernel.org
Cc:     ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
        martin.lau@...ux.dev, song@...nel.org, john.fastabend@...il.com,
        kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com,
        jolsa@...nel.org, linux-kernel@...r.kernel.org,
        kernel-team@...a.com, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH bpf-next] bpf: Disable -Wmissing-declarations for
 globally-linked kfuncs



On 8/16/23 8:06 AM, David Vernet wrote:
> We recently got an lkp warning about missing declarations, as in e.g.
> [0]. This warning is largely redundant with -Wmissing-prototypes, which
> we already disable for kfuncs that have global linkage and are meant to
> be exported in BTF, and called from BPF programs. Let's also disable
> -Wmissing-declarations for kfuncs. For what it's worth, I wasn't able to
> reproduce the warning even on W <= 3, so I can't actually be 100% sure
> this fixes the issue.
> 
> [0]: https://lore.kernel.org/all/202308162115.Hn23vv3n-lkp@intel.com/

Okay, I just got a similar email to [0] which complains
   bpf_obj_new_impl, ..., bpf_cast_to_kern_ctx
missing declarations.

In the email, the used compiler is
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

Unfortunately, I did not have gcc-7 to verify this.
Also, what is the minimum gcc version kernel supports? 5.1?

> 
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202308162115.Hn23vv3n-lkp@intel.com/
> Signed-off-by: David Vernet <void@...ifault.com>
> ---
>   Documentation/bpf/kfuncs.rst                          | 4 +++-
>   kernel/bpf/bpf_iter.c                                 | 2 ++
>   kernel/bpf/cpumask.c                                  | 2 ++
>   kernel/bpf/helpers.c                                  | 2 ++
>   kernel/bpf/map_iter.c                                 | 2 ++
>   kernel/cgroup/rstat.c                                 | 2 ++
>   kernel/trace/bpf_trace.c                              | 2 ++
>   net/bpf/test_run.c                                    | 2 ++
>   net/core/filter.c                                     | 4 ++++
>   net/core/xdp.c                                        | 2 ++
>   net/ipv4/fou_bpf.c                                    | 2 ++
>   net/netfilter/nf_conntrack_bpf.c                      | 2 ++
>   net/netfilter/nf_nat_bpf.c                            | 2 ++
>   net/xfrm/xfrm_interface_bpf.c                         | 2 ++
>   tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 2 ++
>   15 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/bpf/kfuncs.rst b/Documentation/bpf/kfuncs.rst
> index 0d2647fb358d..62ce5a7b92b4 100644
> --- a/Documentation/bpf/kfuncs.rst
> +++ b/Documentation/bpf/kfuncs.rst
> @@ -36,10 +36,12 @@ prototype in a header for the wrapper kfunc.
>   
>   An example is given below::
>   
> -        /* Disables missing prototype warnings */
> +        /* Disables missing prototypes and declarations warnings */
>           __diag_push();
>           __diag_ignore_all("-Wmissing-prototypes",
>                             "Global kfuncs as their definitions will be in BTF");
> +        __diag_ignore_all("-Wmissing-declarations",
> +                          "Global kfuncs as their definitions will be in BTF");
>   
>           __bpf_kfunc struct task_struct *bpf_find_get_task_by_vpid(pid_t nr)
>           {
> diff --git a/kernel/bpf/bpf_iter.c b/kernel/bpf/bpf_iter.c
> index 96856f130cbf..b8def6e4e5e8 100644
> --- a/kernel/bpf/bpf_iter.c
> +++ b/kernel/bpf/bpf_iter.c
> @@ -785,6 +785,8 @@ struct bpf_iter_num_kern {
>   __diag_push();
>   __diag_ignore_all("-Wmissing-prototypes",
>   		  "Global functions as their definitions will be in vmlinux BTF");
> +__diag_ignore_all("-Wmissing-declarations",
> +		  "Global functions as their definitions will be in vmlinux BTF");
>   
>   __bpf_kfunc int bpf_iter_num_new(struct bpf_iter_num *it, int start, int end)
>   {
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ