tree: https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.elf-compat head: b9613abdecd9d2dae95f4712985280c80ce8e646 commit: 5df3c15125233fbc59fd003249c381c7edd985cc [11/13] Kconfig: regularize selection of CONFIG_BINFMT_ELF config: x86_64-randconfig-a005-20210104 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?id=5df3c15125233fbc59fd003249c381c7edd985cc git remote add vfs https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git git fetch --no-tags vfs work.elf-compat git checkout 5df3c15125233fbc59fd003249c381c7edd985cc # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): ld: fs/compat_binfmt_elf.o: in function `create_elf_tables': >> fs/binfmt_elf.c:254: undefined reference to `vdso_image_32' >> ld: fs/binfmt_elf.c:254: undefined reference to `vdso_image_32' >> ld: fs/binfmt_elf.c:254: undefined reference to `vdso_image_32' vim +254 fs/binfmt_elf.c 483fad1c3fa1060 Nathan Lynch 2008-07-22 170 ^1da177e4c3f415 Linus Torvalds 2005-04-16 171 static int a62c5b1b6647ea0 Alexey Dobriyan 2020-01-30 172 create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec, a62c5b1b6647ea0 Alexey Dobriyan 2020-01-30 173 unsigned long load_addr, unsigned long interp_load_addr, a62c5b1b6647ea0 Alexey Dobriyan 2020-01-30 174 unsigned long e_entry) ^1da177e4c3f415 Linus Torvalds 2005-04-16 175 { 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 176 struct mm_struct *mm = current->mm; ^1da177e4c3f415 Linus Torvalds 2005-04-16 177 unsigned long p = bprm->p; ^1da177e4c3f415 Linus Torvalds 2005-04-16 178 int argc = bprm->argc; ^1da177e4c3f415 Linus Torvalds 2005-04-16 179 int envc = bprm->envc; ^1da177e4c3f415 Linus Torvalds 2005-04-16 180 elf_addr_t __user *sp; ^1da177e4c3f415 Linus Torvalds 2005-04-16 181 elf_addr_t __user *u_platform; 483fad1c3fa1060 Nathan Lynch 2008-07-22 182 elf_addr_t __user *u_base_platform; f06295b44c296c8 Kees Cook 2009-01-07 183 elf_addr_t __user *u_rand_bytes; ^1da177e4c3f415 Linus Torvalds 2005-04-16 184 const char *k_platform = ELF_PLATFORM; 483fad1c3fa1060 Nathan Lynch 2008-07-22 185 const char *k_base_platform = ELF_BASE_PLATFORM; f06295b44c296c8 Kees Cook 2009-01-07 186 unsigned char k_rand_bytes[16]; ^1da177e4c3f415 Linus Torvalds 2005-04-16 187 int items; ^1da177e4c3f415 Linus Torvalds 2005-04-16 188 elf_addr_t *elf_info; 1f83d80677a24ae Alexey Dobriyan 2020-01-30 189 int ei_index; 86a264abe542cfe David Howells 2008-11-14 190 const struct cred *cred = current_cred(); b6a2fea39318e43 Ollie Wild 2007-07-19 191 struct vm_area_struct *vma; ^1da177e4c3f415 Linus Torvalds 2005-04-16 192 d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 193 /* d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 194 * In some cases (e.g. Hyper-Threading), we want to avoid L1 d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 195 * evictions by the processes running on the same package. One d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 196 * thing we can do is to shuffle the initial stack for them. d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 197 */ d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 198 d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 199 p = arch_align_stack(p); d68c9d6ae8f1fda Franck Bui-Huu 2007-10-16 200 ^1da177e4c3f415 Linus Torvalds 2005-04-16 201 /* ^1da177e4c3f415 Linus Torvalds 2005-04-16 202 * If this architecture has a platform capability string, copy it ^1da177e4c3f415 Linus Torvalds 2005-04-16 203 * to userspace. In some cases (Sparc), this info is impossible ^1da177e4c3f415 Linus Torvalds 2005-04-16 204 * for userspace to get any other way, in others (i386) it is ^1da177e4c3f415 Linus Torvalds 2005-04-16 205 * merely difficult. ^1da177e4c3f415 Linus Torvalds 2005-04-16 206 */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 207 u_platform = NULL; ^1da177e4c3f415 Linus Torvalds 2005-04-16 208 if (k_platform) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 209 size_t len = strlen(k_platform) + 1; ^1da177e4c3f415 Linus Torvalds 2005-04-16 210 ^1da177e4c3f415 Linus Torvalds 2005-04-16 211 u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len); 646e84deb4496e2 Al Viro 2020-02-19 212 if (copy_to_user(u_platform, k_platform, len)) ^1da177e4c3f415 Linus Torvalds 2005-04-16 213 return -EFAULT; ^1da177e4c3f415 Linus Torvalds 2005-04-16 214 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 215 483fad1c3fa1060 Nathan Lynch 2008-07-22 216 /* 483fad1c3fa1060 Nathan Lynch 2008-07-22 217 * If this architecture has a "base" platform capability 483fad1c3fa1060 Nathan Lynch 2008-07-22 218 * string, copy it to userspace. 483fad1c3fa1060 Nathan Lynch 2008-07-22 219 */ 483fad1c3fa1060 Nathan Lynch 2008-07-22 220 u_base_platform = NULL; 483fad1c3fa1060 Nathan Lynch 2008-07-22 221 if (k_base_platform) { 483fad1c3fa1060 Nathan Lynch 2008-07-22 222 size_t len = strlen(k_base_platform) + 1; 483fad1c3fa1060 Nathan Lynch 2008-07-22 223 483fad1c3fa1060 Nathan Lynch 2008-07-22 224 u_base_platform = (elf_addr_t __user *)STACK_ALLOC(p, len); 646e84deb4496e2 Al Viro 2020-02-19 225 if (copy_to_user(u_base_platform, k_base_platform, len)) 483fad1c3fa1060 Nathan Lynch 2008-07-22 226 return -EFAULT; 483fad1c3fa1060 Nathan Lynch 2008-07-22 227 } 483fad1c3fa1060 Nathan Lynch 2008-07-22 228 f06295b44c296c8 Kees Cook 2009-01-07 229 /* f06295b44c296c8 Kees Cook 2009-01-07 230 * Generate 16 random bytes for userspace PRNG seeding. f06295b44c296c8 Kees Cook 2009-01-07 231 */ f06295b44c296c8 Kees Cook 2009-01-07 232 get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes)); f06295b44c296c8 Kees Cook 2009-01-07 233 u_rand_bytes = (elf_addr_t __user *) f06295b44c296c8 Kees Cook 2009-01-07 234 STACK_ALLOC(p, sizeof(k_rand_bytes)); 646e84deb4496e2 Al Viro 2020-02-19 235 if (copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes))) f06295b44c296c8 Kees Cook 2009-01-07 236 return -EFAULT; f06295b44c296c8 Kees Cook 2009-01-07 237 ^1da177e4c3f415 Linus Torvalds 2005-04-16 238 /* Create the ELF interpreter info */ 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 239 elf_info = (elf_addr_t *)mm->saved_auxv; 4f9a58d75bfe82a Olaf Hering 2007-10-16 240 /* update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 241 #define NEW_AUX_ENT(id, val) \ f4e5cc2c44bf760 Jesper Juhl 2006-06-23 242 do { \ 1f83d80677a24ae Alexey Dobriyan 2020-01-30 243 *elf_info++ = id; \ 1f83d80677a24ae Alexey Dobriyan 2020-01-30 244 *elf_info++ = val; \ f4e5cc2c44bf760 Jesper Juhl 2006-06-23 245 } while (0) ^1da177e4c3f415 Linus Torvalds 2005-04-16 246 ^1da177e4c3f415 Linus Torvalds 2005-04-16 247 #ifdef ARCH_DLINFO ^1da177e4c3f415 Linus Torvalds 2005-04-16 248 /* ^1da177e4c3f415 Linus Torvalds 2005-04-16 249 * ARCH_DLINFO must come first so PPC can do its special alignment of ^1da177e4c3f415 Linus Torvalds 2005-04-16 250 * AUXV. 4f9a58d75bfe82a Olaf Hering 2007-10-16 251 * update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT() in 4f9a58d75bfe82a Olaf Hering 2007-10-16 252 * ARCH_DLINFO changes ^1da177e4c3f415 Linus Torvalds 2005-04-16 253 */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 @254 ARCH_DLINFO; ^1da177e4c3f415 Linus Torvalds 2005-04-16 255 #endif ^1da177e4c3f415 Linus Torvalds 2005-04-16 256 NEW_AUX_ENT(AT_HWCAP, ELF_HWCAP); ^1da177e4c3f415 Linus Torvalds 2005-04-16 257 NEW_AUX_ENT(AT_PAGESZ, ELF_EXEC_PAGESIZE); ^1da177e4c3f415 Linus Torvalds 2005-04-16 258 NEW_AUX_ENT(AT_CLKTCK, CLOCKS_PER_SEC); ^1da177e4c3f415 Linus Torvalds 2005-04-16 259 NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff); ^1da177e4c3f415 Linus Torvalds 2005-04-16 260 NEW_AUX_ENT(AT_PHENT, sizeof(struct elf_phdr)); ^1da177e4c3f415 Linus Torvalds 2005-04-16 261 NEW_AUX_ENT(AT_PHNUM, exec->e_phnum); ^1da177e4c3f415 Linus Torvalds 2005-04-16 262 NEW_AUX_ENT(AT_BASE, interp_load_addr); ^1da177e4c3f415 Linus Torvalds 2005-04-16 263 NEW_AUX_ENT(AT_FLAGS, 0); a62c5b1b6647ea0 Alexey Dobriyan 2020-01-30 264 NEW_AUX_ENT(AT_ENTRY, e_entry); ebc887b278944fc Eric W. Biederman 2012-02-07 265 NEW_AUX_ENT(AT_UID, from_kuid_munged(cred->user_ns, cred->uid)); ebc887b278944fc Eric W. Biederman 2012-02-07 266 NEW_AUX_ENT(AT_EUID, from_kuid_munged(cred->user_ns, cred->euid)); ebc887b278944fc Eric W. Biederman 2012-02-07 267 NEW_AUX_ENT(AT_GID, from_kgid_munged(cred->user_ns, cred->gid)); ebc887b278944fc Eric W. Biederman 2012-02-07 268 NEW_AUX_ENT(AT_EGID, from_kgid_munged(cred->user_ns, cred->egid)); c425e189ffd7720 Kees Cook 2017-07-18 269 NEW_AUX_ENT(AT_SECURE, bprm->secureexec); f06295b44c296c8 Kees Cook 2009-01-07 270 NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes); 2171364d1a92d0a Michael Neuling 2013-04-17 271 #ifdef ELF_HWCAP2 2171364d1a92d0a Michael Neuling 2013-04-17 272 NEW_AUX_ENT(AT_HWCAP2, ELF_HWCAP2); 2171364d1a92d0a Michael Neuling 2013-04-17 273 #endif 651910874633a75 John Reiser 2008-07-21 274 NEW_AUX_ENT(AT_EXECFN, bprm->exec); ^1da177e4c3f415 Linus Torvalds 2005-04-16 275 if (k_platform) { f4e5cc2c44bf760 Jesper Juhl 2006-06-23 276 NEW_AUX_ENT(AT_PLATFORM, f4e5cc2c44bf760 Jesper Juhl 2006-06-23 277 (elf_addr_t)(unsigned long)u_platform); ^1da177e4c3f415 Linus Torvalds 2005-04-16 278 } 483fad1c3fa1060 Nathan Lynch 2008-07-22 279 if (k_base_platform) { 483fad1c3fa1060 Nathan Lynch 2008-07-22 280 NEW_AUX_ENT(AT_BASE_PLATFORM, 483fad1c3fa1060 Nathan Lynch 2008-07-22 281 (elf_addr_t)(unsigned long)u_base_platform); 483fad1c3fa1060 Nathan Lynch 2008-07-22 282 } b8a61c9e7b4a0fe Eric W. Biederman 2020-05-14 283 if (bprm->have_execfd) { b8a61c9e7b4a0fe Eric W. Biederman 2020-05-14 284 NEW_AUX_ENT(AT_EXECFD, bprm->execfd); ^1da177e4c3f415 Linus Torvalds 2005-04-16 285 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 286 #undef NEW_AUX_ENT ^1da177e4c3f415 Linus Torvalds 2005-04-16 287 /* AT_NULL is zero; clear the rest too */ 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 288 memset(elf_info, 0, (char *)mm->saved_auxv + 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 289 sizeof(mm->saved_auxv) - (char *)elf_info); ^1da177e4c3f415 Linus Torvalds 2005-04-16 290 ^1da177e4c3f415 Linus Torvalds 2005-04-16 291 /* And advance past the AT_NULL entry. */ 1f83d80677a24ae Alexey Dobriyan 2020-01-30 292 elf_info += 2; ^1da177e4c3f415 Linus Torvalds 2005-04-16 293 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 294 ei_index = elf_info - (elf_addr_t *)mm->saved_auxv; ^1da177e4c3f415 Linus Torvalds 2005-04-16 295 sp = STACK_ADD(p, ei_index); ^1da177e4c3f415 Linus Torvalds 2005-04-16 296 d20894a23708c2a Andi Kleen 2008-02-08 297 items = (argc + 1) + (envc + 1) + 1; ^1da177e4c3f415 Linus Torvalds 2005-04-16 298 bprm->p = STACK_ROUND(sp, items); ^1da177e4c3f415 Linus Torvalds 2005-04-16 299 ^1da177e4c3f415 Linus Torvalds 2005-04-16 300 /* Point sp at the lowest address on the stack */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 301 #ifdef CONFIG_STACK_GROWSUP ^1da177e4c3f415 Linus Torvalds 2005-04-16 302 sp = (elf_addr_t __user *)bprm->p - items - ei_index; ^1da177e4c3f415 Linus Torvalds 2005-04-16 303 bprm->exec = (unsigned long)sp; /* XXX: PARISC HACK */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 304 #else ^1da177e4c3f415 Linus Torvalds 2005-04-16 305 sp = (elf_addr_t __user *)bprm->p; ^1da177e4c3f415 Linus Torvalds 2005-04-16 306 #endif ^1da177e4c3f415 Linus Torvalds 2005-04-16 307 b6a2fea39318e43 Ollie Wild 2007-07-19 308 b6a2fea39318e43 Ollie Wild 2007-07-19 309 /* b6a2fea39318e43 Ollie Wild 2007-07-19 310 * Grow the stack manually; some architectures have a limit on how b6a2fea39318e43 Ollie Wild 2007-07-19 311 * far ahead a user-space access may be in order to grow the stack. b6a2fea39318e43 Ollie Wild 2007-07-19 312 */ b2767d97f5ff758 Jann Horn 2020-10-17 313 if (mmap_read_lock_killable(mm)) b2767d97f5ff758 Jann Horn 2020-10-17 314 return -EINTR; 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 315 vma = find_extend_vma(mm, bprm->p); b2767d97f5ff758 Jann Horn 2020-10-17 316 mmap_read_unlock(mm); b6a2fea39318e43 Ollie Wild 2007-07-19 317 if (!vma) b6a2fea39318e43 Ollie Wild 2007-07-19 318 return -EFAULT; b6a2fea39318e43 Ollie Wild 2007-07-19 319 ^1da177e4c3f415 Linus Torvalds 2005-04-16 320 /* Now, let's put argc (and argv, envp if appropriate) on the stack */ 646e84deb4496e2 Al Viro 2020-02-19 321 if (put_user(argc, sp++)) ^1da177e4c3f415 Linus Torvalds 2005-04-16 322 return -EFAULT; ^1da177e4c3f415 Linus Torvalds 2005-04-16 323 67c6777a5d331dd Kees Cook 2017-07-10 324 /* Populate list of argv pointers back to argv strings. */ 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 325 p = mm->arg_end = mm->arg_start; ^1da177e4c3f415 Linus Torvalds 2005-04-16 326 while (argc-- > 0) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 327 size_t len; 646e84deb4496e2 Al Viro 2020-02-19 328 if (put_user((elf_addr_t)p, sp++)) 841d5fb7c75260f Heiko Carstens 2006-12-06 329 return -EFAULT; b6a2fea39318e43 Ollie Wild 2007-07-19 330 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); b6a2fea39318e43 Ollie Wild 2007-07-19 331 if (!len || len > MAX_ARG_STRLEN) 23c4971e3d97de4 WANG Cong 2008-05-08 332 return -EINVAL; ^1da177e4c3f415 Linus Torvalds 2005-04-16 333 p += len; ^1da177e4c3f415 Linus Torvalds 2005-04-16 334 } 646e84deb4496e2 Al Viro 2020-02-19 335 if (put_user(0, sp++)) ^1da177e4c3f415 Linus Torvalds 2005-04-16 336 return -EFAULT; 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 337 mm->arg_end = p; 67c6777a5d331dd Kees Cook 2017-07-10 338 67c6777a5d331dd Kees Cook 2017-07-10 339 /* Populate list of envp pointers back to envp strings. */ 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 340 mm->env_end = mm->env_start = p; ^1da177e4c3f415 Linus Torvalds 2005-04-16 341 while (envc-- > 0) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 342 size_t len; 646e84deb4496e2 Al Viro 2020-02-19 343 if (put_user((elf_addr_t)p, sp++)) 841d5fb7c75260f Heiko Carstens 2006-12-06 344 return -EFAULT; b6a2fea39318e43 Ollie Wild 2007-07-19 345 len = strnlen_user((void __user *)p, MAX_ARG_STRLEN); b6a2fea39318e43 Ollie Wild 2007-07-19 346 if (!len || len > MAX_ARG_STRLEN) 23c4971e3d97de4 WANG Cong 2008-05-08 347 return -EINVAL; ^1da177e4c3f415 Linus Torvalds 2005-04-16 348 p += len; ^1da177e4c3f415 Linus Torvalds 2005-04-16 349 } 646e84deb4496e2 Al Viro 2020-02-19 350 if (put_user(0, sp++)) ^1da177e4c3f415 Linus Torvalds 2005-04-16 351 return -EFAULT; 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 352 mm->env_end = p; ^1da177e4c3f415 Linus Torvalds 2005-04-16 353 ^1da177e4c3f415 Linus Torvalds 2005-04-16 354 /* Put the elf_info on the stack in the right place. */ 03c6d723eeac2d7 Alexey Dobriyan 2020-01-30 355 if (copy_to_user(sp, mm->saved_auxv, ei_index * sizeof(elf_addr_t))) ^1da177e4c3f415 Linus Torvalds 2005-04-16 356 return -EFAULT; ^1da177e4c3f415 Linus Torvalds 2005-04-16 357 return 0; ^1da177e4c3f415 Linus Torvalds 2005-04-16 358 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 359 :::::: The code at line 254 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