lkml.org 
[lkml]   [2013]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/7] uretprobes: extract fill_page() and trampoline implementation
On 03/22, Anton Arapov wrote:
>
> +static void fill_page(struct page *page, unsigned long offset, uprobe_opcode_t *insn)
^^^^^^^^^^^^^^^
Well, it should be "u8 *insn" or "char *".

xol_get_insn_slot() passes arch.insn, and this is not uprobe_opcode_t
in general (see arch/powerpc/include/asm/uprobes.h)

> +{
> + void *vaddr;
> +
> + vaddr = kmap_atomic(page);
> + memcpy(vaddr + offset, insn, MAX_UINSN_BYTES);
^^^^^^^^^^^^^^^
OK, but see below...

> + kunmap_atomic(vaddr);
> +
> + /*
> + * We probably need flush_icache_user_range() but it needs vma.
> + * This should work on supported architectures too.
> + */
> + flush_dcache_page(page);
> +}

Please do not move flush_dcache_page() from xol_get_insn_slot(),
this is not needed.

Unlike xol_get_insn_slot(), get_xol_area() calls fill_page() before
xol_add_vma().

> static int xol_add_vma(struct xol_area *area)
> {
> @@ -1122,6 +1137,7 @@ static struct xol_area *get_xol_area(void)
> {
> struct mm_struct *mm = current->mm;
> struct xol_area *area;
> + uprobe_opcode_t insn = UPROBE_SWBP_INSN;
>
> area = mm->uprobes_state.xol_area;
> if (area)
> @@ -1139,6 +1155,10 @@ static struct xol_area *get_xol_area(void)
> if (!area->page)
> goto free_bitmap;
>
> + /* pre-allocate for return probes */
> + set_bit(0, area->bitmap);
> + fill_page(area->page, 0, &insn);

sizeof(insn) == UPROBE_SWBP_INSN_SIZE != MAX_UINSN_BYTES. See also the
comments above.

Oleg.



\
 
 \ /
  Last update: 2013-03-24 16:21    [W:0.243 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site