OpenVZ Forum


Home » Mailing lists » Devel » [RFC] [PATCH -mm] reiser4: replace uid==0 check with capability
[RFC] [PATCH -mm] reiser4: replace uid==0 check with capability [message #25003] Wed, 12 December 2007 21:01 Go to next message
serue is currently offline  serue
Messages: 750
Registered: February 2006
Senior Member
>From c257cb67ce00c8769730cfa92379a53009d99b28 Mon Sep 17 00:00:00 2001
From: serue@us.ibm.com <serue@us.ibm.com>
Date: Wed, 5 Dec 2007 14:02:45 -0800
Subject: [RFC] [PATCH -mm] reiser4: replace uid==0 check with capability

Reiser4 gives root some reserved blocks.  Replace the uid==0 check, which
is not safe in the face of user namespaces, with a CAP_SYS_RESOURCE check,
which seems appropriate.

The per-uid and per-guid reservations appear unimplemented so I'm ignoring
them.

Signed-off-by: Serge Hallyn <serue@us.ibm.com>
---
 fs/reiser4/super.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/reiser4/super.c b/fs/reiser4/super.c
index bc4113e..50e3d09 100644
--- a/fs/reiser4/super.c
+++ b/fs/reiser4/super.c
@@ -144,7 +144,7 @@ long reiser4_reserved_blocks(const struct super_block *super	/* super block
 		reserved += reserved_for_gid(super, gid);
 	if (REISER4_SUPPORT_UID_SPACE_RESERVATION)
 		reserved += reserved_for_uid(super, uid);
-	if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && (uid == 0))
+	if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && capable(CAP_SYS_RESOURCE))
 		reserved += reserved_for_root(super);
 	return reserved;
 }
-- 
1.5.1

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Re: [RFC] [PATCH -mm] reiser4: replace uid==0 check with capability [message #25114 is a reply to message #25003] Wed, 12 December 2007 23:36 Go to previous message
Edward Shishkin is currently offline  Edward Shishkin
Messages: 1
Registered: December 2007
Junior Member
Serge E. Hallyn wrote:

>>From c257cb67ce00c8769730cfa92379a53009d99b28 Mon Sep 17 00:00:00 2001
>From: serue@us.ibm.com <serue@us.ibm.com>
>Date: Wed, 5 Dec 2007 14:02:45 -0800
>Subject: [RFC] [PATCH -mm] reiser4: replace uid==0 check with capability
>
>Reiser4 gives root some reserved blocks.  Replace the uid==0 check, which
>is not safe in the face of user namespaces, with a CAP_SYS_RESOURCE check,
>which seems appropriate.
>
>  
>

Agreed. Thanks,
Edward.

>The per-uid and per-guid reservations appear unimplemented so I'm ignoring
>them.
>
>Signed-off-by: Serge Hallyn <serue@us.ibm.com>
>---
> fs/reiser4/super.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/fs/reiser4/super.c b/fs/reiser4/super.c
>index bc4113e..50e3d09 100644
>--- a/fs/reiser4/super.c
>+++ b/fs/reiser4/super.c
>@@ -144,7 +144,7 @@ long reiser4_reserved_blocks(const struct super_block *super	/* super block
> 		reserved += reserved_for_gid(super, gid);
> 	if (REISER4_SUPPORT_UID_SPACE_RESERVATION)
> 		reserved += reserved_for_uid(super, uid);
>-	if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && (uid == 0))
>+	if (REISER4_SUPPORT_ROOT_SPACE_RESERVATION && capable(CAP_SYS_RESOURCE))
> 		reserved += reserved_for_root(super);
> 	return reserved;
> }
>  
>

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
Previous Topic: [RFC] [PATCH -mm] agp: remove uid comparison as security check
Next Topic: [PATCH 2.6.25] IPv4: thresholds in fib_trie.c are not modified, make them const
Goto Forum:
  


Current Time: Tue Aug 05 12:00:46 GMT 2025

Total time taken to generate the page: 1.42840 seconds