linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Brauner <christian@brauner.io>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: cjwatson@ubuntu.com, ebiederm@xmission.com,
	viro@zeniv.linux.org.uk, serge@hallyn.com,
	Christian Brauner <christian@brauner.io>
Subject: [PATCH 0/1] getxattr: use correct xattr length
Date: Thu,  7 Jun 2018 13:43:47 +0200	[thread overview]
Message-ID: <20180607114348.23667-1-christian@brauner.io> (raw)

Hey,

When running in a container with a user namespace, if you call getxattr
with name = "system.posix_acl_access" and size % 8 != 4, then getxattr
silently skips the user namespace fixup that it normally does resulting in
un-fixed-up data being returned.
I think that the analysis that this is caused by
posix_acl_fix_xattr_to_user() being passed the total buffer size and not
the actual size of the xattr as returned by vfs_getxattr() is correct.
So this commit passes the actual length of the xattr as returned by
vfs_getxattr() down.

It might be worth considering making posix_acl_fix_xattr_userns() and
posix_acl_fix_xattr_to_user() return errors. Such that e.g.
posix_acl_xattr_count() errors can be caught in getxattr(). If that's
something we want I can send a follow-up patch.

More details of this can be found in
https://bugzilla.kernel.org/show_bug.cgi?id=199945

Thanks!
Christian

Christian Brauner (1):
  getxattr: use correct xattr length

 fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.0

             reply	other threads:[~2018-06-07 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 11:43 Christian Brauner [this message]
2018-06-07 11:43 ` [PATCH 1/1] getxattr: use correct xattr length Christian Brauner
2018-06-13 15:45   ` Serge E. Hallyn
2018-06-13 16:42     ` Christian Brauner
2018-07-23 15:00     ` Christian Brauner
2018-07-23 15:14       ` Serge E. Hallyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180607114348.23667-1-christian@brauner.io \
    --to=christian@brauner.io \
    --cc=cjwatson@ubuntu.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hallyn.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).