Bug 1460360 - sd_pid_notify() broken
sd_pid_notify() broken
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
7.3
x86_64 Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: systemd-maint
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-09 16:16 EDT by Cary Townsend
Modified: 2017-09-07 04:25 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-09-07 04:25:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Cary Townsend 2017-06-09 16:16:57 EDT
Description of problem:

Attempts to use sd_pid_notify to pet a watchdog from another process fail with EINVAL. Tried the same test with systemd 232 on Ubuntu 17.04 and they work; something apparently needs to be backported.

Version-Release number of selected component (if applicable):
219

How reproducible:
Always

Steps to Reproduce:
1.	export NOTIFY_SOCKET=/run/systemd/notify
2. Invoke sd_pid_notify with a valid pid
3.

Actual results:
EINVAL

Expected results:
1

Additional info:
sd_notify() works fine without error.

strace shows:
sendmsg(4, {msg_name(21)={sa_family=AF_LOCAL, sun_path="/run/systemd/notify"}, msg_iov(1)=[{"WATCHDOG=1\n", 11}], msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 11

sd_pid_notify() returns EINVAL

strace shows:
sendmsg(4, {msg_name(21)={sa_family=AF_LOCAL, sun_path="/run/systemd/notify"}, msg_iov(1)=[{"WATCHDOG=1\n", 11}], msg_controllen=48, {cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=21134, uid=0, gid=0}}, msg_flags=0}, MSG_NOSIGNAL) = -1 EINVAL (Invalid argument) 
sendmsg(4, {msg_name(21)={sa_family=AF_LOCAL, sun_path="/run/systemd/notify"}, msg_iov(1)=[{"WATCHDOG=1\n", 11}], msg_controllen=16, {cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS, ...}, msg_flags=0}, MSG_NOSIGNAL) = -1 EINVAL (Invalid argument)

The systemd folks suggest the following commit:

https://github.com/systemd/systemd/commit/a5bd3c32abb00ad945282568fd1a97c180b68047

Actually found in CentOS 7.3 3.10.0-514.16.1.el7.x86_64
Comment 2 Lukáš Nykrýn 2017-06-12 06:12:44 EDT
I think this might be fixed in latest build prepared for 7.4.
Can you try latest test build from this copr:
https://copr.fedorainfracloud.org/coprs/lnykryn/systemd-rhel-staging/
Comment 4 Cary Townsend 2017-06-12 12:11:28 EDT
Ok, the copr version seems to work fine.  I assume this will show up in CentOS 7.4? (any links / hints as to when that might be?)

Thanks!
Comment 5 Jan Synacek 2017-06-13 04:24:23 EDT
(In reply to Cary Townsend from comment #4)
> Ok, the copr version seems to work fine.  I assume this will show up in
> CentOS 7.4? (any links / hints as to when that might be?)

It probably will, but note that this is a RHEL bugzilla, not CentOS. But since the fix is already in our copr, it will most likely show in RHEL-7.4.

Note You need to log in before you can comment on or make changes to this bug.