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] [day] [month] [year] [list]
Message-ID: <109e3d8a-26c6-44c8-aabe-04d5c47ec9c8@iogearbox.net>
Date:   Fri, 18 Nov 2022 23:29:07 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Liao Chang <liaochang1@...wei.com>, ast@...nel.org,
        andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
        yhs@...com, john.fastabend@...il.com, kpsingh@...nel.org,
        sdf@...gle.com, haoluo@...gle.com, jolsa@...nel.org
Cc:     bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] samples/bpf: Fix duplicate struct define in test_lru_dist
 sample

On 11/18/22 1:47 AM, Liao Chang wrote:
> Build sample/bpf report error as follow:
> 
>    CC  ./samples/bpf/test_lru_dist
> ./samples/bpf/test_lru_dist.c:35:8: error: redefinition of ‘struct list_head’
>     35 | struct list_head {
>        |        ^~~~~~~~~
> In file included from ./samples/bpf/test_lru_dist.c:6:
> ./tools/include/linux/types.h:84:8: note: originally defined here
>     84 | struct list_head {
> 
> Remove the duplicate definition of struct list_head in test_lru_dist.c
> 
> Signed-off-by: Liao Chang <liaochang1@...wei.com>
> ---
>   samples/bpf/test_lru_dist.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/samples/bpf/test_lru_dist.c b/samples/bpf/test_lru_dist.c
> index 5efb91763d65..2e7341044090 100644
> --- a/samples/bpf/test_lru_dist.c
> +++ b/samples/bpf/test_lru_dist.c
> @@ -32,10 +32,6 @@ static int nr_cpus;
>   static unsigned long long *dist_keys;
>   static unsigned int dist_key_counts;
>   
> -struct list_head {
> -	struct list_head *next, *prev;
> -};
> -

This will actually break it, see CI:

https://github.com/kernel-patches/bpf/actions/runs/3500019006/jobs/5862316961

   [...]
   CLANG-bpf  /tmp/work/bpf/bpf/samples/bpf/lathist_kern.o
     CLANG-bpf  /tmp/work/bpf/bpf/samples/bpf/offwaketime_kern.o
     CLANG-bpf  /tmp/work/bpf/bpf/samples/bpf/spintest_kern.o
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:35:42: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      35 | static inline void INIT_LIST_HEAD(struct list_head *list)
         |                                          ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘INIT_LIST_HEAD’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:37:6: error: dereferencing pointer to incomplete type ‘struct list_head’
      37 |  list->next = list;
         |      ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:41:43: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      41 | static inline int list_empty(const struct list_head *head)
         |                                           ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_empty’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:43:13: error: dereferencing pointer to incomplete type ‘const struct list_head’
      43 |  return head->next == head;
         |             ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:46:38: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      46 | static inline void __list_add(struct list_head *new,
         |                                      ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_add’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:50:6: error: dereferencing pointer to incomplete type ‘struct list_head’
      50 |  next->prev = new;
         |      ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:36: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      56 | static inline void list_add(struct list_head *new, struct list_head *head)
         |                                    ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_add’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:28: error: dereferencing pointer to incomplete type ‘struct list_head’
      58 |  __list_add(new, head, head->next);
     CLANG-bpf  /tmp/work/bpf/bpf/samples/bpf/map_perf_test_kern.o
         |                            ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:13: warning: passing argument 1 of ‘__list_add’ from incompatible pointer type [-Wincompatible-pointer-types]
      58 |  __list_add(new, head, head->next);
         |             ^~~
         |             |
         |             struct list_head *
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:46:49: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’
      46 | static inline void __list_add(struct list_head *new,
         |                               ~~~~~~~~~~~~~~~~~~^~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:58:18: warning: passing argument 2 of ‘__list_add’ from incompatible pointer type [-Wincompatible-pointer-types]
      58 |  __list_add(new, head, head->next);
         |                  ^~~~
         |                  |
         |                  struct list_head *
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:47:28: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’
      47 |          struct list_head *prev,
         |          ~~~~~~~~~~~~~~~~~~^~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:61:38: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      61 | static inline void __list_del(struct list_head *prev, struct list_head *next)
         |                                      ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_del’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:63:6: error: dereferencing pointer to incomplete type ‘struct list_head’
      63 |  next->prev = prev;
         |      ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:67:44: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      67 | static inline void __list_del_entry(struct list_head *entry)
         |                                            ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘__list_del_entry’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:69:18: error: dereferencing pointer to incomplete type ‘struct list_head’
      69 |  __list_del(entry->prev, entry->next);
         |                  ^~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:72:37: warning: ‘struct list_head’ declared inside parameter list will not be visible outside of this definition or declaration
      72 | static inline void list_move(struct list_head *list, struct list_head *head)
         |                                     ^~~~~~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: In function ‘list_move’:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:74:19: warning: passing argument 1 of ‘__list_del_entry’ from incompatible pointer type [-Wincompatible-pointer-types]
      74 |  __list_del_entry(list);
         |                   ^~~~
         |                   |
         |                   struct list_head *
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:67:55: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’
      67 | static inline void __list_del_entry(struct list_head *entry)
         |                                     ~~~~~~~~~~~~~~~~~~^~~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:75:11: warning: passing argument 1 of ‘list_add’ from incompatible pointer type [-Wincompatible-pointer-types]
      75 |  list_add(list, head);
         |           ^~~~
         |           |
         |           struct list_head *
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:47: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’
      56 | static inline void list_add(struct list_head *new, struct list_head *head)
         |                             ~~~~~~~~~~~~~~~~~~^~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:75:17: warning: passing argument 2 of ‘list_add’ from incompatible pointer type [-Wincompatible-pointer-types]
      75 |  list_add(list, head);
         |                 ^~~~
         |                 |
         |                 struct list_head *
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:56:70: note: expected ‘struct list_head *’ but argument is of type ‘struct list_head *’
      56 | static inline void list_add(struct list_head *new, struct list_head *head)
         |                                                    ~~~~~~~~~~~~~~~~~~^~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c: At top level:
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:85:19: error: field ‘list’ has incomplete type
      85 |  struct list_head list;
         |                   ^~~~
   /tmp/work/bpf/bpf/samples/bpf/test_lru_dist.c:90:19: error: field ‘list’ has incomplete type
      90 |  struct list_head list;
         |                   ^~~~
     CLANG-bpf  /tmp/work/bpf/bpf/samples/bpf/test_overhead_tp_kern.o
   make[3]: *** [/tmp/work/bpf/bpf/samples/bpf/Makefile.target:58: /tmp/work/bpf/bpf/samples/bpf/test_lru_dist] Error 1
   make[3]: *** Waiting for unfinished jobs....
     LD      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/libbpf/staticobjs/libbpf-in.o
     LINK    /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/libbpf/libbpf.a
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/main.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/common.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/json_writer.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/gen.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/btf.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/xlated_dumper.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/btf_dumper.o
     CC      /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/disasm.o
     LINK    /tmp/work/bpf/bpf/samples/bpf/bpftool/bootstrap/bpftool
   make[2]: *** [/tmp/work/bpf/bpf/Makefile:1992: /tmp/work/bpf/bpf/samples/bpf] Error 2
   make[2]: Leaving directory '/tmp/work/bpf/bpf/kbuild-output'
   make[1]: *** [Makefile:231: __sub-make] Error 2
   make[1]: Leaving directory '/tmp/work/bpf/bpf'
   make: *** [Makefile:269: all] Error 2
   make: Leaving directory '/tmp/work/bpf/bpf/samples/bpf'
   Error: Process completed with exit code 2.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ