[pcmoore-lsm:working-lsm_init_rework 9/41] security/lsm_init.c:400:25: sparse: sparse: cast removes address space '__rcu' of expression

Paul Moore paul at paul-moore.com
Wed Sep 17 18:02:11 UTC 2025


On Wed, Sep 17, 2025 at 9:00 AM kernel test robot <lkp at intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm.git working-lsm_init_rework
> head:   8ea7358ca612bb85eef9179ae746edeb5f1dc9ac
> commit: 9cb4dac58e465101fea4aa4f9169f1ea04149da8 [9/41] lsm: split the init code out into lsm_init.c
> config: nios2-randconfig-r133-20250917 (https://download.01.org/0day-ci/archive/20250917/202509172014.2AWygxKf-lkp@intel.com/config)
> compiler: nios2-linux-gcc (GCC) 9.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250917/202509172014.2AWygxKf-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 at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202509172014.2AWygxKf-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> security/lsm_init.c:400:25: sparse: sparse: cast removes address space '__rcu' of expression
>
> vim +/__rcu +400 security/lsm_init.c
>
>    348
>    349  static void __init ordered_lsm_init(void)
>    350  {
>    351          struct lsm_info **lsm;
>    352
>    353          if (chosen_lsm_order) {
>    354                  if (chosen_major_lsm) {
>    355                          pr_warn("security=%s is ignored because it is superseded by lsm=%s\n",
>    356                                  chosen_major_lsm, chosen_lsm_order);
>    357                          chosen_major_lsm = NULL;
>    358                  }
>    359                  ordered_lsm_parse(chosen_lsm_order, "cmdline");
>    360          } else
>    361                  ordered_lsm_parse(builtin_lsm_order, "builtin");
>    362
>    363          for (lsm = ordered_lsms; *lsm; lsm++)
>    364                  prepare_lsm(*lsm);
>    365
>    366          report_lsm_order();
>    367
>    368          init_debug("cred blob size       = %d\n", blob_sizes.lbs_cred);
>    369          init_debug("file blob size       = %d\n", blob_sizes.lbs_file);
>    370          init_debug("ib blob size         = %d\n", blob_sizes.lbs_ib);
>    371          init_debug("inode blob size      = %d\n", blob_sizes.lbs_inode);
>    372          init_debug("ipc blob size        = %d\n", blob_sizes.lbs_ipc);
>    373  #ifdef CONFIG_KEYS
>    374          init_debug("key blob size        = %d\n", blob_sizes.lbs_key);
>    375  #endif /* CONFIG_KEYS */
>    376          init_debug("msg_msg blob size    = %d\n", blob_sizes.lbs_msg_msg);
>    377          init_debug("sock blob size       = %d\n", blob_sizes.lbs_sock);
>    378          init_debug("superblock blob size = %d\n", blob_sizes.lbs_superblock);
>    379          init_debug("perf event blob size = %d\n", blob_sizes.lbs_perf_event);
>    380          init_debug("task blob size       = %d\n", blob_sizes.lbs_task);
>    381          init_debug("tun device blob size = %d\n", blob_sizes.lbs_tun_dev);
>    382          init_debug("xattr slots          = %d\n", blob_sizes.lbs_xattr_count);
>    383          init_debug("bdev blob size       = %d\n", blob_sizes.lbs_bdev);
>    384          init_debug("bpf map blob size    = %d\n", blob_sizes.lbs_bpf_map);
>    385          init_debug("bpf prog blob size   = %d\n", blob_sizes.lbs_bpf_prog);
>    386          init_debug("bpf token blob size  = %d\n", blob_sizes.lbs_bpf_token);
>    387
>    388          /*
>    389           * Create any kmem_caches needed for blobs
>    390           */
>    391          if (blob_sizes.lbs_file)
>    392                  lsm_file_cache = kmem_cache_create("lsm_file_cache",
>    393                                                     blob_sizes.lbs_file, 0,
>    394                                                     SLAB_PANIC, NULL);
>    395          if (blob_sizes.lbs_inode)
>    396                  lsm_inode_cache = kmem_cache_create("lsm_inode_cache",
>    397                                                      blob_sizes.lbs_inode, 0,
>    398                                                      SLAB_PANIC, NULL);
>    399
>  > 400          lsm_early_cred((struct cred *) current->cred);
>    401          lsm_early_task(current);
>    402          for (lsm = ordered_lsms; *lsm; lsm++)
>    403                  initialize_lsm(*lsm);
>    404  }
>    405
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

Fixed in the lsm/working-lsm_init_rework branch in case anyone wants
to take a look.  However, as the fix really doesn't have anything to
do with the IMA/EVM patch, I'll wait to repost the patchset until Mimi
has a chance to look at the IMA/EVM patch from Roberto.

-- 
paul-moore.com



More information about the Linux-security-module-archive mailing list