Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Nov 2017 20:54:01 +0000 (12:54 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 17 Nov 2017 20:54:01 +0000 (12:54 -0800)
Pull misc vfs updates from Al Viro:
 "Assorted stuff, really no common topic here"

* 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  vfs: grab the lock instead of blocking in __fd_install during resizing
  vfs: stop clearing close on exec when closing a fd
  include/linux/fs.h: fix comment about struct address_space
  fs: make fiemap work from compat_ioctl
  coda: fix 'kernel memory exposure attempt' in fsync
  pstore: remove unneeded unlikely()
  vfs: remove unneeded unlikely()
  stubs for mount_bdev() and kill_block_super() in !CONFIG_BLOCK case
  make vfs_ustat() static
  do_handle_open() should be static
  elf_fdpic: fix unused variable warning
  fold destroy_super() into __put_super()
  new helper: destroy_unused_super()
  fix address space warnings in ipc/
  acct.h: get rid of detritus

15 files changed:
1  2 
fs/binfmt_elf_fdpic.c
fs/coda/upcall.c
fs/compat_ioctl.c
fs/fhandle.c
fs/file.c
fs/namei.c
fs/pstore/platform.c
fs/statfs.c
fs/super.c
include/linux/acct.h
include/linux/fs.h
ipc/msg.c
ipc/sem.c
ipc/shm.c
ipc/syscall.c

diff --combined fs/binfmt_elf_fdpic.c
index 5429b035e249bfb6eb0d7887ccca0353535af952,c4565061da84c55f9850f6d393cf3bce5816d4cf..429326b6e2e7088dc1c67c770122beb7b004152b
@@@ -378,11 -378,6 +378,11 @@@ static int load_elf_fdpic_binary(struc
                                 executable_stack);
        if (retval < 0)
                goto error;
 +#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
 +      retval = arch_setup_additional_pages(bprm, !!interpreter_name);
 +      if (retval < 0)
 +              goto error;
 +#endif
  #endif
  
        /* load the executable and interpreter into memory */
@@@ -836,9 -831,6 +836,9 @@@ static int elf_fdpic_map_file(struct el
                        if (phdr->p_vaddr >= seg->p_vaddr &&
                            phdr->p_vaddr + phdr->p_memsz <=
                            seg->p_vaddr + seg->p_memsz) {
 +                              Elf32_Dyn __user *dyn;
 +                              Elf32_Sword d_tag;
 +
                                params->dynamic_addr =
                                        (phdr->p_vaddr - seg->p_vaddr) +
                                        seg->addr;
                                        goto dynamic_error;
  
                                tmp = phdr->p_memsz / sizeof(Elf32_Dyn);
 -                              if (((Elf32_Dyn *)
 -                                   params->dynamic_addr)[tmp - 1].d_tag != 0)
 +                              dyn = (Elf32_Dyn __user *)params->dynamic_addr;
 +                              __get_user(d_tag, &dyn[tmp - 1].d_tag);
 +                              if (d_tag != 0)
                                        goto dynamic_error;
                                break;
                        }
@@@ -1498,7 -1489,9 +1498,9 @@@ static bool elf_fdpic_dump_segments(str
        struct vm_area_struct *vma;
  
        for (vma = current->mm->mmap; vma; vma = vma->vm_next) {
+ #ifdef CONFIG_MMU
                unsigned long addr;
+ #endif
  
                if (!maydump(vma, cprm->mm_flags))
                        continue;
diff --combined fs/coda/upcall.c
index a37f003530d7353ca1ae4b37ea8c7f8c2c3a9261,8cf16d8c52613e5d0f20bc6bf655925cbe4fae96..1175a1722411d353624c8b1548f054c5b13fc520
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * Mostly platform independent upcall operations to Venus:
   *  -- upcalls
@@@ -447,8 -446,7 +447,7 @@@ int venus_fsync(struct super_block *sb
        UPARG(CODA_FSYNC);
  
        inp->coda_fsync.VFid = *fid;
-       error = coda_upcall(coda_vcp(sb), sizeof(union inputArgs),
-                           &outsize, inp);
+       error = coda_upcall(coda_vcp(sb), insize, &outsize, inp);
  
        CODA_FREE(inp, insize);
        return error;
diff --combined fs/compat_ioctl.c
index f95aa0b2e9c03f83152c8c74c71a6a8d474ba343,480f9366b4e3f4c1900d54025c2723cddbdad507..5fc5dc66060052af88730f3608b1930a397a412d
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
   *
@@@ -54,6 -53,8 +54,6 @@@
  #include <linux/if_tun.h>
  #include <linux/ctype.h>
  #include <linux/syscalls.h>
 -#include <linux/i2c.h>
 -#include <linux/i2c-dev.h>
  #include <linux/atalk.h>
  #include <linux/gfp.h>
  #include <linux/cec.h>
@@@ -135,6 -136,22 +135,6 @@@ static int do_ioctl(struct file *file, 
        return vfs_ioctl(file, cmd, arg);
  }
  
 -static int w_long(struct file *file,
 -              unsigned int cmd, compat_ulong_t __user *argp)
 -{
 -      int err;
 -      unsigned long __user *valp = compat_alloc_user_space(sizeof(*valp));
 -
 -      if (valp == NULL)
 -              return -EFAULT;
 -      err = do_ioctl(file, cmd, (unsigned long)valp);
 -      if (err)
 -              return err;
 -      if (convert_in_user(valp, argp))
 -              return -EFAULT;
 -      return 0;
 -}
 -
  struct compat_video_event {
        int32_t         type;
        compat_time_t   timestamp;
@@@ -653,6 -670,96 +653,6 @@@ static int serial_struct_ioctl(struct f
          return err;
  }
  
 -/*
 - * I2C layer ioctls
 - */
 -
 -struct i2c_msg32 {
 -      u16 addr;
 -      u16 flags;
 -      u16 len;
 -      compat_caddr_t buf;
 -};
 -
 -struct i2c_rdwr_ioctl_data32 {
 -      compat_caddr_t msgs; /* struct i2c_msg __user *msgs */
 -      u32 nmsgs;
 -};
 -
 -struct i2c_smbus_ioctl_data32 {
 -      u8 read_write;
 -      u8 command;
 -      u32 size;
 -      compat_caddr_t data; /* union i2c_smbus_data *data */
 -};
 -
 -struct i2c_rdwr_aligned {
 -      struct i2c_rdwr_ioctl_data cmd;
 -      struct i2c_msg msgs[0];
 -};
 -
 -static int do_i2c_rdwr_ioctl(struct file *file,
 -      unsigned int cmd, struct i2c_rdwr_ioctl_data32 __user *udata)
 -{
 -      struct i2c_rdwr_aligned         __user *tdata;
 -      struct i2c_msg                  __user *tmsgs;
 -      struct i2c_msg32                __user *umsgs;
 -      compat_caddr_t                  datap;
 -      u32                             nmsgs;
 -      int                             i;
 -
 -      if (get_user(nmsgs, &udata->nmsgs))
 -              return -EFAULT;
 -      if (nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
 -              return -EINVAL;
 -
 -      if (get_user(datap, &udata->msgs))
 -              return -EFAULT;
 -      umsgs = compat_ptr(datap);
 -
 -      tdata = compat_alloc_user_space(sizeof(*tdata) +
 -                                    nmsgs * sizeof(struct i2c_msg));
 -      tmsgs = &tdata->msgs[0];
 -
 -      if (put_user(nmsgs, &tdata->cmd.nmsgs) ||
 -          put_user(tmsgs, &tdata->cmd.msgs))
 -              return -EFAULT;
 -
 -      for (i = 0; i < nmsgs; i++) {
 -              if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
 -                      return -EFAULT;
 -              if (get_user(datap, &umsgs[i].buf) ||
 -                  put_user(compat_ptr(datap), &tmsgs[i].buf))
 -                      return -EFAULT;
 -      }
 -      return do_ioctl(file, cmd, (unsigned long)tdata);
 -}
 -
 -static int do_i2c_smbus_ioctl(struct file *file,
 -              unsigned int cmd, struct i2c_smbus_ioctl_data32   __user *udata)
 -{
 -      struct i2c_smbus_ioctl_data     __user *tdata;
 -      union {
 -              /* beginnings of those have identical layouts */
 -              struct i2c_smbus_ioctl_data32   data32;
 -              struct i2c_smbus_ioctl_data     data;
 -      } v;
 -
 -      tdata = compat_alloc_user_space(sizeof(*tdata));
 -      if (tdata == NULL)
 -              return -ENOMEM;
 -
 -      memset(&v, 0, sizeof(v));
 -      if (copy_from_user(&v.data32, udata, sizeof(v.data32)))
 -              return -EFAULT;
 -      v.data.data = compat_ptr(v.data32.data);
 -
 -      if (copy_to_user(tdata, &v.data, sizeof(v.data)))
 -              return -EFAULT;
 -
 -      return do_ioctl(file, cmd, (unsigned long)tdata);
 -}
 -
  #define RTC_IRQP_READ32               _IOR('p', 0x0b, compat_ulong_t)
  #define RTC_IRQP_SET32                _IOW('p', 0x0c, compat_ulong_t)
  #define RTC_EPOCH_READ32      _IOR('p', 0x0d, compat_ulong_t)
@@@ -1175,6 -1282,13 +1175,6 @@@ COMPATIBLE_IOCTL(PCIIOC_CONTROLLER
  COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
  COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
  COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
 -/* i2c */
 -COMPATIBLE_IOCTL(I2C_SLAVE)
 -COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
 -COMPATIBLE_IOCTL(I2C_TENBIT)
 -COMPATIBLE_IOCTL(I2C_PEC)
 -COMPATIBLE_IOCTL(I2C_RETRIES)
 -COMPATIBLE_IOCTL(I2C_TIMEOUT)
  /* hiddev */
  COMPATIBLE_IOCTL(HIDIOCGVERSION)
  COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
@@@ -1349,6 -1463,13 +1349,6 @@@ static long do_ioctl_trans(unsigned in
        case TIOCGSERIAL:
        case TIOCSSERIAL:
                return serial_struct_ioctl(file, cmd, argp);
 -      /* i2c */
 -      case I2C_FUNCS:
 -              return w_long(file, cmd, argp);
 -      case I2C_RDWR:
 -              return do_i2c_rdwr_ioctl(file, cmd, argp);
 -      case I2C_SMBUS:
 -              return do_i2c_smbus_ioctl(file, cmd, argp);
        /* Not implemented in the native kernel */
        case RTC_IRQP_READ32:
        case RTC_IRQP_SET32:
@@@ -1458,6 -1579,7 +1458,7 @@@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned 
        case FICLONE:
        case FICLONERANGE:
        case FIDEDUPERANGE:
+       case FS_IOC_FIEMAP:
                goto do_ioctl;
  
        case FIBMAP:
diff --combined fs/fhandle.c
index 474adc8d2a3aa5bb7c34913f38e347c604ede26f,75cef4deaa77a274345a6c6213d576f0c3c43b52..0ace128f5d238c6b3a97cc628f14a21548dafaeb
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  #include <linux/syscalls.h>
  #include <linux/slab.h>
  #include <linux/fs.h>
@@@ -213,8 -212,8 +213,8 @@@ out_err
        return retval;
  }
  
long do_handle_open(int mountdirfd,
-                   struct file_handle __user *ufh, int open_flag)
static long do_handle_open(int mountdirfd, struct file_handle __user *ufh,
+                          int open_flag)
  {
        long retval = 0;
        struct path path;
diff --combined fs/file.c
index 4eecbf4244a5242df38816c7c9bfedbcf3e75313,4115503bb575acbaed46e5e471a882560856ffd1..3b080834b8704d6f931fe73cdd3c18c1a8d95d67
+++ b/fs/file.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   *  linux/fs/file.c
   *
@@@ -593,13 -592,16 +593,16 @@@ void __fd_install(struct files_struct *
  {
        struct fdtable *fdt;
  
-       might_sleep();
        rcu_read_lock_sched();
  
-       while (unlikely(files->resize_in_progress)) {
+       if (unlikely(files->resize_in_progress)) {
                rcu_read_unlock_sched();
-               wait_event(files->resize_wait, !files->resize_in_progress);
-               rcu_read_lock_sched();
+               spin_lock(&files->file_lock);
+               fdt = files_fdtable(files);
+               BUG_ON(fdt->fd[fd] != NULL);
+               rcu_assign_pointer(fdt->fd[fd], file);
+               spin_unlock(&files->file_lock);
+               return;
        }
        /* coupled with smp_wmb() in expand_fdtable() */
        smp_rmb();
@@@ -632,7 -634,6 +635,6 @@@ int __close_fd(struct files_struct *fil
        if (!file)
                goto out_unlock;
        rcu_assign_pointer(fdt->fd[fd], NULL);
-       __clear_close_on_exec(fd, fdt);
        __put_unused_fd(files, fd);
        spin_unlock(&files->file_lock);
        return filp_close(file, files);
diff --combined fs/namei.c
index 287781363763bb8c132ba147ce721e08db68b795,00384488fda1f7a99f8992145b83b3683ccdba71..f0c7a7b9b6ca7562217746369cd8d5d82d43a99f
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   *  linux/fs/namei.c
   *
@@@ -1210,7 -1209,7 +1210,7 @@@ static int follow_managed(struct path *
        /* Given that we're not holding a lock here, we retain the value in a
         * local variable for each dentry as we look at it so that we don't see
         * the components of that value change under us */
 -      while (managed = ACCESS_ONCE(path->dentry->d_flags),
 +      while (managed = READ_ONCE(path->dentry->d_flags),
               managed &= DCACHE_MANAGED_DENTRY,
               unlikely(managed != 0)) {
                /* Allow the filesystem to manage the transit without i_mutex
@@@ -1395,7 -1394,7 +1395,7 @@@ int follow_down(struct path *path
        unsigned managed;
        int ret;
  
 -      while (managed = ACCESS_ONCE(path->dentry->d_flags),
 +      while (managed = READ_ONCE(path->dentry->d_flags),
               unlikely(managed & DCACHE_MANAGED_DENTRY)) {
                /* Allow the filesystem to manage the transit without i_mutex
                 * being held.
@@@ -3459,7 -3458,7 +3459,7 @@@ static int do_tmpfile(struct nameidata 
                goto out;
        child = vfs_tmpfile(path.dentry, op->mode, op->open_flag);
        error = PTR_ERR(child);
-       if (unlikely(IS_ERR(child)))
+       if (IS_ERR(child))
                goto out2;
        dput(path.dentry);
        path.dentry = child;
@@@ -4010,9 -4009,10 +4010,9 @@@ EXPORT_SYMBOL(vfs_unlink)
   * writeout happening, and we don't want to prevent access to the directory
   * while waiting on the I/O.
   */
 -static long do_unlinkat(int dfd, const char __user *pathname)
 +long do_unlinkat(int dfd, struct filename *name)
  {
        int error;
 -      struct filename *name;
        struct dentry *dentry;
        struct path path;
        struct qstr last;
        struct inode *delegated_inode = NULL;
        unsigned int lookup_flags = 0;
  retry:
 -      name = filename_parentat(dfd, getname(pathname), lookup_flags,
 -                              &path, &last, &type);
 +      name = filename_parentat(dfd, name, lookup_flags, &path, &last, &type);
        if (IS_ERR(name))
                return PTR_ERR(name);
  
@@@ -4063,12 -4064,12 +4063,12 @@@ exit2
        mnt_drop_write(path.mnt);
  exit1:
        path_put(&path);
 -      putname(name);
        if (retry_estale(error, lookup_flags)) {
                lookup_flags |= LOOKUP_REVAL;
                inode = NULL;
                goto retry;
        }
 +      putname(name);
        return error;
  
  slashes:
@@@ -4089,12 -4090,12 +4089,12 @@@ SYSCALL_DEFINE3(unlinkat, int, dfd, con
        if (flag & AT_REMOVEDIR)
                return do_rmdir(dfd, pathname);
  
 -      return do_unlinkat(dfd, pathname);
 +      return do_unlinkat(dfd, getname(pathname));
  }
  
  SYSCALL_DEFINE1(unlink, const char __user *, pathname)
  {
 -      return do_unlinkat(AT_FDCWD, pathname);
 +      return do_unlinkat(AT_FDCWD, getname(pathname));
  }
  
  int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
diff --combined fs/pstore/platform.c
index 086e491faf04b655e4fdf2903b105a984e788f04,7256149af306307c1ad44b7aa507b50d8df0ff38..423159abd50182812656c6f73e421da272187670
@@@ -62,7 -62,7 +62,7 @@@ MODULE_PARM_DESC(update_ms, "millisecon
  static int pstore_new_entry;
  
  static void pstore_timefunc(unsigned long);
 -static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
 +static DEFINE_TIMER(pstore_timer, pstore_timefunc);
  
  static void pstore_dowork(struct work_struct *);
  static DECLARE_WORK(pstore_work, pstore_dowork);
@@@ -482,7 -482,10 +482,7 @@@ void pstore_record_init(struct pstore_r
        record->psi = psinfo;
  
        /* Report zeroed timestamp if called before timekeeping has resumed. */
 -      if (__getnstimeofday(&record->time)) {
 -              record->time.tv_sec = 0;
 -              record->time.tv_nsec = 0;
 -      }
 +      record->time = ns_to_timespec(ktime_get_real_fast_ns());
  }
  
  /*
@@@ -651,7 -654,7 +651,7 @@@ static int pstore_write_user_compat(str
                return -EINVAL;
  
        record->buf = memdup_user(buf, record->size);
-       if (unlikely(IS_ERR(record->buf))) {
+       if (IS_ERR(record->buf)) {
                ret = PTR_ERR(record->buf);
                goto out;
        }
diff --combined fs/statfs.c
index c25dd9a26cc1c7c3810c398c1b4bc70e27a6d1d8,6327edf79e0f2ceb32907da885c9939bb1cc8553..b072a8bab71a1464d3d06d9017a2a33d441e0ef9
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  #include <linux/syscalls.h>
  #include <linux/export.h>
  #include <linux/fs.h>
@@@ -217,7 -216,7 +217,7 @@@ SYSCALL_DEFINE3(fstatfs64, unsigned int
        return error;
  }
  
- int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
static int vfs_ustat(dev_t dev, struct kstatfs *sbuf)
  {
        struct super_block *s = user_get_super(dev);
        int err;
diff --combined fs/super.c
index 994db21f59bf58d3f83d750f8524d1c35849706b,8ca15415351ac6ed5fabe0737fc84bcbf87810a7..d4e33e8f1e6fee3172e0e07e9d358587eea34bc4
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   *  linux/fs/super.c
   *
@@@ -155,21 -154,19 +155,19 @@@ static void destroy_super_rcu(struct rc
        schedule_work(&s->destroy_work);
  }
  
- /**
-  *    destroy_super   -       frees a superblock
-  *    @s: superblock to free
-  *
-  *    Frees a superblock.
-  */
- static void destroy_super(struct super_block *s)
+ /* Free a superblock that has never been seen by anyone */
+ static void destroy_unused_super(struct super_block *s)
  {
+       if (!s)
+               return;
+       up_write(&s->s_umount);
        list_lru_destroy(&s->s_dentry_lru);
        list_lru_destroy(&s->s_inode_lru);
        security_sb_free(s);
-       WARN_ON(!list_empty(&s->s_mounts));
        put_user_ns(s->s_user_ns);
        kfree(s->s_subtype);
-       call_rcu(&s->rcu, destroy_super_rcu);
+       /* no delays needed */
+       destroy_super_work(&s->destroy_work);
  }
  
  /**
@@@ -257,7 -254,7 +255,7 @@@ static struct super_block *alloc_super(
        return s;
  
  fail:
-       destroy_super(s);
+       destroy_unused_super(s);
        return NULL;
  }
  
  /*
   * Drop a superblock's refcount.  The caller must hold sb_lock.
   */
- static void __put_super(struct super_block *sb)
+ static void __put_super(struct super_block *s)
  {
-       if (!--sb->s_count) {
-               list_del_init(&sb->s_list);
-               destroy_super(sb);
+       if (!--s->s_count) {
+               list_del_init(&s->s_list);
+               WARN_ON(s->s_dentry_lru.node);
+               WARN_ON(s->s_inode_lru.node);
+               WARN_ON(!list_empty(&s->s_mounts));
+               security_sb_free(s);
+               put_user_ns(s->s_user_ns);
+               kfree(s->s_subtype);
+               call_rcu(&s->rcu, destroy_super_rcu);
        }
  }
  
@@@ -485,19 -488,12 +489,12 @@@ retry
                                continue;
                        if (user_ns != old->s_user_ns) {
                                spin_unlock(&sb_lock);
-                               if (s) {
-                                       up_write(&s->s_umount);
-                                       destroy_super(s);
-                               }
+                               destroy_unused_super(s);
                                return ERR_PTR(-EBUSY);
                        }
                        if (!grab_super(old))
                                goto retry;
-                       if (s) {
-                               up_write(&s->s_umount);
-                               destroy_super(s);
-                               s = NULL;
-                       }
+                       destroy_unused_super(s);
                        return old;
                }
        }
        err = set(s, data);
        if (err) {
                spin_unlock(&sb_lock);
-               up_write(&s->s_umount);
-               destroy_super(s);
+               destroy_unused_super(s);
                return ERR_PTR(err);
        }
        s->s_type = type;
diff --combined include/linux/acct.h
index 18e1955f81f59eaefdff0dad9ac19726426c6201,3912a45b8c89c65c27e4d3adcfdb0d9477351ebc..bc70e81895c097839871ec6e3e36337972c01875
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  /*
   *  BSD Process Accounting for Linux - Definitions
   *
@@@ -20,9 -19,6 +20,6 @@@
  
  
  #ifdef CONFIG_BSD_PROCESS_ACCT
- struct vfsmount;
- struct super_block;
- struct pacct_struct;
  struct pid_namespace;
  extern int acct_parm[]; /* for sysctl */
  extern void acct_collect(long exitcode, int group_dead);
diff --combined include/linux/fs.h
index a2b5d64ea50378dab29938f96315bfc399cb3967,ccbac0ed672c6d8d3bce449b5f266432b9a0958c..e9379e258d6464587bd25b31edaf62856c44b96d
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
  #ifndef _LINUX_FS_H
  #define _LINUX_FS_H
  
@@@ -1702,7 -1701,6 +1702,7 @@@ struct file_operations 
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
 +      unsigned long mmap_supported_flags;
        int (*open) (struct inode *, struct file *);
        int (*flush) (struct file *, fl_owner_t id);
        int (*release) (struct inode *, struct file *);
@@@ -1855,7 -1853,6 +1855,7 @@@ struct super_operations 
  #else
  #define S_DAX         0       /* Make all the DAX code disappear */
  #endif
 +#define S_ENCRYPTED   16384   /* Encrypted file (using fs/crypto/) */
  
  /*
   * Note that nosuid etc flags are inode-specific: setting some file-system
@@@ -1895,7 -1892,6 +1895,7 @@@ static inline bool sb_rdonly(const stru
  #define IS_AUTOMOUNT(inode)   ((inode)->i_flags & S_AUTOMOUNT)
  #define IS_NOSEC(inode)               ((inode)->i_flags & S_NOSEC)
  #define IS_DAX(inode)         ((inode)->i_flags & S_DAX)
 +#define IS_ENCRYPTED(inode)   ((inode)->i_flags & S_ENCRYPTED)
  
  #define IS_WHITEOUT(inode)    (S_ISCHR(inode->i_mode) && \
                                 (inode)->i_rdev == WHITEOUT_DEV)
@@@ -2098,9 -2094,18 +2098,18 @@@ struct file_system_type 
  extern struct dentry *mount_ns(struct file_system_type *fs_type,
        int flags, void *data, void *ns, struct user_namespace *user_ns,
        int (*fill_super)(struct super_block *, void *, int));
+ #ifdef CONFIG_BLOCK
  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data,
        int (*fill_super)(struct super_block *, void *, int));
+ #else
+ static inline struct dentry *mount_bdev(struct file_system_type *fs_type,
+       int flags, const char *dev_name, void *data,
+       int (*fill_super)(struct super_block *, void *, int))
+ {
+       return ERR_PTR(-ENODEV);
+ }
+ #endif
  extern struct dentry *mount_single(struct file_system_type *fs_type,
        int flags, void *data,
        int (*fill_super)(struct super_block *, void *, int));
@@@ -2109,7 -2114,14 +2118,14 @@@ extern struct dentry *mount_nodev(struc
        int (*fill_super)(struct super_block *, void *, int));
  extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path);
  void generic_shutdown_super(struct super_block *sb);
+ #ifdef CONFIG_BLOCK
  void kill_block_super(struct super_block *sb);
+ #else
+ static inline void kill_block_super(struct super_block *sb)
+ {
+       BUG();
+ }
+ #endif
  void kill_anon_super(struct super_block *sb);
  void kill_litter_super(struct super_block *sb);
  void deactivate_super(struct super_block *sb);
@@@ -2173,7 -2185,6 +2189,6 @@@ extern int iterate_mounts(int (*)(struc
  extern int vfs_statfs(const struct path *, struct kstatfs *);
  extern int user_statfs(const char __user *, struct kstatfs *);
  extern int fd_statfs(int, struct kstatfs *);
- extern int vfs_ustat(dev_t, struct kstatfs *);
  extern int freeze_super(struct super_block *super);
  extern int thaw_super(struct super_block *super);
  extern bool our_mnt(struct vfsmount *mnt);
@@@ -2796,7 -2807,6 +2811,7 @@@ extern int do_pipe_flags(int *, int)
        id(KEXEC_IMAGE, kexec-image)            \
        id(KEXEC_INITRAMFS, kexec-initramfs)    \
        id(POLICY, security-policy)             \
 +      id(X509_CERTIFICATE, x509-certificate)  \
        id(MAX_ID, )
  
  #define __fid_enumify(ENUM, dummy) READING_ ## ENUM,
diff --combined ipc/msg.c
index bce7ac1c809998762aab36fc84cf8c431184403c,ebb7ea24ee28786bc7bafff42dfe4acbbf79485b..1bbc029d2b17db2a039e1bd5ac1701720251f010
+++ b/ipc/msg.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * linux/ipc/msg.c
   * Copyright (C) 1992 Krishna Balasubramanian
@@@ -591,13 -590,13 +591,13 @@@ static int copy_compat_msqid_from_user(
  {
        memset(out, 0, sizeof(*out));
        if (version == IPC_64) {
-               struct compat_msqid64_ds *p = buf;
+               struct compat_msqid64_ds __user *p = buf;
                if (get_compat_ipc64_perm(&out->msg_perm, &p->msg_perm))
                        return -EFAULT;
                if (get_user(out->msg_qbytes, &p->msg_qbytes))
                        return -EFAULT;
        } else {
-               struct compat_msqid_ds *p = buf;
+               struct compat_msqid_ds __user *p = buf;
                if (get_compat_ipc_perm(&out->msg_perm, &p->msg_perm))
                        return -EFAULT;
                if (get_user(out->msg_qbytes, &p->msg_qbytes))
diff --combined ipc/sem.c
index b2698ebdcb31e65ea2f3e94f64cc567607b8ca2a,6220e9616207fa018b2ab0af8882bf598694fcf9..a5cff0e109ab5a56fbbd3286cf96e625e99c1b53
+++ b/ipc/sem.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * linux/ipc/sem.c
   * Copyright (C) 1992 Krishna Balasubramanian
@@@ -1637,10 -1636,10 +1637,10 @@@ static int copy_compat_semid_from_user(
  {
        memset(out, 0, sizeof(*out));
        if (version == IPC_64) {
-               struct compat_semid64_ds *p = buf;
+               struct compat_semid64_ds __user *p = buf;
                return get_compat_ipc64_perm(&out->sem_perm, &p->sem_perm);
        } else {
-               struct compat_semid_ds *p = buf;
+               struct compat_semid_ds __user *p = buf;
                return get_compat_ipc_perm(&out->sem_perm, &p->sem_perm);
        }
  }
diff --combined ipc/shm.c
index bd652755d32cc6fee7598b7a8dc257bd65e0c807,41706416a3c431904503a6cafc2888d0525b99d2..7733d768666d557ca08e66ca28986f348b8d6b8b
+++ b/ipc/shm.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * linux/ipc/shm.c
   * Copyright (C) 1992, 1993 Krishna Balasubramanian
@@@ -1155,7 -1154,7 +1155,7 @@@ static int put_compat_shm_info(struct s
        info.shm_swp = ip->shm_swp;
        info.swap_attempts = ip->swap_attempts;
        info.swap_successes = ip->swap_successes;
 -      return copy_to_user(up, &info, sizeof(info));
 +      return copy_to_user(uip, &info, sizeof(info));
  }
  
  static int copy_compat_shmid_to_user(void __user *buf, struct shmid64_ds *in,
@@@ -1194,10 -1193,10 +1194,10 @@@ static int copy_compat_shmid_from_user(
  {
        memset(out, 0, sizeof(*out));
        if (version == IPC_64) {
-               struct compat_shmid64_ds *p = buf;
+               struct compat_shmid64_ds __user *p = buf;
                return get_compat_ipc64_perm(&out->shm_perm, &p->shm_perm);
        } else {
-               struct compat_shmid_ds *p = buf;
+               struct compat_shmid_ds __user *p = buf;
                return get_compat_ipc_perm(&out->shm_perm, &p->shm_perm);
        }
  }
@@@ -1238,7 -1237,7 +1238,7 @@@ COMPAT_SYSCALL_DEFINE3(shmctl, int, shm
                err = shmctl_stat(ns, shmid, cmd, &sem64);
                if (err < 0)
                        return err;
 -              if (copy_compat_shmid_to_user(&sem64, uptr, version))
 +              if (copy_compat_shmid_to_user(uptr, &sem64, version))
                        err = -EFAULT;
                return err;
  
diff --combined ipc/syscall.c
index 26b45db2e007325a4303e6edcebf75afe3991d58,977bffd5a7f8d05aded1c44c89a1987da30effd3..3763b4293b74f7bb7f20e385da70b6168f0bd163
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0
  /*
   * sys_ipc() is the old de-multiplexer for the SysV IPC calls.
   *
@@@ -172,7 -171,7 +172,7 @@@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, 
                               COMPAT_SHMLBA);
                if (err < 0)
                        return err;
-               return put_user(raddr, (compat_ulong_t *)compat_ptr(third));
+               return put_user(raddr, (compat_ulong_t __user *)compat_ptr(third));
        }
        case SHMDT:
                return sys_shmdt(compat_ptr(ptr));