[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKH8qBsyR1tJnLcJc=0p7Qxbh+nRGX0h+bb1STS6_=qA9iFVjw@mail.gmail.com>
Date: Thu, 2 Jun 2022 09:49:00 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: kernel test robot <lkp@...el.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, llvm@...ts.linux.dev,
kbuild-all@...ts.01.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org
Subject: Re: [PATCH bpf-next v8 03/11] bpf: per-cgroup lsm flavor
On Wed, Jun 1, 2022 at 11:17 PM kernel test robot <lkp@...el.com> wrote:
>
> Hi Stanislav,
>
> Thank you for the patch! Perhaps something to improve:
This is a config without CONFIG_BPF_LSM and it makes CGROUP_LSM_START
greater than CGROUP_LSM_END (to make sure we don't
waste slots on non-CONFIG_BPF_LSM builds) and it screws up
(atype >= CGROUP_LSM_START && atype <= CGROUP_LSM_END) check.
I'll add an ifdef around that.
> [auto build test WARNING on bpf-next/master]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Stanislav-Fomichev/bpf-cgroup_sock-lsm-flavor/20220602-050600
> base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> config: i386-randconfig-a004 (https://download.01.org/0day-ci/archive/20220602/202206021403.M9hFZdbY-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project b364c76683f8ef241025a9556300778c07b590c2)
> 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/584b25fdd30894c312d577f4b6b83f93d64e464b
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Stanislav-Fomichev/bpf-cgroup_sock-lsm-flavor/20220602-050600
> git checkout 584b25fdd30894c312d577f4b6b83f93d64e464b
> # 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 kernel/bpf/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@...el.com>
>
> All warnings (new ones prefixed by >>):
>
> >> kernel/bpf/cgroup.c:257:35: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
> if (atype >= CGROUP_LSM_START && atype <= CGROUP_LSM_END)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
> kernel/bpf/cgroup.c:252:35: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
> if (atype >= CGROUP_LSM_START && atype <= CGROUP_LSM_END)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
> 2 warnings generated.
>
>
> vim +257 kernel/bpf/cgroup.c
>
> 226
> 227 /**
> 228 * cgroup_bpf_release() - put references of all bpf programs and
> 229 * release all cgroup bpf data
> 230 * @work: work structure embedded into the cgroup to modify
> 231 */
> 232 static void cgroup_bpf_release(struct work_struct *work)
> 233 {
> 234 struct cgroup *p, *cgrp = container_of(work, struct cgroup,
> 235 bpf.release_work);
> 236 struct bpf_prog_array *old_array;
> 237 struct list_head *storages = &cgrp->bpf.storages;
> 238 struct bpf_cgroup_storage *storage, *stmp;
> 239
> 240 unsigned int atype;
> 241
> 242 mutex_lock(&cgroup_mutex);
> 243
> 244 for (atype = 0; atype < ARRAY_SIZE(cgrp->bpf.progs); atype++) {
> 245 struct hlist_head *progs = &cgrp->bpf.progs[atype];
> 246 struct bpf_prog_list *pl;
> 247 struct hlist_node *pltmp;
> 248
> 249 hlist_for_each_entry_safe(pl, pltmp, progs, node) {
> 250 hlist_del(&pl->node);
> 251 if (pl->prog) {
> 252 if (atype >= CGROUP_LSM_START && atype <= CGROUP_LSM_END)
> 253 bpf_trampoline_unlink_cgroup_shim(pl->prog);
> 254 bpf_prog_put(pl->prog);
> 255 }
> 256 if (pl->link) {
> > 257 if (atype >= CGROUP_LSM_START && atype <= CGROUP_LSM_END)
> 258 bpf_trampoline_unlink_cgroup_shim(pl->link->link.prog);
> 259 bpf_cgroup_link_auto_detach(pl->link);
> 260 }
> 261 kfree(pl);
> 262 static_branch_dec(&cgroup_bpf_enabled_key[atype]);
> 263 }
> 264 old_array = rcu_dereference_protected(
> 265 cgrp->bpf.effective[atype],
> 266 lockdep_is_held(&cgroup_mutex));
> 267 bpf_prog_array_free(old_array);
> 268 }
> 269
> 270 list_for_each_entry_safe(storage, stmp, storages, list_cg) {
> 271 bpf_cgroup_storage_unlink(storage);
> 272 bpf_cgroup_storage_free(storage);
> 273 }
> 274
> 275 mutex_unlock(&cgroup_mutex);
> 276
> 277 for (p = cgroup_parent(cgrp); p; p = cgroup_parent(p))
> 278 cgroup_bpf_put(p);
> 279
> 280 percpu_ref_exit(&cgrp->bpf.refcnt);
> 281 cgroup_put(cgrp);
> 282 }
> 283
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
Powered by blists - more mailing lists