Skip to content

Commit 325d0ea

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge fixes from Andrew Morton: "15 patches. Subsystems affected by this patch series: mailmap, mm/hotfixes, mm/thp, mm/memory-hotplug, misc, kcsan" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: kcsan: kconfig: move to menu 'Generic Kernel Debugging Instruments' fs/fs-writeback.c: adjust dirtytime_interval_handler definition to match prototype stackleak: let stack_erasing_sysctl take a kernel pointer buffer ftrace: let ftrace_enable_sysctl take a kernel pointer buffer mm/memory_hotplug: drain per-cpu pages again during memory offline selftests/vm: fix display of page size in map_hugetlb mm/thp: fix __split_huge_pmd_locked() for migration PMD kprobes: fix kill kprobe which has been marked as gone tmpfs: restore functionality of nr_inodes=0 mlock: fix unevictable_pgs event counts on THP mm: fix check_move_unevictable_pages() on THP mm: migration of hugetlbfs page skip memcg ksm: reinstate memcg charge on copied pages mailmap: add older email addresses for Kees Cook
2 parents c8d1a46 + 2645d43 commit 325d0ea

18 files changed

Lines changed: 102 additions & 50 deletions

File tree

.mailmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ Juha Yrjola <juha.yrjola@solidboot.com>
169169
Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com>
170170
Kamil Konieczny <k.konieczny@samsung.com> <k.konieczny@partner.samsung.com>
171171
Kay Sievers <kay.sievers@vrfy.org>
172+
Kees Cook <keescook@chromium.org> <kees.cook@canonical.com>
173+
Kees Cook <keescook@chromium.org> <keescook@google.com>
174+
Kees Cook <keescook@chromium.org> <kees@outflux.net>
175+
Kees Cook <keescook@chromium.org> <kees@ubuntu.com>
172176
Kenneth W Chen <kenneth.w.chen@intel.com>
173177
Konstantin Khlebnikov <koct9i@gmail.com> <khlebnikov@yandex-team.ru>
174178
Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>

fs/fs-writeback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,7 @@ static int __init start_dirtytime_writeback(void)
21842184
__initcall(start_dirtytime_writeback);
21852185

21862186
int dirtytime_interval_handler(struct ctl_table *table, int write,
2187-
void __user *buffer, size_t *lenp, loff_t *ppos)
2187+
void *buffer, size_t *lenp, loff_t *ppos)
21882188
{
21892189
int ret;
21902190

include/linux/ftrace.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ static inline int ftrace_mod_get_kallsym(unsigned int symnum, unsigned long *val
8585
extern int ftrace_enabled;
8686
extern int
8787
ftrace_enable_sysctl(struct ctl_table *table, int write,
88-
void __user *buffer, size_t *lenp,
89-
loff_t *ppos);
88+
void *buffer, size_t *lenp, loff_t *ppos);
9089

9190
struct ftrace_ops;
9291

include/linux/stackleak.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static inline void stackleak_task_init(struct task_struct *t)
2525

2626
#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
2727
int stack_erasing_sysctl(struct ctl_table *table, int write,
28-
void __user *buffer, size_t *lenp, loff_t *ppos);
28+
void *buffer, size_t *lenp, loff_t *ppos);
2929
#endif
3030

3131
#else /* !CONFIG_GCC_PLUGIN_STACKLEAK */

kernel/kprobes.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,9 @@ static void kill_kprobe(struct kprobe *p)
21402140

21412141
lockdep_assert_held(&kprobe_mutex);
21422142

2143+
if (WARN_ON_ONCE(kprobe_gone(p)))
2144+
return;
2145+
21432146
p->flags |= KPROBE_FLAG_GONE;
21442147
if (kprobe_aggrprobe(p)) {
21452148
/*
@@ -2419,7 +2422,10 @@ static int kprobes_module_callback(struct notifier_block *nb,
24192422
mutex_lock(&kprobe_mutex);
24202423
for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
24212424
head = &kprobe_table[i];
2422-
hlist_for_each_entry(p, head, hlist)
2425+
hlist_for_each_entry(p, head, hlist) {
2426+
if (kprobe_gone(p))
2427+
continue;
2428+
24232429
if (within_module_init((unsigned long)p->addr, mod) ||
24242430
(checkcore &&
24252431
within_module_core((unsigned long)p->addr, mod))) {
@@ -2436,6 +2442,7 @@ static int kprobes_module_callback(struct notifier_block *nb,
24362442
*/
24372443
kill_kprobe(p);
24382444
}
2445+
}
24392446
}
24402447
if (val == MODULE_STATE_GOING)
24412448
remove_module_kprobe_blacklist(mod);

kernel/stackleak.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
static DEFINE_STATIC_KEY_FALSE(stack_erasing_bypass);
2121

2222
int stack_erasing_sysctl(struct ctl_table *table, int write,
23-
void __user *buffer, size_t *lenp, loff_t *ppos)
23+
void *buffer, size_t *lenp, loff_t *ppos)
2424
{
2525
int ret = 0;
2626
int state = !static_branch_unlikely(&stack_erasing_bypass);

kernel/trace/ftrace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7531,8 +7531,7 @@ static bool is_permanent_ops_registered(void)
75317531

75327532
int
75337533
ftrace_enable_sysctl(struct ctl_table *table, int write,
7534-
void __user *buffer, size_t *lenp,
7535-
loff_t *ppos)
7534+
void *buffer, size_t *lenp, loff_t *ppos)
75367535
{
75377536
int ret = -ENODEV;
75387537

lib/Kconfig.debug

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ config DEBUG_FS_ALLOW_NONE
520520
endchoice
521521

522522
source "lib/Kconfig.kgdb"
523-
524523
source "lib/Kconfig.ubsan"
524+
source "lib/Kconfig.kcsan"
525525

526526
endmenu
527527

@@ -1620,8 +1620,6 @@ config PROVIDE_OHCI1394_DMA_INIT
16201620

16211621
source "samples/Kconfig"
16221622

1623-
source "lib/Kconfig.kcsan"
1624-
16251623
config ARCH_HAS_DEVMEM_IS_ALLOWED
16261624
bool
16271625

mm/huge_memory.c

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,7 +2022,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
20222022
put_page(page);
20232023
add_mm_counter(mm, mm_counter_file(page), -HPAGE_PMD_NR);
20242024
return;
2025-
} else if (is_huge_zero_pmd(*pmd)) {
2025+
} else if (pmd_trans_huge(*pmd) && is_huge_zero_pmd(*pmd)) {
20262026
/*
20272027
* FIXME: Do we want to invalidate secondary mmu by calling
20282028
* mmu_notifier_invalidate_range() see comments below inside
@@ -2116,30 +2116,34 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,
21162116
pte = pte_offset_map(&_pmd, addr);
21172117
BUG_ON(!pte_none(*pte));
21182118
set_pte_at(mm, addr, pte, entry);
2119-
atomic_inc(&page[i]._mapcount);
2120-
pte_unmap(pte);
2121-
}
2122-
2123-
/*
2124-
* Set PG_double_map before dropping compound_mapcount to avoid
2125-
* false-negative page_mapped().
2126-
*/
2127-
if (compound_mapcount(page) > 1 && !TestSetPageDoubleMap(page)) {
2128-
for (i = 0; i < HPAGE_PMD_NR; i++)
2119+
if (!pmd_migration)
21292120
atomic_inc(&page[i]._mapcount);
2121+
pte_unmap(pte);
21302122
}
21312123

2132-
lock_page_memcg(page);
2133-
if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
2134-
/* Last compound_mapcount is gone. */
2135-
__dec_lruvec_page_state(page, NR_ANON_THPS);
2136-
if (TestClearPageDoubleMap(page)) {
2137-
/* No need in mapcount reference anymore */
2124+
if (!pmd_migration) {
2125+
/*
2126+
* Set PG_double_map before dropping compound_mapcount to avoid
2127+
* false-negative page_mapped().
2128+
*/
2129+
if (compound_mapcount(page) > 1 &&
2130+
!TestSetPageDoubleMap(page)) {
21382131
for (i = 0; i < HPAGE_PMD_NR; i++)
2139-
atomic_dec(&page[i]._mapcount);
2132+
atomic_inc(&page[i]._mapcount);
2133+
}
2134+
2135+
lock_page_memcg(page);
2136+
if (atomic_add_negative(-1, compound_mapcount_ptr(page))) {
2137+
/* Last compound_mapcount is gone. */
2138+
__dec_lruvec_page_state(page, NR_ANON_THPS);
2139+
if (TestClearPageDoubleMap(page)) {
2140+
/* No need in mapcount reference anymore */
2141+
for (i = 0; i < HPAGE_PMD_NR; i++)
2142+
atomic_dec(&page[i]._mapcount);
2143+
}
21402144
}
2145+
unlock_page_memcg(page);
21412146
}
2142-
unlock_page_memcg(page);
21432147

21442148
smp_wmb(); /* make pte visible before pmd */
21452149
pmd_populate(mm, pmd, pgtable);

mm/ksm.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,10 @@ struct page *ksm_might_need_to_copy(struct page *page,
25862586
return page; /* let do_swap_page report the error */
25872587

25882588
new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address);
2589+
if (new_page && mem_cgroup_charge(new_page, vma->vm_mm, GFP_KERNEL)) {
2590+
put_page(new_page);
2591+
new_page = NULL;
2592+
}
25892593
if (new_page) {
25902594
copy_user_highpage(new_page, page, address, vma);
25912595

0 commit comments

Comments
 (0)