LSM/SELinux: {get,set}context hooks to access LSM security context information.
----- Original Message ----
Quoted 29 lines
From: Dave Quigley <[email protected]>
To: Chris Wright <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Sent: Tuesday, March 4, 2008 3:07:06 PM
Subject: Re: [PATCH 1/1] LSM/SELinux: {get,set}context hooks to access LSM security context information.Quoted 7 lines · Chris Wright
Quoted 6 lines · * David P. Quigley ([email protected]) wrote:
(quoted diff) +4
-0+/* Flags for setcontext */ +#define LSM_SETCORE 1 +#define LSM_SETDISK 2 +#ifdef
CONFIG_SECURITYQuoted 6 lines
Review struct security_operations { · line 1402
Quoted 6 lines
/**
(quoted diff) +1
-0@@ -1395,6 +1399,9 @@ struct security_operations { int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); void (*release_secctx)(char *secdata, u32 seclen); + int (*setcontext)(struct dentry *dentry, void *ctx, u32 ctxlen, intflags);
Quoted 7 lines
Review struct security_operations { · line 1403
Quoted 1 line
(quoted diff) +1
-0+ int (*getcontext)(struct dentry *dentry, void **ctx, u32 *ctxlen);Is this meant to address Casey's argument about the mac label hook name? Also, why have you made the distinction of in-core vs. on disk in the interface? As I mentioned, I think just needs a little better description of why.
Quoted 7 lines
Quoted 2 lines
thanks,
-chrisThe reason for the differentiation is that NFS inodes don't need their on-disk representation set. Normally this would be taken care of with an
inode_getsecuritycall but as you noted Casey objected to a hook to get the suffix name.
No, I objected to a hook that is specific to MAC LSMs that store a single label as an xattr. I objected to it because it was being used to support one file system on one LSM and suggested that for that reason it should be an interface private to either the specific LSM or the specific filesystem.
Quoted 4 lines
Also he did have a point in that the context may have several components to it that could have multiple suffixes. So I need a hook that allows us to set possibly multiple internal security values based on a security context and without using an xattr name.
You could use Ahmed's hook to get the secid of a file and then use secid_to_secctx to get the context. That's what audit has to do.
Casey Schaufler
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 44 lines · Casey Schaufler
----- Original Message ----
Quoted 29 lines
From: Dave Quigley <[email protected]>
To: Chris Wright <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Sent: Tuesday, March 4, 2008 3:07:06 PM
Subject: Re: [PATCH 1/1] LSM/SELinux: {get,set}context hooks to access LSM security context information.Quoted 7 lines · Chris Wright
Quoted 6 lines · * David P. Quigley ([email protected]) wrote:
(quoted diff) +4
-0+/* Flags for setcontext */ +#define LSM_SETCORE 1 +#define LSM_SETDISK 2 +#ifdef
CONFIG_SECURITYQuoted 6 lines
Review struct security_operations { · line 1402
Quoted 6 lines
/**
(quoted diff) +1
-0@@ -1395,6 +1399,9 @@ struct security_operations { int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); void (*release_secctx)(char *secdata, u32 seclen); + int (*setcontext)(struct dentry *dentry, void *ctx, u32 ctxlen, intflags);
Quoted 7 lines
Review struct security_operations { · line 1403
Quoted 1 line
(quoted diff) +1
-0+ int (*getcontext)(struct dentry *dentry, void **ctx, u32 *ctxlen);Is this meant to address Casey's argument about the mac label hook name? Also, why have you made the distinction of in-core vs. on disk in the interface? As I mentioned, I think just needs a little better description of why.
Quoted 7 lines
Quoted 2 lines
thanks,
-chrisThe reason for the differentiation is that NFS inodes don't need their on-disk representation set. Normally this would be taken care of with an
inode_getsecuritycall but as you noted Casey objected to a hook to get the suffix name.No, I objected to a hook that is specific to MAC LSMs that store a single label as an xattr. I objected to it because it was being used to support one file system on one LSM and suggested that for that reason it should be an interface private to either the specific LSM or the specific filesystem.
Quoted 9 lines
Quoted 4 lines
Also he did have a point in that the context may have several components to it that could have multiple suffixes. So I need a hook that allows us to set possibly multiple internal security values based on a security context and without using an xattr name.
You could use Ahmed's hook to get the secid of a file and then use
secid_to_secctxto get the context. That's what audit has to do.
Historically though audit was using inode_getsecurity with the suffix. The reason for the switch to secids was that they didn't want to overhead of retrieving and storing the context unless they needed it. With the NFS case we always want to context so we are going to be going through double calls here all the time which is silly. A robust set of interfaces should have the ability to get/set contexts get/set secids and convert between them. As of right now the context half of that is missing.
Dave
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 44 lines · Casey Schaufler
----- Original Message ----
Quoted 29 lines
From: Dave Quigley <[email protected]>
To: Chris Wright <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Sent: Tuesday, March 4, 2008 3:07:06 PM
Subject: Re: [PATCH 1/1] LSM/SELinux: {get,set}context hooks to access LSM security context information.Quoted 7 lines · Chris Wright
Quoted 6 lines · * David P. Quigley ([email protected]) wrote:
(quoted diff) +4
-0+/* Flags for setcontext */ +#define LSM_SETCORE 1 +#define LSM_SETDISK 2 +#ifdef
CONFIG_SECURITYQuoted 6 lines
Review struct security_operations { · line 1402
Quoted 6 lines
/**
(quoted diff) +1
-0@@ -1395,6 +1399,9 @@ struct security_operations { int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid); void (*release_secctx)(char *secdata, u32 seclen); + int (*setcontext)(struct dentry *dentry, void *ctx, u32 ctxlen, intflags);
Quoted 7 lines
Review struct security_operations { · line 1403
Quoted 1 line
(quoted diff) +1
-0+ int (*getcontext)(struct dentry *dentry, void **ctx, u32 *ctxlen);Is this meant to address Casey's argument about the mac label hook name? Also, why have you made the distinction of in-core vs. on disk in the interface? As I mentioned, I think just needs a little better description of why.
Quoted 7 lines
Quoted 2 lines
thanks,
-chrisThe reason for the differentiation is that NFS inodes don't need their on-disk representation set. Normally this would be taken care of with an
inode_getsecuritycall but as you noted Casey objected to a hook to get the suffix name.No, I objected to a hook that is specific to MAC LSMs that store a single label as an xattr. I objected to it because it was being used to support one file system on one LSM and suggested that for that reason it should be an interface private to either the specific LSM or the specific filesystem.
Quoted 8 lines
Quoted 4 lines
Also he did have a point in that the context may have several components to it that could have multiple suffixes. So I need a hook that allows us to set possibly multiple internal security values based on a security context and without using an xattr name.
You could use Ahmed's hook to get the secid of a file and then use
secid_to_secctxto get the context. That's what audit has to do.
IIRC, originally audit directly called inode_getsecurity() to get the string label, and there was a (since removed) LSM hook to get the name suffix that it needed to pass in as input. That was then replaced by use of interfaces to get the secid at audit collection time and convert that into a context only upon audit record generation to avoid the overhead associated with collecting a context always.
Whereas I think NFS just wants the context always, and it doesn't serve any purpose to first get a secid and then later turn it into a context.
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · --- Stephen Smalley
...
IIRC, originally audit directly calledinode_getsecurity()to get the string label, and there was a (since removed) LSM hook to get the name suffix that it needed to pass in as input. That was then replaced by use of interfaces to get the secid at audit collection time and convert that into a context only upon audit record generation to avoid the overhead associated with collecting a context always.Whereas I think NFS just wants the context always, and it doesn't serve any purpose to first get a secid and then later turn it into a context.
It turns out that I agree that hooks to get the secctx of things would be good to have, in fact I much prefer them to the secid interfaces. I would personally prefer to see audit use them instead of the secid interfaces, but I acknowlege the performance implications that would have on SELinux.
Casey Schaufler
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.