public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2015-02-27  2:33 Robin H. Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson @ 2015-02-27  2:33 UTC (permalink / raw
  To: gentoo-commits

commit:     61da9865dce3736e36f7a59121f58ced50d6df42
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 27 01:58:22 2015 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Feb 27 02:31:56 2015 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=61da9865

bootmisc: clean_run safety improvements.

If /tmp or / are read-only, the clean_run function can fail in some very
bad ways.

1. dir=$(mktemp -d) returns an EMPTY string on error.
2. "mount -o bind / $dir", and don't check the result of that,
3. "rm -rf $dir/run/*", which removes the REAL /run contents
4. box gets very weird from this point forward

Signed-Off-By: Robin H. Johnson <robbat2 <AT> gentoo.org>
Signed-Off-By: Chip Parker <infowolfe <AT> gmail.com>
Reported-by: Chip Parker <infowolfe <AT> gmail.com>
Tested-by: Chip Parker <infowolfe <AT> gmail.com>

---
 init.d/bootmisc.in | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index 526ebff..4889c93 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -119,11 +119,36 @@ clean_run()
 {
 	[ "$RC_SYS" = VSERVER ] && return 0
 	local dir
+	# If / is stll read-only due to a problem, this will fail!
+	mountinfo -q --options-regex '^rw(,|$)' /
+	if [ $? -ne 0 ]; then
+		eerror "/ is not writable; unable to clean up underlying /run"
+		return 1
+	fi
+	# Get the mountpoint used by /tmp (it might be /tmp or /)
+	tmpmnt=`/usr/bin/stat -c '%m' /tmp`
+	mountinfo -q --options-regex '^rw(,|$)' $tmpmnt
+	if [ -n "$tmpmnt" -a $? -ne 0 ]; then
+		eerror "/tmp is not writable; unable to clean up underlying /run"
+		return 1
+	fi
+	# Now we know that we can modify /tmp and /
+	# if mktemp -d fails, it returns an EMPTY string
+	# STDERR: mktemp: failed to create directory via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
+	# STDOUT: ''
+	rc=0
 	dir=$(mktemp -d)
-	mount --bind / $dir
-	rm -rf $dir/run/*
-	umount $dir
-	rm -rf $dir
+	if [ -n "$dir" -a -d $dir -a -w $dir ]; then
+		mount --bind / $dir && rm -rf $dir/run/* || rc=1
+		umount $dir
+		rm -rf $dir
+	else
+		rc=1
+	fi
+	if [ $rc -ne 0 ]; then
+		eerror "Could not clean up underlying /run on /"
+		return 1
+	fi
 }
 
 start()


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2013-10-28 20:41 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-10-28 20:41 UTC (permalink / raw
  To: gentoo-commits

commit:     46e504b403d67359df19cdeb935a77c3d28e4ba2
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Oct 28 17:37:22 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 20:40:16 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=46e504b4

loopback: do not run in a prefix or vserver

X-Gentoo-Bug: 489370
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489370

---
 init.d/loopback.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init.d/loopback.in b/init.d/loopback.in
index e5cc118..0139b56 100644
--- a/init.d/loopback.in
+++ b/init.d/loopback.in
@@ -6,7 +6,7 @@ description="Configures the loopback interface."
 
 depend()
 {
-	return 0
+	keyword -jail -prefix -vserver
 }
 
 start()


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2013-10-28 20:41 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-10-28 20:41 UTC (permalink / raw
  To: gentoo-commits

commit:     1a43ce11d08c00ad8b1796acb975ec9cd71eab86
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Oct 28 20:21:50 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 28 20:40:47 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1a43ce11

bootmisc: do not run clean_run on VSERVER systems

X-Gentoo-Bug: 489370
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=489370

---
 init.d/bootmisc.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index a7e54a7..526ebff 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -117,6 +117,7 @@ migrate_to_run()
 
 clean_run()
 {
+	[ "$RC_SYS" = VSERVER ] && return 0
 	local dir
 	dir=$(mktemp -d)
 	mount --bind / $dir


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2013-10-18 20:40 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-10-18 20:40 UTC (permalink / raw
  To: gentoo-commits

commit:     b8a016aaba5e0c480fe0856949d54df5c5ec7463
Author:     Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 16 05:47:09 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct 18 20:22:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=b8a016aa

Add uml keyword to fsck service.

Fix relevant an issue mentioned by Toralf Förster.

X-Gentoo-Bug: 481096.
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=481096

---
 init.d/fsck.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init.d/fsck.in b/init.d/fsck.in
index 7a91fcd..9db5119 100644
--- a/init.d/fsck.in
+++ b/init.d/fsck.in
@@ -9,7 +9,7 @@ _IFS="
 depend()
 {
 	use dev clock modules
-	keyword -jail -openvz -prefix -timeout -vserver -lxc
+	keyword -jail -openvz -prefix -timeout -vserver -lxc -uml
 }
 
 _abort() {


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2013-10-08 17:10 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-10-08 17:10 UTC (permalink / raw
  To: gentoo-commits

commit:     c420f5685608d07c84a66c8e403d25371322eb21
Author:     Daniel Robbins <drobbins <AT> funtoo <DOT> org>
AuthorDate: Thu Sep 26 18:05:40 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct  8 17:06:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=c420f568

FL-786: localmount: support filesystem mounting on openvz

---
 init.d/localmount.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init.d/localmount.in b/init.d/localmount.in
index 407c686..5444889 100644
--- a/init.d/localmount.in
+++ b/init.d/localmount.in
@@ -9,7 +9,7 @@ depend()
 	need fsck
 	use lvm modules mtab
 	after lvm modules
-	keyword -jail -openvz -prefix -vserver -lxc
+	keyword -jail -prefix -vserver -lxc
 }
 
 start()


^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/
@ 2013-10-08 17:10 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-10-08 17:10 UTC (permalink / raw
  To: gentoo-commits

commit:     f2c0e700c6fd874a4ef58f79b72b437e8e375e67
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Tue Oct  8 15:34:45 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Oct  8 17:06:09 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=f2c0e700

netmount: add -lxc keyword

Netmount should not run on lxc, thanks to Mark van Dijk <funtoo <AT> internecto.net>.

---
 init.d/netmount.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init.d/netmount.in b/init.d/netmount.in
index dbf921b..86cdcba 100644
--- a/init.d/netmount.in
+++ b/init.d/netmount.in
@@ -12,7 +12,7 @@ depend()
 	config /etc/fstab
 	use afc-client amd autofs openvpn
 	use dns
-	keyword -jail -prefix -vserver
+	keyword -jail -prefix -vserver -lxc
 }
 
 start()


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-27  2:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-27  2:33 [gentoo-commits] proj/openrc:openrc-0.12.x commit in: init.d/ Robin H. Johnson
  -- strict thread matches above, loose matches on Subject: below --
2013-10-28 20:41 William Hubbs
2013-10-28 20:41 William Hubbs
2013-10-18 20:40 William Hubbs
2013-10-08 17:10 William Hubbs
2013-10-08 17:10 William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox