* [PATCH] ocfs2: trusted xattr missing CAP_SYS_ADMIN check
@ 2015-03-24 15:46 Sanidhya Kashyap
2015-03-24 21:06 ` [Ocfs2-devel] " Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Sanidhya Kashyap @ 2015-03-24 15:46 UTC (permalink / raw)
To: mfasheh, jlbec, ocfs2-devel, linux-kernel
Cc: taesoo, changwoo, sanidhya, blee, csong84, Sanidhya Kashyap
The trusted extended attributes are only visible to the process which hvae
CAP_SYS_ADMIN capability but the check is missing in ocfs2 xattr_handler
trusted list. The check is important because this will be used for implementing
mechanisms in the userspace for which other ordinary processes should not
have access to.
Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@gmail.com>
---
fs/ocfs2/xattr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 85b190d..71a6551 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -7326,6 +7326,9 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
const size_t total_len = prefix_len + name_len + 1;
+ if (!capable(CAP_SYS_ADMIN))
+ return 0;
+
if (list && total_len <= list_size) {
memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
memcpy(list + prefix_len, name, name_len);
--
2.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Ocfs2-devel] [PATCH] ocfs2: trusted xattr missing CAP_SYS_ADMIN check
2015-03-24 15:46 [PATCH] ocfs2: trusted xattr missing CAP_SYS_ADMIN check Sanidhya Kashyap
@ 2015-03-24 21:06 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2015-03-24 21:06 UTC (permalink / raw)
To: Sanidhya Kashyap
Cc: mfasheh, jlbec, ocfs2-devel, linux-kernel, taesoo, sanidhya,
blee, csong84, changwoo
On Tue, 24 Mar 2015 11:46:32 -0400 Sanidhya Kashyap <sanidhya.gatech@gmail.com> wrote:
> The trusted extended attributes are only visible to the process which hvae
> CAP_SYS_ADMIN capability but the check is missing in ocfs2 xattr_handler
> trusted list. The check is important because this will be used for implementing
> mechanisms in the userspace for which other ordinary processes should not
> have access to.
>
> ...
>
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -7326,6 +7326,9 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
> const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
> const size_t total_len = prefix_len + name_len + 1;
>
> + if (!capable(CAP_SYS_ADMIN))
> + return 0;
> +
> if (list && total_len <= list_size) {
> memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
> memcpy(list + prefix_len, name, name_len);
Ouch. Won't this break existing userspace?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-24 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 15:46 [PATCH] ocfs2: trusted xattr missing CAP_SYS_ADMIN check Sanidhya Kashyap
2015-03-24 21:06 ` [Ocfs2-devel] " Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome