From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EA13E138806 for ; Tue, 12 Dec 2017 07:59:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 16BE7E0FA2; Tue, 12 Dec 2017 07:59:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E7E5CE0FA2 for ; Tue, 12 Dec 2017 07:59:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 27E2133D4A6 for ; Tue, 12 Dec 2017 07:59:15 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A3A61AE85 for ; Tue, 12 Dec 2017 07:59:12 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1513062387.60d89770b45fce6ae0eefabbbbebd1fbaa717eea.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/system/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/system/init.fc X-VCS-Directories: policy/modules/system/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: 60d89770b45fce6ae0eefabbbbebd1fbaa717eea X-VCS-Branch: master Date: Tue, 12 Dec 2017 07:59:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 996fc7b2-4cb9-474e-9e90-6a2c61706e4c X-Archives-Hash: 2c526ad0dd77ceddfeca29259a87f91e commit: 60d89770b45fce6ae0eefabbbbebd1fbaa717eea Author: David Sugar tresys com> AuthorDate: Fri Dec 8 22:30:58 2017 +0000 Commit: Jason Zaman gentoo org> CommitDate: Tue Dec 12 07:06:27 2017 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=60d89770 label systemd-shutdown so shutdown works I am seeing (on RHEL 7.4 w/systemd) that halting the system doesn't work. It took me a long time (and a lot of help from Steve L.) to figure out what was going on. It turns out in refpolicy the default label for /usr/lib/systemd/systemd-shutdown is bin_t. But when systemd tried to execve systemd-shutdown it fails because init_t isn't allowed file entrypoint for bin_t. When I labeled systemd-shutdown as init_exec_t shutting down the system works. I was seeing the following log (from systemd) when I enabled systemd debug logging (which was very useful). [ 59.745037] systemd[1]: Starting Final Step. [ 59.746112] systemd[1]: Starting Power-Off... [ 59.776320] systemd[1]: Shutting down. [ 59.783559] systemd[1]: Failed to execute shutdown binary, freezing: Operation not permitted At this point everything locks up instead of actually halting the system. This is a patch to change the label for systemd-shutdown which solves the problem. I'm happy to go through and make a distinct type of systemd-shutdown if someone doesn't think it is a good idea to share the type with systemd. But based on what is going on, this might be reasonable. Signed-off-by: Dave Sugar tresys.com> policy/modules/system/init.fc | 1 + 1 file changed, 1 insertion(+) diff --git a/policy/modules/system/init.fc b/policy/modules/system/init.fc index d029ea30..bf0acaf9 100644 --- a/policy/modules/system/init.fc +++ b/policy/modules/system/init.fc @@ -29,6 +29,7 @@ ifdef(`distro_gentoo',` /usr/bin/upstart -- gen_context(system_u:object_r:init_exec_t,s0) /usr/lib/systemd/systemd -- gen_context(system_u:object_r:init_exec_t,s0) +/usr/lib/systemd/systemd-shutdown -- gen_context(system_u:object_r:init_exec_t,s0) /usr/lib/systemd/system-preset(/.*)? gen_context(system_u:object_r:systemd_unit_t,s0) /usr/lib/systemd/user-preset(/.*)? gen_context(system_u:object_r:systemd_unit_t,s0) /usr/lib/systemd/ntp-units\.d -d gen_context(system_u:object_r:systemd_unit_t,s0)