Browse code

tdnf: fix crash when photon-iso repo only enabled with cdrom disabled.

Change-Id: I1c3b8006ee2688c05d4796c66940e1817b8579d2
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5883
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Keerthana K authored on 2018/10/09 04:33:30
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
0
+From c0f2278a681f8d27c88a9e5b16d92f5433133a74 Mon Sep 17 00:00:00 2001
1
+From: Keerthana K <keerthanak@vmware.com>
2
+Date: Mon, 08 Oct 2018 11:35:11 +0000
3
+Subject: [PATCH] Bug 2210743: fix crash when no repos enabled.
4
+
5
+SIGSEGV is observed when photon-iso repo is only enabled
6
+and cdrom is not mounted. This is due to a NULL pointer
7
+dereference in libsolv library which is called from tdnf code.
8
+When photon-iso is enabled with other repos disabled and cdrom
9
+unmounted, tdnf init code disables the photon-iso repo due to
10
+which some of the Pool objects for repo are not initialized.
11
+
12
+Change-Id: Iee09bcbf8a3aa2a785ccf174c267e3f556d23d2d
13
+---
14
+
15
+diff --git a/solv/tdnfquery.c b/solv/tdnfquery.c
16
+index 8aeaed1..5e1f8d8 100644
17
+--- a/solv/tdnfquery.c
18
+@@ -426,6 +426,11 @@
19
+             nRetFlags = 0;
20
+ 
21
+             queue_empty(&queueJob);
22
++            if (!pPool || !pPool->solvables || !pPool->whatprovides)
23
++            {
24
++                dwError = ERROR_TDNF_INVALID_PARAMETER;
25
++                BAIL_ON_TDNF_LIBSOLV_ERROR(dwError);
26
++            }
27
+ 
28
+             nRetFlags = selection_make(
29
+                          pPool,
... ...
@@ -4,11 +4,11 @@
4 4
 Summary:        dnf/yum equivalent using C libs
5 5
 Name:           tdnf
6 6
 Version:        2.0.0
7
-Release:        1%{?dist}
7
+Release:        2%{?dist}
8 8
 Vendor:         VMware, Inc.
9 9
 Distribution:   Photon
10 10
 License:        LGPLv2.1,GPLv2
11
-Url:            http://www.vmware.com
11
+URL:            http://www.vmware.com
12 12
 Group:          Applications/RPM
13 13
 Requires:       rpm-libs
14 14
 Requires:       curl
... ...
@@ -28,6 +28,7 @@ Source2:        cache-updateinfo.service
28 28
 Source3:        cache-updateinfo.timer
29 29
 Source4:        updateinfo.sh
30 30
 Patch0:         tdnf-epoch-and-perm.patch
31
+Patch1:         tdnf-crash.patch
31 32
 
32 33
 %description
33 34
 tdnf is a yum/dnf equivalent which uses libsolv and libcurl
... ...
@@ -51,14 +52,11 @@ Library providing cli libs for tdnf like clients.
51 51
 %prep
52 52
 %setup -qn %{name}-%{version}-alpha.1
53 53
 %patch0 -p1
54
+%patch1 -p1
54 55
 
55 56
 %build
56 57
 autoreconf -i
57
-./configure \
58
-    --prefix=%{_prefix} \
59
-    --bindir=%{_bindir} \
60
-    --libdir=%{_libdir} \
61
-    --sysconfdir=/etc   \
58
+%configure \
62 59
     --disable-static
63 60
 make %{?_smp_mflags}
64 61
 
... ...
@@ -152,6 +150,8 @@ systemctl try-restart tdnf-cache-updateinfo.timer >/dev/null 2>&1 || :
152 152
     %{_libdir}/libtdnfcli.so.*
153 153
 
154 154
 %changelog
155
+*   Mon Oct 08 2018 Keerthana K <keerthanak@vmware.com> 2.0.0-2
156
+-   Fix bug on tdnf crash when photon-iso repo only enabled without mounting cdrom.
155 157
 *   Fri Feb 09 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.0.0-1
156 158
 -   update to 2.0.0
157 159
 *   Tue Jan 30 2018 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.2.2-3