lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 7 Apr 2013 17:14:41 +0530
From:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:	Anton Arapov <anton@...hat.com>
Cc:	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Josh Stone <jistone@...hat.com>,
	Frank Eigler <fche@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...e.hu>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	adrian.m.negreanu@...el.com, Torsten.Polle@....de
Subject: Re: [PATCH v1 2/9] uretprobes: Reserve the first slot in xol_vma
 for trampoline

* Anton Arapov <anton@...hat.com> [2013-04-03 18:00:32]:

> Allocate trampoline page, as the very first one in uprobed
> task xol area, and fill it with breakpoint opcode.
> 
> Also introduce get_trampoline_vaddr() helper, to wrap the
> trampoline address extraction from area->vaddr. That removes
> confusion and eases the debug experience in case ->vaddr
> notion will be changed.
> 
> v1 changes:
> * rework get_trampoline_vaddr() helper.
> * init xol_area->slot_count.
> 
> Signed-off-by: Anton Arapov <anton@...hat.com>

Acked-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>

(one small check below:)
> ---
>  kernel/events/uprobes.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 27c964b..d3c8201 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1109,6 +1109,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)
> @@ -1126,7 +1127,12 @@ static struct xol_area *get_xol_area(void)
>  	if (!area->page)
>  		goto free_bitmap;
> 
> +	/* allocate first slot of task's xol_area for the return probes */
> +	set_bit(0, area->bitmap);
> +	copy_to_page(area->page, 0, &insn, UPROBE_SWBP_INSN_SIZE);
> +	atomic_set(&area->slot_count, 1);
>  	init_waitqueue_head(&area->wq);
> +
>  	if (!xol_add_vma(area))
>  		return area;
> 
> @@ -1323,6 +1329,25 @@ static struct uprobe_task *get_utask(void)
>  	return current->utask;
>  }
> 
> +/*
> + * Current area->vaddr notion assume the trampoline address is always
> + * equal area->vaddr.
> + *
> + * Returns -1 in case the xol_area is not allocated.
> + */
> +static unsigned long get_trampoline_vaddr(void)
> +{
> +	struct xol_area *area;
> +	unsigned long trampoline_vaddr = -1;
> +
> +	area = current->mm->uprobes_state.xol_area;
> +	smp_read_barrier_depends();

check: do we need this barrier?

> +	if (area)
> +		trampoline_vaddr = area->vaddr;
> +
> +	return trampoline_vaddr;
> +}
> +
>  /* Prepare to single-step probed instruction out of line. */
>  static int
>  pre_ssout(struct uprobe *uprobe, struct pt_regs *regs, unsigned long bp_vaddr)
> -- 
> 1.8.1.4
> 

-- 
Thanks and Regards
Srikar Dronamraju

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ