* uuid: uuidd ... FAILED (daemon start)
@ 2018-03-07 2:28 Thomas Deutschmann
2018-03-07 9:40 ` [PATCH] uuidd: don't truncate long socket paths Ruediger Meier
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Deutschmann @ 2018-03-07 2:28 UTC (permalink / raw)
To: util-linux
[-- Attachment #1.1: Type: text/plain, Size: 771 bytes --]
Hi,
on Gentoo Linux we often see
> uuidd: couldn't bind unix socket /var/tmp/portage/sys-apps/util-linux-2.31.1/work/util-linux-2.31.1-abi_x86_64.amd64/tests/output/uuid/uuiddkOcTUuoZ7kaP3: Address already in use
> uuid: uuidd ... FAILED (daemon start)
test failures.
I think this is because we hit the
char sun_path[108]
limit (=socket path is too long so it will be reduced...
however, it now collides with OUTPUT_FILE or
UUIDD_PID).
I guess there is not much you (upstream) can do about it, right?
So we will have to patch the test to use different names/path
in Gentoo...
--
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 981 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] uuidd: don't truncate long socket paths
2018-03-07 2:28 uuid: uuidd ... FAILED (daemon start) Thomas Deutschmann
@ 2018-03-07 9:40 ` Ruediger Meier
2018-03-07 10:51 ` Karel Zak
0 siblings, 1 reply; 3+ messages in thread
From: Ruediger Meier @ 2018-03-07 9:40 UTC (permalink / raw)
To: util-linux
From: Ruediger Meier <ruediger.meier@ga-group.nl>
This was the error
uuidd: couldn't bind unix socket /var/tmp/portage/sys-apps/util-linux-2.31.1/work/util-linux-2.31.1-abi_x86_64.amd64/tests/output/uuid/uuiddkOcTUuoZ7kaP3: Address already in use
because the socket path was truncated to 108 chars which was luckily
an existing directory.
Now we abort early with "uuidd: socket name too long: ... "
Reported-by: Thomas Deutschmann <whissi@gentoo.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
misc-utils/uuidd.c | 12 ++++++++----
tests/ts/uuid/uuidd | 3 ++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index e7c25cfa1..ca2ae8cf7 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -118,8 +118,8 @@ static int call_daemon(const char *socket_path, int op, char *buf,
}
srv_addr.sun_family = AF_UNIX;
- strncpy(srv_addr.sun_path, socket_path, sizeof(srv_addr.sun_path));
- srv_addr.sun_path[sizeof(srv_addr.sun_path) - 1] = '\0';
+ assert(strlen(socket_path) < sizeof(srv_addr.sun_path));
+ xstrncpy(srv_addr.sun_path, socket_path, sizeof(srv_addr.sun_path));
if (connect(s, (const struct sockaddr *) &srv_addr,
sizeof(struct sockaddr_un)) < 0) {
@@ -252,8 +252,8 @@ static int create_socket(struct uuidd_cxt_t *uuidd_cxt,
* Create the address we will be binding to.
*/
my_addr.sun_family = AF_UNIX;
- strncpy(my_addr.sun_path, socket_path, sizeof(my_addr.sun_path));
- my_addr.sun_path[sizeof(my_addr.sun_path) - 1] = '\0';
+ assert(strlen(socket_path) < sizeof(my_addr.sun_path));
+ xstrncpy(my_addr.sun_path, socket_path, sizeof(my_addr.sun_path));
unlink(socket_path);
save_umask = umask(0);
if (bind(s, (const struct sockaddr *) &my_addr,
@@ -636,6 +636,10 @@ int main(int argc, char **argv)
}
}
+ if (strlen(socket_path) >= sizeof(((struct sockaddr_un *)0)->sun_path)) {
+ errx(EXIT_FAILURE, _("socket name too long: %s"), socket_path);
+ }
+
if (!no_pid && !pidfile_path)
pidfile_path = UUIDD_PIDFILE_PATH;
diff --git a/tests/ts/uuid/uuidd b/tests/ts/uuid/uuidd
index 17cf29d06..16dc45e3f 100755
--- a/tests/ts/uuid/uuidd
+++ b/tests/ts/uuid/uuidd
@@ -23,7 +23,8 @@ ts_check_test_command "$TS_CMD_UUIDD"
OUTPUT_FILE="$(mktemp "${TS_OUTDIR}/uuiddXXXXXXXXXXXXX")"
UUIDD_PID="$(mktemp -u "${TS_OUTDIR}/uuiddXXXXXXXXXXXXX")"
-UUIDD_SOCKET="$(mktemp -u "${TS_OUTDIR}/uuiddXXXXXXXXXXXXX")"
+# socket path must be short (SIZEOF_SOCKADDR_UN_SUN_PATH 108)
+UUIDD_SOCKET=$(mktemp "/tmp/ultest-$TS_COMPONENT-$TS_TESTNAME-socketXXXXXX")
$TS_CMD_UUIDD -p "$UUIDD_PID" -s "$UUIDD_SOCKET"
if [ $? -ne 0 ]; then
--
2.13.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] uuidd: don't truncate long socket paths
2018-03-07 9:40 ` [PATCH] uuidd: don't truncate long socket paths Ruediger Meier
@ 2018-03-07 10:51 ` Karel Zak
0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2018-03-07 10:51 UTC (permalink / raw)
To: Ruediger Meier; +Cc: util-linux
On Wed, Mar 07, 2018 at 10:40:23AM +0100, Ruediger Meier wrote:
> misc-utils/uuidd.c | 12 ++++++++----
> tests/ts/uuid/uuidd | 3 ++-
> 2 files changed, 10 insertions(+), 5 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-07 10:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 2:28 uuid: uuidd ... FAILED (daemon start) Thomas Deutschmann
2018-03-07 9:40 ` [PATCH] uuidd: don't truncate long socket paths Ruediger Meier
2018-03-07 10:51 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).