Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2063743imm; Thu, 7 Jun 2018 05:01:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLUSG2+9oy1TRjI1qPy8stIoqSID/63DLuHl0H84fswHc/fTN79lTQV63P29YRe5sSPHqGy X-Received: by 2002:a63:7a11:: with SMTP id v17-v6mr1335808pgc.97.1528372864825; Thu, 07 Jun 2018 05:01:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528372864; cv=none; d=google.com; s=arc-20160816; b=OoFQKSgDYt5Q4/bH3ZgFVIyRazCev2avNMqnpjppFj5VpTtUrJ2nc7xVAQ8eWswwRz AptpsneIdPh6Ux0MfG1B4NHMH0rwpC60hAh4V6FsB3YYifyIzMXZ4j7aN6/4mQiH5tpG EGQjBeuKN22bQXKz3NUuxvhkvtHzy2PrhuMvCIPOeURhon5y/6nxLYf5fMnxoeql61iS q34m4sXTwXspCFvuEevUJVX8w1lUVkp5bRbXyBvPQuXAEkjyYqei//EMYUoZHRA2Lmlt ydn1vBN6aEO29Xsy4zkHQ46MAkgrHUF9GWCaPyYIYjmB83riozFLS/P7JFgNY74AiXez BiLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CIpA4Fplk4if9Yl5ig6BWPA4vZHtpE5zKAfjT9EqPqw=; b=dYySaLrNZBCimhW8ucbweo3elhY+SwgJpU7CWFNWkLZHIS1l4dOpcZQVl5trr2NjYU x9duzD7kTeX3I5XkZn1Z7SbZMfmoTGfo/MZySry7Go6Ij02DIOydXJ/gkL+J0xft1Osk 2HN2/eSNFODfdigycBDqDuzuU92F78jwcLy5T7dga8xw9U9kKge381rIVQLkz63o5852 bfnxtJl1gosH8v8+KtS+bHfbSrrdX7yP3Od0CkauWOq1SSZN0LY8BXhIbQJlGYFlKtV9 kny7HJxjNJGKBNr/pRqszRRmYSx9lups4ogXv73rqusZ6EolEb9yjkWAdpTJ8QJOMfFl wZnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9-v6si30509465pge.1.2018.06.07.05.00.49; Thu, 07 Jun 2018 05:01:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626AbeFGLn4 (ORCPT + 99 others); Thu, 7 Jun 2018 07:43:56 -0400 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 Received: by mail-wm0-f65.google.com with SMTP id o13-v6so17253064wmf.4; Thu, 07 Jun 2018 04:43:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CIpA4Fplk4if9Yl5ig6BWPA4vZHtpE5zKAfjT9EqPqw=; b=IBgqber+9lz0GryVnwyU6xxPTnPLZ+mVAeUIBWm8PNVL3qJgOZay7kJUpAU3Aw1rU7 E4hNtRH/TzJZMqc4gCEgfxVfTE25kNHzh4IfJYfbw0ewScQ5HHLk/TFVJRdqorkcuWx+ P9nhWd+dcZhvxhU5thf7bSdXiOPyQ1voFBJk50w+0Q/nN7wCJUUEwqrN/WvWf5mDUwYt y+GqRPSJJA92NSz/xzNRtWtdRUcwJ+dQBJUjnpq9z2tBtJu54cZ2OoPrw+ZUZX0xgipS Yb0RE3IJcnvcpl4xeJylWdH0txIuOOvf0aYznx5ONATyTbS3O3OjKz76n6NIIcmHpnDf Dy+g== X-Gm-Message-State: APt69E1uR5etghVmXqgqrjgSUqp2qTM/DfqJAW7ZUdFyu5OAXQpOQRPb 9HmnlKJYu5OADD8kV4pIQoLxuSXe X-Received: by 2002:a1c:88c9:: with SMTP id k192-v6mr1475725wmd.125.1528371832760; Thu, 07 Jun 2018 04:43:52 -0700 (PDT) Received: from localhost.localdomain (u-086-c129.eap.uni-tuebingen.de. [134.2.86.129]) by smtp.gmail.com with ESMTPSA id v13-v6sm15269280wrq.43.2018.06.07.04.43.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 04:43:51 -0700 (PDT) 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> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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