public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch
       [not found] <20080827134541.19980.61042.stgit@warthog.procyon.org.uk>
@ 2008-08-27 13:45 ` David Howells
  2008-08-27 14:55   ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2008-08-27 13:45 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-security-module, David Howells, Serge Hallyn, Tony Luck,
	linux-ia64

Wrap access to task credentials so that they can be separated more easily from
the task_struct during the introduction of COW creds.

Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().

Change some task->e?[ug]id to task_e?[ug]id().  In some places it makes more
sense to use RCU directly rather than a convenient wrapper; these will be
addressed by later patches.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org
---

 arch/ia64/kernel/mca_drv.c |    2 +-
 arch/ia64/kernel/perfmon.c |   23 +++++++++++++----------
 arch/ia64/kernel/signal.c  |    4 ++--
 3 files changed, 16 insertions(+), 13 deletions(-)


diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index fab1d21..f94aaa8 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -158,7 +158,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
 	ia64_mlogbuf_dump();
 	printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
 		"iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
-		raw_smp_processor_id(), current->pid, current->uid,
+	       raw_smp_processor_id(), current->pid, current_uid(),
 		iip, ipsr, paddr, current->comm);
 
 	spin_lock(&mca_bh_lock);
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index fc8f350..ffe6de0 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2224,8 +2224,8 @@ pfm_alloc_file(pfm_context_t *ctx)
 	DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
 
 	inode->i_mode = S_IFCHR|S_IRUGO;
-	inode->i_uid  = current->fsuid;
-	inode->i_gid  = current->fsgid;
+	inode->i_uid  = current_fsuid();
+	inode->i_gid  = current_fsgid();
 
 	sprintf(name, "[%lu]", inode->i_ino);
 	this.name = name;
@@ -2403,22 +2403,25 @@ error_kmem:
 static int
 pfm_bad_permissions(struct task_struct *task)
 {
+	uid_t uid = current_uid();
+	gid_t gid = current_gid();
+
 	/* inspired by ptrace_attach() */
 	DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
-		current->uid,
-		current->gid,
+		uid,
+		gid,
 		task->euid,
 		task->suid,
 		task->uid,
 		task->egid,
 		task->sgid));
 
-	return ((current->uid != task->euid)
-	    || (current->uid != task->suid)
-	    || (current->uid != task->uid)
-	    || (current->gid != task->egid)
-	    || (current->gid != task->sgid)
-	    || (current->gid != task->gid)) && !capable(CAP_SYS_PTRACE);
+	return (uid != task->euid)
+	    || (uid != task->suid)
+	    || (uid != task->uid)
+	    || (gid != task->egid)
+	    || (gid != task->sgid)
+	    || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
 }
 
 static int
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 19c5a78..434e93e 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -228,7 +228,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
 	si.si_errno = 0;
 	si.si_code = SI_KERNEL;
 	si.si_pid = task_pid_vnr(current);
-	si.si_uid = current->uid;
+	si.si_uid = current_uid();
 	si.si_addr = sc;
 	force_sig_info(SIGSEGV, &si, current);
 	return retval;
@@ -325,7 +325,7 @@ force_sigsegv_info (int sig, void __user *addr)
 	si.si_errno = 0;
 	si.si_code = SI_KERNEL;
 	si.si_pid = task_pid_vnr(current);
-	si.si_uid = current->uid;
+	si.si_uid = current_uid();
 	si.si_addr = addr;
 	force_sig_info(SIGSEGV, &si, current);
 	return 0;


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

* Re: [PATCH 01/59] CRED: Wrap task credential accesses in the IA64
  2008-08-27 13:45 ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch David Howells
@ 2008-08-27 14:55   ` Artem Bityutskiy
  2008-08-27 15:24     ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch David Howells
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2008-08-27 14:55 UTC (permalink / raw)
  To: David Howells
  Cc: linux-kernel, linux-security-module, Serge Hallyn, Tony Luck,
	linux-ia64

David Howells wrote:
> Wrap access to task credentials so that they can be separated more easily from
> the task_struct during the introduction of COW creds.
> 
> Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id().
> 
> Change some task->e?[ug]id to task_e?[ug]id().  In some places it makes more
> sense to use RCU directly rather than a convenient wrapper; these will be
> addressed by later patches.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> Reviewed-by: James Morris <jmorris@namei.org>
> Acked-by: Serge Hallyn <serue@us.ibm.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: linux-ia64@vger.kernel.org

Fine with me. Do you want us to put this patch to ubifs-2.6.git or you
prefer to make it go together with the rest of the CRED patches?

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

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

* Re: [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch
  2008-08-27 14:55   ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 Artem Bityutskiy
@ 2008-08-27 15:24     ` David Howells
  2008-08-27 23:21       ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: David Howells @ 2008-08-27 15:24 UTC (permalink / raw)
  To: Artem Bityutskiy, Stephen Rothwell
  Cc: dhowells, linux-kernel, linux-security-module, Serge Hallyn,
	Tony Luck, linux-ia64

Artem Bityutskiy <dedekind@yandex.ru> wrote:

> Fine with me.

Can I count that as an Acked-by?

> Do you want us to put this patch to ubifs-2.6.git or you
> prefer to make it go together with the rest of the CRED patches?

Ummm...  I'll check.  I'm not sure exactly how Stephen wanted to play this.

David

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

* Re: [PATCH 01/59] CRED: Wrap task credential accesses in the IA64
  2008-08-27 15:24     ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch David Howells
@ 2008-08-27 23:21       ` Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2008-08-27 23:21 UTC (permalink / raw)
  To: David Howells
  Cc: Artem Bityutskiy, linux-kernel, linux-security-module,
	Serge Hallyn, Tony Luck, linux-ia64

[-- Attachment #1: Type: text/plain, Size: 990 bytes --]

Hi David, Artem,

On Wed, 27 Aug 2008 16:24:38 +0100 David Howells <dhowells@redhat.com> wrote:
>
> Artem Bityutskiy <dedekind@yandex.ru> wrote:
> 
> > Fine with me.
> 
> Can I count that as an Acked-by?
> 
> > Do you want us to put this patch to ubifs-2.6.git or you
> > prefer to make it go together with the rest of the CRED patches?
> 
> Ummm...  I'll check.  I'm not sure exactly how Stephen wanted to play this.

I am happy for these patches to go into both the subsystem and creds
trees (the mess - if any - will be on my head).  I do expect this to
reduce conflicts in the longer term.

It is much better for that to happen than for a subsystem maintainer to
apply a slightly different fixup when I find a conflict.  If there is not
conflict between the subsystem tree and the creds tree, then it doesn't
matter if the patch is in both trees or not.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

end of thread, other threads:[~2008-08-27 23:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080827134541.19980.61042.stgit@warthog.procyon.org.uk>
2008-08-27 13:45 ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch David Howells
2008-08-27 14:55   ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 Artem Bityutskiy
2008-08-27 15:24     ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 arch David Howells
2008-08-27 23:21       ` [PATCH 01/59] CRED: Wrap task credential accesses in the IA64 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox