summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/cve-check-tool
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2016-08-24 18:58:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-16 15:24:02 +0100
commit189673244b571ad4b9fb121fbffded0e4568d31b (patch)
treea5e46b5a2e5c38e697740bac91b6728aa78921ef /meta/recipes-devtools/cve-check-tool
parent08dc55ce846ee198e69e36dd8b49d26610279c86 (diff)
downloadpoky-189673244b571ad4b9fb121fbffded0e4568d31b.tar.gz
cve-check-tool: Add recipe
cve-check-tool is a program for public CVEs checking. This tool also seek to determine if a vulnerability has been addressed by a patch. The recipe also includes the do_populate_cve_db task that will populate the database used by the tool. [YOCTO #7515] (From OE-Core rev: 5deadfe634638b99420342950bc544547f7121dc) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/cve-check-tool')
-rw-r--r--meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb59
-rw-r--r--meta/recipes-devtools/cve-check-tool/files/check-for-malloc_trim-before-using-it.patch51
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 @@
1SUMMARY = "cve-check-tool"
2DESCRIPTION = "cve-check-tool is a tool for checking known (public) CVEs.\
3The tool will identify potentially vunlnerable software packages within Linux distributions through version matching."
4HOMEPAGE = "https://github.com/ikeydoherty/cve-check-tool"
5SECTION = "Development/Tools"
6LICENSE = "GPL-2.0+"
7LIC_FILES_CHKSUM = "file://LICENSE;md5=e8c1458438ead3c34974bc0be3a03ed6"
8
9SRC_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
13SRC_URI[md5sum] = "c5f4247140fc9be3bf41491d31a34155"
14SRC_URI[sha256sum] = "b8f283be718af8d31232ac1bfc10a0378fb958aaaa49af39168f8acf501e6a5b"
15
16DEPENDS = "libcheck glib-2.0 json-glib curl libxml2 sqlite3 openssl ca-certificates"
17
18RDEPENDS_${PN} = "ca-certificates"
19
20inherit pkgconfig autotools
21
22EXTRA_OECONF = "--disable-coverage"
23CFLAGS_append = " -Wno-error=pedantic"
24
25python 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
56addtask populate_cve_db after do_populate_sysroot
57do_populate_cve_db[nostamp] = "1"
58
59BBCLASSEXTEND = "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 @@
1From ce64633b9733e962b8d8482244301f614d8b5845 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 22 Aug 2016 22:54:24 -0700
4Subject: [PATCH] Check for malloc_trim before using it
5
6malloc_trim is gnu specific and not all libc
7implement it, threfore write a configure check
8to poke for it first and use the define to
9guard its use.
10
11Helps in compiling on musl based systems
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15Upstream-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
20diff --git a/configure.ac b/configure.ac
21index 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,
33diff --git a/src/core.c b/src/core.c
34index 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--
502.9.3
51