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] [day] [month] [year] [list]
Date:	Tue, 5 Mar 2013 14:28:05 +0100
From:	Anton Arapov <anton@...hat.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Srikar Dronamraju <srikar@...ux.vnet.ibm.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>
Subject: Re: [RFC PATCH v4 5/6] uretprobes: invoke return probe handlers

On Mon, Mar 04, 2013 at 05:51:20PM +0100, Oleg Nesterov wrote:
> On 03/04, Anton Arapov wrote:
> >
> > +static void handle_uretprobe(struct xol_area *area, struct pt_regs *regs)
> > +{
> > +	struct hlist_head *head;
> > +	struct hlist_node *tmp;
> > +	struct return_uprobe_i *ri;
> > +	struct uprobe_task *utask;
> > +	unsigned long orig_ret_vaddr;
> > +
> > +	/* TODO: uretprobe bypass logic */
> > +
> > +	utask = get_utask();
> > +	if (!utask) {
> > +		/* TODO:RFC task is not probed, do we want printk here? */
> > +		return;
> > +	}
> > +	head = &utask->return_uprobes;
> > +	hlist_for_each_entry_safe(ri, tmp, head, hlist) {
> > +		if (ri->uprobe->consumers) {
> > +			instruction_pointer_set(regs, ri->orig_ret_vaddr);
> This doesn't look right if ri->orig_ret_vaddr == area->vaddr. We should
> splice the list and find orig_ret_vaddr in advance.
True, this cycle is buggy. I will rework handle_uretprobe().

> > @@ -1589,8 +1639,11 @@ static void handle_swbp(struct pt_regs *regs)
> >
> >  	if (!uprobe) {
> >  		if (is_swbp > 0) {
> > -			/* No matching uprobe; signal SIGTRAP. */
> > -			send_sig(SIGTRAP, current, 0);
> > +			area = get_xol_area();
> > +			if (area && bp_vaddr == area->vaddr)
> > +				handle_uretprobe(area, regs);
> > +			else
> > +				send_sig(SIGTRAP, current, 0);
> 
> Why? We can check bp_vaddr at the start, before find_active_uprobe().
For some reason, I was thinking it is better to hide this logic under
if (!uprobe). Will correct this chunk.

> And I'd suggest to not use area->vaddr directly, imho a trivial helper
> makes sense.
I see the idea behind, with this change it will be more clear and
fragile in case someone change the underneath logic. Will do this.

thank you very much!
Anton.
--
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