[luto:sched/lazymm 8/14] fs/exec.c:1018:9: warning: variable 'active_mm' is uninitialized when used here
From: kernel test robot
Date: Sat Jul 03 2021 - 18:14:57 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git sched/lazymm
head: 755ebd64bdde9503ba31bdcda9bb7cc5fe8b73b4
commit: ed4e648f7e1f8c6251b883ff42675ff291ee68dc [8/14] sched, exec: Move the activate_mm() call sequence into sched/core.c
config: x86_64-randconfig-a004-20210704 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project cb5de7c813f976dd458bd2a7f40702ba648bf650)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/commit/?id=ed4e648f7e1f8c6251b883ff42675ff291ee68dc
git remote add luto https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git
git fetch --no-tags luto sched/lazymm
git checkout ed4e648f7e1f8c6251b883ff42675ff291ee68dc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> fs/exec.c:1018:9: warning: variable 'active_mm' is uninitialized when used here [-Wuninitialized]
mmdrop(active_mm);
^~~~~~~~~
fs/exec.c:975:38: note: initialize the variable 'active_mm' to silence this warning
struct mm_struct *old_mm, *active_mm;
^
= NULL
1 warning generated.
vim +/active_mm +1018 fs/exec.c
3dc20cb282ec03 Al Viro 2013-04-13 966
eea9673250db4e Eric W. Biederman 2020-03-25 967 /*
eea9673250db4e Eric W. Biederman 2020-03-25 968 * Maps the mm_struct mm into the current task struct.
f7cfd871ae0c50 Eric W. Biederman 2020-12-03 969 * On success, this function returns with exec_update_lock
f7cfd871ae0c50 Eric W. Biederman 2020-12-03 970 * held for writing.
eea9673250db4e Eric W. Biederman 2020-03-25 971 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 972 static int exec_mmap(struct mm_struct *mm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 973 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 974 struct task_struct *tsk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 975 struct mm_struct *old_mm, *active_mm;
eea9673250db4e Eric W. Biederman 2020-03-25 976 int ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 977
^1da177e4c3f41 Linus Torvalds 2005-04-16 978 /* Notify parent that we're no longer interested in the old VM */
^1da177e4c3f41 Linus Torvalds 2005-04-16 979 tsk = current;
^1da177e4c3f41 Linus Torvalds 2005-04-16 980 old_mm = current->mm;
4610ba7ad877fa Thomas Gleixner 2019-11-06 981 exec_mm_release(tsk, old_mm);
a28bf136e651e1 Eric W. Biederman 2020-03-30 982 if (old_mm)
a28bf136e651e1 Eric W. Biederman 2020-03-30 983 sync_mm_rss(old_mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 984
f7cfd871ae0c50 Eric W. Biederman 2020-12-03 985 ret = down_write_killable(&tsk->signal->exec_update_lock);
eea9673250db4e Eric W. Biederman 2020-03-25 986 if (ret)
eea9673250db4e Eric W. Biederman 2020-03-25 987 return ret;
eea9673250db4e Eric W. Biederman 2020-03-25 988
^1da177e4c3f41 Linus Torvalds 2005-04-16 989 if (old_mm) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 990 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 991 * Make sure that if there is a core dump in progress
^1da177e4c3f41 Linus Torvalds 2005-04-16 992 * for the old mm, we get out and die instead of going
c1e8d7c6a7a682 Michel Lespinasse 2020-06-08 993 * through with the exec. We must hold mmap_lock around
999d9fc1670bc0 Oleg Nesterov 2008-07-25 994 * checking core_state and changing tsk->mm.
^1da177e4c3f41 Linus Torvalds 2005-04-16 995 */
d8ed45c5dcd455 Michel Lespinasse 2020-06-08 996 mmap_read_lock(old_mm);
999d9fc1670bc0 Oleg Nesterov 2008-07-25 997 if (unlikely(old_mm->core_state)) {
d8ed45c5dcd455 Michel Lespinasse 2020-06-08 998 mmap_read_unlock(old_mm);
f7cfd871ae0c50 Eric W. Biederman 2020-12-03 999 up_write(&tsk->signal->exec_update_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1000 return -EINTR;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1001 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1002 }
eea9673250db4e Eric W. Biederman 2020-03-25 1003
^1da177e4c3f41 Linus Torvalds 2005-04-16 1004 task_lock(tsk);
227a4aadc75ba2 Mathieu Desnoyers 2019-09-19 1005 membarrier_exec_mmap(mm);
ed4e648f7e1f8c Andy Lutomirski 2021-06-22 1006 __activate_mm(mm);
615d6e8756c871 Davidlohr Bueso 2014-04-07 1007 tsk->mm->vmacache_seqnum = 0;
615d6e8756c871 Davidlohr Bueso 2014-04-07 1008 vmacache_flush(tsk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1009 task_unlock(tsk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1010 if (old_mm) {
d8ed45c5dcd455 Michel Lespinasse 2020-06-08 1011 mmap_read_unlock(old_mm);
7dddb12c63553d Eric Sesterhenn 2006-04-01 1012 BUG_ON(active_mm != old_mm);
701085b219016d Oleg Nesterov 2012-03-19 1013 setmax_mm_hiwater_rss(&tsk->signal->maxrss, old_mm);
31a78f23bac006 Balbir Singh 2008-09-28 1014 mm_update_next_owner(old_mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1015 mmput(old_mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1016 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1017 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 @1018 mmdrop(active_mm);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1019 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1020 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1021
:::::: The code at line 1018 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip