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:	Mon, 28 Jan 2013 17:39:26 +0530
From:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Anton Arapov <anton@...hat.com>,
	Frank Eigler <fche@...hat.com>,
	Josh Stone <jistone@...hat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	"Suzuki K. Poulose" <suzuki@...ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] uprobes: Fully initialize uprobe_trace_consumer
 before uprobe_register()

* Oleg Nesterov <oleg@...hat.com> [2013-01-27 20:48:37]:

> probe_event_enable() does uprobe_register() and only after that sets
> utc->tu and tu->consumer/flags. This can race with uprobe_dispatcher()
> which can miss these assignments or see them out of order. Nothing
> really bad can happen, but this doesn't look clean/safe.
> 
> And this does not allow to use uprobe_consumer->filter() we are going
> to add, it is called by uprobe_register() and it needs utc->tu.
> 
> Change this code to initialize everything before uprobe_register(), and
> reset tu->consumer/flags if it fails. We can't race with event_disable(),
> the caller holds event_mutex, and if we could the code would be wrong
> anyway.
> 
> In fact I think uprobe_trace_consumer should die, it buys nothing but
> complicate the code. We can simply add uprobe_consumer into trace_uprobe.
> 
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>

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

> ---
>  kernel/trace/trace_uprobe.c |   13 +++++++------
>  1 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 53afabe..94d4ea2 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -552,17 +552,18 @@ static int probe_event_enable(struct trace_uprobe *tu, int flag)
>  		return -EINTR;
> 
>  	utc->cons.handler = uprobe_dispatcher;
> +	utc->tu = tu;
> +	tu->consumer = utc;
> +	tu->flags |= flag;
> +
>  	ret = uprobe_register(tu->inode, tu->offset, &utc->cons);
>  	if (ret) {
> +		tu->consumer = NULL;
> +		tu->flags &= ~flag;
>  		kfree(utc);
> -		return ret;
>  	}
> 
> -	tu->flags |= flag;
> -	utc->tu = tu;
> -	tu->consumer = utc;
> -
> -	return 0;
> +	return ret;
>  }
> 
>  static void probe_event_disable(struct trace_uprobe *tu, int flag)
> -- 
> 1.5.5.1
> 

-- 
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