Browse code

rpm: Updated to 4.13.0.2

Updated to 4.13.0.2 and Fix CVE CVE-2017-7500 and CVE-2017-7501

Pls refer : http://rpm.org/wiki/Releases/4.13.0.2

Change-Id: I854e54a04a84ec06af26d7ab358367c6de60991b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6100
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

Tapas Kundu authored on 2018/11/05 23:50:04
Showing 2 changed files
1 1
deleted file mode 100644
... ...
@@ -1,96 +0,0 @@
1
-From 404ef011c300207cdb1e531670384564aae04bdc Mon Sep 17 00:00:00 2001
2
-From: Panu Matilainen <pmatilai@redhat.com>
3
-Date: Tue, 19 Sep 2017 14:46:36 +0300
4
-Subject: [PATCH] Don't follow symlinks on file creation (CVE-2017-7501)
5
-
6
-Open newly created files with O_EXCL to prevent symlink tricks.
7
-When reopening hardlinks for writing the actual content, use append
8
-mode instead. This is compatible with the write-only permissions but
9
-is not destructive in case we got redirected to somebody elses file,
10
-verify the target before actually writing anything.
11
-
12
-As these are files with the temporary suffix, errors mean a local
13
-user with sufficient privileges to break the installation of the package
14
-anyway is trying to goof us on purpose, don't bother trying to mend it
15
-(we couldn't fix the hardlink case anyhow) but just bail out.
16
-
17
-Based on a patch by Florian Festi.
18
- lib/fsm.c | 29 +++++++++++++++++++++++------
19
- 1 file changed, 23 insertions(+), 6 deletions(-)
20
-
21
-diff --git a/lib/fsm.c b/lib/fsm.c
22
-index 553774b30..e0e9d03a1 100644
23
-+++ b/lib/fsm.c
24
-@@ -206,11 +206,22 @@ static int fsmSetFCaps(const char *path, const char *captxt)
25
-     return rc;
26
- }
27
- 
28
-+/* Check dest is the same, empty and regular file with writeonly permissions */
29
-+static int linkSane(FD_t wfd, const char *dest)
30
-+{
31
-+    struct stat sb, lsb;
32
-+
33
-+    return (fstat(Fileno(wfd), &sb) == 0 && sb.st_size == 0 &&
34
-+	    (sb.st_mode & ~S_IFMT) == S_IWUSR &&
35
-+	    lstat(dest, &lsb) == 0 && S_ISREG(lsb.st_mode) &&
36
-+	    sb.st_dev == lsb.st_dev && sb.st_ino == lsb.st_ino);
37
-+}
38
-+
39
- /** \ingroup payload
40
-  * Create file from payload stream.
41
-  * @return		0 on success
42
-  */
43
--static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int nodigest, int nocontent)
44
-+static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int exclusive, int nodigest, int nocontent)
45
- {
46
-     FD_t wfd = NULL;
47
-     int rc = 0;
48
-@@ -218,8 +229,14 @@ static int expandRegular(rpmfi fi, const char *dest, rpmpsm psm, int nodigest, i
49
-     /* Create the file with 0200 permissions (write by owner). */
50
-     {
51
- 	mode_t old_umask = umask(0577);
52
--	wfd = Fopen(dest, "w.ufdio");
53
-+	wfd = Fopen(dest, exclusive ? "wx.ufdio" : "a.ufdio");
54
- 	umask(old_umask);
55
-+
56
-+	/* If reopening, make sure the file is what we expect */
57
-+	if (!exclusive && wfd != NULL && !linkSane(wfd, dest)) {
58
-+	    rc = RPMERR_OPEN_FAILED;
59
-+	    goto exit;
60
-+	}
61
-     }
62
-     if (Ferror(wfd)) {
63
- 	rc = RPMERR_OPEN_FAILED;
64
-@@ -248,7 +265,7 @@ static int fsmMkfile(rpmfi fi, const char *dest, rpmfiles files,
65
- 	/* Create first hardlinked file empty */
66
- 	if (*firsthardlink < 0) {
67
- 	    *firsthardlink = rpmfiFX(fi);
68
--	    rc = expandRegular(fi, dest, psm, nodigest, 1);
69
-+	    rc = expandRegular(fi, dest, psm, 1, nodigest, 1);
70
- 	} else {
71
- 	    /* Create hard links for others */
72
- 	    char *fn = rpmfilesFN(files, *firsthardlink);
73
-@@ -263,10 +280,10 @@ static int fsmMkfile(rpmfi fi, const char *dest, rpmfiles files,
74
-        existing) file with content */
75
-     if (numHardlinks<=1) {
76
- 	if (!rc)
77
--	    rc = expandRegular(fi, dest, psm, nodigest, 0);
78
-+	    rc = expandRegular(fi, dest, psm, 1, nodigest, 0);
79
-     } else if (rpmfiArchiveHasContent(fi)) {
80
- 	if (!rc)
81
--	    rc = expandRegular(fi, dest, psm, nodigest, 0);
82
-+	    rc = expandRegular(fi, dest, psm, 0, nodigest, 0);
83
- 	*firsthardlink = -1;
84
-     } else {
85
- 	*setmeta = 0;
86
-@@ -939,7 +956,7 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
87
- 	    /* we skip the hard linked file containing the content */
88
- 	    /* write the content to the first used instead */
89
- 	    char *fn = rpmfilesFN(files, firsthardlink);
90
--	    rc = expandRegular(fi, fn, psm, nodigest, 0);
91
-+	    rc = expandRegular(fi, fn, psm, 0, nodigest, 0);
92
- 	    firsthardlink = -1;
93
- 	    free(fn);
94
- 	}
... ...
@@ -3,22 +3,21 @@
3 3
 
4 4
 Summary:        Package manager
5 5
 Name:           rpm
6
-Version:        4.13.0.1
7
-Release:        4%{?dist}
6
+Version:        4.13.0.2
7
+Release:        1%{?dist}
8 8
 License:        GPLv2+
9 9
 URL:            http://rpm.org
10 10
 Group:          Applications/System
11 11
 Vendor:         VMware, Inc.
12 12
 Distribution:   Photon
13
-Source0:        https://github.com/rpm-software-management/rpm/archive/%{name}-%{version}-release.tar.gz
14
-%define sha1    rpm=2119489397d7e4da19320ef9330ab717ac05587d
13
+Source0:        http://ftp.rpm.org/releases/rpm-4.13.x/%{name}-%{version}.tar.bz2
14
+%define sha1    rpm=9d6da0750184d8d077b4c28bb0ce171aef4da70b
15 15
 Source1:        http://download.oracle.com/berkeley-db/db-5.3.28.tar.gz
16 16
 %define sha1    db=fa3f8a41ad5101f43d08bc0efb6241c9b6fc1ae9
17 17
 Source2:        rpm-system-configuring-scripts-2.2.tar.gz
18 18
 %define sha1 rpm-system-configuring-scripts=9461cdc0b65f7ecc244bfa09886b4123e55ab5a8
19 19
 Patch1:         find-debuginfo-do-not-generate-non-existing-build-id.patch
20 20
 Patch2:         find-debuginfo-do-not-generate-dir-entries.patch
21
-Patch3:         rpm-CVE-2017-7501.patch
22 21
 #Requires:      nspr
23 22
 Requires:       nss 
24 23
 Requires:       popt
... ...
@@ -73,13 +72,12 @@ Requires:       python3
73 73
 Python3 rpm.
74 74
 
75 75
 %prep
76
-%setup -n rpm-%{name}-%{version}-release
77
-%setup -n rpm-%{name}-%{version}-release -T -D -a 1
78
-%setup -n rpm-%{name}-%{version}-release -T -D -a 2
76
+%setup -n %{name}-%{version}
77
+%setup -n %{name}-%{version} -T -D -a 1
78
+%setup -n %{name}-%{version} -T -D -a 2
79 79
 mv db-5.3.28 db
80 80
 %patch1 -p1
81 81
 %patch2 -p1
82
-%patch3 -p1
83 82
 
84 83
 %build
85 84
 sed -i '/define _GNU_SOURCE/a #include "../config.h"' tools/sepdebugcrcfix.c
... ...
@@ -240,6 +238,9 @@ rm -rf %{buildroot}
240 240
 %{python3_sitelib}/*
241 241
 
242 242
 %changelog
243
+*   Sat Nov 03 2018 Tapas Kundu <tkundu@vmware.com> 4.13.0.2-1
244
+-   Updated to 4.13.0.2
245
+-   Fix CVE-2017-7501 and CVE-2017-7500
243 246
 *   Thu Dec 21 2017 Xiaolin Li <xiaolinl@vmware.com> 4.13.0.1-4
244 247
 -   Fix CVE-2017-7501
245 248
 *    Mon Dec 04 2017 Kumar Kaushik <kaushikk@vmware.com> 4.13.0.1-3