Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.10 commit in: /
Date: Fri, 02 Jul 2021 19:38:29
Message-Id: 1625254663.da09e43808cfff024220fc10065e6744764e576e.mpagano@gentoo
1 commit: da09e43808cfff024220fc10065e6744764e576e
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 2 19:37:43 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 2 19:37:43 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=da09e438
7
8 Update shiftfs patchset and correct typo in patch name
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 2 +-
13 ...-20.04.patch => 5000_shiftfs-ubuntu-20.04.patch | 89 +++++++++++++---------
14 2 files changed, 53 insertions(+), 38 deletions(-)
15
16 diff --git a/0000_README b/0000_README
17 index 9ae25ca..58e20cf 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -255,7 +255,7 @@ Patch: 4567_distro-Gentoo-Kconfig.patch
21 From: Tom Wijsman <TomWij@g.o>
22 Desc: Add Gentoo Linux support config settings and defaults.
23
24 -Patch: 5000_shifts-ubuntu-20.04.patch
25 +Patch: 5000_shiftfs-ubuntu-20.04.patch
26 From: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal
27 Desc: UID/GID shifting overlay filesystem for containers
28
29
30 diff --git a/5000_shifts-ubuntu-20.04.patch b/5000_shiftfs-ubuntu-20.04.patch
31 similarity index 97%
32 rename from 5000_shifts-ubuntu-20.04.patch
33 rename to 5000_shiftfs-ubuntu-20.04.patch
34 index 665fc66..9ea7400 100644
35 --- a/5000_shifts-ubuntu-20.04.patch
36 +++ b/5000_shiftfs-ubuntu-20.04.patch
37 @@ -1,6 +1,6 @@
38 ---- /dev/null 2021-01-08 13:33:13.190303432 -0500
39 -+++ b/fs/shiftfs.c 2021-01-08 19:02:40.000000000 -0500
40 -@@ -0,0 +1,2157 @@
41 +--- /dev/null 2021-07-02 07:32:48.742034238 -0400
42 ++++ b/fs/shiftfs.c 2021-07-02 13:55:18.327684885 -0400
43 +@@ -0,0 +1,2172 @@
44 +#include <linux/btrfs.h>
45 +#include <linux/capability.h>
46 +#include <linux/cred.h>
47 @@ -1427,7 +1427,7 @@
48 + kfree(v1);
49 + kfree(v2);
50 +
51 -+ return ret;
52 ++ return ret ? -EFAULT: 0;
53 +}
54 +
55 +static int shiftfs_btrfs_ioctl_fd_replace(int cmd, void __user *arg,
56 @@ -1441,6 +1441,9 @@
57 + struct btrfs_ioctl_vol_args *v1 = NULL;
58 + struct btrfs_ioctl_vol_args_v2 *v2 = NULL;
59 +
60 ++ *b1 = NULL;
61 ++ *b2 = NULL;
62 ++
63 + if (!is_btrfs_snap_ioctl(cmd))
64 + return 0;
65 +
66 @@ -1449,29 +1452,29 @@
67 + if (IS_ERR(v1))
68 + return PTR_ERR(v1);
69 + oldfd = v1->fd;
70 -+ *b1 = v1;
71 + } else {
72 + v2 = memdup_user(arg, sizeof(*v2));
73 + if (IS_ERR(v2))
74 + return PTR_ERR(v2);
75 + oldfd = v2->fd;
76 -+ *b2 = v2;
77 + }
78 +
79 + src = fdget(oldfd);
80 -+ if (!src.file)
81 -+ return -EINVAL;
82 ++ if (!src.file) {
83 ++ ret = -EINVAL;
84 ++ goto err_free;
85 ++ }
86 +
87 + ret = shiftfs_real_fdget(src.file, &lfd);
88 + if (ret) {
89 + fdput(src);
90 -+ return ret;
91 ++ goto err_free;
92 + }
93 +
94 + /*
95 + * shiftfs_real_fdget() does not take a reference to lfd.file, so
96 + * take a reference here to offset the one which will be put by
97 -+ * __close_fd(), and make sure that reference is put on fdput(lfd).
98 ++ * close_fd(), and make sure that reference is put on fdput(lfd).
99 + */
100 + get_file(lfd.file);
101 + lfd.flags |= FDPUT_FPUT;
102 @@ -1480,7 +1483,8 @@
103 + *newfd = get_unused_fd_flags(lfd.file->f_flags);
104 + if (*newfd < 0) {
105 + fdput(lfd);
106 -+ return *newfd;
107 ++ ret = *newfd;
108 ++ goto err_free;
109 + }
110 +
111 + fd_install(*newfd, lfd.file);
112 @@ -1495,8 +1499,19 @@
113 + v2->fd = oldfd;
114 + }
115 +
116 -+ if (ret)
117 ++ if (!ret) {
118 ++ *b1 = v1;
119 ++ *b2 = v2;
120 ++ } else {
121 + shiftfs_btrfs_ioctl_fd_restore(cmd, *newfd, arg, v1, v2);
122 ++ ret = -EFAULT;
123 ++ }
124 ++
125 ++ return ret;
126 ++
127 ++err_free:
128 ++ kfree(v1);
129 ++ kfree(v2);
130 +
131 + return ret;
132 +}
133 @@ -2158,45 +2173,45 @@
134 +MODULE_LICENSE("GPL v2");
135 +module_init(shiftfs_init)
136 +module_exit(shiftfs_exit)
137 ---- a/include/uapi/linux/magic.h 2021-01-06 19:08:45.234777659 -0500
138 -+++ b/include/uapi/linux/magic.h 2021-01-06 19:09:53.900375394 -0500
139 -@@ -96,4 +96,6 @@
140 - #define DEVMEM_MAGIC 0x454d444d /* "DMEM" */
141 +--- a/include/uapi/linux/magic.h 2021-07-02 13:19:57.024999483 -0400
142 ++++ b/include/uapi/linux/magic.h 2021-07-02 13:21:16.215074343 -0400
143 +@@ -98,4 +98,6 @@
144 #define Z3FOLD_MAGIC 0x33
145 + #define PPC_CMM_MAGIC 0xc7571590
146
147 -+#define SHIFTFS_MAGIC 0x6a656a62
148 ++#define SHIFTFS_MAGIC 0x6a656a62
149 +
150 #endif /* __LINUX_MAGIC_H__ */
151 ---- a/fs/Makefile 2021-01-08 18:08:28.187064015 -0500
152 -+++ b/fs/Makefile 2021-01-08 18:09:00.788217579 -0500
153 +--- a/fs/Makefile 2021-07-02 13:22:24.815163699 -0400
154 ++++ b/fs/Makefile 2021-07-02 13:22:43.991858989 -0400
155 @@ -136,3 +136,4 @@ obj-$(CONFIG_EFIVAR_FS) += efivarfs/
156 obj-$(CONFIG_EROFS_FS) += erofs/
157 obj-$(CONFIG_VBOXSF_FS) += vboxsf/
158 obj-$(CONFIG_ZONEFS_FS) += zonefs/
159 -+obj-$(CONFIG_SHIFT_FS) += shiftfs.o
160 ---- a/fs/Kconfig 2021-01-06 19:14:17.709697891 -0500
161 -+++ b/fs/Kconfig 2021-01-06 19:15:23.413281282 -0500
162 -@@ -122,6 +122,24 @@ source "fs/autofs/Kconfig"
163 ++obj-$(CONFIG_SHIFT_FS) += shiftfs.o
164 +--- a/fs/Kconfig 2021-07-02 13:24:13.908678796 -0400
165 ++++ b/fs/Kconfig 2021-07-02 13:28:26.312574889 -0400
166 +@@ -123,6 +123,24 @@ source "fs/autofs/Kconfig"
167 source "fs/fuse/Kconfig"
168 source "fs/overlayfs/Kconfig"
169
170 +config SHIFT_FS
171 -+ tristate "UID/GID shifting overlay filesystem for containers"
172 -+ help
173 -+ This filesystem can overlay any mounted filesystem and shift
174 -+ the uid/gid the files appear at. The idea is that
175 -+ unprivileged containers can use this to mount root volumes
176 -+ using this technique.
177 ++ tristate "UID/GID shifting overlay filesystem for containers"
178 ++ help
179 ++ This filesystem can overlay any mounted filesystem and shift
180 ++ the uid/gid the files appear at. The idea is that
181 ++ unprivileged containers can use this to mount root volumes
182 ++ using this technique.
183 +
184 +config SHIFT_FS_POSIX_ACL
185 -+ bool "shiftfs POSIX Access Control Lists"
186 -+ depends on SHIFT_FS
187 -+ select FS_POSIX_ACL
188 -+ help
189 -+ POSIX Access Control Lists (ACLs) support permissions for users and
190 -+ groups beyond the owner/group/world scheme.
191 -+
192 -+ If you don't know what Access Control Lists are, say N.
193 ++ bool "shiftfs POSIX Access Control Lists"
194 ++ depends on SHIFT_FS
195 ++ select FS_POSIX_ACL
196 ++ help
197 ++ POSIX Access Control Lists (ACLs) support permissions for users and
198 ++ groups beyond the owner/group/world scheme.
199 ++
200 ++ If you don't know what Access Control Lists are, say N.
201 +
202 menu "Caches"