diff mbox series

[OpenWrt-Devel,procd] early: set /tmp permissions explicitly

Message ID 20181123110245.10555-1-dedeckeh@gmail.com
State Accepted
Headers show
Series [OpenWrt-Devel,procd] early: set /tmp permissions explicitly | expand

Commit Message

Hans Dedecker Nov. 23, 2018, 11:02 a.m. UTC
In case ramfs is used as tmpfs it creates /tmp with permissions 755
which are the the default permissions.
Therefore when mounting tmp set permissions explicitly to 1777

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
---
 initd/early.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John Crispin Nov. 23, 2018, 12:22 p.m. UTC | #1
On 23/11/2018 12:02, Hans Dedecker wrote:
> In case ramfs is used as tmpfs it creates /tmp with permissions 755
> which are the the default permissions.
> Therefore when mounting tmp set permissions explicitly to 1777
>
> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Acked-by: John Crispin <john@phrozen.org>
> ---
>   initd/early.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/initd/early.c b/initd/early.c
> index 00fd946..2e15112 100644
> --- a/initd/early.c
> +++ b/initd/early.c
> @@ -67,7 +67,7 @@ early_mounts(void)
>   
>   	early_console("/dev/console");
>   	if (mount_zram_on_tmp()) {
> -		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0);
> +		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, "mode=01777");
>   		mkdir("/tmp/shm", 01777);
>   	} else {
>   		mkdir("/tmp/shm", 01777);
diff mbox series

Patch

diff --git a/initd/early.c b/initd/early.c
index 00fd946..2e15112 100644
--- a/initd/early.c
+++ b/initd/early.c
@@ -67,7 +67,7 @@  early_mounts(void)
 
 	early_console("/dev/console");
 	if (mount_zram_on_tmp()) {
-		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0);
+		mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, "mode=01777");
 		mkdir("/tmp/shm", 01777);
 	} else {
 		mkdir("/tmp/shm", 01777);