All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@google.com>
To: kernel test robot <lkp@intel.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	llvm@lists.linux.dev,  kbuild-all@lists.01.org, ast@kernel.org,
	daniel@iogearbox.net,  andrii@kernel.org
Subject: Re: [PATCH bpf-next v8 03/11] bpf: per-cgroup lsm flavor
Date: Thu, 2 Jun 2022 09:49:00 -0700	[thread overview]
Message-ID: <CAKH8qBsyR1tJnLcJc=0p7Qxbh+nRGX0h+bb1STS6_=qA9iFVjw@mail.gmail.com> (raw)
In-Reply-To: <202206021403.M9hFZdbY-lkp@intel.com>

On Wed, Jun 1, 2022 at 11:17 PM kernel test robot <lkp@intel.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@intel.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

WARNING: multiple messages have this Message-ID (diff)
From: Stanislav Fomichev <sdf@google.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH bpf-next v8 03/11] bpf: per-cgroup lsm flavor
Date: Thu, 02 Jun 2022 09:49:00 -0700	[thread overview]
Message-ID: <CAKH8qBsyR1tJnLcJc=0p7Qxbh+nRGX0h+bb1STS6_=qA9iFVjw@mail.gmail.com> (raw)
In-Reply-To: <202206021403.M9hFZdbY-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 5547 bytes --]

On Wed, Jun 1, 2022 at 11:17 PM kernel test robot <lkp@intel.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(a)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@intel.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

  reply	other threads:[~2022-06-02 16:49 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 19:02 [PATCH bpf-next v8 00/11] bpf: cgroup_sock lsm flavor Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 01/11] bpf: add bpf_func_t and trampoline helpers Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 02/11] bpf: convert cgroup_bpf.progs to hlist Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 03/11] bpf: per-cgroup lsm flavor Stanislav Fomichev
2022-06-02  6:16   ` kernel test robot
2022-06-02 16:49     ` Stanislav Fomichev [this message]
2022-06-02 16:49       ` Stanislav Fomichev
2022-06-04  6:11   ` Martin KaFai Lau
2022-06-04  8:27     ` Martin KaFai Lau
2022-06-06 22:46       ` Stanislav Fomichev
2022-06-06 22:46     ` Stanislav Fomichev
2022-06-07 19:24       ` Martin KaFai Lau
2022-06-01 19:02 ` [PATCH bpf-next v8 04/11] bpf: minimize number of allocated lsm slots per program Stanislav Fomichev
2022-06-04  6:35   ` Martin KaFai Lau
2022-06-06 22:46     ` Stanislav Fomichev
2022-06-07 19:57       ` Martin KaFai Lau
2022-06-01 19:02 ` [PATCH bpf-next v8 05/11] bpf: implement BPF_PROG_QUERY for BPF_LSM_CGROUP Stanislav Fomichev
2022-06-04  6:59   ` Martin KaFai Lau
2022-06-04  8:05     ` Martin KaFai Lau
2022-06-06 22:46     ` Stanislav Fomichev
2022-06-07 20:44       ` Martin KaFai Lau
2022-06-01 19:02 ` [PATCH bpf-next v8 06/11] bpf: allow writing to a subset of sock fields from lsm progtype Stanislav Fomichev
2022-06-04  7:18   ` Martin KaFai Lau
2022-06-06 22:46     ` Stanislav Fomichev
2022-06-07 22:17       ` Martin KaFai Lau
2022-06-01 19:02 ` [PATCH bpf-next v8 07/11] libbpf: add lsm_cgoup_sock type Stanislav Fomichev
2022-06-03 21:30   ` Andrii Nakryiko
2022-06-01 19:02 ` [PATCH bpf-next v8 08/11] libbpf: implement bpf_prog_query_opts Stanislav Fomichev
2022-06-03 21:34   ` Andrii Nakryiko
2022-06-03 23:13     ` Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 09/11] bpftool: implement cgroup tree for BPF_LSM_CGROUP Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 10/11] selftests/bpf: lsm_cgroup functional test Stanislav Fomichev
2022-06-01 19:02 ` [PATCH bpf-next v8 11/11] selftests/bpf: verify lsm_cgroup struct sock access Stanislav Fomichev
2022-06-03  1:52   ` Martin KaFai Lau
2022-06-03  1:59     ` Stanislav Fomichev
2022-06-03  5:38       ` Martin KaFai Lau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKH8qBsyR1tJnLcJc=0p7Qxbh+nRGX0h+bb1STS6_=qA9iFVjw@mail.gmail.com' \
    --to=sdf@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kbuild-all@lists.01.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.