From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH lttng-tools] Fix: run_as gid/uid test should return result to parent
Date: Tue, 27 Aug 2013 16:24:55 -0400 [thread overview]
Message-ID: <20130827202455.GA12616@Krystal> (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
next reply other threads:[~2013-08-27 20:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 20:24 Mathieu Desnoyers [this message]
2013-08-27 21:43 ` David Goulet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130827202455.GA12616@Krystal \
--to=mathieu.desnoyers@efficios.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox