From b527b0e7f84cc2bc796858a93107c752bbd1406f7591a2c91c8a0c784e6b5b13 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Tue, 12 Jul 2016 20:02:37 +0000 Subject: [PATCH] - systemd: fix ready notification on abstract socket c8f08e48-systemd-notify-fix.patch boo#987668 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=549 --- c8f08e48-systemd-notify-fix.patch | 46 +++++++++++++++++++++++++++++++ libvirt.changes | 7 +++++ libvirt.spec | 2 ++ 3 files changed, 55 insertions(+) create mode 100644 c8f08e48-systemd-notify-fix.patch diff --git a/c8f08e48-systemd-notify-fix.patch b/c8f08e48-systemd-notify-fix.patch new file mode 100644 index 0000000..19cf089 --- /dev/null +++ b/c8f08e48-systemd-notify-fix.patch @@ -0,0 +1,46 @@ +commit c8f08e487672afcaa53629bddbc6703b5d90e846 +Author: Jim Fehlig +Date: Mon Jul 11 17:26:48 2016 -0600 + + systemd: fix ready notification on abstract socket + + At least with systemd v210, NOTIFY_SOCKET is abstact, e.g. + @/org/freedesktop/systemd1/notify. sendmsg() fails on such a socket + with "Connection refused". The unix(7) man page contains the following + details wrt abstract socket addresses + + abstract: an abstract socket address is distinguished (from a + pathname socket) by the fact that sun_path[0] is a null byte + ('\0'). The socket's address in this namespace is given by the + additional bytes in sun_path that are covered by the specified + length of the address structure. (Null bytes in the name have + no special significance.) + + So we need to be more precise about the address length, setting it to + the sizeof sa_family_t + length of address copied to sun_path instead + of setting it to the sizeof the entire sockaddr_un struct. + + Resolves: https://bugzilla.opensuse.org/show_bug.cgi?id=987668 + Signed-off-by: Jim Fehlig + +Index: libvirt-2.0.0/src/util/virsystemd.c +=================================================================== +--- libvirt-2.0.0.orig/src/util/virsystemd.c ++++ libvirt-2.0.0/src/util/virsystemd.c +@@ -495,7 +495,6 @@ virSystemdNotifyStartup(void) + }; + struct msghdr mh = { + .msg_name = &un, +- .msg_namelen = sizeof(un), + .msg_iov = &iov, + .msg_iovlen = 1, + }; +@@ -515,6 +514,8 @@ virSystemdNotifyStartup(void) + if (un.sun_path[0] == '@') + un.sun_path[0] = '\0'; + ++ mh.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(path); ++ + fd = socket(AF_UNIX, SOCK_DGRAM, 0); + if (fd < 0) { + VIR_WARN("Unable to create socket FD"); diff --git a/libvirt.changes b/libvirt.changes index 6a4a784..3c8b8f7 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Jul 12 19:57:40 UTC 2016 - jfehlig@suse.com + +- systemd: fix ready notification on abstract socket + c8f08e48-systemd-notify-fix.patch + boo#987668 + ------------------------------------------------------------------- Fri Jul 1 14:16:04 UTC 2016 - jfehlig@suse.com diff --git a/libvirt.spec b/libvirt.spec index 3480ab4..b200649 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -279,6 +279,7 @@ Source4: libvirtd-relocation-server.fw Source99: baselibs.conf Source100: %{name}-rpmlintrc # Upstream patches +Patch0: c8f08e48-systemd-notify-fix.patch # Patches pending upstream review Patch100: libxl-dom-reset.patch # Need to go upstream @@ -730,6 +731,7 @@ libvirt plugin for NSS for translating domain names into IP addresses. %prep %setup -q +%patch0 -p1 %patch100 -p1 %patch150 -p1 %patch151 -p1