login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
October
»
16
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capabilities
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Serge E. Hallyn
Subject:
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capabilities
Date: Tuesday, October 16, 2007 - 11:48 am
Quoting Stephen Smalley (
sds@tycho.nsa.gov
):
quoted text
> On Mon, 2007-10-15 at 21:31 -0500, Serge E. Hallyn wrote: > > >From 7dd503c612afcb86b3165602ab264e2e9493b4bf Mon Sep 17 00:00:00 2001 > > From: Serge E. Hallyn <serue@us.ibm.com> > > Date: Mon, 15 Oct 2007 20:57:52 -0400 > > Subject: [RFC] [PATCH 2/2] capabilities: implement 64-bit capabilities > > > > We are out of capabilities in the 32-bit capability fields, and > > several users could make use of additional capabilities. > > Convert the capabilities to 64-bits, change the capability > > version number accordingly, and convert the file capability > > code to handle both 32-bit and 64-bit file capability xattrs. > > > > It might seem desirable to also implement back-compatibility > > to read 32-bit caps from userspace, but that becomes > > problematic with capget, as capget could return valid info > > for processes not using high bits, but would have to return > > -EINVAL for those which were. > > > > So with this patch, libcap would need to be updated to make > > use of capset/capget. > > > > Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> > > --- > > fs/proc/array.c | 6 +++--- > > include/linux/capability.h | 29 ++++++++++++++++++++--------- > > security/commoncap.c | 37 +++++++++++++++++++++++++++++-------- > > 3 files changed, 52 insertions(+), 20 deletions(-) > > > > diff --git a/fs/proc/array.c b/fs/proc/array.c > > index 3f4d824..c8ea46d 100644 > > --- a/fs/proc/array.c > > +++ b/fs/proc/array.c > > @@ -288,9 +288,9 @@ static inline char *task_sig(struct task_struct *p, char *buffer) > > > > static inline char *task_cap(struct task_struct *p, char *buffer) > > { > > - return buffer + sprintf(buffer, "CapInh:\t%016x\n" > > - "CapPrm:\t%016x\n" > > - "CapEff:\t%016x\n", > > + return buffer + sprintf(buffer, "CapInh:\t%016lx\n" > > + "CapPrm:\t%016lx\n" > > + "CapEff:\t%016lx\n", > > cap_t(p->cap_inheritable), > > cap_t(p->cap_permitted), > > cap_t(p->cap_effective)); > > diff --git a/include/linux/capability.h b/include/linux/capability.h > > index bb017ed..a3da4b9 100644 > > --- a/include/linux/capability.h > > +++ b/include/linux/capability.h > > @@ -29,7 +29,7 @@ struct task_struct; > > library since the draft standard requires the use of malloc/free > > etc.. */ > > > > -#define _LINUX_CAPABILITY_VERSION 0x19980330 > > +#define _LINUX_CAPABILITY_VERSION 0x20071015 > > > > typedef struct __user_cap_header_struct { > > __u32 version; > > @@ -37,29 +37,40 @@ typedef struct __user_cap_header_struct { > > } __user *cap_user_header_t; > > > > typedef struct __user_cap_data_struct { > > - __u32 effective; > > - __u32 permitted; > > - __u32 inheritable; > > + __u64 effective; > > + __u64 permitted; > > + __u64 inheritable; > > } __user *cap_user_data_t; > > > > #define XATTR_CAPS_SUFFIX "capability" > > #define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX > > > > -#define XATTR_CAPS_SZ (3*sizeof(__le32)) > > +#define XATTR_CAPS_SZ_1 (3*sizeof(__le32)) > > +#define XATTR_CAPS_SZ_2 (2*sizeof(__le64) + sizeof(__le32)) > > #define VFS_CAP_REVISION_MASK 0xFF000000 > > #define VFS_CAP_REVISION_1 0x01000000 > > +#define VFS_CAP_REVISION_2 0x02000000 > > > > -#define VFS_CAP_REVISION VFS_CAP_REVISION_1 > > +#define VFS_CAP_REVISION VFS_CAP_REVISION_2 > > +#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2 > > > > #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK > > #define VFS_CAP_FLAGS_EFFECTIVE 0x000001 > > > > -struct vfs_cap_data { > > +struct vfs_cap_data_v1 { > > __u32 magic_etc; /* Little endian */ > > __u32 permitted; /* Little endian */ > > __u32 inheritable; /* Little endian */ > > }; > > > > +struct vfs_cap_data_v2 { > > + __u32 magic_etc; /* Little endian */ > > + __u64 permitted; /* Little endian */ > > + __u64 inheritable; /* Little endian */ > > +}; > > + > > +typedef struct vfs_cap_data_v2 vfs_cap_data; > > + > > #ifdef __KERNEL__ > > > > /* #define STRICT_CAP_T_TYPECHECKS */ > > @@ -67,12 +78,12 @@ struct vfs_cap_data { > > #ifdef STRICT_CAP_T_TYPECHECKS > > > > typedef struct kernel_cap_struct { > > - __u32 cap; > > + __u64 cap; > > } kernel_cap_t; > > > > #else > > > > -typedef __u32 kernel_cap_t; > > +typedef __u64 kernel_cap_t; > > > > #endif > > Don't you need to update CAP_TO_MASK() too?
Yeah, I'm afraid so.
quoted text
> And, of course, SELinux task_has_capability() will then need to deal > with higher capabilities differently, most likely by mapping them to > permissions in a new class and access vector.
I saw your other email about this so will watch that thread. thanks, -serge -
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 1/2 -mm] capabilities: clean up file capability reading
, Serge E. Hallyn
, (Mon Oct 15, 7:27 pm)
[RFC] [PATCH 2/2] capabilities: implement 64-bit capabilities
, Serge E. Hallyn
, (Mon Oct 15, 7:31 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Stephen Smalley
, (Tue Oct 16, 7:18 am)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Serge E. Hallyn
, (Tue Oct 16, 11:48 am)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Serge E. Hallyn
, (Tue Oct 16, 2:41 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Andrew Morton
, (Wed Oct 17, 6:00 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Serge E. Hallyn
, (Wed Oct 17, 7:59 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Casey Schaufler
, (Wed Oct 17, 8:13 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Andrew Morton
, (Wed Oct 17, 8:20 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Chris Wright
, (Wed Oct 17, 10:21 pm)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Serge E. Hallyn
, (Thu Oct 18, 5:50 am)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Andrew Morgan
, (Thu Oct 18, 8:27 am)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Serge E. Hallyn
, (Thu Oct 18, 8:30 am)
Re: [RFC] [PATCH 2/2] capabilities: implement 64-bit capab ...
, Chris Wright
, (Thu Oct 18, 8:30 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate