Skip to content

Commit

Permalink
Merge branch 'akpm' (patches from Andrew)
Browse files Browse the repository at this point in the history
Merge misc fixes from Andrew Morton:
 "31 fixes"

* emailed patches from Andrew Morton <[email protected]>: (31 commits)
  ocfs2: fix potential use after free
  mm/khugepaged: fix the xas_create_range() error path
  mm/khugepaged: collapse_shmem() do not crash on Compound
  mm/khugepaged: collapse_shmem() without freezing new_page
  mm/khugepaged: minor reorderings in collapse_shmem()
  mm/khugepaged: collapse_shmem() remember to clear holes
  mm/khugepaged: fix crashes due to misaccounted holes
  mm/khugepaged: collapse_shmem() stop if punched or truncated
  mm/huge_memory: fix lockdep complaint on 32-bit i_size_read()
  mm/huge_memory: splitting set mapping+index before unfreeze
  mm/huge_memory: rename freeze_page() to unmap_page()
  initramfs: clean old path before creating a hardlink
  kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace
  psi: make disabling/enabling easier for vendor kernels
  proc: fixup map_files test on arm
  debugobjects: avoid recursive calls with kmemleak
  userfaultfd: shmem: UFFDIO_COPY: set the page dirty if VM_WRITE is not set
  userfaultfd: shmem: add i_size checks
  userfaultfd: shmem/hugetlbfs: only allow to register VM_MAYWRITE vmas
  userfaultfd: shmem: allocate anonymous memory for MAP_PRIVATE shmem
  ...
  • Loading branch information
torvalds committed Dec 1, 2018
2 parents 6c7954b + 164f7e5 commit d8f190e
Show file tree
Hide file tree
Showing 25 changed files with 319 additions and 177 deletions.
4 changes: 4 additions & 0 deletions Documentation/admin-guide/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3505,6 +3505,10 @@
before loading.
See Documentation/blockdev/ramdisk.txt.

psi= [KNL] Enable or disable pressure stall information
tracking.
Format: <bool>

psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to
probe for; one of (bare|imps|exps|lifebook|any).
psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports
Expand Down
13 changes: 7 additions & 6 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ F: drivers/net/wireless/ath/*
ATHEROS ATH5K WIRELESS DRIVER
M: Jiri Slaby <[email protected]>
M: Nick Kossifidis <[email protected]>
M: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
M: Luis Chamberlain <mcgrof@kernel.org>
L: [email protected]
W: http://wireless.kernel.org/en/users/Drivers/ath5k
S: Maintained
Expand Down Expand Up @@ -5835,7 +5835,7 @@ F: include/uapi/linux/firewire*.h
F: tools/firewire/

FIRMWARE LOADER (request_firmware)
M: Luis R. Rodriguez <[email protected]>
M: Luis Chamberlain <[email protected]>
L: [email protected]
S: Maintained
F: Documentation/firmware_class/
Expand Down Expand Up @@ -8135,7 +8135,7 @@ F: tools/testing/selftests/
F: Documentation/dev-tools/kselftest*

KERNEL USERMODE HELPER
M: "Luis R. Rodriguez" <[email protected]>
M: Luis Chamberlain <[email protected]>
L: [email protected]
S: Maintained
F: kernel/umh.c
Expand Down Expand Up @@ -8311,7 +8311,7 @@ F: mm/kmemleak.c
F: mm/kmemleak-test.c

KMOD KERNEL MODULE LOADER - USERMODE HELPER
M: "Luis R. Rodriguez" <[email protected]>
M: Luis Chamberlain <[email protected]>
L: [email protected]
S: Maintained
F: kernel/kmod.c
Expand Down Expand Up @@ -12061,7 +12061,7 @@ F: kernel/printk/
F: include/linux/printk.h

PRISM54 WIRELESS DRIVER
M: "Luis R. Rodriguez" <mcgrof@gmail.com>
M: Luis Chamberlain <mcgrof@kernel.org>
L: [email protected]
W: http://wireless.kernel.org/en/users/Drivers/p54
S: Obsolete
Expand All @@ -12075,9 +12075,10 @@ S: Maintained
F: fs/proc/
F: include/linux/proc_fs.h
F: tools/testing/selftests/proc/
F: Documentation/filesystems/proc.txt

PROC SYSCTL
M: "Luis R. Rodriguez" <[email protected]>
M: Luis Chamberlain <[email protected]>
M: Kees Cook <[email protected]>
L: [email protected]
L: [email protected]
Expand Down
3 changes: 2 additions & 1 deletion fs/hfs/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,14 @@ void hfs_bmap_free(struct hfs_bnode *node)

nidx -= len * 8;
i = node->next;
hfs_bnode_put(node);
if (!i) {
/* panic */;
pr_crit("unable to free bnode %u. bmap not found!\n",
node->this);
hfs_bnode_put(node);
return;
}
hfs_bnode_put(node);
node = hfs_bnode_find(tree, i);
if (IS_ERR(node))
return;
Expand Down
3 changes: 2 additions & 1 deletion fs/hfsplus/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,15 @@ void hfs_bmap_free(struct hfs_bnode *node)

nidx -= len * 8;
i = node->next;
hfs_bnode_put(node);
if (!i) {
/* panic */;
pr_crit("unable to free bnode %u. "
"bmap not found!\n",
node->this);
hfs_bnode_put(node);
return;
}
hfs_bnode_put(node);
node = hfs_bnode_find(tree, i);
if (IS_ERR(node))
return;
Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,

check_gen:
if (handle->ih_generation != inode->i_generation) {
iput(inode);
trace_ocfs2_get_dentry_generation((unsigned long long)blkno,
handle->ih_generation,
inode->i_generation);
iput(inode);
result = ERR_PTR(-ESTALE);
goto bail;
}
Expand Down
47 changes: 26 additions & 21 deletions fs/ocfs2/move_extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,14 @@ static int __ocfs2_move_extent(handle_t *handle,
}

/*
* lock allocators, and reserving appropriate number of bits for
* meta blocks and data clusters.
*
* in some cases, we don't need to reserve clusters, just let data_ac
* be NULL.
* lock allocator, and reserve appropriate number of bits for
* meta blocks.
*/
static int ocfs2_lock_allocators_move_extents(struct inode *inode,
static int ocfs2_lock_meta_allocator_move_extents(struct inode *inode,
struct ocfs2_extent_tree *et,
u32 clusters_to_move,
u32 extents_to_split,
struct ocfs2_alloc_context **meta_ac,
struct ocfs2_alloc_context **data_ac,
int extra_blocks,
int *credits)
{
Expand All @@ -193,13 +189,6 @@ static int ocfs2_lock_allocators_move_extents(struct inode *inode,
goto out;
}

if (data_ac) {
ret = ocfs2_reserve_clusters(osb, clusters_to_move, data_ac);
if (ret) {
mlog_errno(ret);
goto out;
}
}

*credits += ocfs2_calc_extend_credits(osb->sb, et->et_root_el);

Expand Down Expand Up @@ -259,10 +248,10 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
}
}

ret = ocfs2_lock_allocators_move_extents(inode, &context->et, *len, 1,
&context->meta_ac,
&context->data_ac,
extra_blocks, &credits);
ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
*len, 1,
&context->meta_ac,
extra_blocks, &credits);
if (ret) {
mlog_errno(ret);
goto out;
Expand All @@ -285,6 +274,21 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context,
}
}

/*
* Make sure ocfs2_reserve_cluster is called after
* __ocfs2_flush_truncate_log, otherwise, dead lock may happen.
*
* If ocfs2_reserve_cluster is called
* before __ocfs2_flush_truncate_log, dead lock on global bitmap
* may happen.
*
*/
ret = ocfs2_reserve_clusters(osb, *len, &context->data_ac);
if (ret) {
mlog_errno(ret);
goto out_unlock_mutex;
}

handle = ocfs2_start_trans(osb, credits);
if (IS_ERR(handle)) {
ret = PTR_ERR(handle);
Expand Down Expand Up @@ -617,9 +621,10 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context,
}
}

ret = ocfs2_lock_allocators_move_extents(inode, &context->et, len, 1,
&context->meta_ac,
NULL, extra_blocks, &credits);
ret = ocfs2_lock_meta_allocator_move_extents(inode, &context->et,
len, 1,
&context->meta_ac,
extra_blocks, &credits);
if (ret) {
mlog_errno(ret);
goto out;
Expand Down
15 changes: 15 additions & 0 deletions fs/userfaultfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,19 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
ret = -EINVAL;
if (!vma_can_userfault(cur))
goto out_unlock;

/*
* UFFDIO_COPY will fill file holes even without
* PROT_WRITE. This check enforces that if this is a
* MAP_SHARED, the process has write permission to the backing
* file. If VM_MAYWRITE is set it also enforces that on a
* MAP_SHARED vma: there is no F_WRITE_SEAL and no further
* F_WRITE_SEAL can be taken until the vma is destroyed.
*/
ret = -EPERM;
if (unlikely(!(cur->vm_flags & VM_MAYWRITE)))
goto out_unlock;

/*
* If this vma contains ending address, and huge pages
* check alignment.
Expand Down Expand Up @@ -1406,6 +1419,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx,
BUG_ON(!vma_can_userfault(vma));
BUG_ON(vma->vm_userfaultfd_ctx.ctx &&
vma->vm_userfaultfd_ctx.ctx != ctx);
WARN_ON(!(vma->vm_flags & VM_MAYWRITE));

/*
* Nothing to do: this vma is already registered into this
Expand Down Expand Up @@ -1552,6 +1566,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx,
cond_resched();

BUG_ON(!vma_can_userfault(vma));
WARN_ON(!(vma->vm_flags & VM_MAYWRITE));

/*
* Nothing to do: this vma is already registered into this
Expand Down
3 changes: 2 additions & 1 deletion include/linux/psi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _LINUX_PSI_H
#define _LINUX_PSI_H

#include <linux/jump_label.h>
#include <linux/psi_types.h>
#include <linux/sched.h>

Expand All @@ -9,7 +10,7 @@ struct css_set;

#ifdef CONFIG_PSI

extern bool psi_disabled;
extern struct static_key_false psi_disabled;

void psi_init(void);

Expand Down
9 changes: 9 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@ config PSI

Say N if unsure.

config PSI_DEFAULT_DISABLED
bool "Require boot parameter to enable pressure stall information tracking"
default n
depends on PSI
help
If set, pressure stall information tracking will be disabled
per default but can be enabled through passing psi_enable=1
on the kernel commandline during boot.

endmenu # "CPU/Task time and stats accounting"

config CPU_ISOLATION
Expand Down
22 changes: 12 additions & 10 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,6 @@ static int __init do_reset(void)
return 1;
}

static int __init maybe_link(void)
{
if (nlink >= 2) {
char *old = find_link(major, minor, ino, mode, collected);
if (old)
return (ksys_link(old, collected) < 0) ? -1 : 1;
}
return 0;
}

static void __init clean_path(char *path, umode_t fmode)
{
struct kstat st;
Expand All @@ -313,6 +303,18 @@ static void __init clean_path(char *path, umode_t fmode)
}
}

static int __init maybe_link(void)
{
if (nlink >= 2) {
char *old = find_link(major, minor, ino, mode, collected);
if (old) {
clean_path(collected, 0);
return (ksys_link(old, collected) < 0) ? -1 : 1;
}
}
return 0;
}

static __initdata int wfd;

static int __init do_name(void)
Expand Down
4 changes: 2 additions & 2 deletions kernel/kcov.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct kcov {
struct task_struct *t;
};

static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
{
unsigned int mode;

Expand All @@ -78,7 +78,7 @@ static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
return mode == needed_mode;
}

static unsigned long canonicalize_ip(unsigned long ip)
static notrace unsigned long canonicalize_ip(unsigned long ip)
{
#ifdef CONFIG_RANDOMIZE_BASE
ip -= kaslr_offset();
Expand Down
Loading

0 comments on commit d8f190e

Please sign in to comment.