Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 4 Aug 2016 22:04:44 +0000 (18:04 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 4 Aug 2016 22:04:44 +0000 (18:04 -0400)
Pull m68knommu updates from Greg Ungerer:
 "This series is all about Nicolas flat format support for MMU systems.

  Traditional m68k no-MMU flat format binaries can now be run on m68k
  MMU enabled systems too.  The series includes some nice cleanups of
  the binfmt_flat code and converts it to using proper user space
  accessor functions.

  With all this in place you can boot and run a complete no-MMU flat
  format based user space on an MMU enabled system"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68k: enable binfmt_flat on systems with an MMU
  binfmt_flat: allow compressed flat binary format to work on MMU systems
  binfmt_flat: add MMU-specific support
  binfmt_flat: update libraries' data segment pointer with userspace accessors
  binfmt_flat: use clear_user() rather than memset() to clear .bss
  binfmt_flat: use proper user space accessors with old relocs code
  binfmt_flat: use proper user space accessors with relocs processing code
  binfmt_flat: clean up create_flat_tables() and stack accesses
  binfmt_flat: use generic transfer_args_to_stack()
  elf_fdpic_transfer_args_to_stack(): make it generic
  binfmt_flat: prevent kernel dammage from corrupted executable headers
  binfmt_flat: convert printk invocations to their modern form
  binfmt_flat: assorted cleanups
  m68k: use same start_thread() on MMU and no-MMU
  m68k: fix file path comment
  m68k: fix bFLT executable running on MMU enabled systems

1  2 
fs/exec.c

diff --combined fs/exec.c
index a1789cd684bf25dde64739c2c38b1bcc23cd3eb3,ef0df2f09257677107fdd5eb6e99dd2d4320ac11..6fcfb3f7b137951b133d3db95431c23bc2d4677f
+++ b/fs/exec.c
@@@ -762,6 -762,39 +762,39 @@@ out_unlock
  }
  EXPORT_SYMBOL(setup_arg_pages);
  
+ #else
+ /*
+  * Transfer the program arguments and environment from the holding pages
+  * onto the stack. The provided stack pointer is adjusted accordingly.
+  */
+ int transfer_args_to_stack(struct linux_binprm *bprm,
+                          unsigned long *sp_location)
+ {
+       unsigned long index, stop, sp;
+       int ret = 0;
+       stop = bprm->p >> PAGE_SHIFT;
+       sp = *sp_location;
+       for (index = MAX_ARG_PAGES - 1; index >= stop; index--) {
+               unsigned int offset = index == stop ? bprm->p & ~PAGE_MASK : 0;
+               char *src = kmap(bprm->page[index]) + offset;
+               sp -= PAGE_SIZE - offset;
+               if (copy_to_user((void *) sp, src, PAGE_SIZE - offset) != 0)
+                       ret = -EFAULT;
+               kunmap(bprm->page[index]);
+               if (ret)
+                       goto out;
+       }
+       *sp_location = sp;
+ out:
+       return ret;
+ }
+ EXPORT_SYMBOL(transfer_args_to_stack);
  #endif /* CONFIG_MMU */
  
  static struct file *do_open_execat(int fd, struct filename *name, int flags)
@@@ -866,8 -899,7 +899,8 @@@ int kernel_read_file(struct file *file
                goto out;
        }
  
 -      *buf = vmalloc(i_size);
 +      if (id != READING_FIRMWARE_PREALLOC_BUFFER)
 +              *buf = vmalloc(i_size);
        if (!*buf) {
                ret = -ENOMEM;
                goto out;
  
  out_free:
        if (ret < 0) {
 -              vfree(*buf);
 -              *buf = NULL;
 +              if (id != READING_FIRMWARE_PREALLOC_BUFFER) {
 +                      vfree(*buf);
 +                      *buf = NULL;
 +              }
        }
  
  out:
@@@ -1414,7 -1444,7 +1447,7 @@@ static void bprm_fill_uid(struct linux_
        bprm->cred->euid = current_euid();
        bprm->cred->egid = current_egid();
  
 -      if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
 +      if (!mnt_may_suid(bprm->file->f_path.mnt))
                return;
  
        if (task_no_new_privs(current))
This page took 0.031186 seconds and 5 git commands to generate.