mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: jmorris@namei.org, akpm@linux-foundation.org, morgan@kernel.org
Cc: sfr@canb.auug.org.au, dhowells@redhat.com, viro@ftp.linux.org.uk,
	casey@schaufler-ca.com, linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 05/24] CRED: Constify the kernel_cap_t arguments to the capset LSM hooks [ver #7]
Date: Wed, 06 Aug 2008 16:37:39 +0100	[thread overview]
Message-ID: <20080806153739.14351.13364.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20080806153713.14351.91448.stgit@warthog.procyon.org.uk>

Constify the kernel_cap_t arguments to the capset LSM hooks.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: James Morris <jmorris@namei.org>
---

 include/linux/security.h |   44 ++++++++++++++++++++++++--------------------
 security/commoncap.c     |   10 ++++++----
 security/security.c      |   12 ++++++------
 security/selinux/hooks.c |   10 ++++++----
 4 files changed, 42 insertions(+), 34 deletions(-)


diff --git a/include/linux/security.h b/include/linux/security.h
index dc23a3d..c3eed5a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -49,8 +49,12 @@ extern int cap_settime(struct timespec *ts, struct timezone *tz);
 extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
 extern int cap_ptrace_traceme(struct task_struct *parent);
 extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
-extern int cap_capset_check(kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
-extern void cap_capset_set(kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
+extern int cap_capset_check(const kernel_cap_t *effective,
+			    const kernel_cap_t *inheritable,
+			    const kernel_cap_t *permitted);
+extern void cap_capset_set(const kernel_cap_t *effective,
+			   const kernel_cap_t *inheritable,
+			   const kernel_cap_t *permitted);
 extern int cap_bprm_set_security(struct linux_binprm *bprm);
 extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
 extern int cap_bprm_secureexec(struct linux_binprm *bprm);
@@ -1289,12 +1293,12 @@ struct security_operations {
 	int (*capget) (struct task_struct *target,
 		       kernel_cap_t *effective,
 		       kernel_cap_t *inheritable, kernel_cap_t *permitted);
-	int (*capset_check) (kernel_cap_t *effective,
-			     kernel_cap_t *inheritable,
-			     kernel_cap_t *permitted);
-	void (*capset_set) (kernel_cap_t *effective,
-			    kernel_cap_t *inheritable,
-			    kernel_cap_t *permitted);
+	int (*capset_check) (const kernel_cap_t *effective,
+			     const kernel_cap_t *inheritable,
+			     const kernel_cap_t *permitted);
+	void (*capset_set) (const kernel_cap_t *effective,
+			    const kernel_cap_t *inheritable,
+			    const kernel_cap_t *permitted);
 	int (*capable) (struct task_struct *tsk, int cap);
 	int (*acct) (struct file *file);
 	int (*sysctl) (struct ctl_table *table, int op);
@@ -1561,12 +1565,12 @@ int security_capget(struct task_struct *target,
 		    kernel_cap_t *effective,
 		    kernel_cap_t *inheritable,
 		    kernel_cap_t *permitted);
-int security_capset_check(kernel_cap_t *effective,
-			  kernel_cap_t *inheritable,
-			  kernel_cap_t *permitted);
-void security_capset_set(kernel_cap_t *effective,
-			 kernel_cap_t *inheritable,
-			 kernel_cap_t *permitted);
+int security_capset_check(const kernel_cap_t *effective,
+			  const kernel_cap_t *inheritable,
+			  const kernel_cap_t *permitted);
+void security_capset_set(const kernel_cap_t *effective,
+			 const kernel_cap_t *inheritable,
+			 const kernel_cap_t *permitted);
 int security_capable(struct task_struct *tsk, int cap);
 int security_acct(struct file *file);
 int security_sysctl(struct ctl_table *table, int op);
@@ -1754,16 +1758,16 @@ static inline int security_capget(struct task_struct *target,
 	return cap_capget(target, effective, inheritable, permitted);
 }
 
-static inline int security_capset_check(kernel_cap_t *effective,
-					kernel_cap_t *inheritable,
-					kernel_cap_t *permitted)
+static inline int security_capset_check(const kernel_cap_t *effective,
+					const kernel_cap_t *inheritable,
+					const kernel_cap_t *permitted)
 {
 	return cap_capset_check(effective, inheritable, permitted);
 }
 
-static inline void security_capset_set(kernel_cap_t *effective,
-				       kernel_cap_t *inheritable,
-				       kernel_cap_t *permitted)
+static inline void security_capset_set(const kernel_cap_t *effective,
+				       const kernel_cap_t *inheritable,
+				       const kernel_cap_t *permitted)
 {
 	cap_capset_set(effective, inheritable, permitted);
 }
diff --git a/security/commoncap.c b/security/commoncap.c
index 059a131..40e8b83 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -117,8 +117,9 @@ static inline int cap_limit_ptraced_target(void)
 
 #endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */
 
-int cap_capset_check (kernel_cap_t *effective,
-		      kernel_cap_t *inheritable, kernel_cap_t *permitted)
+int cap_capset_check(const kernel_cap_t *effective,
+		     const kernel_cap_t *inheritable,
+		     const kernel_cap_t *permitted)
 {
 	if (cap_inh_is_capped()
 	    && !cap_issubset(*inheritable,
@@ -149,8 +150,9 @@ int cap_capset_check (kernel_cap_t *effective,
 	return 0;
 }
 
-void cap_capset_set (kernel_cap_t *effective,
-		     kernel_cap_t *inheritable, kernel_cap_t *permitted)
+void cap_capset_set(const kernel_cap_t *effective,
+		    const kernel_cap_t *inheritable,
+		    const kernel_cap_t *permitted)
 {
 	current->cap_effective = *effective;
 	current->cap_inheritable = *inheritable;
diff --git a/security/security.c b/security/security.c
index 78502ac..c2203f5 100644
--- a/security/security.c
+++ b/security/security.c
@@ -145,16 +145,16 @@ int security_capget(struct task_struct *target,
 	return security_ops->capget(target, effective, inheritable, permitted);
 }
 
-int security_capset_check(kernel_cap_t *effective,
-			  kernel_cap_t *inheritable,
-			  kernel_cap_t *permitted)
+int security_capset_check(const kernel_cap_t *effective,
+			  const kernel_cap_t *inheritable,
+			  const kernel_cap_t *permitted)
 {
 	return security_ops->capset_check(effective, inheritable, permitted);
 }
 
-void security_capset_set(kernel_cap_t *effective,
-			 kernel_cap_t *inheritable,
-			 kernel_cap_t *permitted)
+void security_capset_set(const kernel_cap_t *effective,
+			 const kernel_cap_t *inheritable,
+			 const kernel_cap_t *permitted)
 {
 	security_ops->capset_set(effective, inheritable, permitted);
 }
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index b040887..9cc59f6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1781,8 +1781,9 @@ static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
 	return secondary_ops->capget(target, effective, inheritable, permitted);
 }
 
-static int selinux_capset_check(kernel_cap_t *effective,
-				kernel_cap_t *inheritable, kernel_cap_t *permitted)
+static int selinux_capset_check(const kernel_cap_t *effective,
+				const kernel_cap_t *inheritable,
+				const kernel_cap_t *permitted)
 {
 	int error;
 
@@ -1793,8 +1794,9 @@ static int selinux_capset_check(kernel_cap_t *effective,
 	return task_has_perm(current, current, PROCESS__SETCAP);
 }
 
-static void selinux_capset_set(kernel_cap_t *effective,
-			       kernel_cap_t *inheritable, kernel_cap_t *permitted)
+static void selinux_capset_set(const kernel_cap_t *effective,
+			       const kernel_cap_t *inheritable,
+			       const kernel_cap_t *permitted)
 {
 	secondary_ops->capset_set(effective, inheritable, permitted);
 }


  parent reply	other threads:[~2008-08-06 15:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06 15:37 [PATCH 00/24] Introduce credentials " David Howells
2008-08-06 15:37 ` [PATCH 01/24] Fix setting of PF_SUPERPRIV by __capable() " David Howells
2008-08-06 15:37 ` [PATCH 02/24] KEYS: Disperse linux/key_ui.h " David Howells
2008-08-06 15:37 ` [PATCH 03/24] KEYS: Alter use of key instantiation link-to-keyring argument " David Howells
2008-08-06 15:37 ` [PATCH 04/24] CRED: Neuter sys_capset() " David Howells
2008-08-06 15:37 ` David Howells [this message]
2008-08-06 15:37 ` [PATCH 06/24] CRED: Change current->fs[ug]id to current_fs[ug]id() " David Howells
2008-08-06 15:37 ` [PATCH 07/24] CRED: Wrap most current->e?[ug]id and some task->e?[ug]id " David Howells
2008-08-06 15:37 ` [PATCH 08/24] CRED: Separate task security context from task_struct " David Howells
2008-08-06 15:38 ` [PATCH 09/24] CRED: Detach the credentials " David Howells
2008-08-06 15:38 ` [PATCH 10/24] CRED: Wrap current->cred and a few other accessors " David Howells
2008-08-06 15:38 ` [PATCH 11/24] CRED: Use RCU to access another task's creds and to release a task's own creds " David Howells
2008-08-06 15:38 ` [PATCH 12/24] CRED: Wrap access to SELinux's task SID " David Howells
2008-08-06 15:38 ` [PATCH 13/24] CRED: Separate per-task-group keyrings from signal_struct " David Howells
2008-08-06 15:38 ` [PATCH 14/24] CRED: Rename is_single_threaded() to is_wq_single_threaded() " David Howells
2008-08-06 15:38 ` [PATCH 15/24] CRED: Make inode_has_perm() and file_has_perm() take a cred pointer " David Howells
2008-08-06 15:38 ` [PATCH 16/24] CRED: Pass credentials through dentry_open() " David Howells
2008-08-06 15:38 ` [PATCH 17/24] CRED: Inaugurate COW credentials " David Howells
2008-08-06 15:38 ` [PATCH 18/24] CRED: Make execve() take advantage of copy-on-write " David Howells
2008-08-06 15:38 ` [PATCH 19/24] CRED: Prettify commoncap.c " David Howells
2008-08-06 15:38 ` [PATCH 20/24] CRED: Use creds in file structs " David Howells
2008-08-06 15:39 ` [PATCH 21/24] CRED: Documentation " David Howells
2008-08-06 15:39 ` [PATCH 22/24] CRED: Differentiate objective and effective subjective credentials on a task " David Howells
2008-08-06 15:39 ` [PATCH 23/24] CRED: Add a kernel_service object class to SELinux " David Howells
2008-08-06 15:39 ` [PATCH 24/24] CRED: Allow kernel services to override LSM settings for task actions " David Howells
2008-08-07  8:50 ` [PATCH 00/24] Introduce credentials " James Morris
2008-08-07  9:32 ` David Howells
2008-08-07  9:56   ` James Morris
2008-08-07 12:03 ` James Morris
2008-08-08  0:23   ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080806153739.14351.13364.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=casey@schaufler-ca.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@ftp.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®