OSDN Git Service

Merge 4.4.148 into android-4.4-p
authorGreg Kroah-Hartman <gregkh@google.com>
Wed, 15 Aug 2018 16:23:58 +0000 (18:23 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 15 Aug 2018 16:23:58 +0000 (18:23 +0200)
Changes in 4.4.148
ext4: fix check to prevent initializing reserved inodes
tpm: fix race condition in tpm_common_write()
ipv4+ipv6: Make INET*_ESP select CRYPTO_ECHAINIV
fork: unconditionally clear stack on fork
parisc: Enable CONFIG_MLONGCALLS by default
parisc: Define mb() and add memory barriers to assembler unlock sequences
xen/netfront: don't cache skb_shinfo()
ACPI / LPSS: Add missing prv_offset setting for byt/cht PWM devices
scsi: sr: Avoid that opening a CD-ROM hangs with runtime power management enabled
root dentries need RCU-delayed freeing
fix mntput/mntput race
fix __legitimize_mnt()/mntput() race
IB/core: Make testing MR flags for writability a static inline function
IB/mlx4: Mark user MR as writable if actual virtual memory is writable
IB/ocrdma: fix out of bounds access to local buffer
ARM: dts: imx6sx: fix irq for pcie bridge
x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
x86/speculation: Protect against userspace-userspace spectreRSB
kprobes/x86: Fix %p uses in error messages
x86/irqflags: Provide a declaration for native_save_fl
x86/speculation/l1tf: Increase 32bit PAE __PHYSICAL_PAGE_SHIFT
x86/mm: Move swap offset/type up in PTE to work around erratum
x86/mm: Fix swap entry comment and macro
mm: x86: move _PAGE_SWP_SOFT_DIRTY from bit 7 to bit 1
x86/speculation/l1tf: Change order of offset/type in swap entry
x86/speculation/l1tf: Protect swap entries against L1TF
x86/speculation/l1tf: Protect PROT_NONE PTEs against speculation
x86/speculation/l1tf: Make sure the first page is always reserved
x86/speculation/l1tf: Add sysfs reporting for l1tf
mm: Add vm_insert_pfn_prot()
mm: fix cache mode tracking in vm_insert_mixed()
x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings
x86/speculation/l1tf: Limit swap file size to MAX_PA/2
x86/bugs: Move the l1tf function and define pr_fmt properly
x86/speculation/l1tf: Extend 64bit swap file size limit
x86/cpufeatures: Add detection of L1D cache flush support.
x86/speculation/l1tf: Protect PAE swap entries against L1TF
x86/speculation/l1tf: Fix up pte->pfn conversion for PAE
x86/speculation/l1tf: Invert all not present mappings
x86/speculation/l1tf: Make pmd/pud_mknotpresent() invert
x86/mm/pat: Make set_memory_np() L1TF safe
x86/mm/kmmio: Make the tracer robust against L1TF
x86/speculation/l1tf: Fix up CPU feature flags
x86/init: fix build with CONFIG_SWAP=n
x86/speculation/l1tf: Unbreak !__HAVE_ARCH_PFN_MODIFY_ALLOWED architectures
Linux 4.4.148

Change-Id: Id593840e382389d43e5e54f9d1cfa1d679d8d8be
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
13 files changed:
1  2 
Makefile
arch/x86/kernel/kprobes/core.c
arch/x86/mm/mmap.c
arch/x86/mm/pageattr.c
fs/dcache.c
fs/ext4/super.c
fs/namespace.c
include/linux/cpu.h
include/linux/mm.h
include/linux/thread_info.h
mm/mprotect.c
mm/swapfile.c
net/ipv4/Kconfig

diff --combined Makefile
+++ b/Makefile
@@@ -1,6 -1,6 +1,6 @@@
  VERSION = 4
  PATCHLEVEL = 4
- SUBLEVEL = 147
+ SUBLEVEL = 148
  EXTRAVERSION =
  NAME = Blurry Fish Butt
  
@@@ -148,7 -148,7 +148,7 @@@ PHONY += $(MAKECMDGOALS) sub-mak
  $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
        @:
  
 -sub-make: FORCE
 +sub-make:
        $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \
        -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS))
  
@@@ -303,7 -303,7 +303,7 @@@ CONFIG_SHELL := $(shell if [ -x "$$BASH
  
  HOSTCC       = gcc
  HOSTCXX      = g++
 -HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
 +HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
  HOSTCXXFLAGS = -O2
  
  ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@@ -371,7 -371,6 +371,7 @@@ LDFLAGS_MODULE  
  CFLAGS_KERNEL =
  AFLAGS_KERNEL =
  CFLAGS_GCOV   = -fprofile-arcs -ftest-coverage -fno-tree-loop-im
 +CFLAGS_KCOV   = -fsanitize-coverage=trace-pc
  
  
  # Use USERINCLUDE when you must reference the UAPI directories only.
@@@ -419,7 -418,7 +419,7 @@@ export MAKE AWK GENKSYMS INSTALLKERNEL 
  export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
  
  export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 -export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KASAN
 +export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV CFLAGS_KCOV CFLAGS_KASAN
  export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
  export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
  export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
@@@ -628,7 -627,7 +628,7 @@@ KBUILD_CFLAGS      += $(call cc-disable-warn
  KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias)
  
  ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 -KBUILD_CFLAGS += -Os
 +KBUILD_CFLAGS += $(call cc-option,-Oz,-Os)
  else
  ifdef CONFIG_PROFILE_ALL_BRANCHES
  KBUILD_CFLAGS += -O2
@@@ -697,31 -696,12 +697,31 @@@ endi
  endif
  KBUILD_CFLAGS += $(stackp-flag)
  
 +ifdef CONFIG_KCOV
 +  ifeq ($(call cc-option, $(CFLAGS_KCOV)),)
 +    $(warning Cannot use CONFIG_KCOV: \
 +             -fsanitize-coverage=trace-pc is not supported by compiler)
 +    CFLAGS_KCOV =
 +  endif
 +endif
 +
  ifeq ($(cc-name),clang)
 +ifneq ($(CROSS_COMPILE),)
 +CLANG_TRIPLE    ?= $(CROSS_COMPILE)
 +CLANG_TARGET  := --target=$(notdir $(CLANG_TRIPLE:%-=%))
 +GCC_TOOLCHAIN := $(realpath $(dir $(shell which $(LD)))/..)
 +endif
 +ifneq ($(GCC_TOOLCHAIN),)
 +CLANG_GCC_TC  := --gcc-toolchain=$(GCC_TOOLCHAIN)
 +endif
 +KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
 +KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
  KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
 -KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
  KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
  KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
  KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
 +KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
 +KBUILD_CFLAGS += $(call cc-disable-warning, duplicate-decl-specifier)
  # Quiet clang warning: comparison of unsigned expression < 0 is always false
  KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
  # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
  # See modpost pattern 2
  KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
  KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
 +KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
 +KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
  else
  
  # These warnings generated too much noise in a regular build.
@@@ -1040,7 -1018,7 +1040,7 @@@ prepare1: prepare2 $(version_h) include
  
  archprepare: archheaders archscripts prepare1 scripts_basic
  
 -prepare0: archprepare FORCE
 +prepare0: archprepare
        $(Q)$(MAKE) $(build)=.
  
  # All the preparing..
@@@ -1085,7 -1063,7 +1085,7 @@@ INSTALL_FW_PATH=$(INSTALL_MOD_PATH)/lib
  export INSTALL_FW_PATH
  
  PHONY += firmware_install
 -firmware_install: FORCE
 +firmware_install:
        @mkdir -p $(objtree)/firmware
        $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_install
  
@@@ -1105,7 -1083,7 +1105,7 @@@ PHONY += archscript
  archscripts:
  
  PHONY += __headers
 -__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE
 +__headers: $(version_h) scripts_basic asm-generic archheaders archscripts
        $(Q)$(MAKE) $(build)=scripts build_unifdef
  
  PHONY += headers_install_all
@@@ -1318,8 -1296,6 +1318,8 @@@ help
        @echo  '                    (default: $$(INSTALL_MOD_PATH)/lib/firmware)'
        @echo  '  dir/            - Build all files in dir and below'
        @echo  '  dir/file.[ois]  - Build specified target only'
 +      @echo  '  dir/file.ll     - Build the LLVM assembly file'
 +      @echo  '                    (requires compiler support for LLVM assembly generation)'
        @echo  '  dir/file.lst    - Build specified mixed source/assembly target only'
        @echo  '                    (requires a recent binutils and recent build (System.map))'
        @echo  '  dir/file.ko     - Build module including final link'
@@@ -1495,7 -1471,6 +1495,7 @@@ clean: $(clean-dirs
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
                -o -name '*.symtypes' -o -name 'modules.order' \
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
 +              -o -name '*.ll' \
                -o -name '*.gcno' \) -type f -print | xargs rm -f
  
  # Generate tags for editors
@@@ -1599,8 -1574,6 +1599,8 @@@ endi
        $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  %.symtypes: %.c prepare scripts FORCE
        $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
 +%.ll: %.c prepare scripts FORCE
 +      $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
  
  # Modules
  /: prepare scripts FORCE
@@@ -49,7 -49,6 +49,7 @@@
  #include <linux/kdebug.h>
  #include <linux/kallsyms.h>
  #include <linux/ftrace.h>
 +#include <linux/kasan.h>
  #include <linux/moduleloader.h>
  
  #include <asm/cacheflush.h>
@@@ -394,7 -393,6 +394,6 @@@ int __copy_instruction(u8 *dest, u8 *sr
                newdisp = (u8 *) src + (s64) insn.displacement.value - (u8 *) dest;
                if ((s64) (s32) newdisp != newdisp) {
                        pr_err("Kprobes error: new displacement does not fit into s32 (%llx)\n", newdisp);
-                       pr_err("\tSrc: %p, Dest: %p, old disp: %x\n", src, dest, insn.displacement.value);
                        return 0;
                }
                disp = (u8 *) dest + insn_offset_displacement(&insn);
@@@ -610,8 -608,7 +609,7 @@@ static int reenter_kprobe(struct kprob
                 * Raise a BUG or we'll continue in an endless reentering loop
                 * and eventually a stack overflow.
                 */
-               printk(KERN_WARNING "Unrecoverable kprobe detected at %p.\n",
-                      p->addr);
+               pr_err("Unrecoverable kprobe detected.\n");
                dump_kprobe(p);
                BUG();
        default:
@@@ -1092,9 -1089,6 +1090,9 @@@ void jprobe_return(void
  {
        struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
  
 +      /* Unpoison stack redzones in the frames we are going to jump over. */
 +      kasan_unpoison_stack_above_sp_to(kcb->jprobe_saved_sp);
 +
        asm volatile (
  #ifdef CONFIG_X86_64
                        "       xchg   %%rbx,%%rsp      \n"
diff --combined arch/x86/mm/mmap.c
@@@ -69,14 -69,14 +69,14 @@@ unsigned long arch_mmap_rnd(void
  {
        unsigned long rnd;
  
 -      /*
 -       *  8 bits of randomness in 32bit mmaps, 20 address space bits
 -       * 28 bits of randomness in 64bit mmaps, 40 address space bits
 -       */
        if (mmap_is_ia32())
 -              rnd = (unsigned long)get_random_int() % (1<<8);
 +#ifdef CONFIG_COMPAT
 +              rnd = get_random_long() & ((1UL << mmap_rnd_compat_bits) - 1);
 +#else
 +              rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
 +#endif
        else
 -              rnd = (unsigned long)get_random_int() % (1<<28);
 +              rnd = get_random_long() & ((1UL << mmap_rnd_bits) - 1);
  
        return rnd << PAGE_SHIFT;
  }
@@@ -121,3 -121,24 +121,24 @@@ const char *arch_vma_name(struct vm_are
                return "[mpx]";
        return NULL;
  }
+ /*
+  * Only allow root to set high MMIO mappings to PROT_NONE.
+  * This prevents an unpriv. user to set them to PROT_NONE and invert
+  * them, then pointing to valid memory for L1TF speculation.
+  *
+  * Note: for locked down kernels may want to disable the root override.
+  */
+ bool pfn_modify_allowed(unsigned long pfn, pgprot_t prot)
+ {
+       if (!boot_cpu_has_bug(X86_BUG_L1TF))
+               return true;
+       if (!__pte_needs_invert(pgprot_val(prot)))
+               return true;
+       /* If it's real memory always allow */
+       if (pfn_valid(pfn))
+               return true;
+       if (pfn > l1tf_pfn_limit() && !capable(CAP_SYS_ADMIN))
+               return false;
+       return true;
+ }
diff --combined arch/x86/mm/pageattr.c
@@@ -279,7 -279,7 +279,7 @@@ static inline pgprot_t static_protectio
                   __pa_symbol(__end_rodata) >> PAGE_SHIFT))
                pgprot_val(forbidden) |= _PAGE_RW;
  
 -#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
 +#if defined(CONFIG_X86_64)
        /*
         * Once the kernel maps the text as RO (kernel_set_to_readonly is set),
         * kernel text mappings for the large page aligned text, rodata sections
@@@ -1006,8 -1006,8 +1006,8 @@@ static int populate_pmd(struct cpa_dat
  
                pmd = pmd_offset(pud, start);
  
-               set_pmd(pmd, __pmd(cpa->pfn | _PAGE_PSE |
-                                  massage_pgprot(pmd_pgprot)));
+               set_pmd(pmd, pmd_mkhuge(pfn_pmd(cpa->pfn,
+                                       canon_pgprot(pmd_pgprot))));
  
                start     += PMD_SIZE;
                cpa->pfn  += PMD_SIZE;
@@@ -1079,8 -1079,8 +1079,8 @@@ static int populate_pud(struct cpa_dat
         * Map everything starting from the Gb boundary, possibly with 1G pages
         */
        while (end - start >= PUD_SIZE) {
-               set_pud(pud, __pud(cpa->pfn | _PAGE_PSE |
-                                  massage_pgprot(pud_pgprot)));
+               set_pud(pud, pud_mkhuge(pfn_pud(cpa->pfn,
+                                  canon_pgprot(pud_pgprot))));
  
                start     += PUD_SIZE;
                cpa->pfn  += PUD_SIZE;
diff --combined fs/dcache.c
@@@ -1954,10 -1954,12 +1954,12 @@@ struct dentry *d_make_root(struct inod
                static const struct qstr name = QSTR_INIT("/", 1);
  
                res = __d_alloc(root_inode->i_sb, &name);
-               if (res)
+               if (res) {
+                       res->d_flags |= DCACHE_RCUACCESS;
                        d_instantiate(res, root_inode);
-               else
+               } else {
                        iput(root_inode);
+               }
        }
        return res;
  }
@@@ -3081,7 -3083,6 +3083,7 @@@ char *d_absolute_path(const struct pat
                return ERR_PTR(error);
        return res;
  }
 +EXPORT_SYMBOL(d_absolute_path);
  
  /*
   * same as __d_path but appends "(deleted)" for unlinked files.
diff --combined fs/ext4/super.c
@@@ -817,6 -817,7 +817,6 @@@ static void ext4_put_super(struct super
        ext4_release_system_zone(sb);
        ext4_mb_release(sb);
        ext4_ext_release(sb);
 -      ext4_xattr_put_super(sb);
  
        if (!(sb->s_flags & MS_RDONLY) && !aborted) {
                ext4_clear_feature_journal_needs_recovery(sb);
@@@ -2874,14 -2875,8 +2874,8 @@@ static ext4_group_t ext4_has_uninit_ita
                if (!gdp)
                        continue;
  
-               if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))
-                       continue;
-               if (group != 0)
+               if (!(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED)))
                        break;
-               ext4_error(sb, "Inode table for bg 0 marked as "
-                          "needing zeroing");
-               if (sb->s_flags & MS_RDONLY)
-                       return ngroups;
        }
  
        return group;
@@@ -3914,7 -3909,7 +3908,7 @@@ static int ext4_fill_super(struct super
  
  no_journal:
        if (ext4_mballoc_ready) {
 -              sbi->s_mb_cache = ext4_xattr_create_cache(sb->s_id);
 +              sbi->s_mb_cache = ext4_xattr_create_cache();
                if (!sbi->s_mb_cache) {
                        ext4_msg(sb, KERN_ERR, "Failed to create an mb_cache");
                        goto failed_mount_wq;
@@@ -4146,10 -4141,6 +4140,10 @@@ failed_mount4
        if (EXT4_SB(sb)->rsv_conversion_wq)
                destroy_workqueue(EXT4_SB(sb)->rsv_conversion_wq);
  failed_mount_wq:
 +      if (sbi->s_mb_cache) {
 +              ext4_xattr_destroy_cache(sbi->s_mb_cache);
 +              sbi->s_mb_cache = NULL;
 +      }
        if (sbi->s_journal) {
                jbd2_journal_destroy(sbi->s_journal);
                sbi->s_journal = NULL;
diff --combined fs/namespace.c
@@@ -227,7 -227,6 +227,7 @@@ static struct mount *alloc_vfsmnt(cons
                mnt->mnt_count = 1;
                mnt->mnt_writers = 0;
  #endif
 +              mnt->mnt.data = NULL;
  
                INIT_HLIST_NODE(&mnt->mnt_hash);
                INIT_LIST_HEAD(&mnt->mnt_child);
@@@ -582,7 -581,6 +582,7 @@@ int sb_prepare_remount_readonly(struct 
  
  static void free_vfsmnt(struct mount *mnt)
  {
 +      kfree(mnt->mnt.data);
        kfree_const(mnt->mnt_devname);
  #ifdef CONFIG_SMP
        free_percpu(mnt->mnt_pcp);
@@@ -605,12 -603,21 +605,21 @@@ int __legitimize_mnt(struct vfsmount *b
                return 0;
        mnt = real_mount(bastard);
        mnt_add_count(mnt, 1);
+       smp_mb();                       // see mntput_no_expire()
        if (likely(!read_seqretry(&mount_lock, seq)))
                return 0;
        if (bastard->mnt_flags & MNT_SYNC_UMOUNT) {
                mnt_add_count(mnt, -1);
                return 1;
        }
+       lock_mount_hash();
+       if (unlikely(bastard->mnt_flags & MNT_DOOMED)) {
+               mnt_add_count(mnt, -1);
+               unlock_mount_hash();
+               return 1;
+       }
+       unlock_mount_hash();
+       /* caller will mntput() */
        return -1;
  }
  
@@@ -977,18 -984,10 +986,18 @@@ vfs_kern_mount(struct file_system_type 
        if (!mnt)
                return ERR_PTR(-ENOMEM);
  
 +      if (type->alloc_mnt_data) {
 +              mnt->mnt.data = type->alloc_mnt_data();
 +              if (!mnt->mnt.data) {
 +                      mnt_free_id(mnt);
 +                      free_vfsmnt(mnt);
 +                      return ERR_PTR(-ENOMEM);
 +              }
 +      }
        if (flags & MS_KERNMOUNT)
                mnt->mnt.mnt_flags = MNT_INTERNAL;
  
 -      root = mount_fs(type, flags, name, data);
 +      root = mount_fs(type, flags, name, &mnt->mnt, data);
        if (IS_ERR(root)) {
                mnt_free_id(mnt);
                free_vfsmnt(mnt);
@@@ -1017,14 -1016,6 +1026,14 @@@ static struct mount *clone_mnt(struct m
        if (!mnt)
                return ERR_PTR(-ENOMEM);
  
 +      if (sb->s_op->clone_mnt_data) {
 +              mnt->mnt.data = sb->s_op->clone_mnt_data(old->mnt.data);
 +              if (!mnt->mnt.data) {
 +                      err = -ENOMEM;
 +                      goto out_free;
 +              }
 +      }
 +
        if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE))
                mnt->mnt_group_id = 0; /* not a peer of original */
        else
@@@ -1142,12 -1133,27 +1151,27 @@@ static DECLARE_DELAYED_WORK(delayed_mnt
  static void mntput_no_expire(struct mount *mnt)
  {
        rcu_read_lock();
-       mnt_add_count(mnt, -1);
-       if (likely(mnt->mnt_ns)) { /* shouldn't be the last one */
+       if (likely(READ_ONCE(mnt->mnt_ns))) {
+               /*
+                * Since we don't do lock_mount_hash() here,
+                * ->mnt_ns can change under us.  However, if it's
+                * non-NULL, then there's a reference that won't
+                * be dropped until after an RCU delay done after
+                * turning ->mnt_ns NULL.  So if we observe it
+                * non-NULL under rcu_read_lock(), the reference
+                * we are dropping is not the final one.
+                */
+               mnt_add_count(mnt, -1);
                rcu_read_unlock();
                return;
        }
        lock_mount_hash();
+       /*
+        * make sure that if __legitimize_mnt() has not seen us grab
+        * mount_lock, we'll see their refcount increment here.
+        */
+       smp_mb();
+       mnt_add_count(mnt, -1);
        if (mnt_get_count(mnt)) {
                rcu_read_unlock();
                unlock_mount_hash();
@@@ -2307,14 -2313,8 +2331,14 @@@ static int do_remount(struct path *path
                err = change_mount_flags(path->mnt, flags);
        else if (!capable(CAP_SYS_ADMIN))
                err = -EPERM;
 -      else
 -              err = do_remount_sb(sb, flags, data, 0);
 +      else {
 +              err = do_remount_sb2(path->mnt, sb, flags, data, 0);
 +              namespace_lock();
 +              lock_mount_hash();
 +              propagate_remount(mnt);
 +              unlock_mount_hash();
 +              namespace_unlock();
 +      }
        if (!err) {
                lock_mount_hash();
                mnt_flags |= mnt->mnt.mnt_flags & ~MNT_USER_SETTABLE_MASK;
diff --combined include/linux/cpu.h
@@@ -48,6 -48,8 +48,8 @@@ extern ssize_t cpu_show_spectre_v2(stru
                                   struct device_attribute *attr, char *buf);
  extern ssize_t cpu_show_spec_store_bypass(struct device *dev,
                                          struct device_attribute *attr, char *buf);
+ extern ssize_t cpu_show_l1tf(struct device *dev,
+                            struct device_attribute *attr, char *buf);
  
  extern __printf(4, 5)
  struct device *cpu_device_create(struct device *parent, void *drvdata,
@@@ -292,11 -294,4 +294,11 @@@ bool cpu_wait_death(unsigned int cpu, i
  bool cpu_report_death(void);
  #endif /* #ifdef CONFIG_HOTPLUG_CPU */
  
 +#define IDLE_START 1
 +#define IDLE_END 2
 +
 +void idle_notifier_register(struct notifier_block *n);
 +void idle_notifier_unregister(struct notifier_block *n);
 +void idle_notifier_call_chain(unsigned long val);
 +
  #endif /* _LINUX_CPU_H_ */
diff --combined include/linux/mm.h
@@@ -51,17 -51,6 +51,17 @@@ extern int sysctl_legacy_va_layout
  #define sysctl_legacy_va_layout 0
  #endif
  
 +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
 +extern const int mmap_rnd_bits_min;
 +extern const int mmap_rnd_bits_max;
 +extern int mmap_rnd_bits __read_mostly;
 +#endif
 +#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
 +extern const int mmap_rnd_compat_bits_min;
 +extern const int mmap_rnd_compat_bits_max;
 +extern int mmap_rnd_compat_bits __read_mostly;
 +#endif
 +
  #include <asm/page.h>
  #include <asm/pgtable.h>
  #include <asm/processor.h>
  #define __pa_symbol(x)  __pa(RELOC_HIDE((unsigned long)(x), 0))
  #endif
  
 +#ifndef lm_alias
 +#define lm_alias(x)   __va(__pa_symbol(x))
 +#endif
 +
  /*
   * To prevent common memory management code establishing
   * a zero page mapping on a read fault.
@@@ -1078,7 -1063,6 +1078,7 @@@ extern void pagefault_out_of_memory(voi
  extern void show_free_areas(unsigned int flags);
  extern bool skip_free_areas_node(unsigned int flags, int nid);
  
 +void shmem_set_file(struct vm_area_struct *vma, struct file *file);
  int shmem_zero_setup(struct vm_area_struct *);
  #ifdef CONFIG_SHMEM
  bool shmem_mapping(struct address_space *mapping);
@@@ -1858,7 -1842,7 +1858,7 @@@ extern int vma_adjust(struct vm_area_st
  extern struct vm_area_struct *vma_merge(struct mm_struct *,
        struct vm_area_struct *prev, unsigned long addr, unsigned long end,
        unsigned long vm_flags, struct anon_vma *, struct file *, pgoff_t,
 -      struct mempolicy *, struct vm_userfaultfd_ctx);
 +      struct mempolicy *, struct vm_userfaultfd_ctx, const char __user *);
  extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);
  extern int split_vma(struct mm_struct *,
        struct vm_area_struct *, unsigned long addr, int new_below);
@@@ -2099,6 -2083,8 +2099,8 @@@ int remap_pfn_range(struct vm_area_stru
  int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
  int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
                        unsigned long pfn);
+ int vm_insert_pfn_prot(struct vm_area_struct *vma, unsigned long addr,
+                       unsigned long pfn, pgprot_t pgprot);
  int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
                        unsigned long pfn);
  int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len);
@@@ -2165,18 -2151,14 +2167,18 @@@ kernel_map_pages(struct page *page, in
  }
  #ifdef CONFIG_HIBERNATION
  extern bool kernel_page_present(struct page *page);
 -#endif /* CONFIG_HIBERNATION */
 -#else
 +#endif        /* CONFIG_HIBERNATION */
 +#else /* CONFIG_DEBUG_PAGEALLOC */
  static inline void
  kernel_map_pages(struct page *page, int numpages, int enable) {}
  #ifdef CONFIG_HIBERNATION
  static inline bool kernel_page_present(struct page *page) { return true; }
 -#endif /* CONFIG_HIBERNATION */
 -#endif
 +#endif        /* CONFIG_HIBERNATION */
 +static inline bool debug_pagealloc_enabled(void)
 +{
 +      return false;
 +}
 +#endif        /* CONFIG_DEBUG_PAGEALLOC */
  
  #ifdef __HAVE_ARCH_GATE_AREA
  extern struct vm_area_struct *get_gate_vma(struct mm_struct *mm);
@@@ -9,28 -9,53 +9,24 @@@
  
  #include <linux/types.h>
  #include <linux/bug.h>
 +#include <linux/restart_block.h>
  
 -struct timespec;
 -struct compat_timespec;
 -
 +#ifdef CONFIG_THREAD_INFO_IN_TASK
  /*
 - * System call restart block.
 + * For CONFIG_THREAD_INFO_IN_TASK kernels we need <asm/current.h> for the
 + * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels,
 + * including <asm/current.h> can cause a circular dependency on some platforms.
   */
 -struct restart_block {
 -      long (*fn)(struct restart_block *);
 -      union {
 -              /* For futex_wait and futex_wait_requeue_pi */
 -              struct {
 -                      u32 __user *uaddr;
 -                      u32 val;
 -                      u32 flags;
 -                      u32 bitset;
 -                      u64 time;
 -                      u32 __user *uaddr2;
 -              } futex;
 -              /* For nanosleep */
 -              struct {
 -                      clockid_t clockid;
 -                      struct timespec __user *rmtp;
 -#ifdef CONFIG_COMPAT
 -                      struct compat_timespec __user *compat_rmtp;
 +#include <asm/current.h>
 +#define current_thread_info() ((struct thread_info *)current)
  #endif
 -                      u64 expires;
 -              } nanosleep;
 -              /* For poll */
 -              struct {
 -                      struct pollfd __user *ufds;
 -                      int nfds;
 -                      int has_timeout;
 -                      unsigned long tv_sec;
 -                      unsigned long tv_nsec;
 -              } poll;
 -      };
 -};
 -
 -extern long do_no_restart_syscall(struct restart_block *parm);
  
  #include <linux/bitops.h>
  #include <asm/thread_info.h>
  
  #ifdef __KERNEL__
  
- #ifdef CONFIG_DEBUG_STACK_USAGE
- # define THREADINFO_GFP               (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
- #else
- # define THREADINFO_GFP               (GFP_KERNEL | __GFP_NOTRACK)
- #endif
+ #define THREADINFO_GFP                (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
  
  /*
   * flag set/clear/test wrappers
@@@ -116,31 -141,6 +112,31 @@@ static inline bool test_and_clear_resto
  #error "no set_restore_sigmask() provided and default one won't work"
  #endif
  
 +#ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES
 +static inline int arch_within_stack_frames(const void * const stack,
 +                                         const void * const stackend,
 +                                         const void *obj, unsigned long len)
 +{
 +      return 0;
 +}
 +#endif
 +
 +#ifdef CONFIG_HARDENED_USERCOPY
 +extern void __check_object_size(const void *ptr, unsigned long n,
 +                                      bool to_user);
 +
 +static __always_inline void check_object_size(const void *ptr, unsigned long n,
 +                                            bool to_user)
 +{
 +      if (!__builtin_constant_p(n))
 +              __check_object_size(ptr, n, to_user);
 +}
 +#else
 +static inline void check_object_size(const void *ptr, unsigned long n,
 +                                   bool to_user)
 +{ }
 +#endif /* CONFIG_HARDENED_USERCOPY */
 +
  #endif        /* __KERNEL__ */
  
  #endif /* _LINUX_THREAD_INFO_H */
diff --combined mm/mprotect.c
@@@ -255,6 -255,42 +255,42 @@@ unsigned long change_protection(struct 
        return pages;
  }
  
+ static int prot_none_pte_entry(pte_t *pte, unsigned long addr,
+                              unsigned long next, struct mm_walk *walk)
+ {
+       return pfn_modify_allowed(pte_pfn(*pte), *(pgprot_t *)(walk->private)) ?
+               0 : -EACCES;
+ }
+ static int prot_none_hugetlb_entry(pte_t *pte, unsigned long hmask,
+                                  unsigned long addr, unsigned long next,
+                                  struct mm_walk *walk)
+ {
+       return pfn_modify_allowed(pte_pfn(*pte), *(pgprot_t *)(walk->private)) ?
+               0 : -EACCES;
+ }
+ static int prot_none_test(unsigned long addr, unsigned long next,
+                         struct mm_walk *walk)
+ {
+       return 0;
+ }
+ static int prot_none_walk(struct vm_area_struct *vma, unsigned long start,
+                          unsigned long end, unsigned long newflags)
+ {
+       pgprot_t new_pgprot = vm_get_page_prot(newflags);
+       struct mm_walk prot_none_walk = {
+               .pte_entry = prot_none_pte_entry,
+               .hugetlb_entry = prot_none_hugetlb_entry,
+               .test_walk = prot_none_test,
+               .mm = current->mm,
+               .private = &new_pgprot,
+       };
+       return walk_page_range(start, end, &prot_none_walk);
+ }
  int
  mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
        unsigned long start, unsigned long end, unsigned long newflags)
        }
  
        /*
+        * Do PROT_NONE PFN permission checks here when we can still
+        * bail out without undoing a lot of state. This is a rather
+        * uncommon case, so doesn't need to be very optimized.
+        */
+       if (arch_has_pfn_modify_check() &&
+           (vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) &&
+           (newflags & (VM_READ|VM_WRITE|VM_EXEC)) == 0) {
+               error = prot_none_walk(vma, start, end, newflags);
+               if (error)
+                       return error;
+       }
+       /*
         * If we make a private mapping writable we increase our commit;
         * but (without finer accounting) cannot reduce our commit if we
         * make it unwritable again. hugetlb mapping were accounted for
        pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
        *pprev = vma_merge(mm, *pprev, start, end, newflags,
                           vma->anon_vma, vma->vm_file, pgoff, vma_policy(vma),
 -                         vma->vm_userfaultfd_ctx);
 +                         vma->vm_userfaultfd_ctx, vma_get_anon_name(vma));
        if (*pprev) {
                vma = *pprev;
                goto success;
diff --combined mm/swapfile.c
@@@ -2206,6 -2206,35 +2206,35 @@@ static int claim_swapfile(struct swap_i
        return 0;
  }
  
+ /*
+  * Find out how many pages are allowed for a single swap device. There
+  * are two limiting factors:
+  * 1) the number of bits for the swap offset in the swp_entry_t type, and
+  * 2) the number of bits in the swap pte, as defined by the different
+  * architectures.
+  *
+  * In order to find the largest possible bit mask, a swap entry with
+  * swap type 0 and swap offset ~0UL is created, encoded to a swap pte,
+  * decoded to a swp_entry_t again, and finally the swap offset is
+  * extracted.
+  *
+  * This will mask all the bits from the initial ~0UL mask that can't
+  * be encoded in either the swp_entry_t or the architecture definition
+  * of a swap pte.
+  */
+ unsigned long generic_max_swapfile_size(void)
+ {
+       return swp_offset(pte_to_swp_entry(
+                       swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
+ }
+ /* Can be overridden by an architecture for additional checks. */
+ __weak unsigned long max_swapfile_size(void)
+ {
+       return generic_max_swapfile_size();
+ }
  static unsigned long read_swap_header(struct swap_info_struct *p,
                                        union swap_header *swap_header,
                                        struct inode *inode)
        p->cluster_next = 1;
        p->cluster_nr = 0;
  
-       /*
-        * Find out how many pages are allowed for a single swap
-        * device. There are two limiting factors: 1) the number
-        * of bits for the swap offset in the swp_entry_t type, and
-        * 2) the number of bits in the swap pte as defined by the
-        * different architectures. In order to find the
-        * largest possible bit mask, a swap entry with swap type 0
-        * and swap offset ~0UL is created, encoded to a swap pte,
-        * decoded to a swp_entry_t again, and finally the swap
-        * offset is extracted. This will mask all the bits from
-        * the initial ~0UL mask that can't be encoded in either
-        * the swp_entry_t or the architecture definition of a
-        * swap pte.
-        */
-       maxpages = swp_offset(pte_to_swp_entry(
-                       swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
+       maxpages = max_swapfile_size();
        last_page = swap_header->info.last_page;
        if (!last_page) {
                pr_warn("Empty swap-file\n");
@@@ -2546,7 -2560,8 +2560,7 @@@ SYSCALL_DEFINE2(swapon, const char __us
                  (swap_flags & SWAP_FLAG_PRIO_MASK) >> SWAP_FLAG_PRIO_SHIFT;
        enable_swap_info(p, prio, swap_map, cluster_info, frontswap_map);
  
 -      pr_info("Adding %uk swap on %s.  "
 -                      "Priority:%d extents:%d across:%lluk %s%s%s%s%s\n",
 +      pr_info("Adding %uk swap on %s.  Priority:%d extents:%d across:%lluk %s%s%s%s%s\n",
                p->pages<<(PAGE_SHIFT-10), name->name, p->prio,
                nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10),
                (p->flags & SWP_SOLIDSTATE) ? "SS" : "",
diff --combined net/ipv4/Kconfig
@@@ -354,6 -354,7 +354,7 @@@ config INET_ES
        select CRYPTO_CBC
        select CRYPTO_SHA1
        select CRYPTO_DES
+       select CRYPTO_ECHAINIV
        ---help---
          Support for IPsec ESP.
  
@@@ -437,19 -438,6 +438,19 @@@ config INET_UDP_DIA
          Support for UDP socket monitoring interface used by the ss tool.
          If unsure, say Y.
  
 +config INET_DIAG_DESTROY
 +      bool "INET: allow privileged process to administratively close sockets"
 +      depends on INET_DIAG
 +      default n
 +      ---help---
 +        Provides a SOCK_DESTROY operation that allows privileged processes
 +        (e.g., a connection manager or a network administration tool such as
 +        ss) to close sockets opened by other processes. Closing a socket in
 +        this way interrupts any blocking read/write/connect operations on
 +        the socket and causes future socket calls to behave as if the socket
 +        had been disconnected.
 +        If unsure, say N.
 +
  menuconfig TCP_CONG_ADVANCED
        bool "TCP: advanced congestion control"
        ---help---