summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch')
-rw-r--r--meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch226
1 files changed, 226 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch b/meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch
new file mode 100644
index 0000000000..1610b5a0fe
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/CVE-2021-3996.patch
@@ -0,0 +1,226 @@
1From 018a10907fa9885093f6d87401556932c2d8bd2b Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Tue, 4 Jan 2022 10:54:20 +0100
4Subject: [PATCH] libmount: fix (deleted) suffix issue [CVE-2021-3996]
5
6This issue is related to parsing the /proc/self/mountinfo file allows an
7unprivileged user to unmount other user's filesystems that are either
8world-writable themselves or mounted in a world-writable directory.
9
10The support for "(deleted)" is no more necessary as the Linux kernel does
11not use it in /proc/self/mountinfo and /proc/self/mount files anymore.
12
13Signed-off-by: Karel Zak <kzak@redhat.com>
14
15CVE: CVE-2021-3996
16Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/018a10907fa9885093f6d87401556932c2d8bd2b]
17Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
18
19---
20 libmount/src/tab_parse.c | 5 -----
21 tests/expected/findmnt/filter-options | 1 -
22 tests/expected/findmnt/filter-options-nameval-neg | 3 +--
23 tests/expected/findmnt/filter-types-neg | 1 -
24 tests/expected/findmnt/outputs-default | 3 +--
25 tests/expected/findmnt/outputs-force-tree | 3 +--
26 tests/expected/findmnt/outputs-kernel | 3 +--
27 tests/expected/libmount/tabdiff-mount | 1 -
28 tests/expected/libmount/tabdiff-move | 1 -
29 tests/expected/libmount/tabdiff-remount | 1 -
30 tests/expected/libmount/tabdiff-umount | 1 -
31 tests/expected/libmount/tabfiles-parse-mountinfo | 11 -----------
32 tests/expected/libmount/tabfiles-py-parse-mountinfo | 11 -----------
33 tests/ts/findmnt/files/mountinfo | 1 -
34 tests/ts/findmnt/files/mountinfo-nonroot | 1 -
35 tests/ts/libmount/files/mountinfo | 1 -
36 16 files changed, 4 insertions(+), 44 deletions(-)
37
38diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c
39index 917779ab6d..4407f9c9c7 100644
40--- a/libmount/src/tab_parse.c
41+++ b/libmount/src/tab_parse.c
42@@ -225,11 +225,6 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, const char *s)
43 goto fail;
44 }
45
46- /* remove "\040(deleted)" suffix */
47- p = (char *) endswith(fs->target, PATH_DELETED_SUFFIX);
48- if (p && *p)
49- *p = '\0';
50-
51 s = skip_separator(s);
52
53 /* (6) vfs options (fs-independent) */
54diff --git a/tests/expected/findmnt/filter-options b/tests/expected/findmnt/filter-options
55index 2606bce76b..97b0ead0ad 100644
56--- a/tests/expected/findmnt/filter-options
57+++ b/tests/expected/findmnt/filter-options
58@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS
59 /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
60 /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
61 /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
62-/mnt/foo /fooooo bar rw,relatime
63 rc=0
64diff --git a/tests/expected/findmnt/filter-options-nameval-neg b/tests/expected/findmnt/filter-options-nameval-neg
65index 5471d65af1..f0467ef755 100644
66--- a/tests/expected/findmnt/filter-options-nameval-neg
67+++ b/tests/expected/findmnt/filter-options-nameval-neg
68@@ -29,6 +29,5 @@ TARGET SOURCE FSTYPE OPTIO
69 |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
70 | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
71 |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
72-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
73-`-/mnt/foo /fooooo bar rw,relatime
74+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
75 rc=0
76diff --git a/tests/expected/findmnt/filter-types-neg b/tests/expected/findmnt/filter-types-neg
77index 2606bce76b..97b0ead0ad 100644
78--- a/tests/expected/findmnt/filter-types-neg
79+++ b/tests/expected/findmnt/filter-types-neg
80@@ -28,5 +28,4 @@ TARGET SOURCE FSTYPE OPTIONS
81 /home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
82 /var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
83 /mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
84-/mnt/foo /fooooo bar rw,relatime
85 rc=0
86diff --git a/tests/expected/findmnt/outputs-default b/tests/expected/findmnt/outputs-default
87index 59495797bd..01599355ec 100644
88--- a/tests/expected/findmnt/outputs-default
89+++ b/tests/expected/findmnt/outputs-default
90@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO
91 |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
92 | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
93 |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
94-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
95-`-/mnt/foo /fooooo bar rw,relatime
96+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
97 rc=0
98diff --git a/tests/expected/findmnt/outputs-force-tree b/tests/expected/findmnt/outputs-force-tree
99index 59495797bd..01599355ec 100644
100--- a/tests/expected/findmnt/outputs-force-tree
101+++ b/tests/expected/findmnt/outputs-force-tree
102@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO
103 |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
104 | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
105 |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
106-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
107-`-/mnt/foo /fooooo bar rw,relatime
108+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
109 rc=0
110diff --git a/tests/expected/findmnt/outputs-kernel b/tests/expected/findmnt/outputs-kernel
111index 59495797bd..01599355ec 100644
112--- a/tests/expected/findmnt/outputs-kernel
113+++ b/tests/expected/findmnt/outputs-kernel
114@@ -30,6 +30,5 @@ TARGET SOURCE FSTYPE OPTIO
115 |-/home/kzak /dev/mapper/kzak-home ext4 rw,noatime,barrier=1,data=ordered
116 | `-/home/kzak/.gvfs gvfs-fuse-daemon fuse.gvfs-fuse-daemon rw,nosuid,nodev,relatime,user_id=500,group_id=500
117 |-/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime
118-|-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
119-`-/mnt/foo /fooooo bar rw,relatime
120+`-/mnt/sounds //foo.home/bar/ cifs rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
121 rc=0
122diff --git a/tests/expected/libmount/tabdiff-mount b/tests/expected/libmount/tabdiff-mount
123index 420aeacd5e..3c18f8dc4f 100644
124--- a/tests/expected/libmount/tabdiff-mount
125+++ b/tests/expected/libmount/tabdiff-mount
126@@ -1,3 +1,2 @@
127 /dev/mapper/kzak-home on /home/kzak: MOUNTED
128-/fooooo on /mnt/foo: MOUNTED
129 tmpfs on /mnt/test/foo bar: MOUNTED
130diff --git a/tests/expected/libmount/tabdiff-move b/tests/expected/libmount/tabdiff-move
131index 24f9bc791b..95820d93ef 100644
132--- a/tests/expected/libmount/tabdiff-move
133+++ b/tests/expected/libmount/tabdiff-move
134@@ -1,3 +1,2 @@
135 //foo.home/bar/ on /mnt/music: MOVED to /mnt/music
136-/fooooo on /mnt/foo: UMOUNTED
137 tmpfs on /mnt/test/foo bar: UMOUNTED
138diff --git a/tests/expected/libmount/tabdiff-remount b/tests/expected/libmount/tabdiff-remount
139index 82ebeab390..876bfd9539 100644
140--- a/tests/expected/libmount/tabdiff-remount
141+++ b/tests/expected/libmount/tabdiff-remount
142@@ -1,4 +1,3 @@
143 /dev/mapper/kzak-home on /home/kzak: REMOUNTED from 'rw,noatime,barrier=1,data=ordered' to 'ro,noatime,barrier=1,data=ordered'
144 //foo.home/bar/ on /mnt/sounds: REMOUNTED from 'rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344' to 'ro,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344'
145-/fooooo on /mnt/foo: UMOUNTED
146 tmpfs on /mnt/test/foo bar: UMOUNTED
147diff --git a/tests/expected/libmount/tabdiff-umount b/tests/expected/libmount/tabdiff-umount
148index a3e0fe48a1..c7be725b92 100644
149--- a/tests/expected/libmount/tabdiff-umount
150+++ b/tests/expected/libmount/tabdiff-umount
151@@ -1,3 +1,2 @@
152 /dev/mapper/kzak-home on /home/kzak: UMOUNTED
153-/fooooo on /mnt/foo: UMOUNTED
154 tmpfs on /mnt/test/foo bar: UMOUNTED
155diff --git a/tests/expected/libmount/tabfiles-parse-mountinfo b/tests/expected/libmount/tabfiles-parse-mountinfo
156index 47eb770061..d5ba5248e4 100644
157--- a/tests/expected/libmount/tabfiles-parse-mountinfo
158+++ b/tests/expected/libmount/tabfiles-parse-mountinfo
159@@ -351,17 +351,6 @@ id: 47
160 parent: 20
161 devno: 0:38
162 ------ fs:
163-source: /fooooo
164-target: /mnt/foo
165-fstype: bar
166-optstr: rw,relatime
167-VFS-optstr: rw,relatime
168-FS-opstr: rw
169-root: /
170-id: 48
171-parent: 20
172-devno: 0:39
173------- fs:
174 source: tmpfs
175 target: /mnt/test/foo bar
176 fstype: tmpfs
177diff --git a/tests/expected/libmount/tabfiles-py-parse-mountinfo b/tests/expected/libmount/tabfiles-py-parse-mountinfo
178index 47eb770061..d5ba5248e4 100644
179--- a/tests/expected/libmount/tabfiles-py-parse-mountinfo
180+++ b/tests/expected/libmount/tabfiles-py-parse-mountinfo
181@@ -351,17 +351,6 @@ id: 47
182 parent: 20
183 devno: 0:38
184 ------ fs:
185-source: /fooooo
186-target: /mnt/foo
187-fstype: bar
188-optstr: rw,relatime
189-VFS-optstr: rw,relatime
190-FS-opstr: rw
191-root: /
192-id: 48
193-parent: 20
194-devno: 0:39
195------- fs:
196 source: tmpfs
197 target: /mnt/test/foo bar
198 fstype: tmpfs
199diff --git a/tests/ts/findmnt/files/mountinfo b/tests/ts/findmnt/files/mountinfo
200index 475ea1a337..ff1e664a84 100644
201--- a/tests/ts/findmnt/files/mountinfo
202+++ b/tests/ts/findmnt/files/mountinfo
203@@ -30,4 +30,3 @@
204 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
205 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
206 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
207-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw
208diff --git a/tests/ts/findmnt/files/mountinfo-nonroot b/tests/ts/findmnt/files/mountinfo-nonroot
209index e15b467016..87b421d2ef 100644
210--- a/tests/ts/findmnt/files/mountinfo-nonroot
211+++ b/tests/ts/findmnt/files/mountinfo-nonroot
212@@ -29,4 +29,3 @@
213 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
214 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
215 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
216-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw
217diff --git a/tests/ts/libmount/files/mountinfo b/tests/ts/libmount/files/mountinfo
218index c063071833..2b01740481 100644
219--- a/tests/ts/libmount/files/mountinfo
220+++ b/tests/ts/libmount/files/mountinfo
221@@ -30,5 +30,4 @@
222 44 41 0:36 / /home/kzak/.gvfs rw,nosuid,nodev,relatime - fuse.gvfs-fuse-daemon gvfs-fuse-daemon rw,user_id=500,group_id=500
223 45 20 0:37 / /var/lib/nfs/rpc_pipefs rw,relatime - rpc_pipefs sunrpc rw
224 47 20 0:38 / /mnt/sounds rw,relatime - cifs //foo.home/bar/ rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344
225-48 20 0:39 / /mnt/foo\040(deleted) rw,relatime - bar /fooooo rw
226 49 20 0:56 / /mnt/test/foo bar rw,relatime shared:323 - tmpfs tmpfs rw