Re: [PATCH v1 2/3] fs: Optimize credentials reference count for backing file ops

From: kernel test robot
Date: Wed Apr 03 2024 - 11:48:10 EST


Hi Vinicius,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.9-rc2 next-20240403]
[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/Vinicius-Costa-Gomes/cred-Add-a-light-version-of-override-revert_creds/20240403-101954
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20240403021808.309900-3-vinicius.gomes%40intel.com
patch subject: [PATCH v1 2/3] fs: Optimize credentials reference count for backing file ops
config: i386-randconfig-061-20240403 (https://download.01.org/0day-ci/archive/20240403/202404032344.SKdrnkhI-lkp@xxxxxxxxx/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240403/202404032344.SKdrnkhI-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404032344.SKdrnkhI-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
fs/backing-file.c: note: in included file (through include/linux/sched/signal.h, include/linux/rcuwait.h, include/linux/percpu-rwsem.h, ...):
>> include/linux/cred.h:182:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cred const *old @@ got struct cred const [noderef] __rcu *cred @@
include/linux/cred.h:182:41: sparse: expected struct cred const *old
include/linux/cred.h:182:41: sparse: got struct cred const [noderef] __rcu *cred
>> include/linux/cred.h:182:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cred const *old @@ got struct cred const [noderef] __rcu *cred @@
include/linux/cred.h:182:41: sparse: expected struct cred const *old
include/linux/cred.h:182:41: sparse: got struct cred const [noderef] __rcu *cred
>> include/linux/cred.h:182:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cred const *old @@ got struct cred const [noderef] __rcu *cred @@
include/linux/cred.h:182:41: sparse: expected struct cred const *old
include/linux/cred.h:182:41: sparse: got struct cred const [noderef] __rcu *cred
>> include/linux/cred.h:182:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cred const *old @@ got struct cred const [noderef] __rcu *cred @@
include/linux/cred.h:182:41: sparse: expected struct cred const *old
include/linux/cred.h:182:41: sparse: got struct cred const [noderef] __rcu *cred
>> include/linux/cred.h:182:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct cred const *old @@ got struct cred const [noderef] __rcu *cred @@
include/linux/cred.h:182:41: sparse: expected struct cred const *old
include/linux/cred.h:182:41: sparse: got struct cred const [noderef] __rcu *cred

vim +182 include/linux/cred.h

58319057b78476 Andy Lutomirski 2015-09-04 174
dd60a254548056 Vinicius Costa Gomes 2024-04-02 175 /*
dd60a254548056 Vinicius Costa Gomes 2024-04-02 176 * Override creds without bumping reference count. Caller must ensure
dd60a254548056 Vinicius Costa Gomes 2024-04-02 177 * reference remains valid or has taken reference. Almost always not the
dd60a254548056 Vinicius Costa Gomes 2024-04-02 178 * interface you want. Use override_creds()/revert_creds() instead.
dd60a254548056 Vinicius Costa Gomes 2024-04-02 179 */
dd60a254548056 Vinicius Costa Gomes 2024-04-02 180 static inline const struct cred *override_creds_light(const struct cred *override_cred)
dd60a254548056 Vinicius Costa Gomes 2024-04-02 181 {
dd60a254548056 Vinicius Costa Gomes 2024-04-02 @182 const struct cred *old = current->cred;
dd60a254548056 Vinicius Costa Gomes 2024-04-02 183
dd60a254548056 Vinicius Costa Gomes 2024-04-02 184 rcu_assign_pointer(current->cred, override_cred);
dd60a254548056 Vinicius Costa Gomes 2024-04-02 185 return old;
dd60a254548056 Vinicius Costa Gomes 2024-04-02 186 }
dd60a254548056 Vinicius Costa Gomes 2024-04-02 187

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