tools/hotplug: Use env rather than sh in xenstored.service
PATCH 1/1 tools/hotplug: Use env rather than sh in xenstored.service
Using sh to exec xenstored breaks on selinux systems (at least, on CentOS 7). The only purpose of doing that was to be able to expand the $XENSTORED variable; this can be done with /usr/bin/env instead, which still works on systemd systems (at least on CentOS 7).
---
One could argue that this is a bug in 4.6 and should be accepted. I could also see an argument, however, that this late in the cycle we should just wait until 4.6.1. I'll leave it up to Wei to decide.
--- tools/hotplug/Linux/systemd/xenstored.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/Linux/systemd/xenstored.service.in +1 -1
@@ -15,7 +15,7 @@ EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ -ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" +ExecStart=/usr/bin/env $XENSTORED --no-fork $XENSTORED_ARGS [Install] WantedBy=multi-user.target
Signature · 1 line
1.9.1
Quoted 5 lines · George Dunlap
Using sh to exec xenstored breaks on selinux systems (at least, on CentOS 7). The only purpose of doing that was to be able to expand the $XENSTORED variable; this can be done with
/usr/bin/envinstead, which still works on systemd systems (at least on CentOS 7).
Quoted 8 lines
Suggested-by Olaf Hering <[email protected]>Signed-off-by George Dunlap <[email protected]>---
One could argue that this is a bug in 4.6 and should be accepted. I could also see an argument, however, that this late in the cycle we should just wait until 4.6.1. I'll leave it up to Wei to decide.
We don't have testing visibility on whether this change will break systemd without selinux. All distros probably have patches to unit files anyway so this is not urgent. I would say let's wait until 4.6.1.
Furthermore, a link to systemd manual regarding envvar expansion without quotes in systemd unit file would also increase confidence why it doesn't break things.
Wei.
Quoted 23 lines
CC Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Wei Liu <[email protected]>CC Olaf Hering <[email protected]>--- tools/hotplug/Linux/systemd/xenstored.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/Linux/systemd/xenstored.service.in +1
-1@@ -15,7 +15,7 @@ EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ -ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" +ExecStart=/usr/bin/env $XENSTORED --no-fork $XENSTORED_ARGS [Install] WantedBy=multi-user.targetSignature · 1 line
1.9.1
Quoted 26 lines · George Dunlap
Using sh to exec xenstored breaks on selinux systems (at least, on CentOS 7). The only purpose of doing that was to be able to expand the $XENSTORED variable; this can be done with
/usr/bin/envinstead, which still works on systemd systems (at least on CentOS 7).Suggested-by Olaf Hering <[email protected]>Signed-off-by George Dunlap <[email protected]>---
One could argue that this is a bug in 4.6 and should be accepted. I could also see an argument, however, that this late in the cycle we should just wait until 4.6.1. I'll leave it up to Wei to decide.
CC Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>CC Wei Liu <[email protected]>CC Olaf Hering <[email protected]>--- tools/hotplug/Linux/systemd/xenstored.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/hotplug/Linux/systemd/xenstored.service.in +0
-0
tools/hotplug/Linux/systemd/xenstored.service.in EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons · line 18
Quoted 5 lines
tools/hotplug/Linux/systemd/xenstored.service.in +1
-1@@ -15,7 +15,7 @@ EnvironmentFile=-@CONFIG_DIR@/@CONFIG_LEAF_DIR@/xencommons ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb* ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@ -ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS" +ExecStart=/usr/bin/env $XENSTORED --no-fork $XENSTORED_ARGS
Actually, hold off on this one -- apparently env destroys the selinux context in a way that's too permissive:
# ps axZ | grep xenstored system_u:system_r:unconfined_service_t:s0 612 ? Ss 0:00 /usr/sbin/xenstored --no-fork
IOW, a side effect this patch is to "fix" the /var/lib/xenstored tmpfs selinux context problem by basically disabling that selinux limitation. :-/
-George