Return-Path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:54705 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960AbeFGLny (ORCPT ); Thu, 7 Jun 2018 07:43:54 -0400 From: Christian Brauner 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 Subject: [PATCH 0/1] getxattr: use correct xattr length Date: Thu, 7 Jun 2018 13:43:47 +0200 Message-Id: <20180607114348.23667-1-christian@brauner.io> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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