Skip to content

Commit 2abbcc0

Browse files
oleg-nesterovakpm00
authored andcommitted
uprobes: turn xol_area->pages[2] into xol_area->page
Now that xol_mapping has its own ->fault() method we no longer need xol_area->pages[1] == NULL, we need a single page. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Oleg Nesterov <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sven Schnelle <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6d27a31 commit 2abbcc0

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

kernel/events/uprobes.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ struct xol_area {
9999
atomic_t slot_count; /* number of in-use slots */
100100
unsigned long *bitmap; /* 0 = free slot */
101101

102-
struct page *pages[2];
102+
struct page *page;
103103
/*
104104
* We keep the vma's vm_start rather than a pointer to the vma
105105
* itself. The probed process or a naughty kernel module could make
@@ -1437,7 +1437,7 @@ static vm_fault_t xol_fault(const struct vm_special_mapping *sm,
14371437
{
14381438
struct xol_area *area = vma->vm_mm->uprobes_state.xol_area;
14391439

1440-
vmf->page = area->pages[0];
1440+
vmf->page = area->page;
14411441
get_page(vmf->page);
14421442
return 0;
14431443
}
@@ -1512,23 +1512,22 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
15121512
if (!area->bitmap)
15131513
goto free_area;
15141514

1515-
area->pages[0] = alloc_page(GFP_HIGHUSER);
1516-
if (!area->pages[0])
1515+
area->page = alloc_page(GFP_HIGHUSER);
1516+
if (!area->page)
15171517
goto free_bitmap;
1518-
area->pages[1] = NULL;
15191518

15201519
area->vaddr = vaddr;
15211520
init_waitqueue_head(&area->wq);
15221521
/* Reserve the 1st slot for get_trampoline_vaddr() */
15231522
set_bit(0, area->bitmap);
15241523
atomic_set(&area->slot_count, 1);
15251524
insns = arch_uprobe_trampoline(&insns_size);
1526-
arch_uprobe_copy_ixol(area->pages[0], 0, insns, insns_size);
1525+
arch_uprobe_copy_ixol(area->page, 0, insns, insns_size);
15271526

15281527
if (!xol_add_vma(mm, area))
15291528
return area;
15301529

1531-
__free_page(area->pages[0]);
1530+
__free_page(area->page);
15321531
free_bitmap:
15331532
kfree(area->bitmap);
15341533
free_area:
@@ -1570,7 +1569,7 @@ void uprobe_clear_state(struct mm_struct *mm)
15701569
if (!area)
15711570
return;
15721571

1573-
put_page(area->pages[0]);
1572+
put_page(area->page);
15741573
kfree(area->bitmap);
15751574
kfree(area);
15761575
}
@@ -1637,7 +1636,7 @@ static unsigned long xol_get_insn_slot(struct uprobe *uprobe)
16371636
if (unlikely(!xol_vaddr))
16381637
return 0;
16391638

1640-
arch_uprobe_copy_ixol(area->pages[0], xol_vaddr,
1639+
arch_uprobe_copy_ixol(area->page, xol_vaddr,
16411640
&uprobe->arch.ixol, sizeof(uprobe->arch.ixol));
16421641

16431642
return xol_vaddr;

0 commit comments

Comments
 (0)