kernel/fork.c:1181: warning: Function parameter or member 'mm' not described in 'replace_mm_exe_file'

From: kernel test robot
Date: Sun Sep 03 2023 - 21:02:17 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 708283abf896dd4853e673cc8cba70acaf9bf4ea
commit: 35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc kernel/fork: factor out replacing the current MM exe_file
date: 2 years ago
:::::: branch date: 5 hours ago
:::::: commit date: 2 years ago
config: i386-allnoconfig (attached as .config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (attached as 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/202309040758.TJlCtQvv-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

kernel/fork.c:1154: warning: Function parameter or member 'mm' not described in 'set_mm_exe_file'
kernel/fork.c:1154: warning: Function parameter or member 'new_exe_file' not described in 'set_mm_exe_file'
>> kernel/fork.c:1181: warning: Function parameter or member 'mm' not described in 'replace_mm_exe_file'
>> kernel/fork.c:1181: warning: Function parameter or member 'new_exe_file' not described in 'replace_mm_exe_file'
kernel/fork.c:1218: warning: Function parameter or member 'mm' not described in 'get_mm_exe_file'
kernel/fork.c:1238: warning: Function parameter or member 'task' not described in 'get_task_exe_file'
kernel/fork.c:1263: warning: Function parameter or member 'task' not described in 'get_task_mm'
kernel/fork.c:2807: warning: expecting prototype for clone3(). Prototype was for sys_clone3() instead


vim +1181 kernel/fork.c

3864601387cf419 Jiri Slaby 2011-05-26 1170
35d7bdc86031a2c David Hildenbrand 2021-04-23 1171 /**
35d7bdc86031a2c David Hildenbrand 2021-04-23 1172 * replace_mm_exe_file - replace a reference to the mm's executable file
35d7bdc86031a2c David Hildenbrand 2021-04-23 1173 *
35d7bdc86031a2c David Hildenbrand 2021-04-23 1174 * This changes mm's executable file (shown as symlink /proc/[pid]/exe),
35d7bdc86031a2c David Hildenbrand 2021-04-23 1175 * dealing with concurrent invocation and without grabbing the mmap lock in
35d7bdc86031a2c David Hildenbrand 2021-04-23 1176 * write mode.
35d7bdc86031a2c David Hildenbrand 2021-04-23 1177 *
35d7bdc86031a2c David Hildenbrand 2021-04-23 1178 * Main user is sys_prctl(PR_SET_MM_MAP/EXE_FILE).
35d7bdc86031a2c David Hildenbrand 2021-04-23 1179 */
35d7bdc86031a2c David Hildenbrand 2021-04-23 1180 int replace_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
35d7bdc86031a2c David Hildenbrand 2021-04-23 @1181 {
35d7bdc86031a2c David Hildenbrand 2021-04-23 1182 struct vm_area_struct *vma;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1183 struct file *old_exe_file;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1184 int ret = 0;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1185
35d7bdc86031a2c David Hildenbrand 2021-04-23 1186 /* Forbid mm->exe_file change if old file still mapped. */
35d7bdc86031a2c David Hildenbrand 2021-04-23 1187 old_exe_file = get_mm_exe_file(mm);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1188 if (old_exe_file) {
35d7bdc86031a2c David Hildenbrand 2021-04-23 1189 mmap_read_lock(mm);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1190 for (vma = mm->mmap; vma && !ret; vma = vma->vm_next) {
35d7bdc86031a2c David Hildenbrand 2021-04-23 1191 if (!vma->vm_file)
35d7bdc86031a2c David Hildenbrand 2021-04-23 1192 continue;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1193 if (path_equal(&vma->vm_file->f_path,
35d7bdc86031a2c David Hildenbrand 2021-04-23 1194 &old_exe_file->f_path))
35d7bdc86031a2c David Hildenbrand 2021-04-23 1195 ret = -EBUSY;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1196 }
35d7bdc86031a2c David Hildenbrand 2021-04-23 1197 mmap_read_unlock(mm);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1198 fput(old_exe_file);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1199 if (ret)
35d7bdc86031a2c David Hildenbrand 2021-04-23 1200 return ret;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1201 }
35d7bdc86031a2c David Hildenbrand 2021-04-23 1202
35d7bdc86031a2c David Hildenbrand 2021-04-23 1203 /* set the new file, lockless */
35d7bdc86031a2c David Hildenbrand 2021-04-23 1204 get_file(new_exe_file);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1205 old_exe_file = xchg(&mm->exe_file, new_exe_file);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1206 if (old_exe_file)
35d7bdc86031a2c David Hildenbrand 2021-04-23 1207 fput(old_exe_file);
35d7bdc86031a2c David Hildenbrand 2021-04-23 1208 return 0;
35d7bdc86031a2c David Hildenbrand 2021-04-23 1209 }
35d7bdc86031a2c David Hildenbrand 2021-04-23 1210

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

Attachment: .config.gz
Description: application/gzip

reproduce (this is a W=1 build):
mkdir -p ~/bin
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang ~/bin/make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash