All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmount: Ensure utab.lock mode 644
@ 2017-04-11 14:12 Stanislav Brabec
  2017-04-18  9:23 ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Stanislav Brabec @ 2017-04-11 14:12 UTC (permalink / raw)
  To: util-linux

If utab.lock is created by a process with a restricted umask, utab.lock is
created with restricted permissions. It breaks userspace monitor.

Ensure that the mode is always 644.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 libmount/src/lock.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libmount/src/lock.c b/libmount/src/lock.c
index 06eff1344..f9d0253fb 100644
--- a/libmount/src/lock.c
+++ b/libmount/src/lock.c
@@ -220,6 +220,11 @@ static int lock_simplelock(struct libmnt_lock *ml)
 		rc = -errno;
 		goto err;
 	}
+	rc = fchmod(ml->lockfile_fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
+	if (rc < 0) {
+		rc = -errno;
+		goto err;
+	}
 
 	while (flock(ml->lockfile_fd, LOCK_EX) < 0) {
 		int errsv;
-- 
2.12.2

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

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

* Re: [PATCH] libmount: Ensure utab.lock mode 644
  2017-04-11 14:12 [PATCH] libmount: Ensure utab.lock mode 644 Stanislav Brabec
@ 2017-04-18  9:23 ` Karel Zak
  2017-04-18 12:15   ` Stanislav Brabec
  0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2017-04-18  9:23 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Tue, Apr 11, 2017 at 04:12:52PM +0200, Stanislav Brabec wrote:
> If utab.lock is created by a process with a restricted umask, utab.lock is
> created with restricted permissions. It breaks userspace monitor.
> 
> Ensure that the mode is always 644.
> 
> Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
> ---
>  libmount/src/lock.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libmount/src/lock.c b/libmount/src/lock.c
> index 06eff1344..f9d0253fb 100644
> --- a/libmount/src/lock.c
> +++ b/libmount/src/lock.c
> @@ -220,6 +220,11 @@ static int lock_simplelock(struct libmnt_lock *ml)
>  		rc = -errno;
>  		goto err;
>  	}
> +	rc = fchmod(ml->lockfile_fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
> +	if (rc < 0) {
> +		rc = -errno;
> +		goto err;
> +	}

Hmm... interesting issue. systemd?

Applied, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

* Re: [PATCH] libmount: Ensure utab.lock mode 644
  2017-04-18  9:23 ` Karel Zak
@ 2017-04-18 12:15   ` Stanislav Brabec
  0 siblings, 0 replies; 3+ messages in thread
From: Stanislav Brabec @ 2017-04-18 12:15 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

Dne 18.4.2017 v 11:23 Karel Zak napsal(a):
> On Tue, Apr 11, 2017 at 04:12:52PM +0200, Stanislav Brabec wrote:
>> Ensure that the mode is always 644.
>>
> 
> Hmm... interesting issue. systemd?

Partially. A combination of restrictive umask, user mount on login and
later umount. mnt_monitor_get_fd() then fails.

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

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

end of thread, other threads:[~2017-04-18 12:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 14:12 [PATCH] libmount: Ensure utab.lock mode 644 Stanislav Brabec
2017-04-18  9:23 ` Karel Zak
2017-04-18 12:15   ` Stanislav Brabec

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.