All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] busybox: mdev: Make /dev/shm world-writable
@ 2014-07-21 16:53 Ben Shelton
  2014-07-21 16:53 ` [PATCH 2/4] busybox: mdev: Use mdev.seq Ben Shelton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ben Shelton @ 2014-07-21 16:53 UTC (permalink / raw)
  To: openembedded-core; +Cc: Gratian Crisan

From: Gratian Crisan <gratian.crisan@ni.com>

Otherwise, users cannot use named semaphores or shared memory.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/busybox/files/mdev | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index 4eba619..f7ed1f3 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -2,6 +2,7 @@
 
 mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
 mkdir /dev/pts /dev/shm
+chmod 777 /dev/shm
 mount -t devpts devpts /dev/pts
 echo "/sbin/mdev" > /proc/sys/kernel/hotplug
 mdev -s
-- 
2.0.2



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

* [PATCH 2/4] busybox: mdev: Use mdev.seq
  2014-07-21 16:53 [PATCH 1/4] busybox: mdev: Make /dev/shm world-writable Ben Shelton
@ 2014-07-21 16:53 ` Ben Shelton
  2014-07-21 16:53 ` [PATCH 3/4] busybox: mdev: Ensure /dev/initctl exists after tmpfs mount Ben Shelton
  2014-07-21 16:53 ` [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug Ben Shelton
  2 siblings, 0 replies; 6+ messages in thread
From: Ben Shelton @ 2014-07-21 16:53 UTC (permalink / raw)
  To: openembedded-core; +Cc: Bill Pittman

From: Bill Pittman <bill.pittman@ni.com>

/dev/mdev.seq exists to synchronize concurrently running instances of
mdev and to ensure that they execute in the proper order.  Without this
synchronization, it is possible to have inconsistent mount points, to
leak device nodes, or to have a node erroneously removed in rapid
hotplug scenarios.

Enable the use of mdev.seq by creating an empty /dev/mdev.seq at boot.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/busybox/files/mdev | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index f7ed1f3..c4447ef 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -4,5 +4,6 @@ mount -t tmpfs tmpfs /dev  -o size=64k,mode=0755
 mkdir /dev/pts /dev/shm
 chmod 777 /dev/shm
 mount -t devpts devpts /dev/pts
+touch /dev/mdev.seq
 echo "/sbin/mdev" > /proc/sys/kernel/hotplug
 mdev -s
-- 
2.0.2



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

* [PATCH 3/4] busybox: mdev: Ensure /dev/initctl exists after tmpfs mount
  2014-07-21 16:53 [PATCH 1/4] busybox: mdev: Make /dev/shm world-writable Ben Shelton
  2014-07-21 16:53 ` [PATCH 2/4] busybox: mdev: Use mdev.seq Ben Shelton
@ 2014-07-21 16:53 ` Ben Shelton
  2014-07-21 16:53 ` [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug Ben Shelton
  2 siblings, 0 replies; 6+ messages in thread
From: Ben Shelton @ 2014-07-21 16:53 UTC (permalink / raw)
  To: openembedded-core

During boot, there is a brief window during which /dev/initctl is
missing, which breaks initscripts that would need to access it. This
occurs because /etc/init.d/mountall.sh (rcS.d/S02...) attempts to ensure
/dev/initctl is present, but /etc/init.d/mdev (rcS.d/S06...) mounts over
/dev and clobbers the work done by mountall, and then does not wait
synchronously until initctl is ready before continuing.

To close this window, in /etc/init.d/mdev, we check whether /dev/initctl
is present, and if not, we remove it and recreate it.  This is the same
thing that is done by /etc/init.d/mountall.sh, and we have verified that
any writers of /dev/initctl will wait synchronously until sysvinit
notices the change in fd and does the read, so no race exists.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/busybox/files/mdev | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/meta/recipes-core/busybox/files/mdev b/meta/recipes-core/busybox/files/mdev
index c4447ef..9625247 100755
--- a/meta/recipes-core/busybox/files/mdev
+++ b/meta/recipes-core/busybox/files/mdev
@@ -7,3 +7,13 @@ mount -t devpts devpts /dev/pts
 touch /dev/mdev.seq
 echo "/sbin/mdev" > /proc/sys/kernel/hotplug
 mdev -s
+
+#
+# We might have mounted something over /dev, see if /dev/initctl is there.
+#
+if test ! -p /dev/initctl
+then
+        rm -f /dev/initctl
+        mknod -m 600 /dev/initctl p
+fi
+
-- 
2.0.2



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

* [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug
  2014-07-21 16:53 [PATCH 1/4] busybox: mdev: Make /dev/shm world-writable Ben Shelton
  2014-07-21 16:53 ` [PATCH 2/4] busybox: mdev: Use mdev.seq Ben Shelton
  2014-07-21 16:53 ` [PATCH 3/4] busybox: mdev: Ensure /dev/initctl exists after tmpfs mount Ben Shelton
@ 2014-07-21 16:53 ` Ben Shelton
  2014-07-21 18:14   ` Richard Purdie
  2 siblings, 1 reply; 6+ messages in thread
From: Ben Shelton @ 2014-07-21 16:53 UTC (permalink / raw)
  To: openembedded-core

From: Richard Tollerton <rich.tollerton@ni.com>

This is for symmetry with udev which also RPROVIDES hotplug.

Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
Signed-off-by: Ben Shelton <ben.shelton@ni.com>
---
 meta/recipes-core/busybox/busybox.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index bd66e4f..b4b9684 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -42,6 +42,7 @@ SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
 
 CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
 CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
+RPROVIDES_${PN}-mdev = "hotplug"
 
 RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
 
-- 
2.0.2



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

* Re: [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug
  2014-07-21 16:53 ` [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug Ben Shelton
@ 2014-07-21 18:14   ` Richard Purdie
  2014-07-21 18:44     ` Richard Tollerton
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2014-07-21 18:14 UTC (permalink / raw)
  To: Ben Shelton; +Cc: openembedded-core

On Mon, 2014-07-21 at 11:53 -0500, Ben Shelton wrote:
> From: Richard Tollerton <rich.tollerton@ni.com>
> 
> This is for symmetry with udev which also RPROVIDES hotplug.
> 
> Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
> Signed-off-by: Ben Shelton <ben.shelton@ni.com>
> ---
>  meta/recipes-core/busybox/busybox.inc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
> index bd66e4f..b4b9684 100644
> --- a/meta/recipes-core/busybox/busybox.inc
> +++ b/meta/recipes-core/busybox/busybox.inc
> @@ -42,6 +42,7 @@ SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
>  
>  CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
>  CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
> +RPROVIDES_${PN}-mdev = "hotplug"
>  
>  RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"

Why add this? I'm curious what would actually use that naming?

The RPROVIDES in udev was for backwards compatibility when hotplug
actually existed iirc, its long since dead?

Cheers,

Richard




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

* Re: [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug
  2014-07-21 18:14   ` Richard Purdie
@ 2014-07-21 18:44     ` Richard Tollerton
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Tollerton @ 2014-07-21 18:44 UTC (permalink / raw)
  To: Richard Purdie, Ben Shelton; +Cc: openembedded-core

Richard Purdie <richard.purdie@linuxfoundation.org> writes:

> On Mon, 2014-07-21 at 11:53 -0500, Ben Shelton wrote:
>> From: Richard Tollerton <rich.tollerton@ni.com>
>> 
>> This is for symmetry with udev which also RPROVIDES hotplug.
>> 
>> Signed-off-by: Richard Tollerton <rich.tollerton@ni.com>
>> Signed-off-by: Ben Shelton <ben.shelton@ni.com>
>> ---
>>  meta/recipes-core/busybox/busybox.inc | 1 +
>>  1 file changed, 1 insertion(+)
>> 
>> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
>> index bd66e4f..b4b9684 100644
>> --- a/meta/recipes-core/busybox/busybox.inc
>> +++ b/meta/recipes-core/busybox/busybox.inc
>> @@ -42,6 +42,7 @@ SYSTEMD_SERVICE_${PN}-syslog = "busybox-syslog.service"
>>  
>>  CONFFILES_${PN}-syslog = "${sysconfdir}/syslog-startup.conf.${BPN}"
>>  CONFFILES_${PN}-mdev = "${sysconfdir}/mdev.conf"
>> +RPROVIDES_${PN}-mdev = "hotplug"
>>  
>>  RRECOMMENDS_${PN} = "${PN}-syslog ${PN}-udhcpc"
>
> Why add this? I'm curious what would actually use that naming?
>
> The RPROVIDES in udev was for backwards compatibility when hotplug
> actually existed iirc, its long since dead?

Sorry, this was a mild case of cargo cult programming on my part. I saw
the RPROVIDES in the udev recipe, and while I couldn't find it ever
being used, I couldn't preclude the possibility that some other layer
somebody else would use might depend on it.

I agree that AFAIK, this code is dead, and the patch can be dropped.

> Cheers,
>
> Richard

-- 
Richard Tollerton <rich.tollerton@ni.com>


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

end of thread, other threads:[~2014-07-21 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-21 16:53 [PATCH 1/4] busybox: mdev: Make /dev/shm world-writable Ben Shelton
2014-07-21 16:53 ` [PATCH 2/4] busybox: mdev: Use mdev.seq Ben Shelton
2014-07-21 16:53 ` [PATCH 3/4] busybox: mdev: Ensure /dev/initctl exists after tmpfs mount Ben Shelton
2014-07-21 16:53 ` [PATCH 4/4] busybox: Allow busybox-mdev to RPROVIDES hotplug Ben Shelton
2014-07-21 18:14   ` Richard Purdie
2014-07-21 18:44     ` Richard Tollerton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.