Commit 3dd0130f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (patches from Andrew)

Merge misc fixes from Andrew Morton:
 "Five fixes.

  Subsystems affected by this patch series: MAINTAINERS, mm/pagemap,
  mm/swap, and mm/hugetlb"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged
  mm: validate inode in mapping_set_error()
  mm: mmap: Fix general protection fault in unlink_file_vma()
  MAINTAINERS: Antoine Tenart's email address
  MAINTAINERS: change hardening mailing list
parents 5b697f86 4aab2be0
...@@ -41,7 +41,8 @@ Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com> ...@@ -41,7 +41,8 @@ Andrew Murray <amurray@thegoodpenguin.co.uk> <andrew.murray@arm.com>
Andrew Vasquez <andrew.vasquez@qlogic.com> Andrew Vasquez <andrew.vasquez@qlogic.com>
Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com> Andrey Ryabinin <ryabinin.a.a@gmail.com> <a.ryabinin@samsung.com>
Andy Adamson <andros@citi.umich.edu> Andy Adamson <andros@citi.umich.edu>
Antoine Tenart <antoine.tenart@free-electrons.com> Antoine Tenart <atenart@kernel.org> <antoine.tenart@bootlin.com>
Antoine Tenart <atenart@kernel.org> <antoine.tenart@free-electrons.com>
Antonio Ospite <ao2@ao2.it> <ao2@amarulasolutions.com> Antonio Ospite <ao2@ao2.it> <ao2@amarulasolutions.com>
Archit Taneja <archit@ti.com> Archit Taneja <archit@ti.com>
Ard Biesheuvel <ardb@kernel.org> <ard.biesheuvel@linaro.org> Ard Biesheuvel <ardb@kernel.org> <ard.biesheuvel@linaro.org>
...@@ -188,6 +189,7 @@ Leon Romanovsky <leon@kernel.org> <leonro@nvidia.com> ...@@ -188,6 +189,7 @@ Leon Romanovsky <leon@kernel.org> <leonro@nvidia.com>
Linas Vepstas <linas@austin.ibm.com> Linas Vepstas <linas@austin.ibm.com>
Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch> Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@ascom.ch>
Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de> Linus Lüssing <linus.luessing@c0d3.blue> <linus.luessing@web.de>
<linux-hardening@vger.kernel.org> <kernel-hardening@lists.openwall.com>
Li Yang <leoyang.li@nxp.com> <leoli@freescale.com> Li Yang <leoyang.li@nxp.com> <leoli@freescale.com>
Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org> Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org>
Lukasz Luba <lukasz.luba@arm.com> <l.luba@partner.samsung.com> Lukasz Luba <lukasz.luba@arm.com> <l.luba@partner.samsung.com>
......
...@@ -1628,7 +1628,7 @@ N: meson ...@@ -1628,7 +1628,7 @@ N: meson
ARM/Annapurna Labs ALPINE ARCHITECTURE ARM/Annapurna Labs ALPINE ARCHITECTURE
M: Tsahee Zidenberg <tsahee@annapurnalabs.com> M: Tsahee Zidenberg <tsahee@annapurnalabs.com>
M: Antoine Tenart <antoine.tenart@bootlin.com> M: Antoine Tenart <atenart@kernel.org>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Maintained S: Maintained
F: arch/arm/boot/dts/alpine* F: arch/arm/boot/dts/alpine*
...@@ -7240,7 +7240,7 @@ F: drivers/staging/gasket/ ...@@ -7240,7 +7240,7 @@ F: drivers/staging/gasket/
GCC PLUGINS GCC PLUGINS
M: Kees Cook <keescook@chromium.org> M: Kees Cook <keescook@chromium.org>
R: Emese Revfy <re.emese@gmail.com> R: Emese Revfy <re.emese@gmail.com>
L: kernel-hardening@lists.openwall.com L: linux-hardening@vger.kernel.org
S: Maintained S: Maintained
F: Documentation/kbuild/gcc-plugins.rst F: Documentation/kbuild/gcc-plugins.rst
F: scripts/Makefile.gcc-plugins F: scripts/Makefile.gcc-plugins
...@@ -8678,7 +8678,7 @@ F: drivers/input/input-mt.c ...@@ -8678,7 +8678,7 @@ F: drivers/input/input-mt.c
K: \b(ABS|SYN)_MT_ K: \b(ABS|SYN)_MT_
INSIDE SECURE CRYPTO DRIVER INSIDE SECURE CRYPTO DRIVER
M: Antoine Tenart <antoine.tenart@bootlin.com> M: Antoine Tenart <atenart@kernel.org>
L: linux-crypto@vger.kernel.org L: linux-crypto@vger.kernel.org
S: Maintained S: Maintained
F: drivers/crypto/inside-secure/ F: drivers/crypto/inside-secure/
...@@ -9802,7 +9802,7 @@ F: drivers/scsi/53c700* ...@@ -9802,7 +9802,7 @@ F: drivers/scsi/53c700*
LEAKING_ADDRESSES LEAKING_ADDRESSES
M: Tobin C. Harding <me@tobin.cc> M: Tobin C. Harding <me@tobin.cc>
M: Tycho Andersen <tycho@tycho.pizza> M: Tycho Andersen <tycho@tycho.pizza>
L: kernel-hardening@lists.openwall.com L: linux-hardening@vger.kernel.org
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/tobin/leaks.git
F: scripts/leaking_addresses.pl F: scripts/leaking_addresses.pl
......
...@@ -15,6 +15,7 @@ extern int __khugepaged_enter(struct mm_struct *mm); ...@@ -15,6 +15,7 @@ extern int __khugepaged_enter(struct mm_struct *mm);
extern void __khugepaged_exit(struct mm_struct *mm); extern void __khugepaged_exit(struct mm_struct *mm);
extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma, extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
unsigned long vm_flags); unsigned long vm_flags);
extern void khugepaged_min_free_kbytes_update(void);
#ifdef CONFIG_SHMEM #ifdef CONFIG_SHMEM
extern void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr); extern void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr);
#else #else
...@@ -85,6 +86,10 @@ static inline void collapse_pte_mapped_thp(struct mm_struct *mm, ...@@ -85,6 +86,10 @@ static inline void collapse_pte_mapped_thp(struct mm_struct *mm,
unsigned long addr) unsigned long addr)
{ {
} }
static inline void khugepaged_min_free_kbytes_update(void)
{
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
#endif /* _LINUX_KHUGEPAGED_H */ #endif /* _LINUX_KHUGEPAGED_H */
...@@ -54,6 +54,7 @@ static inline void mapping_set_error(struct address_space *mapping, int error) ...@@ -54,6 +54,7 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
__filemap_set_wb_err(mapping, error); __filemap_set_wb_err(mapping, error);
/* Record it in superblock */ /* Record it in superblock */
if (mapping->host)
errseq_set(&mapping->host->i_sb->s_wb_err, error); errseq_set(&mapping->host->i_sb->s_wb_err, error);
/* Record it in flags for now, for legacy callers */ /* Record it in flags for now, for legacy callers */
......
...@@ -56,6 +56,9 @@ enum scan_result { ...@@ -56,6 +56,9 @@ enum scan_result {
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include <trace/events/huge_memory.h> #include <trace/events/huge_memory.h>
static struct task_struct *khugepaged_thread __read_mostly;
static DEFINE_MUTEX(khugepaged_mutex);
/* default scan 8*512 pte (or vmas) every 30 second */ /* default scan 8*512 pte (or vmas) every 30 second */
static unsigned int khugepaged_pages_to_scan __read_mostly; static unsigned int khugepaged_pages_to_scan __read_mostly;
static unsigned int khugepaged_pages_collapsed; static unsigned int khugepaged_pages_collapsed;
...@@ -2304,8 +2307,6 @@ static void set_recommended_min_free_kbytes(void) ...@@ -2304,8 +2307,6 @@ static void set_recommended_min_free_kbytes(void)
int start_stop_khugepaged(void) int start_stop_khugepaged(void)
{ {
static struct task_struct *khugepaged_thread __read_mostly;
static DEFINE_MUTEX(khugepaged_mutex);
int err = 0; int err = 0;
mutex_lock(&khugepaged_mutex); mutex_lock(&khugepaged_mutex);
...@@ -2332,3 +2333,11 @@ int start_stop_khugepaged(void) ...@@ -2332,3 +2333,11 @@ int start_stop_khugepaged(void)
mutex_unlock(&khugepaged_mutex); mutex_unlock(&khugepaged_mutex);
return err; return err;
} }
void khugepaged_min_free_kbytes_update(void)
{
mutex_lock(&khugepaged_mutex);
if (khugepaged_enabled() && khugepaged_thread)
set_recommended_min_free_kbytes();
mutex_unlock(&khugepaged_mutex);
}
...@@ -1781,7 +1781,11 @@ unsigned long mmap_region(struct file *file, unsigned long addr, ...@@ -1781,7 +1781,11 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
merge = vma_merge(mm, prev, vma->vm_start, vma->vm_end, vma->vm_flags, merge = vma_merge(mm, prev, vma->vm_start, vma->vm_end, vma->vm_flags,
NULL, vma->vm_file, vma->vm_pgoff, NULL, NULL_VM_UFFD_CTX); NULL, vma->vm_file, vma->vm_pgoff, NULL, NULL_VM_UFFD_CTX);
if (merge) { if (merge) {
fput(file); /* ->mmap() can change vma->vm_file and fput the original file. So
* fput the vma->vm_file here or we would add an extra fput for file
* and cause general protection fault ultimately.
*/
fput(vma->vm_file);
vm_area_free(vma); vm_area_free(vma);
vma = merge; vma = merge;
/* Update vm_flags and possible addr to pick up the change. We don't /* Update vm_flags and possible addr to pick up the change. We don't
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include <linux/nmi.h> #include <linux/nmi.h>
#include <linux/psi.h> #include <linux/psi.h>
#include <linux/padata.h> #include <linux/padata.h>
#include <linux/khugepaged.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
...@@ -7904,6 +7905,8 @@ int __meminit init_per_zone_wmark_min(void) ...@@ -7904,6 +7905,8 @@ int __meminit init_per_zone_wmark_min(void)
setup_min_slab_ratio(); setup_min_slab_ratio();
#endif #endif
khugepaged_min_free_kbytes_update();
return 0; return 0;
} }
postcore_initcall(init_per_zone_wmark_min) postcore_initcall(init_per_zone_wmark_min)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment