Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] [PATCH lttng-tools] Fix: run_as gid/uid test should return result to parent
@ 2013-08-27 20:24 Mathieu Desnoyers
  2013-08-27 21:43 ` David Goulet
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu Desnoyers @ 2013-08-27 20:24 UTC (permalink / raw)


Failure to do so could cause the parent to hang on read() waiting for
the return value from the child.

Targets: 2.3-rc and stable-2.2 branches.
 
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
diff --git a/src/common/runas.c b/src/common/runas.c
index bd51cd4..6979ad3 100644
--- a/src/common/runas.c
+++ b/src/common/runas.c
@@ -130,14 +130,16 @@ int child_run_as(void *_data)
 		ret = setegid(data->gid);
 		if (ret < 0) {
 			PERROR("setegid");
-			return EXIT_FAILURE;
+			sendret.i = -1;
+			goto write_return;
 		}
 	}
 	if (data->uid != geteuid()) {
 		ret = seteuid(data->uid);
 		if (ret < 0) {
 			PERROR("seteuid");
-			return EXIT_FAILURE;
+			sendret.i = -1;
+			goto write_return;
 		}
 	}
 	/*
@@ -145,6 +147,8 @@ int child_run_as(void *_data)
 	 */
 	umask(0);
 	sendret.i = (*data->cmd)(data->data);
+
+write_return:
 	/* send back return value */
 	writeleft = sizeof(sendret);
 	index = 0;

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [lttng-dev] [PATCH lttng-tools] Fix: run_as gid/uid test should return result to parent
  2013-08-27 20:24 [lttng-dev] [PATCH lttng-tools] Fix: run_as gid/uid test should return result to parent Mathieu Desnoyers
@ 2013-08-27 21:43 ` David Goulet
  0 siblings, 0 replies; 2+ messages in thread
From: David Goulet @ 2013-08-27 21:43 UTC (permalink / raw)


Merged!

David

Mathieu Desnoyers:
> Failure to do so could cause the parent to hang on read() waiting for
> the return value from the child.
> 
> Targets: 2.3-rc and stable-2.2 branches.
>  
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> diff --git a/src/common/runas.c b/src/common/runas.c
> index bd51cd4..6979ad3 100644
> --- a/src/common/runas.c
> +++ b/src/common/runas.c
> @@ -130,14 +130,16 @@ int child_run_as(void *_data)
>  		ret = setegid(data->gid);
>  		if (ret < 0) {
>  			PERROR("setegid");
> -			return EXIT_FAILURE;
> +			sendret.i = -1;
> +			goto write_return;
>  		}
>  	}
>  	if (data->uid != geteuid()) {
>  		ret = seteuid(data->uid);
>  		if (ret < 0) {
>  			PERROR("seteuid");
> -			return EXIT_FAILURE;
> +			sendret.i = -1;
> +			goto write_return;
>  		}
>  	}
>  	/*
> @@ -145,6 +147,8 @@ int child_run_as(void *_data)
>  	 */
>  	umask(0);
>  	sendret.i = (*data->cmd)(data->data);
> +
> +write_return:
>  	/* send back return value */
>  	writeleft = sizeof(sendret);
>  	index = 0;
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-27 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-27 20:24 [lttng-dev] [PATCH lttng-tools] Fix: run_as gid/uid test should return result to parent Mathieu Desnoyers
2013-08-27 21:43 ` David Goulet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox