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: <202211302135.JfiXsPjn-lkp@intel.com>
Date:   Wed, 30 Nov 2022 21:13:37 +0800
From:   kernel test robot <lkp@...el.com>
To:     Waiman Long <longman@...hat.com>, Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Juri Lelli <juri.lelli@...hat.com>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
        Daniel Bristot de Oliveira <bristot@...hat.com>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        Phil Auld <pauld@...hat.com>, linux-kernel@...r.kernel.org,
        Waiman Long <longman@...hat.com>
Subject: Re: [PATCH-tip v2] sched: Use kfree_rcu() in do_set_cpus_allowed()

Hi Waiman,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/sched/core]
[also build test ERROR on tip/master tip/auto-latest next-20221130]
[cannot apply to linus/master v6.1-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Waiman-Long/sched-Use-kfree_rcu-in-do_set_cpus_allowed/20221129-092940
patch link:    https://lore.kernel.org/r/20221129012643.1382368-1-longman%40redhat.com
patch subject: [PATCH-tip v2] sched: Use kfree_rcu() in do_set_cpus_allowed()
config: i386-randconfig-r025-20221128
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/intel-lab-lkp/linux/commit/a04360654add5d890983b0da53f792f63ef0b9f7
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Waiman-Long/sched-Use-kfree_rcu-in-do_set_cpus_allowed/20221129-092940
        git checkout a04360654add5d890983b0da53f792f63ef0b9f7
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

>> kernel/sched/core.c:8228:36: error: invalid application of 'sizeof' to an incomplete type 'union cpumask_rcuhead'
           size = max_t(int, cpumask_size(), sizeof(union cpumask_rcuhead));
                                             ^     ~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:112:59: note: expanded from macro 'max_t'
   #define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)
                                                                   ^
   include/linux/minmax.h:36:38: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                               ^
   include/linux/minmax.h:26:19: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                                   ^
   include/linux/minmax.h:20:39: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                                                ^
   kernel/sched/core.c:8228:49: note: forward declaration of 'union cpumask_rcuhead'
           size = max_t(int, cpumask_size(), sizeof(union cpumask_rcuhead));
                                                          ^
>> kernel/sched/core.c:8228:36: error: invalid application of 'sizeof' to an incomplete type 'union cpumask_rcuhead'
           size = max_t(int, cpumask_size(), sizeof(union cpumask_rcuhead));
                                             ^     ~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:112:59: note: expanded from macro 'max_t'
   #define max_t(type, x, y)       __careful_cmp((type)(x), (type)(y), >)
                                                                   ^
   include/linux/minmax.h:36:38: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                               ^
   include/linux/minmax.h:26:46: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                                                              ^
   include/linux/minmax.h:23:40: note: expanded from macro '__no_side_effects'
                   (__is_constexpr(x) && __is_constexpr(y))
                                                        ^
   include/linux/const.h:12:48: note: expanded from macro '__is_constexpr'
           (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
                                                         ^
   kernel/sched/core.c:8228:49: note: forward declaration of 'union cpumask_rcuhead'
           size = max_t(int, cpumask_size(), sizeof(union cpumask_rcuhead));
                                                          ^
   2 errors generated.


vim +8228 kernel/sched/core.c

  8186	
  8187	long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
  8188	{
  8189		struct affinity_context ac;
  8190		struct cpumask *user_mask;
  8191		struct task_struct *p;
  8192		int retval, size;
  8193	
  8194		rcu_read_lock();
  8195	
  8196		p = find_process_by_pid(pid);
  8197		if (!p) {
  8198			rcu_read_unlock();
  8199			return -ESRCH;
  8200		}
  8201	
  8202		/* Prevent p going away */
  8203		get_task_struct(p);
  8204		rcu_read_unlock();
  8205	
  8206		if (p->flags & PF_NO_SETAFFINITY) {
  8207			retval = -EINVAL;
  8208			goto out_put_task;
  8209		}
  8210	
  8211		if (!check_same_owner(p)) {
  8212			rcu_read_lock();
  8213			if (!ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE)) {
  8214				rcu_read_unlock();
  8215				retval = -EPERM;
  8216				goto out_put_task;
  8217			}
  8218			rcu_read_unlock();
  8219		}
  8220	
  8221		retval = security_task_setscheduler(p);
  8222		if (retval)
  8223			goto out_put_task;
  8224	
  8225		/*
  8226		 * See do_set_cpus_allowed() for the rcu_head usage.
  8227		 */
> 8228		size = max_t(int, cpumask_size(), sizeof(union cpumask_rcuhead));
  8229		user_mask = kmalloc(size, GFP_KERNEL);
  8230		if (!user_mask) {
  8231			retval = -ENOMEM;
  8232			goto out_put_task;
  8233		}
  8234		cpumask_copy(user_mask, in_mask);
  8235		ac = (struct affinity_context){
  8236			.new_mask  = in_mask,
  8237			.user_mask = user_mask,
  8238			.flags     = SCA_USER,
  8239		};
  8240	
  8241		retval = __sched_setaffinity(p, &ac);
  8242		kfree(ac.user_mask);
  8243	
  8244	out_put_task:
  8245		put_task_struct(p);
  8246		return retval;
  8247	}
  8248	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (118813 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ