* [PATCH] CRED: Fix IA64 COW credentials handling
@ 2008-08-12 9:24 David Howells
2008-08-12 12:40 ` Kamalesh Babulal
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: David Howells @ 2008-08-12 9:24 UTC (permalink / raw)
To: sfr, jmorris; +Cc: tony.luck, linux-next, dhowells, linux-security-module
Fix the IA64 arch's use of COW credentials.
Signed-off-by: David Howells <dhowells@redhat.com>
---
arch/ia64/ia32/sys_ia32.c | 7 +++----
arch/ia64/kernel/perfmon.c | 32 ++++++++++++++++++++------------
include/sound/ad1848.h | 0
sound/isa/ad1848/ad1848_lib.c | 0
4 files changed, 23 insertions(+), 16 deletions(-)
delete mode 100644 include/sound/ad1848.h
delete mode 100644 sound/isa/ad1848/ad1848_lib.c
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 465116a..7f0704f 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2084,25 +2084,24 @@ groups16_from_user(struct group_info *group_info, short __user *grouplist)
asmlinkage long
sys32_getgroups16 (int gidsetsize, short __user *grouplist)
{
+ const struct cred *cred = current_cred();
int i;
if (gidsetsize < 0)
return -EINVAL;
- get_group_info(current->group_info);
- i = current->group_info->ngroups;
+ i = cred->group_info->ngroups;
if (gidsetsize) {
if (i > gidsetsize) {
i = -EINVAL;
goto out;
}
- if (groups16_to_user(grouplist, current->group_info)) {
+ if (groups16_to_user(grouplist, cred->group_info)) {
i = -EFAULT;
goto out;
}
}
out:
- put_group_info(current->group_info);
return i;
}
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index ffe6de0..a1aead7 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2403,25 +2403,33 @@ error_kmem:
static int
pfm_bad_permissions(struct task_struct *task)
{
+ const struct cred *tcred;
uid_t uid = current_uid();
gid_t gid = current_gid();
+ int ret;
+
+ rcu_read_lock();
+ tcred = __task_cred(task);
/* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
uid,
gid,
- task->euid,
- task->suid,
- task->uid,
- task->egid,
- task->sgid));
-
- return (uid != task->euid)
- || (uid != task->suid)
- || (uid != task->uid)
- || (gid != task->egid)
- || (gid != task->sgid)
- || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
+ tcred->euid,
+ tcred->suid,
+ tcred->uid,
+ tcred->egid,
+ tcred->sgid));
+
+ ret = ((uid != tcred->euid)
+ || (uid != tcred->suid)
+ || (uid != tcred->uid)
+ || (gid != tcred->egid)
+ || (gid != tcred->sgid)
+ || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
+
+ rcu_read_unlock();
+ return ret;
}
static int
diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
deleted file mode 100644
index e69de29..0000000
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
deleted file mode 100644
index e69de29..0000000
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] CRED: Fix IA64 COW credentials handling
2008-08-12 9:24 [PATCH] CRED: Fix IA64 COW credentials handling David Howells
@ 2008-08-12 12:40 ` Kamalesh Babulal
2008-08-12 22:48 ` James Morris
2008-08-12 22:52 ` James Morris
2 siblings, 0 replies; 5+ messages in thread
From: Kamalesh Babulal @ 2008-08-12 12:40 UTC (permalink / raw)
To: David Howells; +Cc: sfr, jmorris, tony.luck, linux-next, linux-security-module
David Howells wrote:
> Fix the IA64 arch's use of COW credentials.
Hi David,
Thanks, the build failure is fixed by the thanks.
Tested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
>
> arch/ia64/ia32/sys_ia32.c | 7 +++----
> arch/ia64/kernel/perfmon.c | 32 ++++++++++++++++++++------------
> include/sound/ad1848.h | 0
> sound/isa/ad1848/ad1848_lib.c | 0
> 4 files changed, 23 insertions(+), 16 deletions(-)
> delete mode 100644 include/sound/ad1848.h
> delete mode 100644 sound/isa/ad1848/ad1848_lib.c
>
> diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
> index 465116a..7f0704f 100644
> --- a/arch/ia64/ia32/sys_ia32.c
> +++ b/arch/ia64/ia32/sys_ia32.c
> @@ -2084,25 +2084,24 @@ groups16_from_user(struct group_info *group_info, short __user *grouplist)
> asmlinkage long
> sys32_getgroups16 (int gidsetsize, short __user *grouplist)
> {
> + const struct cred *cred = current_cred();
> int i;
>
> if (gidsetsize < 0)
> return -EINVAL;
>
> - get_group_info(current->group_info);
> - i = current->group_info->ngroups;
> + i = cred->group_info->ngroups;
> if (gidsetsize) {
> if (i > gidsetsize) {
> i = -EINVAL;
> goto out;
> }
> - if (groups16_to_user(grouplist, current->group_info)) {
> + if (groups16_to_user(grouplist, cred->group_info)) {
> i = -EFAULT;
> goto out;
> }
> }
> out:
> - put_group_info(current->group_info);
> return i;
> }
>
> diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
> index ffe6de0..a1aead7 100644
> --- a/arch/ia64/kernel/perfmon.c
> +++ b/arch/ia64/kernel/perfmon.c
> @@ -2403,25 +2403,33 @@ error_kmem:
> static int
> pfm_bad_permissions(struct task_struct *task)
> {
> + const struct cred *tcred;
> uid_t uid = current_uid();
> gid_t gid = current_gid();
> + int ret;
> +
> + rcu_read_lock();
> + tcred = __task_cred(task);
>
> /* inspired by ptrace_attach() */
> DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
> uid,
> gid,
> - task->euid,
> - task->suid,
> - task->uid,
> - task->egid,
> - task->sgid));
> -
> - return (uid != task->euid)
> - || (uid != task->suid)
> - || (uid != task->uid)
> - || (gid != task->egid)
> - || (gid != task->sgid)
> - || (gid != task->gid)) && !capable(CAP_SYS_PTRACE);
> + tcred->euid,
> + tcred->suid,
> + tcred->uid,
> + tcred->egid,
> + tcred->sgid));
> +
> + ret = ((uid != tcred->euid)
> + || (uid != tcred->suid)
> + || (uid != tcred->uid)
> + || (gid != tcred->egid)
> + || (gid != tcred->sgid)
> + || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
> +
> + rcu_read_unlock();
> + return ret;
> }
>
> static int
> diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
> deleted file mode 100644
> index e69de29..0000000
>
--
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CRED: Fix IA64 COW credentials handling
2008-08-12 9:24 [PATCH] CRED: Fix IA64 COW credentials handling David Howells
2008-08-12 12:40 ` Kamalesh Babulal
@ 2008-08-12 22:48 ` James Morris
2008-08-12 23:43 ` David Howells
2008-08-12 22:52 ` James Morris
2 siblings, 1 reply; 5+ messages in thread
From: James Morris @ 2008-08-12 22:48 UTC (permalink / raw)
To: David Howells; +Cc: sfr, tony.luck, linux-next, linux-security-module
On Tue, 12 Aug 2008, David Howells wrote:
> Fix the IA64 arch's use of COW credentials.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> ---
> diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
> deleted file mode 100644
> index e69de29..0000000
> diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
> deleted file mode 100644
> index e69de29..0000000
Where did this come from ? :-)
- James
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CRED: Fix IA64 COW credentials handling
2008-08-12 9:24 [PATCH] CRED: Fix IA64 COW credentials handling David Howells
2008-08-12 12:40 ` Kamalesh Babulal
2008-08-12 22:48 ` James Morris
@ 2008-08-12 22:52 ` James Morris
2 siblings, 0 replies; 5+ messages in thread
From: James Morris @ 2008-08-12 22:52 UTC (permalink / raw)
To: David Howells; +Cc: sfr, tony.luck, linux-next, linux-security-module
On Tue, 12 Aug 2008, David Howells wrote:
> Fix the IA64 arch's use of COW credentials.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
Applied the IA64 chunks to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next-creds
- James
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CRED: Fix IA64 COW credentials handling
2008-08-12 22:48 ` James Morris
@ 2008-08-12 23:43 ` David Howells
0 siblings, 0 replies; 5+ messages in thread
From: David Howells @ 2008-08-12 23:43 UTC (permalink / raw)
To: James Morris; +Cc: dhowells, sfr, tony.luck, linux-next, linux-security-module
James Morris <jmorris@namei.org> wrote:
> > diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h
> > deleted file mode 100644
> > index e69de29..0000000
> > diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
> > deleted file mode 100644
> > index e69de29..0000000
>
> Where did this come from ? :-)
Ummm... I don't know. GIT being bad I expect. I'll have a look in the
morning.
David
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-08-12 23:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-12 9:24 [PATCH] CRED: Fix IA64 COW credentials handling David Howells
2008-08-12 12:40 ` Kamalesh Babulal
2008-08-12 22:48 ` James Morris
2008-08-12 23:43 ` David Howells
2008-08-12 22:52 ` James Morris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).