Skip to contentSkip to conversation

VM: add capabilites check to set_zone_reclaim

PATCH In review Martin Hicks 2 participants 2 messages Jul 27, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VM: add capabilites check to set_zone_reclaim

Hi Andrew,

Here's a patch to add a capability check to sys_set_zone_reclaim(). This syscall is not something that should be available to a user.

Against a recent .git tree.

mh

Signature · 17 lines
Martin Hicks   ||   Silicon Graphics Inc.   ||   [email protected]


Add capabilities check on the set_zone_reclaim() syscall.

Signed-off-by:  Martin Hicks <[email protected]>

---
commit 3297435cafea4822b23d74b051f046694b40beb8
tree 6b64393e98968719818b05b2562714c6f44db531
parent e17fbedb41baa72f5e24ee02f4f43f44e2d3114d
author Martin Hicks,,,,,,,engr <[email protected]> Wed, 27 Jul 2005 09:14:48 -0700
committer Martin Hicks,,,,,,,engr <[email protected]> Wed, 27 Jul 2005 09:14:48 -0700

 include/linux/capability.h |    1 +
 mm/vmscan.c                |    3 +++
 2 files changed, 4 insertions(+), 0 deletions(-)
include/linux/capability.h +1 -0
@@ -233,6 +233,7 @@ typedef __u32 kernel_cap_t;
 /* Allow enabling/disabling tagged queuing on SCSI controllers and sending
    arbitrary SCSI commands */
 /* Allow setting encryption key on loopback filesystem */
+/* Allow setting zone reclaim policy */
 
 #define CAP_SYS_ADMIN        21
 
mm/vmscan.c +3 -0
@@ -1376,6 +1376,9 @@ asmlinkage long sys_set_zone_reclaim(uns
 	struct zone *z;
 	int i;
 
+        if (!capable(CAP_SYS_ADMIN))
+                return -EACCES;
+
 	if (node >= MAX_NUMNODES || !node_online(node))
 		return -EINVAL;
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

mm/vmscan.c asmlinkage long sys_set_zone_reclaim(uns · line 1383

Quoted 8 lines · Martin Hicks
mm/vmscan.c +3 -0
 	struct zone *z;
 	int i;
 
+        if (!capable(CAP_SYS_ADMIN))
+                return -EACCES;
+
 	if (node >= MAX_NUMNODES || !node_online(node))
 		return -EINVAL;

Fix the whitespace issues.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>