mirror of
https://git.yoctoproject.org/poky
synced 2026-02-15 21:23:04 +01:00
Compare commits
54 Commits
yocto-2.6.
...
thud-20.0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51f6145f8f | ||
|
|
2c5af52109 | ||
|
|
47925dc5f9 | ||
|
|
795af97c45 | ||
|
|
ebf1cc65a9 | ||
|
|
507434199d | ||
|
|
ab318acf53 | ||
|
|
dba05668f7 | ||
|
|
7e20a2238c | ||
|
|
01d107f5c1 | ||
|
|
9257748714 | ||
|
|
c272ecd65b | ||
|
|
8e23315bda | ||
|
|
d31a23609c | ||
|
|
0077503ed8 | ||
|
|
f3a4b20850 | ||
|
|
93cde08301 | ||
|
|
6d5867a94c | ||
|
|
bda26ff31c | ||
|
|
cc0605bad6 | ||
|
|
b15ffd14ac | ||
|
|
2d699f84a3 | ||
|
|
7d0a5058e6 | ||
|
|
70f57755d7 | ||
|
|
87d0be72e7 | ||
|
|
d8b63d9ad6 | ||
|
|
65ba01d602 | ||
|
|
6fc3dc1af5 | ||
|
|
d59f2b0a74 | ||
|
|
94ac57739c | ||
|
|
26ab554fd5 | ||
|
|
90e5385568 | ||
|
|
45cebeda6e | ||
|
|
36fa7fce02 | ||
|
|
458009f31a | ||
|
|
5f125a31e1 | ||
|
|
6518c248e6 | ||
|
|
6eaf69d732 | ||
|
|
3d3a165925 | ||
|
|
176dc6eb01 | ||
|
|
d39b67e491 | ||
|
|
09d46e9131 | ||
|
|
0f7e6681a8 | ||
|
|
4e6a44598f | ||
|
|
9da2eb4bef | ||
|
|
fe27c50545 | ||
|
|
1b62838428 | ||
|
|
20ee17a579 | ||
|
|
d581f111db | ||
|
|
fa4683a484 | ||
|
|
e694933647 | ||
|
|
55e9d7c1e4 | ||
|
|
dab13e1c79 | ||
|
|
3103c383b3 |
@@ -26,6 +26,7 @@ import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import hashlib
|
||||
from functools import wraps
|
||||
import bb
|
||||
from bb import data
|
||||
@@ -279,6 +280,7 @@ class CookerDataBuilder(object):
|
||||
self.mcdata = {}
|
||||
|
||||
def parseBaseConfiguration(self):
|
||||
data_hash = hashlib.sha256()
|
||||
try:
|
||||
bb.parse.init_parser(self.basedata)
|
||||
self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles)
|
||||
@@ -302,7 +304,7 @@ class CookerDataBuilder(object):
|
||||
bb.event.fire(bb.event.ConfigParsed(), self.data)
|
||||
|
||||
bb.parse.init_parser(self.data)
|
||||
self.data_hash = self.data.get_hash()
|
||||
data_hash.update(self.data.get_hash().encode('utf-8'))
|
||||
self.mcdata[''] = self.data
|
||||
|
||||
multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split()
|
||||
@@ -310,9 +312,11 @@ class CookerDataBuilder(object):
|
||||
mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config)
|
||||
bb.event.fire(bb.event.ConfigParsed(), mcdata)
|
||||
self.mcdata[config] = mcdata
|
||||
data_hash.update(mcdata.get_hash().encode('utf-8'))
|
||||
if multiconfig:
|
||||
bb.event.fire(bb.event.MultiConfigParsed(self.mcdata), self.data)
|
||||
|
||||
self.data_hash = data_hash.hexdigest()
|
||||
except (SyntaxError, bb.BBHandledException):
|
||||
raise bb.BBHandledException
|
||||
except bb.data_smart.ExpansionError as e:
|
||||
|
||||
@@ -966,7 +966,8 @@ def rename_bad_checksum(ud, suffix):
|
||||
|
||||
new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
|
||||
bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
|
||||
bb.utils.movefile(ud.localpath, new_localpath)
|
||||
if not bb.utils.movefile(ud.localpath, new_localpath):
|
||||
bb.warn("Renaming %s to %s failed, grep movefile in log.do_fetch to see why" % (ud.localpath, new_localpath))
|
||||
|
||||
|
||||
def try_mirror_url(fetch, origud, ud, ld, check = False):
|
||||
|
||||
@@ -1128,8 +1128,8 @@ class FetchLatestVersionTest(FetcherTest):
|
||||
# packages with valid UPSTREAM_CHECK_URI and UPSTREAM_CHECK_REGEX
|
||||
("cups", "http://www.cups.org/software/1.7.2/cups-1.7.2-source.tar.bz2", "https://github.com/apple/cups/releases", "(?P<name>cups\-)(?P<pver>((\d+[\.\-_]*)+))\-source\.tar\.gz")
|
||||
: "2.0.0",
|
||||
("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html", "http://download.oracle.com/otn/berkeley-db/(?P<name>db-)(?P<pver>((\d+[\.\-_]*)+))\.tar\.gz")
|
||||
: "6.1.19",
|
||||
("db", "http://download.oracle.com/berkeley-db/db-5.3.21.tar.gz", "http://ftp.debian.org/debian/pool/main/d/db5.3/", "(?P<name>db5\.3_)(?P<pver>\d+(\.\d+)+).+\.orig\.tar\.xz")
|
||||
: "5.3.10",
|
||||
}
|
||||
|
||||
@skipIfNoNetwork()
|
||||
|
||||
@@ -796,7 +796,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
|
||||
os.rename(src, destpath)
|
||||
renamefailed = 0
|
||||
except Exception as e:
|
||||
if e[0] != errno.EXDEV:
|
||||
if e.errno != errno.EXDEV:
|
||||
# Some random error.
|
||||
print("movefile: Failed to move", src, "to", dest, e)
|
||||
return None
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>2.6.3</revnumber>
|
||||
<date>&REL_MONTH_YEAR;</date>
|
||||
<date>August 2019</date>
|
||||
<revremark>Released with the Yocto Project 2.6.3 Release.</revremark>
|
||||
</revision>
|
||||
</revhistory>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "2.6.3"
|
||||
DISTRO_VERSION = "2.6.4"
|
||||
DISTRO_CODENAME = "thud"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}"
|
||||
|
||||
@@ -451,7 +451,7 @@ do_shared_workdir () {
|
||||
cp .config $kerneldir/
|
||||
mkdir -p $kerneldir/include/config
|
||||
cp include/config/kernel.release $kerneldir/include/config/kernel.release
|
||||
if [ -e certs/signing_key.pem ]; then
|
||||
if [ -e certs/signing_key.x509 ]; then
|
||||
# The signing_key.* files are stored in the certs/ dir in
|
||||
# newer Linux kernels
|
||||
mkdir -p $kerneldir/certs
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
# to the distro running on the build machine.
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.29"
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.30"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.6/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "a37118fc8b423f48146120707b81dd15017512c3e8ef9e6ca2cb3a033f4f4046"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "3234fc3ded810225071f23a0e9a99f4f8c2480059945a848eff076ce78122ade"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "133387753a9acf3e1b788103c59fac91e968e2ee331d7a4b9498e926ada7be57"
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/2.7/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "e76a45886ee8a0b3904b761c17ac8ff91edf9811ee455f1832d10763ba794dfc"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "810d027dfb1c7675226afbcec07808770516c969ee7378f6d8240281083f8924"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "9498d8bba047499999a7310ac2576d0796461184965351a56f6d32c888a1f216"
|
||||
|
||||
@@ -4,7 +4,7 @@ require conf/machine/include/arm/arch-armv7ve.inc
|
||||
|
||||
TUNEVALID[aarch64] = "Enable instructions for aarch64"
|
||||
|
||||
MACHINEOVERRIDES .= "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', ':aarch64', '' ,d)}"
|
||||
MACHINEOVERRIDES =. "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', 'aarch64:', '' ,d)}"
|
||||
|
||||
# Little Endian base configs
|
||||
AVAILTUNES += "aarch64 aarch64_be"
|
||||
|
||||
@@ -127,7 +127,7 @@ class ChangeRecord:
|
||||
removed = list(set(aitems) - set(bitems))
|
||||
added = list(set(bitems) - set(aitems))
|
||||
|
||||
if not removed and not added:
|
||||
if not removed and not added and self.fieldname in ['RPROVIDES', 'RDEPENDS', 'RRECOMMENDS', 'RSUGGESTS', 'RREPLACES', 'RCONFLICTS']:
|
||||
depvera = bb.utils.explode_dep_versions2(self.oldvalue, sort=False)
|
||||
depverb = bb.utils.explode_dep_versions2(self.newvalue, sort=False)
|
||||
for i, j in zip(depvera.items(), depverb.items()):
|
||||
|
||||
@@ -1329,8 +1329,6 @@ class OpkgPM(OpkgDpkgPM):
|
||||
cmd = "%s %s" % (self.opkg_cmd, self.opkg_args)
|
||||
for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split():
|
||||
cmd += " --add-exclude %s" % exclude
|
||||
for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
|
||||
cmd += " --add-ignore-recommends %s" % bad_recommendation
|
||||
cmd += " install "
|
||||
cmd += " ".join(pkgs)
|
||||
|
||||
@@ -1399,6 +1397,45 @@ class OpkgPM(OpkgDpkgPM):
|
||||
def list_installed(self):
|
||||
return OpkgPkgsList(self.d, self.target_rootfs, self.config_file).list_pkgs()
|
||||
|
||||
def handle_bad_recommendations(self):
|
||||
bad_recommendations = self.d.getVar("BAD_RECOMMENDATIONS") or ""
|
||||
if bad_recommendations.strip() == "":
|
||||
return
|
||||
|
||||
status_file = os.path.join(self.opkg_dir, "status")
|
||||
|
||||
# If status file existed, it means the bad recommendations has already
|
||||
# been handled
|
||||
if os.path.exists(status_file):
|
||||
return
|
||||
|
||||
cmd = "%s %s info " % (self.opkg_cmd, self.opkg_args)
|
||||
|
||||
with open(status_file, "w+") as status:
|
||||
for pkg in bad_recommendations.split():
|
||||
pkg_info = cmd + pkg
|
||||
|
||||
try:
|
||||
output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.fatal("Cannot get package info. Command '%s' "
|
||||
"returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
|
||||
|
||||
if output == "":
|
||||
bb.note("Ignored bad recommendation: '%s' is "
|
||||
"not a package" % pkg)
|
||||
continue
|
||||
|
||||
for line in output.split('\n'):
|
||||
if line.startswith("Status:"):
|
||||
status.write("Status: deinstall hold not-installed\n")
|
||||
else:
|
||||
status.write(line + "\n")
|
||||
|
||||
# Append a blank line after each package entry to ensure that it
|
||||
# is separated from the following entry
|
||||
status.write("\n")
|
||||
|
||||
def dummy_install(self, pkgs):
|
||||
"""
|
||||
The following function dummy installs pkgs and returns the log of output.
|
||||
|
||||
@@ -879,6 +879,8 @@ class OpkgRootfs(DpkgOpkgRootfs):
|
||||
|
||||
self.pm.update()
|
||||
|
||||
self.pm.handle_bad_recommendations()
|
||||
|
||||
if self.progress_reporter:
|
||||
self.progress_reporter.next_stage()
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor):
|
||||
logdir = os.environ.get("BUILDDIR")
|
||||
if 'LOG_DIR' in bbvars:
|
||||
logdir = bbvars['LOG_DIR']
|
||||
bb.utils.mkdirhier(logdir)
|
||||
args.output_log = logdir + '/%s-results-%s.log' % (self.name, args.test_start_time)
|
||||
|
||||
super(OESelftestTestContextExecutor, self)._process_args(logger, args)
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
Upstream-Status: Backport [https://ftp.isc.org/isc/bind9/9.11.4-P1/patches/CVE-2018-5740]
|
||||
|
||||
CVE: CVE-2018-5740
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
|
||||
diff --git a/CHANGES b/CHANGES
|
||||
index 750b600..3d8d655 100644
|
||||
--- a/CHANGES
|
||||
+++ b/CHANGES
|
||||
@@ -1,3 +1,9 @@
|
||||
+ --- 9.11.4-P1 released ---
|
||||
+
|
||||
+4997. [security] named could crash during recursive processing
|
||||
+ of DNAME records when "deny-answer-aliases" was
|
||||
+ in use. (CVE-2018-5740) [GL #387]
|
||||
+
|
||||
--- 9.11.4 released ---
|
||||
|
||||
--- 9.11.4rc2 released ---
|
||||
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
|
||||
index 8f674a2..41d1385 100644
|
||||
--- a/lib/dns/resolver.c
|
||||
+++ b/lib/dns/resolver.c
|
||||
@@ -6318,6 +6318,7 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
|
||||
unsigned int nlabels;
|
||||
dns_fixedname_t fixed;
|
||||
dns_name_t prefix;
|
||||
+ int order;
|
||||
|
||||
REQUIRE(rdataset != NULL);
|
||||
REQUIRE(rdataset->type == dns_rdatatype_cname ||
|
||||
@@ -6340,17 +6341,25 @@ is_answertarget_allowed(fetchctx_t *fctx, dns_name_t *qname, dns_name_t *rname,
|
||||
tname = &cname.cname;
|
||||
break;
|
||||
case dns_rdatatype_dname:
|
||||
+ if (dns_name_fullcompare(qname, rname, &order, &nlabels) !=
|
||||
+ dns_namereln_subdomain)
|
||||
+ {
|
||||
+ return (ISC_TRUE);
|
||||
+ }
|
||||
result = dns_rdata_tostruct(&rdata, &dname, NULL);
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
dns_name_init(&prefix, NULL);
|
||||
tname = dns_fixedname_initname(&fixed);
|
||||
- nlabels = dns_name_countlabels(qname) -
|
||||
- dns_name_countlabels(rname);
|
||||
+ nlabels = dns_name_countlabels(rname);
|
||||
dns_name_split(qname, nlabels, &prefix, NULL);
|
||||
result = dns_name_concatenate(&prefix, &dname.dname, tname,
|
||||
NULL);
|
||||
- if (result == DNS_R_NAMETOOLONG)
|
||||
+ if (result == DNS_R_NAMETOOLONG) {
|
||||
+ if (chainingp != NULL) {
|
||||
+ *chainingp = ISC_TRUE;
|
||||
+ }
|
||||
return (ISC_TRUE);
|
||||
+ }
|
||||
RUNTIME_CHECK(result == ISC_R_SUCCESS);
|
||||
break;
|
||||
default:
|
||||
@@ -7071,7 +7080,9 @@ answer_response(fetchctx_t *fctx) {
|
||||
}
|
||||
if ((ardataset->type == dns_rdatatype_cname ||
|
||||
ardataset->type == dns_rdatatype_dname) &&
|
||||
- !is_answertarget_allowed(fctx, qname, aname, ardataset,
|
||||
+ type != ardataset->type &&
|
||||
+ type != dns_rdatatype_any &&
|
||||
+ !is_answertarget_allowed(fctx, qname, aname, ardataset,
|
||||
NULL))
|
||||
{
|
||||
return (DNS_R_SERVFAIL);
|
||||
@@ -3,7 +3,7 @@ HOMEPAGE = "http://www.isc.org/sw/bind/"
|
||||
SECTION = "console/network"
|
||||
|
||||
LICENSE = "ISC & BSD"
|
||||
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=6ba7c9fe0c888a943c79c93e6de744fb"
|
||||
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=8f17f64e47e83b60cd920a1e4b54419e"
|
||||
|
||||
DEPENDS = "openssl libcap zlib"
|
||||
|
||||
@@ -20,14 +20,14 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \
|
||||
file://0001-configure.in-remove-useless-L-use_openssl-lib.patch \
|
||||
file://0001-named-lwresd-V-and-start-log-hide-build-options.patch \
|
||||
file://0001-avoid-start-failure-with-bind-user.patch \
|
||||
file://CVE-2018-5740.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "9b4834d78f30cdb796ce437262272a36"
|
||||
SRC_URI[sha256sum] = "595070b031f869f8939656b5a5d11b121211967f15f6afeafa895df745279617"
|
||||
SRC_URI[md5sum] = "8ddab4b61fa4516fe404679c74e37960"
|
||||
SRC_URI[sha256sum] = "7e8c08192bcbaeb6e9f2391a70e67583b027b90e8c4bc1605da6eb126edde434"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://ftp.isc.org/isc/bind9/"
|
||||
UPSTREAM_CHECK_REGEX = "(?P<pver>9(\.\d+)+(-P\d+)*)/"
|
||||
RECIPE_NO_UPDATE_REASON = "9.11 is LTS 2021"
|
||||
|
||||
inherit autotools update-rc.d systemd useradd pkgconfig multilib_script
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
From 8194daabfd590f17825f0c61e9534bee5c99cc86 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Markwalder <tmark@isc.org>
|
||||
Date: Fri, 14 Sep 2018 13:41:41 -0400
|
||||
Subject: [master] Added includes of new BIND9 compatibility headers
|
||||
|
||||
Merges in rt48072.
|
||||
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Adrian Bunk <bunk@stusta.de>
|
||||
|
||||
diff --git a/includes/omapip/isclib.h b/includes/omapip/isclib.h
|
||||
index 75a87ff6..538b927f 100644
|
||||
--- a/includes/omapip/isclib.h
|
||||
+++ b/includes/omapip/isclib.h
|
||||
@@ -48,6 +48,9 @@
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
|
||||
+#include <isc/boolean.h>
|
||||
+#include <isc/int.h>
|
||||
+
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/lex.h>
|
||||
#include <isc/lib.h>
|
||||
diff --git a/includes/omapip/result.h b/includes/omapip/result.h
|
||||
index 91243e1b..860298f6 100644
|
||||
--- a/includes/omapip/result.h
|
||||
+++ b/includes/omapip/result.h
|
||||
@@ -26,6 +26,7 @@
|
||||
#ifndef DHCP_RESULT_H
|
||||
#define DHCP_RESULT_H 1
|
||||
|
||||
+#include <isc/boolean.h>
|
||||
#include <isc/lang.h>
|
||||
#include <isc/resultclass.h>
|
||||
#include <isc/types.h>
|
||||
diff --git a/server/dhcpv6.c b/server/dhcpv6.c
|
||||
index a7110f98..cde4f617 100644
|
||||
--- a/server/dhcpv6.c
|
||||
+++ b/server/dhcpv6.c
|
||||
@@ -1034,7 +1034,8 @@ void check_pool6_threshold(struct reply_state *reply,
|
||||
shared_name,
|
||||
inet_ntop(AF_INET6, &lease->addr,
|
||||
tmp_addr, sizeof(tmp_addr)),
|
||||
- used, count);
|
||||
+ (long long unsigned)(used),
|
||||
+ (long long unsigned)(count));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1066,7 +1067,8 @@ void check_pool6_threshold(struct reply_state *reply,
|
||||
"address: %s; high threshold %d%% %llu/%llu.",
|
||||
shared_name,
|
||||
inet_ntop(AF_INET6, &lease->addr, tmp_addr, sizeof(tmp_addr)),
|
||||
- poolhigh, used, count);
|
||||
+ poolhigh, (long long unsigned)(used),
|
||||
+ (long long unsigned)(count));
|
||||
|
||||
/* handle the low threshold now, if we don't
|
||||
* have one we default to 0. */
|
||||
@@ -1436,12 +1438,15 @@ pick_v6_address(struct reply_state *reply)
|
||||
log_debug("Unable to pick client address: "
|
||||
"no addresses available - shared network %s: "
|
||||
" 2^64-1 < total, %llu active, %llu abandoned",
|
||||
- shared_name, active - abandoned, abandoned);
|
||||
+ shared_name, (long long unsigned)(active - abandoned),
|
||||
+ (long long unsigned)(abandoned));
|
||||
} else {
|
||||
log_debug("Unable to pick client address: "
|
||||
"no addresses available - shared network %s: "
|
||||
"%llu total, %llu active, %llu abandoned",
|
||||
- shared_name, total, active - abandoned, abandoned);
|
||||
+ shared_name, (long long unsigned)(total),
|
||||
+ (long long unsigned)(active - abandoned),
|
||||
+ (long long unsigned)(abandoned));
|
||||
}
|
||||
|
||||
return ISC_R_NORESOURCES;
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
From 92875f5cc44914515e50c11c503a09cec90497b2 Mon Sep 17 00:00:00 2001
|
||||
From: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Date: Sat, 11 Jun 2016 22:51:44 -0400
|
||||
Subject: [PATCH 08/11] tweak to support external bind
|
||||
|
||||
Tweak the external bind to oe-core's sysroot rather than
|
||||
external bind source build.
|
||||
|
||||
Upstream-Status: Inappropriate <oe-core specific>
|
||||
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
client/Makefile.am | 2 +-
|
||||
client/tests/Makefile.am | 2 +-
|
||||
common/tests/Makefile.am | 2 +-
|
||||
dhcpctl/Makefile.am | 2 +-
|
||||
omapip/Makefile.am | 2 +-
|
||||
relay/Makefile.am | 2 +-
|
||||
server/Makefile.am | 2 +-
|
||||
server/tests/Makefile.am | 2 +-
|
||||
8 files changed, 8 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/client/Makefile.am b/client/Makefile.am
|
||||
index 4730bb3..84d8131 100644
|
||||
--- a/client/Makefile.am
|
||||
+++ b/client/Makefile.am
|
||||
@@ -4,7 +4,7 @@
|
||||
# production code. Sadly, we are not there yet.
|
||||
SUBDIRS = . tests
|
||||
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = -DCLIENT_PATH='"PATH=$(sbindir):/sbin:/bin:/usr/sbin:/usr/bin"' \
|
||||
-DLOCALSTATEDIR='"$(localstatedir)"' -I$(top_srcdir)/includes
|
||||
diff --git a/client/tests/Makefile.am b/client/tests/Makefile.am
|
||||
index 5031d0c..a8dfd26 100644
|
||||
--- a/client/tests/Makefile.am
|
||||
+++ b/client/tests/Makefile.am
|
||||
@@ -1,6 +1,6 @@
|
||||
SUBDIRS = .
|
||||
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes
|
||||
AM_CPPFLAGS += -I@BINDDIR@/include -I$(top_srcdir)
|
||||
diff --git a/common/tests/Makefile.am b/common/tests/Makefile.am
|
||||
index f6a43e4..2f98d22 100644
|
||||
--- a/common/tests/Makefile.am
|
||||
+++ b/common/tests/Makefile.am
|
||||
@@ -1,6 +1,6 @@
|
||||
SUBDIRS = .
|
||||
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = $(ATF_CFLAGS) -I$(top_srcdir)/includes
|
||||
|
||||
diff --git a/dhcpctl/Makefile.am b/dhcpctl/Makefile.am
|
||||
index ba8dd8b..9b2486e 100644
|
||||
--- a/dhcpctl/Makefile.am
|
||||
+++ b/dhcpctl/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/includes -I$(top_srcdir)
|
||||
|
||||
diff --git a/omapip/Makefile.am b/omapip/Makefile.am
|
||||
index dd1afa0..e4a8599 100644
|
||||
--- a/omapip/Makefile.am
|
||||
+++ b/omapip/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/includes
|
||||
|
||||
lib_LIBRARIES = libomapi.a
|
||||
diff --git a/relay/Makefile.am b/relay/Makefile.am
|
||||
index 6d652f6..b3bf578 100644
|
||||
--- a/relay/Makefile.am
|
||||
+++ b/relay/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = -DLOCALSTATEDIR='"@localstatedir@"' -I$(top_srcdir)/includes
|
||||
|
||||
diff --git a/server/Makefile.am b/server/Makefile.am
|
||||
index 3990b9c..b5d8c2d 100644
|
||||
--- a/server/Makefile.am
|
||||
+++ b/server/Makefile.am
|
||||
@@ -4,7 +4,7 @@
|
||||
# production code. Sadly, we are not there yet.
|
||||
SUBDIRS = . tests
|
||||
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir) -DLOCALSTATEDIR='"@localstatedir@"' -I$(top_srcdir)/includes
|
||||
|
||||
diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am
|
||||
index a87c5e7..9821081 100644
|
||||
--- a/server/tests/Makefile.am
|
||||
+++ b/server/tests/Makefile.am
|
||||
@@ -1,6 +1,6 @@
|
||||
SUBDIRS = .
|
||||
|
||||
-BINDLIBDIR = @BINDDIR@/lib
|
||||
+BINDLIBDIR = @BINDDIR@
|
||||
|
||||
AM_CPPFLAGS = $(ATF_CFLAGS) -DUNIT_TEST -I$(top_srcdir)/includes
|
||||
AM_CPPFLAGS += -I@BINDDIR@/include -I$(top_srcdir)
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
@@ -10,6 +10,7 @@ SRC_URI += "file://0001-define-macro-_PATH_DHCPD_CONF-and-_PATH_DHCLIENT_CON.pat
|
||||
file://0009-remove-dhclient-script-bash-dependency.patch \
|
||||
file://0012-dhcp-correct-the-intention-for-xml2-lib-search.patch \
|
||||
file://0013-fixup_use_libbind.patch \
|
||||
file://0001-master-Added-includes-of-new-BIND9-compatibility-hea.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "18c7f4dcbb0a63df25098216d47b1ede"
|
||||
|
||||
127
meta/recipes-core/dbus/dbus/CVE-2019-12749.patch
Normal file
127
meta/recipes-core/dbus/dbus/CVE-2019-12749.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
From f0120c5d97a4cc1b659e86d38f2b1f646ca20ea3 Mon Sep 17 00:00:00 2001
|
||||
From: Simon McVittie <smcv@collabora.com>
|
||||
Date: Thu, 30 May 2019 12:53:03 +0100
|
||||
Subject: [PATCH] auth: Reject DBUS_COOKIE_SHA1 for users other than the server
|
||||
owner
|
||||
|
||||
The DBUS_COOKIE_SHA1 authentication mechanism aims to prove ownership
|
||||
of a shared home directory by having the server write a secret "cookie"
|
||||
into a .dbus-keyrings subdirectory of the desired identity's home
|
||||
directory with 0700 permissions, and having the client prove that it can
|
||||
read the cookie. This never actually worked for non-malicious clients in
|
||||
the case where server uid != client uid (unless the server and client
|
||||
both have privileges, such as Linux CAP_DAC_OVERRIDE or traditional
|
||||
Unix uid 0) because an unprivileged server would fail to write out the
|
||||
cookie, and an unprivileged client would be unable to read the resulting
|
||||
file owned by the server.
|
||||
|
||||
Additionally, since dbus 1.7.10 we have checked that ~/.dbus-keyrings
|
||||
is owned by the uid of the server (a side-effect of a check added to
|
||||
harden our use of XDG_RUNTIME_DIR), further ruling out successful use
|
||||
by a non-malicious client with a uid differing from the server's.
|
||||
|
||||
Joe Vennix of Apple Information Security discovered that the
|
||||
implementation of DBUS_COOKIE_SHA1 was susceptible to a symbolic link
|
||||
attack: a malicious client with write access to its own home directory
|
||||
could manipulate a ~/.dbus-keyrings symlink to cause the DBusServer to
|
||||
read and write in unintended locations. In the worst case this could
|
||||
result in the DBusServer reusing a cookie that is known to the
|
||||
malicious client, and treating that cookie as evidence that a subsequent
|
||||
client connection came from an attacker-chosen uid, allowing
|
||||
authentication bypass.
|
||||
|
||||
This is mitigated by the fact that by default, the well-known system
|
||||
dbus-daemon (since 2003) and the well-known session dbus-daemon (in
|
||||
stable releases since dbus 1.10.0 in 2015) only accept the EXTERNAL
|
||||
authentication mechanism, and as a result will reject DBUS_COOKIE_SHA1
|
||||
at an early stage, before manipulating cookies. As a result, this
|
||||
vulnerability only applies to:
|
||||
|
||||
* system or session dbus-daemons with non-standard configuration
|
||||
* third-party dbus-daemon invocations such as at-spi2-core (although
|
||||
in practice at-spi2-core also only accepts EXTERNAL by default)
|
||||
* third-party uses of DBusServer such as the one in Upstart
|
||||
|
||||
Avoiding symlink attacks in a portable way is difficult, because APIs
|
||||
like openat() and Linux /proc/self/fd are not universally available.
|
||||
However, because DBUS_COOKIE_SHA1 already doesn't work in practice for
|
||||
a non-matching uid, we can solve this vulnerability in an easier way
|
||||
without regressions, by rejecting it early (before looking at
|
||||
~/.dbus-keyrings) whenever the requested identity doesn't match the
|
||||
identity of the process hosting the DBusServer.
|
||||
|
||||
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
||||
Closes: https://gitlab.freedesktop.org/dbus/dbus/issues/269
|
||||
Closes: CVE-2019-12749
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://gitlab.freedesktop.org/dbus/dbus/commit
|
||||
/47b1a4c41004bf494b87370987b222c934b19016]
|
||||
|
||||
CVE: CVE-2019-12749
|
||||
|
||||
Signed-off-by: Kevin Weng <t-keweng@microsoft.com>
|
||||
---
|
||||
dbus/dbus-auth.c | 32 ++++++++++++++++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
|
||||
index 37d8d4c9..7390a9d5 100644
|
||||
--- a/dbus/dbus-auth.c
|
||||
+++ b/dbus/dbus-auth.c
|
||||
@@ -529,6 +529,7 @@ sha1_handle_first_client_response (DBusAuth *auth,
|
||||
DBusString tmp2;
|
||||
dbus_bool_t retval = FALSE;
|
||||
DBusError error = DBUS_ERROR_INIT;
|
||||
+ DBusCredentials *myself = NULL;
|
||||
|
||||
_dbus_string_set_length (&auth->challenge, 0);
|
||||
|
||||
@@ -565,6 +566,34 @@ sha1_handle_first_client_response (DBusAuth *auth,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+ myself = _dbus_credentials_new_from_current_process ();
|
||||
+
|
||||
+ if (myself == NULL)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (!_dbus_credentials_same_user (myself, auth->desired_identity))
|
||||
+ {
|
||||
+ /*
|
||||
+ * DBUS_COOKIE_SHA1 is not suitable for authenticating that the
|
||||
+ * client is anyone other than the user owning the process
|
||||
+ * containing the DBusServer: we probably aren't allowed to write
|
||||
+ * to other users' home directories. Even if we can (for example
|
||||
+ * uid 0 on traditional Unix or CAP_DAC_OVERRIDE on Linux), we
|
||||
+ * must not, because the other user controls their home directory,
|
||||
+ * and could carry out symlink attacks to make us read from or
|
||||
+ * write to unintended locations. It's difficult to avoid symlink
|
||||
+ * attacks in a portable way, so we just don't try. This isn't a
|
||||
+ * regression, because DBUS_COOKIE_SHA1 never worked for other
|
||||
+ * users anyway.
|
||||
+ */
|
||||
+ _dbus_verbose ("%s: client tried to authenticate as \"%s\", "
|
||||
+ "but that doesn't match this process",
|
||||
+ DBUS_AUTH_NAME (auth),
|
||||
+ _dbus_string_get_const_data (data));
|
||||
+ retval = send_rejected (auth);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/* we cache the keyring for speed, so here we drop it if it's the
|
||||
* wrong one. FIXME caching the keyring here is useless since we use
|
||||
* a different DBusAuth for every connection.
|
||||
@@ -679,6 +708,9 @@ sha1_handle_first_client_response (DBusAuth *auth,
|
||||
_dbus_string_zero (&tmp2);
|
||||
_dbus_string_free (&tmp2);
|
||||
|
||||
+ if (myself != NULL)
|
||||
+ _dbus_credentials_unref (myself);
|
||||
+
|
||||
return retval;
|
||||
}
|
||||
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@@ -16,6 +16,7 @@ SRC_URI = "http://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
|
||||
file://tmpdir.patch \
|
||||
file://dbus-1.init \
|
||||
file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
|
||||
file://CVE-2019-12749.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "c3e12b4206e2a7da39d7cc42567790ef"
|
||||
|
||||
47
meta/recipes-core/glib-2.0/glib-2.0/CVE-2019-13012.patch
Normal file
47
meta/recipes-core/glib-2.0/glib-2.0/CVE-2019-13012.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From c7f7fd53780f8caebccc903d61ffc21632b46a6c Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Tue, 22 Jan 2019 13:26:31 -0500
|
||||
Subject: [PATCH] keyfile settings: Use tighter permissions
|
||||
|
||||
When creating directories, create them with 700 permissions,
|
||||
instead of 777.
|
||||
|
||||
Closes: #1658
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://gitlab.gnome.org/GNOME/glib/commit
|
||||
/5e4da714f00f6bfb2ccd6d73d61329c6f3a08429]
|
||||
|
||||
CVE: CVE-2019-13012
|
||||
|
||||
Signed-off-by: Kevin Weng <t-keweng@microsoft.com>
|
||||
---
|
||||
gio/gkeyfilesettingsbackend.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c
|
||||
index a37978e83..580a0b0a1 100644
|
||||
--- a/gio/gkeyfilesettingsbackend.c
|
||||
+++ b/gio/gkeyfilesettingsbackend.c
|
||||
@@ -89,7 +89,8 @@ g_keyfile_settings_backend_keyfile_write (GKeyfileSettingsBackend *kfsb)
|
||||
|
||||
contents = g_key_file_to_data (kfsb->keyfile, &length, NULL);
|
||||
g_file_replace_contents (kfsb->file, contents, length, NULL, FALSE,
|
||||
- G_FILE_CREATE_REPLACE_DESTINATION,
|
||||
+ G_FILE_CREATE_REPLACE_DESTINATION |
|
||||
+ G_FILE_CREATE_PRIVATE,
|
||||
NULL, NULL, NULL);
|
||||
|
||||
compute_checksum (kfsb->digest, contents, length);
|
||||
@@ -640,7 +641,7 @@ g_keyfile_settings_backend_new (const gchar *filename,
|
||||
|
||||
kfsb->file = g_file_new_for_path (filename);
|
||||
kfsb->dir = g_file_get_parent (kfsb->file);
|
||||
- g_file_make_directory_with_parents (kfsb->dir, NULL, NULL);
|
||||
+ g_mkdir_with_parents (g_file_peek_path (kfsb->dir), 0700);
|
||||
|
||||
kfsb->file_monitor = g_file_monitor (kfsb->file, 0, NULL, NULL);
|
||||
kfsb->dir_monitor = g_file_monitor (kfsb->dir, 0, NULL, NULL);
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@@ -17,6 +17,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
|
||||
file://CVE-2019-12450.patch \
|
||||
file://CVE-2019-9633_p1.patch \
|
||||
file://CVE-2019-9633_p2.patch \
|
||||
file://CVE-2019-13012.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-native = " file://relocate-modules.patch"
|
||||
|
||||
274
meta/recipes-core/glibc/glibc/CVE-2019-6488.patch
Normal file
274
meta/recipes-core/glibc/glibc/CVE-2019-6488.patch
Normal file
@@ -0,0 +1,274 @@
|
||||
From 718016100d889a986c536b595bf6ec0d6ab4b90e Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Fri, 1 Feb 2019 12:17:09 -0800
|
||||
Subject: [PATCH] x86-64 memchr/wmemchr: Properly handle the length parameter
|
||||
[BZ #24097]
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
On x32, the size_t parameter may be passed in the lower 32 bits of a
|
||||
64-bit register with the non-zero upper 32 bits. The string/memory
|
||||
functions written in assembly can only use the lower 32 bits of a
|
||||
64-bit register as length or must clear the upper 32 bits before using
|
||||
the full 64-bit register for length.
|
||||
|
||||
This pach fixes memchr/wmemchr for x32. Tested on x86-64 and x32. On
|
||||
x86-64, libc.so is the same with and withou the fix.
|
||||
|
||||
[BZ #24097]
|
||||
CVE-2019-6488
|
||||
* sysdeps/x86_64/memchr.S: Use RDX_LP for length. Clear the
|
||||
upper 32 bits of RDX register.
|
||||
* sysdeps/x86_64/multiarch/memchr-avx2.S: Likewise.
|
||||
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memchr and
|
||||
tst-size_t-wmemchr.
|
||||
* sysdeps/x86_64/x32/test-size_t.h: New file.
|
||||
* sysdeps/x86_64/x32/tst-size_t-memchr.c: Likewise.
|
||||
* sysdeps/x86_64/x32/tst-size_t-wmemchr.c: Likewise.
|
||||
|
||||
(cherry picked from commit 97700a34f36721b11a754cf37a1cc40695ece1fd)
|
||||
|
||||
CVE: CVE-2019-6488
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
---
|
||||
NEWS | 1 -
|
||||
sysdeps/x86_64/memchr.S | 10 ++--
|
||||
sysdeps/x86_64/multiarch/memchr-avx2.S | 8 ++-
|
||||
sysdeps/x86_64/x32/Makefile | 8 +++
|
||||
sysdeps/x86_64/x32/test-size_t.h | 35 ++++++++++++
|
||||
sysdeps/x86_64/x32/tst-size_t-memchr.c | 72 +++++++++++++++++++++++++
|
||||
sysdeps/x86_64/x32/tst-size_t-wmemchr.c | 20 +++++++
|
||||
7 files changed, 148 insertions(+), 6 deletions(-)
|
||||
create mode 100644 sysdeps/x86_64/x32/test-size_t.h
|
||||
create mode 100644 sysdeps/x86_64/x32/tst-size_t-memchr.c
|
||||
create mode 100644 sysdeps/x86_64/x32/tst-size_t-wmemchr.c
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index fd14941128..b158973a30 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -17,7 +17,6 @@ The following bugs are resolved with this release:
|
||||
[23606] Missing ENDBR32 in sysdeps/i386/start.S
|
||||
[23679] gethostid: Missing NULL check for gethostbyname_r result
|
||||
[23717] Fix stack overflow in stdlib/tst-setcontext9
|
||||
-
|
||||
|
||||
Version 2.28
|
||||
|
||||
diff --git a/sysdeps/x86_64/memchr.S b/sysdeps/x86_64/memchr.S
|
||||
index feef5d4f24..cb320257a2 100644
|
||||
--- a/sysdeps/x86_64/memchr.S
|
||||
+++ b/sysdeps/x86_64/memchr.S
|
||||
@@ -34,12 +34,16 @@ ENTRY(MEMCHR)
|
||||
mov %edi, %ecx
|
||||
|
||||
#ifdef USE_AS_WMEMCHR
|
||||
- test %rdx, %rdx
|
||||
+ test %RDX_LP, %RDX_LP
|
||||
jz L(return_null)
|
||||
- shl $2, %rdx
|
||||
+ shl $2, %RDX_LP
|
||||
#else
|
||||
+# ifdef __ILP32__
|
||||
+ /* Clear the upper 32 bits. */
|
||||
+ movl %edx, %edx
|
||||
+# endif
|
||||
punpcklbw %xmm1, %xmm1
|
||||
- test %rdx, %rdx
|
||||
+ test %RDX_LP, %RDX_LP
|
||||
jz L(return_null)
|
||||
punpcklbw %xmm1, %xmm1
|
||||
#endif
|
||||
diff --git a/sysdeps/x86_64/multiarch/memchr-avx2.S b/sysdeps/x86_64/multiarch/memchr-avx2.S
|
||||
index 5f5e772554..c81da19bf0 100644
|
||||
--- a/sysdeps/x86_64/multiarch/memchr-avx2.S
|
||||
+++ b/sysdeps/x86_64/multiarch/memchr-avx2.S
|
||||
@@ -40,16 +40,20 @@
|
||||
ENTRY (MEMCHR)
|
||||
# ifndef USE_AS_RAWMEMCHR
|
||||
/* Check for zero length. */
|
||||
- testq %rdx, %rdx
|
||||
+ test %RDX_LP, %RDX_LP
|
||||
jz L(null)
|
||||
# endif
|
||||
movl %edi, %ecx
|
||||
/* Broadcast CHAR to YMM0. */
|
||||
vmovd %esi, %xmm0
|
||||
# ifdef USE_AS_WMEMCHR
|
||||
- shl $2, %rdx
|
||||
+ shl $2, %RDX_LP
|
||||
vpbroadcastd %xmm0, %ymm0
|
||||
# else
|
||||
+# ifdef __ILP32__
|
||||
+ /* Clear the upper 32 bits. */
|
||||
+ movl %edx, %edx
|
||||
+# endif
|
||||
vpbroadcastb %xmm0, %ymm0
|
||||
# endif
|
||||
/* Check if we may cross page boundary with one vector load. */
|
||||
diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile
|
||||
index f2ebc24fb0..7d528889c6 100644
|
||||
--- a/sysdeps/x86_64/x32/Makefile
|
||||
+++ b/sysdeps/x86_64/x32/Makefile
|
||||
@@ -4,3 +4,11 @@ ifeq ($(subdir),math)
|
||||
# 64-bit llround. Add -fno-builtin-lround to silence the compiler.
|
||||
CFLAGS-s_llround.c += -fno-builtin-lround
|
||||
endif
|
||||
+
|
||||
+ifeq ($(subdir),string)
|
||||
+tests += tst-size_t-memchr
|
||||
+endif
|
||||
+
|
||||
+ifeq ($(subdir),wcsmbs)
|
||||
+tests += tst-size_t-wmemchr
|
||||
+endif
|
||||
diff --git a/sysdeps/x86_64/x32/test-size_t.h b/sysdeps/x86_64/x32/test-size_t.h
|
||||
new file mode 100644
|
||||
index 0000000000..78a940863e
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86_64/x32/test-size_t.h
|
||||
@@ -0,0 +1,35 @@
|
||||
+/* Test string/memory functions with size_t in the lower 32 bits of
|
||||
+ 64-bit register.
|
||||
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#define TEST_MAIN
|
||||
+#include <string/test-string.h>
|
||||
+
|
||||
+/* On x32, parameter_t may be passed in a 64-bit register with the LEN
|
||||
+ field in the lower 32 bits. When the LEN field of 64-bit register
|
||||
+ is passed to string/memory function as the size_t parameter, only
|
||||
+ the lower 32 bits can be used. */
|
||||
+typedef struct
|
||||
+{
|
||||
+ union
|
||||
+ {
|
||||
+ size_t len;
|
||||
+ void (*fn) (void);
|
||||
+ };
|
||||
+ void *p;
|
||||
+} parameter_t;
|
||||
diff --git a/sysdeps/x86_64/x32/tst-size_t-memchr.c b/sysdeps/x86_64/x32/tst-size_t-memchr.c
|
||||
new file mode 100644
|
||||
index 0000000000..29a3daf102
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86_64/x32/tst-size_t-memchr.c
|
||||
@@ -0,0 +1,72 @@
|
||||
+/* Test memchr with size_t in the lower 32 bits of 64-bit register.
|
||||
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#ifndef WIDE
|
||||
+# define TEST_NAME "memchr"
|
||||
+#else
|
||||
+# define TEST_NAME "wmemchr"
|
||||
+#endif /* WIDE */
|
||||
+#include "test-size_t.h"
|
||||
+
|
||||
+#ifndef WIDE
|
||||
+# define MEMCHR memchr
|
||||
+# define CHAR char
|
||||
+# define UCHAR unsigned char
|
||||
+#else
|
||||
+# include <wchar.h>
|
||||
+# define MEMCHR wmemchr
|
||||
+# define CHAR wchar_t
|
||||
+# define UCHAR wchar_t
|
||||
+#endif /* WIDE */
|
||||
+
|
||||
+IMPL (MEMCHR, 1)
|
||||
+
|
||||
+typedef CHAR * (*proto_t) (const CHAR*, int, size_t);
|
||||
+
|
||||
+static CHAR *
|
||||
+__attribute__ ((noinline, noclone))
|
||||
+do_memchr (parameter_t a, parameter_t b)
|
||||
+{
|
||||
+ return CALL (&b, a.p, (uintptr_t) b.p, a.len);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+test_main (void)
|
||||
+{
|
||||
+ test_init ();
|
||||
+
|
||||
+ parameter_t src = { { page_size / sizeof (CHAR) }, buf2 };
|
||||
+ parameter_t c = { { 0 }, (void *) (uintptr_t) 0x12 };
|
||||
+
|
||||
+ int ret = 0;
|
||||
+ FOR_EACH_IMPL (impl, 0)
|
||||
+ {
|
||||
+ c.fn = impl->fn;
|
||||
+ CHAR *res = do_memchr (src, c);
|
||||
+ if (res)
|
||||
+ {
|
||||
+ error (0, 0, "Wrong result in function %s: %p != NULL",
|
||||
+ impl->name, res);
|
||||
+ ret = 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
diff --git a/sysdeps/x86_64/x32/tst-size_t-wmemchr.c b/sysdeps/x86_64/x32/tst-size_t-wmemchr.c
|
||||
new file mode 100644
|
||||
index 0000000000..877801d646
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86_64/x32/tst-size_t-wmemchr.c
|
||||
@@ -0,0 +1,20 @@
|
||||
+/* Test wmemchr with size_t in the lower 32 bits of 64-bit register.
|
||||
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#define WIDE 1
|
||||
+#include "tst-size_t-memchr.c"
|
||||
--
|
||||
2.23.0
|
||||
|
||||
207
meta/recipes-core/glibc/glibc/CVE-2019-7309.patch
Normal file
207
meta/recipes-core/glibc/glibc/CVE-2019-7309.patch
Normal file
@@ -0,0 +1,207 @@
|
||||
From af7f46c45a60e6df754fb6258b546917e61ae6f1 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Mon, 4 Feb 2019 08:55:52 -0800
|
||||
Subject: [PATCH] x86-64 memcmp: Use unsigned Jcc instructions on size [BZ
|
||||
#24155]
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
Since the size argument is unsigned. we should use unsigned Jcc
|
||||
instructions, instead of signed, to check size.
|
||||
|
||||
Tested on x86-64 and x32, with and without --disable-multi-arch.
|
||||
|
||||
[BZ #24155]
|
||||
CVE-2019-7309
|
||||
* NEWS: Updated for CVE-2019-7309.
|
||||
* sysdeps/x86_64/memcmp.S: Use RDX_LP for size. Clear the
|
||||
upper 32 bits of RDX register for x32. Use unsigned Jcc
|
||||
instructions, instead of signed.
|
||||
* sysdeps/x86_64/x32/Makefile (tests): Add tst-size_t-memcmp-2.
|
||||
* sysdeps/x86_64/x32/tst-size_t-memcmp-2.c: New test.
|
||||
|
||||
(cherry picked from commit 3f635fb43389b54f682fc9ed2acc0b2aaf4a923d)
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
CVE: CVE-2019-7309
|
||||
|
||||
Upstream-Status: Backport
|
||||
---
|
||||
sysdeps/x86_64/memcmp.S | 20 +++---
|
||||
sysdeps/x86_64/x32/Makefile | 2 +-
|
||||
sysdeps/x86_64/x32/tst-size_t-memcmp-2.c | 79 ++++++++++++++++++++++++
|
||||
3 files changed, 92 insertions(+), 9 deletions(-)
|
||||
create mode 100644 sysdeps/x86_64/x32/tst-size_t-memcmp-2.c
|
||||
|
||||
diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S
|
||||
index bcb4a2e88d..45918d375a 100644
|
||||
--- a/sysdeps/x86_64/memcmp.S
|
||||
+++ b/sysdeps/x86_64/memcmp.S
|
||||
@@ -21,14 +21,18 @@
|
||||
|
||||
.text
|
||||
ENTRY (memcmp)
|
||||
- test %rdx, %rdx
|
||||
+#ifdef __ILP32__
|
||||
+ /* Clear the upper 32 bits. */
|
||||
+ movl %edx, %edx
|
||||
+#endif
|
||||
+ test %RDX_LP, %RDX_LP
|
||||
jz L(finz)
|
||||
cmpq $1, %rdx
|
||||
- jle L(finr1b)
|
||||
+ jbe L(finr1b)
|
||||
subq %rdi, %rsi
|
||||
movq %rdx, %r10
|
||||
cmpq $32, %r10
|
||||
- jge L(gt32)
|
||||
+ jae L(gt32)
|
||||
/* Handle small chunks and last block of less than 32 bytes. */
|
||||
L(small):
|
||||
testq $1, %r10
|
||||
@@ -156,7 +160,7 @@ L(A32):
|
||||
movq %r11, %r10
|
||||
andq $-32, %r10
|
||||
cmpq %r10, %rdi
|
||||
- jge L(mt16)
|
||||
+ jae L(mt16)
|
||||
/* Pre-unroll to be ready for unrolled 64B loop. */
|
||||
testq $32, %rdi
|
||||
jz L(A64)
|
||||
@@ -178,7 +182,7 @@ L(A64):
|
||||
movq %r11, %r10
|
||||
andq $-64, %r10
|
||||
cmpq %r10, %rdi
|
||||
- jge L(mt32)
|
||||
+ jae L(mt32)
|
||||
|
||||
L(A64main):
|
||||
movdqu (%rdi,%rsi), %xmm0
|
||||
@@ -216,7 +220,7 @@ L(mt32):
|
||||
movq %r11, %r10
|
||||
andq $-32, %r10
|
||||
cmpq %r10, %rdi
|
||||
- jge L(mt16)
|
||||
+ jae L(mt16)
|
||||
|
||||
L(A32main):
|
||||
movdqu (%rdi,%rsi), %xmm0
|
||||
@@ -254,7 +258,7 @@ L(ATR):
|
||||
movq %r11, %r10
|
||||
andq $-32, %r10
|
||||
cmpq %r10, %rdi
|
||||
- jge L(mt16)
|
||||
+ jae L(mt16)
|
||||
testq $16, %rdi
|
||||
jz L(ATR32)
|
||||
|
||||
@@ -325,7 +329,7 @@ L(ATR64main):
|
||||
movq %r11, %r10
|
||||
andq $-32, %r10
|
||||
cmpq %r10, %rdi
|
||||
- jge L(mt16)
|
||||
+ jae L(mt16)
|
||||
|
||||
L(ATR32res):
|
||||
movdqa (%rdi,%rsi), %xmm0
|
||||
diff --git a/sysdeps/x86_64/x32/Makefile b/sysdeps/x86_64/x32/Makefile
|
||||
index 7d528889c6..c9850beeb5 100644
|
||||
--- a/sysdeps/x86_64/x32/Makefile
|
||||
+++ b/sysdeps/x86_64/x32/Makefile
|
||||
@@ -6,7 +6,7 @@ CFLAGS-s_llround.c += -fno-builtin-lround
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),string)
|
||||
-tests += tst-size_t-memchr
|
||||
+tests += tst-size_t-memchr tst-size_t-memcmp-2
|
||||
endif
|
||||
|
||||
ifeq ($(subdir),wcsmbs)
|
||||
diff --git a/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c b/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c
|
||||
new file mode 100644
|
||||
index 0000000000..d8ae1a0813
|
||||
--- /dev/null
|
||||
+++ b/sysdeps/x86_64/x32/tst-size_t-memcmp-2.c
|
||||
@@ -0,0 +1,79 @@
|
||||
+/* Test memcmp with size_t in the lower 32 bits of 64-bit register.
|
||||
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+
|
||||
+ The GNU C Library is free software; you can redistribute it and/or
|
||||
+ modify it under the terms of the GNU Lesser General Public
|
||||
+ License as published by the Free Software Foundation; either
|
||||
+ version 2.1 of the License, or (at your option) any later version.
|
||||
+
|
||||
+ The GNU C Library is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public
|
||||
+ License along with the GNU C Library; if not, see
|
||||
+ <http://www.gnu.org/licenses/>. */
|
||||
+
|
||||
+#define TEST_MAIN
|
||||
+#ifdef WIDE
|
||||
+# define TEST_NAME "wmemcmp"
|
||||
+#else
|
||||
+# define TEST_NAME "memcmp"
|
||||
+#endif
|
||||
+
|
||||
+#include "test-size_t.h"
|
||||
+
|
||||
+#ifdef WIDE
|
||||
+# include <inttypes.h>
|
||||
+# include <wchar.h>
|
||||
+
|
||||
+# define MEMCMP wmemcmp
|
||||
+# define CHAR wchar_t
|
||||
+#else
|
||||
+# define MEMCMP memcmp
|
||||
+# define CHAR char
|
||||
+#endif
|
||||
+
|
||||
+IMPL (MEMCMP, 1)
|
||||
+
|
||||
+typedef int (*proto_t) (const CHAR *, const CHAR *, size_t);
|
||||
+
|
||||
+static int
|
||||
+__attribute__ ((noinline, noclone))
|
||||
+do_memcmp (parameter_t a, parameter_t b)
|
||||
+{
|
||||
+ return CALL (&b, a.p, b.p, a.len);
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+test_main (void)
|
||||
+{
|
||||
+ test_init ();
|
||||
+
|
||||
+ parameter_t dest = { { page_size / sizeof (CHAR) }, buf1 };
|
||||
+ parameter_t src = { { 0 }, buf2 };
|
||||
+
|
||||
+ memcpy (buf1, buf2, page_size);
|
||||
+
|
||||
+ CHAR *p = (CHAR *) buf1;
|
||||
+ p[page_size / sizeof (CHAR) - 1] = (CHAR) 1;
|
||||
+
|
||||
+ int ret = 0;
|
||||
+ FOR_EACH_IMPL (impl, 0)
|
||||
+ {
|
||||
+ src.fn = impl->fn;
|
||||
+ int res = do_memcmp (dest, src);
|
||||
+ if (res >= 0)
|
||||
+ {
|
||||
+ error (0, 0, "Wrong result in function %s: %i >= 0",
|
||||
+ impl->name, res);
|
||||
+ ret = 1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
+}
|
||||
+
|
||||
+#include <support/test-driver.c>
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -50,6 +50,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
|
||||
file://CVE-2019-9169.patch \
|
||||
file://CVE-2016-10739.patch \
|
||||
file://CVE-2018-19591.patch \
|
||||
file://CVE-2019-6488.patch \
|
||||
file://CVE-2019-7309.patch \
|
||||
"
|
||||
|
||||
NATIVESDKFIXES ?= ""
|
||||
|
||||
@@ -22,7 +22,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image module-base setuptools3
|
||||
|
||||
SRCREV ?= "d43a86de1a37ce9daede726a49231547a21429a5"
|
||||
SRCREV ?= "2c5af52109bca8c0452b1539589cf073f6f0064a"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=thud \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
@@ -46,6 +46,12 @@ SRC_URI = "\
|
||||
file://CVE-2018-18605.patch \
|
||||
file://CVE-2018-18606.patch \
|
||||
file://CVE-2018-18607.patch \
|
||||
file://CVE-2019-14444.patch \
|
||||
file://CVE-2019-12972.patch \
|
||||
file://CVE-2018-20623.patch \
|
||||
file://CVE-2018-20651.patch \
|
||||
file://CVE-2018-20671.patch \
|
||||
file://CVE-2018-1000876.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
|
||||
180
meta/recipes-devtools/binutils/binutils/CVE-2018-1000876.patch
Normal file
180
meta/recipes-devtools/binutils/binutils/CVE-2018-1000876.patch
Normal file
@@ -0,0 +1,180 @@
|
||||
From efec0844fcfb5692f5a78f4082994d63e420ecd9 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Sun, 16 Dec 2018 23:02:50 +1030
|
||||
Subject: [PATCH] PR23994, libbfd integer overflow
|
||||
|
||||
PR 23994
|
||||
* aoutx.h: Include limits.h.
|
||||
(get_reloc_upper_bound): Detect long overflow and return a file
|
||||
too big error if it occurs.
|
||||
* elf.c: Include limits.h.
|
||||
(_bfd_elf_get_symtab_upper_bound): Detect long overflow and return
|
||||
a file too big error if it occurs.
|
||||
(_bfd_elf_get_dynamic_symtab_upper_bound): Likewise.
|
||||
(_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
|
||||
|
||||
CVE: CVE-2018-1000876
|
||||
Upstream-Status: Backport
|
||||
[https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3a551c7a1b80fca579461774860574eabfd7f18f]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
bfd/aoutx.h | 40 +++++++++++++++++++++-------------------
|
||||
bfd/elf.c | 32 ++++++++++++++++++++++++--------
|
||||
2 files changed, 45 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
|
||||
index 023843b0be..78eaa9c503 100644
|
||||
--- a/bfd/aoutx.h
|
||||
+++ b/bfd/aoutx.h
|
||||
@@ -117,6 +117,7 @@ DESCRIPTION
|
||||
#define KEEPIT udata.i
|
||||
|
||||
#include "sysdep.h"
|
||||
+#include <limits.h>
|
||||
#include "bfd.h"
|
||||
#include "safe-ctype.h"
|
||||
#include "bfdlink.h"
|
||||
@@ -2491,6 +2492,8 @@ NAME (aout, canonicalize_reloc) (bfd *abfd,
|
||||
long
|
||||
NAME (aout, get_reloc_upper_bound) (bfd *abfd, sec_ptr asect)
|
||||
{
|
||||
+ bfd_size_type count;
|
||||
+
|
||||
if (bfd_get_format (abfd) != bfd_object)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
@@ -2498,26 +2501,25 @@ NAME (aout, get_reloc_upper_bound) (bfd *abfd, sec_ptr asect)
|
||||
}
|
||||
|
||||
if (asect->flags & SEC_CONSTRUCTOR)
|
||||
- return sizeof (arelent *) * (asect->reloc_count + 1);
|
||||
-
|
||||
- if (asect == obj_datasec (abfd))
|
||||
- return sizeof (arelent *)
|
||||
- * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd))
|
||||
- + 1);
|
||||
-
|
||||
- if (asect == obj_textsec (abfd))
|
||||
- return sizeof (arelent *)
|
||||
- * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))
|
||||
- + 1);
|
||||
-
|
||||
- if (asect == obj_bsssec (abfd))
|
||||
- return sizeof (arelent *);
|
||||
-
|
||||
- if (asect == obj_bsssec (abfd))
|
||||
- return 0;
|
||||
+ count = asect->reloc_count;
|
||||
+ else if (asect == obj_datasec (abfd))
|
||||
+ count = exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd);
|
||||
+ else if (asect == obj_textsec (abfd))
|
||||
+ count = exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd);
|
||||
+ else if (asect == obj_bsssec (abfd))
|
||||
+ count = 0;
|
||||
+ else
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_invalid_operation);
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
- bfd_set_error (bfd_error_invalid_operation);
|
||||
- return -1;
|
||||
+ if (count >= LONG_MAX / sizeof (arelent *))
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_file_too_big);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ return (count + 1) * sizeof (arelent *);
|
||||
}
|
||||
|
||||
long
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 828241d48a..10037176a3 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -35,6 +35,7 @@ SECTION
|
||||
/* For sparc64-cross-sparc32. */
|
||||
#define _SYSCALL32
|
||||
#include "sysdep.h"
|
||||
+#include <limits.h>
|
||||
#include "bfd.h"
|
||||
#include "bfdlink.h"
|
||||
#include "libbfd.h"
|
||||
@@ -8114,11 +8115,16 @@ error_return:
|
||||
long
|
||||
_bfd_elf_get_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
- long symcount;
|
||||
+ bfd_size_type symcount;
|
||||
long symtab_size;
|
||||
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
||||
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
|
||||
+ if (symcount >= LONG_MAX / sizeof (asymbol *))
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_file_too_big);
|
||||
+ return -1;
|
||||
+ }
|
||||
symtab_size = (symcount + 1) * (sizeof (asymbol *));
|
||||
if (symcount > 0)
|
||||
symtab_size -= sizeof (asymbol *);
|
||||
@@ -8129,7 +8135,7 @@ _bfd_elf_get_symtab_upper_bound (bfd *abfd)
|
||||
long
|
||||
_bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd)
|
||||
{
|
||||
- long symcount;
|
||||
+ bfd_size_type symcount;
|
||||
long symtab_size;
|
||||
Elf_Internal_Shdr *hdr = &elf_tdata (abfd)->dynsymtab_hdr;
|
||||
|
||||
@@ -8140,6 +8146,11 @@ _bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd)
|
||||
}
|
||||
|
||||
symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
|
||||
+ if (symcount >= LONG_MAX / sizeof (asymbol *))
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_file_too_big);
|
||||
+ return -1;
|
||||
+ }
|
||||
symtab_size = (symcount + 1) * (sizeof (asymbol *));
|
||||
if (symcount > 0)
|
||||
symtab_size -= sizeof (asymbol *);
|
||||
@@ -8209,7 +8220,7 @@ _bfd_elf_canonicalize_dynamic_symtab (bfd *abfd,
|
||||
long
|
||||
_bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
|
||||
{
|
||||
- long ret;
|
||||
+ bfd_size_type count;
|
||||
asection *s;
|
||||
|
||||
if (elf_dynsymtab (abfd) == 0)
|
||||
@@ -8218,15 +8229,20 @@ _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- ret = sizeof (arelent *);
|
||||
+ count = 1;
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
|
||||
&& (elf_section_data (s)->this_hdr.sh_type == SHT_REL
|
||||
|| elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
|
||||
- ret += ((s->size / elf_section_data (s)->this_hdr.sh_entsize)
|
||||
- * sizeof (arelent *));
|
||||
-
|
||||
- return ret;
|
||||
+ {
|
||||
+ count += s->size / elf_section_data (s)->this_hdr.sh_entsize;
|
||||
+ if (count > LONG_MAX / sizeof (arelent *))
|
||||
+ {
|
||||
+ bfd_set_error (bfd_error_file_too_big);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ return count * sizeof (arelent *);
|
||||
}
|
||||
|
||||
/* Canonicalize the dynamic relocation entries. Note that we return the
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
74
meta/recipes-devtools/binutils/binutils/CVE-2018-20623.patch
Normal file
74
meta/recipes-devtools/binutils/binutils/CVE-2018-20623.patch
Normal file
@@ -0,0 +1,74 @@
|
||||
From 90cce28d4b59f86366d4f562d01a8d439d514234 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 9 Jan 2019 12:25:16 +0000
|
||||
Subject: [PATCH] Fix a heap use after free memory access fault when displaying
|
||||
error messages about malformed archives.
|
||||
|
||||
PR 14049
|
||||
* readelf.c (process_archive): Use arch.file_name in error
|
||||
messages until the qualified name is available.
|
||||
|
||||
CVE: CVE-2018-20623
|
||||
Upstream-Status: Backport
|
||||
[https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=28e817cc440bce73691c03e01860089a0954a837]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
binutils/readelf.c | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/binutils/readelf.c b/binutils/readelf.c
|
||||
index f4df697a7d..280023d8de 100644
|
||||
--- a/binutils/readelf.c
|
||||
+++ b/binutils/readelf.c
|
||||
@@ -19061,7 +19061,7 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
|
||||
/* Read the next archive header. */
|
||||
if (fseek (filedata->handle, arch.next_arhdr_offset, SEEK_SET) != 0)
|
||||
{
|
||||
- error (_("%s: failed to seek to next archive header\n"), filedata->file_name);
|
||||
+ error (_("%s: failed to seek to next archive header\n"), arch.file_name);
|
||||
return FALSE;
|
||||
}
|
||||
got = fread (&arch.arhdr, 1, sizeof arch.arhdr, filedata->handle);
|
||||
@@ -19069,7 +19069,10 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
|
||||
{
|
||||
if (got == 0)
|
||||
break;
|
||||
- error (_("%s: failed to read archive header\n"), filedata->file_name);
|
||||
+ /* PR 24049 - we cannot use filedata->file_name as this will
|
||||
+ have already been freed. */
|
||||
+ error (_("%s: failed to read archive header\n"), arch.file_name);
|
||||
+
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -19089,7 +19092,7 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
|
||||
name = get_archive_member_name (&arch, &nested_arch);
|
||||
if (name == NULL)
|
||||
{
|
||||
- error (_("%s: bad archive file name\n"), filedata->file_name);
|
||||
+ error (_("%s: bad archive file name\n"), arch.file_name);
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -19098,7 +19101,7 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
|
||||
qualified_name = make_qualified_name (&arch, &nested_arch, name);
|
||||
if (qualified_name == NULL)
|
||||
{
|
||||
- error (_("%s: bad archive file name\n"), filedata->file_name);
|
||||
+ error (_("%s: bad archive file name\n"), arch.file_name);
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -19144,7 +19147,7 @@ process_archive (Filedata * filedata, bfd_boolean is_thin_archive)
|
||||
if (nested_arch.file == NULL)
|
||||
{
|
||||
error (_("%s: contains corrupt thin archive: %s\n"),
|
||||
- filedata->file_name, name);
|
||||
+ qualified_name, name);
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
35
meta/recipes-devtools/binutils/binutils/CVE-2018-20651.patch
Normal file
35
meta/recipes-devtools/binutils/binutils/CVE-2018-20651.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 6a29d95602b09bb83d2c82b45ed935157fb780aa Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Mon, 31 Dec 2018 15:40:08 +1030
|
||||
Subject: [PATCH] PR24041, Invalid Memory Address Dereference in
|
||||
elf_link_add_object_symbols
|
||||
|
||||
PR 24041
|
||||
* elflink.c (elf_link_add_object_symbols): Don't segfault on
|
||||
crafted ET_DYN with no program headers.
|
||||
|
||||
CVE: CVE-2018-20651
|
||||
Upstream-Status: Backport
|
||||
[https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=54025d5812ff100f5f0654eb7e1ffd50f2e37f5f]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
bfd/elflink.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/elflink.c b/bfd/elflink.c
|
||||
index 46091b6341..557c550082 100644
|
||||
--- a/bfd/elflink.c
|
||||
+++ b/bfd/elflink.c
|
||||
@@ -4178,7 +4178,7 @@ error_free_dyn:
|
||||
all sections contained fully therein. This makes relro
|
||||
shared library sections appear as they will at run-time. */
|
||||
phdr = elf_tdata (abfd)->phdr + elf_elfheader (abfd)->e_phnum;
|
||||
- while (--phdr >= elf_tdata (abfd)->phdr)
|
||||
+ while (phdr-- > elf_tdata (abfd)->phdr)
|
||||
if (phdr->p_type == PT_GNU_RELRO)
|
||||
{
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
49
meta/recipes-devtools/binutils/binutils/CVE-2018-20671.patch
Normal file
49
meta/recipes-devtools/binutils/binutils/CVE-2018-20671.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 8a5f4f2ebe7f35ac5646060fa51e3332f6ef388c Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Fri, 4 Jan 2019 13:44:34 +0000
|
||||
Subject: [PATCH] Fix a possible integer overflow problem when examining
|
||||
corrupt binaries using a 32-bit binutil.
|
||||
|
||||
PR 24005
|
||||
* objdump.c (load_specific_debug_section): Check for integer
|
||||
overflow before attempting to allocate contents.
|
||||
|
||||
CVE: CVE-2018-20671
|
||||
Upstream-Status: Backport
|
||||
[https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=11fa9f134fd658075c6f74499c780df045d9e9ca]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
binutils/objdump.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/binutils/objdump.c b/binutils/objdump.c
|
||||
index f468fcdb59..89ca688938 100644
|
||||
--- a/binutils/objdump.c
|
||||
+++ b/binutils/objdump.c
|
||||
@@ -2503,12 +2503,19 @@ load_specific_debug_section (enum dwarf_section_display_enum debug,
|
||||
section->reloc_info = NULL;
|
||||
section->num_relocs = 0;
|
||||
section->address = bfd_get_section_vma (abfd, sec);
|
||||
+ section->user_data = sec;
|
||||
section->size = bfd_get_section_size (sec);
|
||||
amt = section->size + 1;
|
||||
+ if (amt == 0 || amt > bfd_get_file_size (abfd))
|
||||
+ {
|
||||
+ section->start = NULL;
|
||||
+ free_debug_section (debug);
|
||||
+ printf (_("\nSection '%s' has an invalid size: %#llx.\n"),
|
||||
+ section->name, (unsigned long long) section->size);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
section->start = contents = malloc (amt);
|
||||
- section->user_data = sec;
|
||||
- if (amt == 0
|
||||
- || section->start == NULL
|
||||
+ if (section->start == NULL
|
||||
|| !bfd_get_full_section_contents (abfd, sec, &contents))
|
||||
{
|
||||
free_debug_section (debug);
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
39
meta/recipes-devtools/binutils/binutils/CVE-2019-12972.patch
Normal file
39
meta/recipes-devtools/binutils/binutils/CVE-2019-12972.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 890f750a3b053532a4b839a2dd6243076de12031 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Fri, 21 Jun 2019 11:51:38 +0930
|
||||
Subject: [PATCH] PR24689, string table corruption
|
||||
|
||||
The testcase in the PR had a e_shstrndx section of type SHT_GROUP.
|
||||
hdr->contents were initialized by setup_group rather than being read
|
||||
from the file, thus last byte was not zero and string dereference ran
|
||||
off the end of the buffer.
|
||||
|
||||
PR 24689
|
||||
* elfcode.h (elf_object_p): Check type of e_shstrndx section.
|
||||
|
||||
Upstream-Status: Backport
|
||||
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=890f750a3b053532a4b839a2dd6243076de12031
|
||||
|
||||
CVE: CVE-2019-12972
|
||||
Affects: <= 2.23.0
|
||||
Dropped Changelog
|
||||
Signed-off-by Armin Kuster <akuster@mvista.com>
|
||||
---
|
||||
bfd/ChangeLog | 5 +++++
|
||||
bfd/elfcode.h | 3 ++-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: git/bfd/elfcode.h
|
||||
===================================================================
|
||||
--- git.orig/bfd/elfcode.h
|
||||
+++ git/bfd/elfcode.h
|
||||
@@ -747,7 +747,8 @@ elf_object_p (bfd *abfd)
|
||||
/* A further sanity check. */
|
||||
if (i_ehdrp->e_shnum != 0)
|
||||
{
|
||||
- if (i_ehdrp->e_shstrndx >= elf_numsections (abfd))
|
||||
+ if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
|
||||
+ || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB)
|
||||
{
|
||||
/* PR 2257:
|
||||
We used to just goto got_wrong_format_error here
|
||||
33
meta/recipes-devtools/binutils/binutils/CVE-2019-14444.patch
Normal file
33
meta/recipes-devtools/binutils/binutils/CVE-2019-14444.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From e17869db99195849826eaaf5d2d0eb2cfdd7a2a7 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Mon, 5 Aug 2019 10:40:35 +0100
|
||||
Subject: [PATCH] Catch potential integer overflow in readelf when processing
|
||||
corrupt binaries.
|
||||
|
||||
PR 24829
|
||||
* readelf.c (apply_relocations): Catch potential integer overflow
|
||||
whilst checking reloc location against section size.
|
||||
|
||||
Upstream-Status: Backport
|
||||
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e17869db99195849826eaaf5d2d0eb2cfdd7a2a7
|
||||
CVE: CVE-2019-14444
|
||||
Dropped changelog
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
binutils/readelf.c | 2 +-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
Index: git/binutils/readelf.c
|
||||
===================================================================
|
||||
--- git.orig/binutils/readelf.c
|
||||
+++ git/binutils/readelf.c
|
||||
@@ -13113,7 +13113,7 @@ apply_relocations (Filedata *
|
||||
}
|
||||
|
||||
rloc = start + rp->r_offset;
|
||||
- if ((rloc + reloc_size) > end || (rloc < start))
|
||||
+ if (rloc >= end || (rloc + reloc_size) > end || (rloc < start))
|
||||
{
|
||||
warn (_("skipping invalid relocation offset 0x%lx in section %s\n"),
|
||||
(unsigned long) rp->r_offset,
|
||||
@@ -31,6 +31,8 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
|
||||
file://CVE-2019-7150.patch \
|
||||
file://CVE-2019-7146_p1.patch \
|
||||
file://CVE-2019-7146_p2.patch \
|
||||
file://CVE-2019-7664.patch \
|
||||
file://CVE-2019-7665.patch \
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch"
|
||||
|
||||
|
||||
65
meta/recipes-devtools/elfutils/files/CVE-2019-7664.patch
Normal file
65
meta/recipes-devtools/elfutils/files/CVE-2019-7664.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From 3ed05376e7b2c96c1d6eb24d2842cc25b79a4f07 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Wed, 16 Jan 2019 12:25:57 +0100
|
||||
Subject: [PATCH] CVE: CVE-2019-7664
|
||||
|
||||
Upstream-Status: Backport
|
||||
libelf: Correct overflow check in note_xlate.
|
||||
|
||||
We want to make sure the note_len doesn't overflow and becomes shorter
|
||||
than the note header. But the namesz and descsz checks got the note header
|
||||
size wrong). Replace the wrong constant (8) with a sizeof cvt_Nhdr (12).
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=24084
|
||||
|
||||
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
||||
Signed-off-by: Ubuntu <lisa@shuagr-yocto-build.mdn4q2lr1oauhmizmzsslly3ad.xx.internal.cloudapp.net>
|
||||
---
|
||||
libelf/ChangeLog | 13 +++++++++++++
|
||||
libelf/note_xlate.h | 4 ++--
|
||||
2 files changed, 15 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
|
||||
index 68c4fbd..892e6e7 100644
|
||||
--- a/libelf/ChangeLog
|
||||
+++ b/libelf/ChangeLog
|
||||
@@ -1,3 +1,16 @@
|
||||
+<<<<<<< HEAD
|
||||
+=======
|
||||
+2019-01-16 Mark Wielaard <mark@klomp.org>
|
||||
+
|
||||
+ * note_xlate.h (elf_cvt_note): Check n_namesz and n_descsz don't
|
||||
+ overflow note_len into note header.
|
||||
+
|
||||
+2018-11-17 Mark Wielaard <mark@klomp.org>
|
||||
+
|
||||
+ * elf32_updatefile.c (updatemmap): Make sure to call convert
|
||||
+ function on a properly aligned destination.
|
||||
+
|
||||
+>>>>>>> e65d91d... libelf: Correct overflow check in note_xlate.
|
||||
2018-11-16 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* libebl.h (__elf32_msize): Mark with const attribute.
|
||||
diff --git a/libelf/note_xlate.h b/libelf/note_xlate.h
|
||||
index 9bdc3e2..bc9950f 100644
|
||||
--- a/libelf/note_xlate.h
|
||||
+++ b/libelf/note_xlate.h
|
||||
@@ -46,13 +46,13 @@ elf_cvt_note (void *dest, const void *src, size_t len, int encode,
|
||||
/* desc needs to be aligned. */
|
||||
note_len += n->n_namesz;
|
||||
note_len = nhdr8 ? NOTE_ALIGN8 (note_len) : NOTE_ALIGN4 (note_len);
|
||||
- if (note_len > len || note_len < 8)
|
||||
+ if (note_len > len || note_len < sizeof *n)
|
||||
break;
|
||||
|
||||
/* data as a whole needs to be aligned. */
|
||||
note_len += n->n_descsz;
|
||||
note_len = nhdr8 ? NOTE_ALIGN8 (note_len) : NOTE_ALIGN4 (note_len);
|
||||
- if (note_len > len || note_len < 8)
|
||||
+ if (note_len > len || note_len < sizeof *n)
|
||||
break;
|
||||
|
||||
/* Copy or skip the note data. */
|
||||
--
|
||||
2.7.4
|
||||
|
||||
154
meta/recipes-devtools/elfutils/files/CVE-2019-7665.patch
Normal file
154
meta/recipes-devtools/elfutils/files/CVE-2019-7665.patch
Normal file
@@ -0,0 +1,154 @@
|
||||
From 4323d46c4a369b614aa1f574805860b3434552df Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Wed, 16 Jan 2019 15:41:31 +0100
|
||||
Subject: [PATCH] CVE: CVE-2019-7665
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Sign off: Shubham Agrawal <shuagr@microsoft.com>
|
||||
|
||||
libebl: Check NT_PLATFORM core notes contain a zero terminated string.
|
||||
|
||||
Most strings in core notes are fixed size. But NT_PLATFORM contains just
|
||||
a variable length string. Check that it is actually zero terminated
|
||||
before passing to readelf to print.
|
||||
|
||||
https://sourceware.org/bugzilla/show_bug.cgi?id=24089
|
||||
|
||||
Signed-off-by: Mark Wielaard <mark@klomp.org>
|
||||
Signed-off-by: Ubuntu <lisa@shuagr-yocto-build.mdn4q2lr1oauhmizmzsslly3ad.xx.internal.cloudapp.net>
|
||||
---
|
||||
libdwfl/linux-core-attach.c | 9 +++++----
|
||||
libebl/eblcorenote.c | 39 +++++++++++++++++++--------------------
|
||||
libebl/libebl.h | 3 ++-
|
||||
src/readelf.c | 2 +-
|
||||
4 files changed, 27 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/libdwfl/linux-core-attach.c b/libdwfl/linux-core-attach.c
|
||||
index 6c99b9e..c0f1b0d 100644
|
||||
--- a/libdwfl/linux-core-attach.c
|
||||
+++ b/libdwfl/linux-core-attach.c
|
||||
@@ -137,7 +137,7 @@ core_next_thread (Dwfl *dwfl __attribute__ ((unused)), void *dwfl_arg,
|
||||
const Ebl_Register_Location *reglocs;
|
||||
size_t nitems;
|
||||
const Ebl_Core_Item *items;
|
||||
- if (! ebl_core_note (core_arg->ebl, &nhdr, name,
|
||||
+ if (! ebl_core_note (core_arg->ebl, &nhdr, name, desc,
|
||||
®s_offset, &nregloc, ®locs, &nitems, &items))
|
||||
{
|
||||
/* This note may be just not recognized, skip it. */
|
||||
@@ -191,8 +191,9 @@ core_set_initial_registers (Dwfl_Thread *thread, void *thread_arg_voidp)
|
||||
const Ebl_Register_Location *reglocs;
|
||||
size_t nitems;
|
||||
const Ebl_Core_Item *items;
|
||||
- int core_note_err = ebl_core_note (core_arg->ebl, &nhdr, name, ®s_offset,
|
||||
- &nregloc, ®locs, &nitems, &items);
|
||||
+ int core_note_err = ebl_core_note (core_arg->ebl, &nhdr, name, desc,
|
||||
+ ®s_offset, &nregloc, ®locs,
|
||||
+ &nitems, &items);
|
||||
/* __libdwfl_attach_state_for_core already verified the note is there. */
|
||||
assert (core_note_err != 0);
|
||||
assert (nhdr.n_type == NT_PRSTATUS);
|
||||
@@ -383,7 +384,7 @@ dwfl_core_file_attach (Dwfl *dwfl, Elf *core)
|
||||
const Ebl_Register_Location *reglocs;
|
||||
size_t nitems;
|
||||
const Ebl_Core_Item *items;
|
||||
- if (! ebl_core_note (ebl, &nhdr, name,
|
||||
+ if (! ebl_core_note (ebl, &nhdr, name, desc,
|
||||
®s_offset, &nregloc, ®locs, &nitems, &items))
|
||||
{
|
||||
/* This note may be just not recognized, skip it. */
|
||||
diff --git a/libebl/eblcorenote.c b/libebl/eblcorenote.c
|
||||
index 783f981..7fab397 100644
|
||||
--- a/libebl/eblcorenote.c
|
||||
+++ b/libebl/eblcorenote.c
|
||||
@@ -36,11 +36,13 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
+#include <string.h>
|
||||
#include <libeblP.h>
|
||||
|
||||
|
||||
int
|
||||
ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name,
|
||||
+ const char *desc,
|
||||
GElf_Word *regs_offset, size_t *nregloc,
|
||||
const Ebl_Register_Location **reglocs, size_t *nitems,
|
||||
const Ebl_Core_Item **items)
|
||||
@@ -51,28 +53,25 @@ ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name,
|
||||
{
|
||||
/* The machine specific function did not know this type. */
|
||||
|
||||
- *regs_offset = 0;
|
||||
- *nregloc = 0;
|
||||
- *reglocs = NULL;
|
||||
- switch (nhdr->n_type)
|
||||
+ /* NT_PLATFORM is kind of special since it needs a zero terminated
|
||||
+ string (other notes often have a fixed size string). */
|
||||
+ static const Ebl_Core_Item platform[] =
|
||||
{
|
||||
-#define ITEMS(type, table) \
|
||||
- case type: \
|
||||
- *items = table; \
|
||||
- *nitems = sizeof table / sizeof table[0]; \
|
||||
- result = 1; \
|
||||
- break
|
||||
+ {
|
||||
+ .name = "Platform",
|
||||
+ .type = ELF_T_BYTE, .count = 0, .format = 's'
|
||||
+ }
|
||||
+ };
|
||||
|
||||
- static const Ebl_Core_Item platform[] =
|
||||
- {
|
||||
- {
|
||||
- .name = "Platform",
|
||||
- .type = ELF_T_BYTE, .count = 0, .format = 's'
|
||||
- }
|
||||
- };
|
||||
- ITEMS (NT_PLATFORM, platform);
|
||||
-
|
||||
-#undef ITEMS
|
||||
+ if (nhdr->n_type == NT_PLATFORM
|
||||
+ && memchr (desc, '\0', nhdr->n_descsz) != NULL)
|
||||
+ {
|
||||
+ *regs_offset = 0;
|
||||
+ *nregloc = 0;
|
||||
+ *reglocs = NULL;
|
||||
+ *items = platform;
|
||||
+ *nitems = 1;
|
||||
+ result = 1;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/libebl/libebl.h b/libebl/libebl.h
|
||||
index ca9b9fe..24922eb 100644
|
||||
--- a/libebl/libebl.h
|
||||
+++ b/libebl/libebl.h
|
||||
@@ -319,7 +319,8 @@ typedef struct
|
||||
|
||||
/* Describe the format of a core file note with the given header and NAME.
|
||||
NAME is not guaranteed terminated, it's NHDR->n_namesz raw bytes. */
|
||||
-extern int ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr, const char *name,
|
||||
+extern int ebl_core_note (Ebl *ebl, const GElf_Nhdr *nhdr,
|
||||
+ const char *name, const char *desc,
|
||||
GElf_Word *regs_offset, size_t *nregloc,
|
||||
const Ebl_Register_Location **reglocs,
|
||||
size_t *nitems, const Ebl_Core_Item **items)
|
||||
diff --git a/src/readelf.c b/src/readelf.c
|
||||
index 3a73710..71651e0 100644
|
||||
--- a/src/readelf.c
|
||||
+++ b/src/readelf.c
|
||||
@@ -12153,7 +12153,7 @@ handle_core_note (Ebl *ebl, const GElf_Nhdr *nhdr,
|
||||
size_t nitems;
|
||||
const Ebl_Core_Item *items;
|
||||
|
||||
- if (! ebl_core_note (ebl, nhdr, name,
|
||||
+ if (! ebl_core_note (ebl, nhdr, name, desc,
|
||||
®s_offset, &nregloc, ®locs, &nitems, &items))
|
||||
return;
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -73,6 +73,7 @@ SRC_URI = "\
|
||||
${BACKPORTS} \
|
||||
"
|
||||
BACKPORTS = "\
|
||||
file://CVE-2019-14250.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "4ab282f414676496483b3e1793d07862"
|
||||
SRC_URI[sha256sum] = "196c3c04ba2613f893283977e6011b2345d1cd1af9abeac58e916b1aab3e0080"
|
||||
|
||||
44
meta/recipes-devtools/gcc/gcc-8.2/CVE-2019-14250.patch
Normal file
44
meta/recipes-devtools/gcc/gcc-8.2/CVE-2019-14250.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From a4f1b58eb48b349a5f353bc69c30be553506d33b Mon Sep 17 00:00:00 2001
|
||||
From: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
|
||||
Date: Thu, 25 Jul 2019 10:48:26 +0000
|
||||
Subject: [PATCH] 2019-07-25 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR lto/90924
|
||||
Backport from mainline
|
||||
2019-07-12 Ren Kimura <rkx1209dev@gmail.com>
|
||||
|
||||
* simple-object-elf.c (simple_object_elf_match): Check zero value
|
||||
shstrndx.
|
||||
|
||||
|
||||
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@273794 138bc75d-0d04-0410-961f-82ee72b054a4
|
||||
|
||||
Upstream-Status: Backport
|
||||
Affectes: < 9.2
|
||||
CVE: CVE-2019-14250
|
||||
Dropped changelog
|
||||
Signed-off-by: Armin Kuster <Akustre@mvista.com>
|
||||
|
||||
---
|
||||
libiberty/simple-object-elf.c | 8 ++++++++
|
||||
2 files changed, 17 insertions(+)
|
||||
|
||||
Index: gcc-8.2.0/libiberty/simple-object-elf.c
|
||||
===================================================================
|
||||
--- gcc-8.2.0.orig/libiberty/simple-object-elf.c
|
||||
+++ gcc-8.2.0/libiberty/simple-object-elf.c
|
||||
@@ -549,6 +549,14 @@ simple_object_elf_match (unsigned char h
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+ if (eor->shstrndx == 0)
|
||||
+ {
|
||||
+ *errmsg = "invalid ELF shstrndx == 0";
|
||||
+ *err = 0;
|
||||
+ XDELETE (eor);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
return (void *) eor;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
require go-common.inc
|
||||
|
||||
GO_BASEVERSION = "1.11"
|
||||
GO_MINOR = ".10"
|
||||
GO_MINOR = ".13"
|
||||
PV .= "${GO_MINOR}"
|
||||
FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
|
||||
|
||||
@@ -19,5 +19,5 @@ SRC_URI += "\
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
SRC_URI[main.md5sum] = "f2d2e44b9954b827daa8ad4d936a7a82"
|
||||
SRC_URI[main.sha256sum] = "df27e96a9d1d362c46ecd975f1faa56b8c300f5c529074e9ea79bdd885493c1b"
|
||||
SRC_URI[main.md5sum] = "32e71746981695517387a2149eb541ef"
|
||||
SRC_URI[main.sha256sum] = "5032095fd3f641cafcce164f551e5ae873785ce7b07ca7c143aecd18f7ba4076"
|
||||
|
||||
@@ -20,8 +20,6 @@ RPROVIDES_${PN} = "libjson"
|
||||
|
||||
inherit autotools
|
||||
|
||||
EXTRA_OECONF = "--enable-rdrand"
|
||||
|
||||
do_configure_prepend() {
|
||||
# Clean up autoconf cruft that should not be in the tarball
|
||||
rm -f ${S}/config.status
|
||||
|
||||
97
meta/recipes-devtools/libcomps/libcomps/CVE-2019-3817.patch
Normal file
97
meta/recipes-devtools/libcomps/libcomps/CVE-2019-3817.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From cea10cd1f2ef6bb4edaac0c1d46d47bf237c42b8 Mon Sep 17 00:00:00 2001
|
||||
From: Riccardo Schirone <rschiron@redhat.com>
|
||||
Date: Mon, 21 Jan 2019 18:11:42 +0100
|
||||
Subject: [PATCH] Fix UAF in comps_objmrtree_unite function
|
||||
|
||||
The added field is not used at all in many places and it is probably the
|
||||
left-over of some copy-paste.
|
||||
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/rpm-software-management/libcomps/commit
|
||||
/e3a5d056633677959ad924a51758876d415e7046]
|
||||
|
||||
CVE: CVE-2019-3817
|
||||
|
||||
Signed-off-by: Kevin Weng <t-keweng@microsoft.com>
|
||||
---
|
||||
libcomps/src/comps_mradix.c | 2 --
|
||||
libcomps/src/comps_objmradix.c | 2 --
|
||||
libcomps/src/comps_objradix.c | 2 --
|
||||
libcomps/src/comps_radix.c | 1 -
|
||||
4 files changed, 7 deletions(-)
|
||||
|
||||
diff --git a/libcomps/src/comps_mradix.c b/libcomps/src/comps_mradix.c
|
||||
index 338cb07..6ceb7c9 100644
|
||||
--- a/libcomps/src/comps_mradix.c
|
||||
+++ b/libcomps/src/comps_mradix.c
|
||||
@@ -177,7 +177,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
|
||||
struct Pair {
|
||||
COMPS_HSList * subnodes;
|
||||
char * key;
|
||||
- char added;
|
||||
} *pair, *parent_pair;
|
||||
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
@@ -195,7 +194,6 @@ void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) {
|
||||
parent_pair = (struct Pair*) it->data;
|
||||
free(it);
|
||||
|
||||
- pair->added = 0;
|
||||
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes;
|
||||
diff --git a/libcomps/src/comps_objmradix.c b/libcomps/src/comps_objmradix.c
|
||||
index 9be6648..8771c89 100644
|
||||
--- a/libcomps/src/comps_objmradix.c
|
||||
+++ b/libcomps/src/comps_objmradix.c
|
||||
@@ -285,7 +285,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
|
||||
struct Pair {
|
||||
COMPS_HSList * subnodes;
|
||||
char * key;
|
||||
- char added;
|
||||
} *pair, *parent_pair;
|
||||
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
@@ -303,7 +302,6 @@ void comps_objmrtree_unite(COMPS_ObjMRTree *rt1, COMPS_ObjMRTree *rt2) {
|
||||
parent_pair = (struct Pair*) it->data;
|
||||
free(it);
|
||||
|
||||
- pair->added = 0;
|
||||
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
pair->subnodes = ((COMPS_ObjMRTreeData*)it->data)->subnodes;
|
||||
diff --git a/libcomps/src/comps_objradix.c b/libcomps/src/comps_objradix.c
|
||||
index a790270..0ebaf22 100644
|
||||
--- a/libcomps/src/comps_objradix.c
|
||||
+++ b/libcomps/src/comps_objradix.c
|
||||
@@ -692,7 +692,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
|
||||
struct Pair {
|
||||
COMPS_HSList * subnodes;
|
||||
char * key;
|
||||
- char added;
|
||||
} *pair, *parent_pair;
|
||||
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
@@ -711,7 +710,6 @@ void comps_objrtree_unite(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2) {
|
||||
//printf("key-part:%s\n", parent_pair->key);
|
||||
free(it);
|
||||
|
||||
- //pair->added = 0;
|
||||
for (it = tmp_subnodes->first; it != NULL; it=it->next) {
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
pair->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes;
|
||||
diff --git a/libcomps/src/comps_radix.c b/libcomps/src/comps_radix.c
|
||||
index ada4fda..05dcaf2 100644
|
||||
--- a/libcomps/src/comps_radix.c
|
||||
+++ b/libcomps/src/comps_radix.c
|
||||
@@ -529,7 +529,6 @@ void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) {
|
||||
struct Pair {
|
||||
COMPS_HSList * subnodes;
|
||||
char * key;
|
||||
- char added;
|
||||
} *pair, *parent_pair;
|
||||
|
||||
pair = malloc(sizeof(struct Pair));
|
||||
--
|
||||
2.22.0
|
||||
|
||||
@@ -6,6 +6,7 @@ SRC_URI = "git://github.com/rpm-software-management/libcomps.git \
|
||||
file://0001-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \
|
||||
file://0002-Set-library-installation-path-correctly.patch \
|
||||
file://0001-Make-__comps_objmrtree_all-static-inline.patch \
|
||||
file://CVE-2019-3817.patch \
|
||||
"
|
||||
|
||||
PV = "0.1.8+git${SRCPV}"
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
From 7f770b9c20da1a192dad8cb572a6391f2773285a Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Thu, 3 May 2018 14:31:55 +0200
|
||||
Subject: [PATCH 1/2] Don't leak temporary file on failed ed-style patch
|
||||
|
||||
Now that we write ed-style patches to a temporary file before we
|
||||
apply them, we need to ensure that the temporary file is removed
|
||||
before we leave, even on fatal error.
|
||||
|
||||
* src/pch.c (do_ed_script): Use global TMPEDNAME instead of local
|
||||
tmpname. Don't unlink the file directly, instead tag it for removal
|
||||
at exit time.
|
||||
* src/patch.c (cleanup): Unlink TMPEDNAME at exit.
|
||||
|
||||
This closes bug #53820:
|
||||
https://savannah.gnu.org/bugs/index.php?53820
|
||||
|
||||
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
|
||||
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=19599883ffb6a450d2884f081f8ecf68edbed7ee]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
src/common.h | 2 ++
|
||||
src/pch.c | 12 +++++-------
|
||||
2 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/common.h b/src/common.h
|
||||
index ec50b40..22238b5 100644
|
||||
--- a/src/common.h
|
||||
+++ b/src/common.h
|
||||
@@ -94,10 +94,12 @@ XTERN char const *origsuff;
|
||||
XTERN char const * TMPINNAME;
|
||||
XTERN char const * TMPOUTNAME;
|
||||
XTERN char const * TMPPATNAME;
|
||||
+XTERN char const * TMPEDNAME;
|
||||
|
||||
XTERN bool TMPINNAME_needs_removal;
|
||||
XTERN bool TMPOUTNAME_needs_removal;
|
||||
XTERN bool TMPPATNAME_needs_removal;
|
||||
+XTERN bool TMPEDNAME_needs_removal;
|
||||
|
||||
#ifdef DEBUGGING
|
||||
XTERN int debug;
|
||||
diff --git a/src/pch.c b/src/pch.c
|
||||
index 16e001a..c1a62cf 100644
|
||||
--- a/src/pch.c
|
||||
+++ b/src/pch.c
|
||||
@@ -2392,7 +2392,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
file_offset beginning_of_this_line;
|
||||
size_t chars_read;
|
||||
FILE *tmpfp = 0;
|
||||
- char const *tmpname;
|
||||
int tmpfd;
|
||||
pid_t pid;
|
||||
|
||||
@@ -2404,12 +2403,13 @@ do_ed_script (char const *inname, char const *outname,
|
||||
invalid commands and treats the next line as a new command, which
|
||||
can lead to arbitrary command execution. */
|
||||
|
||||
- tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
|
||||
+ tmpfd = make_tempfile (&TMPEDNAME, 'e', NULL, O_RDWR | O_BINARY, 0);
|
||||
if (tmpfd == -1)
|
||||
- pfatal ("Can't create temporary file %s", quotearg (tmpname));
|
||||
+ pfatal ("Can't create temporary file %s", quotearg (TMPEDNAME));
|
||||
+ TMPEDNAME_needs_removal = true;
|
||||
tmpfp = fdopen (tmpfd, "w+b");
|
||||
if (! tmpfp)
|
||||
- pfatal ("Can't open stream for file %s", quotearg (tmpname));
|
||||
+ pfatal ("Can't open stream for file %s", quotearg (TMPEDNAME));
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
@@ -2449,8 +2449,7 @@ do_ed_script (char const *inname, char const *outname,
|
||||
write_fatal ();
|
||||
|
||||
if (lseek (tmpfd, 0, SEEK_SET) == -1)
|
||||
- pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
|
||||
-
|
||||
+ pfatal ("Can't rewind to the beginning of file %s", quotearg (TMPEDNAME));
|
||||
if (! dry_run && ! skip_rest_of_patch) {
|
||||
int exclusive = *outname_needs_removal ? 0 : O_EXCL;
|
||||
*outname_needs_removal = true;
|
||||
@@ -2482,7 +2481,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
}
|
||||
|
||||
fclose (tmpfp);
|
||||
- safe_unlink (tmpname);
|
||||
|
||||
if (ofp)
|
||||
{
|
||||
--
|
||||
2.17.0
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
From 369dcccdfa6336e5a873d6d63705cfbe04c55727 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Mon, 7 May 2018 15:14:45 +0200
|
||||
Subject: Don't leak temporary file on failed multi-file ed-style patch
|
||||
|
||||
The previous fix worked fine with single-file ed-style patches, but
|
||||
would still leak temporary files in the case of multi-file ed-style
|
||||
patch. Fix that case as well, and extend the test case to check for
|
||||
it.
|
||||
|
||||
* src/patch.c (main): Unlink TMPEDNAME if needed before moving to
|
||||
the next file in a patch.
|
||||
|
||||
This closes bug #53820:
|
||||
https://savannah.gnu.org/bugs/index.php?53820
|
||||
|
||||
Fixes: 123eaff0d5d1 ("Fix arbitrary command execution in ed-style patches (CVE-2018-1000156)")
|
||||
Fixes: 19599883ffb6 ("Don't leak temporary file on failed ed-style patch")
|
||||
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/patch.git/commit/?id=369dcccdfa6336e5a873d6d63705cfbe04c55727]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
src/patch.c | 1 +
|
||||
tests/ed-style | 31 +++++++++++++++++++++++++++++++
|
||||
2 files changed, 32 insertions(+)
|
||||
|
||||
diff --git a/src/patch.c b/src/patch.c
|
||||
index 9146597..81c7a02 100644
|
||||
--- a/src/patch.c
|
||||
+++ b/src/patch.c
|
||||
@@ -236,6 +236,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
|
||||
}
|
||||
+ remove_if_needed (TMPEDNAME, &TMPEDNAME_needs_removal);
|
||||
|
||||
if (! skip_rest_of_patch && ! file_type)
|
||||
{
|
||||
diff --git a/tests/ed-style b/tests/ed-style
|
||||
index 6b6ef9d..504e6e5 100644
|
||||
--- a/tests/ed-style
|
||||
+++ b/tests/ed-style
|
||||
@@ -38,3 +38,34 @@ EOF
|
||||
check 'cat foo' <<EOF
|
||||
foo
|
||||
EOF
|
||||
+
|
||||
+# Test the case where one ed-style patch modifies several files
|
||||
+
|
||||
+cat > ed3.diff <<EOF
|
||||
+--- foo
|
||||
++++ foo
|
||||
+1c
|
||||
+bar
|
||||
+.
|
||||
+--- baz
|
||||
++++ baz
|
||||
+0a
|
||||
+baz
|
||||
+.
|
||||
+EOF
|
||||
+
|
||||
+# Apparently we can't create a file with such a patch, while it works fine
|
||||
+# when the file name is provided on the command line
|
||||
+cat > baz <<EOF
|
||||
+EOF
|
||||
+
|
||||
+check 'patch -e -i ed3.diff' <<EOF
|
||||
+EOF
|
||||
+
|
||||
+check 'cat foo' <<EOF
|
||||
+bar
|
||||
+EOF
|
||||
+
|
||||
+check 'cat baz' <<EOF
|
||||
+baz
|
||||
+EOF
|
||||
--
|
||||
cgit v1.0-41-gc330
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Gruenbacher <agruen@gnu.org>
|
||||
Date: Fri, 6 Apr 2018 19:36:15 +0200
|
||||
Subject: [PATCH] Invoke ed directly instead of using the shell
|
||||
|
||||
* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell
|
||||
command to avoid quoting vulnerabilities.
|
||||
|
||||
CVE: CVE-2019-13638
|
||||
Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=3fcd042d26d70856e826a42b5f93dc4854d80bf0]
|
||||
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
|
||||
|
||||
---
|
||||
src/pch.c | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
|
||||
diff --git a/src/pch.c b/src/pch.c
|
||||
index 4fd5a05..16e001a 100644
|
||||
--- a/src/pch.c
|
||||
+++ b/src/pch.c
|
||||
@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname,
|
||||
*outname_needs_removal = true;
|
||||
copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
|
||||
}
|
||||
- sprintf (buf, "%s %s%s", editor_program,
|
||||
- verbosity == VERBOSE ? "" : "- ",
|
||||
- outname);
|
||||
fflush (stdout);
|
||||
|
||||
pid = fork();
|
||||
@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname,
|
||||
else if (pid == 0)
|
||||
{
|
||||
dup2 (tmpfd, 0);
|
||||
- execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
|
||||
+ assert (outname[0] != '!' && outname[0] != '-');
|
||||
+ execlp (editor_program, editor_program, "-", outname, (char *) NULL);
|
||||
_exit (2);
|
||||
}
|
||||
else
|
||||
--
|
||||
2.7.4
|
||||
|
||||
113
meta/recipes-devtools/patch/patch/CVE-2019-13636.patch
Normal file
113
meta/recipes-devtools/patch/patch/CVE-2019-13636.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Gruenbacher <agruen@gnu.org>
|
||||
Date: Mon, 15 Jul 2019 16:21:48 +0200
|
||||
Subject: Don't follow symlinks unless --follow-symlinks is given
|
||||
|
||||
* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
|
||||
append_to_file): Unless the --follow-symlinks option is given, open files with
|
||||
the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing
|
||||
that consistently for input files.
|
||||
* src/util.c (create_backup): When creating empty backup files, (re)create them
|
||||
with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
|
||||
|
||||
CVE: CVE-2019-13636
|
||||
Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=dce4683cbbe107a95f1f0d45fabc304acfb5d71a]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
|
||||
---
|
||||
src/inp.c | 12 ++++++++++--
|
||||
src/util.c | 14 +++++++++++---
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/inp.c b/src/inp.c
|
||||
index 32d0919..22d7473 100644
|
||||
--- a/src/inp.c
|
||||
+++ b/src/inp.c
|
||||
@@ -238,8 +238,13 @@ plan_a (char const *filename)
|
||||
{
|
||||
if (S_ISREG (instat.st_mode))
|
||||
{
|
||||
- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
|
||||
+ int flags = O_RDONLY | binary_transput;
|
||||
size_t buffered = 0, n;
|
||||
+ int ifd;
|
||||
+
|
||||
+ if (! follow_symlinks)
|
||||
+ flags |= O_NOFOLLOW;
|
||||
+ ifd = safe_open (filename, flags, 0);
|
||||
if (ifd < 0)
|
||||
pfatal ("can't open file %s", quotearg (filename));
|
||||
|
||||
@@ -340,6 +345,7 @@ plan_a (char const *filename)
|
||||
static void
|
||||
plan_b (char const *filename)
|
||||
{
|
||||
+ int flags = O_RDONLY | binary_transput;
|
||||
int ifd;
|
||||
FILE *ifp;
|
||||
int c;
|
||||
@@ -353,7 +359,9 @@ plan_b (char const *filename)
|
||||
|
||||
if (instat.st_size == 0)
|
||||
filename = NULL_DEVICE;
|
||||
- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
|
||||
+ if (! follow_symlinks)
|
||||
+ flags |= O_NOFOLLOW;
|
||||
+ if ((ifd = safe_open (filename, flags, 0)) < 0
|
||||
|| ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
|
||||
pfatal ("Can't open file %s", quotearg (filename));
|
||||
if (TMPINNAME_needs_removal)
|
||||
diff --git a/src/util.c b/src/util.c
|
||||
index 1cc08ba..fb38307 100644
|
||||
--- a/src/util.c
|
||||
+++ b/src/util.c
|
||||
@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
|
||||
|
||||
try_makedirs_errno = ENOENT;
|
||||
safe_unlink (bakname);
|
||||
- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
|
||||
+ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0)
|
||||
{
|
||||
if (errno != try_makedirs_errno)
|
||||
pfatal ("Can't create file %s", quotearg (bakname));
|
||||
@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode,
|
||||
static void
|
||||
copy_to_fd (const char *from, int tofd)
|
||||
{
|
||||
+ int from_flags = O_RDONLY | O_BINARY;
|
||||
int fromfd;
|
||||
ssize_t i;
|
||||
|
||||
- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
|
||||
+ if (! follow_symlinks)
|
||||
+ from_flags |= O_NOFOLLOW;
|
||||
+ if ((fromfd = safe_open (from, from_flags, 0)) < 0)
|
||||
pfatal ("Can't reopen file %s", quotearg (from));
|
||||
while ((i = read (fromfd, buf, bufsize)) != 0)
|
||||
{
|
||||
@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost,
|
||||
else
|
||||
{
|
||||
assert (S_ISREG (mode));
|
||||
+ if (! follow_symlinks)
|
||||
+ to_flags |= O_NOFOLLOW;
|
||||
tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode,
|
||||
to_dir_known_to_exist);
|
||||
copy_to_fd (from, tofd);
|
||||
@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost,
|
||||
void
|
||||
append_to_file (char const *from, char const *to)
|
||||
{
|
||||
+ int to_flags = O_WRONLY | O_APPEND | O_BINARY;
|
||||
int tofd;
|
||||
|
||||
- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
|
||||
+ if (! follow_symlinks)
|
||||
+ to_flags |= O_NOFOLLOW;
|
||||
+ if ((tofd = safe_open (to, to_flags, 0)) < 0)
|
||||
pfatal ("Can't reopen file %s", quotearg (to));
|
||||
copy_to_fd (from, tofd);
|
||||
if (close (tofd) != 0)
|
||||
--
|
||||
cgit v1.0-41-gc330
|
||||
|
||||
@@ -6,6 +6,10 @@ SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
|
||||
file://0003-Allow-input-files-to-be-missing-for-ed-style-patches.patch \
|
||||
file://0004-Fix-arbitrary-command-execution-in-ed-style-patches-.patch \
|
||||
file://0001-Fix-swapping-fake-lines-in-pch_swap.patch \
|
||||
file://CVE-2019-13636.patch \
|
||||
file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \
|
||||
file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \
|
||||
file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600"
|
||||
|
||||
183
meta/recipes-devtools/perl/perl/CVE-2018-18311.patch
Normal file
183
meta/recipes-devtools/perl/perl/CVE-2018-18311.patch
Normal file
@@ -0,0 +1,183 @@
|
||||
From 4706b65d7c835c0bb219db160fbcdbcd98efab2d Mon Sep 17 00:00:00 2001
|
||||
From: David Mitchell <davem@iabyn.com>
|
||||
Date: Fri, 29 Jun 2018 13:37:03 +0100
|
||||
Subject: [PATCH] Perl_my_setenv(); handle integer wrap
|
||||
|
||||
RT #133204
|
||||
|
||||
Wean this function off int/I32 and onto UV/Size_t.
|
||||
Also, replace all malloc-ish calls with a wrapper that does
|
||||
overflow checks,
|
||||
|
||||
In particular, it was doing (nlen + vlen + 2) which could wrap when
|
||||
the combined length of the environment variable name and value
|
||||
exceeded around 0x7fffffff.
|
||||
|
||||
The wrapper check function is probably overkill, but belt and braces...
|
||||
|
||||
NB this function has several variant parts, #ifdef'ed by platform
|
||||
type; I have blindly changed the parts that aren't compiled under linux.
|
||||
|
||||
(cherry picked from commit 34716e2a6ee2af96078d62b065b7785c001194be)
|
||||
|
||||
CVE: CVE-2018-18311
|
||||
Upstream-Status: Backport
|
||||
[https://perl5.git.perl.org/perl.git/commit/5737d31aac51360cc1eb412ef059e36147c9d6d6]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
util.c | 76 ++++++++++++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 53 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/util.c b/util.c
|
||||
index 7c3d271f51..27f4eddf3b 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -2160,8 +2160,40 @@ Perl_new_warnings_bitfield(pTHX_ STRLEN *buffer, const char *const bits,
|
||||
*(s+(nlen+1+vlen)) = '\0'
|
||||
|
||||
#ifdef USE_ENVIRON_ARRAY
|
||||
- /* VMS' my_setenv() is in vms.c */
|
||||
+
|
||||
+/* small wrapper for use by Perl_my_setenv that mallocs, or reallocs if
|
||||
+ * 'current' is non-null, with up to three sizes that are added together.
|
||||
+ * It handles integer overflow.
|
||||
+ */
|
||||
+static char *
|
||||
+S_env_alloc(void *current, Size_t l1, Size_t l2, Size_t l3, Size_t size)
|
||||
+{
|
||||
+ void *p;
|
||||
+ Size_t sl, l = l1 + l2;
|
||||
+
|
||||
+ if (l < l2)
|
||||
+ goto panic;
|
||||
+ l += l3;
|
||||
+ if (l < l3)
|
||||
+ goto panic;
|
||||
+ sl = l * size;
|
||||
+ if (sl < l)
|
||||
+ goto panic;
|
||||
+
|
||||
+ p = current
|
||||
+ ? safesysrealloc(current, sl)
|
||||
+ : safesysmalloc(sl);
|
||||
+ if (p)
|
||||
+ return (char*)p;
|
||||
+
|
||||
+ panic:
|
||||
+ croak_memory_wrap();
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* VMS' my_setenv() is in vms.c */
|
||||
#if !defined(WIN32) && !defined(NETWARE)
|
||||
+
|
||||
void
|
||||
Perl_my_setenv(pTHX_ const char *nam, const char *val)
|
||||
{
|
||||
@@ -2177,28 +2209,27 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
|
||||
#ifndef PERL_USE_SAFE_PUTENV
|
||||
if (!PL_use_safe_putenv) {
|
||||
/* most putenv()s leak, so we manipulate environ directly */
|
||||
- I32 i;
|
||||
- const I32 len = strlen(nam);
|
||||
- int nlen, vlen;
|
||||
+ UV i;
|
||||
+ Size_t vlen, nlen = strlen(nam);
|
||||
|
||||
/* where does it go? */
|
||||
for (i = 0; environ[i]; i++) {
|
||||
- if (strnEQ(environ[i],nam,len) && environ[i][len] == '=')
|
||||
+ if (strnEQ(environ[i], nam, nlen) && environ[i][nlen] == '=')
|
||||
break;
|
||||
}
|
||||
|
||||
if (environ == PL_origenviron) { /* need we copy environment? */
|
||||
- I32 j;
|
||||
- I32 max;
|
||||
+ UV j, max;
|
||||
char **tmpenv;
|
||||
|
||||
max = i;
|
||||
while (environ[max])
|
||||
max++;
|
||||
- tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*));
|
||||
+ /* XXX shouldn't that be max+1 rather than max+2 ??? - DAPM */
|
||||
+ tmpenv = (char**)S_env_alloc(NULL, max, 2, 0, sizeof(char*));
|
||||
for (j=0; j<max; j++) { /* copy environment */
|
||||
- const int len = strlen(environ[j]);
|
||||
- tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char));
|
||||
+ const Size_t len = strlen(environ[j]);
|
||||
+ tmpenv[j] = S_env_alloc(NULL, len, 1, 0, 1);
|
||||
Copy(environ[j], tmpenv[j], len+1, char);
|
||||
}
|
||||
tmpenv[max] = NULL;
|
||||
@@ -2217,15 +2248,15 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
|
||||
#endif
|
||||
}
|
||||
if (!environ[i]) { /* does not exist yet */
|
||||
- environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*));
|
||||
+ environ = (char**)S_env_alloc(environ, i, 2, 0, sizeof(char*));
|
||||
environ[i+1] = NULL; /* make sure it's null terminated */
|
||||
}
|
||||
else
|
||||
safesysfree(environ[i]);
|
||||
- nlen = strlen(nam);
|
||||
+
|
||||
vlen = strlen(val);
|
||||
|
||||
- environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char));
|
||||
+ environ[i] = S_env_alloc(NULL, nlen, vlen, 2, 1);
|
||||
/* all that work just for this */
|
||||
my_setenv_format(environ[i], nam, nlen, val, vlen);
|
||||
} else {
|
||||
@@ -2250,22 +2281,21 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
|
||||
if (environ) /* old glibc can crash with null environ */
|
||||
(void)unsetenv(nam);
|
||||
} else {
|
||||
- const int nlen = strlen(nam);
|
||||
- const int vlen = strlen(val);
|
||||
- char * const new_env =
|
||||
- (char*)safesysmalloc((nlen + vlen + 2) * sizeof(char));
|
||||
+ const Size_t nlen = strlen(nam);
|
||||
+ const Size_t vlen = strlen(val);
|
||||
+ char * const new_env = S_env_alloc(NULL, nlen, vlen, 2, 1);
|
||||
my_setenv_format(new_env, nam, nlen, val, vlen);
|
||||
(void)putenv(new_env);
|
||||
}
|
||||
# else /* ! HAS_UNSETENV */
|
||||
char *new_env;
|
||||
- const int nlen = strlen(nam);
|
||||
- int vlen;
|
||||
+ const Size_t nlen = strlen(nam);
|
||||
+ Size_t vlen;
|
||||
if (!val) {
|
||||
val = "";
|
||||
}
|
||||
vlen = strlen(val);
|
||||
- new_env = (char*)safesysmalloc((nlen + vlen + 2) * sizeof(char));
|
||||
+ new_env = S_env_alloc(NULL, nlen, vlen, 2, 1);
|
||||
/* all that work just for this */
|
||||
my_setenv_format(new_env, nam, nlen, val, vlen);
|
||||
(void)putenv(new_env);
|
||||
@@ -2288,14 +2318,14 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
|
||||
{
|
||||
dVAR;
|
||||
char *envstr;
|
||||
- const int nlen = strlen(nam);
|
||||
- int vlen;
|
||||
+ const Size_t nlen = strlen(nam);
|
||||
+ Size_t vlen;
|
||||
|
||||
if (!val) {
|
||||
val = "";
|
||||
}
|
||||
vlen = strlen(val);
|
||||
- Newx(envstr, nlen+vlen+2, char);
|
||||
+ envstr = S_env_alloc(NULL, nlen, vlen, 2, 1);
|
||||
my_setenv_format(envstr, nam, nlen, val, vlen);
|
||||
(void)PerlEnv_putenv(envstr);
|
||||
Safefree(envstr);
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
BIN
meta/recipes-devtools/perl/perl/CVE-2018-18312.patch
Normal file
BIN
meta/recipes-devtools/perl/perl/CVE-2018-18312.patch
Normal file
Binary file not shown.
60
meta/recipes-devtools/perl/perl/CVE-2018-18313.patch
Normal file
60
meta/recipes-devtools/perl/perl/CVE-2018-18313.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
From 3458f6115ca8e8d11779948c12b7e1cc5803358c Mon Sep 17 00:00:00 2001
|
||||
From: Karl Williamson <khw@cpan.org>
|
||||
Date: Sat, 25 Mar 2017 15:00:22 -0600
|
||||
Subject: [PATCH 2/3] regcomp.c: Convert some strchr to memchr
|
||||
|
||||
This allows things to work properly in the face of embedded NULs.
|
||||
See the branch merge message for more information.
|
||||
|
||||
(cherry picked from commit 43b2f4ef399e2fd7240b4eeb0658686ad95f8e62)
|
||||
|
||||
CVE: CVE-2018-18313
|
||||
Upstream-Status: Backport
|
||||
[https://perl5.git.perl.org/perl.git/commit/c1c28ce6ba90ee05aa96b11ad551a6063680f3b9]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
regcomp.c | 13 ++++++++-----
|
||||
1 file changed, 8 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/regcomp.c b/regcomp.c
|
||||
index 00d26d9290..2688979882 100644
|
||||
--- a/regcomp.c
|
||||
+++ b/regcomp.c
|
||||
@@ -11783,8 +11783,9 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
|
||||
|
||||
RExC_parse++; /* Skip past the '{' */
|
||||
|
||||
- if (! (endbrace = strchr(RExC_parse, '}')) /* no trailing brace */
|
||||
- || ! (endbrace == RExC_parse /* nothing between the {} */
|
||||
+ endbrace = (char *) memchr(RExC_parse, '}', RExC_end - RExC_parse);
|
||||
+ if ((! endbrace) /* no trailing brace */
|
||||
+ || ! (endbrace == RExC_parse /* nothing between the {} */
|
||||
|| (endbrace - RExC_parse >= 2 /* U+ (bad hex is checked... */
|
||||
&& strnEQ(RExC_parse, "U+", 2)))) /* ... below for a better
|
||||
error msg) */
|
||||
@@ -12483,9 +12484,11 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
else {
|
||||
STRLEN length;
|
||||
char name = *RExC_parse;
|
||||
- char * endbrace;
|
||||
+ char * endbrace = NULL;
|
||||
RExC_parse += 2;
|
||||
- endbrace = strchr(RExC_parse, '}');
|
||||
+ if (RExC_parse < RExC_end) {
|
||||
+ endbrace = (char *) memchr(RExC_parse, '}', RExC_end - RExC_parse);
|
||||
+ }
|
||||
|
||||
if (! endbrace) {
|
||||
vFAIL2("Missing right brace on \\%c{}", name);
|
||||
@@ -15939,7 +15942,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
|
||||
vFAIL2("Empty \\%c", (U8)value);
|
||||
if (*RExC_parse == '{') {
|
||||
const U8 c = (U8)value;
|
||||
- e = strchr(RExC_parse, '}');
|
||||
+ e = (char *) memchr(RExC_parse, '}', RExC_end - RExC_parse);
|
||||
if (!e) {
|
||||
RExC_parse++;
|
||||
vFAIL2("Missing right brace on \\%c{}", c);
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
271
meta/recipes-devtools/perl/perl/CVE-2018-18314.patch
Normal file
271
meta/recipes-devtools/perl/perl/CVE-2018-18314.patch
Normal file
@@ -0,0 +1,271 @@
|
||||
From 6a2d07f43ae7cfcb2eb30cf39751f2f7fed7ecc1 Mon Sep 17 00:00:00 2001
|
||||
From: Yves Orton <demerphq@gmail.com>
|
||||
Date: Mon, 26 Jun 2017 13:19:55 +0200
|
||||
Subject: [PATCH 3/3] fix #131649 - extended charclass can trigger assert
|
||||
|
||||
The extended charclass parser makes some assumptions during the
|
||||
first pass which are only true on well structured input, and it
|
||||
does not properly catch various errors. later on the code assumes
|
||||
that things the first pass will let through are valid, when in
|
||||
fact they should trigger errors.
|
||||
|
||||
(cherry picked from commit 19a498a461d7c81ae3507c450953d1148efecf4f)
|
||||
|
||||
CVE: CVE-2018-18314
|
||||
Upstream-Status: Backport
|
||||
[https://perl5.git.perl.org/perl.git/commit/dabe076af345ab4512ea80245b4e4cd7ec0996cd]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
pod/perldiag.pod | 27 ++++++++++++++++++++++++++-
|
||||
pod/perlrecharclass.pod | 4 ++--
|
||||
regcomp.c | 23 +++++++++++++----------
|
||||
t/lib/warnings/regcomp | 6 +++---
|
||||
t/re/reg_mesg.t | 29 ++++++++++++++++-------------
|
||||
t/re/regex_sets.t | 6 +++---
|
||||
6 files changed, 63 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
|
||||
index 737d3633f6..644b814008 100644
|
||||
--- a/pod/perldiag.pod
|
||||
+++ b/pod/perldiag.pod
|
||||
@@ -5777,7 +5777,7 @@ yourself.
|
||||
a perl4 interpreter, especially if the next 2 tokens are "use strict"
|
||||
or "my $var" or "our $var".
|
||||
|
||||
-=item Syntax error in (?[...]) in regex m/%s/
|
||||
+=item Syntax error in (?[...]) in regex; marked by <-- HERE in m/%s/
|
||||
|
||||
(F) Perl could not figure out what you meant inside this construct; this
|
||||
notifies you that it is giving up trying.
|
||||
@@ -6153,6 +6153,31 @@ for example,
|
||||
(F) The unexec() routine failed for some reason. See your local FSF
|
||||
representative, who probably put it there in the first place.
|
||||
|
||||
+=item Unexpected ']' with no following ')' in (?[... in regex; marked by <-- HERE in m/%s/
|
||||
+
|
||||
+(F) While parsing an extended character class a ']' character was encountered
|
||||
+at a point in the definition where the only legal use of ']' is to close the
|
||||
+character class definition as part of a '])', you may have forgotten the close
|
||||
+paren, or otherwise confused the parser.
|
||||
+
|
||||
+=item Expecting close paren for nested extended charclass in regex; marked by <-- HERE in m/%s/
|
||||
+
|
||||
+(F) While parsing a nested extended character class like:
|
||||
+
|
||||
+ (?[ ... (?flags:(?[ ... ])) ... ])
|
||||
+ ^
|
||||
+
|
||||
+we expected to see a close paren ')' (marked by ^) but did not.
|
||||
+
|
||||
+=item Expecting close paren for wrapper for nested extended charclass in regex; marked by <-- HERE in m/%s/
|
||||
+
|
||||
+(F) While parsing a nested extended character class like:
|
||||
+
|
||||
+ (?[ ... (?flags:(?[ ... ])) ... ])
|
||||
+ ^
|
||||
+
|
||||
+we expected to see a close paren ')' (marked by ^) but did not.
|
||||
+
|
||||
=item Unexpected binary operator '%c' with no preceding operand in regex;
|
||||
marked by S<<-- HERE> in m/%s/
|
||||
|
||||
diff --git a/pod/perlrecharclass.pod b/pod/perlrecharclass.pod
|
||||
index 89f4a7ef3f..a557cc0384 100644
|
||||
--- a/pod/perlrecharclass.pod
|
||||
+++ b/pod/perlrecharclass.pod
|
||||
@@ -1101,8 +1101,8 @@ hence both of the following work:
|
||||
Any contained POSIX character classes, including things like C<\w> and C<\D>
|
||||
respect the C<E<sol>a> (and C<E<sol>aa>) modifiers.
|
||||
|
||||
-C<< (?[ ]) >> is a regex-compile-time construct. Any attempt to use
|
||||
-something which isn't knowable at the time the containing regular
|
||||
+Note that C<< (?[ ]) >> is a regex-compile-time construct. Any attempt
|
||||
+to use something which isn't knowable at the time the containing regular
|
||||
expression is compiled is a fatal error. In practice, this means
|
||||
just three limitations:
|
||||
|
||||
diff --git a/regcomp.c b/regcomp.c
|
||||
index 2688979882..cb8409ed27 100644
|
||||
--- a/regcomp.c
|
||||
+++ b/regcomp.c
|
||||
@@ -14609,8 +14609,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
|
||||
TRUE /* Force /x */ );
|
||||
|
||||
switch (*RExC_parse) {
|
||||
- case '?':
|
||||
- if (RExC_parse[1] == '[') depth++, RExC_parse++;
|
||||
+ case '(':
|
||||
+ if (RExC_parse[1] == '?' && RExC_parse[2] == '[')
|
||||
+ depth++, RExC_parse+=2;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
break;
|
||||
@@ -14667,9 +14668,9 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
|
||||
}
|
||||
|
||||
case ']':
|
||||
- if (depth--) break;
|
||||
- RExC_parse++;
|
||||
- if (*RExC_parse == ')') {
|
||||
+ if (RExC_parse[1] == ')') {
|
||||
+ RExC_parse++;
|
||||
+ if (depth--) break;
|
||||
node = reganode(pRExC_state, ANYOF, 0);
|
||||
RExC_size += ANYOF_SKIP;
|
||||
nextchar(pRExC_state);
|
||||
@@ -14681,20 +14682,20 @@ S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist,
|
||||
|
||||
return node;
|
||||
}
|
||||
- goto no_close;
|
||||
+ RExC_parse++;
|
||||
+ vFAIL("Unexpected ']' with no following ')' in (?[...");
|
||||
}
|
||||
|
||||
RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1;
|
||||
}
|
||||
|
||||
- no_close:
|
||||
/* We output the messages even if warnings are off, because we'll fail
|
||||
* the very next thing, and these give a likely diagnosis for that */
|
||||
if (posix_warnings && av_tindex_nomg(posix_warnings) >= 0) {
|
||||
output_or_return_posix_warnings(pRExC_state, posix_warnings, NULL);
|
||||
}
|
||||
|
||||
- FAIL("Syntax error in (?[...])");
|
||||
+ vFAIL("Syntax error in (?[...])");
|
||||
}
|
||||
|
||||
/* Pass 2 only after this. */
|
||||
@@ -14868,12 +14869,14 @@ redo_curchar:
|
||||
* inversion list, and RExC_parse points to the trailing
|
||||
* ']'; the next character should be the ')' */
|
||||
RExC_parse++;
|
||||
- assert(UCHARAT(RExC_parse) == ')');
|
||||
+ if (UCHARAT(RExC_parse) != ')')
|
||||
+ vFAIL("Expecting close paren for nested extended charclass");
|
||||
|
||||
/* Then the ')' matching the original '(' handled by this
|
||||
* case: statement */
|
||||
RExC_parse++;
|
||||
- assert(UCHARAT(RExC_parse) == ')');
|
||||
+ if (UCHARAT(RExC_parse) != ')')
|
||||
+ vFAIL("Expecting close paren for wrapper for nested extended charclass");
|
||||
|
||||
RExC_flags = save_flags;
|
||||
goto handle_operand;
|
||||
diff --git a/t/lib/warnings/regcomp b/t/lib/warnings/regcomp
|
||||
index 08cb27b00f..367276d0fc 100644
|
||||
--- a/t/lib/warnings/regcomp
|
||||
+++ b/t/lib/warnings/regcomp
|
||||
@@ -59,21 +59,21 @@ Unmatched [ in regex; marked by <-- HERE in m/abc[ <-- HERE fi[.00./ at - line
|
||||
qr/(?[[[:word]]])/;
|
||||
EXPECT
|
||||
Assuming NOT a POSIX class since there is no terminating ':' in regex; marked by <-- HERE in m/(?[[[:word <-- HERE ]]])/ at - line 2.
|
||||
-syntax error in (?[...]) in regex m/(?[[[:word]]])/ at - line 2.
|
||||
+Unexpected ']' with no following ')' in (?[... in regex; marked by <-- HERE in m/(?[[[:word]] <-- HERE ])/ at - line 2.
|
||||
########
|
||||
# NAME qr/(?[ [[:digit: ])/
|
||||
# OPTION fatal
|
||||
qr/(?[[[:digit: ])/;
|
||||
EXPECT
|
||||
Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[[:digit: ] <-- HERE )/ at - line 2.
|
||||
-syntax error in (?[...]) in regex m/(?[[[:digit: ])/ at - line 2.
|
||||
+syntax error in (?[...]) in regex; marked by <-- HERE in m/(?[[[:digit: ]) <-- HERE / at - line 2.
|
||||
########
|
||||
# NAME qr/(?[ [:digit: ])/
|
||||
# OPTION fatal
|
||||
qr/(?[[:digit: ])/
|
||||
EXPECT
|
||||
Assuming NOT a POSIX class since no blanks are allowed in one in regex; marked by <-- HERE in m/(?[[:digit: ] <-- HERE )/ at - line 2.
|
||||
-syntax error in (?[...]) in regex m/(?[[:digit: ])/ at - line 2.
|
||||
+syntax error in (?[...]) in regex; marked by <-- HERE in m/(?[[:digit: ]) <-- HERE / at - line 2.
|
||||
########
|
||||
# NAME [perl #126141]
|
||||
# OPTION fatal
|
||||
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
|
||||
index 658397ac27..08a3688e1d 100644
|
||||
--- a/t/re/reg_mesg.t
|
||||
+++ b/t/re/reg_mesg.t
|
||||
@@ -202,8 +202,9 @@ my @death =
|
||||
'/\b{gc}/' => "'gc' is an unknown bound type {#} m/\\b{gc{#}}/",
|
||||
'/\B{gc}/' => "'gc' is an unknown bound type {#} m/\\B{gc{#}}/",
|
||||
|
||||
- '/(?[[[::]]])/' => "Syntax error in (?[...]) in regex m/(?[[[::]]])/",
|
||||
- '/(?[[[:w:]]])/' => "Syntax error in (?[...]) in regex m/(?[[[:w:]]])/",
|
||||
+
|
||||
+ '/(?[[[::]]])/' => "Unexpected ']' with no following ')' in (?[... {#} m/(?[[[::]]{#}])/",
|
||||
+ '/(?[[[:w:]]])/' => "Unexpected ']' with no following ')' in (?[... {#} m/(?[[[:w:]]{#}])/",
|
||||
'/(?[[:w:]])/' => "",
|
||||
'/[][[:alpha:]]' => "", # [perl #127581]
|
||||
'/([.].*)[.]/' => "", # [perl #127582]
|
||||
@@ -227,11 +228,12 @@ my @death =
|
||||
'/(?[ \p{foo} ])/' => 'Can\'t find Unicode property definition "foo" {#} m/(?[ \p{foo}{#} ])/',
|
||||
'/(?[ \p{ foo = bar } ])/' => 'Can\'t find Unicode property definition "foo = bar" {#} m/(?[ \p{ foo = bar }{#} ])/',
|
||||
'/(?[ \8 ])/' => 'Unrecognized escape \8 in character class {#} m/(?[ \8{#} ])/',
|
||||
- '/(?[ \t ]/' => 'Syntax error in (?[...]) in regex m/(?[ \t ]/',
|
||||
- '/(?[ [ \t ]/' => 'Syntax error in (?[...]) in regex m/(?[ [ \t ]/',
|
||||
- '/(?[ \t ] ]/' => 'Syntax error in (?[...]) in regex m/(?[ \t ] ]/',
|
||||
- '/(?[ [ ] ]/' => 'Syntax error in (?[...]) in regex m/(?[ [ ] ]/',
|
||||
- '/(?[ \t + \e # This was supposed to be a comment ])/' => 'Syntax error in (?[...]) in regex m/(?[ \t + \e # This was supposed to be a comment ])/',
|
||||
+ '/(?[ \t ]/' => "Unexpected ']' with no following ')' in (?[... {#} m/(?[ \\t ]{#}/",
|
||||
+ '/(?[ [ \t ]/' => "Syntax error in (?[...]) {#} m/(?[ [ \\t ]{#}/",
|
||||
+ '/(?[ \t ] ]/' => "Unexpected ']' with no following ')' in (?[... {#} m/(?[ \\t ]{#} ]/",
|
||||
+ '/(?[ [ ] ]/' => "Syntax error in (?[...]) {#} m/(?[ [ ] ]{#}/",
|
||||
+ '/(?[ \t + \e # This was supposed to be a comment ])/' =>
|
||||
+ "Syntax error in (?[...]) {#} m/(?[ \\t + \\e # This was supposed to be a comment ]){#}/",
|
||||
'/(?[ ])/' => 'Incomplete expression within \'(?[ ])\' {#} m/(?[ {#}])/',
|
||||
'm/(?[[a-\d]])/' => 'False [] range "a-\d" {#} m/(?[[a-\d{#}]])/',
|
||||
'm/(?[[\w-x]])/' => 'False [] range "\w-" {#} m/(?[[\w-{#}x]])/',
|
||||
@@ -410,10 +412,10 @@ my @death_utf8 = mark_as_utf8(
|
||||
|
||||
'/ネ\p{}ネ/' => 'Empty \p{} {#} m/ネ\p{{#}}ネ/',
|
||||
|
||||
- '/ネ(?[[[:ネ]]])ネ/' => "Syntax error in (?[...]) in regex m/ネ(?[[[:ネ]]])ネ/",
|
||||
- '/ネ(?[[[:ネ: ])ネ/' => "Syntax error in (?[...]) in regex m/ネ(?[[[:ネ: ])ネ/",
|
||||
- '/ネ(?[[[::]]])ネ/' => "Syntax error in (?[...]) in regex m/ネ(?[[[::]]])ネ/",
|
||||
- '/ネ(?[[[:ネ:]]])ネ/' => "Syntax error in (?[...]) in regex m/ネ(?[[[:ネ:]]])ネ/",
|
||||
+ '/ネ(?[[[:ネ]]])ネ/' => "Unexpected ']' with no following ')' in (?[... {#} m/ネ(?[[[:ネ]]{#}])ネ/",
|
||||
+ '/ネ(?[[[:ネ: ])ネ/' => "Syntax error in (?[...]) {#} m/ネ(?[[[:ネ: ])ネ{#}/",
|
||||
+ '/ネ(?[[[::]]])ネ/' => "Unexpected ']' with no following ')' in (?[... {#} m/ネ(?[[[::]]{#}])ネ/",
|
||||
+ '/ネ(?[[[:ネ:]]])ネ/' => "Unexpected ']' with no following ')' in (?[... {#} m/ネ(?[[[:ネ:]]{#}])ネ/",
|
||||
'/ネ(?[[:ネ:]])ネ/' => "",
|
||||
'/ネ(?[ネ])ネ/' => 'Unexpected character {#} m/ネ(?[ネ{#}])ネ/',
|
||||
'/ネ(?[ + [ネ] ])/' => 'Unexpected binary operator \'+\' with no preceding operand {#} m/ネ(?[ +{#} [ネ] ])/',
|
||||
@@ -426,8 +428,9 @@ my @death_utf8 = mark_as_utf8(
|
||||
'/(?[ \x{ネ} ])ネ/' => 'Non-hex character {#} m/(?[ \x{ネ{#}} ])ネ/',
|
||||
'/(?[ \p{ネ} ])/' => 'Can\'t find Unicode property definition "ネ" {#} m/(?[ \p{ネ}{#} ])/',
|
||||
'/(?[ \p{ ネ = bar } ])/' => 'Can\'t find Unicode property definition "ネ = bar" {#} m/(?[ \p{ ネ = bar }{#} ])/',
|
||||
- '/ネ(?[ \t ]/' => 'Syntax error in (?[...]) in regex m/ネ(?[ \t ]/',
|
||||
- '/(?[ \t + \e # ネ This was supposed to be a comment ])/' => 'Syntax error in (?[...]) in regex m/(?[ \t + \e # ネ This was supposed to be a comment ])/',
|
||||
+ '/ネ(?[ \t ]/' => "Unexpected ']' with no following ')' in (?[... {#} m/ネ(?[ \\t ]{#}/",
|
||||
+ '/(?[ \t + \e # ネ This was supposed to be a comment ])/' =>
|
||||
+ "Syntax error in (?[...]) {#} m/(?[ \\t + \\e # ネ This was supposed to be a comment ]){#}/",
|
||||
'm/(*ネ)ネ/' => q<Unknown verb pattern 'ネ' {#} m/(*ネ){#}ネ/>,
|
||||
'/\cネ/' => "Character following \"\\c\" must be printable ASCII",
|
||||
'/\b{ネ}/' => "'ネ' is an unknown bound type {#} m/\\b{ネ{#}}/",
|
||||
diff --git a/t/re/regex_sets.t b/t/re/regex_sets.t
|
||||
index 92875677be..60a126ba3c 100644
|
||||
--- a/t/re/regex_sets.t
|
||||
+++ b/t/re/regex_sets.t
|
||||
@@ -157,13 +157,13 @@ for my $char ("٠", "٥", "٩") {
|
||||
eval { $_ = '/(?[(\c]) /'; qr/$_/ };
|
||||
like($@, qr/^Syntax error/, '/(?[(\c]) / should not panic');
|
||||
eval { $_ = '(?[\c#]' . "\n])"; qr/$_/ };
|
||||
- like($@, qr/^Syntax error/, '/(?[(\c]) / should not panic');
|
||||
+ like($@, qr/^Unexpected/, '/(?[(\c]) / should not panic');
|
||||
eval { $_ = '(?[(\c])'; qr/$_/ };
|
||||
like($@, qr/^Syntax error/, '/(?[(\c])/ should be a syntax error');
|
||||
eval { $_ = '(?[(\c]) ]\b'; qr/$_/ };
|
||||
- like($@, qr/^Syntax error/, '/(?[(\c]) ]\b/ should be a syntax error');
|
||||
+ like($@, qr/^Unexpected/, '/(?[(\c]) ]\b/ should be a syntax error');
|
||||
eval { $_ = '(?[\c[]](])'; qr/$_/ };
|
||||
- like($@, qr/^Syntax error/, '/(?[\c[]](])/ should be a syntax error');
|
||||
+ like($@, qr/^Unexpected/, '/(?[\c[]](])/ should be a syntax error');
|
||||
like("\c#", qr/(?[\c#])/, '\c# should match itself');
|
||||
like("\c[", qr/(?[\c[])/, '\c[ should match itself');
|
||||
like("\c\ ", qr/(?[\c\])/, '\c\ should match itself');
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
@@ -65,6 +65,10 @@ SRC_URI += " \
|
||||
file://perl-5.26.1-guard_old_libcrypt_fix.patch \
|
||||
file://CVE-2018-12015.patch \
|
||||
file://0001-ExtUtils-MM_Unix.pm-fix-race-issues.patch \
|
||||
file://CVE-2018-18311.patch \
|
||||
file://CVE-2018-18312.patch \
|
||||
file://CVE-2018-18313.patch \
|
||||
file://CVE-2018-18314.patch \
|
||||
"
|
||||
|
||||
# Fix test case issues
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
From 39815ee5bb7f2f9ca1f0d5e9f51e27a2877ec35b Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <victor.stinner@gmail.com>
|
||||
Date: Tue, 21 May 2019 15:12:33 +0200
|
||||
Subject: [PATCH] bpo-30458: Disallow control chars in http URLs (GH-12755)
|
||||
(GH-13154) (GH-13315)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Disallow control chars in http URLs in urllib2.urlopen. This
|
||||
addresses a potential security problem for applications that do not
|
||||
sanity check their URLs where http request headers could be injected.
|
||||
|
||||
Disable https related urllib tests on a build without ssl (GH-13032)
|
||||
These tests require an SSL enabled build. Skip these tests when
|
||||
python is built without SSL to fix test failures.
|
||||
|
||||
Use httplib.InvalidURL instead of ValueError as the new error case's
|
||||
exception. (GH-13044)
|
||||
|
||||
Backport Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
|
||||
|
||||
(cherry picked from commit 7e200e0763f5b71c199aaf98bd5588f291585619)
|
||||
|
||||
Notes on backport to Python 2.7:
|
||||
|
||||
* test_urllib tests urllib.urlopen() which quotes the URL and so is
|
||||
not vulerable to HTTP Header Injection.
|
||||
* Add tests to test_urllib2 on urllib2.urlopen().
|
||||
* Reject non-ASCII characters: range 0x80-0xff.
|
||||
|
||||
CVE: CVE-2019-9740 CVE-2019-9747
|
||||
Upstream-Status: Accepted
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Lib/httplib.py | 16 ++++++
|
||||
Lib/test/test_urllib.py | 25 +++++++++
|
||||
Lib/test/test_urllib2.py | 51 ++++++++++++++++++-
|
||||
Lib/test/test_xmlrpc.py | 8 ++-
|
||||
.../2019-04-10-08-53-30.bpo-30458.51E-DA.rst | 1 +
|
||||
5 files changed, 99 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
|
||||
diff --git a/Lib/httplib.py b/Lib/httplib.py
|
||||
index 60a8fb4e35..1b41c346e0 100644
|
||||
--- a/Lib/httplib.py
|
||||
+++ b/Lib/httplib.py
|
||||
@@ -247,6 +247,16 @@ _MAXHEADERS = 100
|
||||
_is_legal_header_name = re.compile(r'\A[^:\s][^:\r\n]*\Z').match
|
||||
_is_illegal_header_value = re.compile(r'\n(?![ \t])|\r(?![ \t\n])').search
|
||||
|
||||
+# These characters are not allowed within HTTP URL paths.
|
||||
+# See https://tools.ietf.org/html/rfc3986#section-3.3 and the
|
||||
+# https://tools.ietf.org/html/rfc3986#appendix-A pchar definition.
|
||||
+# Prevents CVE-2019-9740. Includes control characters such as \r\n.
|
||||
+# Restrict non-ASCII characters above \x7f (0x80-0xff).
|
||||
+_contains_disallowed_url_pchar_re = re.compile('[\x00-\x20\x7f-\xff]')
|
||||
+# Arguably only these _should_ allowed:
|
||||
+# _is_allowed_url_pchars_re = re.compile(r"^[/!$&'()*+,;=:@%a-zA-Z0-9._~-]+$")
|
||||
+# We are more lenient for assumed real world compatibility purposes.
|
||||
+
|
||||
# We always set the Content-Length header for these methods because some
|
||||
# servers will otherwise respond with a 411
|
||||
_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'}
|
||||
@@ -927,6 +937,12 @@ class HTTPConnection:
|
||||
self._method = method
|
||||
if not url:
|
||||
url = '/'
|
||||
+ # Prevent CVE-2019-9740.
|
||||
+ match = _contains_disallowed_url_pchar_re.search(url)
|
||||
+ if match:
|
||||
+ raise InvalidURL("URL can't contain control characters. %r "
|
||||
+ "(found at least %r)"
|
||||
+ % (url, match.group()))
|
||||
hdr = '%s %s %s' % (method, url, self._http_vsn_str)
|
||||
|
||||
self._output(hdr)
|
||||
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
|
||||
index 1ce9201c06..d7778d4194 100644
|
||||
--- a/Lib/test/test_urllib.py
|
||||
+++ b/Lib/test/test_urllib.py
|
||||
@@ -257,6 +257,31 @@ class urlopen_HttpTests(unittest.TestCase, FakeHTTPMixin):
|
||||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
+ def test_url_with_control_char_rejected(self):
|
||||
+ for char_no in range(0, 0x21) + range(0x7f, 0x100):
|
||||
+ char = chr(char_no)
|
||||
+ schemeless_url = "//localhost:7777/test%s/" % char
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ try:
|
||||
+ # urllib quotes the URL so there is no injection.
|
||||
+ resp = urllib.urlopen("http:" + schemeless_url)
|
||||
+ self.assertNotIn(char, resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+ def test_url_with_newline_header_injection_rejected(self):
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
|
||||
+ schemeless_url = "//" + host + ":8080/test/?test=a"
|
||||
+ try:
|
||||
+ # urllib quotes the URL so there is no injection.
|
||||
+ resp = urllib.urlopen("http:" + schemeless_url)
|
||||
+ self.assertNotIn(' ', resp.geturl())
|
||||
+ self.assertNotIn('\r', resp.geturl())
|
||||
+ self.assertNotIn('\n', resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
def test_read_bogus(self):
|
||||
# urlopen() should raise IOError for many error codes.
|
||||
self.fakehttp('''HTTP/1.1 401 Authentication Required
|
||||
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
|
||||
index 6d24d5ddf8..9531818e16 100644
|
||||
--- a/Lib/test/test_urllib2.py
|
||||
+++ b/Lib/test/test_urllib2.py
|
||||
@@ -15,6 +15,9 @@ try:
|
||||
except ImportError:
|
||||
ssl = None
|
||||
|
||||
+from test.test_urllib import FakeHTTPMixin
|
||||
+
|
||||
+
|
||||
# XXX
|
||||
# Request
|
||||
# CacheFTPHandler (hard to write)
|
||||
@@ -1262,7 +1265,7 @@ class HandlerTests(unittest.TestCase):
|
||||
self.assertEqual(len(http_handler.requests), 1)
|
||||
self.assertFalse(http_handler.requests[0].has_header(auth_header))
|
||||
|
||||
-class MiscTests(unittest.TestCase):
|
||||
+class MiscTests(unittest.TestCase, FakeHTTPMixin):
|
||||
|
||||
def test_build_opener(self):
|
||||
class MyHTTPHandler(urllib2.HTTPHandler): pass
|
||||
@@ -1317,6 +1320,52 @@ class MiscTests(unittest.TestCase):
|
||||
"Unsupported digest authentication algorithm 'invalid'"
|
||||
)
|
||||
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_control_char_rejected(self):
|
||||
+ for char_no in range(0, 0x21) + range(0x7f, 0x100):
|
||||
+ char = chr(char_no)
|
||||
+ schemeless_url = "//localhost:7777/test%s/" % char
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ try:
|
||||
+ # We explicitly test urllib.request.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ escaped_char_repr = repr(char).replace('\\', r'\\')
|
||||
+ InvalidURL = httplib.InvalidURL
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, "contain control.*" + escaped_char_repr):
|
||||
+ urllib2.urlopen("http:" + schemeless_url)
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, "contain control.*" + escaped_char_repr):
|
||||
+ urllib2.urlopen("https:" + schemeless_url)
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_newline_header_injection_rejected(self):
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
|
||||
+ schemeless_url = "//" + host + ":8080/test/?test=a"
|
||||
+ try:
|
||||
+ # We explicitly test urllib2.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ InvalidURL = httplib.InvalidURL
|
||||
+ with self.assertRaisesRegexp(
|
||||
+ InvalidURL, r"contain control.*\\r.*(found at least . .)"):
|
||||
+ urllib2.urlopen("http:" + schemeless_url)
|
||||
+ with self.assertRaisesRegexp(InvalidURL, r"contain control.*\\n"):
|
||||
+ urllib2.urlopen("https:" + schemeless_url)
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+
|
||||
|
||||
class RequestTests(unittest.TestCase):
|
||||
|
||||
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
|
||||
index 36b3be67fd..90ccb30716 100644
|
||||
--- a/Lib/test/test_xmlrpc.py
|
||||
+++ b/Lib/test/test_xmlrpc.py
|
||||
@@ -659,7 +659,13 @@ class SimpleServerTestCase(BaseServerTestCase):
|
||||
def test_partial_post(self):
|
||||
# Check that a partial POST doesn't make the server loop: issue #14001.
|
||||
conn = httplib.HTTPConnection(ADDR, PORT)
|
||||
- conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
|
||||
+ conn.send('POST /RPC2 HTTP/1.0\r\n'
|
||||
+ 'Content-Length: 100\r\n\r\n'
|
||||
+ 'bye HTTP/1.1\r\n'
|
||||
+ 'Host: %s:%s\r\n'
|
||||
+ 'Accept-Encoding: identity\r\n'
|
||||
+ 'Content-Length: 0\r\n\r\n'
|
||||
+ % (ADDR, PORT))
|
||||
conn.close()
|
||||
|
||||
class SimpleServerEncodingTestCase(BaseServerTestCase):
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
new file mode 100644
|
||||
index 0000000000..47cb899df1
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Address CVE-2019-9740 by disallowing URL paths with embedded whitespace or control characters through into the underlying http client request. Such potentially malicious header injection URLs now cause an httplib.InvalidURL exception to be raised.
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
From 1bd50d351e508b8947e5813c5f925eb4b61c8d76 Mon Sep 17 00:00:00 2001
|
||||
From: Xtreak <tir.karthi@gmail.com>
|
||||
Date: Sat, 15 Jun 2019 20:59:43 +0530
|
||||
Subject: [PATCH] [2.7] bpo-35121: prefix dot in domain for proper subdomain
|
||||
validation (GH-10258) (GH-13426)
|
||||
|
||||
This is a manual backport of ca7fe5063593958e5efdf90f068582837f07bd14 since 2.7 has `http.cookiejar` in `cookielib`
|
||||
|
||||
https://bugs.python.org/issue35121
|
||||
|
||||
CVE: CVE-2018-20852
|
||||
Upstream-Status: Accepted
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Lib/cookielib.py | 13 ++++++--
|
||||
Lib/test/test_cookielib.py | 30 +++++++++++++++++++
|
||||
.../2019-05-20-00-35-12.bpo-35121.RRi-HU.rst | 4 +++
|
||||
3 files changed, 45 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-05-20-00-35-12.bpo-35121.RRi-HU.rst
|
||||
|
||||
diff --git a/Lib/cookielib.py b/Lib/cookielib.py
|
||||
index 2dd7c48728..0b471a42f2 100644
|
||||
--- a/Lib/cookielib.py
|
||||
+++ b/Lib/cookielib.py
|
||||
@@ -1139,6 +1139,11 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
req_host, erhn = eff_request_host(request)
|
||||
domain = cookie.domain
|
||||
|
||||
+ if domain and not domain.startswith("."):
|
||||
+ dotdomain = "." + domain
|
||||
+ else:
|
||||
+ dotdomain = domain
|
||||
+
|
||||
# strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
|
||||
if (cookie.version == 0 and
|
||||
(self.strict_ns_domain & self.DomainStrictNonDomain) and
|
||||
@@ -1151,7 +1156,7 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
_debug(" effective request-host name %s does not domain-match "
|
||||
"RFC 2965 cookie domain %s", erhn, domain)
|
||||
return False
|
||||
- if cookie.version == 0 and not ("."+erhn).endswith(domain):
|
||||
+ if cookie.version == 0 and not ("."+erhn).endswith(dotdomain):
|
||||
_debug(" request-host %s does not match Netscape cookie domain "
|
||||
"%s", req_host, domain)
|
||||
return False
|
||||
@@ -1165,7 +1170,11 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
req_host = "."+req_host
|
||||
if not erhn.startswith("."):
|
||||
erhn = "."+erhn
|
||||
- if not (req_host.endswith(domain) or erhn.endswith(domain)):
|
||||
+ if domain and not domain.startswith("."):
|
||||
+ dotdomain = "." + domain
|
||||
+ else:
|
||||
+ dotdomain = domain
|
||||
+ if not (req_host.endswith(dotdomain) or erhn.endswith(dotdomain)):
|
||||
#_debug(" request domain %s does not match cookie domain %s",
|
||||
# req_host, domain)
|
||||
return False
|
||||
diff --git a/Lib/test/test_cookielib.py b/Lib/test/test_cookielib.py
|
||||
index f2dd9727d1..7f7ff614d6 100644
|
||||
--- a/Lib/test/test_cookielib.py
|
||||
+++ b/Lib/test/test_cookielib.py
|
||||
@@ -368,6 +368,7 @@ class CookieTests(TestCase):
|
||||
("http://foo.bar.com/", ".foo.bar.com", True),
|
||||
("http://foo.bar.com/", "foo.bar.com", True),
|
||||
("http://foo.bar.com/", ".bar.com", True),
|
||||
+ ("http://foo.bar.com/", "bar.com", True),
|
||||
("http://foo.bar.com/", "com", True),
|
||||
("http://foo.com/", "rhubarb.foo.com", False),
|
||||
("http://foo.com/", ".foo.com", True),
|
||||
@@ -378,6 +379,8 @@ class CookieTests(TestCase):
|
||||
("http://foo/", "foo", True),
|
||||
("http://foo/", "foo.local", True),
|
||||
("http://foo/", ".local", True),
|
||||
+ ("http://barfoo.com", ".foo.com", False),
|
||||
+ ("http://barfoo.com", "foo.com", False),
|
||||
]:
|
||||
request = urllib2.Request(url)
|
||||
r = pol.domain_return_ok(domain, request)
|
||||
@@ -938,6 +941,33 @@ class CookieTests(TestCase):
|
||||
c.add_cookie_header(req)
|
||||
self.assertFalse(req.has_header("Cookie"))
|
||||
|
||||
+ c.clear()
|
||||
+
|
||||
+ pol.set_blocked_domains([])
|
||||
+ req = Request("http://acme.com/")
|
||||
+ res = FakeResponse(headers, "http://acme.com/")
|
||||
+ cookies = c.make_cookies(res, req)
|
||||
+ c.extract_cookies(res, req)
|
||||
+ self.assertEqual(len(c), 1)
|
||||
+
|
||||
+ req = Request("http://acme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertTrue(req.has_header("Cookie"))
|
||||
+
|
||||
+ req = Request("http://badacme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(pol.return_ok(cookies[0], req))
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
+ p = pol.set_blocked_domains(["acme.com"])
|
||||
+ req = Request("http://acme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
+ req = Request("http://badacme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
def test_secure(self):
|
||||
from cookielib import CookieJar, DefaultCookiePolicy
|
||||
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-05-20-00-35-12.bpo-35121.RRi-HU.rst b/Misc/NEWS.d/next/Security/2019-05-20-00-35-12.bpo-35121.RRi-HU.rst
|
||||
new file mode 100644
|
||||
index 0000000000..7725180616
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-05-20-00-35-12.bpo-35121.RRi-HU.rst
|
||||
@@ -0,0 +1,4 @@
|
||||
+Don't send cookies of domain A without Domain attribute to domain B when
|
||||
+domain A is a suffix match of domain B while using a cookiejar with
|
||||
+:class:`cookielib.DefaultCookiePolicy` policy. Patch by Karthikeyan
|
||||
+Singaravelan.
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
95
meta/recipes-devtools/python/python3/CVE-2018-14647.patch
Normal file
95
meta/recipes-devtools/python/python3/CVE-2018-14647.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
From 610b4b0dbaedd3099ab76acf678e9cc845d99a76 Mon Sep 17 00:00:00 2001
|
||||
From: stratakis <cstratak@redhat.com>
|
||||
Date: Mon, 25 Feb 2019 22:04:09 +0100
|
||||
Subject: [PATCH] [3.5] bpo-34623: Use XML_SetHashSalt in _elementtree (#9933)
|
||||
|
||||
* bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146)
|
||||
|
||||
The C accelerated _elementtree module now initializes hash randomization
|
||||
salt from _Py_HashSecret instead of libexpat's default CPRNG.
|
||||
|
||||
Signed-off-by: Christian Heimes <christian@python.org>
|
||||
|
||||
https://bugs.python.org/issue34623
|
||||
(cherry picked from commit cb5778f00ce48631c7140f33ba242496aaf7102b)
|
||||
|
||||
Co-authored-by: Christian Heimes <christian@python.org>
|
||||
|
||||
CVE: CVE-2018-14647
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/python/cpython/commit/41b48e71ac8a71f56694b548f118bd20ce203410]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Include/pyexpat.h | 4 +++-
|
||||
.../next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst | 2 ++
|
||||
Modules/_elementtree.c | 5 +++++
|
||||
Modules/pyexpat.c | 5 +++++
|
||||
4 files changed, 15 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst
|
||||
|
||||
diff --git a/Include/pyexpat.h b/Include/pyexpat.h
|
||||
index 44259bf6d7..07020b5dc9 100644
|
||||
--- a/Include/pyexpat.h
|
||||
+++ b/Include/pyexpat.h
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* note: you must import expat.h before importing this module! */
|
||||
|
||||
-#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0"
|
||||
+#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.1"
|
||||
#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
|
||||
|
||||
struct PyExpat_CAPI
|
||||
@@ -48,6 +48,8 @@ struct PyExpat_CAPI
|
||||
enum XML_Status (*SetEncoding)(XML_Parser parser, const XML_Char *encoding);
|
||||
int (*DefaultUnknownEncodingHandler)(
|
||||
void *encodingHandlerData, const XML_Char *name, XML_Encoding *info);
|
||||
+ /* might be none for expat < 2.1.0 */
|
||||
+ int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
|
||||
/* always add new stuff to the end! */
|
||||
};
|
||||
|
||||
diff --git a/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst
|
||||
new file mode 100644
|
||||
index 0000000000..cbaa4b7506
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2018-09-10-16-05-39.bpo-34623.Ua9jMv.rst
|
||||
@@ -0,0 +1,2 @@
|
||||
+CVE-2018-14647: The C accelerated _elementtree module now initializes hash
|
||||
+randomization salt from _Py_HashSecret instead of libexpat's default CSPRNG.
|
||||
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
|
||||
index 5dba9f70a9..90c6daf64a 100644
|
||||
--- a/Modules/_elementtree.c
|
||||
+++ b/Modules/_elementtree.c
|
||||
@@ -3282,6 +3282,11 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *html,
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
+ /* expat < 2.1.0 has no XML_SetHashSalt() */
|
||||
+ if (EXPAT(SetHashSalt) != NULL) {
|
||||
+ EXPAT(SetHashSalt)(self->parser,
|
||||
+ (unsigned long)_Py_HashSecret.expat.hashsalt);
|
||||
+ }
|
||||
|
||||
if (target) {
|
||||
Py_INCREF(target);
|
||||
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
|
||||
index adc9b6cde8..948ab1b703 100644
|
||||
--- a/Modules/pyexpat.c
|
||||
+++ b/Modules/pyexpat.c
|
||||
@@ -1882,6 +1882,11 @@ MODULE_INITFUNC(void)
|
||||
capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
|
||||
capi.SetEncoding = XML_SetEncoding;
|
||||
capi.DefaultUnknownEncodingHandler = PyUnknownEncodingHandler;
|
||||
+#if XML_COMBINED_VERSION >= 20100
|
||||
+ capi.SetHashSalt = XML_SetHashSalt;
|
||||
+#else
|
||||
+ capi.SetHashSalt = NULL;
|
||||
+#endif
|
||||
|
||||
/* export using capsule */
|
||||
capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
217
meta/recipes-devtools/python/python3/CVE-2018-20406.patch
Normal file
217
meta/recipes-devtools/python/python3/CVE-2018-20406.patch
Normal file
@@ -0,0 +1,217 @@
|
||||
From 3c7fd2b2729e3ebcf7877e7a32b3bbabf907a38d Mon Sep 17 00:00:00 2001
|
||||
From: Victor Stinner <vstinner@redhat.com>
|
||||
Date: Tue, 26 Feb 2019 01:42:39 +0100
|
||||
Subject: [PATCH] closes bpo-34656: Avoid relying on signed overflow in _pickle
|
||||
memos. (GH-9261) (#11869)
|
||||
|
||||
(cherry picked from commit a4ae828ee416a66d8c7bf5ee71d653c2cc6a26dd)
|
||||
|
||||
CVE: CVE-2018-20406
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/python/cpython/commit/ef33dd6036aafbd3f06c1d56e2b1a81dae3da63c]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Modules/_pickle.c | 63 ++++++++++++++++++++++++-----------------------
|
||||
1 file changed, 32 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/Modules/_pickle.c b/Modules/_pickle.c
|
||||
index 0f62b1c019..fcb9e87899 100644
|
||||
--- a/Modules/_pickle.c
|
||||
+++ b/Modules/_pickle.c
|
||||
@@ -527,9 +527,9 @@ typedef struct {
|
||||
} PyMemoEntry;
|
||||
|
||||
typedef struct {
|
||||
- Py_ssize_t mt_mask;
|
||||
- Py_ssize_t mt_used;
|
||||
- Py_ssize_t mt_allocated;
|
||||
+ size_t mt_mask;
|
||||
+ size_t mt_used;
|
||||
+ size_t mt_allocated;
|
||||
PyMemoEntry *mt_table;
|
||||
} PyMemoTable;
|
||||
|
||||
@@ -573,8 +573,8 @@ typedef struct UnpicklerObject {
|
||||
/* The unpickler memo is just an array of PyObject *s. Using a dict
|
||||
is unnecessary, since the keys are contiguous ints. */
|
||||
PyObject **memo;
|
||||
- Py_ssize_t memo_size; /* Capacity of the memo array */
|
||||
- Py_ssize_t memo_len; /* Number of objects in the memo */
|
||||
+ size_t memo_size; /* Capacity of the memo array */
|
||||
+ size_t memo_len; /* Number of objects in the memo */
|
||||
|
||||
PyObject *pers_func; /* persistent_load() method, can be NULL. */
|
||||
|
||||
@@ -658,7 +658,6 @@ PyMemoTable_New(void)
|
||||
static PyMemoTable *
|
||||
PyMemoTable_Copy(PyMemoTable *self)
|
||||
{
|
||||
- Py_ssize_t i;
|
||||
PyMemoTable *new = PyMemoTable_New();
|
||||
if (new == NULL)
|
||||
return NULL;
|
||||
@@ -675,7 +674,7 @@ PyMemoTable_Copy(PyMemoTable *self)
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
- for (i = 0; i < self->mt_allocated; i++) {
|
||||
+ for (size_t i = 0; i < self->mt_allocated; i++) {
|
||||
Py_XINCREF(self->mt_table[i].me_key);
|
||||
}
|
||||
memcpy(new->mt_table, self->mt_table,
|
||||
@@ -721,7 +720,7 @@ _PyMemoTable_Lookup(PyMemoTable *self, PyObject *key)
|
||||
{
|
||||
size_t i;
|
||||
size_t perturb;
|
||||
- size_t mask = (size_t)self->mt_mask;
|
||||
+ size_t mask = self->mt_mask;
|
||||
PyMemoEntry *table = self->mt_table;
|
||||
PyMemoEntry *entry;
|
||||
Py_hash_t hash = (Py_hash_t)key >> 3;
|
||||
@@ -743,22 +742,24 @@ _PyMemoTable_Lookup(PyMemoTable *self, PyObject *key)
|
||||
|
||||
/* Returns -1 on failure, 0 on success. */
|
||||
static int
|
||||
-_PyMemoTable_ResizeTable(PyMemoTable *self, Py_ssize_t min_size)
|
||||
+_PyMemoTable_ResizeTable(PyMemoTable *self, size_t min_size)
|
||||
{
|
||||
PyMemoEntry *oldtable = NULL;
|
||||
PyMemoEntry *oldentry, *newentry;
|
||||
- Py_ssize_t new_size = MT_MINSIZE;
|
||||
- Py_ssize_t to_process;
|
||||
+ size_t new_size = MT_MINSIZE;
|
||||
+ size_t to_process;
|
||||
|
||||
assert(min_size > 0);
|
||||
|
||||
- /* Find the smallest valid table size >= min_size. */
|
||||
- while (new_size < min_size && new_size > 0)
|
||||
- new_size <<= 1;
|
||||
- if (new_size <= 0) {
|
||||
+ if (min_size > PY_SSIZE_T_MAX) {
|
||||
PyErr_NoMemory();
|
||||
return -1;
|
||||
}
|
||||
+
|
||||
+ /* Find the smallest valid table size >= min_size. */
|
||||
+ while (new_size < min_size) {
|
||||
+ new_size <<= 1;
|
||||
+ }
|
||||
/* new_size needs to be a power of two. */
|
||||
assert((new_size & (new_size - 1)) == 0);
|
||||
|
||||
@@ -808,6 +809,7 @@ static int
|
||||
PyMemoTable_Set(PyMemoTable *self, PyObject *key, Py_ssize_t value)
|
||||
{
|
||||
PyMemoEntry *entry;
|
||||
+ size_t desired_size;
|
||||
|
||||
assert(key != NULL);
|
||||
|
||||
@@ -831,10 +833,12 @@ PyMemoTable_Set(PyMemoTable *self, PyObject *key, Py_ssize_t value)
|
||||
* Very large memo tables (over 50K items) use doubling instead.
|
||||
* This may help applications with severe memory constraints.
|
||||
*/
|
||||
- if (!(self->mt_used * 3 >= (self->mt_mask + 1) * 2))
|
||||
+ if (SIZE_MAX / 3 >= self->mt_used && self->mt_used * 3 < self->mt_allocated * 2) {
|
||||
return 0;
|
||||
- return _PyMemoTable_ResizeTable(self,
|
||||
- (self->mt_used > 50000 ? 2 : 4) * self->mt_used);
|
||||
+ }
|
||||
+ // self->mt_used is always < PY_SSIZE_T_MAX, so this can't overflow.
|
||||
+ desired_size = (self->mt_used > 50000 ? 2 : 4) * self->mt_used;
|
||||
+ return _PyMemoTable_ResizeTable(self, desired_size);
|
||||
}
|
||||
|
||||
#undef MT_MINSIZE
|
||||
@@ -1273,9 +1277,9 @@ _Unpickler_Readline(UnpicklerObject *self, char **result)
|
||||
/* Returns -1 (with an exception set) on failure, 0 on success. The memo array
|
||||
will be modified in place. */
|
||||
static int
|
||||
-_Unpickler_ResizeMemoList(UnpicklerObject *self, Py_ssize_t new_size)
|
||||
+_Unpickler_ResizeMemoList(UnpicklerObject *self, size_t new_size)
|
||||
{
|
||||
- Py_ssize_t i;
|
||||
+ size_t i;
|
||||
|
||||
assert(new_size > self->memo_size);
|
||||
|
||||
@@ -1292,9 +1296,9 @@ _Unpickler_ResizeMemoList(UnpicklerObject *self, Py_ssize_t new_size)
|
||||
|
||||
/* Returns NULL if idx is out of bounds. */
|
||||
static PyObject *
|
||||
-_Unpickler_MemoGet(UnpicklerObject *self, Py_ssize_t idx)
|
||||
+_Unpickler_MemoGet(UnpicklerObject *self, size_t idx)
|
||||
{
|
||||
- if (idx < 0 || idx >= self->memo_size)
|
||||
+ if (idx >= self->memo_size)
|
||||
return NULL;
|
||||
|
||||
return self->memo[idx];
|
||||
@@ -1303,7 +1307,7 @@ _Unpickler_MemoGet(UnpicklerObject *self, Py_ssize_t idx)
|
||||
/* Returns -1 (with an exception set) on failure, 0 on success.
|
||||
This takes its own reference to `value`. */
|
||||
static int
|
||||
-_Unpickler_MemoPut(UnpicklerObject *self, Py_ssize_t idx, PyObject *value)
|
||||
+_Unpickler_MemoPut(UnpicklerObject *self, size_t idx, PyObject *value)
|
||||
{
|
||||
PyObject *old_item;
|
||||
|
||||
@@ -4194,14 +4198,13 @@ static PyObject *
|
||||
_pickle_PicklerMemoProxy_copy_impl(PicklerMemoProxyObject *self)
|
||||
/*[clinic end generated code: output=bb83a919d29225ef input=b73043485ac30b36]*/
|
||||
{
|
||||
- Py_ssize_t i;
|
||||
PyMemoTable *memo;
|
||||
PyObject *new_memo = PyDict_New();
|
||||
if (new_memo == NULL)
|
||||
return NULL;
|
||||
|
||||
memo = self->pickler->memo;
|
||||
- for (i = 0; i < memo->mt_allocated; ++i) {
|
||||
+ for (size_t i = 0; i < memo->mt_allocated; ++i) {
|
||||
PyMemoEntry entry = memo->mt_table[i];
|
||||
if (entry.me_key != NULL) {
|
||||
int status;
|
||||
@@ -6620,7 +6623,7 @@ static PyObject *
|
||||
_pickle_UnpicklerMemoProxy_copy_impl(UnpicklerMemoProxyObject *self)
|
||||
/*[clinic end generated code: output=e12af7e9bc1e4c77 input=97769247ce032c1d]*/
|
||||
{
|
||||
- Py_ssize_t i;
|
||||
+ size_t i;
|
||||
PyObject *new_memo = PyDict_New();
|
||||
if (new_memo == NULL)
|
||||
return NULL;
|
||||
@@ -6771,8 +6774,7 @@ static int
|
||||
Unpickler_set_memo(UnpicklerObject *self, PyObject *obj)
|
||||
{
|
||||
PyObject **new_memo;
|
||||
- Py_ssize_t new_memo_size = 0;
|
||||
- Py_ssize_t i;
|
||||
+ size_t new_memo_size = 0;
|
||||
|
||||
if (obj == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
@@ -6789,7 +6791,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj)
|
||||
if (new_memo == NULL)
|
||||
return -1;
|
||||
|
||||
- for (i = 0; i < new_memo_size; i++) {
|
||||
+ for (size_t i = 0; i < new_memo_size; i++) {
|
||||
Py_XINCREF(unpickler->memo[i]);
|
||||
new_memo[i] = unpickler->memo[i];
|
||||
}
|
||||
@@ -6837,8 +6839,7 @@ Unpickler_set_memo(UnpicklerObject *self, PyObject *obj)
|
||||
|
||||
error:
|
||||
if (new_memo_size) {
|
||||
- i = new_memo_size;
|
||||
- while (--i >= 0) {
|
||||
+ for (size_t i = new_memo_size - 1; i != SIZE_MAX; i--) {
|
||||
Py_XDECREF(new_memo[i]);
|
||||
}
|
||||
PyMem_FREE(new_memo);
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
129
meta/recipes-devtools/python/python3/CVE-2018-20852.patch
Normal file
129
meta/recipes-devtools/python/python3/CVE-2018-20852.patch
Normal file
@@ -0,0 +1,129 @@
|
||||
From 31c16d62fc762ab87e66e7f47e36dbfcfc8b5224 Mon Sep 17 00:00:00 2001
|
||||
From: Xtreak <tir.karthi@gmail.com>
|
||||
Date: Sun, 17 Mar 2019 05:33:39 +0530
|
||||
Subject: [PATCH] [3.5] bpo-35121: prefix dot in domain for proper subdomain
|
||||
validation (GH-10258) (#12281)
|
||||
|
||||
Don't send cookies of domain A without Domain attribute to domain B when domain A is a suffix match of domain B while using a cookiejar with `http.cookiejar.DefaultCookiePolicy` policy. Patch by Karthikeyan Singaravelan.
|
||||
(cherry picked from commit ca7fe5063593958e5efdf90f068582837f07bd14)
|
||||
|
||||
Co-authored-by: Xtreak <tir.karthi@gmail.com>
|
||||
|
||||
CVE: CVE-2018-20852
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/python/cpython/commit/4749f1b69000259e23b4cc6f63c542a9bdc62f1b]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Lib/http/cookiejar.py | 13 ++++++--
|
||||
Lib/test/test_http_cookiejar.py | 30 +++++++++++++++++++
|
||||
.../2018-10-31-15-39-17.bpo-35121.EgHv9k.rst | 4 +++
|
||||
3 files changed, 45 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2018-10-31-15-39-17.bpo-35121.EgHv9k.rst
|
||||
|
||||
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
|
||||
index 6d4572af03..1cc9378ae4 100644
|
||||
--- a/Lib/http/cookiejar.py
|
||||
+++ b/Lib/http/cookiejar.py
|
||||
@@ -1148,6 +1148,11 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
req_host, erhn = eff_request_host(request)
|
||||
domain = cookie.domain
|
||||
|
||||
+ if domain and not domain.startswith("."):
|
||||
+ dotdomain = "." + domain
|
||||
+ else:
|
||||
+ dotdomain = domain
|
||||
+
|
||||
# strict check of non-domain cookies: Mozilla does this, MSIE5 doesn't
|
||||
if (cookie.version == 0 and
|
||||
(self.strict_ns_domain & self.DomainStrictNonDomain) and
|
||||
@@ -1160,7 +1165,7 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
_debug(" effective request-host name %s does not domain-match "
|
||||
"RFC 2965 cookie domain %s", erhn, domain)
|
||||
return False
|
||||
- if cookie.version == 0 and not ("."+erhn).endswith(domain):
|
||||
+ if cookie.version == 0 and not ("."+erhn).endswith(dotdomain):
|
||||
_debug(" request-host %s does not match Netscape cookie domain "
|
||||
"%s", req_host, domain)
|
||||
return False
|
||||
@@ -1174,7 +1179,11 @@ class DefaultCookiePolicy(CookiePolicy):
|
||||
req_host = "."+req_host
|
||||
if not erhn.startswith("."):
|
||||
erhn = "."+erhn
|
||||
- if not (req_host.endswith(domain) or erhn.endswith(domain)):
|
||||
+ if domain and not domain.startswith("."):
|
||||
+ dotdomain = "." + domain
|
||||
+ else:
|
||||
+ dotdomain = domain
|
||||
+ if not (req_host.endswith(dotdomain) or erhn.endswith(dotdomain)):
|
||||
#_debug(" request domain %s does not match cookie domain %s",
|
||||
# req_host, domain)
|
||||
return False
|
||||
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py
|
||||
index 49c01ae489..e67e6ae780 100644
|
||||
--- a/Lib/test/test_http_cookiejar.py
|
||||
+++ b/Lib/test/test_http_cookiejar.py
|
||||
@@ -417,6 +417,7 @@ class CookieTests(unittest.TestCase):
|
||||
("http://foo.bar.com/", ".foo.bar.com", True),
|
||||
("http://foo.bar.com/", "foo.bar.com", True),
|
||||
("http://foo.bar.com/", ".bar.com", True),
|
||||
+ ("http://foo.bar.com/", "bar.com", True),
|
||||
("http://foo.bar.com/", "com", True),
|
||||
("http://foo.com/", "rhubarb.foo.com", False),
|
||||
("http://foo.com/", ".foo.com", True),
|
||||
@@ -427,6 +428,8 @@ class CookieTests(unittest.TestCase):
|
||||
("http://foo/", "foo", True),
|
||||
("http://foo/", "foo.local", True),
|
||||
("http://foo/", ".local", True),
|
||||
+ ("http://barfoo.com", ".foo.com", False),
|
||||
+ ("http://barfoo.com", "foo.com", False),
|
||||
]:
|
||||
request = urllib.request.Request(url)
|
||||
r = pol.domain_return_ok(domain, request)
|
||||
@@ -961,6 +964,33 @@ class CookieTests(unittest.TestCase):
|
||||
c.add_cookie_header(req)
|
||||
self.assertFalse(req.has_header("Cookie"))
|
||||
|
||||
+ c.clear()
|
||||
+
|
||||
+ pol.set_blocked_domains([])
|
||||
+ req = urllib.request.Request("http://acme.com/")
|
||||
+ res = FakeResponse(headers, "http://acme.com/")
|
||||
+ cookies = c.make_cookies(res, req)
|
||||
+ c.extract_cookies(res, req)
|
||||
+ self.assertEqual(len(c), 1)
|
||||
+
|
||||
+ req = urllib.request.Request("http://acme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertTrue(req.has_header("Cookie"))
|
||||
+
|
||||
+ req = urllib.request.Request("http://badacme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(pol.return_ok(cookies[0], req))
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
+ p = pol.set_blocked_domains(["acme.com"])
|
||||
+ req = urllib.request.Request("http://acme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
+ req = urllib.request.Request("http://badacme.com/")
|
||||
+ c.add_cookie_header(req)
|
||||
+ self.assertFalse(req.has_header("Cookie"))
|
||||
+
|
||||
def test_secure(self):
|
||||
for ns in True, False:
|
||||
for whitespace in " ", "":
|
||||
diff --git a/Misc/NEWS.d/next/Security/2018-10-31-15-39-17.bpo-35121.EgHv9k.rst b/Misc/NEWS.d/next/Security/2018-10-31-15-39-17.bpo-35121.EgHv9k.rst
|
||||
new file mode 100644
|
||||
index 0000000000..d2eb8f1f35
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2018-10-31-15-39-17.bpo-35121.EgHv9k.rst
|
||||
@@ -0,0 +1,4 @@
|
||||
+Don't send cookies of domain A without Domain attribute to domain B
|
||||
+when domain A is a suffix match of domain B while using a cookiejar
|
||||
+with :class:`http.cookiejar.DefaultCookiePolicy` policy. Patch by
|
||||
+Karthikeyan Singaravelan.
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
154
meta/recipes-devtools/python/python3/CVE-2019-9636.patch
Normal file
154
meta/recipes-devtools/python/python3/CVE-2019-9636.patch
Normal file
@@ -0,0 +1,154 @@
|
||||
From b0305339567b64e07df87620e97e4cb99332aef6 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Dower <steve.dower@microsoft.com>
|
||||
Date: Sun, 10 Mar 2019 21:59:24 -0700
|
||||
Subject: [PATCH] bpo-36216: Add check for characters in netloc that normalize
|
||||
to separators (GH-12201) (#12223)
|
||||
|
||||
CVE: CVE-2019-9636
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/python/cpython/commit/c0d95113b070799679bcb9dc49d4960d82e8bb08]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
Doc/library/urllib.parse.rst | 18 +++++++++++++++
|
||||
Lib/test/test_urlparse.py | 23 +++++++++++++++++++
|
||||
Lib/urllib/parse.py | 17 ++++++++++++++
|
||||
.../2019-03-06-09-38-40.bpo-36216.6q1m4a.rst | 3 +++
|
||||
4 files changed, 61 insertions(+)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-03-06-09-38-40.bpo-36216.6q1m4a.rst
|
||||
|
||||
diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst
|
||||
index 6f722a8897..a4c6b6726e 100644
|
||||
--- a/Doc/library/urllib.parse.rst
|
||||
+++ b/Doc/library/urllib.parse.rst
|
||||
@@ -120,6 +120,11 @@ or on combining URL components into a URL string.
|
||||
Unmatched square brackets in the :attr:`netloc` attribute will raise a
|
||||
:exc:`ValueError`.
|
||||
|
||||
+ Characters in the :attr:`netloc` attribute that decompose under NFKC
|
||||
+ normalization (as used by the IDNA encoding) into any of ``/``, ``?``,
|
||||
+ ``#``, ``@``, or ``:`` will raise a :exc:`ValueError`. If the URL is
|
||||
+ decomposed before parsing, no error will be raised.
|
||||
+
|
||||
.. versionchanged:: 3.2
|
||||
Added IPv6 URL parsing capabilities.
|
||||
|
||||
@@ -128,6 +133,10 @@ or on combining URL components into a URL string.
|
||||
false), in accordance with :rfc:`3986`. Previously, a whitelist of
|
||||
schemes that support fragments existed.
|
||||
|
||||
+ .. versionchanged:: 3.5.7
|
||||
+ Characters that affect netloc parsing under NFKC normalization will
|
||||
+ now raise :exc:`ValueError`.
|
||||
+
|
||||
|
||||
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
|
||||
|
||||
@@ -236,6 +245,15 @@ or on combining URL components into a URL string.
|
||||
Unmatched square brackets in the :attr:`netloc` attribute will raise a
|
||||
:exc:`ValueError`.
|
||||
|
||||
+ Characters in the :attr:`netloc` attribute that decompose under NFKC
|
||||
+ normalization (as used by the IDNA encoding) into any of ``/``, ``?``,
|
||||
+ ``#``, ``@``, or ``:`` will raise a :exc:`ValueError`. If the URL is
|
||||
+ decomposed before parsing, no error will be raised.
|
||||
+
|
||||
+ .. versionchanged:: 3.5.7
|
||||
+ Characters that affect netloc parsing under NFKC normalization will
|
||||
+ now raise :exc:`ValueError`.
|
||||
+
|
||||
|
||||
.. function:: urlunsplit(parts)
|
||||
|
||||
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
|
||||
index e2cf1b7e0f..d0420b0e74 100644
|
||||
--- a/Lib/test/test_urlparse.py
|
||||
+++ b/Lib/test/test_urlparse.py
|
||||
@@ -1,3 +1,5 @@
|
||||
+import sys
|
||||
+import unicodedata
|
||||
import unittest
|
||||
import urllib.parse
|
||||
|
||||
@@ -970,6 +972,27 @@ class UrlParseTestCase(unittest.TestCase):
|
||||
expected.append(name)
|
||||
self.assertCountEqual(urllib.parse.__all__, expected)
|
||||
|
||||
+ def test_urlsplit_normalization(self):
|
||||
+ # Certain characters should never occur in the netloc,
|
||||
+ # including under normalization.
|
||||
+ # Ensure that ALL of them are detected and cause an error
|
||||
+ illegal_chars = '/:#?@'
|
||||
+ hex_chars = {'{:04X}'.format(ord(c)) for c in illegal_chars}
|
||||
+ denorm_chars = [
|
||||
+ c for c in map(chr, range(128, sys.maxunicode))
|
||||
+ if (hex_chars & set(unicodedata.decomposition(c).split()))
|
||||
+ and c not in illegal_chars
|
||||
+ ]
|
||||
+ # Sanity check that we found at least one such character
|
||||
+ self.assertIn('\u2100', denorm_chars)
|
||||
+ self.assertIn('\uFF03', denorm_chars)
|
||||
+
|
||||
+ for scheme in ["http", "https", "ftp"]:
|
||||
+ for c in denorm_chars:
|
||||
+ url = "{}://netloc{}false.netloc/path".format(scheme, c)
|
||||
+ with self.subTest(url=url, char='{:04X}'.format(ord(c))):
|
||||
+ with self.assertRaises(ValueError):
|
||||
+ urllib.parse.urlsplit(url)
|
||||
|
||||
class Utility_Tests(unittest.TestCase):
|
||||
"""Testcase to test the various utility functions in the urllib."""
|
||||
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
|
||||
index 62e8ddf04b..7ba2b445f5 100644
|
||||
--- a/Lib/urllib/parse.py
|
||||
+++ b/Lib/urllib/parse.py
|
||||
@@ -327,6 +327,21 @@ def _splitnetloc(url, start=0):
|
||||
delim = min(delim, wdelim) # use earliest delim position
|
||||
return url[start:delim], url[delim:] # return (domain, rest)
|
||||
|
||||
+def _checknetloc(netloc):
|
||||
+ if not netloc or not any(ord(c) > 127 for c in netloc):
|
||||
+ return
|
||||
+ # looking for characters like \u2100 that expand to 'a/c'
|
||||
+ # IDNA uses NFKC equivalence, so normalize for this check
|
||||
+ import unicodedata
|
||||
+ netloc2 = unicodedata.normalize('NFKC', netloc)
|
||||
+ if netloc == netloc2:
|
||||
+ return
|
||||
+ _, _, netloc = netloc.rpartition('@') # anything to the left of '@' is okay
|
||||
+ for c in '/?#@:':
|
||||
+ if c in netloc2:
|
||||
+ raise ValueError("netloc '" + netloc2 + "' contains invalid " +
|
||||
+ "characters under NFKC normalization")
|
||||
+
|
||||
def urlsplit(url, scheme='', allow_fragments=True):
|
||||
"""Parse a URL into 5 components:
|
||||
<scheme>://<netloc>/<path>?<query>#<fragment>
|
||||
@@ -356,6 +371,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
||||
url, fragment = url.split('#', 1)
|
||||
if '?' in url:
|
||||
url, query = url.split('?', 1)
|
||||
+ _checknetloc(netloc)
|
||||
v = SplitResult(scheme, netloc, url, query, fragment)
|
||||
_parse_cache[key] = v
|
||||
return _coerce_result(v)
|
||||
@@ -379,6 +395,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
||||
url, fragment = url.split('#', 1)
|
||||
if '?' in url:
|
||||
url, query = url.split('?', 1)
|
||||
+ _checknetloc(netloc)
|
||||
v = SplitResult(scheme, netloc, url, query, fragment)
|
||||
_parse_cache[key] = v
|
||||
return _coerce_result(v)
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-03-06-09-38-40.bpo-36216.6q1m4a.rst b/Misc/NEWS.d/next/Security/2019-03-06-09-38-40.bpo-36216.6q1m4a.rst
|
||||
new file mode 100644
|
||||
index 0000000000..5546394157
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-03-06-09-38-40.bpo-36216.6q1m4a.rst
|
||||
@@ -0,0 +1,3 @@
|
||||
+Changes urlsplit() to raise ValueError when the URL contains characters that
|
||||
+decompose under IDNA encoding (NFKC-normalization) into characters that
|
||||
+affect how the URL is parsed.
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
155
meta/recipes-devtools/python/python3/CVE-2019-9740.patch
Normal file
155
meta/recipes-devtools/python/python3/CVE-2019-9740.patch
Normal file
@@ -0,0 +1,155 @@
|
||||
From afe3a4975cf93c97e5d6eb8800e48f368011d37a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||
Date: Sun, 14 Jul 2019 11:07:11 +0200
|
||||
Subject: [PATCH] bpo-30458: Disallow control chars in http URLs. (GH-12755)
|
||||
(#13207)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Disallow control chars in http URLs in urllib.urlopen. This addresses a potential security problem for applications that do not sanity check their URLs where http request headers could be injected.
|
||||
|
||||
Disable https related urllib tests on a build without ssl (GH-13032)
|
||||
These tests require an SSL enabled build. Skip these tests when python is built without SSL to fix test failures.
|
||||
|
||||
Use http.client.InvalidURL instead of ValueError as the new error case's exception. (GH-13044)
|
||||
|
||||
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
|
||||
Upstream-Status: Backport[https://github.com/python/cpython/commit/afe3a4975cf93c97e5d6eb8800e48f368011d37a]
|
||||
CVE: CVE-2019-9740
|
||||
CVE: CVE-2019-9947
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
Lib/http/client.py | 16 ++++++
|
||||
Lib/test/test_urllib.py | 55 +++++++++++++++++++
|
||||
Lib/test/test_xmlrpc.py | 8 ++-
|
||||
.../2019-04-10-08-53-30.bpo-30458.51E-DA.rst | 1 +
|
||||
4 files changed, 79 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
|
||||
diff --git a/Lib/http/client.py b/Lib/http/client.py
|
||||
index 352c1017adce..76b9be69a374 100644
|
||||
--- a/Lib/http/client.py
|
||||
+++ b/Lib/http/client.py
|
||||
@@ -141,6 +141,16 @@
|
||||
_is_legal_header_name = re.compile(rb'[^:\s][^:\r\n]*').fullmatch
|
||||
_is_illegal_header_value = re.compile(rb'\n(?![ \t])|\r(?![ \t\n])').search
|
||||
|
||||
+# These characters are not allowed within HTTP URL paths.
|
||||
+# See https://tools.ietf.org/html/rfc3986#section-3.3 and the
|
||||
+# https://tools.ietf.org/html/rfc3986#appendix-A pchar definition.
|
||||
+# Prevents CVE-2019-9740. Includes control characters such as \r\n.
|
||||
+# We don't restrict chars above \x7f as putrequest() limits us to ASCII.
|
||||
+_contains_disallowed_url_pchar_re = re.compile('[\x00-\x20\x7f]')
|
||||
+# Arguably only these _should_ allowed:
|
||||
+# _is_allowed_url_pchars_re = re.compile(r"^[/!$&'()*+,;=:@%a-zA-Z0-9._~-]+$")
|
||||
+# We are more lenient for assumed real world compatibility purposes.
|
||||
+
|
||||
# We always set the Content-Length header for these methods because some
|
||||
# servers will otherwise respond with a 411
|
||||
_METHODS_EXPECTING_BODY = {'PATCH', 'POST', 'PUT'}
|
||||
@@ -978,6 +988,12 @@ def putrequest(self, method, url, skip_host=False,
|
||||
self._method = method
|
||||
if not url:
|
||||
url = '/'
|
||||
+ # Prevent CVE-2019-9740.
|
||||
+ match = _contains_disallowed_url_pchar_re.search(url)
|
||||
+ if match:
|
||||
+ raise InvalidURL("URL can't contain control characters. {!r} "
|
||||
+ "(found at least {!r})".format(url,
|
||||
+ match.group()))
|
||||
request = '%s %s %s' % (method, url, self._http_vsn_str)
|
||||
|
||||
# Non-ASCII characters should have been eliminated earlier
|
||||
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py
|
||||
index 3afb1312de32..1e2c622e29fd 100644
|
||||
--- a/Lib/test/test_urllib.py
|
||||
+++ b/Lib/test/test_urllib.py
|
||||
@@ -330,6 +330,61 @@ def test_willclose(self):
|
||||
finally:
|
||||
self.unfakehttp()
|
||||
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_control_char_rejected(self):
|
||||
+ for char_no in list(range(0, 0x21)) + [0x7f]:
|
||||
+ char = chr(char_no)
|
||||
+ schemeless_url = "//localhost:7777/test{}/".format(char)
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ try:
|
||||
+ # We explicitly test urllib.request.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ escaped_char_repr = repr(char).replace('\\', r'\\')
|
||||
+ InvalidURL = http.client.InvalidURL
|
||||
+ with self.assertRaisesRegex(
|
||||
+ InvalidURL,
|
||||
+ "contain control.*{}".format(escaped_char_repr)):
|
||||
+ urllib.request.urlopen("http:{}".format(schemeless_url))
|
||||
+ with self.assertRaisesRegex(
|
||||
+ InvalidURL,
|
||||
+ "contain control.*{}".format(escaped_char_repr)):
|
||||
+ urllib.request.urlopen("https:{}".format(schemeless_url))
|
||||
+ # This code path quotes the URL so there is no injection.
|
||||
+ resp = urlopen("http:{}".format(schemeless_url))
|
||||
+ self.assertNotIn(char, resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
+ @unittest.skipUnless(ssl, "ssl module required")
|
||||
+ def test_url_with_newline_header_injection_rejected(self):
|
||||
+ self.fakehttp(b"HTTP/1.1 200 OK\r\n\r\nHello.")
|
||||
+ host = "localhost:7777?a=1 HTTP/1.1\r\nX-injected: header\r\nTEST: 123"
|
||||
+ schemeless_url = "//" + host + ":8080/test/?test=a"
|
||||
+ try:
|
||||
+ # We explicitly test urllib.request.urlopen() instead of the top
|
||||
+ # level 'def urlopen()' function defined in this... (quite ugly)
|
||||
+ # test suite. They use different url opening codepaths. Plain
|
||||
+ # urlopen uses FancyURLOpener which goes via a codepath that
|
||||
+ # calls urllib.parse.quote() on the URL which makes all of the
|
||||
+ # above attempts at injection within the url _path_ safe.
|
||||
+ InvalidURL = http.client.InvalidURL
|
||||
+ with self.assertRaisesRegex(
|
||||
+ InvalidURL, r"contain control.*\\r.*(found at least . .)"):
|
||||
+ urllib.request.urlopen("http:{}".format(schemeless_url))
|
||||
+ with self.assertRaisesRegex(InvalidURL, r"contain control.*\\n"):
|
||||
+ urllib.request.urlopen("https:{}".format(schemeless_url))
|
||||
+ # This code path quotes the URL so there is no injection.
|
||||
+ resp = urlopen("http:{}".format(schemeless_url))
|
||||
+ self.assertNotIn(' ', resp.geturl())
|
||||
+ self.assertNotIn('\r', resp.geturl())
|
||||
+ self.assertNotIn('\n', resp.geturl())
|
||||
+ finally:
|
||||
+ self.unfakehttp()
|
||||
+
|
||||
def test_read_0_9(self):
|
||||
# "0.9" response accepted (but not "simple responses" without
|
||||
# a status line)
|
||||
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
|
||||
index c2de057ecbfa..99e510fcee86 100644
|
||||
--- a/Lib/test/test_xmlrpc.py
|
||||
+++ b/Lib/test/test_xmlrpc.py
|
||||
@@ -896,7 +896,13 @@ def test_unicode_host(self):
|
||||
def test_partial_post(self):
|
||||
# Check that a partial POST doesn't make the server loop: issue #14001.
|
||||
conn = http.client.HTTPConnection(ADDR, PORT)
|
||||
- conn.request('POST', '/RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nbye')
|
||||
+ conn.send('POST /RPC2 HTTP/1.0\r\n'
|
||||
+ 'Content-Length: 100\r\n\r\n'
|
||||
+ 'bye HTTP/1.1\r\n'
|
||||
+ 'Host: {}:{}\r\n'
|
||||
+ 'Accept-Encoding: identity\r\n'
|
||||
+ 'Content-Length: 0\r\n\r\n'
|
||||
+ .format(ADDR, PORT).encode('ascii'))
|
||||
conn.close()
|
||||
|
||||
def test_context_manager(self):
|
||||
diff --git a/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
new file mode 100644
|
||||
index 000000000000..ed8027fb4d64
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2019-04-10-08-53-30.bpo-30458.51E-DA.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Address CVE-2019-9740 by disallowing URL paths with embedded whitespace or control characters through into the underlying http client request. Such potentially malicious header injection URLs now cause an http.client.InvalidURL exception to be raised.
|
||||
@@ -43,6 +43,11 @@ SRC_URI += "\
|
||||
file://0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch \
|
||||
file://0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch \
|
||||
file://run-ptest \
|
||||
file://CVE-2019-9740.patch \
|
||||
file://CVE-2018-14647.patch \
|
||||
file://CVE-2018-20406.patch \
|
||||
file://CVE-2018-20852.patch \
|
||||
file://CVE-2019-9636.patch \
|
||||
"
|
||||
|
||||
inherit multilib_header python3native update-alternatives qemu ptest
|
||||
|
||||
@@ -35,6 +35,8 @@ SRC_URI += "\
|
||||
file://bpo-35907-cve-2019-9948-fix.patch \
|
||||
file://bpo-36216-cve-2019-9636.patch \
|
||||
file://bpo-36216-cve-2019-9636-fix.patch \
|
||||
file://bpo-35121-cve-2018-20852.patch \
|
||||
file://bpo-30458-cve-2019-9740.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/Python-${PV}"
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 184943d827ce09375284e6fbb9fd5eeb9e369529 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 20 Mar 2019 16:18:41 +0000
|
||||
Subject: [PATCH] linux-user: assume __NR_gettid always exists
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The gettid syscall was introduced in Linux 2.4.11. This is old enough
|
||||
that we can assume it always exists and thus not bother with the
|
||||
conditional backcompat logic.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||||
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Message-Id: <20190320161842.13908-2-berrange@redhat.com>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
|
||||
Upstream-Status: Backport
|
||||
dependancy patch for fix
|
||||
|
||||
Signed-off-by: Armin Kuster <akuster808@gmail.com>
|
||||
|
||||
---
|
||||
|
||||
|
||||
linux-user/syscall.c | 8 --------
|
||||
1 file changed, 8 deletions(-)
|
||||
|
||||
Index: qemu-3.0.0/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/syscall.c
|
||||
+++ qemu-3.0.0/linux-user/syscall.c
|
||||
@@ -251,15 +251,7 @@ static type name (type1 arg1,type2 arg2,
|
||||
#define TARGET_NR__llseek TARGET_NR_llseek
|
||||
#endif
|
||||
|
||||
-#ifdef __NR_gettid
|
||||
_syscall0(int, gettid)
|
||||
-#else
|
||||
-/* This is a replacement for the host gettid() and must return a host
|
||||
- errno. */
|
||||
-static int gettid(void) {
|
||||
- return -ENOSYS;
|
||||
-}
|
||||
-#endif
|
||||
|
||||
/* For the 64-bit guest on 32-bit host case we must emulate
|
||||
* getdents using getdents64, because otherwise the host
|
||||
@@ -0,0 +1,95 @@
|
||||
From 71ba74f67eaca21b0cc9d96f534ad3b9a7161400 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Wed, 20 Mar 2019 16:18:42 +0000
|
||||
Subject: [PATCH] linux-user: rename gettid() to sys_gettid() to avoid clash
|
||||
with glibc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The glibc-2.29.9000-6.fc31.x86_64 package finally includes the gettid()
|
||||
function as part of unistd.h when __USE_GNU is defined. This clashes
|
||||
with linux-user code which unconditionally defines this function name
|
||||
itself.
|
||||
|
||||
/home/berrange/src/virt/qemu/linux-user/syscall.c:253:16: error: static declaration of ‘gettid’ follows non-static declaration
|
||||
253 | _syscall0(int, gettid)
|
||||
| ^~~~~~
|
||||
/home/berrange/src/virt/qemu/linux-user/syscall.c:184:13: note: in definition of macro ‘_syscall0’
|
||||
184 | static type name (void) \
|
||||
| ^~~~
|
||||
In file included from /usr/include/unistd.h:1170,
|
||||
from /home/berrange/src/virt/qemu/include/qemu/osdep.h:107,
|
||||
from /home/berrange/src/virt/qemu/linux-user/syscall.c:20:
|
||||
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
|
||||
34 | extern __pid_t gettid (void) __THROW;
|
||||
| ^~~~~~
|
||||
CC aarch64-linux-user/linux-user/signal.o
|
||||
make[1]: *** [/home/berrange/src/virt/qemu/rules.mak:69: linux-user/syscall.o] Error 1
|
||||
make[1]: *** Waiting for unfinished jobs....
|
||||
make: *** [Makefile:449: subdir-aarch64-linux-user] Error 2
|
||||
|
||||
While we could make our definition conditional and rely on glibc's impl,
|
||||
this patch simply renames our definition to sys_gettid() which is a
|
||||
common pattern in this file.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||||
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Message-Id: <20190320161842.13908-3-berrange@redhat.com>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
|
||||
Upstream-status: Backport
|
||||
|
||||
Fixes issue found on tumbleweed-ty-1
|
||||
Yocto bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13577
|
||||
Signed-off-by: Armin Kuster <akuster808@gmail.com>
|
||||
|
||||
---
|
||||
linux-user/syscall.c | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: qemu-3.0.0/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/syscall.c
|
||||
+++ qemu-3.0.0/linux-user/syscall.c
|
||||
@@ -251,7 +251,8 @@ static type name (type1 arg1,type2 arg2,
|
||||
#define TARGET_NR__llseek TARGET_NR_llseek
|
||||
#endif
|
||||
|
||||
-_syscall0(int, gettid)
|
||||
+#define __NR_sys_gettid __NR_gettid
|
||||
+_syscall0(int, sys_gettid)
|
||||
|
||||
/* For the 64-bit guest on 32-bit host case we must emulate
|
||||
* getdents using getdents64, because otherwise the host
|
||||
@@ -6483,7 +6484,7 @@ static void *clone_func(void *arg)
|
||||
cpu = ENV_GET_CPU(env);
|
||||
thread_cpu = cpu;
|
||||
ts = (TaskState *)cpu->opaque;
|
||||
- info->tid = gettid();
|
||||
+ info->tid = sys_gettid();
|
||||
task_settid(ts);
|
||||
if (info->child_tidptr)
|
||||
put_user_u32(info->tid, info->child_tidptr);
|
||||
@@ -6628,9 +6629,9 @@ static int do_fork(CPUArchState *env, un
|
||||
mapping. We can't repeat the spinlock hack used above because
|
||||
the child process gets its own copy of the lock. */
|
||||
if (flags & CLONE_CHILD_SETTID)
|
||||
- put_user_u32(gettid(), child_tidptr);
|
||||
+ put_user_u32(sys_gettid(), child_tidptr);
|
||||
if (flags & CLONE_PARENT_SETTID)
|
||||
- put_user_u32(gettid(), parent_tidptr);
|
||||
+ put_user_u32(sys_gettid(), parent_tidptr);
|
||||
ts = (TaskState *)cpu->opaque;
|
||||
if (flags & CLONE_SETTLS)
|
||||
cpu_set_tls (env, newtls);
|
||||
@@ -11876,7 +11877,7 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
break;
|
||||
#endif
|
||||
case TARGET_NR_gettid:
|
||||
- ret = get_errno(gettid());
|
||||
+ ret = get_errno(sys_gettid());
|
||||
break;
|
||||
#ifdef TARGET_NR_readahead
|
||||
case TARGET_NR_readahead:
|
||||
@@ -18,11 +18,11 @@ Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
|
||||
2 files changed, 29 insertions(+)
|
||||
create mode 100644 custom_debug.h
|
||||
|
||||
diff --git a/cpus.c b/cpus.c
|
||||
index 38eba8bff3..b84a60a4f3 100644
|
||||
--- a/cpus.c
|
||||
+++ b/cpus.c
|
||||
@@ -1690,6 +1690,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
|
||||
Index: qemu-3.0.0/cpus.c
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/cpus.c
|
||||
+++ qemu-3.0.0/cpus.c
|
||||
@@ -1693,6 +1693,8 @@ static void *qemu_tcg_cpu_thread_fn(void
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ index 38eba8bff3..b84a60a4f3 100644
|
||||
static void qemu_cpu_kick_thread(CPUState *cpu)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
@@ -1702,6 +1704,9 @@ static void qemu_cpu_kick_thread(CPUState *cpu)
|
||||
@@ -1705,6 +1707,9 @@ static void qemu_cpu_kick_thread(CPUStat
|
||||
err = pthread_kill(cpu->thread->thread, SIG_IPI);
|
||||
if (err) {
|
||||
fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
|
||||
@@ -41,11 +41,10 @@ index 38eba8bff3..b84a60a4f3 100644
|
||||
exit(1);
|
||||
}
|
||||
#else /* _WIN32 */
|
||||
diff --git a/custom_debug.h b/custom_debug.h
|
||||
new file mode 100644
|
||||
index 0000000000..f029e45547
|
||||
Index: qemu-3.0.0/custom_debug.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/custom_debug.h
|
||||
+++ qemu-3.0.0/custom_debug.h
|
||||
@@ -0,0 +1,24 @@
|
||||
+#include <execinfo.h>
|
||||
+#include <stdio.h>
|
||||
|
||||
@@ -0,0 +1,336 @@
|
||||
From 8104018ba4c66e568d2583a3a0ee940851ee7471 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Date: Tue, 23 Jul 2019 17:50:00 +0200
|
||||
Subject: [PATCH] linux-user: fix to handle variably sized SIOCGSTAMP with new
|
||||
kernels
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The SIOCGSTAMP symbol was previously defined in the
|
||||
asm-generic/sockios.h header file. QEMU sees that header
|
||||
indirectly via sys/socket.h
|
||||
|
||||
In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115
|
||||
the asm-generic/sockios.h header no longer defines SIOCGSTAMP.
|
||||
Instead it provides only SIOCGSTAMP_OLD, which only uses a
|
||||
32-bit time_t on 32-bit architectures.
|
||||
|
||||
The linux/sockios.h header then defines SIOCGSTAMP using
|
||||
either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If
|
||||
SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even
|
||||
on 32-bit architectures
|
||||
|
||||
To cope with this we must now convert the old and new type from
|
||||
the target to the host one.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
|
||||
Message-Id: <20190718130641.15294-1-laurent@vivier.eu>
|
||||
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
|
||||
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
|
||||
---
|
||||
Uptream-status: Backport (upstream commit: 6d5d5dde9adb5acb32e6b8e3dfbf47fff0f308d2)
|
||||
|
||||
linux-user/ioctls.h | 21 +++++-
|
||||
linux-user/syscall.c | 140 +++++++++++++++++++++++++++++--------
|
||||
linux-user/syscall_defs.h | 30 +++++++-
|
||||
linux-user/syscall_types.h | 6 --
|
||||
4 files changed, 159 insertions(+), 38 deletions(-)
|
||||
|
||||
Index: qemu-3.0.0/linux-user/ioctls.h
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/ioctls.h
|
||||
+++ qemu-3.0.0/linux-user/ioctls.h
|
||||
@@ -173,8 +173,25 @@
|
||||
IOCTL(SIOCGRARP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_arpreq)))
|
||||
IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
|
||||
IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
|
||||
- IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
|
||||
- IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
|
||||
+
|
||||
+ /*
|
||||
+ * We can't use IOCTL_SPECIAL() because it will set
|
||||
+ * host_cmd to XXX_OLD and XXX_NEW and these macros
|
||||
+ * are not defined with kernel prior to 5.2.
|
||||
+ * We must set host_cmd to the same value as in target_cmd
|
||||
+ * otherwise the consistency check in syscall_init()
|
||||
+ * will trigger an error.
|
||||
+ * host_cmd is ignored by the do_ioctl_XXX() helpers.
|
||||
+ * FIXME: create a macro to define this kind of entry
|
||||
+ */
|
||||
+ { TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
|
||||
+ "SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
|
||||
+ { TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
|
||||
+ "SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
|
||||
+ { TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
|
||||
+ "SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
|
||||
+ { TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
|
||||
+ "SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
|
||||
|
||||
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
|
||||
Index: qemu-3.0.0/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/syscall.c
|
||||
+++ qemu-3.0.0/linux-user/syscall.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <sched.h>
|
||||
#include <sys/timex.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <linux/sockios.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/uio.h>
|
||||
#include <poll.h>
|
||||
@@ -1391,8 +1392,9 @@ static inline abi_long copy_from_user_ti
|
||||
{
|
||||
struct target_timeval *target_tv;
|
||||
|
||||
- if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1))
|
||||
+ if (!lock_user_struct(VERIFY_READ, target_tv, target_tv_addr, 1)) {
|
||||
return -TARGET_EFAULT;
|
||||
+ }
|
||||
|
||||
__get_user(tv->tv_sec, &target_tv->tv_sec);
|
||||
__get_user(tv->tv_usec, &target_tv->tv_usec);
|
||||
@@ -1407,8 +1409,26 @@ static inline abi_long copy_to_user_time
|
||||
{
|
||||
struct target_timeval *target_tv;
|
||||
|
||||
- if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0))
|
||||
+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+
|
||||
+ __put_user(tv->tv_sec, &target_tv->tv_sec);
|
||||
+ __put_user(tv->tv_usec, &target_tv->tv_usec);
|
||||
+
|
||||
+ unlock_user_struct(target_tv, target_tv_addr, 1);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline abi_long copy_to_user_timeval64(abi_ulong target_tv_addr,
|
||||
+ const struct timeval *tv)
|
||||
+{
|
||||
+ struct target__kernel_sock_timeval *target_tv;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_WRITE, target_tv, target_tv_addr, 0)) {
|
||||
return -TARGET_EFAULT;
|
||||
+ }
|
||||
|
||||
__put_user(tv->tv_sec, &target_tv->tv_sec);
|
||||
__put_user(tv->tv_usec, &target_tv->tv_usec);
|
||||
@@ -1418,6 +1438,48 @@ static inline abi_long copy_to_user_time
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline abi_long target_to_host_timespec(struct timespec *host_ts,
|
||||
+ abi_ulong target_addr)
|
||||
+{
|
||||
+ struct target_timespec *target_ts;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ __get_user(host_ts->tv_sec, &target_ts->tv_sec);
|
||||
+ __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
|
||||
+ unlock_user_struct(target_ts, target_addr, 0);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline abi_long host_to_target_timespec(abi_ulong target_addr,
|
||||
+ struct timespec *host_ts)
|
||||
+{
|
||||
+ struct target_timespec *target_ts;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
|
||||
+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
|
||||
+ unlock_user_struct(target_ts, target_addr, 1);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static inline abi_long host_to_target_timespec64(abi_ulong target_addr,
|
||||
+ struct timespec *host_ts)
|
||||
+{
|
||||
+ struct target__kernel_timespec *target_ts;
|
||||
+
|
||||
+ if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ __put_user(host_ts->tv_sec, &target_ts->tv_sec);
|
||||
+ __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
|
||||
+ unlock_user_struct(target_ts, target_addr, 1);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static inline abi_long copy_from_user_timezone(struct timezone *tz,
|
||||
abi_ulong target_tz_addr)
|
||||
{
|
||||
@@ -5733,6 +5795,54 @@ static abi_long do_ioctl_kdsigaccept(con
|
||||
return get_errno(safe_ioctl(fd, ie->host_cmd, sig));
|
||||
}
|
||||
|
||||
+static abi_long do_ioctl_SIOCGSTAMP(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||
+ int fd, int cmd, abi_long arg)
|
||||
+{
|
||||
+ struct timeval tv;
|
||||
+ abi_long ret;
|
||||
+
|
||||
+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMP, &tv));
|
||||
+ if (is_error(ret)) {
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (cmd == (int)TARGET_SIOCGSTAMP_OLD) {
|
||||
+ if (copy_to_user_timeval(arg, &tv)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (copy_to_user_timeval64(arg, &tv)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static abi_long do_ioctl_SIOCGSTAMPNS(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||
+ int fd, int cmd, abi_long arg)
|
||||
+{
|
||||
+ struct timespec ts;
|
||||
+ abi_long ret;
|
||||
+
|
||||
+ ret = get_errno(safe_ioctl(fd, SIOCGSTAMPNS, &ts));
|
||||
+ if (is_error(ret)) {
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ if (cmd == (int)TARGET_SIOCGSTAMPNS_OLD) {
|
||||
+ if (host_to_target_timespec(arg, &ts)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ } else{
|
||||
+ if (host_to_target_timespec64(arg, &ts)) {
|
||||
+ return -TARGET_EFAULT;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
#ifdef TIOCGPTPEER
|
||||
static abi_long do_ioctl_tiocgptpeer(const IOCTLEntry *ie, uint8_t *buf_temp,
|
||||
int fd, int cmd, abi_long arg)
|
||||
@@ -7106,32 +7216,6 @@ static inline abi_long target_ftruncate6
|
||||
}
|
||||
#endif
|
||||
|
||||
-static inline abi_long target_to_host_timespec(struct timespec *host_ts,
|
||||
- abi_ulong target_addr)
|
||||
-{
|
||||
- struct target_timespec *target_ts;
|
||||
-
|
||||
- if (!lock_user_struct(VERIFY_READ, target_ts, target_addr, 1))
|
||||
- return -TARGET_EFAULT;
|
||||
- __get_user(host_ts->tv_sec, &target_ts->tv_sec);
|
||||
- __get_user(host_ts->tv_nsec, &target_ts->tv_nsec);
|
||||
- unlock_user_struct(target_ts, target_addr, 0);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static inline abi_long host_to_target_timespec(abi_ulong target_addr,
|
||||
- struct timespec *host_ts)
|
||||
-{
|
||||
- struct target_timespec *target_ts;
|
||||
-
|
||||
- if (!lock_user_struct(VERIFY_WRITE, target_ts, target_addr, 0))
|
||||
- return -TARGET_EFAULT;
|
||||
- __put_user(host_ts->tv_sec, &target_ts->tv_sec);
|
||||
- __put_user(host_ts->tv_nsec, &target_ts->tv_nsec);
|
||||
- unlock_user_struct(target_ts, target_addr, 1);
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static inline abi_long target_to_host_itimerspec(struct itimerspec *host_itspec,
|
||||
abi_ulong target_addr)
|
||||
{
|
||||
Index: qemu-3.0.0/linux-user/syscall_defs.h
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/syscall_defs.h
|
||||
+++ qemu-3.0.0/linux-user/syscall_defs.h
|
||||
@@ -203,16 +203,34 @@ struct target_ip_mreq_source {
|
||||
uint32_t imr_sourceaddr;
|
||||
};
|
||||
|
||||
+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
|
||||
+struct target_timeval {
|
||||
+ abi_long tv_sec;
|
||||
+ abi_int tv_usec;
|
||||
+};
|
||||
+#define target__kernel_sock_timeval target_timeval
|
||||
+#else
|
||||
struct target_timeval {
|
||||
abi_long tv_sec;
|
||||
abi_long tv_usec;
|
||||
};
|
||||
|
||||
+struct target__kernel_sock_timeval {
|
||||
+ abi_llong tv_sec;
|
||||
+ abi_llong tv_usec;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
struct target_timespec {
|
||||
abi_long tv_sec;
|
||||
abi_long tv_nsec;
|
||||
};
|
||||
|
||||
+struct target__kernel_timespec {
|
||||
+ abi_llong tv_sec;
|
||||
+ abi_llong tv_nsec;
|
||||
+};
|
||||
+
|
||||
struct target_timezone {
|
||||
abi_int tz_minuteswest;
|
||||
abi_int tz_dsttime;
|
||||
@@ -738,8 +756,16 @@ struct target_pollfd {
|
||||
#define TARGET_SIOCATMARK 0x8905
|
||||
#define TARGET_SIOCGPGRP 0x8904
|
||||
#endif
|
||||
-#define TARGET_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
|
||||
-#define TARGET_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
|
||||
+#if defined(TARGET_SH4)
|
||||
+#define TARGET_SIOCGSTAMP_OLD TARGET_IOR('s', 100, struct target_timeval)
|
||||
+#define TARGET_SIOCGSTAMPNS_OLD TARGET_IOR('s', 101, struct target_timespec)
|
||||
+#else
|
||||
+#define TARGET_SIOCGSTAMP_OLD 0x8906
|
||||
+#define TARGET_SIOCGSTAMPNS_OLD 0x8907
|
||||
+#endif
|
||||
+
|
||||
+#define TARGET_SIOCGSTAMP_NEW TARGET_IOR(0x89, 0x06, abi_llong[2])
|
||||
+#define TARGET_SIOCGSTAMPNS_NEW TARGET_IOR(0x89, 0x07, abi_llong[2])
|
||||
|
||||
/* Networking ioctls */
|
||||
#define TARGET_SIOCADDRT 0x890B /* add routing table entry */
|
||||
Index: qemu-3.0.0/linux-user/syscall_types.h
|
||||
===================================================================
|
||||
--- qemu-3.0.0.orig/linux-user/syscall_types.h
|
||||
+++ qemu-3.0.0/linux-user/syscall_types.h
|
||||
@@ -14,12 +14,6 @@ STRUCT(serial_icounter_struct,
|
||||
STRUCT(sockaddr,
|
||||
TYPE_SHORT, MK_ARRAY(TYPE_CHAR, 14))
|
||||
|
||||
-STRUCT(timeval,
|
||||
- MK_ARRAY(TYPE_LONG, 2))
|
||||
-
|
||||
-STRUCT(timespec,
|
||||
- MK_ARRAY(TYPE_LONG, 2))
|
||||
-
|
||||
STRUCT(rtentry,
|
||||
TYPE_ULONG, MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr), MK_STRUCT(STRUCT_sockaddr),
|
||||
TYPE_SHORT, TYPE_SHORT, TYPE_ULONG, TYPE_PTRVOID, TYPE_SHORT, TYPE_PTRVOID,
|
||||
@@ -19,7 +19,7 @@ Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commitdiff
|
||||
;h=fdc89e90fac40c5ca2686733df17b6423fb8d8fb#patch1]
|
||||
|
||||
CVE: CVE-2018-10839
|
||||
CVE: CVE-2018-10839 CVE-2018-17958
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
---
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
From 06e88ca78d056ea4de885e3a1496805179dc47bc Mon Sep 17 00:00:00 2001
|
||||
From: Changqing Li <changqing.li@windriver.com>
|
||||
Date: Mon, 15 Oct 2018 16:33:04 +0800
|
||||
Subject: [PATCH] ne2000: fix possible out of bound access in ne2000_receive
|
||||
|
||||
In ne2000_receive(), we try to assign size_ to size which converts
|
||||
from size_t to integer. This will cause troubles when size_ is greater
|
||||
INT_MAX, this will lead a negative value in size and it can then pass
|
||||
the check of size < MIN_BUF_SIZE which may lead out of bound access of
|
||||
for both buf and buf1.
|
||||
|
||||
Fixing by converting the type of size to size_t.
|
||||
|
||||
CC: address@hidden
|
||||
Reported-by: Daniel Shapira <address@hidden>
|
||||
Reviewed-by: Michael S. Tsirkin <address@hidden>
|
||||
Signed-off-by: Jason Wang <address@hidden>
|
||||
|
||||
Upstream-Status: Backport [https://lists.gnu.org/archive/html/qemu-devel/2018-09/msg03273.html]
|
||||
|
||||
CVE: CVE-2018-17958
|
||||
|
||||
Signed-off-by: Changqing Li <changqing.li@windriver.com>
|
||||
---
|
||||
hw/net/ne2000.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
|
||||
index 07d79e3..869518e 100644
|
||||
--- a/hw/net/ne2000.c
|
||||
+++ b/hw/net/ne2000.c
|
||||
@@ -174,7 +174,7 @@ static int ne2000_buffer_full(NE2000State *s)
|
||||
ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
|
||||
{
|
||||
NE2000State *s = qemu_get_nic_opaque(nc);
|
||||
- int size = size_;
|
||||
+ size_t size = size_;
|
||||
uint8_t *p;
|
||||
unsigned int total_len, next, avail, len, index, mcast_idx;
|
||||
uint8_t buf1[60];
|
||||
@@ -182,7 +182,7 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_)
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
#if defined(DEBUG_NE2000)
|
||||
- printf("NE2000: received len=%d\n", size);
|
||||
+ printf("NE2000: received len=%zu\n", size);
|
||||
#endif
|
||||
|
||||
if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
|
||||
--
|
||||
2.7.4
|
||||
|
||||
50
meta/recipes-devtools/qemu/qemu/CVE-2018-18954.patch
Normal file
50
meta/recipes-devtools/qemu/qemu/CVE-2018-18954.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 3c9fd43da473a324f6cc7a0d3db58f651a2d262c Mon Sep 17 00:00:00 2001
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Fri, 26 Oct 2018 18:03:58 +0530
|
||||
Subject: [PATCH] ppc/pnv: check size before data buffer access
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
While performing PowerNV memory r/w operations, the access length
|
||||
'sz' could exceed the data[4] buffer size. Add check to avoid OOB
|
||||
access.
|
||||
|
||||
Reported-by: Moguofang <moguofang@huawei.com>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Reviewed-by: Cédric Le Goater <clg@kaod.org>
|
||||
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
||||
|
||||
CVE: CVE-2018-18954
|
||||
Upstream-Status: Backport
|
||||
[https://git.qemu.org/?p=qemu.git;a=commit;h=d07945e78eb6b593cd17a4640c1fc9eb35e3245d]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
hw/ppc/pnv_lpc.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
|
||||
index d7721320a2..172a915cfc 100644
|
||||
--- a/hw/ppc/pnv_lpc.c
|
||||
+++ b/hw/ppc/pnv_lpc.c
|
||||
@@ -155,9 +155,15 @@ static void pnv_lpc_do_eccb(PnvLpcController *lpc, uint64_t cmd)
|
||||
/* XXX Check for magic bits at the top, addr size etc... */
|
||||
unsigned int sz = (cmd & ECCB_CTL_SZ_MASK) >> ECCB_CTL_SZ_LSH;
|
||||
uint32_t opb_addr = cmd & ECCB_CTL_ADDR_MASK;
|
||||
- uint8_t data[4];
|
||||
+ uint8_t data[8];
|
||||
bool success;
|
||||
|
||||
+ if (sz > sizeof(data)) {
|
||||
+ qemu_log_mask(LOG_GUEST_ERROR,
|
||||
+ "ECCB: invalid operation at @0x%08x size %d\n", opb_addr, sz);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (cmd & ECCB_CTL_READ) {
|
||||
success = opb_read(lpc, opb_addr, data, sz);
|
||||
if (success) {
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
39
meta/recipes-devtools/qemu/qemu/CVE-2019-3812.patch
Normal file
39
meta/recipes-devtools/qemu/qemu/CVE-2019-3812.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From b664d9d003d1a98642dcfb8e6fceef6dbf3d52d8 Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Tue, 8 Jan 2019 11:23:01 +0100
|
||||
Subject: [PATCH] i2c-ddc: fix oob read
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Suggested-by: Michael Hanselmann <public@hansmi.ch>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reviewed-by: Michael Hanselmann <public@hansmi.ch>
|
||||
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Message-id: 20190108102301.1957-1-kraxel@redhat.com
|
||||
|
||||
CVE: CVE-2019-3812
|
||||
Upstream-Status: Backport
|
||||
[https://git.qemu.org/?p=qemu.git;a=commit;h=b05b267840515730dbf6753495d5b7bd8b04ad1c]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
hw/i2c/i2c-ddc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/i2c/i2c-ddc.c b/hw/i2c/i2c-ddc.c
|
||||
index bec0c91e2d..89e659288e 100644
|
||||
--- a/hw/i2c/i2c-ddc.c
|
||||
+++ b/hw/i2c/i2c-ddc.c
|
||||
@@ -247,7 +247,7 @@ static int i2c_ddc_rx(I2CSlave *i2c)
|
||||
I2CDDCState *s = I2CDDC(i2c);
|
||||
|
||||
int value;
|
||||
- value = s->edid_blob[s->reg];
|
||||
+ value = s->edid_blob[s->reg % sizeof(s->edid_blob)];
|
||||
s->reg++;
|
||||
return value;
|
||||
}
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
41
meta/recipes-devtools/qemu/qemu/CVE-2019-6778.patch
Normal file
41
meta/recipes-devtools/qemu/qemu/CVE-2019-6778.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From b6c0fa3b435375918714e107b22de2ef13a41c26 Mon Sep 17 00:00:00 2001
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Sun, 13 Jan 2019 23:29:48 +0530
|
||||
Subject: [PATCH] slirp: check data length while emulating ident function
|
||||
|
||||
While emulating identification protocol, tcp_emu() does not check
|
||||
available space in the 'sc_rcv->sb_data' buffer. It could lead to
|
||||
heap buffer overflow issue. Add check to avoid it.
|
||||
|
||||
Reported-by: Kira <864786842@qq.com>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
|
||||
CVE: CVE-2019-6778
|
||||
Upstream-Status: Backport
|
||||
[https://git.qemu.org/?p=qemu.git;a=commit;h=a7104eda7dab99d0cdbd3595c211864cba415905]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
slirp/tcp_subr.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/slirp/tcp_subr.c b/slirp/tcp_subr.c
|
||||
index 8d0f94b75f..7277aadfdf 100644
|
||||
--- a/slirp/tcp_subr.c
|
||||
+++ b/slirp/tcp_subr.c
|
||||
@@ -640,6 +640,11 @@ tcp_emu(struct socket *so, struct mbuf *m)
|
||||
socklen_t addrlen = sizeof(struct sockaddr_in);
|
||||
struct sbuf *so_rcv = &so->so_rcv;
|
||||
|
||||
+ if (m->m_len > so_rcv->sb_datalen
|
||||
+ - (so_rcv->sb_wptr - so_rcv->sb_data)) {
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
memcpy(so_rcv->sb_wptr, m->m_data, m->m_len);
|
||||
so_rcv->sb_wptr += m->m_len;
|
||||
so_rcv->sb_rptr += m->m_len;
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
215
meta/recipes-devtools/qemu/qemu/CVE-2019-8934.patch
Normal file
215
meta/recipes-devtools/qemu/qemu/CVE-2019-8934.patch
Normal file
@@ -0,0 +1,215 @@
|
||||
From 13e153f01b4f2a3e199202b34a247d83c176f21a Mon Sep 17 00:00:00 2001
|
||||
From: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Date: Mon, 18 Feb 2019 23:43:49 +0530
|
||||
Subject: [PATCH] ppc: add host-serial and host-model machine attributes
|
||||
(CVE-2019-8934)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
On ppc hosts, hypervisor shares following system attributes
|
||||
|
||||
- /proc/device-tree/system-id
|
||||
- /proc/device-tree/model
|
||||
|
||||
with a guest. This could lead to information leakage and misuse.[*]
|
||||
Add machine attributes to control such system information exposure
|
||||
to a guest.
|
||||
|
||||
[*] https://wiki.openstack.org/wiki/OSSN/OSSN-0028
|
||||
|
||||
Reported-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Fix-suggested-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
||||
Message-Id: <20190218181349.23885-1-ppandit@redhat.com>
|
||||
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
Reviewed-by: Greg Kurz <groug@kaod.org>
|
||||
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
||||
|
||||
CVE: CVE-2019-8934
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/qemu/qemu/commit/27461d69a0f108dea756419251acc3ea65198f1b]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
hw/ppc/spapr.c | 128 ++++++++++++++++++++++++++++++++++++++---
|
||||
include/hw/ppc/spapr.h | 2 +
|
||||
2 files changed, 123 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
|
||||
index 421b2dd09b..069d678ee0 100644
|
||||
--- a/hw/ppc/spapr.c
|
||||
+++ b/hw/ppc/spapr.c
|
||||
@@ -1266,13 +1266,30 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
|
||||
* Add info to guest to indentify which host is it being run on
|
||||
* and what is the uuid of the guest
|
||||
*/
|
||||
- if (kvmppc_get_host_model(&buf)) {
|
||||
- _FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
|
||||
- g_free(buf);
|
||||
+ if (spapr->host_model && !g_str_equal(spapr->host_model, "none")) {
|
||||
+ if (g_str_equal(spapr->host_model, "passthrough")) {
|
||||
+ /* -M host-model=passthrough */
|
||||
+ if (kvmppc_get_host_model(&buf)) {
|
||||
+ _FDT(fdt_setprop_string(fdt, 0, "host-model", buf));
|
||||
+ g_free(buf);
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* -M host-model=<user-string> */
|
||||
+ _FDT(fdt_setprop_string(fdt, 0, "host-model", spapr->host_model));
|
||||
+ }
|
||||
}
|
||||
- if (kvmppc_get_host_serial(&buf)) {
|
||||
- _FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
|
||||
- g_free(buf);
|
||||
+
|
||||
+ if (spapr->host_serial && !g_str_equal(spapr->host_serial, "none")) {
|
||||
+ if (g_str_equal(spapr->host_serial, "passthrough")) {
|
||||
+ /* -M host-serial=passthrough */
|
||||
+ if (kvmppc_get_host_serial(&buf)) {
|
||||
+ _FDT(fdt_setprop_string(fdt, 0, "host-serial", buf));
|
||||
+ g_free(buf);
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* -M host-serial=<user-string> */
|
||||
+ _FDT(fdt_setprop_string(fdt, 0, "host-serial", spapr->host_serial));
|
||||
+ }
|
||||
}
|
||||
|
||||
buf = qemu_uuid_unparse_strdup(&qemu_uuid);
|
||||
@@ -3027,6 +3044,73 @@ static void spapr_set_vsmt(Object *obj, Visitor *v, const char *name,
|
||||
visit_type_uint32(v, name, (uint32_t *)opaque, errp);
|
||||
}
|
||||
|
||||
+static char *spapr_get_ic_mode(Object *obj, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ if (spapr->irq == &spapr_irq_xics_legacy) {
|
||||
+ return g_strdup("legacy");
|
||||
+ } else if (spapr->irq == &spapr_irq_xics) {
|
||||
+ return g_strdup("xics");
|
||||
+ } else if (spapr->irq == &spapr_irq_xive) {
|
||||
+ return g_strdup("xive");
|
||||
+ } else if (spapr->irq == &spapr_irq_dual) {
|
||||
+ return g_strdup("dual");
|
||||
+ }
|
||||
+ g_assert_not_reached();
|
||||
+}
|
||||
+
|
||||
+static void spapr_set_ic_mode(Object *obj, const char *value, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
|
||||
+ error_setg(errp, "This machine only uses the legacy XICS backend, don't pass ic-mode");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* The legacy IRQ backend can not be set */
|
||||
+ if (strcmp(value, "xics") == 0) {
|
||||
+ spapr->irq = &spapr_irq_xics;
|
||||
+ } else if (strcmp(value, "xive") == 0) {
|
||||
+ spapr->irq = &spapr_irq_xive;
|
||||
+ } else if (strcmp(value, "dual") == 0) {
|
||||
+ spapr->irq = &spapr_irq_dual;
|
||||
+ } else {
|
||||
+ error_setg(errp, "Bad value for \"ic-mode\" property");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static char *spapr_get_host_model(Object *obj, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ return g_strdup(spapr->host_model);
|
||||
+}
|
||||
+
|
||||
+static void spapr_set_host_model(Object *obj, const char *value, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ g_free(spapr->host_model);
|
||||
+ spapr->host_model = g_strdup(value);
|
||||
+}
|
||||
+
|
||||
+static char *spapr_get_host_serial(Object *obj, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ return g_strdup(spapr->host_serial);
|
||||
+}
|
||||
+
|
||||
+static void spapr_set_host_serial(Object *obj, const char *value, Error **errp)
|
||||
+{
|
||||
+ sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
+
|
||||
+ g_free(spapr->host_serial);
|
||||
+ spapr->host_serial = g_strdup(value);
|
||||
+}
|
||||
+
|
||||
static void spapr_instance_init(Object *obj)
|
||||
{
|
||||
sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
|
||||
@@ -3063,6 +3147,25 @@ static void spapr_instance_init(Object *obj)
|
||||
" the host's SMT mode", &error_abort);
|
||||
object_property_add_bool(obj, "vfio-no-msix-emulation",
|
||||
spapr_get_msix_emulation, NULL, NULL);
|
||||
+
|
||||
+ /* The machine class defines the default interrupt controller mode */
|
||||
+ spapr->irq = smc->irq;
|
||||
+ object_property_add_str(obj, "ic-mode", spapr_get_ic_mode,
|
||||
+ spapr_set_ic_mode, NULL);
|
||||
+ object_property_set_description(obj, "ic-mode",
|
||||
+ "Specifies the interrupt controller mode (xics, xive, dual)",
|
||||
+ NULL);
|
||||
+
|
||||
+ object_property_add_str(obj, "host-model",
|
||||
+ spapr_get_host_model, spapr_set_host_model,
|
||||
+ &error_abort);
|
||||
+ object_property_set_description(obj, "host-model",
|
||||
+ "Set host's model-id to use - none|passthrough|string", &error_abort);
|
||||
+ object_property_add_str(obj, "host-serial",
|
||||
+ spapr_get_host_serial, spapr_set_host_serial,
|
||||
+ &error_abort);
|
||||
+ object_property_set_description(obj, "host-serial",
|
||||
+ "Set host's system-id to use - none|passthrough|string", &error_abort);
|
||||
}
|
||||
|
||||
static void spapr_machine_finalizefn(Object *obj)
|
||||
@@ -4067,7 +4170,18 @@ static void spapr_machine_3_0_instance_options(MachineState *machine)
|
||||
|
||||
static void spapr_machine_3_0_class_options(MachineClass *mc)
|
||||
{
|
||||
- /* Defaults for the latest behaviour inherited from the base class */
|
||||
+ sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
|
||||
+ static GlobalProperty compat[] = {
|
||||
+ { TYPE_SPAPR_MACHINE, "host-model", "passthrough" },
|
||||
+ { TYPE_SPAPR_MACHINE, "host-serial", "passthrough" },
|
||||
+ };
|
||||
+
|
||||
+ spapr_machine_4_0_class_options(mc);
|
||||
+ compat_props_add(mc->compat_props, hw_compat_3_1, hw_compat_3_1_len);
|
||||
+ compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
|
||||
+
|
||||
+ mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
|
||||
+ smc->update_dt_enabled = false;
|
||||
}
|
||||
|
||||
DEFINE_SPAPR_MACHINE(3_0, "3.0", true);
|
||||
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
|
||||
index 7e5de1a6fd..4c69a55374 100644
|
||||
--- a/include/hw/ppc/spapr.h
|
||||
+++ b/include/hw/ppc/spapr.h
|
||||
@@ -165,6 +165,8 @@ struct sPAPRMachineState {
|
||||
|
||||
/*< public >*/
|
||||
char *kvm_type;
|
||||
+ char *host_model;
|
||||
+ char *host_serial;
|
||||
|
||||
const char *icp_type;
|
||||
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
@@ -21,8 +21,8 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://0009-apic-fixup-fallthrough-to-PIC.patch \
|
||||
file://0010-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \
|
||||
file://0011-Revert-linux-user-fix-mmap-munmap-mprotect-mremap-sh.patch \
|
||||
file://CVE-2018-10839.patch\
|
||||
file://CVE-2018-15746.patch \
|
||||
file://CVE-2018-17958.patch \
|
||||
file://CVE-2018-17962.patch \
|
||||
file://CVE-2018-17963.patch \
|
||||
file://CVE-2018-16867.patch \
|
||||
@@ -35,6 +35,13 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://CVE-2018-20815_p1.patch \
|
||||
file://CVE-2018-20815_p2.patch \
|
||||
file://CVE-2019-9824.patch \
|
||||
file://0014-linux-user-fix-to-handle-variably-sized-SIOCGSTAMP-w.patch \
|
||||
file://CVE-2018-18954.patch \
|
||||
file://CVE-2019-3812.patch \
|
||||
file://CVE-2019-6778.patch \
|
||||
file://CVE-2019-8934.patch \
|
||||
file://0001-linux-user-assume-__NR_gettid-always-exists.patch \
|
||||
file://0001-linux-user-rename-gettid-to-sys_gettid-to-avoid-clas.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From fcd9e3aba122a220af617a802c4f47bad4b51e64 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Fri, 7 Dec 2018 07:05:10 +0100
|
||||
Subject: [PATCH] Fix: Dereference of null pointer
|
||||
Reply-To: muislam@microsoft.com
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
|
||||
---
|
||||
ext/repo_repomdxml.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ext/repo_repomdxml.c b/ext/repo_repomdxml.c
|
||||
index 760d481f..b2a5b8dd 100644
|
||||
--- a/ext/repo_repomdxml.c
|
||||
+++ b/ext/repo_repomdxml.c
|
||||
@@ -181,7 +181,7 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
|
||||
while (value)
|
||||
{
|
||||
char *p = strchr(value, ',');
|
||||
- if (*p)
|
||||
+ if (p)
|
||||
*p++ = 0;
|
||||
if (*value)
|
||||
repodata_add_poolstr_array(pd->data, SOLVID_META, REPOSITORY_UPDATES, value);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
From 58053b44c9ed043d48fa7dd595d213849b733f0f Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 09:50:06 +0100
|
||||
Subject: [PATCH] Fix: Add va_end() before return
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
The va_end() performs cleanup.
|
||||
If va_end() is not called before a function that calls va_start() returns,
|
||||
the behavior is undefined.
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
src/pool.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/pool.c b/src/pool.c
|
||||
index 60cc0f49..f03b43f9 100644
|
||||
--- a/src/pool.c
|
||||
+++ b/src/pool.c
|
||||
@@ -1505,6 +1505,7 @@ pool_debug(Pool *pool, int type, const char *format, ...)
|
||||
vprintf(format, args);
|
||||
else
|
||||
vfprintf(stderr, format, args);
|
||||
+ va_end(args);
|
||||
return;
|
||||
}
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
From 6c99f33252d8bf8ff3e49013b8ad78aacf71c5d8 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 10:14:04 +0100
|
||||
Subject: [PATCH] Fix: Memory leaks
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
ext/repo_rpmdb.c | 16 ++++++++++++++++
|
||||
ext/testcase.c | 4 ++++
|
||||
tools/repo2solv.c | 1 +
|
||||
3 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
||||
index 75bb6780..ff939978 100644
|
||||
--- a/ext/repo_rpmdb.c
|
||||
+++ b/ext/repo_rpmdb.c
|
||||
@@ -1939,6 +1939,8 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (fread(lead, 96 + 16, 1, fp) != 1 || getu32(lead) != 0xedabeedb)
|
||||
{
|
||||
pool_error(pool, -1, "%s: not a rpm", rpm);
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -1951,12 +1953,16 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (lead[78] != 0 || lead[79] != 5)
|
||||
{
|
||||
pool_error(pool, -1, "%s: not a rpm v5 header", rpm);
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
if (getu32(lead + 96) != 0x8eade801)
|
||||
{
|
||||
pool_error(pool, -1, "%s: bad signature header", rpm);
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -1965,6 +1971,8 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (sigcnt >= MAX_SIG_CNT || sigdsize >= MAX_SIG_DSIZE)
|
||||
{
|
||||
pool_error(pool, -1, "%s: bad signature header", rpm);
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -1975,6 +1983,8 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
{
|
||||
if (!headfromfp(&state, rpm, fp, lead + 96, sigcnt, sigdsize, sigpad, chksumh, leadsigchksumh))
|
||||
{
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -2014,6 +2024,8 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (fread(lead, l, 1, fp) != 1)
|
||||
{
|
||||
pool_error(pool, -1, "%s: unexpected EOF", rpm);
|
||||
+ solv_chksum_free(leadsigchksumh, NULL);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -2034,6 +2046,7 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (fread(lead, 16, 1, fp) != 1)
|
||||
{
|
||||
pool_error(pool, -1, "%s: unexpected EOF", rpm);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -2042,6 +2055,7 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (getu32(lead) != 0x8eade801)
|
||||
{
|
||||
pool_error(pool, -1, "%s: bad header", rpm);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -2050,6 +2064,7 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
if (sigcnt >= MAX_HDR_CNT || sigdsize >= MAX_HDR_DSIZE)
|
||||
{
|
||||
pool_error(pool, -1, "%s: bad header", rpm);
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
@@ -2057,6 +2072,7 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags)
|
||||
|
||||
if (!headfromfp(&state, rpm, fp, lead, sigcnt, sigdsize, 0, chksumh, 0))
|
||||
{
|
||||
+ solv_chksum_free(chksumh, NULL);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/ext/testcase.c b/ext/testcase.c
|
||||
index aa72a8d7..3901d90d 100644
|
||||
--- a/ext/testcase.c
|
||||
+++ b/ext/testcase.c
|
||||
@@ -2348,6 +2348,7 @@ testcase_write_mangled(Solver *solv, const char *dir, int resultflags, const cha
|
||||
if (fclose(fp))
|
||||
{
|
||||
pool_error(solv->pool, 0, "testcase_write: write error");
|
||||
+ solv_free(result);
|
||||
strqueue_free(&sq);
|
||||
return 0;
|
||||
}
|
||||
@@ -2360,12 +2361,14 @@ testcase_write_mangled(Solver *solv, const char *dir, int resultflags, const cha
|
||||
if (!(fp = fopen(out, "w")))
|
||||
{
|
||||
pool_error(solv->pool, 0, "testcase_write: could not open '%s' for writing", out);
|
||||
+ solv_free(cmd);
|
||||
strqueue_free(&sq);
|
||||
return 0;
|
||||
}
|
||||
if (*cmd && fwrite(cmd, strlen(cmd), 1, fp) != 1)
|
||||
{
|
||||
pool_error(solv->pool, 0, "testcase_write: write error");
|
||||
+ solv_free(cmd);
|
||||
strqueue_free(&sq);
|
||||
fclose(fp);
|
||||
return 0;
|
||||
@@ -2373,6 +2376,7 @@ testcase_write_mangled(Solver *solv, const char *dir, int resultflags, const cha
|
||||
if (fclose(fp))
|
||||
{
|
||||
pool_error(solv->pool, 0, "testcase_write: write error");
|
||||
+ solv_free(cmd);
|
||||
strqueue_free(&sq);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/tools/repo2solv.c b/tools/repo2solv.c
|
||||
index e055e408..30a41f42 100644
|
||||
--- a/tools/repo2solv.c
|
||||
+++ b/tools/repo2solv.c
|
||||
@@ -208,6 +208,7 @@ read_plaindir_repo(Repo *repo, const char *dir)
|
||||
repodata_set_location(data, p, 0, 0, bp[0] == '.' && bp[1] == '/' ? bp + 2 : bp);
|
||||
solv_free(rpm);
|
||||
}
|
||||
+ solv_free(buf);
|
||||
fclose(fp);
|
||||
while (waitpid(pid, &wstatus, 0) == -1)
|
||||
{
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 823bf65087a017d2f488f01e09ee284fa36f7446 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 10:22:09 +0100
|
||||
Subject: [PATCH] Fix: testsolv segfault
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fab0e11bf2b bp 0x7ffdfc044b70 sp 0x7ffdfc044a90 T0)
|
||||
0 0x7fab0e11bf2a in testcase_str2dep_complex /home/company/real_sanitize/libsolv-master/ext/testcase.c:577
|
||||
1 0x7fab0e11c80f in testcase_str2dep /home/company/real_sanitize/libsolv-master/ext/testcase.c:656
|
||||
2 0x7fab0e12e64a in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2952
|
||||
3 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
|
||||
4 0x7fab0d9d2a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
|
||||
5 0x401bb8 in _start (/home/company/real_sanitize/libsolv-master/build/install/bin/testsolv+0x401bb8)
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
ext/testcase.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/ext/testcase.c b/ext/testcase.c
|
||||
index 3901d90d..dd20de14 100644
|
||||
--- a/ext/testcase.c
|
||||
+++ b/ext/testcase.c
|
||||
@@ -571,6 +571,8 @@ testcase_str2dep_complex(Pool *pool, const char **sp, int relop)
|
||||
Id flags, id, id2, namespaceid = 0;
|
||||
struct oplist *op;
|
||||
|
||||
+ if (!s)
|
||||
+ return 0;
|
||||
while (*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
if (!strncmp(s, "namespace:", 10))
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From 43928ee565b9c4f69daa1875da66f92b2d5bf932 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 10:27:15 +0100
|
||||
Subject: [PATCH] Fix: testsolv segfaults
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
ERROR: AddressSanitizer: SEGV on unknown address 0x0000000002f0 (pc 0x7f31501d3bd2 bp 0x7ffcfe4d4a50 sp 0x7ffcfe4d4a30 T0)
|
||||
0 0x7f31501d3bd1 in pool_whatprovides /home/company/real_sanitize/libsolv-master/src/pool.h:331
|
||||
1 0x7f31501d895e in testcase_str2solvid /home/company/real_sanitize/libsolv-master/ext/testcase.c:793
|
||||
2 0x7f31501e8388 in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2807
|
||||
3 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
|
||||
4 0x7f314fa8da3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
|
||||
5 0x401bb8 in _start (/home/company/real_sanitize/libsolv-master/build/install/bin/testsolv+0x401bb8)
|
||||
|
||||
ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f5af9e7815f bp 0x7ffc4c843a40 sp 0x7ffc4c8436c0 T0)
|
||||
0 0x7f5af9e7815e in testcase_read /home/company/real_sanitize/libsolv-master/ext/testcase.c:2799
|
||||
1 0x402aa5 in main /home/company/real_sanitize/libsolv-master/tools/testsolv.c:148
|
||||
2 0x7f5af971da3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f)
|
||||
3 0x401bb8 in _start (/home/company/real_sanitize/libsolv-master/build/install/bin/testsolv+0x401bb8)
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
ext/testcase.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ext/testcase.c b/ext/testcase.c
|
||||
index dd20de14..83467fe2 100644
|
||||
--- a/ext/testcase.c
|
||||
+++ b/ext/testcase.c
|
||||
@@ -2772,7 +2772,7 @@ testcase_read(Pool *pool, FILE *fp, const char *testcase, Queue *job, char **res
|
||||
{
|
||||
int i = strlen(pieces[1]);
|
||||
s = strchr(pieces[1], '(');
|
||||
- if (!s && pieces[1][i - 1] != ')')
|
||||
+ if (!s || pieces[1][i - 1] != ')')
|
||||
{
|
||||
pool_error(pool, 0, "testcase_read: bad namespace '%s'", pieces[1]);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From ebb51f73491987435664ac14b79bebe16ffbdd5c Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 12:40:42 +0100
|
||||
Subject: [PATCH] Fix: Be sure that NONBLOCK is set
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
examples/solv/fastestmirror.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/examples/solv/fastestmirror.c b/examples/solv/fastestmirror.c
|
||||
index d2ebd97a..0ee4e73b 100644
|
||||
--- a/examples/solv/fastestmirror.c
|
||||
+++ b/examples/solv/fastestmirror.c
|
||||
@@ -68,7 +68,11 @@ findfastest(char **urls, int nurls)
|
||||
socks[i] = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
|
||||
if (socks[i] >= 0)
|
||||
{
|
||||
- fcntl(socks[i], F_SETFL, O_NONBLOCK);
|
||||
+ if (fcntl(socks[i], F_SETFL, O_NONBLOCK) == -1)
|
||||
+ {
|
||||
+ close(socks[i]);
|
||||
+ socks[i] = -1;
|
||||
+ }
|
||||
if (connect(socks[i], result->ai_addr, result->ai_addrlen) == -1)
|
||||
{
|
||||
if (errno != EINPROGRESS)
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
From edf87c92cf59c2eed9c1e33c51a47163da15d90b Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Rohel <jrohel@redhat.com>
|
||||
Date: Tue, 11 Dec 2018 12:58:34 +0100
|
||||
Subject: [PATCH] Don't set values that are never read
|
||||
Reply-To: muislam@microsoft.com
|
||||
|
||||
CVE: CVE-2018-20532 CVE-2018-20533 CVE-2018-20534
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Muminul Islam <muislam@microsoft.com>
|
||||
|
||||
Cherry picked from https://github.com/openSUSE/libsolv/pull/291/commits
|
||||
---
|
||||
ext/pool_fileconflicts.c | 1 -
|
||||
ext/repo_appdata.c | 2 +-
|
||||
ext/repo_comps.c | 2 +-
|
||||
src/cleandeps.c | 1 -
|
||||
src/dirpool.c | 2 +-
|
||||
src/order.c | 1 -
|
||||
src/repopage.c | 1 -
|
||||
7 files changed, 3 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/ext/pool_fileconflicts.c b/ext/pool_fileconflicts.c
|
||||
index eaeb52b2..2fd3d540 100644
|
||||
--- a/ext/pool_fileconflicts.c
|
||||
+++ b/ext/pool_fileconflicts.c
|
||||
@@ -590,7 +590,6 @@ findfileconflicts_alias_cb(void *cbdatav, const char *fn, struct filelistinfo *i
|
||||
|
||||
if (!info->dirlen)
|
||||
return;
|
||||
- dp = fn + info->dirlen;
|
||||
if (info->diridx != cbdata->lastdiridx)
|
||||
{
|
||||
cbdata->lastdiridx = info->diridx;
|
||||
diff --git a/ext/repo_appdata.c b/ext/repo_appdata.c
|
||||
index 62faf2d8..69d46386 100644
|
||||
--- a/ext/repo_appdata.c
|
||||
+++ b/ext/repo_appdata.c
|
||||
@@ -103,7 +103,7 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
|
||||
{
|
||||
struct parsedata *pd = xmlp->userdata;
|
||||
Pool *pool = pd->pool;
|
||||
- Solvable *s = pd->solvable;
|
||||
+ Solvable *s;
|
||||
const char *type;
|
||||
|
||||
/* ignore all language tags */
|
||||
diff --git a/ext/repo_comps.c b/ext/repo_comps.c
|
||||
index 255ecb16..e59f8d12 100644
|
||||
--- a/ext/repo_comps.c
|
||||
+++ b/ext/repo_comps.c
|
||||
@@ -107,7 +107,7 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
|
||||
{
|
||||
struct parsedata *pd = xmlp->userdata;
|
||||
Pool *pool = pd->pool;
|
||||
- Solvable *s = pd->solvable;
|
||||
+ Solvable *s;
|
||||
|
||||
switch(state)
|
||||
{
|
||||
diff --git a/src/cleandeps.c b/src/cleandeps.c
|
||||
index 1da28f6e..b2fde317 100644
|
||||
--- a/src/cleandeps.c
|
||||
+++ b/src/cleandeps.c
|
||||
@@ -748,7 +748,6 @@ solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded)
|
||||
continue;
|
||||
if (strncmp(pool_id2str(pool, s->name), "pattern:", 8) != 0)
|
||||
continue;
|
||||
- dp = s->repo->idarraydata + s->requires;
|
||||
for (dp = s->repo->idarraydata + s->requires; *dp; dp++)
|
||||
FOR_PROVIDES(p, pp, *dp)
|
||||
if (pool->solvables[p].repo == installed)
|
||||
diff --git a/src/dirpool.c b/src/dirpool.c
|
||||
index afb26ea5..bed9435e 100644
|
||||
--- a/src/dirpool.c
|
||||
+++ b/src/dirpool.c
|
||||
@@ -85,7 +85,7 @@ dirpool_make_dirtraverse(Dirpool *dp)
|
||||
return;
|
||||
dp->dirs = solv_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK);
|
||||
dirtraverse = solv_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK);
|
||||
- for (parent = 0, i = 0; i < dp->ndirs; i++)
|
||||
+ for (i = 0; i < dp->ndirs; i++)
|
||||
{
|
||||
if (dp->dirs[i] > 0)
|
||||
continue;
|
||||
diff --git a/src/order.c b/src/order.c
|
||||
index c92c3328..cfde40c9 100644
|
||||
--- a/src/order.c
|
||||
+++ b/src/order.c
|
||||
@@ -1066,7 +1066,6 @@ transaction_order(Transaction *trans, int flags)
|
||||
#if 0
|
||||
printf("do %s [%d]\n", pool_solvid2str(pool, te->p), temedianr[i]);
|
||||
#endif
|
||||
- s = pool->solvables + te->p;
|
||||
for (j = te->edges; od.invedgedata[j]; j++)
|
||||
{
|
||||
struct _TransactionElement *te2 = od.tes + od.invedgedata[j];
|
||||
diff --git a/src/repopage.c b/src/repopage.c
|
||||
index 2b7a863b..85d53eb9 100644
|
||||
--- a/src/repopage.c
|
||||
+++ b/src/repopage.c
|
||||
@@ -399,7 +399,6 @@ match_done:
|
||||
litlen -= 32;
|
||||
}
|
||||
}
|
||||
- litofs = 0;
|
||||
}
|
||||
return oo;
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -10,6 +10,13 @@ DEPENDS = "expat zlib"
|
||||
SRC_URI = "git://github.com/openSUSE/libsolv.git"
|
||||
SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch \
|
||||
file://0002-Fixes-to-internal-fopencookie-implementation.patch \
|
||||
file://0003-Fix-Dereference-of-null-pointer.patch \
|
||||
file://0004-Fix-Add-va_end-before-return.patch \
|
||||
file://0005-Fix-Memory-leaks.patch \
|
||||
file://0006-Fix-testsolv-segfault.patch \
|
||||
file://0007-Fix-testsolv-segfaults.patch \
|
||||
file://0008-Fix-Be-sure-that-NONBLOCK-is-set.patch \
|
||||
file://0009-Don-t-set-values-that-are-never-read.patch \
|
||||
"
|
||||
|
||||
SRCREV = "38c5374d4712667b0b6ada4bf78ddbb343095d0c"
|
||||
|
||||
33
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p1.patch
Normal file
33
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p1.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 080d52c3c9416c731f637f9c6e003961ef43f079 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Mon, 27 May 2019 08:20:32 -0700
|
||||
Subject: [PATCH 1/3] Fix bug in undefer_input() that misplaced the input
|
||||
state.
|
||||
|
||||
CVE: CVE-2019-13232
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/madler/unzip/commit/41beb477c5744bc396fa1162ee0c14218ec12213]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
fileio.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fileio.c b/fileio.c
|
||||
index 7605a29..14460f3 100644
|
||||
--- a/fileio.c
|
||||
+++ b/fileio.c
|
||||
@@ -532,8 +532,10 @@ void undefer_input(__G)
|
||||
* This condition was checked when G.incnt_leftover was set > 0 in
|
||||
* defer_leftover_input(), and it is NOT allowed to touch G.csize
|
||||
* before calling undefer_input() when (G.incnt_leftover > 0)
|
||||
- * (single exception: see read_byte()'s "G.csize <= 0" handling) !!
|
||||
+ * (single exception: see readbyte()'s "G.csize <= 0" handling) !!
|
||||
*/
|
||||
+ if (G.csize < 0L)
|
||||
+ G.csize = 0L;
|
||||
G.incnt = G.incnt_leftover + (int)G.csize;
|
||||
G.inptr = G.inptr_leftover - (int)G.csize;
|
||||
G.incnt_leftover = 0;
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
356
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p2.patch
Normal file
356
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p2.patch
Normal file
@@ -0,0 +1,356 @@
|
||||
From 1aae47fa8935654a84403768f32c03ecbb1be470 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Tue, 11 Jun 2019 22:01:18 -0700
|
||||
Subject: [PATCH 2/3] Detect and reject a zip bomb using overlapped entries.
|
||||
|
||||
This detects an invalid zip file that has at least one entry that
|
||||
overlaps with another entry or with the central directory to the
|
||||
end of the file. A Fifield zip bomb uses overlapped local entries
|
||||
to vastly increase the potential inflation ratio. Such an invalid
|
||||
zip file is rejected.
|
||||
|
||||
See https://www.bamsoftware.com/hacks/zipbomb/ for David Fifield's
|
||||
analysis, construction, and examples of such zip bombs.
|
||||
|
||||
The detection maintains a list of covered spans of the zip files
|
||||
so far, where the central directory to the end of the file and any
|
||||
bytes preceding the first entry at zip file offset zero are
|
||||
considered covered initially. Then as each entry is decompressed
|
||||
or tested, it is considered covered. When a new entry is about to
|
||||
be processed, its initial offset is checked to see if it is
|
||||
contained by a covered span. If so, the zip file is rejected as
|
||||
invalid.
|
||||
|
||||
This commit depends on a preceding commit: "Fix bug in
|
||||
undefer_input() that misplaced the input state."
|
||||
|
||||
CVE: CVE-2019-13232
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/madler/unzip/commit/47b3ceae397d21bf822bc2ac73052a4b1daf8e1c]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
extract.c | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
globals.c | 1 +
|
||||
globals.h | 3 +
|
||||
process.c | 10 +++
|
||||
unzip.h | 1 +
|
||||
5 files changed, 204 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/extract.c b/extract.c
|
||||
index 24db2a8..2bb72ba 100644
|
||||
--- a/extract.c
|
||||
+++ b/extract.c
|
||||
@@ -321,6 +321,125 @@ static ZCONST char Far UnsupportedExtraField[] =
|
||||
"\nerror: unsupported extra-field compression type (%u)--skipping\n";
|
||||
static ZCONST char Far BadExtraFieldCRC[] =
|
||||
"error [%s]: bad extra-field CRC %08lx (should be %08lx)\n";
|
||||
+static ZCONST char Far NotEnoughMemCover[] =
|
||||
+ "error: not enough memory for bomb detection\n";
|
||||
+static ZCONST char Far OverlappedComponents[] =
|
||||
+ "error: invalid zip file with overlapped components (possible zip bomb)\n";
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+
|
||||
+/* A growable list of spans. */
|
||||
+typedef zoff_t bound_t;
|
||||
+typedef struct {
|
||||
+ bound_t beg; /* start of the span */
|
||||
+ bound_t end; /* one past the end of the span */
|
||||
+} span_t;
|
||||
+typedef struct {
|
||||
+ span_t *span; /* allocated, distinct, and sorted list of spans */
|
||||
+ size_t num; /* number of spans in the list */
|
||||
+ size_t max; /* allocated number of spans (num <= max) */
|
||||
+} cover_t;
|
||||
+
|
||||
+/*
|
||||
+ * Return the index of the first span in cover whose beg is greater than val.
|
||||
+ * If there is no such span, then cover->num is returned.
|
||||
+ */
|
||||
+static size_t cover_find(cover, val)
|
||||
+ cover_t *cover;
|
||||
+ bound_t val;
|
||||
+{
|
||||
+ size_t lo = 0, hi = cover->num;
|
||||
+ while (lo < hi) {
|
||||
+ size_t mid = (lo + hi) >> 1;
|
||||
+ if (val < cover->span[mid].beg)
|
||||
+ hi = mid;
|
||||
+ else
|
||||
+ lo = mid + 1;
|
||||
+ }
|
||||
+ return hi;
|
||||
+}
|
||||
+
|
||||
+/* Return true if val lies within any one of the spans in cover. */
|
||||
+static int cover_within(cover, val)
|
||||
+ cover_t *cover;
|
||||
+ bound_t val;
|
||||
+{
|
||||
+ size_t pos = cover_find(cover, val);
|
||||
+ return pos > 0 && val < cover->span[pos - 1].end;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Add a new span to the list, but only if the new span does not overlap any
|
||||
+ * spans already in the list. The new span covers the values beg..end-1. beg
|
||||
+ * must be less than end.
|
||||
+ *
|
||||
+ * Keep the list sorted and merge adjacent spans. Grow the allocated space for
|
||||
+ * the list as needed. On success, 0 is returned. If the new span overlaps any
|
||||
+ * existing spans, then 1 is returned and the new span is not added to the
|
||||
+ * list. If the new span is invalid because beg is greater than or equal to
|
||||
+ * end, then -1 is returned. If the list needs to be grown but the memory
|
||||
+ * allocation fails, then -2 is returned.
|
||||
+ */
|
||||
+static int cover_add(cover, beg, end)
|
||||
+ cover_t *cover;
|
||||
+ bound_t beg;
|
||||
+ bound_t end;
|
||||
+{
|
||||
+ size_t pos;
|
||||
+ int prec, foll;
|
||||
+
|
||||
+ if (beg >= end)
|
||||
+ /* The new span is invalid. */
|
||||
+ return -1;
|
||||
+
|
||||
+ /* Find where the new span should go, and make sure that it does not
|
||||
+ overlap with any existing spans. */
|
||||
+ pos = cover_find(cover, beg);
|
||||
+ if ((pos > 0 && beg < cover->span[pos - 1].end) ||
|
||||
+ (pos < cover->num && end > cover->span[pos].beg))
|
||||
+ return 1;
|
||||
+
|
||||
+ /* Check for adjacencies. */
|
||||
+ prec = pos > 0 && beg == cover->span[pos - 1].end;
|
||||
+ foll = pos < cover->num && end == cover->span[pos].beg;
|
||||
+ if (prec && foll) {
|
||||
+ /* The new span connects the preceding and following spans. Merge the
|
||||
+ following span into the preceding span, and delete the following
|
||||
+ span. */
|
||||
+ cover->span[pos - 1].end = cover->span[pos].end;
|
||||
+ cover->num--;
|
||||
+ memmove(cover->span + pos, cover->span + pos + 1,
|
||||
+ (cover->num - pos) * sizeof(span_t));
|
||||
+ }
|
||||
+ else if (prec)
|
||||
+ /* The new span is adjacent only to the preceding span. Extend the end
|
||||
+ of the preceding span. */
|
||||
+ cover->span[pos - 1].end = end;
|
||||
+ else if (foll)
|
||||
+ /* The new span is adjacent only to the following span. Extend the
|
||||
+ beginning of the following span. */
|
||||
+ cover->span[pos].beg = beg;
|
||||
+ else {
|
||||
+ /* The new span has gaps between both the preceding and the following
|
||||
+ spans. Assure that there is room and insert the span. */
|
||||
+ if (cover->num == cover->max) {
|
||||
+ size_t max = cover->max == 0 ? 16 : cover->max << 1;
|
||||
+ span_t *span = realloc(cover->span, max * sizeof(span_t));
|
||||
+ if (span == NULL)
|
||||
+ return -2;
|
||||
+ cover->span = span;
|
||||
+ cover->max = max;
|
||||
+ }
|
||||
+ memmove(cover->span + pos + 1, cover->span + pos,
|
||||
+ (cover->num - pos) * sizeof(span_t));
|
||||
+ cover->num++;
|
||||
+ cover->span[pos].beg = beg;
|
||||
+ cover->span[pos].end = end;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
|
||||
|
||||
@@ -376,6 +495,29 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||
}
|
||||
#endif /* !SFX || SFX_EXDIR */
|
||||
|
||||
+ /* One more: initialize cover structure for bomb detection. Start with a
|
||||
+ span that covers the central directory though the end of the file. */
|
||||
+ if (G.cover == NULL) {
|
||||
+ G.cover = malloc(sizeof(cover_t));
|
||||
+ if (G.cover == NULL) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(NotEnoughMemCover)));
|
||||
+ return PK_MEM;
|
||||
+ }
|
||||
+ ((cover_t *)G.cover)->span = NULL;
|
||||
+ ((cover_t *)G.cover)->max = 0;
|
||||
+ }
|
||||
+ ((cover_t *)G.cover)->num = 0;
|
||||
+ if ((G.extra_bytes != 0 &&
|
||||
+ cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
|
||||
+ cover_add((cover_t *)G.cover,
|
||||
+ G.extra_bytes + G.ecrec.offset_start_central_directory,
|
||||
+ G.ziplen) != 0) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(NotEnoughMemCover)));
|
||||
+ return PK_MEM;
|
||||
+ }
|
||||
+
|
||||
/*---------------------------------------------------------------------------
|
||||
The basic idea of this function is as follows. Since the central di-
|
||||
rectory lies at the end of the zipfile and the member files lie at the
|
||||
@@ -593,7 +735,8 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||
if (error > error_in_archive)
|
||||
error_in_archive = error;
|
||||
/* ...and keep going (unless disk full or user break) */
|
||||
- if (G.disk_full > 1 || error_in_archive == IZ_CTRLC) {
|
||||
+ if (G.disk_full > 1 || error_in_archive == IZ_CTRLC ||
|
||||
+ error == PK_BOMB) {
|
||||
/* clear reached_end to signal premature stop ... */
|
||||
reached_end = FALSE;
|
||||
/* ... and cancel scanning the central directory */
|
||||
@@ -1062,6 +1205,11 @@ static int extract_or_test_entrylist(__G__ numchunk,
|
||||
|
||||
/* seek_zipf(__G__ pInfo->offset); */
|
||||
request = G.pInfo->offset + G.extra_bytes;
|
||||
+ if (cover_within((cover_t *)G.cover, request)) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(OverlappedComponents)));
|
||||
+ return PK_BOMB;
|
||||
+ }
|
||||
inbuf_offset = request % INBUFSIZ;
|
||||
bufstart = request - inbuf_offset;
|
||||
|
||||
@@ -1593,6 +1741,18 @@ reprompt:
|
||||
return IZ_CTRLC; /* cancel operation by user request */
|
||||
}
|
||||
#endif
|
||||
+ error = cover_add((cover_t *)G.cover, request,
|
||||
+ G.cur_zipfile_bufstart + (G.inptr - G.inbuf));
|
||||
+ if (error < 0) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(NotEnoughMemCover)));
|
||||
+ return PK_MEM;
|
||||
+ }
|
||||
+ if (error != 0) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(OverlappedComponents)));
|
||||
+ return PK_BOMB;
|
||||
+ }
|
||||
#ifdef MACOS /* MacOS is no preemptive OS, thus call event-handling by hand */
|
||||
UserStop();
|
||||
#endif
|
||||
@@ -1994,6 +2154,34 @@ static int extract_or_test_member(__G) /* return PK-type error code */
|
||||
}
|
||||
|
||||
undefer_input(__G);
|
||||
+
|
||||
+ if ((G.lrec.general_purpose_bit_flag & 8) != 0) {
|
||||
+ /* skip over data descriptor (harder than it sounds, due to signature
|
||||
+ * ambiguity)
|
||||
+ */
|
||||
+# define SIG 0x08074b50
|
||||
+# define LOW 0xffffffff
|
||||
+ uch buf[12];
|
||||
+ unsigned shy = 12 - readbuf((char *)buf, 12);
|
||||
+ ulg crc = shy ? 0 : makelong(buf);
|
||||
+ ulg clen = shy ? 0 : makelong(buf + 4);
|
||||
+ ulg ulen = shy ? 0 : makelong(buf + 8); /* or high clen if ZIP64 */
|
||||
+ if (crc == SIG && /* if not SIG, no signature */
|
||||
+ (G.lrec.crc32 != SIG || /* if not SIG, have signature */
|
||||
+ (clen == SIG && /* if not SIG, no signature */
|
||||
+ ((G.lrec.csize & LOW) != SIG || /* if not SIG, have signature */
|
||||
+ (ulen == SIG && /* if not SIG, no signature */
|
||||
+ (G.zip64 ? G.lrec.csize >> 32 : G.lrec.ucsize) != SIG
|
||||
+ /* if not SIG, have signature */
|
||||
+ )))))
|
||||
+ /* skip four more bytes to account for signature */
|
||||
+ shy += 4 - readbuf((char *)buf, 4);
|
||||
+ if (G.zip64)
|
||||
+ shy += 8 - readbuf((char *)buf, 8); /* skip eight more for ZIP64 */
|
||||
+ if (shy)
|
||||
+ error = PK_ERR;
|
||||
+ }
|
||||
+
|
||||
return error;
|
||||
|
||||
} /* end function extract_or_test_member() */
|
||||
diff --git a/globals.c b/globals.c
|
||||
index fa8cca5..1e0f608 100644
|
||||
--- a/globals.c
|
||||
+++ b/globals.c
|
||||
@@ -181,6 +181,7 @@ Uz_Globs *globalsCtor()
|
||||
# if (!defined(NO_TIMESTAMPS))
|
||||
uO.D_flag=1; /* default to '-D', no restoration of dir timestamps */
|
||||
# endif
|
||||
+ G.cover = NULL; /* not allocated yet */
|
||||
#endif
|
||||
|
||||
uO.lflag=(-1);
|
||||
diff --git a/globals.h b/globals.h
|
||||
index 11b7215..2bdcdeb 100644
|
||||
--- a/globals.h
|
||||
+++ b/globals.h
|
||||
@@ -260,12 +260,15 @@ typedef struct Globals {
|
||||
ecdir_rec ecrec; /* used in unzip.c, extract.c */
|
||||
z_stat statbuf; /* used by main, mapname, check_for_newer */
|
||||
|
||||
+ int zip64; /* true if Zip64 info in extra field */
|
||||
+
|
||||
int mem_mode;
|
||||
uch *outbufptr; /* extract.c static */
|
||||
ulg outsize; /* extract.c static */
|
||||
int reported_backslash; /* extract.c static */
|
||||
int disk_full;
|
||||
int newfile;
|
||||
+ void **cover; /* used in extract.c for bomb detection */
|
||||
|
||||
int didCRlast; /* fileio static */
|
||||
ulg numlines; /* fileio static: number of lines printed */
|
||||
diff --git a/process.c b/process.c
|
||||
index a3c1a4d..208619c 100644
|
||||
--- a/process.c
|
||||
+++ b/process.c
|
||||
@@ -637,6 +637,13 @@ void free_G_buffers(__G) /* releases all memory allocated in global vars */
|
||||
}
|
||||
#endif
|
||||
|
||||
+ /* Free the cover span list and the cover structure. */
|
||||
+ if (G.cover != NULL) {
|
||||
+ free(*(G.cover));
|
||||
+ free(G.cover);
|
||||
+ G.cover = NULL;
|
||||
+ }
|
||||
+
|
||||
} /* end function free_G_buffers() */
|
||||
|
||||
|
||||
@@ -1905,6 +1912,7 @@ int getZip64Data(__G__ ef_buf, ef_len)
|
||||
|
||||
#define Z64FLGS 0xffff
|
||||
#define Z64FLGL 0xffffffff
|
||||
+ G.zip64 = FALSE;
|
||||
|
||||
if (ef_len == 0 || ef_buf == NULL)
|
||||
return PK_COOL;
|
||||
@@ -1964,6 +1972,8 @@ int getZip64Data(__G__ ef_buf, ef_len)
|
||||
G.crec.disk_number_start = (zuvl_t)makelong(offset + ef_buf);
|
||||
offset += 4;
|
||||
}
|
||||
+
|
||||
+ G.zip64 = TRUE;
|
||||
#if 0
|
||||
break; /* Expect only one EF_PKSZ64 block. */
|
||||
#endif /* 0 */
|
||||
diff --git a/unzip.h b/unzip.h
|
||||
index 5b2a326..ed24a5b 100644
|
||||
--- a/unzip.h
|
||||
+++ b/unzip.h
|
||||
@@ -645,6 +645,7 @@ typedef struct _Uzp_cdir_Rec {
|
||||
#define PK_NOZIP 9 /* zipfile not found */
|
||||
#define PK_PARAM 10 /* bad or illegal parameters specified */
|
||||
#define PK_FIND 11 /* no files found */
|
||||
+#define PK_BOMB 12 /* likely zip bomb */
|
||||
#define PK_DISK 50 /* disk full */
|
||||
#define PK_EOF 51 /* unexpected EOF */
|
||||
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
121
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p3.patch
Normal file
121
meta/recipes-extended/unzip/unzip/CVE-2019-13232_p3.patch
Normal file
@@ -0,0 +1,121 @@
|
||||
From be88aa4811af47ca06d8b7dcda294f899eba70ea Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Thu, 25 Jul 2019 20:43:17 -0700
|
||||
Subject: [PATCH 3/3] Do not raise a zip bomb alert for a misplaced central
|
||||
directory.
|
||||
|
||||
There is a zip-like file in the Firefox distribution, omni.ja,
|
||||
which is a zip container with the central directory placed at the
|
||||
start of the file instead of after the local entries as required
|
||||
by the zip standard. This commit marks the actual location of the
|
||||
central directory, as well as the end of central directory records,
|
||||
as disallowed locations. This now permits such containers to not
|
||||
raise a zip bomb alert, where in fact there are no overlaps.
|
||||
|
||||
CVE: CVE-2019-13232
|
||||
Upstream-Status: Backport
|
||||
[https://github.com/madler/unzip/commit/6d351831be705cc26d897db44f878a978f4138fc]
|
||||
|
||||
Signed-off-by: Dan Tran <dantran@microsoft.com>
|
||||
---
|
||||
extract.c | 25 +++++++++++++++++++------
|
||||
process.c | 6 ++++++
|
||||
unzpriv.h | 10 ++++++++++
|
||||
3 files changed, 35 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/extract.c b/extract.c
|
||||
index 2bb72ba..a9dcca8 100644
|
||||
--- a/extract.c
|
||||
+++ b/extract.c
|
||||
@@ -495,8 +495,11 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||
}
|
||||
#endif /* !SFX || SFX_EXDIR */
|
||||
|
||||
- /* One more: initialize cover structure for bomb detection. Start with a
|
||||
- span that covers the central directory though the end of the file. */
|
||||
+ /* One more: initialize cover structure for bomb detection. Start with
|
||||
+ spans that cover any extra bytes at the start, the central directory,
|
||||
+ the end of central directory record (including the Zip64 end of central
|
||||
+ directory locator, if present), and the Zip64 end of central directory
|
||||
+ record, if present. */
|
||||
if (G.cover == NULL) {
|
||||
G.cover = malloc(sizeof(cover_t));
|
||||
if (G.cover == NULL) {
|
||||
@@ -508,15 +511,25 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||
((cover_t *)G.cover)->max = 0;
|
||||
}
|
||||
((cover_t *)G.cover)->num = 0;
|
||||
- if ((G.extra_bytes != 0 &&
|
||||
- cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
|
||||
- cover_add((cover_t *)G.cover,
|
||||
+ if (cover_add((cover_t *)G.cover,
|
||||
G.extra_bytes + G.ecrec.offset_start_central_directory,
|
||||
- G.ziplen) != 0) {
|
||||
+ G.extra_bytes + G.ecrec.offset_start_central_directory +
|
||||
+ G.ecrec.size_central_directory) != 0) {
|
||||
Info(slide, 0x401, ((char *)slide,
|
||||
LoadFarString(NotEnoughMemCover)));
|
||||
return PK_MEM;
|
||||
}
|
||||
+ if ((G.extra_bytes != 0 &&
|
||||
+ cover_add((cover_t *)G.cover, 0, G.extra_bytes) != 0) ||
|
||||
+ (G.ecrec.have_ecr64 &&
|
||||
+ cover_add((cover_t *)G.cover, G.ecrec.ec64_start,
|
||||
+ G.ecrec.ec64_end) != 0) ||
|
||||
+ cover_add((cover_t *)G.cover, G.ecrec.ec_start,
|
||||
+ G.ecrec.ec_end) != 0) {
|
||||
+ Info(slide, 0x401, ((char *)slide,
|
||||
+ LoadFarString(OverlappedComponents)));
|
||||
+ return PK_BOMB;
|
||||
+ }
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
The basic idea of this function is as follows. Since the central di-
|
||||
diff --git a/process.c b/process.c
|
||||
index 208619c..5f8f6c6 100644
|
||||
--- a/process.c
|
||||
+++ b/process.c
|
||||
@@ -1408,6 +1408,10 @@ static int find_ecrec64(__G__ searchlen) /* return PK-class error */
|
||||
|
||||
/* Now, we are (almost) sure that we have a Zip64 archive. */
|
||||
G.ecrec.have_ecr64 = 1;
|
||||
+ G.ecrec.ec_start -= ECLOC64_SIZE+4;
|
||||
+ G.ecrec.ec64_start = ecrec64_start_offset;
|
||||
+ G.ecrec.ec64_end = ecrec64_start_offset +
|
||||
+ 12 + makeint64(&byterec[ECREC64_LENGTH]);
|
||||
|
||||
/* Update the "end-of-central-dir offset" for later checks. */
|
||||
G.real_ecrec_offset = ecrec64_start_offset;
|
||||
@@ -1542,6 +1546,8 @@ static int find_ecrec(__G__ searchlen) /* return PK-class error */
|
||||
makelong(&byterec[OFFSET_START_CENTRAL_DIRECTORY]);
|
||||
G.ecrec.zipfile_comment_length =
|
||||
makeword(&byterec[ZIPFILE_COMMENT_LENGTH]);
|
||||
+ G.ecrec.ec_start = G.real_ecrec_offset;
|
||||
+ G.ecrec.ec_end = G.ecrec.ec_start + 22 + G.ecrec.zipfile_comment_length;
|
||||
|
||||
/* Now, we have to read the archive comment, BEFORE the file pointer
|
||||
is moved away backwards to seek for a Zip64 ECLOC64 structure.
|
||||
diff --git a/unzpriv.h b/unzpriv.h
|
||||
index c8d3eab..5e177c7 100644
|
||||
--- a/unzpriv.h
|
||||
+++ b/unzpriv.h
|
||||
@@ -2185,6 +2185,16 @@ typedef struct VMStimbuf {
|
||||
int have_ecr64; /* valid Zip64 ecdir-record exists */
|
||||
int is_zip64_archive; /* Zip64 ecdir-record is mandatory */
|
||||
ush zipfile_comment_length;
|
||||
+ zusz_t ec_start, ec_end; /* offsets of start and end of the
|
||||
+ end of central directory record,
|
||||
+ including if present the Zip64
|
||||
+ end of central directory locator,
|
||||
+ which immediately precedes the
|
||||
+ end of central directory record */
|
||||
+ zusz_t ec64_start, ec64_end; /* if have_ecr64 is true, then these
|
||||
+ are the offsets of the start and
|
||||
+ end of the Zip64 end of central
|
||||
+ directory record */
|
||||
} ecdir_rec;
|
||||
|
||||
|
||||
--
|
||||
2.22.0.vfs.1.1.57.gbaf16c8
|
||||
|
||||
@@ -22,6 +22,9 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
|
||||
file://symlink.patch \
|
||||
file://0001-unzip-fix-CVE-2018-1000035.patch \
|
||||
file://CVE-2018-18384.patch \
|
||||
file://CVE-2019-13232_p1.patch \
|
||||
file://CVE-2019-13232_p2.patch \
|
||||
file://CVE-2019-13232_p3.patch \
|
||||
"
|
||||
UPSTREAM_VERSION_UNKNOWN = "1"
|
||||
|
||||
|
||||
73
meta/recipes-extended/wget/wget/CVE-2018-20483_p1.patch
Normal file
73
meta/recipes-extended/wget/wget/CVE-2018-20483_p1.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 6c5471e4834aebd7359d88b760b087136473bac8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
|
||||
Date: Wed, 26 Dec 2018 13:51:48 +0100
|
||||
Subject: [PATCH 1/2] Don't use extended attributes (--xattr) by default
|
||||
|
||||
* src/init.c (defaults): Set enable_xattr to false by default
|
||||
* src/main.c (print_help): Reverse option logic of --xattr
|
||||
* doc/wget.texi: Add description for --xattr
|
||||
|
||||
Users may not be aware that the origin URL and Referer are saved
|
||||
including credentials, and possibly access tokens within
|
||||
the urls.
|
||||
|
||||
CVE: CVE-2018-20483 patch 1
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/wget.git/commit/?id=c125d24762962d91050d925fbbd9e6f30b2302f8]
|
||||
Signed-off-by: Aviraj CJ <acj@cisco.com>
|
||||
---
|
||||
doc/wget.texi | 8 ++++++++
|
||||
src/init.c | 4 ----
|
||||
src/main.c | 2 +-
|
||||
3 files changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/doc/wget.texi b/doc/wget.texi
|
||||
index eaf6b380..3f9d7c1c 100644
|
||||
--- a/doc/wget.texi
|
||||
+++ b/doc/wget.texi
|
||||
@@ -540,6 +540,14 @@ right NUMBER.
|
||||
Set preferred location for Metalink resources. This has effect if multiple
|
||||
resources with same priority are available.
|
||||
|
||||
+@cindex xattr
|
||||
+@item --xattr
|
||||
+Enable use of file system's extended attributes to save the
|
||||
+original URL and the Referer HTTP header value if used.
|
||||
+
|
||||
+Be aware that the URL might contain private information like
|
||||
+access tokens or credentials.
|
||||
+
|
||||
|
||||
@cindex force html
|
||||
@item -F
|
||||
diff --git a/src/init.c b/src/init.c
|
||||
index eb81ab47..800970c5 100644
|
||||
--- a/src/init.c
|
||||
+++ b/src/init.c
|
||||
@@ -509,11 +509,7 @@ defaults (void)
|
||||
opt.hsts = true;
|
||||
#endif
|
||||
|
||||
-#ifdef ENABLE_XATTR
|
||||
- opt.enable_xattr = true;
|
||||
-#else
|
||||
opt.enable_xattr = false;
|
||||
-#endif
|
||||
}
|
||||
|
||||
/* Return the user's home directory (strdup-ed), or NULL if none is
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 81db9319..6ac1621b 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -754,7 +754,7 @@ Download:\n"),
|
||||
#endif
|
||||
#ifdef ENABLE_XATTR
|
||||
N_("\
|
||||
- --no-xattr turn off storage of metadata in extended file attributes\n"),
|
||||
+ --xattr turn on storage of metadata in extended file attributes\n"),
|
||||
#endif
|
||||
"\n",
|
||||
|
||||
--
|
||||
2.19.1
|
||||
|
||||
127
meta/recipes-extended/wget/wget/CVE-2018-20483_p2.patch
Normal file
127
meta/recipes-extended/wget/wget/CVE-2018-20483_p2.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
From 5a4ee4f3c07cc5dc7ef5f7244fcf51fd2fa3bc67 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
|
||||
Date: Wed, 26 Dec 2018 14:38:18 +0100
|
||||
Subject: [PATCH 2/2] Don't save user/pw with --xattr
|
||||
|
||||
Also the Referer info is reduced to scheme+host+port.
|
||||
|
||||
* src/ftp.c (getftp): Change params of set_file_metadata()
|
||||
* src/http.c (gethttp): Change params of set_file_metadata()
|
||||
* src/xattr.c (set_file_metadata): Remove user/password from origin URL,
|
||||
reduce Referer value to scheme/host/port.
|
||||
* src/xattr.h: Change prototype of set_file_metadata()
|
||||
|
||||
CVE: CVE-2018-20483 patch 2
|
||||
Upstream-Status: Backport [http://git.savannah.gnu.org/cgit/wget.git/commit/?id=3cdfb594cf75f11cdbb9702ac5e856c332ccacfa]
|
||||
Signed-off-by: Aviraj CJ <acj@cisco.com>
|
||||
---
|
||||
src/ftp.c | 2 +-
|
||||
src/http.c | 4 ++--
|
||||
src/xattr.c | 24 ++++++++++++++++++++----
|
||||
src/xattr.h | 3 ++-
|
||||
4 files changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/ftp.c b/src/ftp.c
|
||||
index 69148936..db8a6267 100644
|
||||
--- a/src/ftp.c
|
||||
+++ b/src/ftp.c
|
||||
@@ -1580,7 +1580,7 @@ Error in server response, closing control connection.\n"));
|
||||
|
||||
#ifdef ENABLE_XATTR
|
||||
if (opt.enable_xattr)
|
||||
- set_file_metadata (u->url, NULL, fp);
|
||||
+ set_file_metadata (u, NULL, fp);
|
||||
#endif
|
||||
|
||||
fd_close (local_sock);
|
||||
diff --git a/src/http.c b/src/http.c
|
||||
index 77bdbbed..472c328f 100644
|
||||
--- a/src/http.c
|
||||
+++ b/src/http.c
|
||||
@@ -4120,9 +4120,9 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
|
||||
if (opt.enable_xattr)
|
||||
{
|
||||
if (original_url != u)
|
||||
- set_file_metadata (u->url, original_url->url, fp);
|
||||
+ set_file_metadata (u, original_url, fp);
|
||||
else
|
||||
- set_file_metadata (u->url, NULL, fp);
|
||||
+ set_file_metadata (u, NULL, fp);
|
||||
}
|
||||
#endif
|
||||
|
||||
diff --git a/src/xattr.c b/src/xattr.c
|
||||
index 66524226..0f20fadf 100644
|
||||
--- a/src/xattr.c
|
||||
+++ b/src/xattr.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "log.h"
|
||||
+#include "utils.h"
|
||||
#include "xattr.h"
|
||||
|
||||
#ifdef USE_XATTR
|
||||
@@ -57,7 +58,7 @@ write_xattr_metadata (const char *name, const char *value, FILE *fp)
|
||||
#endif /* USE_XATTR */
|
||||
|
||||
int
|
||||
-set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp)
|
||||
+set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp)
|
||||
{
|
||||
/* Save metadata about where the file came from (requested, final URLs) to
|
||||
* user POSIX Extended Attributes of retrieved file.
|
||||
@@ -67,13 +68,28 @@ set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp)
|
||||
* [http://0pointer.de/lennart/projects/mod_mime_xattr/].
|
||||
*/
|
||||
int retval = -1;
|
||||
+ char *value;
|
||||
|
||||
if (!origin_url || !fp)
|
||||
return retval;
|
||||
|
||||
- retval = write_xattr_metadata ("user.xdg.origin.url", escnonprint_uri (origin_url), fp);
|
||||
- if ((!retval) && referrer_url)
|
||||
- retval = write_xattr_metadata ("user.xdg.referrer.url", escnonprint_uri (referrer_url), fp);
|
||||
+ value = url_string (origin_url, URL_AUTH_HIDE);
|
||||
+ retval = write_xattr_metadata ("user.xdg.origin.url", escnonprint_uri (value), fp);
|
||||
+ xfree (value);
|
||||
+
|
||||
+ if (!retval && referrer_url)
|
||||
+ {
|
||||
+ struct url u;
|
||||
+
|
||||
+ memset(&u, 0, sizeof(u));
|
||||
+ u.scheme = referrer_url->scheme;
|
||||
+ u.host = referrer_url->host;
|
||||
+ u.port = referrer_url->port;
|
||||
+
|
||||
+ value = url_string (&u, 0);
|
||||
+ retval = write_xattr_metadata ("user.xdg.referrer.url", escnonprint_uri (value), fp);
|
||||
+ xfree (value);
|
||||
+ }
|
||||
|
||||
return retval;
|
||||
}
|
||||
diff --git a/src/xattr.h b/src/xattr.h
|
||||
index 10f3ed11..40c7a8d3 100644
|
||||
--- a/src/xattr.h
|
||||
+++ b/src/xattr.h
|
||||
@@ -16,12 +16,13 @@
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <stdio.h>
|
||||
+#include <url.h>
|
||||
|
||||
#ifndef _XATTR_H
|
||||
#define _XATTR_H
|
||||
|
||||
/* Store metadata name/value attributes against fp. */
|
||||
-int set_file_metadata (const char *origin_url, const char *referrer_url, FILE *fp);
|
||||
+int set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp);
|
||||
|
||||
#if defined(__linux)
|
||||
/* libc on Linux has fsetxattr (5 arguments). */
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@@ -2,6 +2,8 @@ SRC_URI = "${GNU_MIRROR}/wget/wget-${PV}.tar.gz \
|
||||
file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
|
||||
file://0002-improve-reproducibility.patch \
|
||||
file://CVE-2019-5953.patch \
|
||||
file://CVE-2018-20483_p1.patch \
|
||||
file://CVE-2018-20483_p2.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "2db6f03d655041f82eb64b8c8a1fa7da"
|
||||
|
||||
38
meta/recipes-graphics/pango/pango/CVE-2019-1010238.patch
Normal file
38
meta/recipes-graphics/pango/pango/CVE-2019-1010238.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 490f8979a260c16b1df055eab386345da18a2d54 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Wed, 10 Jul 2019 20:26:23 -0400
|
||||
Subject: [PATCH] bidi: Be safer against bad input
|
||||
|
||||
Don't run off the end of an array that we
|
||||
allocated to certain length.
|
||||
|
||||
Closes: https://gitlab.gnome.org/GNOME/pango/issues/342
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/pango/commit/490f8979a260c16b1df055eab386345da18a2d54]
|
||||
CVE: CVE-2019-1010238
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
pango/pango-bidi-type.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
|
||||
index 3e46b66c..5c02dbbb 100644
|
||||
--- a/pango/pango-bidi-type.c
|
||||
+++ b/pango/pango-bidi-type.c
|
||||
@@ -181,8 +181,11 @@ pango_log2vis_get_embedding_levels (const gchar *text,
|
||||
for (i = 0, p = text; p < text + length; p = g_utf8_next_char(p), i++)
|
||||
{
|
||||
gunichar ch = g_utf8_get_char (p);
|
||||
- FriBidiCharType char_type;
|
||||
- char_type = fribidi_get_bidi_type (ch);
|
||||
+ FriBidiCharType char_type = fribidi_get_bidi_type (ch);
|
||||
+
|
||||
+ if (i == n_chars)
|
||||
+ break;
|
||||
+
|
||||
bidi_types[i] = char_type;
|
||||
ored_types |= char_type;
|
||||
if (FRIBIDI_IS_STRONG (char_type))
|
||||
--
|
||||
2.21.0
|
||||
|
||||
@@ -15,7 +15,9 @@ inherit gnomebase gtk-doc ptest-gnome upstream-version-is-even gobject-introspec
|
||||
|
||||
SRC_URI += "file://run-ptest \
|
||||
file://0001-Enforce-recreation-of-docs-pango.types-it-is-build-c.patch \
|
||||
"
|
||||
file://CVE-2019-1010238.patch \
|
||||
"
|
||||
|
||||
SRC_URI[archive.md5sum] = "deb171a31a3ad76342d5195a1b5bbc7c"
|
||||
SRC_URI[archive.sha256sum] = "1d2b74cd63e8bd41961f2f8d952355aa0f9be6002b52c8aa7699d9f5da597c9d"
|
||||
|
||||
|
||||
@@ -62,6 +62,12 @@ do_install() {
|
||||
cd ${S}
|
||||
cp --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") $kerneldir/build
|
||||
cp --parents $(find -type f -name "Build" -o -name "Build.include") $kerneldir/build
|
||||
|
||||
# Copy localversion file if any to keep correct version magic after
|
||||
# modules_prepare.
|
||||
if [ -f *localversion* ]; then
|
||||
cp *localversion* $kerneldir/build
|
||||
fi
|
||||
)
|
||||
|
||||
# then drop all but the needed Makefiles/Kconfig files
|
||||
@@ -213,6 +219,9 @@ do_install() {
|
||||
|
||||
# required to build scripts/selinux/genheaders/genheaders
|
||||
cp -a --parents security/selinux/include/* $kerneldir/build/
|
||||
|
||||
# copy any localversion files
|
||||
cp -a localversion* $kerneldir/build/ 2>/dev/null || :
|
||||
)
|
||||
|
||||
# Make sure the Makefile and version.h have a matching timestamp so that
|
||||
|
||||
@@ -11,13 +11,13 @@ python () {
|
||||
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
|
||||
}
|
||||
|
||||
SRCREV_machine ?= "82ac7b2b8048b537481bf16b8acda1cc9bfe9565"
|
||||
SRCREV_meta ?= "6a3254e7b370cbb86c1f73379dcf38885c1c69e0"
|
||||
SRCREV_machine ?= "72075349c6af55a7a6d024f0aa241711653fcb97"
|
||||
SRCREV_meta ?= "1bd749b7ce4240e83024b10fa4a4a6b9de5a5e5f"
|
||||
|
||||
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.14;destsuffix=${KMETA}"
|
||||
|
||||
LINUX_VERSION ?= "4.14.79"
|
||||
LINUX_VERSION ?= "4.14.143"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
@@ -4,7 +4,7 @@ KCONFIG_MODE = "--allnoconfig"
|
||||
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
|
||||
LINUX_VERSION ?= "4.14.79"
|
||||
LINUX_VERSION ?= "4.14.143"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
@@ -12,8 +12,8 @@ DEPENDS += "openssl-native util-linux-native"
|
||||
KMETA = "kernel-meta"
|
||||
KCONF_BSP_AUDIT_LEVEL = "2"
|
||||
|
||||
SRCREV_machine ?= "6ce17eae5d962b30846a5258956246438d68d60a"
|
||||
SRCREV_meta ?= "6a3254e7b370cbb86c1f73379dcf38885c1c69e0"
|
||||
SRCREV_machine ?= "3d884bc92763f474cc0728d1feb0becad8ed37d5"
|
||||
SRCREV_meta ?= "1bd749b7ce4240e83024b10fa4a4a6b9de5a5e5f"
|
||||
|
||||
PV = "${LINUX_VERSION}+git${SRCPV}"
|
||||
|
||||
|
||||
@@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "v4.14/standard/base"
|
||||
KBRANCH_qemux86-64 ?= "v4.14/standard/base"
|
||||
KBRANCH_qemumips64 ?= "v4.14/standard/mti-malta64"
|
||||
|
||||
SRCREV_machine_qemuarm ?= "8752b8421efe8b5a478f17fbffacf4af974ec703"
|
||||
SRCREV_machine_qemuarm64 ?= "ac66474ba7f7e93d16ae3ea005f214113bb127c5"
|
||||
SRCREV_machine_qemumips ?= "ab031b267e2a79fcd48da5d10d503f4d065f4821"
|
||||
SRCREV_machine_qemuppc ?= "f47c3945e8dd230ea37771bcacc836245fc79d22"
|
||||
SRCREV_machine_qemux86 ?= "f1d93b219bde37a8a286cd18d6af2dcf0d02c1a8"
|
||||
SRCREV_machine_qemux86-64 ?= "f1d93b219bde37a8a286cd18d6af2dcf0d02c1a8"
|
||||
SRCREV_machine_qemumips64 ?= "8063a7258fc670a361fed85b858fabb237485f1c"
|
||||
SRCREV_machine ?= "f1d93b219bde37a8a286cd18d6af2dcf0d02c1a8"
|
||||
SRCREV_meta ?= "6a3254e7b370cbb86c1f73379dcf38885c1c69e0"
|
||||
SRCREV_machine_qemuarm ?= "bd85f4880bb890bf9c45ee6c2fd95f077d2bf67e"
|
||||
SRCREV_machine_qemuarm64 ?= "445a4787bd489eb6b3d5c172b9842dbe5a34d734"
|
||||
SRCREV_machine_qemumips ?= "3d07ac9aa6ca729674dfb763563202f18f9eedde"
|
||||
SRCREV_machine_qemuppc ?= "81ba8dbab3b1bfc371e539956be905809db0e41a"
|
||||
SRCREV_machine_qemux86 ?= "bc9d4b045fa0254d14ef3a667a200f02cb9af755"
|
||||
SRCREV_machine_qemux86-64 ?= "bc9d4b045fa0254d14ef3a667a200f02cb9af755"
|
||||
SRCREV_machine_qemumips64 ?= "3c4acadcbe2ee11043f7d0fce43a5181511d0935"
|
||||
SRCREV_machine ?= "bc9d4b045fa0254d14ef3a667a200f02cb9af755"
|
||||
SRCREV_meta ?= "1bd749b7ce4240e83024b10fa4a4a6b9de5a5e5f"
|
||||
|
||||
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRANCH}; \
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.14;destsuffix=${KMETA}"
|
||||
|
||||
LINUX_VERSION ?= "4.14.79"
|
||||
LINUX_VERSION ?= "4.14.143"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user