Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "13 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: memcg: disable hierarchy support if bound to the legacy cgroup hierarchy mm: reorder can_do_mlock to fix audit denial kasan, module: move MODULE_ALIGN macro into <linux/moduleloader.h> kasan, module, vmalloc: rework shadow allocation for modules fanotify: fix event filtering with FAN_ONDIR set mm/nommu.c: export symbol max_mapnr arch/c6x/include/asm/pgtable.h: define dummy pgprot_writecombine for !MMU nilfs2: fix deadlock of segment constructor during recovery mm: cma: fix CMA aligned offset calculation mm, hugetlb: close race when setting PageTail for gigantic pages mm, oom: do not fail __GFP_NOFAIL allocation if oom killer is disabled drivers/rtc/rtc-s3c.c: add .needs_src_clk to s3c6410 RTC data ocfs2: make append_dio an incompat feature
This commit is contained in:
commit
c202baf017
18 changed files with 63 additions and 33 deletions
|
@ -67,6 +67,11 @@ extern unsigned long empty_zero_page;
|
|||
*/
|
||||
#define pgtable_cache_init() do { } while (0)
|
||||
|
||||
/*
|
||||
* c6x is !MMU, so define the simpliest implementation
|
||||
*/
|
||||
#define pgprot_writecombine pgprot_noncached
|
||||
|
||||
#include <asm-generic/pgtable.h>
|
||||
|
||||
#endif /* _ASM_C6X_PGTABLE_H */
|
||||
|
|
|
@ -849,6 +849,7 @@ static struct s3c_rtc_data const s3c2443_rtc_data = {
|
|||
|
||||
static struct s3c_rtc_data const s3c6410_rtc_data = {
|
||||
.max_user_freq = 32768,
|
||||
.needs_src_clk = true,
|
||||
.irq_handler = s3c6410_rtc_irq,
|
||||
.set_freq = s3c6410_rtc_setfreq,
|
||||
.enable_tick = s3c6410_rtc_enable_tick,
|
||||
|
|
|
@ -1907,6 +1907,7 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
|
|||
struct the_nilfs *nilfs)
|
||||
{
|
||||
struct nilfs_inode_info *ii, *n;
|
||||
int during_mount = !(sci->sc_super->s_flags & MS_ACTIVE);
|
||||
int defer_iput = false;
|
||||
|
||||
spin_lock(&nilfs->ns_inode_lock);
|
||||
|
@ -1919,10 +1920,10 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci,
|
|||
brelse(ii->i_bh);
|
||||
ii->i_bh = NULL;
|
||||
list_del_init(&ii->i_dirty);
|
||||
if (!ii->vfs_inode.i_nlink) {
|
||||
if (!ii->vfs_inode.i_nlink || during_mount) {
|
||||
/*
|
||||
* Defer calling iput() to avoid a deadlock
|
||||
* over I_SYNC flag for inodes with i_nlink == 0
|
||||
* Defer calling iput() to avoid deadlocks if
|
||||
* i_nlink == 0 or mount is not yet finished.
|
||||
*/
|
||||
list_add_tail(&ii->i_dirty, &sci->sc_iput_queue);
|
||||
defer_iput = true;
|
||||
|
|
|
@ -143,7 +143,8 @@ static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
|
|||
!(marks_mask & FS_ISDIR & ~marks_ignored_mask))
|
||||
return false;
|
||||
|
||||
if (event_mask & marks_mask & ~marks_ignored_mask)
|
||||
if (event_mask & FAN_ALL_OUTGOING_EVENTS & marks_mask &
|
||||
~marks_ignored_mask)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -502,7 +502,7 @@ static inline int ocfs2_writes_unwritten_extents(struct ocfs2_super *osb)
|
|||
|
||||
static inline int ocfs2_supports_append_dio(struct ocfs2_super *osb)
|
||||
{
|
||||
if (osb->s_feature_ro_compat & OCFS2_FEATURE_RO_COMPAT_APPEND_DIO)
|
||||
if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_APPEND_DIO)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -102,11 +102,11 @@
|
|||
| OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \
|
||||
| OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \
|
||||
| OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG \
|
||||
| OCFS2_FEATURE_INCOMPAT_CLUSTERINFO)
|
||||
| OCFS2_FEATURE_INCOMPAT_CLUSTERINFO \
|
||||
| OCFS2_FEATURE_INCOMPAT_APPEND_DIO)
|
||||
#define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
|
||||
| OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
|
||||
| OCFS2_FEATURE_RO_COMPAT_GRPQUOTA \
|
||||
| OCFS2_FEATURE_RO_COMPAT_APPEND_DIO)
|
||||
| OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
|
||||
|
||||
/*
|
||||
* Heartbeat-only devices are missing journals and other files. The
|
||||
|
@ -178,6 +178,11 @@
|
|||
*/
|
||||
#define OCFS2_FEATURE_INCOMPAT_CLUSTERINFO 0x4000
|
||||
|
||||
/*
|
||||
* Append Direct IO support
|
||||
*/
|
||||
#define OCFS2_FEATURE_INCOMPAT_APPEND_DIO 0x8000
|
||||
|
||||
/*
|
||||
* backup superblock flag is used to indicate that this volume
|
||||
* has backup superblocks.
|
||||
|
@ -200,10 +205,6 @@
|
|||
#define OCFS2_FEATURE_RO_COMPAT_USRQUOTA 0x0002
|
||||
#define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA 0x0004
|
||||
|
||||
/*
|
||||
* Append Direct IO support
|
||||
*/
|
||||
#define OCFS2_FEATURE_RO_COMPAT_APPEND_DIO 0x0008
|
||||
|
||||
/* The byte offset of the first backup block will be 1G.
|
||||
* The following will be 4G, 16G, 64G, 256G and 1T.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
struct kmem_cache;
|
||||
struct page;
|
||||
struct vm_struct;
|
||||
|
||||
#ifdef CONFIG_KASAN
|
||||
|
||||
|
@ -49,15 +50,11 @@ void kasan_krealloc(const void *object, size_t new_size);
|
|||
void kasan_slab_alloc(struct kmem_cache *s, void *object);
|
||||
void kasan_slab_free(struct kmem_cache *s, void *object);
|
||||
|
||||
#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
|
||||
|
||||
int kasan_module_alloc(void *addr, size_t size);
|
||||
void kasan_module_free(void *addr);
|
||||
void kasan_free_shadow(const struct vm_struct *vm);
|
||||
|
||||
#else /* CONFIG_KASAN */
|
||||
|
||||
#define MODULE_ALIGN 1
|
||||
|
||||
static inline void kasan_unpoison_shadow(const void *address, size_t size) {}
|
||||
|
||||
static inline void kasan_enable_current(void) {}
|
||||
|
@ -82,7 +79,7 @@ static inline void kasan_slab_alloc(struct kmem_cache *s, void *object) {}
|
|||
static inline void kasan_slab_free(struct kmem_cache *s, void *object) {}
|
||||
|
||||
static inline int kasan_module_alloc(void *addr, size_t size) { return 0; }
|
||||
static inline void kasan_module_free(void *addr) {}
|
||||
static inline void kasan_free_shadow(const struct vm_struct *vm) {}
|
||||
|
||||
#endif /* CONFIG_KASAN */
|
||||
|
||||
|
|
|
@ -84,4 +84,12 @@ void module_arch_cleanup(struct module *mod);
|
|||
|
||||
/* Any cleanup before freeing mod->module_init */
|
||||
void module_arch_freeing_init(struct module *mod);
|
||||
|
||||
#ifdef CONFIG_KASAN
|
||||
#include <linux/kasan.h>
|
||||
#define MODULE_ALIGN (PAGE_SIZE << KASAN_SHADOW_SCALE_SHIFT)
|
||||
#else
|
||||
#define MODULE_ALIGN PAGE_SIZE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@ struct vm_area_struct; /* vma defining user mapping in mm_types.h */
|
|||
#define VM_VPAGES 0x00000010 /* buffer for pages was vmalloc'ed */
|
||||
#define VM_UNINITIALIZED 0x00000020 /* vm_struct is not fully initialized */
|
||||
#define VM_NO_GUARD 0x00000040 /* don't add guard page */
|
||||
#define VM_KASAN 0x00000080 /* has allocated kasan shadow memory */
|
||||
/* bits [20..32] reserved for arch specific ioremap internals */
|
||||
|
||||
/*
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include <linux/async.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/kmemleak.h>
|
||||
#include <linux/kasan.h>
|
||||
#include <linux/jump_label.h>
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/bsearch.h>
|
||||
|
@ -1814,7 +1813,6 @@ static void unset_module_init_ro_nx(struct module *mod) { }
|
|||
void __weak module_memfree(void *module_region)
|
||||
{
|
||||
vfree(module_region);
|
||||
kasan_module_free(module_region);
|
||||
}
|
||||
|
||||
void __weak module_arch_cleanup(struct module *mod)
|
||||
|
|
12
mm/cma.c
12
mm/cma.c
|
@ -64,15 +64,17 @@ static unsigned long cma_bitmap_aligned_mask(struct cma *cma, int align_order)
|
|||
return (1UL << (align_order - cma->order_per_bit)) - 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a PFN aligned to the specified order and return an offset represented in
|
||||
* order_per_bits.
|
||||
*/
|
||||
static unsigned long cma_bitmap_aligned_offset(struct cma *cma, int align_order)
|
||||
{
|
||||
unsigned int alignment;
|
||||
|
||||
if (align_order <= cma->order_per_bit)
|
||||
return 0;
|
||||
alignment = 1UL << (align_order - cma->order_per_bit);
|
||||
return ALIGN(cma->base_pfn, alignment) -
|
||||
(cma->base_pfn >> cma->order_per_bit);
|
||||
|
||||
return (ALIGN(cma->base_pfn, (1UL << align_order))
|
||||
- cma->base_pfn) >> cma->order_per_bit;
|
||||
}
|
||||
|
||||
static unsigned long cma_bitmap_maxno(struct cma *cma)
|
||||
|
|
|
@ -917,7 +917,6 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order)
|
|||
__SetPageHead(page);
|
||||
__ClearPageReserved(page);
|
||||
for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
|
||||
__SetPageTail(p);
|
||||
/*
|
||||
* For gigantic hugepages allocated through bootmem at
|
||||
* boot, it's safer to be consistent with the not-gigantic
|
||||
|
@ -933,6 +932,9 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order)
|
|||
__ClearPageReserved(p);
|
||||
set_page_count(p, 0);
|
||||
p->first_page = page;
|
||||
/* Make sure p->first_page is always valid for PageTail() */
|
||||
smp_wmb();
|
||||
__SetPageTail(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <linux/stacktrace.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/kasan.h>
|
||||
|
||||
#include "kasan.h"
|
||||
|
@ -414,12 +415,19 @@ int kasan_module_alloc(void *addr, size_t size)
|
|||
GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO,
|
||||
PAGE_KERNEL, VM_NO_GUARD, NUMA_NO_NODE,
|
||||
__builtin_return_address(0));
|
||||
return ret ? 0 : -ENOMEM;
|
||||
|
||||
if (ret) {
|
||||
find_vm_area(addr)->flags |= VM_KASAN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
void kasan_module_free(void *addr)
|
||||
void kasan_free_shadow(const struct vm_struct *vm)
|
||||
{
|
||||
vfree(kasan_mem_to_shadow(addr));
|
||||
if (vm->flags & VM_KASAN)
|
||||
vfree(kasan_mem_to_shadow(vm->addr));
|
||||
}
|
||||
|
||||
static void register_global(struct kasan_global *global)
|
||||
|
|
|
@ -5232,7 +5232,9 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css)
|
|||
* on for the root memcg is enough.
|
||||
*/
|
||||
if (cgroup_on_dfl(root_css->cgroup))
|
||||
mem_cgroup_from_css(root_css)->use_hierarchy = true;
|
||||
root_mem_cgroup->use_hierarchy = true;
|
||||
else
|
||||
root_mem_cgroup->use_hierarchy = false;
|
||||
}
|
||||
|
||||
static u64 memory_current_read(struct cgroup_subsys_state *css,
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
int can_do_mlock(void)
|
||||
{
|
||||
if (capable(CAP_IPC_LOCK))
|
||||
return 1;
|
||||
if (rlimit(RLIMIT_MEMLOCK) != 0)
|
||||
return 1;
|
||||
if (capable(CAP_IPC_LOCK))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(can_do_mlock);
|
||||
|
|
|
@ -62,6 +62,7 @@ void *high_memory;
|
|||
EXPORT_SYMBOL(high_memory);
|
||||
struct page *mem_map;
|
||||
unsigned long max_mapnr;
|
||||
EXPORT_SYMBOL(max_mapnr);
|
||||
unsigned long highest_memmap_pfn;
|
||||
struct percpu_counter vm_committed_as;
|
||||
int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
|
||||
|
|
|
@ -2373,7 +2373,8 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
|
|||
goto out;
|
||||
}
|
||||
/* Exhausted what can be done so it's blamo time */
|
||||
if (out_of_memory(ac->zonelist, gfp_mask, order, ac->nodemask, false))
|
||||
if (out_of_memory(ac->zonelist, gfp_mask, order, ac->nodemask, false)
|
||||
|| WARN_ON_ONCE(gfp_mask & __GFP_NOFAIL))
|
||||
*did_some_progress = 1;
|
||||
out:
|
||||
oom_zonelist_unlock(ac->zonelist, gfp_mask);
|
||||
|
|
|
@ -1418,6 +1418,7 @@ struct vm_struct *remove_vm_area(const void *addr)
|
|||
spin_unlock(&vmap_area_lock);
|
||||
|
||||
vmap_debug_free_range(va->va_start, va->va_end);
|
||||
kasan_free_shadow(vm);
|
||||
free_unmap_vmap_area(va);
|
||||
vm->size -= PAGE_SIZE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue