Re: tmpfs support of xattrs?

From: Casey Schaufler
Date: Tue Oct 28 2008 - 01:52:18 EST


Rob MacKinnon wrote:
Andreas Gruenbacher wrote:
On Monday, 27 October 2008 21:25:31 Stephen Smalley wrote:
Looks like a bug in Smack's implementation of the inode_listsecurity
hook to me. Did you mean to enable Smack in your kernel config?
Yes, there is at least one bug there; this kernel is broken. You may want to try booting with a kernel command line option like "security=none", which *should* turn smack off.

Andreas

All,

Indeed the kernel cmdline option security=none did disable smack. So
atleast that works. Thank you all for helping me track this down. I can
now return to updating packages (some of which have been waiting
patiently for this to be cleared up)! Though I will be looking forward
to this feature working as it was intended. ;) Let me know if there is
a bug # assigned and I'll quietly return to lurking... ;

It looks like a trivial fix and the patch is here. I have just started
testing it myself, but if I don't send it now it will be Wednesday before
I do. No sign-off because I haven't verified it, but I would be delighted
if you would pass judgement on its efficacy. Thank you.


----

diff -uprN -X linux-2.6/Documentation/dontdiff linux-2.6/security/smack/smack_lsm.c linux-smack/security/smack/smack_lsm.c
--- linux-2.6/security/smack/smack_lsm.c 2008-10-26 17:37:08.000000000 -0700
+++ linux-smack/security/smack/smack_lsm.c 2008-10-26 19:11:23.000000000 -0700
@@ -763,13 +763,11 @@ static int smack_inode_getsecurity(const
static int smack_inode_listsecurity(struct inode *inode, char *buffer,
size_t buffer_size)
{
- int len = strlen(XATTR_NAME_SMACK);
+ int len = sizeof(XATTR_NAME_SMACK);

- if (buffer != NULL && len <= buffer_size) {
+ if (buffer != NULL && len <= buffer_size)
memcpy(buffer, XATTR_NAME_SMACK, len);
- return len;
- }
- return -EINVAL;
+ return len;
}

/**

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/