Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "8 patches. Subsystems affected by this patch series: proc, selftests, kbuild, and mm (pagecache, kasan, hugetlb)" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: mm/hugetlb: clear compound_nr before freeing gigantic pages kasan: fix object remaining in offline per-cpu quarantine elfcore: fix building with clang initramfs: fix clang build failure kbuild: avoid static_assert for genksyms selftest/fpu: avoid clang warning proc: use untagged_addr() for pagemap_read addresses revert "mm/filemap: add static for function __add_to_page_cache_locked"
This commit is contained in:
commit
a06caa4a68
@ -1599,11 +1599,15 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
|
|||||||
|
|
||||||
src = *ppos;
|
src = *ppos;
|
||||||
svpfn = src / PM_ENTRY_BYTES;
|
svpfn = src / PM_ENTRY_BYTES;
|
||||||
start_vaddr = svpfn << PAGE_SHIFT;
|
|
||||||
end_vaddr = mm->task_size;
|
end_vaddr = mm->task_size;
|
||||||
|
|
||||||
/* watch out for wraparound */
|
/* watch out for wraparound */
|
||||||
if (svpfn > mm->task_size >> PAGE_SHIFT)
|
start_vaddr = end_vaddr;
|
||||||
|
if (svpfn <= (ULONG_MAX >> PAGE_SHIFT))
|
||||||
|
start_vaddr = untagged_addr(svpfn << PAGE_SHIFT);
|
||||||
|
|
||||||
|
/* Ensure the address is inside the task */
|
||||||
|
if (start_vaddr > mm->task_size)
|
||||||
start_vaddr = end_vaddr;
|
start_vaddr = end_vaddr;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -77,4 +77,9 @@
|
|||||||
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
|
#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
|
||||||
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
|
#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
|
||||||
|
|
||||||
|
#ifdef __GENKSYMS__
|
||||||
|
/* genksyms gets confused by _Static_assert */
|
||||||
|
#define _Static_assert(expr, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _LINUX_BUILD_BUG_H */
|
#endif /* _LINUX_BUILD_BUG_H */
|
||||||
|
@ -104,6 +104,7 @@ static inline int elf_core_copy_task_fpregs(struct task_struct *t, struct pt_reg
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(CONFIG_UM) || defined(CONFIG_IA64)
|
||||||
/*
|
/*
|
||||||
* These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
|
* These functions parameterize elf_core_dump in fs/binfmt_elf.c to write out
|
||||||
* extra segments containing the gate DSO contents. Dumping its
|
* extra segments containing the gate DSO contents. Dumping its
|
||||||
@ -118,5 +119,26 @@ elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset);
|
|||||||
extern int
|
extern int
|
||||||
elf_core_write_extra_data(struct coredump_params *cprm);
|
elf_core_write_extra_data(struct coredump_params *cprm);
|
||||||
extern size_t elf_core_extra_data_size(void);
|
extern size_t elf_core_extra_data_size(void);
|
||||||
|
#else
|
||||||
|
static inline Elf_Half elf_core_extra_phdrs(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int elf_core_write_extra_data(struct coredump_params *cprm)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline size_t elf_core_extra_data_size(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _LINUX_ELFCORE_H */
|
#endif /* _LINUX_ELFCORE_H */
|
||||||
|
@ -535,7 +535,7 @@ extern unsigned long __initramfs_size;
|
|||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
|
|
||||||
void __weak free_initrd_mem(unsigned long start, unsigned long end)
|
void __weak __init free_initrd_mem(unsigned long start, unsigned long end)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
|
#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
|
||||||
unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
|
unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
|
||||||
|
@ -97,7 +97,6 @@ obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
|
|||||||
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
|
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
|
||||||
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
|
obj-$(CONFIG_TRACEPOINTS) += tracepoint.o
|
||||||
obj-$(CONFIG_LATENCYTOP) += latencytop.o
|
obj-$(CONFIG_LATENCYTOP) += latencytop.o
|
||||||
obj-$(CONFIG_ELFCORE) += elfcore.o
|
|
||||||
obj-$(CONFIG_FUNCTION_TRACER) += trace/
|
obj-$(CONFIG_FUNCTION_TRACER) += trace/
|
||||||
obj-$(CONFIG_TRACING) += trace/
|
obj-$(CONFIG_TRACING) += trace/
|
||||||
obj-$(CONFIG_TRACE_CLOCK) += trace/
|
obj-$(CONFIG_TRACE_CLOCK) += trace/
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0
|
|
||||||
#include <linux/elf.h>
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <linux/mm.h>
|
|
||||||
#include <linux/binfmts.h>
|
|
||||||
#include <linux/elfcore.h>
|
|
||||||
|
|
||||||
Elf_Half __weak elf_core_extra_phdrs(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __weak elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int __weak elf_core_write_extra_data(struct coredump_params *cprm)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t __weak elf_core_extra_data_size(void)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -107,7 +107,7 @@ obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o
|
|||||||
# off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS
|
# off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS
|
||||||
# get appended last to CFLAGS and thus override those previous compiler options.
|
# get appended last to CFLAGS and thus override those previous compiler options.
|
||||||
#
|
#
|
||||||
FPU_CFLAGS := -mhard-float -msse -msse2
|
FPU_CFLAGS := -msse -msse2
|
||||||
ifdef CONFIG_CC_IS_GCC
|
ifdef CONFIG_CC_IS_GCC
|
||||||
# Stack alignment mismatch, proceed with caution.
|
# Stack alignment mismatch, proceed with caution.
|
||||||
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
|
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
|
||||||
@ -120,6 +120,7 @@ ifdef CONFIG_CC_IS_GCC
|
|||||||
# -mpreferred-stack-boundary=3 is not between 4 and 12
|
# -mpreferred-stack-boundary=3 is not between 4 and 12
|
||||||
#
|
#
|
||||||
# can be triggered. Otherwise gcc doesn't complain.
|
# can be triggered. Otherwise gcc doesn't complain.
|
||||||
|
FPU_CFLAGS += -mhard-float
|
||||||
FPU_CFLAGS += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
|
FPU_CFLAGS += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -827,7 +827,7 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(replace_page_cache_page);
|
EXPORT_SYMBOL_GPL(replace_page_cache_page);
|
||||||
|
|
||||||
static noinline int __add_to_page_cache_locked(struct page *page,
|
noinline int __add_to_page_cache_locked(struct page *page,
|
||||||
struct address_space *mapping,
|
struct address_space *mapping,
|
||||||
pgoff_t offset, gfp_t gfp,
|
pgoff_t offset, gfp_t gfp,
|
||||||
void **shadowp)
|
void **shadowp)
|
||||||
|
@ -1216,6 +1216,7 @@ static void destroy_compound_gigantic_page(struct page *page,
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_compound_order(page, 0);
|
set_compound_order(page, 0);
|
||||||
|
page[1].compound_nr = 0;
|
||||||
__ClearPageHead(page);
|
__ClearPageHead(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include <linux/srcu.h>
|
#include <linux/srcu.h>
|
||||||
#include <linux/string.h>
|
#include <linux/string.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/cpuhotplug.h>
|
||||||
|
|
||||||
#include "../slab.h"
|
#include "../slab.h"
|
||||||
#include "kasan.h"
|
#include "kasan.h"
|
||||||
@ -43,6 +44,7 @@ struct qlist_head {
|
|||||||
struct qlist_node *head;
|
struct qlist_node *head;
|
||||||
struct qlist_node *tail;
|
struct qlist_node *tail;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
|
bool offline;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QLIST_INIT { NULL, NULL, 0 }
|
#define QLIST_INIT { NULL, NULL, 0 }
|
||||||
@ -188,6 +190,10 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache)
|
|||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
|
|
||||||
q = this_cpu_ptr(&cpu_quarantine);
|
q = this_cpu_ptr(&cpu_quarantine);
|
||||||
|
if (q->offline) {
|
||||||
|
local_irq_restore(flags);
|
||||||
|
return;
|
||||||
|
}
|
||||||
qlist_put(q, &info->quarantine_link, cache->size);
|
qlist_put(q, &info->quarantine_link, cache->size);
|
||||||
if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
|
if (unlikely(q->bytes > QUARANTINE_PERCPU_SIZE)) {
|
||||||
qlist_move_all(q, &temp);
|
qlist_move_all(q, &temp);
|
||||||
@ -328,3 +334,36 @@ void quarantine_remove_cache(struct kmem_cache *cache)
|
|||||||
|
|
||||||
synchronize_srcu(&remove_cache_srcu);
|
synchronize_srcu(&remove_cache_srcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int kasan_cpu_online(unsigned int cpu)
|
||||||
|
{
|
||||||
|
this_cpu_ptr(&cpu_quarantine)->offline = false;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int kasan_cpu_offline(unsigned int cpu)
|
||||||
|
{
|
||||||
|
struct qlist_head *q;
|
||||||
|
|
||||||
|
q = this_cpu_ptr(&cpu_quarantine);
|
||||||
|
/* Ensure the ordering between the writing to q->offline and
|
||||||
|
* qlist_free_all. Otherwise, cpu_quarantine may be corrupted
|
||||||
|
* by interrupt.
|
||||||
|
*/
|
||||||
|
WRITE_ONCE(q->offline, true);
|
||||||
|
barrier();
|
||||||
|
qlist_free_all(q, NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int __init kasan_cpu_quarantine_init(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "mm/kasan:online",
|
||||||
|
kasan_cpu_online, kasan_cpu_offline);
|
||||||
|
if (ret < 0)
|
||||||
|
pr_err("kasan cpu quarantine register failed [%d]\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
late_initcall(kasan_cpu_quarantine_init);
|
||||||
|
Loading…
Reference in New Issue
Block a user