diff options
| -rw-r--r-- | meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb | 59 | ||||
| -rw-r--r-- | meta/recipes-devtools/cve-check-tool/files/check-for-malloc_trim-before-using-it.patch | 51 |
2 files changed, 110 insertions, 0 deletions
diff --git a/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb new file mode 100644 index 0000000000..116555962c --- /dev/null +++ b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | SUMMARY = "cve-check-tool" | ||
| 2 | DESCRIPTION = "cve-check-tool is a tool for checking known (public) CVEs.\ | ||
| 3 | The tool will identify potentially vunlnerable software packages within Linux distributions through version matching." | ||
| 4 | HOMEPAGE = "https://github.com/ikeydoherty/cve-check-tool" | ||
| 5 | SECTION = "Development/Tools" | ||
| 6 | LICENSE = "GPL-2.0+" | ||
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e8c1458438ead3c34974bc0be3a03ed6" | ||
| 8 | |||
| 9 | SRC_URI = "https://github.com/ikeydoherty/${BPN}/releases/download/v${PV}/${BP}.tar.xz \ | ||
| 10 | file://check-for-malloc_trim-before-using-it.patch \ | ||
| 11 | " | ||
| 12 | |||
| 13 | SRC_URI[md5sum] = "c5f4247140fc9be3bf41491d31a34155" | ||
| 14 | SRC_URI[sha256sum] = "b8f283be718af8d31232ac1bfc10a0378fb958aaaa49af39168f8acf501e6a5b" | ||
| 15 | |||
| 16 | DEPENDS = "libcheck glib-2.0 json-glib curl libxml2 sqlite3 openssl ca-certificates" | ||
| 17 | |||
| 18 | RDEPENDS_${PN} = "ca-certificates" | ||
| 19 | |||
| 20 | inherit pkgconfig autotools | ||
| 21 | |||
| 22 | EXTRA_OECONF = "--disable-coverage" | ||
| 23 | CFLAGS_append = " -Wno-error=pedantic" | ||
| 24 | |||
| 25 | python do_populate_cve_db () { | ||
| 26 | import subprocess | ||
| 27 | import time | ||
| 28 | |||
| 29 | if d.getVar("BB_NO_NETWORK", True) == "1": | ||
| 30 | bb.error("BB_NO_NETWORK is set; Can't update cve-check-tool database, " | ||
| 31 | "CVEs won't be checked") | ||
| 32 | return | ||
| 33 | |||
| 34 | bb.utils.export_proxies(d) | ||
| 35 | # In case we don't inherit cve-check class, use default values defined in the class. | ||
| 36 | cve_dir = d.getVar("CVE_CHECK_DB_DIR", True) or d.expand("${DL_DIR}/CVE_CHECK") | ||
| 37 | cve_file = d.getVar("CVE_CHECK_TMP_FILE", True) or d.expand("${TMPDIR}/cve_check") | ||
| 38 | cve_cmd = "cve-check-update" | ||
| 39 | cmd = [cve_cmd, "-d", cve_dir] | ||
| 40 | bb.debug(1, "Updating cve-check-tool database located in %s" % cve_dir) | ||
| 41 | try: | ||
| 42 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) | ||
| 43 | bb.debug(2, "Command '%s' returned:\n%s" % ("\n".join(cmd), output)) | ||
| 44 | time_utc = time.gmtime(time.time()) | ||
| 45 | time_format = "%Y-%m-%d %H:%M:%S" | ||
| 46 | with open(cve_file, "w") as f: | ||
| 47 | f.write("CVE database was updated on %s UTC\n\n" | ||
| 48 | % time.strftime(time_format, time_utc)) | ||
| 49 | |||
| 50 | except subprocess.CalledProcessError as e: | ||
| 51 | bb.warn("Error in executing cve-check-update: %s (output %s)" % (e, e.output)) | ||
| 52 | if bb.data.inherits_class('cve-check', d): | ||
| 53 | bb.warn("Failed to update cve-check-tool database, CVEs won't be checked") | ||
| 54 | } | ||
| 55 | |||
| 56 | addtask populate_cve_db after do_populate_sysroot | ||
| 57 | do_populate_cve_db[nostamp] = "1" | ||
| 58 | |||
| 59 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta/recipes-devtools/cve-check-tool/files/check-for-malloc_trim-before-using-it.patch b/meta/recipes-devtools/cve-check-tool/files/check-for-malloc_trim-before-using-it.patch new file mode 100644 index 0000000000..0774ad946a --- /dev/null +++ b/meta/recipes-devtools/cve-check-tool/files/check-for-malloc_trim-before-using-it.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From ce64633b9733e962b8d8482244301f614d8b5845 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 22 Aug 2016 22:54:24 -0700 | ||
| 4 | Subject: [PATCH] Check for malloc_trim before using it | ||
| 5 | |||
| 6 | malloc_trim is gnu specific and not all libc | ||
| 7 | implement it, threfore write a configure check | ||
| 8 | to poke for it first and use the define to | ||
| 9 | guard its use. | ||
| 10 | |||
| 11 | Helps in compiling on musl based systems | ||
| 12 | |||
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 14 | --- | ||
| 15 | Upstream-Status: Submitted [https://github.com/ikeydoherty/cve-check-tool/pull/48] | ||
| 16 | configure.ac | 2 ++ | ||
| 17 | src/core.c | 4 ++-- | ||
| 18 | 2 files changed, 4 insertions(+), 2 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/configure.ac b/configure.ac | ||
| 21 | index d3b66ce..79c3542 100644 | ||
| 22 | --- a/configure.ac | ||
| 23 | +++ b/configure.ac | ||
| 24 | @@ -19,6 +19,8 @@ m4_define([json_required_version], [0.16.0]) | ||
| 25 | m4_define([openssl_required_version],[1.0.0]) | ||
| 26 | # TODO: Set minimum sqlite | ||
| 27 | |||
| 28 | +AC_CHECK_FUNCS_ONCE(malloc_trim) | ||
| 29 | + | ||
| 30 | PKG_CHECK_MODULES(CVE_CHECK_TOOL, | ||
| 31 | [ | ||
| 32 | glib-2.0 >= glib_required_version, | ||
| 33 | diff --git a/src/core.c b/src/core.c | ||
| 34 | index 6263031..0d5df29 100644 | ||
| 35 | --- a/src/core.c | ||
| 36 | +++ b/src/core.c | ||
| 37 | @@ -498,9 +498,9 @@ bool cve_db_load(CveDB *self, const char *fname) | ||
| 38 | } | ||
| 39 | |||
| 40 | b = true; | ||
| 41 | - | ||
| 42 | +#ifdef HAVE_MALLOC_TRIM | ||
| 43 | malloc_trim(0); | ||
| 44 | - | ||
| 45 | +#endif | ||
| 46 | xmlFreeTextReader(r); | ||
| 47 | if (fd) { | ||
| 48 | close(fd); | ||
| 49 | -- | ||
| 50 | 2.9.3 | ||
| 51 | |||
