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>] [day] [month] [year] [list]
Message-ID: <202109050826.BaXleWUe-lkp@intel.com>
Date:   Sun, 5 Sep 2021 08:49:31 +0800
From:   kernel test robot <lkp@...el.com>
To:     Cong Wang <cong.wang@...edance.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [congwang:sch_bpf 3/3] kernel/bpf/priority_queue_map.c:77:11: error:
 'struct bpf_priority_queue' has no member named 'size'

tree:   https://github.com/congwang/linux.git sch_bpf
head:   bf999641e11e4a3291fbaa9dd339162eaa3ccbe7
commit: bf999641e11e4a3291fbaa9dd339162eaa3ccbe7 [3/3] bpf: introduce priority queue based map
config: mips-randconfig-r036-20210905 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/congwang/linux/commit/bf999641e11e4a3291fbaa9dd339162eaa3ccbe7
        git remote add congwang https://github.com/congwang/linux.git
        git fetch --no-tags congwang sch_bpf
        git checkout bf999641e11e4a3291fbaa9dd339162eaa3ccbe7
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash kernel/bpf/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All error/warnings (new ones prefixed by >>):

   kernel/bpf/priority_queue_map.c: In function 'priority_queue_map_alloc':
>> kernel/bpf/priority_queue_map.c:77:11: error: 'struct bpf_priority_queue' has no member named 'size'
      77 |         pq->size = (u64) attr->max_entries + 1;
         |           ^~
>> kernel/bpf/priority_queue_map.c:80:11: error: 'struct bpf_priority_queue' has no member named 'elem_size'
      80 |         pq->elem_size = sizeof(struct bpf_priority_queue_node ) +
         |           ^~
   kernel/bpf/priority_queue_map.c: In function 'priority_queue_map_peek':
>> kernel/bpf/priority_queue_map.c:111:9: error: 'ptr' undeclared (first use in this function)
     111 |         ptr = n->key + pq->map.key_size;
         |         ^~~
   kernel/bpf/priority_queue_map.c:111:9: note: each undeclared identifier is reported only once for each function it appears in
   kernel/bpf/priority_queue_map.c:100:13: warning: unused variable 'key_size' [-Wunused-variable]
     100 |         u32 key_size = map->key_size;
         |             ^~~~~~~~
   kernel/bpf/priority_queue_map.c: In function 'priority_queue_map_pop_elem':
   kernel/bpf/priority_queue_map.c:133:9: error: 'ptr' undeclared (first use in this function)
     133 |         ptr = n->key + pq->map.key_size;
         |         ^~~
   kernel/bpf/priority_queue_map.c:122:13: warning: unused variable 'key_size' [-Wunused-variable]
     122 |         u32 key_size = map->key_size;
         |             ^~~~~~~~
   kernel/bpf/priority_queue_map.c: At top level:
>> kernel/bpf/priority_queue_map.c:152:33: warning: no previous prototype for 'alloc_priority_queue_node' [-Wmissing-prototypes]
     152 | struct bpf_priority_queue_node *alloc_priority_queue_node(struct bpf_priority_queue *pq)
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
   kernel/bpf/priority_queue_map.c: In function 'alloc_priority_queue_node':
   kernel/bpf/priority_queue_map.c:154:49: error: 'struct bpf_priority_queue' has no member named 'elem_size'
     154 |         return bpf_map_kmalloc_node(&pq->map, pq->elem_size,
         |                                                 ^~
   kernel/bpf/priority_queue_map.c: In function 'priority_queue_map_update_elem':
>> kernel/bpf/priority_queue_map.c:166:23: error: 'flags' redeclared as different kind of symbol
     166 |         unsigned long flags;
         |                       ^~~~~
   kernel/bpf/priority_queue_map.c:161:57: note: previous definition of 'flags' with type 'u64' {aka 'long long unsigned int'}
     161 |                                        void *value, u64 flags)
         |                                                     ~~~~^~~~~
   kernel/bpf/priority_queue_map.c:165:13: warning: unused variable 'key_size' [-Wunused-variable]
     165 |         u32 key_size = map->key_size;
         |             ^~~~~~~~
   kernel/bpf/priority_queue_map.c: In function 'alloc_priority_queue_node':
   kernel/bpf/priority_queue_map.c:157:1: error: control reaches end of non-void function [-Werror=return-type]
     157 | }
         | ^
   cc1: some warnings being treated as errors


vim +77 kernel/bpf/priority_queue_map.c

    63	
    64	static struct bpf_map *priority_queue_map_alloc(union bpf_attr *attr)
    65	{
    66		int numa_node = bpf_map_attr_numa_node(attr);
    67		struct bpf_priority_queue *pq;
    68		u64 size, queue_size;
    69	
    70		queue_size = sizeof(*pq) + size * attr->value_size;
    71		pq = bpf_map_area_alloc(queue_size, numa_node);
    72		if (!pq)
    73			return ERR_PTR(-ENOMEM);
    74	
    75		memset(pq, 0, sizeof(*pq));
    76		bpf_map_init_from_attr(&pq->map, attr);
  > 77		pq->size = (u64) attr->max_entries + 1;
    78		raw_spin_lock_init(&pq->lock);
    79		pq_root_init(&pq->root, bpf_priority_queue_cmp);
  > 80		pq->elem_size = sizeof(struct bpf_priority_queue_node ) +
    81				  round_up(pq->map.key_size, 8) +
    82				  round_up(pq->map.value_size, 8);
    83		return &pq->map;
    84	}
    85	
    86	/* Called when map->refcnt goes to zero, either from workqueue or from syscall */
    87	static void priority_queue_map_free(struct bpf_map *map)
    88	{
    89		struct bpf_priority_queue *pq = bpf_priority_queue(map);
    90	
    91		pq_flush(&pq->root, NULL);
    92		bpf_map_area_free(pq);
    93	}
    94	
    95	/* Called from syscall or from eBPF program */
    96	static int priority_queue_map_peek(struct bpf_map *map, void *value)
    97	{
    98		struct bpf_priority_queue *pq = bpf_priority_queue(map);
    99		struct bpf_priority_queue_node *n;
   100		u32 key_size = map->key_size;
   101		struct pq_node *node;
   102		unsigned long flags;
   103	
   104		raw_spin_lock_irqsave(&pq->lock, flags);
   105		node = pq_top(&pq->root);
   106		if (!node) {
   107			raw_spin_unlock_irqrestore(&pq->lock, flags);
   108			return -ENOENT;
   109		}
   110		n = container_of(node, struct bpf_priority_queue_node, node);
 > 111		ptr = n->key + pq->map.key_size;
   112		memcpy(value, ptr, pq->map.value_size);
   113		raw_spin_unlock_irqrestore(&pq->lock, flags);
   114		return 0;
   115	}
   116	
   117	/* Called from syscall or from eBPF program */
   118	static int priority_queue_map_pop_elem(struct bpf_map *map, void *value)
   119	{
   120		struct bpf_priority_queue *pq = bpf_priority_queue(map);
   121		struct bpf_priority_queue_node *n;
   122		u32 key_size = map->key_size;
   123		struct pq_node *node;
   124		unsigned long flags;
   125	
   126		raw_spin_lock_irqsave(&pq->lock, flags);
   127		node = pq_pop(&pq->root);
   128		if (!node) {
   129			raw_spin_unlock_irqrestore(&pq->lock, flags);
   130			return -ENOENT;
   131		}
   132		n = container_of(node, struct bpf_priority_queue_node, node);
   133		ptr = n->key + pq->map.key_size;
   134		memcpy(value, ptr, pq->map.value_size);
   135		raw_spin_unlock_irqrestore(&pq->lock, flags);
   136		return 0;
   137	}
   138	
   139	/* Called from syscall or from eBPF program */
   140	static int priority_queue_map_push_elem(struct bpf_map *map, void *value,
   141					     u64 flags)
   142	{
   143		return -EINVAL;
   144	}
   145	
   146	/* Called from syscall or from eBPF program */
   147	static void *priority_queue_map_lookup_elem(struct bpf_map *map, void *key)
   148	{
   149		return NULL;
   150	}
   151	
 > 152	struct bpf_priority_queue_node *alloc_priority_queue_node(struct bpf_priority_queue *pq)
   153	{
   154		return bpf_map_kmalloc_node(&pq->map, pq->elem_size,
   155					     GFP_ATOMIC | __GFP_NOWARN,
   156					     pq->map.numa_node);
   157	}
   158	
   159	/* Called from syscall or from eBPF program */
   160	static int priority_queue_map_update_elem(struct bpf_map *map, void *key,
   161					       void *value, u64 flags)
   162	{
   163		struct bpf_priority_queue *pq = bpf_priority_queue(map);
   164		struct bpf_priority_queue_node *n;
   165		u32 key_size = map->key_size;
 > 166		unsigned long flags;
   167	
   168		n = alloc_priority_queue_node(pq);
   169		if (!n)
   170			return -ENOMEM;
   171		raw_spin_lock_irqsave(&pq->lock, flags);
   172		pq_push(&pq->root, &n->node);
   173		raw_spin_unlock_irqrestore(&pq->lock, flags);
   174		return 0;
   175	}
   176	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (32819 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ