diff mbox

[OpenWrt-Devel,procd] move /dev/shm to /tmp/shm

Message ID 1436579918.10870.6.camel@chimera
State Accepted
Delegated to: John Crispin
Headers show

Commit Message

Daniel Gimpelevich July 11, 2015, 1:58 a.m. UTC
Since the /dev filesystem is tiny, /dev/shm needs to live somewhere
else.

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>

Comments

John Crispin July 14, 2015, 9:50 a.m. UTC | #1
what kind of usage do you expect ?

On 11/07/2015 03:58, Daniel Gimpelevich wrote:
> Since the /dev filesystem is tiny, /dev/shm needs to live somewhere
> else.
> 
> Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
> --- a/initd/early.c	2015-06-19 14:01:25.000000000 -0700
> +++ b/initd/early.c	2015-07-10 15:04:23.270143065 -0700
> @@ -66,16 +66,20 @@
>  	mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
>  	mount("none", "/sys/fs/cgroup", "cgroup", 0, 0);
>  	mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
> -	mkdir("/dev/shm", 01777);
> +	symlink("/tmp/shm", "/dev/shm");
>  	mkdir("/dev/pts", 0755);
>  	mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
>  	early_dev();
>  
>  	early_console("/dev/console");
> -	if (mount_zram_on_tmp())
> +	if (mount_zram_on_tmp()) {
>  		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL);
> -	else
> -		mkdev("*", 0600);
> +		mkdir("/tmp/shm", 01777);
> +	} else {
> +		mkdir("/tmp/shm", 01777);
> +		mount("tmpfs", "/tmp/shm", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME,
> +				"mode=01777");
> +	}
>  	mkdir("/tmp/run", 0777);
>  	mkdir("/tmp/lock", 0777);
>  	mkdir("/tmp/state", 0777);
> --- a/plug/coldplug.c	2015-06-19 14:01:25.000000000 -0700
> +++ b/plug/coldplug.c	2015-07-10 15:04:19.270123233 -0700
> @@ -45,7 +45,7 @@
>  	umount2("/dev/pts", MNT_DETACH);
>  	umount2("/dev/", MNT_DETACH);
>  	mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");
> -	mkdir("/dev/shm", 01777);
> +	symlink("/tmp/shm", "/dev/shm");
>  	mkdir("/dev/pts", 0755);
>  	umask(oldumask);
>  	mount("devpts", "/dev/pts", "devpts", 0, 0);
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
Daniel Gimpelevich July 14, 2015, 4:59 p.m. UTC | #2
OpenSSL session caches create shared memory segments that appear as
files under /dev/shm. If there is not enough room there, execution
terminates with SIGBUS upon access. Even a single instance would exceed
512K.

On Tue, 2015-07-14 at 11:50 +0200, John Crispin wrote:
> what kind of usage do you expect ?
> 
> On 11/07/2015 03:58, Daniel Gimpelevich wrote:
> > Since the /dev filesystem is tiny, /dev/shm needs to live somewhere
> > else.
> > 
> > Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
> > --- a/initd/early.c	2015-06-19 14:01:25.000000000 -0700
> > +++ b/initd/early.c	2015-07-10 15:04:23.270143065 -0700
> > @@ -66,16 +66,20 @@
> >  	mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
> >  	mount("none", "/sys/fs/cgroup", "cgroup", 0, 0);
> >  	mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
> > -	mkdir("/dev/shm", 01777);
> > +	symlink("/tmp/shm", "/dev/shm");
> >  	mkdir("/dev/pts", 0755);
> >  	mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
> >  	early_dev();
> >  
> >  	early_console("/dev/console");
> > -	if (mount_zram_on_tmp())
> > +	if (mount_zram_on_tmp()) {
> >  		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL);
> > -	else
> > -		mkdev("*", 0600);
> > +		mkdir("/tmp/shm", 01777);
> > +	} else {
> > +		mkdir("/tmp/shm", 01777);
> > +		mount("tmpfs", "/tmp/shm", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME,
> > +				"mode=01777");
> > +	}
> >  	mkdir("/tmp/run", 0777);
> >  	mkdir("/tmp/lock", 0777);
> >  	mkdir("/tmp/state", 0777);
> > --- a/plug/coldplug.c	2015-06-19 14:01:25.000000000 -0700
> > +++ b/plug/coldplug.c	2015-07-10 15:04:19.270123233 -0700
> > @@ -45,7 +45,7 @@
> >  	umount2("/dev/pts", MNT_DETACH);
> >  	umount2("/dev/", MNT_DETACH);
> >  	mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");
> > -	mkdir("/dev/shm", 01777);
> > +	symlink("/tmp/shm", "/dev/shm");
> >  	mkdir("/dev/pts", 0755);
> >  	umask(oldumask);
> >  	mount("devpts", "/dev/pts", "devpts", 0, 0);
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Daniel Gimpelevich July 20, 2015, 2:14 a.m. UTC | #3
I'm intending for this fix to be backported to CC as well.

On Tue, 2015-07-14 at 09:59 -0700, Daniel Gimpelevich wrote:
> OpenSSL session caches create shared memory segments that appear as
> files under /dev/shm. If there is not enough room there, execution
> terminates with SIGBUS upon access. Even a single instance would
> exceed
> 512K.
> 
> On Tue, 2015-07-14 at 11:50 +0200, John Crispin wrote:
> > what kind of usage do you expect ?
> > 
> > On 11/07/2015 03:58, Daniel Gimpelevich wrote:
> > > Since the /dev filesystem is tiny, /dev/shm needs to live
> somewhere
> > > else.
Daniel Gimpelevich Sept. 11, 2015, 8:05 p.m. UTC | #4
Is there an ETA for merging this?

On Sun, 2015-07-19 at 19:14 -0700, Daniel Gimpelevich wrote:
> I'm intending for this fix to be backported to CC as well.
> 
> On Tue, 2015-07-14 at 09:59 -0700, Daniel Gimpelevich wrote:
> > OpenSSL session caches create shared memory segments that appear as
> > files under /dev/shm. If there is not enough room there, execution
> > terminates with SIGBUS upon access. Even a single instance would
> > exceed
> > 512K.
> > 
> > On Tue, 2015-07-14 at 11:50 +0200, John Crispin wrote:
> > > what kind of usage do you expect ?
> > > 
> > > On 11/07/2015 03:58, Daniel Gimpelevich wrote:
> > > > Since the /dev filesystem is tiny, /dev/shm needs to live
> > somewhere
> > > > else.
Daniel Gimpelevich Sept. 15, 2015, 3:05 p.m. UTC | #5
I see procd got an update. Any reason this patch was left out?

On Fri, 2015-09-11 at 13:05 -0700, Daniel Gimpelevich wrote:
> Is there an ETA for merging this?
> 
> On Sun, 2015-07-19 at 19:14 -0700, Daniel Gimpelevich wrote:
> > I'm intending for this fix to be backported to CC as well.
> > 
> > On Tue, 2015-07-14 at 09:59 -0700, Daniel Gimpelevich wrote:
> > > OpenSSL session caches create shared memory segments that appear as
> > > files under /dev/shm. If there is not enough room there, execution
> > > terminates with SIGBUS upon access. Even a single instance would
> > > exceed
> > > 512K.
> > > 
> > > On Tue, 2015-07-14 at 11:50 +0200, John Crispin wrote:
> > > > what kind of usage do you expect ?
> > > > 
> > > > On 11/07/2015 03:58, Daniel Gimpelevich wrote:
> > > > > Since the /dev filesystem is tiny, /dev/shm needs to live
> > > somewhere
> > > > > else.
John Crispin Sept. 16, 2015, 7:03 a.m. UTC | #6
On 15/09/2015 17:05, Daniel Gimpelevich wrote:
> I see procd got an update. Any reason this patch was left out?
> 
> On Fri, 2015-09-11 at 13:05 -0700, Daniel Gimpelevich wrote:
>> Is there an ETA for merging this?
>>
>> On Sun, 2015-07-19 at 19:14 -0700, Daniel Gimpelevich wrote:
>>> I'm intending for this fix to be backported to CC as well.
>>>
>>> On Tue, 2015-07-14 at 09:59 -0700, Daniel Gimpelevich wrote:
>>>> OpenSSL session caches create shared memory segments that appear as
>>>> files under /dev/shm. If there is not enough room there, execution
>>>> terminates with SIGBUS upon access. Even a single instance would
>>>> exceed
>>>> 512K.
>>>>
>>>> On Tue, 2015-07-14 at 11:50 +0200, John Crispin wrote:
>>>>> what kind of usage do you expect ?
>>>>>
>>>>> On 11/07/2015 03:58, Daniel Gimpelevich wrote:
>>>>>> Since the /dev filesystem is tiny, /dev/shm needs to live
>>>> somewhere
>>>>>> else.


Hi,

there was no ... ah wait its a trap ... you were just impatient. i was
working on the release and after that i started working through patchwork.

	John
diff mbox

Patch

--- a/initd/early.c	2015-06-19 14:01:25.000000000 -0700
+++ b/initd/early.c	2015-07-10 15:04:23.270143065 -0700
@@ -66,16 +66,20 @@ 
 	mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0);
 	mount("none", "/sys/fs/cgroup", "cgroup", 0, 0);
 	mount("tmpfs", "/dev", "tmpfs", MS_NOATIME, "mode=0755,size=512K");
-	mkdir("/dev/shm", 01777);
+	symlink("/tmp/shm", "/dev/shm");
 	mkdir("/dev/pts", 0755);
 	mount("devpts", "/dev/pts", "devpts", MS_NOATIME, "mode=600");
 	early_dev();
 
 	early_console("/dev/console");
-	if (mount_zram_on_tmp())
+	if (mount_zram_on_tmp()) {
 		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, NULL);
-	else
-		mkdev("*", 0600);
+		mkdir("/tmp/shm", 01777);
+	} else {
+		mkdir("/tmp/shm", 01777);
+		mount("tmpfs", "/tmp/shm", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME,
+				"mode=01777");
+	}
 	mkdir("/tmp/run", 0777);
 	mkdir("/tmp/lock", 0777);
 	mkdir("/tmp/state", 0777);
--- a/plug/coldplug.c	2015-06-19 14:01:25.000000000 -0700
+++ b/plug/coldplug.c	2015-07-10 15:04:19.270123233 -0700
@@ -45,7 +45,7 @@ 
 	umount2("/dev/pts", MNT_DETACH);
 	umount2("/dev/", MNT_DETACH);
 	mount("tmpfs", "/dev", "tmpfs", 0, "mode=0755,size=512K");
-	mkdir("/dev/shm", 01777);
+	symlink("/tmp/shm", "/dev/shm");
 	mkdir("/dev/pts", 0755);
 	umask(oldumask);
 	mount("devpts", "/dev/pts", "devpts", 0, 0);