From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 39C9813838B for ; Tue, 7 Oct 2014 01:28:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 273C7E08FB; Tue, 7 Oct 2014 01:28:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B3E81E08FB for ; Tue, 7 Oct 2014 01:28:04 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8C67333EAF6 for ; Tue, 7 Oct 2014 01:28:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 410F87321 for ; Tue, 7 Oct 2014 01:28:02 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1412645313.f0e24d581e380ceb5a563a6bc0a9e66ad077fe31.blueness@gentoo> Subject: [gentoo-commits] proj/linux-patches:3.16 commit in: / X-VCS-Repository: proj/linux-patches X-VCS-Files: 0000_README 1500_XATTR_USER_PREFIX.patch X-VCS-Directories: / X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: f0e24d581e380ceb5a563a6bc0a9e66ad077fe31 X-VCS-Branch: 3.16 Date: Tue, 7 Oct 2014 01:28:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e6ae5abd-8806-4358-ba88-bdd7361d2138 X-Archives-Hash: c2de261d9edc18eb6ff21ef83425a23f commit: f0e24d581e380ceb5a563a6bc0a9e66ad077fe31 Author: Anthony G. Basile gentoo org> AuthorDate: Tue Oct 7 01:28:33 2014 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Tue Oct 7 01:28:33 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=f0e24d58 Add patch t support namespace user.pax.* on tmpfs, bug #470644 --- 0000_README | 4 ++++ 1500_XATTR_USER_PREFIX.patch | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/0000_README b/0000_README index 3cc9441..25ca364 100644 --- a/0000_README +++ b/0000_README @@ -54,6 +54,10 @@ Patch: 1002_linux-3.16.3.patch From: http://www.kernel.org Desc: Linux 3.16.3 +Patch: 1500_XATTR_USER_PREFIX.patch +From: https://bugs.gentoo.org/show_bug.cgi?id=470644 +Desc: Support for namespace user.pax.* on tmpfs. + Patch: 2400_kcopy-patch-for-infiniband-driver.patch From: Alexey Shvetsov Desc: Zero copy for infiniband psm userspace driver diff --git a/1500_XATTR_USER_PREFIX.patch b/1500_XATTR_USER_PREFIX.patch new file mode 100644 index 0000000..cc15cd5 --- /dev/null +++ b/1500_XATTR_USER_PREFIX.patch @@ -0,0 +1,54 @@ +From: Anthony G. Basile + +This patch adds support for a restricted user-controlled namespace on +tmpfs filesystem used to house PaX flags. The namespace must be of the +form user.pax.* and its value cannot exceed a size of 8 bytes. + +This is needed even on all Gentoo systems so that XATTR_PAX flags +are preserved for users who might build packages using portage on +a tmpfs system with a non-hardened kernel and then switch to a +hardened kernel with XATTR_PAX enabled. + +The namespace is added to any user with Extended Attribute support +enabled for tmpfs. Users who do not enable xattrs will not have +the XATTR_PAX flags preserved. + +diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h +index e4629b9..6958086 100644 +--- a/include/uapi/linux/xattr.h ++++ b/include/uapi/linux/xattr.h +@@ -63,5 +63,9 @@ + #define XATTR_POSIX_ACL_DEFAULT "posix_acl_default" + #define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT + ++/* User namespace */ ++#define XATTR_PAX_PREFIX XATTR_USER_PREFIX "pax." ++#define XATTR_PAX_FLAGS_SUFFIX "flags" ++#define XATTR_NAME_PAX_FLAGS XATTR_PAX_PREFIX XATTR_PAX_FLAGS_SUFFIX + + #endif /* _UAPI_LINUX_XATTR_H */ +diff --git a/mm/shmem.c b/mm/shmem.c +index 1c44af7..f23bb1b 100644 +--- a/mm/shmem.c ++++ b/mm/shmem.c +@@ -2201,6 +2201,7 @@ static const struct xattr_handler *shmem_xattr_handlers[] = { + static int shmem_xattr_validate(const char *name) + { + struct { const char *prefix; size_t len; } arr[] = { ++ { XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN}, + { XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN }, + { XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN } + }; +@@ -2256,6 +2257,12 @@ static int shmem_setxattr(struct dentry *dentry, const char *name, + if (err) + return err; + ++ if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) { ++ if (strcmp(name, XATTR_NAME_PAX_FLAGS)) ++ return -EOPNOTSUPP; ++ if (size > 8) ++ return -EINVAL; ++ } + return simple_xattr_set(&info->xattrs, name, value, size, flags); + } +