lkml.org 
[lkml]   [2012]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Add security.selinux XATTR support for the UBIFS. Also fix couple of bugs in UBIFS extended attribute length calculation.
On 04/08/2012 22:37, Casey Schaufler wrote:
>> +
>> +size_t
>> +ubifs_security_listxattr(struct dentry *d, char *list, size_t
>> list_size,
>> + const char *name, size_t name_len, int flags)
>> +{
>> + const int prefix_len = XATTR_SECURITY_PREFIX_LEN;
>> + const size_t total_len = prefix_len + name_len + 1;
>> + if (list && total_len <= list_size) {
>> + memcpy(list, XATTR_SECURITY_PREFIX, prefix_len);
>> + memcpy(list+prefix_len, name, name_len);
>> + list[prefix_len + name_len] = '\0';
>> + }
>> + return total_len;
>> +}
>> +
>> +
>> +int ubifs_security_getxattr(struct dentry *d, const char *name,
>> + void *buffer, size_t size, int flags)
>> +{
>> + if (strcmp(name, "") == 0)
>> + return -EINVAL;
>> + return __ubifs_getxattr(d->d_inode, XATTR_NAME_SELINUX, buffer,
>> size);
>> +}
>> +
>> +
>> +int ubifs_security_setxattr(struct dentry *d, const char *name,
>> + const void *value, size_t size,
>> + int flags, int handler_flags)
>> +{
>> + if (strcmp(name, "") == 0)
>> + return -EINVAL;
>> + return __ubifs_setxattr(d->d_inode, XATTR_NAME_SELINUX, value,

More constructively, Casey is right in that you shouldn't be putting
the SELinux xattr in there. If __ubifs_setxattr is expecting the full
namespace.name string just pass name down. Otherwise strip off the
security. and send the remaining porting down to __ubiffs_setxattr.

Dave


\
 
 \ /
  Last update: 2012-04-09 15:45    [W:0.724 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site