All of lore.kernel.org
 help / color / mirror / Atom feed
* [rgushchin:bpfoom.3.9 3/17] kernel/bpf/bpf_struct_ops.c:1417:10: error: implicit declaration of function 'cgroup_get_from_fd'; did you mean 'cgroup_id_from_mm'?
@ 2026-01-23 21:11 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-01-23 21:11 UTC (permalink / raw)
  To: Roman Gushchin; +Cc: oe-kbuild-all

tree:   https://github.com/rgushchin/linux.git bpfoom.3.9
head:   4d25d8446dbd73d9adfdbc35c139e6b4fb16f158
commit: 549fc9aaf5c8051e33cecc2faeb4033f267298e6 [3/17] bpf: allow attaching struct_ops to cgroups
config: sparc64-randconfig-r132-20260123 (https://download.01.org/0day-ci/archive/20260124/202601240548.Y30ROSs6-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260124/202601240548.Y30ROSs6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601240548.Y30ROSs6-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/bpf/bpf_struct_ops.c: In function 'bpf_struct_ops_link_create':
>> kernel/bpf/bpf_struct_ops.c:1417:10: error: implicit declaration of function 'cgroup_get_from_fd'; did you mean 'cgroup_id_from_mm'? [-Werror=implicit-function-declaration]
      cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
             ^~~~~~~~~~~~~~~~~~
             cgroup_id_from_mm
   kernel/bpf/bpf_struct_ops.c:1417:8: warning: assignment to 'struct cgroup *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
           ^
>> kernel/bpf/bpf_struct_ops.c:1425:4: error: implicit declaration of function 'cgroup_put'; did you mean 'cgroup_init'? [-Werror=implicit-function-declaration]
       cgroup_put(cgrp);
       ^~~~~~~~~~
       cgroup_init
   cc1: some warnings being treated as errors


vim +1417 kernel/bpf/bpf_struct_ops.c

  1382	
  1383	int bpf_struct_ops_link_create(union bpf_attr *attr)
  1384	{
  1385		struct bpf_struct_ops_link *link = NULL;
  1386		struct bpf_link_primer link_primer;
  1387		struct bpf_struct_ops_map *st_map;
  1388		struct bpf_map *map;
  1389		struct cgroup *cgrp;
  1390		int err;
  1391	
  1392		if (attr->link_create.flags & ~BPF_F_CGROUP_FD)
  1393			return -EINVAL;
  1394	
  1395		map = bpf_map_get(attr->link_create.map_fd);
  1396		if (IS_ERR(map))
  1397			return PTR_ERR(map);
  1398	
  1399		st_map = (struct bpf_struct_ops_map *)map;
  1400	
  1401		if (!bpf_struct_ops_valid_to_reg(map)) {
  1402			err = -EINVAL;
  1403			goto err_out;
  1404		}
  1405	
  1406		link = kzalloc(sizeof(*link), GFP_USER);
  1407		if (!link) {
  1408			err = -ENOMEM;
  1409			goto err_out;
  1410		}
  1411		bpf_link_init(&link->link, BPF_LINK_TYPE_STRUCT_OPS, &bpf_struct_ops_map_lops, NULL,
  1412			      attr->link_create.attach_type);
  1413	
  1414		init_waitqueue_head(&link->wait_hup);
  1415	
  1416		if (attr->link_create.flags & BPF_F_CGROUP_FD) {
> 1417			cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
  1418			if (IS_ERR(cgrp)) {
  1419				err = PTR_ERR(cgrp);
  1420				goto err_out;
  1421			}
  1422			link->cgroup = cgrp;
  1423			err = cgroup_bpf_attach_struct_ops(cgrp, link);
  1424			if (err) {
> 1425				cgroup_put(cgrp);
  1426				link->cgroup = NULL;
  1427				goto err_out;
  1428			}
  1429		}
  1430	
  1431		err = bpf_link_prime(&link->link, &link_primer);
  1432		if (err)
  1433			goto err_put_cgroup;
  1434	
  1435		/* Hold the update_mutex such that the subsystem cannot
  1436		 * do link->ops->detach() before the link is fully initialized.
  1437		 */
  1438		mutex_lock(&update_mutex);
  1439		err = st_map->st_ops_desc->st_ops->reg(st_map->kvalue.data, &link->link);
  1440		if (err) {
  1441			mutex_unlock(&update_mutex);
  1442			bpf_link_cleanup(&link_primer);
  1443			link = NULL;
  1444			goto err_put_cgroup;
  1445		}
  1446		RCU_INIT_POINTER(link->map, map);
  1447		mutex_unlock(&update_mutex);
  1448	
  1449		return bpf_link_settle(&link_primer);
  1450	
  1451	err_put_cgroup:
  1452		if (link && link->cgroup)
  1453			cgroup_bpf_detach_struct_ops(link->cgroup, link);
  1454	err_out:
  1455		bpf_map_put(map);
  1456		kfree(link);
  1457		return err;
  1458	}
  1459	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-23 21:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 21:11 [rgushchin:bpfoom.3.9 3/17] kernel/bpf/bpf_struct_ops.c:1417:10: error: implicit declaration of function 'cgroup_get_from_fd'; did you mean 'cgroup_id_from_mm'? kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.