summaryrefslogtreecommitdiff
blob: 6db8e37d63302df1e894b67a888d53a209cdcef5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From: Anthony G. Basile <blueness@gentoo.org>

For users that emerge without XATTR_PAX support enabled, we still want user.pax.flags
namespace supported on tmpfs so that the PaX markings survive emerge.

diff -Naur a/mm/shmem.c b/mm/shmem.c
--- a/mm/shmem.c	2016-04-29 19:56:25.306101147 -0400
+++ b/mm/shmem.c	2016-04-29 19:59:44.126104490 -0400
@@ -2670,24 +2670,20 @@
 	return simple_xattr_set(&info->xattrs, name, value, size, flags);
 }
 
-#ifdef CONFIG_PAX_XATTR_PAX_FLAGS
 static int shmem_user_xattr_handler_set(const struct xattr_handler *handler,
 				   struct dentry *dentry, const char *name,
 				   const void *value, size_t size, int flags)
 {
 	struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
 
-#ifdef CONFIG_PAX_XATTR_PAX_FLAGS
 	if (strcmp(name, XATTR_NAME_PAX_FLAGS))
 		return -EOPNOTSUPP;
 	if (size > 8)
 		return -EINVAL;
-#endif
 
 	name = xattr_full_name(handler, name);
 	return simple_xattr_set(&info->xattrs, name, value, size, flags);
 }
-#endif
 
 static const struct xattr_handler shmem_security_xattr_handler = {
 	.prefix = XATTR_SECURITY_PREFIX,
@@ -2701,13 +2697,11 @@
 	.set = shmem_xattr_handler_set,
 };
 
-#ifdef CONFIG_PAX_XATTR_PAX_FLAGS
 static const struct xattr_handler shmem_user_xattr_handler = {
 	.prefix = XATTR_USER_PREFIX,
 	.get = shmem_xattr_handler_get,
 	.set = shmem_user_xattr_handler_set,
 };
-#endif
 
 static const struct xattr_handler *shmem_xattr_handlers[] = {
 #ifdef CONFIG_TMPFS_POSIX_ACL
@@ -2717,9 +2711,7 @@
 	&shmem_security_xattr_handler,
 	&shmem_trusted_xattr_handler,
 
-#ifdef CONFIG_PAX_XATTR_PAX_FLAGS
 	&shmem_user_xattr_handler,
-#endif
 
 	NULL
 };