Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 148143 Details for
Bug 228902
SELinux: fine grained enforcement of sysfs objects
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
sysfs-genfs early work
sysfs-genfs.patch (text/plain), 2.82 KB, created by
Eric Paris
on 2007-02-15 20:23:46 UTC
(
hide
)
Description:
sysfs-genfs early work
Filename:
MIME Type:
Creator:
Eric Paris
Created:
2007-02-15 20:23:46 UTC
Size:
2.82 KB
patch
obsolete
>diff -uprN -x '*.o' -x '*.cmd' -r ./linux-2.6.15/security/selinux/hooks.c ./linux-2.6.15-sysfs/security/selinux/hooks.c >--- ./linux-2.6.15/security/selinux/hooks.c 2006-01-02 22:21:10.000000000 -0500 >+++ ./linux-2.6.15-sysfs/security/selinux/hooks.c 2006-01-25 14:21:17.000000000 -0500 >@@ -558,6 +558,8 @@ static int superblock_doinit(struct supe > > if (strcmp(sb->s_type->name, "proc") == 0) > sbsec->proc = 1; >+ else if (strcmp(sb->s_type->name, "sysfs") == 0) >+ sbsec->sysfs = 1; > > sbsec->initialized = 1; > >@@ -698,6 +700,55 @@ static inline u16 socket_type_to_securit > return SECCLASS_SOCKET; > } > >+#ifdef CONFIG_SYSFS >+extern const unsigned char * sysfs_get_name(struct sysfs_dirent *sd); >+ >+static int selinux_sysfs_get_sid(struct dentry *de, >+ u16 tclass, >+ u32 *sid) >+{ >+ struct sysfs_dirent *sde; >+ int buflen, rc, namelen; >+ char *buffer, *path, *end; >+ const char *name; >+ >+ buffer = (char*)__get_free_page(GFP_KERNEL); >+ if (!buffer) >+ return -ENOMEM; >+ >+ buflen = PAGE_SIZE; >+ end = buffer+buflen; >+ *--end = '\0'; >+ buflen--; >+ path = end-1; >+ *path = '/'; >+ while (de && de != de->d_parent) { >+ sde = de->d_fsdata; >+ >+ name = sysfs_get_name(sde); >+ namelen = strlen(name); >+ buflen -= namelen + 1; >+ if (buflen < 0) >+ break; >+ end -= namelen; >+ memcpy(end, name, namelen); >+ *--end = '/'; >+ path = end; >+ de = sde->s_dentry->d_parent; >+ } >+ rc = security_genfs_sid("sysfs", path, tclass, sid); >+ free_page((unsigned long)buffer); >+ return rc; >+} >+#else >+static int selinux_sysfs_get_sid(struct sysfs_dirent *de, >+ u16 tclass, >+ u32 *sid) >+{ >+ return -EINVAL; >+} >+#endif >+ > #ifdef CONFIG_PROC_FS > static int selinux_proc_get_sid(struct proc_dir_entry *de, > u16 tclass, >@@ -885,6 +936,20 @@ static int inode_doinit_with_dentry(stru > goto out; > isec->sid = sid; > } >+ } else if (sbsec->sysfs) { >+ if (opt_dentry) { >+ /* Called from d_instantiate or d_splice_alias. */ >+ dentry = dget(opt_dentry); >+ } else { >+ /* Called from selinux_complete_init, try to find a dentry. */ >+ dentry = d_find_alias(inode); >+ } >+ >+ rc = selinux_sysfs_get_sid(dentry, isec->sclass, &sid); >+ dput(dentry); >+ if (rc) >+ goto out; >+ isec->sid = sid; > } > break; > } >diff -uprN -x '*.o' -x '*.cmd' -r ./linux-2.6.15/security/selinux/include/objsec.h ./linux-2.6.15-sysfs/security/selinux/include/objsec.h >--- ./linux-2.6.15/security/selinux/include/objsec.h 2006-01-02 22:21:10.000000000 -0500 >+++ ./linux-2.6.15-sysfs/security/selinux/include/objsec.h 2006-01-25 14:07:40.000000000 -0500 >@@ -64,6 +64,7 @@ struct superblock_security_struct { > unsigned int behavior; /* labeling behavior */ > unsigned char initialized; /* initialization flag */ > unsigned char proc; /* proc fs */ >+ unsigned char sysfs; /* sysfs */ > struct semaphore sem; > struct list_head isec_head; > spinlock_t isec_lock;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 228902
: 148143 |
148144