Thread (47 messages) 47 messages, 12 authors, 2024-01-23

Re: [PATCH v4 4/6] add statmount(2) syscall

From: Christian Brauner <brauner@kernel.org>
Date: 2023-11-08 07:58:44
Also in: linux-fsdevel, linux-man, linux-security-module, lkml

quoted
+static int do_statmount(struct stmt_state *s)
+{
+	struct statmnt *sm = &s->sm;
+	struct mount *m = real_mount(s->mnt);
+	size_t copysize = min_t(size_t, s->bufsize, sizeof(*sm));
+	int err;
+
+	err = security_sb_statfs(s->mnt->mnt_root);
+	if (err)
+		return err;
+
+	if (!capable(CAP_SYS_ADMIN) &&
+	    !is_path_reachable(m, m->mnt.mnt_root, &s->root))
+		return -EPERM;
In order to be consistent with our typical access control ordering,
please move the security_sb_statfs() call down to here, after the
capability checks.
I've moved the security_sb_statfs() calls accordingly.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help