Merge branch 'akpm' (patches from Andrew)
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:18:29 +0000 (19:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 5 Jun 2020 02:18:29 +0000 (19:18 -0700)
Merge yet more updates from Andrew Morton:

 - More MM work. 100ish more to go. Mike Rapoport's "mm: remove
   __ARCH_HAS_5LEVEL_HACK" series should fix the current ppc issue

 - Various other little subsystems

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (127 commits)
  lib/ubsan.c: fix gcc-10 warnings
  tools/testing/selftests/vm: remove duplicate headers
  selftests: vm: pkeys: fix multilib builds for x86
  selftests: vm: pkeys: use the correct page size on powerpc
  selftests/vm/pkeys: override access right definitions on powerpc
  selftests/vm/pkeys: test correct behaviour of pkey-0
  selftests/vm/pkeys: introduce a sub-page allocator
  selftests/vm/pkeys: detect write violation on a mapped access-denied-key page
  selftests/vm/pkeys: associate key on a mapped page and detect write violation
  selftests/vm/pkeys: associate key on a mapped page and detect access violation
  selftests/vm/pkeys: improve checks to determine pkey support
  selftests/vm/pkeys: fix assertion in test_pkey_alloc_exhaust()
  selftests/vm/pkeys: fix number of reserved powerpc pkeys
  selftests/vm/pkeys: introduce powerpc support
  selftests/vm/pkeys: introduce generic pkey abstractions
  selftests: vm: pkeys: use the correct huge page size
  selftests/vm/pkeys: fix alloc_random_pkey() to make it really random
  selftests/vm/pkeys: fix assertion in pkey_disable_set/clear()
  selftests/vm/pkeys: fix pkey_disable_clear()
  selftests: vm: pkeys: add helpers for pkey bits
  ...

1  2 
fs/binfmt_elf.c
fs/binfmt_em86.c
fs/binfmt_misc.c
fs/binfmt_script.c
fs/exec.c
fs/proc/array.c
include/linux/binfmts.h
mm/mremap.c

diff --cc fs/binfmt_elf.c
Simple merge
Simple merge
index bc5506619b7e3b104618385a2c11104b37ebb0d5,b15257d8ff5e4c3e26c6a42d3a1e81046f90523a..3880a82da1dc507a4b4efd02a8d6a2db79b40ef4
@@@ -159,19 -160,45 +159,19 @@@ static int load_misc_binary(struct linu
                        goto ret;
        }
  
 -      if (fmt->flags & MISC_FMT_OPEN_BINARY) {
 +      if (fmt->flags & MISC_FMT_OPEN_BINARY)
 +              bprm->have_execfd = 1;
  
 -              /* if the binary should be opened on behalf of the
 -               * interpreter than keep it open and assign descriptor
 -               * to it
 -               */
 -              fd_binary = get_unused_fd_flags(0);
 -              if (fd_binary < 0) {
 -                      retval = fd_binary;
 -                      goto ret;
 -              }
 -              fd_install(fd_binary, bprm->file);
 -
 -              /* if the binary is not readable than enforce mm->dumpable=0
 -                 regardless of the interpreter's permissions */
 -              would_dump(bprm, bprm->file);
 -
 -              allow_write_access(bprm->file);
 -              bprm->file = NULL;
 -
 -              /* mark the bprm that fd should be passed to interp */
 -              bprm->interp_flags |= BINPRM_FLAGS_EXECFD;
 -              bprm->interp_data = fd_binary;
 -
 -      } else {
 -              allow_write_access(bprm->file);
 -              fput(bprm->file);
 -              bprm->file = NULL;
 -      }
        /* make argv[1] be the path to the binary */
-       retval = copy_strings_kernel(1, &bprm->interp, bprm);
+       retval = copy_string_kernel(bprm->interp, bprm);
        if (retval < 0)
 -              goto error;
 +              goto ret;
        bprm->argc++;
  
        /* add the interp as argv[0] */
-       retval = copy_strings_kernel(1, &fmt->interpreter, bprm);
+       retval = copy_string_kernel(fmt->interpreter, bprm);
        if (retval < 0)
 -              goto error;
 +              goto ret;
        bprm->argc++;
  
        /* Update interp in case binfmt_script needs it. */
index 0e8b953d12cf88cb4bda5e19e218f9f7a9999d15,c4fb7f52a46e5f3da97e215ee5bc3bd3bfee6ba5..1b6625e959587da5b0545cb1ef88ab16a6530199
@@@ -110,10 -121,8 +110,10 @@@ static int load_script(struct linux_bin
        if (retval < 0)
                return retval;
        bprm->argc++;
 +      *((char *)i_end) = '\0';
        if (i_arg) {
-               retval = copy_strings_kernel(1, &i_arg, bprm);
 +              *((char *)i_sep) = '\0';
+               retval = copy_string_kernel(i_arg, bprm);
                if (retval < 0)
                        return retval;
                bprm->argc++;
diff --cc fs/exec.c
index e850ee7dd636d64fdf342233993fd208b86fcd2b,03a85e3c49bbfa54c51864f11948969c917494f6..93ff1c4c7ebb1084a30741fb38495c57008baf67
+++ b/fs/exec.c
@@@ -1878,12 -1885,11 +1902,12 @@@ static int __do_execve_file(int fd, str
        if (retval < 0)
                goto out;
  
 -      retval = prepare_binprm(bprm);
 -      if (retval < 0)
 +      /* Set the unchanging part of bprm->cred */
 +      retval = security_bprm_creds_for_exec(bprm);
 +      if (retval)
                goto out;
  
-       retval = copy_strings_kernel(1, &bprm->filename, bprm);
+       retval = copy_string_kernel(bprm->filename, bprm);
        if (retval < 0)
                goto out;
  
diff --cc fs/proc/array.c
Simple merge
index aece1b340e7d4587c640a22f71211a21c661eb81,3d3afe094c97dbba28b3b364f8a102895de08cce..4a20b7517dd036c1fba31ab024ec9ee773d0e9ec
@@@ -130,8 -144,8 +130,7 @@@ extern int setup_arg_pages(struct linux
  extern int transfer_args_to_stack(struct linux_binprm *bprm,
                                  unsigned long *sp_location);
  extern int bprm_change_interp(const char *interp, struct linux_binprm *bprm);
- extern int copy_strings_kernel(int argc, const char *const *argv,
-                              struct linux_binprm *bprm);
+ int copy_string_kernel(const char *arg, struct linux_binprm *bprm);
 -extern void install_exec_creds(struct linux_binprm *bprm);
  extern void set_binfmt(struct linux_binfmt *new);
  extern ssize_t read_code(struct file *, unsigned long, loff_t, size_t);
  
diff --cc mm/mremap.c
Simple merge