Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton: - MM remainders - various misc things - kcov updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (27 commits) lib/test_printf.c: call wait_for_random_bytes() before plain %p tests hexagon: drop the unused variable zero_page_mask hexagon: fix printk format warning in setup.c mm: fix oom_kill event handling treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAX mm: use octal not symbolic permissions ipc: use new return type vm_fault_t sysvipc/sem: mitigate semnum index against spectre v1 fault-injection: reorder config entries arm: port KCOV to arm sched/core / kcov: avoid kcov_area during task switch kcov: prefault the kcov_area kcov: ensure irq code sees a valid area kernel/relay.c: change return type to vm_fault_t exofs: avoid VLA in structures coredump: fix spam with zero VMA process fat: use fat_fs_error() instead of BUG_ON() in __fat_get_block() proc: skip branch in /proc/*/* lookup mremap: remove LATENCY_LIMIT from mremap to reduce the number of TLB shootdowns mm/memblock: add missing include <linux/bootmem.h> ...
这个提交包含在:
@@ -440,6 +440,14 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
|
||||
continue;
|
||||
}
|
||||
charge = 0;
|
||||
/*
|
||||
* Don't duplicate many vmas if we've been oom-killed (for
|
||||
* example)
|
||||
*/
|
||||
if (fatal_signal_pending(current)) {
|
||||
retval = -EINTR;
|
||||
goto out;
|
||||
}
|
||||
if (mpnt->vm_flags & VM_ACCOUNT) {
|
||||
unsigned long len = vma_pages(mpnt);
|
||||
|
||||
|
@@ -58,7 +58,7 @@ struct kcov {
|
||||
|
||||
static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
|
||||
{
|
||||
enum kcov_mode mode;
|
||||
unsigned int mode;
|
||||
|
||||
/*
|
||||
* We are interested in code coverage as a function of a syscall inputs,
|
||||
@@ -241,7 +241,8 @@ static void kcov_put(struct kcov *kcov)
|
||||
|
||||
void kcov_task_init(struct task_struct *t)
|
||||
{
|
||||
t->kcov_mode = KCOV_MODE_DISABLED;
|
||||
WRITE_ONCE(t->kcov_mode, KCOV_MODE_DISABLED);
|
||||
barrier();
|
||||
t->kcov_size = 0;
|
||||
t->kcov_area = NULL;
|
||||
t->kcov = NULL;
|
||||
@@ -323,6 +324,21 @@ static int kcov_close(struct inode *inode, struct file *filep)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fault in a lazily-faulted vmalloc area before it can be used by
|
||||
* __santizer_cov_trace_pc(), to avoid recursion issues if any code on the
|
||||
* vmalloc fault handling path is instrumented.
|
||||
*/
|
||||
static void kcov_fault_in_area(struct kcov *kcov)
|
||||
{
|
||||
unsigned long stride = PAGE_SIZE / sizeof(unsigned long);
|
||||
unsigned long *area = kcov->area;
|
||||
unsigned long offset;
|
||||
|
||||
for (offset = 0; offset < kcov->size; offset += stride)
|
||||
READ_ONCE(area[offset]);
|
||||
}
|
||||
|
||||
static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
@@ -371,6 +387,7 @@ static int kcov_ioctl_locked(struct kcov *kcov, unsigned int cmd,
|
||||
#endif
|
||||
else
|
||||
return -EINVAL;
|
||||
kcov_fault_in_area(kcov);
|
||||
/* Cache in task struct for performance. */
|
||||
t->kcov_size = kcov->size;
|
||||
t->kcov_area = kcov->area;
|
||||
|
@@ -829,6 +829,8 @@ static int kimage_load_normal_segment(struct kimage *image,
|
||||
else
|
||||
buf += mchunk;
|
||||
mbytes -= mchunk;
|
||||
|
||||
cond_resched();
|
||||
}
|
||||
out:
|
||||
return result;
|
||||
@@ -893,6 +895,8 @@ static int kimage_load_crash_segment(struct kimage *image,
|
||||
else
|
||||
buf += mchunk;
|
||||
mbytes -= mchunk;
|
||||
|
||||
cond_resched();
|
||||
}
|
||||
out:
|
||||
return result;
|
||||
|
@@ -39,7 +39,7 @@ static void relay_file_mmap_close(struct vm_area_struct *vma)
|
||||
/*
|
||||
* fault() vm_op implementation for relay file mapping.
|
||||
*/
|
||||
static int relay_buf_fault(struct vm_fault *vmf)
|
||||
static vm_fault_t relay_buf_fault(struct vm_fault *vmf)
|
||||
{
|
||||
struct page *page;
|
||||
struct rchan_buf *buf = vmf->vma->vm_private_data;
|
||||
|
@@ -10,6 +10,8 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/nospec.h>
|
||||
|
||||
#include <linux/kcov.h>
|
||||
|
||||
#include <asm/switch_to.h>
|
||||
#include <asm/tlb.h>
|
||||
|
||||
@@ -2633,6 +2635,7 @@ static inline void
|
||||
prepare_task_switch(struct rq *rq, struct task_struct *prev,
|
||||
struct task_struct *next)
|
||||
{
|
||||
kcov_prepare_switch(prev);
|
||||
sched_info_switch(rq, prev, next);
|
||||
perf_event_task_sched_out(prev, next);
|
||||
rseq_preempt(prev);
|
||||
@@ -2702,6 +2705,7 @@ static struct rq *finish_task_switch(struct task_struct *prev)
|
||||
finish_task(prev);
|
||||
finish_lock_switch(rq);
|
||||
finish_arch_post_lock_switch();
|
||||
kcov_finish_switch(current);
|
||||
|
||||
fire_sched_in_preempt_notifiers(current);
|
||||
/*
|
||||
|
在新工单中引用
屏蔽一个用户