Skip to contentSkip to conversation

qemu: fix CVE-2020-14364

PATCH New Ross Burton 1 participant 4 messages Sep 10, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 qemu: fix CVE-2020-14364

Backport a patch from upstream to fix CVE-2020-14364.

---
 meta/recipes-devtools/qemu/qemu.inc           |  7 +-
 .../qemu/qemu/usb-fix-setup_len-init.patch    | 89 +++++++++++++++++++
 2 files changed, 93 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-devtools/qemu/qemu/usb-fix-setup_len-init.patch
meta/recipes-devtools/qemu/qemu.inc +4 -3
index 5599382a92..9091115caf 100644
@@ -28,9 +28,10 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
            file://0009-Fix-webkitgtk-builds.patch \
            file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
            file://0001-Add-enable-disable-udev.patch \
-	   file://0001-qemu-Do-not-include-file-if-not-exists.patch \
-	   file://find_datadir.patch \
-	   "
+           file://0001-qemu-Do-not-include-file-if-not-exists.patch \
+           file://find_datadir.patch \
+           file://usb-fix-setup_len-init.patch \
+           "
 UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
 
 SRC_URI[sha256sum] = "c9174eb5933d9eb5e61f541cd6d1184cd3118dfe4c5c4955bc1bdc4d390fa4e5"
meta/recipes-devtools/qemu/qemu/usb-fix-setup_len-init.patch new file +89 -0

89 lines not on this page · raw message

Signature · 1 line
2.28.0
#1 lore raw

PATCH 2/4 cve-update-db-native: remove unused import

This import isn't used anymore, so remove it.

---
 meta/recipes-core/meta/cve-update-db-native.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/meta/cve-update-db-native.bb +1 -1
index 328f6ab364..94367f9a94 100644
@@ -30,7 +30,7 @@ python do_populate_cve_db() {
     """
     import bb.utils
     import bb.progress
-    import sqlite3, urllib, urllib.parse, shutil, gzip
+    import sqlite3, urllib, urllib.parse, gzip
     from datetime import date
 
     bb.utils.export_proxies(d)
Signature · 1 line
2.28.0
#2 lore raw

PATCH 3/4 cve-update-db-native: add more logging when fetching

In reply to Ross Burton

Add some debug logging when fetching the CVE data.

---
 meta/recipes-core/meta/cve-update-db-native.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/meta/cve-update-db-native.bb +5 -1
index 94367f9a94..27b4c58d4e 100644
@@ -46,6 +46,7 @@ python do_populate_cve_db() {
     try:
         import time
         if time.time() - os.path.getmtime(db_file) < (60*60):
+            bb.debug(2, "Recently updated, skipping")
             return
     except OSError:
         pass
@@ -61,6 +62,7 @@ python do_populate_cve_db() {
     with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
         total_years = date.today().year + 1 - YEAR_START
         for i, year in enumerate(range(YEAR_START, date.today().year + 1)):
+            bb.debug(2, "Updating %d" % year)
             ph.update((float(i + 1) / total_years) * 100)
             year_url = BASE_URL + str(year)
             meta_url = year_url + ".meta"
@@ -88,6 +90,7 @@ python do_populate_cve_db() {
             c.execute("select DATE from META where YEAR = ?", (year,))
             meta = c.fetchone()
             if not meta or meta[0] != last_modified:
+                bb.debug(2, "Updating entries")
                 # Clear products table entries corresponding to current year
                 c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,))
 
@@ -101,7 +104,8 @@ python do_populate_cve_db() {
                     cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
                     bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
                     return
-
+            else:
+                bb.debug(2, "Already up to date (last modified %s)" % last_modified)
             # Update success, set the date to cve_check file.
             if year == date.today().year:
                 cve_f.write('CVE database update : %s\n\n' % date.today())
Signature · 1 line
2.28.0
#3 lore raw

PATCH 4/4 cve-update-db-native: use fetch task

In reply to Ross Burton

Instead of inventing a new task to fetch the CVE data, use the existing fetch task.

---
 meta/classes/cve-check.bbclass                 | 2 +-
 meta/recipes-core/meta/cve-update-db-native.bb | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
meta/classes/cve-check.bbclass +1 -1
index 17f64a8a9c..02fef7c205 100644
@@ -97,7 +97,7 @@ python do_cve_check () {
 }
 
 addtask cve_check before do_build after do_fetch
-do_cve_check[depends] = "cve-update-db-native:do_populate_cve_db"
+do_cve_check[depends] = "cve-update-db-native:do_fetch"
 do_cve_check[nostamp] = "1"
 
 python cve_check_cleanup () {
meta/recipes-core/meta/cve-update-db-native.bb +5 -4
index 27b4c58d4e..e4e2451bfd 100644
@@ -24,7 +24,7 @@ python () {
             os.remove(cve_check_db_file)
 }
 
-python do_populate_cve_db() {
+python do_fetch() {
     """
     Update NVD database with json data feed
     """
@@ -114,7 +114,9 @@ python do_populate_cve_db() {
         conn.close()
 }
 
-do_populate_cve_db[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
+do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
+do_fetch[file-checksums] = ""
+do_fetch[vardeps] = ""
 
 def initialize_db(c):
     c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
@@ -206,7 +208,6 @@ def update_db(c, jsondata):
             parse_node_and_insert(c, config, cveId)
 
 
-addtask do_populate_cve_db before do_fetch
-do_populate_cve_db[nostamp] = "1"
+do_fetch[nostamp] = "1"
 
 EXCLUDE_FROM_WORLD = "1"
Signature · 1 line
2.28.0