Skip to content

Commit 50eb842

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "28 patches. Subsystems affected by this series: mm (memblock, pagealloc, hugetlb, highmem, kfence, oom-kill, madvise, kasan, userfaultfd, memcg, and zram), core-kernel, kconfig, fork, binfmt, MAINTAINERS, kbuild, and ia64" * emailed patches from Andrew Morton <[email protected]>: (28 commits) zram: fix broken page writeback zram: fix return value on writeback_store mm/memcg: set memcg when splitting page mm/memcg: rename mem_cgroup_split_huge_fixup to split_page_memcg and add nr_pages argument ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign ia64: fix ia64_syscall_get_set_arguments() for break-based syscalls mm/userfaultfd: fix memory corruption due to writeprotect kasan: fix KASAN_STACK dependency for HW_TAGS kasan, mm: fix crash with HW_TAGS and DEBUG_PAGEALLOC mm/madvise: replace ptrace attach requirement for process_madvise include/linux/sched/mm.h: use rcu_dereference in in_vfork() kfence: fix reports if constant function prefixes exist kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations kfence: fix printk format for ptrdiff_t linux/compiler-clang.h: define HAVE_BUILTIN_BSWAP* MAINTAINERS: exclude uapi directories in API/ABI section binfmt_misc: fix possible deadlock in bm_register_write mm/highmem.c: fix zero_user_segments() with start > end hugetlb: do early cow when page pinned on src mm mm: use is_cow_mapping() across tree where proper ...
2 parents 88fe492 + 2766f18 commit 50eb842

File tree

28 files changed

+332
-214
lines changed

28 files changed

+332
-214
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ ABI/API
261261
262262
F: include/linux/syscalls.h
263263
F: kernel/sys_ni.c
264-
F: include/uapi/
265-
F: arch/*/include/uapi/
264+
X: include/uapi/
265+
X: arch/*/include/uapi/
266266

267267
ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
268268
M: Hans de Goede <[email protected]>

arch/ia64/include/asm/syscall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static inline void syscall_rollback(struct task_struct *task,
3232
static inline long syscall_get_error(struct task_struct *task,
3333
struct pt_regs *regs)
3434
{
35-
return regs->r10 == -1 ? regs->r8:0;
35+
return regs->r10 == -1 ? -regs->r8:0;
3636
}
3737

3838
static inline long syscall_get_return_value(struct task_struct *task,

arch/ia64/kernel/ptrace.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,27 +2013,39 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data)
20132013
{
20142014
struct syscall_get_set_args *args = data;
20152015
struct pt_regs *pt = args->regs;
2016-
unsigned long *krbs, cfm, ndirty;
2016+
unsigned long *krbs, cfm, ndirty, nlocals, nouts;
20172017
int i, count;
20182018

20192019
if (unw_unwind_to_user(info) < 0)
20202020
return;
20212021

2022+
/*
2023+
* We get here via a few paths:
2024+
* - break instruction: cfm is shared with caller.
2025+
* syscall args are in out= regs, locals are non-empty.
2026+
* - epsinstruction: cfm is set by br.call
2027+
* locals don't exist.
2028+
*
2029+
* For both cases argguments are reachable in cfm.sof - cfm.sol.
2030+
* CFM: [ ... | sor: 17..14 | sol : 13..7 | sof : 6..0 ]
2031+
*/
20222032
cfm = pt->cr_ifs;
2033+
nlocals = (cfm >> 7) & 0x7f; /* aka sol */
2034+
nouts = (cfm & 0x7f) - nlocals; /* aka sof - sol */
20232035
krbs = (unsigned long *)info->task + IA64_RBS_OFFSET/8;
20242036
ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
20252037

20262038
count = 0;
20272039
if (in_syscall(pt))
2028-
count = min_t(int, args->n, cfm & 0x7f);
2040+
count = min_t(int, args->n, nouts);
20292041

2042+
/* Iterate over outs. */
20302043
for (i = 0; i < count; i++) {
2044+
int j = ndirty + nlocals + i + args->i;
20312045
if (args->rw)
2032-
*ia64_rse_skip_regs(krbs, ndirty + i + args->i) =
2033-
args->args[i];
2046+
*ia64_rse_skip_regs(krbs, j) = args->args[i];
20342047
else
2035-
args->args[i] = *ia64_rse_skip_regs(krbs,
2036-
ndirty + i + args->i);
2048+
args->args[i] = *ia64_rse_skip_regs(krbs, j);
20372049
}
20382050

20392051
if (!args->rw) {

drivers/block/zram/zram_drv.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ static ssize_t writeback_store(struct device *dev,
627627
struct bio_vec bio_vec;
628628
struct page *page;
629629
ssize_t ret = len;
630-
int mode;
630+
int mode, err;
631631
unsigned long blk_idx = 0;
632632

633633
if (sysfs_streq(buf, "idle"))
@@ -638,8 +638,8 @@ static ssize_t writeback_store(struct device *dev,
638638
if (strncmp(buf, PAGE_WB_SIG, sizeof(PAGE_WB_SIG) - 1))
639639
return -EINVAL;
640640

641-
ret = kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index);
642-
if (ret || index >= nr_pages)
641+
if (kstrtol(buf + sizeof(PAGE_WB_SIG) - 1, 10, &index) ||
642+
index >= nr_pages)
643643
return -EINVAL;
644644

645645
nr_pages = 1;
@@ -663,7 +663,7 @@ static ssize_t writeback_store(struct device *dev,
663663
goto release_init_lock;
664664
}
665665

666-
while (nr_pages--) {
666+
for (; nr_pages != 0; index++, nr_pages--) {
667667
struct bio_vec bvec;
668668

669669
bvec.bv_page = page;
@@ -728,12 +728,17 @@ static ssize_t writeback_store(struct device *dev,
728728
* XXX: A single page IO would be inefficient for write
729729
* but it would be not bad as starter.
730730
*/
731-
ret = submit_bio_wait(&bio);
732-
if (ret) {
731+
err = submit_bio_wait(&bio);
732+
if (err) {
733733
zram_slot_lock(zram, index);
734734
zram_clear_flag(zram, index, ZRAM_UNDER_WB);
735735
zram_clear_flag(zram, index, ZRAM_IDLE);
736736
zram_slot_unlock(zram, index);
737+
/*
738+
* Return last IO error unless every IO were
739+
* not suceeded.
740+
*/
741+
ret = err;
737742
continue;
738743
}
739744

drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,6 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf,
500500
vm_fault_t ret;
501501
pgoff_t fault_page_size;
502502
bool write = vmf->flags & FAULT_FLAG_WRITE;
503-
bool is_cow_mapping =
504-
(vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
505503

506504
switch (pe_size) {
507505
case PE_SIZE_PMD:
@@ -518,7 +516,7 @@ vm_fault_t vmw_bo_vm_huge_fault(struct vm_fault *vmf,
518516
}
519517

520518
/* Always do write dirty-tracking and COW on PTE level. */
521-
if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping))
519+
if (write && (READ_ONCE(vbo->dirty) || is_cow_mapping(vma->vm_flags)))
522520
return VM_FAULT_FALLBACK;
523521

524522
ret = ttm_bo_vm_reserve(bo, vmf);

drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
4949
vma->vm_ops = &vmw_vm_ops;
5050

5151
/* Use VM_PFNMAP rather than VM_MIXEDMAP if not a COW mapping */
52-
if ((vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) != VM_MAYWRITE)
52+
if (!is_cow_mapping(vma->vm_flags))
5353
vma->vm_flags = (vma->vm_flags & ~VM_MIXEDMAP) | VM_PFNMAP;
5454

5555
return 0;

fs/binfmt_misc.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,24 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
649649
struct super_block *sb = file_inode(file)->i_sb;
650650
struct dentry *root = sb->s_root, *dentry;
651651
int err = 0;
652+
struct file *f = NULL;
652653

653654
e = create_entry(buffer, count);
654655

655656
if (IS_ERR(e))
656657
return PTR_ERR(e);
657658

659+
if (e->flags & MISC_FMT_OPEN_FILE) {
660+
f = open_exec(e->interpreter);
661+
if (IS_ERR(f)) {
662+
pr_notice("register: failed to install interpreter file %s\n",
663+
e->interpreter);
664+
kfree(e);
665+
return PTR_ERR(f);
666+
}
667+
e->interp_file = f;
668+
}
669+
658670
inode_lock(d_inode(root));
659671
dentry = lookup_one_len(e->name, root, strlen(e->name));
660672
err = PTR_ERR(dentry);
@@ -678,21 +690,6 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
678690
goto out2;
679691
}
680692

681-
if (e->flags & MISC_FMT_OPEN_FILE) {
682-
struct file *f;
683-
684-
f = open_exec(e->interpreter);
685-
if (IS_ERR(f)) {
686-
err = PTR_ERR(f);
687-
pr_notice("register: failed to install interpreter file %s\n", e->interpreter);
688-
simple_release_fs(&bm_mnt, &entry_count);
689-
iput(inode);
690-
inode = NULL;
691-
goto out2;
692-
}
693-
e->interp_file = f;
694-
}
695-
696693
e->dentry = dget(dentry);
697694
inode->i_private = e;
698695
inode->i_fop = &bm_entry_operations;
@@ -709,6 +706,8 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,
709706
inode_unlock(d_inode(root));
710707

711708
if (err) {
709+
if (f)
710+
filp_close(f, NULL);
712711
kfree(e);
713712
return err;
714713
}

fs/proc/task_mmu.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,8 +1036,6 @@ struct clear_refs_private {
10361036

10371037
#ifdef CONFIG_MEM_SOFT_DIRTY
10381038

1039-
#define is_cow_mapping(flags) (((flags) & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE)
1040-
10411039
static inline bool pte_is_pinned(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
10421040
{
10431041
struct page *page;

include/linux/compiler-clang.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
#define __no_sanitize_thread
3232
#endif
3333

34+
#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
35+
#define __HAVE_BUILTIN_BSWAP32__
36+
#define __HAVE_BUILTIN_BSWAP64__
37+
#define __HAVE_BUILTIN_BSWAP16__
38+
#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
39+
3440
#if __has_feature(undefined_behavior_sanitizer)
3541
/* GCC does not have __SANITIZE_UNDEFINED__ */
3642
#define __no_sanitize_undefined \

include/linux/memblock.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
460460
/*
461461
* Set the allocation direction to bottom-up or top-down.
462462
*/
463-
static inline void memblock_set_bottom_up(bool enable)
463+
static inline __init void memblock_set_bottom_up(bool enable)
464464
{
465465
memblock.bottom_up = enable;
466466
}
@@ -470,7 +470,7 @@ static inline void memblock_set_bottom_up(bool enable)
470470
* if this is true, that said, memblock will allocate memory
471471
* in bottom-up direction.
472472
*/
473-
static inline bool memblock_bottom_up(void)
473+
static inline __init bool memblock_bottom_up(void)
474474
{
475475
return memblock.bottom_up;
476476
}

0 commit comments

Comments
 (0)