mirror of
https://git.yoctoproject.org/poky
synced 2026-02-20 16:39:40 +01:00
Compare commits
99 Commits
yocto-3.1.
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f9b7f912e | ||
|
|
9ae9138497 | ||
|
|
8cf3492f4c | ||
|
|
d7019b183d | ||
|
|
4d8f22bc23 | ||
|
|
028971709f | ||
|
|
aa449287a0 | ||
|
|
95ba88b935 | ||
|
|
f50439feb5 | ||
|
|
e9ad2aab5c | ||
|
|
fb7acc1b21 | ||
|
|
1956baac10 | ||
|
|
ca1c4e7a76 | ||
|
|
35aaf7eadd | ||
|
|
483ab0979f | ||
|
|
243a95b193 | ||
|
|
d7194226b1 | ||
|
|
134ac61730 | ||
|
|
2fef664dd9 | ||
|
|
915a752d37 | ||
|
|
a8ee7ba022 | ||
|
|
f9a63709b0 | ||
|
|
9cc9232e31 | ||
|
|
b44d209043 | ||
|
|
20087e04b3 | ||
|
|
10c6b704c0 | ||
|
|
8b52687223 | ||
|
|
65cf3249fa | ||
|
|
537de1798b | ||
|
|
2fa8edea5a | ||
|
|
e49990f01e | ||
|
|
aa19c8c35e | ||
|
|
a69227932f | ||
|
|
a14af03441 | ||
|
|
0781ad69b8 | ||
|
|
9ca32cf9ab | ||
|
|
459d081bf8 | ||
|
|
5e7c237200 | ||
|
|
a98b309fe2 | ||
|
|
b9c73d6591 | ||
|
|
0566db5c82 | ||
|
|
0bee2e95b7 | ||
|
|
7ba4ed6f5f | ||
|
|
85637f30f3 | ||
|
|
a5de603a1b | ||
|
|
8f4bbd9359 | ||
|
|
d24759196a | ||
|
|
a884e8bdbf | ||
|
|
e576212d25 | ||
|
|
b16301db9a | ||
|
|
beda483705 | ||
|
|
3d435421bc | ||
|
|
c4692956ea | ||
|
|
1cf135da98 | ||
|
|
fb9e6d51d4 | ||
|
|
211a3fd4db | ||
|
|
964b78a02d | ||
|
|
1a1eceee49 | ||
|
|
7d67a61029 | ||
|
|
8bc3443c08 | ||
|
|
dea6f2c847 | ||
|
|
87377eacc0 | ||
|
|
bc294f9573 | ||
|
|
adc49cb960 | ||
|
|
afd213cc8e | ||
|
|
eaf8d5efa0 | ||
|
|
4aad5914ef | ||
|
|
23322786e0 | ||
|
|
139225f0ba | ||
|
|
fc24cd1948 | ||
|
|
1fc880e165 | ||
|
|
9243169d4f | ||
|
|
f97bd9abe6 | ||
|
|
59180eb474 | ||
|
|
2340b1dbb9 | ||
|
|
0b85e5d610 | ||
|
|
ef2da8f28e | ||
|
|
5373e681cf | ||
|
|
98dd6e4cac | ||
|
|
ae4acc9f81 | ||
|
|
cfd2eaa0e1 | ||
|
|
5b956ef359 | ||
|
|
54846f581e | ||
|
|
b361f2a931 | ||
|
|
0c3dfb682d | ||
|
|
7c7fc0de71 | ||
|
|
354f571f61 | ||
|
|
883102b9b8 | ||
|
|
b365d212dc | ||
|
|
c4499b85f7 | ||
|
|
c35c1e15f0 | ||
|
|
820e8891b8 | ||
|
|
b9ae8da74e | ||
|
|
038831674e | ||
|
|
25606f450d | ||
|
|
9e7f4a7db2 | ||
|
|
e4946bd39e | ||
|
|
97810ff2d7 | ||
|
|
d323923047 |
@@ -52,6 +52,12 @@ class WgetProgressHandler(bb.progress.LineFilterProgressHandler):
|
||||
|
||||
|
||||
class Wget(FetchMethod):
|
||||
|
||||
# CDNs like CloudFlare may do a 'browser integrity test' which can fail
|
||||
# with the standard wget/urllib User-Agent, so pretend to be a modern
|
||||
# browser.
|
||||
user_agent = "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0"
|
||||
|
||||
"""Class to fetch urls via 'wget'"""
|
||||
def supports(self, ud, d):
|
||||
"""
|
||||
@@ -303,7 +309,7 @@ class Wget(FetchMethod):
|
||||
# Some servers (FusionForge, as used on Alioth) require that the
|
||||
# optional Accept header is set.
|
||||
r.add_header("Accept", "*/*")
|
||||
r.add_header("User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12")
|
||||
r.add_header("User-Agent", self.user_agent)
|
||||
def add_basic_auth(login_str, request):
|
||||
'''Adds Basic auth to http request, pass in login:password as string'''
|
||||
import base64
|
||||
@@ -407,9 +413,8 @@ class Wget(FetchMethod):
|
||||
"""
|
||||
f = tempfile.NamedTemporaryFile()
|
||||
with tempfile.TemporaryDirectory(prefix="wget-index-") as workdir, tempfile.NamedTemporaryFile(dir=workdir, prefix="wget-listing-") as f:
|
||||
agent = "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12"
|
||||
fetchcmd = self.basecmd
|
||||
fetchcmd += " -O " + f.name + " --user-agent='" + agent + "' '" + uri + "'"
|
||||
fetchcmd += " -O " + f.name + " --user-agent='" + self.user_agent + "' '" + uri + "'"
|
||||
try:
|
||||
self._runwget(ud, d, fetchcmd, True, workdir=workdir)
|
||||
fetchresult = f.read()
|
||||
|
||||
@@ -24,6 +24,7 @@ import pickle
|
||||
from multiprocessing import Process
|
||||
import shlex
|
||||
import pprint
|
||||
import time
|
||||
|
||||
bblogger = logging.getLogger("BitBake")
|
||||
logger = logging.getLogger("BitBake.RunQueue")
|
||||
@@ -142,6 +143,55 @@ class RunQueueScheduler(object):
|
||||
self.buildable.append(tid)
|
||||
|
||||
self.rev_prio_map = None
|
||||
self.is_pressure_usable()
|
||||
|
||||
def is_pressure_usable(self):
|
||||
"""
|
||||
If monitoring pressure, return True if pressure files can be open and read. For example
|
||||
openSUSE /proc/pressure/* files have readable file permissions but when read the error EOPNOTSUPP (Operation not supported)
|
||||
is returned.
|
||||
"""
|
||||
if self.rq.max_cpu_pressure or self.rq.max_io_pressure or self.rq.max_memory_pressure:
|
||||
try:
|
||||
with open("/proc/pressure/cpu") as cpu_pressure_fds, \
|
||||
open("/proc/pressure/io") as io_pressure_fds, \
|
||||
open("/proc/pressure/memory") as memory_pressure_fds:
|
||||
|
||||
self.prev_cpu_pressure = cpu_pressure_fds.readline().split()[4].split("=")[1]
|
||||
self.prev_io_pressure = io_pressure_fds.readline().split()[4].split("=")[1]
|
||||
self.prev_memory_pressure = memory_pressure_fds.readline().split()[4].split("=")[1]
|
||||
self.prev_pressure_time = time.time()
|
||||
self.check_pressure = True
|
||||
except:
|
||||
bb.note("The /proc/pressure files can't be read. Continuing build without monitoring pressure")
|
||||
self.check_pressure = False
|
||||
else:
|
||||
self.check_pressure = False
|
||||
|
||||
def exceeds_max_pressure(self):
|
||||
"""
|
||||
Monitor the difference in total pressure at least once per second, if
|
||||
BB_PRESSURE_MAX_{CPU|IO|MEMORY} are set, return True if above threshold.
|
||||
"""
|
||||
if self.check_pressure:
|
||||
with open("/proc/pressure/cpu") as cpu_pressure_fds, \
|
||||
open("/proc/pressure/io") as io_pressure_fds, \
|
||||
open("/proc/pressure/memory") as memory_pressure_fds:
|
||||
# extract "total" from /proc/pressure/{cpu|io}
|
||||
curr_cpu_pressure = cpu_pressure_fds.readline().split()[4].split("=")[1]
|
||||
curr_io_pressure = io_pressure_fds.readline().split()[4].split("=")[1]
|
||||
curr_memory_pressure = memory_pressure_fds.readline().split()[4].split("=")[1]
|
||||
exceeds_cpu_pressure = self.rq.max_cpu_pressure and (float(curr_cpu_pressure) - float(self.prev_cpu_pressure)) > self.rq.max_cpu_pressure
|
||||
exceeds_io_pressure = self.rq.max_io_pressure and (float(curr_io_pressure) - float(self.prev_io_pressure)) > self.rq.max_io_pressure
|
||||
exceeds_memory_pressure = self.rq.max_memory_pressure and (float(curr_memory_pressure) - float(self.prev_memory_pressure)) > self.rq.max_memory_pressure
|
||||
now = time.time()
|
||||
if now - self.prev_pressure_time > 1.0:
|
||||
self.prev_cpu_pressure = curr_cpu_pressure
|
||||
self.prev_io_pressure = curr_io_pressure
|
||||
self.prev_memory_pressure = curr_memory_pressure
|
||||
self.prev_pressure_time = now
|
||||
return (exceeds_cpu_pressure or exceeds_io_pressure or exceeds_memory_pressure)
|
||||
return False
|
||||
|
||||
def next_buildable_task(self):
|
||||
"""
|
||||
@@ -155,6 +205,12 @@ class RunQueueScheduler(object):
|
||||
if not buildable:
|
||||
return None
|
||||
|
||||
# Bitbake requires that at least one task be active. Only check for pressure if
|
||||
# this is the case, otherwise the pressure limitation could result in no tasks
|
||||
# being active and no new tasks started thereby, at times, breaking the scheduler.
|
||||
if self.rq.stats.active and self.exceeds_max_pressure():
|
||||
return None
|
||||
|
||||
# Filter out tasks that have a max number of threads that have been exceeded
|
||||
skip_buildable = {}
|
||||
for running in self.rq.runq_running.difference(self.rq.runq_complete):
|
||||
@@ -1700,6 +1756,9 @@ class RunQueueExecute:
|
||||
|
||||
self.number_tasks = int(self.cfgData.getVar("BB_NUMBER_THREADS") or 1)
|
||||
self.scheduler = self.cfgData.getVar("BB_SCHEDULER") or "speed"
|
||||
self.max_cpu_pressure = self.cfgData.getVar("BB_PRESSURE_MAX_CPU")
|
||||
self.max_io_pressure = self.cfgData.getVar("BB_PRESSURE_MAX_IO")
|
||||
self.max_memory_pressure = self.cfgData.getVar("BB_PRESSURE_MAX_MEMORY")
|
||||
|
||||
self.sq_buildable = set()
|
||||
self.sq_running = set()
|
||||
@@ -1735,6 +1794,29 @@ class RunQueueExecute:
|
||||
if self.number_tasks <= 0:
|
||||
bb.fatal("Invalid BB_NUMBER_THREADS %s" % self.number_tasks)
|
||||
|
||||
lower_limit = 1.0
|
||||
upper_limit = 1000000.0
|
||||
if self.max_cpu_pressure:
|
||||
self.max_cpu_pressure = float(self.max_cpu_pressure)
|
||||
if self.max_cpu_pressure < lower_limit:
|
||||
bb.fatal("Invalid BB_PRESSURE_MAX_CPU %s, minimum value is %s." % (self.max_cpu_pressure, lower_limit))
|
||||
if self.max_cpu_pressure > upper_limit:
|
||||
bb.warn("Your build will be largely unregulated since BB_PRESSURE_MAX_CPU is set to %s. It is very unlikely that such high pressure will be experienced." % (self.max_cpu_pressure))
|
||||
|
||||
if self.max_io_pressure:
|
||||
self.max_io_pressure = float(self.max_io_pressure)
|
||||
if self.max_io_pressure < lower_limit:
|
||||
bb.fatal("Invalid BB_PRESSURE_MAX_IO %s, minimum value is %s." % (self.max_io_pressure, lower_limit))
|
||||
if self.max_io_pressure > upper_limit:
|
||||
bb.warn("Your build will be largely unregulated since BB_PRESSURE_MAX_IO is set to %s. It is very unlikely that such high pressure will be experienced." % (self.max_io_pressure))
|
||||
|
||||
if self.max_memory_pressure:
|
||||
self.max_memory_pressure = float(self.max_memory_pressure)
|
||||
if self.max_memory_pressure < lower_limit:
|
||||
bb.fatal("Invalid BB_PRESSURE_MAX_MEMORY %s, minimum value is %s." % (self.max_memory_pressure, lower_limit))
|
||||
if self.max_memory_pressure > upper_limit:
|
||||
bb.warn("Your build will be largely unregulated since BB_PRESSURE_MAX_MEMORY is set to %s. It is very unlikely that such high pressure will be experienced." % (self.max_io_pressure))
|
||||
|
||||
# List of setscene tasks which we've covered
|
||||
self.scenequeue_covered = set()
|
||||
# List of tasks which are covered (including setscene ones)
|
||||
|
||||
@@ -421,12 +421,14 @@ def better_eval(source, locals, extraglobals = None):
|
||||
return eval(source, ctx, locals)
|
||||
|
||||
@contextmanager
|
||||
def fileslocked(files):
|
||||
def fileslocked(files, *args, **kwargs):
|
||||
"""Context manager for locking and unlocking file locks."""
|
||||
locks = []
|
||||
if files:
|
||||
for lockfile in files:
|
||||
locks.append(bb.utils.lockfile(lockfile))
|
||||
l = bb.utils.lockfile(lockfile, *args, **kwargs)
|
||||
if l is not None:
|
||||
locks.append(l)
|
||||
|
||||
try:
|
||||
yield
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.18"
|
||||
DISTRO : "3.1.20"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.18"
|
||||
YOCTO_DOC_VERSION : "3.1.20"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.18"
|
||||
DOCCONF_VERSION : "3.1.18"
|
||||
DISTRO_REL_TAG : "yocto-3.1.20"
|
||||
DOCCONF_VERSION : "3.1.20"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.18"
|
||||
POKYVERSION : "23.0.20"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -63,6 +63,8 @@ Project metadata:
|
||||
|
||||
- *keyboard:* Hardware has a keyboard
|
||||
|
||||
- *numa:* Hardware has non-uniform memory access
|
||||
|
||||
- *pcbios:* Support for booting through BIOS
|
||||
|
||||
- *pci:* Hardware has a PCI bus
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.18"
|
||||
DISTRO_VERSION = "3.1.20"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
|
||||
@@ -7,8 +7,8 @@ KMACHINE_genericx86 ?= "common-pc"
|
||||
KMACHINE_genericx86-64 ?= "common-pc-64"
|
||||
KMACHINE_beaglebone-yocto ?= "beaglebone"
|
||||
|
||||
SRCREV_machine_genericx86 ?= "e2020dbe2ccaef50d7e8f37a5bf08c68a006a064"
|
||||
SRCREV_machine_genericx86-64 ?= "e2020dbe2ccaef50d7e8f37a5bf08c68a006a064"
|
||||
SRCREV_machine_genericx86 ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_machine_genericx86-64 ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_machine_edgerouter ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd"
|
||||
SRCREV_machine_beaglebone-yocto ?= "706efec4c1e270ec5dda92275898cd465dfdc7dd"
|
||||
|
||||
@@ -17,7 +17,7 @@ COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64"
|
||||
COMPATIBLE_MACHINE_edgerouter = "edgerouter"
|
||||
COMPATIBLE_MACHINE_beaglebone-yocto = "beaglebone-yocto"
|
||||
|
||||
LINUX_VERSION_genericx86 = "5.4.178"
|
||||
LINUX_VERSION_genericx86-64 = "5.4.178"
|
||||
LINUX_VERSION_genericx86 = "5.4.205"
|
||||
LINUX_VERSION_genericx86-64 = "5.4.205"
|
||||
LINUX_VERSION_edgerouter = "5.4.58"
|
||||
LINUX_VERSION_beaglebone-yocto = "5.4.58"
|
||||
|
||||
@@ -30,8 +30,9 @@ bin_package_do_install () {
|
||||
bbfatal bin_package has nothing to install. Be sure the SRC_URI unpacks into S.
|
||||
fi
|
||||
cd ${S}
|
||||
install -d ${D}${base_prefix}
|
||||
tar --no-same-owner --exclude='./patches' --exclude='./.pc' -cpf - . \
|
||||
| tar --no-same-owner -xpf - -C ${D}
|
||||
| tar --no-same-owner -xpf - -C ${D}${base_prefix}
|
||||
}
|
||||
|
||||
FILES_${PN} = "/"
|
||||
|
||||
@@ -138,17 +138,18 @@ python do_cve_check () {
|
||||
"""
|
||||
from oe.cve_check import get_patched_cves
|
||||
|
||||
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
||||
try:
|
||||
patched_cves = get_patched_cves(d)
|
||||
except FileNotFoundError:
|
||||
bb.fatal("Failure in searching patches")
|
||||
whitelisted, patched, unpatched, status = check_cves(d, patched_cves)
|
||||
if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
|
||||
cve_data = get_cve_info(d, patched + unpatched + whitelisted)
|
||||
cve_write_data(d, patched, unpatched, whitelisted, cve_data, status)
|
||||
else:
|
||||
bb.note("No CVE database found, skipping CVE check")
|
||||
with bb.utils.fileslocked([d.getVar("CVE_CHECK_DB_FILE_LOCK")], shared=True):
|
||||
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
||||
try:
|
||||
patched_cves = get_patched_cves(d)
|
||||
except FileNotFoundError:
|
||||
bb.fatal("Failure in searching patches")
|
||||
ignored, patched, unpatched, status = check_cves(d, patched_cves)
|
||||
if patched or unpatched or (d.getVar("CVE_CHECK_COVERAGE") == "1" and status):
|
||||
cve_data = get_cve_info(d, patched + unpatched + ignored)
|
||||
cve_write_data(d, patched, unpatched, ignored, cve_data, status)
|
||||
else:
|
||||
bb.note("No CVE database found, skipping CVE check")
|
||||
|
||||
}
|
||||
|
||||
@@ -289,7 +290,8 @@ def check_cves(d, patched_cves):
|
||||
vendor = "%"
|
||||
|
||||
# Find all relevant CVE IDs.
|
||||
for cverow in conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor)):
|
||||
cve_cursor = conn.execute("SELECT DISTINCT ID FROM PRODUCTS WHERE PRODUCT IS ? AND VENDOR LIKE ?", (product, vendor))
|
||||
for cverow in cve_cursor:
|
||||
cve = cverow[0]
|
||||
|
||||
if cve in cve_whitelist:
|
||||
@@ -308,7 +310,8 @@ def check_cves(d, patched_cves):
|
||||
vulnerable = False
|
||||
ignored = False
|
||||
|
||||
for row in conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor)):
|
||||
product_cursor = conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor))
|
||||
for row in product_cursor:
|
||||
(_, _, _, version_start, operator_start, version_end, operator_end) = row
|
||||
#bb.debug(2, "Evaluating row " + str(row))
|
||||
if cve in cve_whitelist:
|
||||
@@ -352,10 +355,12 @@ def check_cves(d, patched_cves):
|
||||
bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
|
||||
cves_unpatched.append(cve)
|
||||
break
|
||||
product_cursor.close()
|
||||
|
||||
if not vulnerable:
|
||||
bb.note("%s-%s is not vulnerable to %s" % (pn, real_pv, cve))
|
||||
patched_cves.add(cve)
|
||||
cve_cursor.close()
|
||||
|
||||
if not cves_in_product:
|
||||
bb.note("No CVE records found for product %s, pn %s" % (product, pn))
|
||||
@@ -377,14 +382,15 @@ def get_cve_info(d, cves):
|
||||
conn = sqlite3.connect(db_file, uri=True)
|
||||
|
||||
for cve in cves:
|
||||
for row in conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,)):
|
||||
cursor = conn.execute("SELECT * FROM NVD WHERE ID IS ?", (cve,))
|
||||
for row in cursor:
|
||||
cve_data[row[0]] = {}
|
||||
cve_data[row[0]]["summary"] = row[1]
|
||||
cve_data[row[0]]["scorev2"] = row[2]
|
||||
cve_data[row[0]]["scorev3"] = row[3]
|
||||
cve_data[row[0]]["modified"] = row[4]
|
||||
cve_data[row[0]]["vector"] = row[5]
|
||||
|
||||
cursor.close()
|
||||
conn.close()
|
||||
return cve_data
|
||||
|
||||
|
||||
@@ -452,12 +452,14 @@ def package_qa_check_buildpaths(path, name, d, elf, messages):
|
||||
"""
|
||||
Check for build paths inside target files and error if not found in the whitelist
|
||||
"""
|
||||
import stat
|
||||
# Ignore .debug files, not interesting
|
||||
if path.find(".debug") != -1:
|
||||
return
|
||||
|
||||
# Ignore symlinks
|
||||
if os.path.islink(path):
|
||||
# Ignore symlinks/devs/fifos
|
||||
mode = os.lstat(path).st_mode
|
||||
if stat.S_ISLNK(mode) or stat.S_ISBLK(mode) or stat.S_ISFIFO(mode) or stat.S_ISCHR(mode) or stat.S_ISSOCK(mode):
|
||||
return
|
||||
|
||||
tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8")
|
||||
|
||||
@@ -61,7 +61,7 @@ HOST_LD_KERNEL_ARCH ?= "${TARGET_LD_KERNEL_ARCH}"
|
||||
TARGET_AR_KERNEL_ARCH ?= ""
|
||||
HOST_AR_KERNEL_ARCH ?= "${TARGET_AR_KERNEL_ARCH}"
|
||||
|
||||
KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH}"
|
||||
KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH}"
|
||||
KERNEL_LD = "${CCACHE}${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
|
||||
KERNEL_AR = "${CCACHE}${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
|
||||
TOOLCHAIN = "gcc"
|
||||
|
||||
@@ -56,6 +56,9 @@ FIT_HASH_ALG ?= "sha256"
|
||||
# fitImage Signature Algo
|
||||
FIT_SIGN_ALG ?= "rsa2048"
|
||||
|
||||
# fitImage Padding Algo
|
||||
FIT_PAD_ALG ?= "pkcs-1.5"
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS header
|
||||
#
|
||||
@@ -250,6 +253,7 @@ fitimage_emit_section_config() {
|
||||
|
||||
conf_csum="${FIT_HASH_ALG}"
|
||||
conf_sign_algo="${FIT_SIGN_ALG}"
|
||||
conf_padding_algo="${FIT_PAD_ALG}"
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
|
||||
conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
|
||||
fi
|
||||
@@ -333,6 +337,7 @@ EOF
|
||||
signature-1 {
|
||||
algo = "${conf_csum},${conf_sign_algo}";
|
||||
key-name-hint = "${conf_sign_keyname}";
|
||||
padding = "${conf_padding_algo}";
|
||||
${sign_line}
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -305,7 +305,7 @@ rootfs_trim_schemas () {
|
||||
}
|
||||
|
||||
rootfs_check_host_user_contaminated () {
|
||||
contaminated="${WORKDIR}/host-user-contaminated.txt"
|
||||
contaminated="${S}/host-user-contaminated.txt"
|
||||
HOST_USER_UID="$(PSEUDO_UNLOAD=1 id -u)"
|
||||
HOST_USER_GID="$(PSEUDO_UNLOAD=1 id -g)"
|
||||
|
||||
|
||||
@@ -13,24 +13,31 @@
|
||||
SPDXLICENSEMAP[AGPL-3] = "AGPL-3.0"
|
||||
SPDXLICENSEMAP[AGPLv3] = "AGPL-3.0"
|
||||
SPDXLICENSEMAP[AGPLv3.0] = "AGPL-3.0"
|
||||
SPDXLICENSEMAP[AGPL-3.0-only] = "AGPL-3.0"
|
||||
|
||||
# GPL variations
|
||||
SPDXLICENSEMAP[GPL-1] = "GPL-1.0"
|
||||
SPDXLICENSEMAP[GPLv1] = "GPL-1.0"
|
||||
SPDXLICENSEMAP[GPLv1.0] = "GPL-1.0"
|
||||
SPDXLICENSEMAP[GPL-1.0-only] = "GPL-1.0"
|
||||
SPDXLICENSEMAP[GPL-2] = "GPL-2.0"
|
||||
SPDXLICENSEMAP[GPLv2] = "GPL-2.0"
|
||||
SPDXLICENSEMAP[GPLv2.0] = "GPL-2.0"
|
||||
SPDXLICENSEMAP[GPL-2.0-only] = "GPL-2.0"
|
||||
SPDXLICENSEMAP[GPL-3] = "GPL-3.0"
|
||||
SPDXLICENSEMAP[GPLv3] = "GPL-3.0"
|
||||
SPDXLICENSEMAP[GPLv3.0] = "GPL-3.0"
|
||||
SPDXLICENSEMAP[GPL-3.0-only] = "GPL-3.0"
|
||||
|
||||
#LGPL variations
|
||||
SPDXLICENSEMAP[LGPLv2] = "LGPL-2.0"
|
||||
SPDXLICENSEMAP[LGPLv2.0] = "LGPL-2.0"
|
||||
SPDXLICENSEMAP[LGPL-2.0-only] = "LGPL-2.0"
|
||||
SPDXLICENSEMAP[LGPL2.1] = "LGPL-2.1"
|
||||
SPDXLICENSEMAP[LGPLv2.1] = "LGPL-2.1"
|
||||
SPDXLICENSEMAP[LGPL-2.1-only] = "LGPL-2.1"
|
||||
SPDXLICENSEMAP[LGPLv3] = "LGPL-3.0"
|
||||
SPDXLICENSEMAP[LGPL-3.0-only] = "LGPL-3.0"
|
||||
|
||||
#MPL variations
|
||||
SPDXLICENSEMAP[MPL-1] = "MPL-1.0"
|
||||
|
||||
@@ -114,9 +114,10 @@ def get_patched_cves(d):
|
||||
for url in oe.patch.src_patches(d):
|
||||
patch_file = bb.fetch.decodeurl(url)[2]
|
||||
|
||||
# Remote compressed patches may not be unpacked, so silently ignore them
|
||||
if not os.path.isfile(patch_file):
|
||||
bb.error("File Not found: %s" % patch_file)
|
||||
raise FileNotFoundError
|
||||
bb.warn("%s does not exist, cannot extract CVE list" % patch_file)
|
||||
continue
|
||||
|
||||
# Check patch file name for CVE ID
|
||||
fname_match = cve_file_name_match.search(patch_file)
|
||||
@@ -167,7 +168,7 @@ def get_cpe_ids(cve_product, version):
|
||||
else:
|
||||
vendor = "*"
|
||||
|
||||
cpe_id = f'cpe:2.3:a:{vendor}:{product}:{version}:*:*:*:*:*:*:*'
|
||||
cpe_id = 'cpe:2.3:a:{}:{}:{}:*:*:*:*:*:*:*'.format(vendor, product, version)
|
||||
cpe_ids.append(cpe_id)
|
||||
|
||||
return cpe_ids
|
||||
|
||||
@@ -187,6 +187,8 @@ class TestImage(OESelftestTestCase):
|
||||
self.skipTest('virgl isn\'t working with Fedora 34')
|
||||
if distro and distro == 'fedora-35':
|
||||
self.skipTest('virgl isn\'t working with Fedora 35')
|
||||
if distro and distro == 'fedora-36':
|
||||
self.skipTest('virgl isn\'t working with Fedora 36')
|
||||
if distro and distro == 'opensuseleap-15.0':
|
||||
self.skipTest('virgl isn\'t working with Opensuse 15.0')
|
||||
|
||||
|
||||
178
meta/recipes-bsp/grub/files/CVE-2021-3695.patch
Normal file
178
meta/recipes-bsp/grub/files/CVE-2021-3695.patch
Normal file
@@ -0,0 +1,178 @@
|
||||
From 0693d672abcf720419f86c56bda6428c540e2bb1 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 20 Jul 2022 10:01:35 +0530
|
||||
Subject: [PATCH] CVE-2021-3695
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=e623866d9286410156e8b9d2c82d6253a1b22d08]
|
||||
CVE: CVE-2021-3695
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
video/readers/png: Drop greyscale support to fix heap out-of-bounds write
|
||||
|
||||
A 16-bit greyscale PNG without alpha is processed in the following loop:
|
||||
|
||||
for (i = 0; i < (data->image_width * data->image_height);
|
||||
i++, d1 += 4, d2 += 2)
|
||||
{
|
||||
d1[R3] = d2[1];
|
||||
d1[G3] = d2[1];
|
||||
d1[B3] = d2[1];
|
||||
}
|
||||
|
||||
The increment of d1 is wrong. d1 is incremented by 4 bytes per iteration,
|
||||
but there are only 3 bytes allocated for storage. This means that image
|
||||
data will overwrite somewhat-attacker-controlled parts of memory - 3 bytes
|
||||
out of every 4 following the end of the image.
|
||||
|
||||
This has existed since greyscale support was added in 2013 in commit
|
||||
3ccf16dff98f (grub-core/video/readers/png.c: Support grayscale).
|
||||
|
||||
Saving starfield.png as a 16-bit greyscale image without alpha in the gimp
|
||||
and attempting to load it causes grub-emu to crash - I don't think this code
|
||||
has ever worked.
|
||||
|
||||
Delete all PNG greyscale support.
|
||||
|
||||
Fixes: CVE-2021-3695
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/video/readers/png.c | 89 ++++-------------------------------
|
||||
1 file changed, 8 insertions(+), 81 deletions(-)
|
||||
|
||||
diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c
|
||||
index 0157ff7..db4a9d4 100644
|
||||
--- a/grub-core/video/readers/png.c
|
||||
+++ b/grub-core/video/readers/png.c
|
||||
@@ -100,7 +100,7 @@ struct grub_png_data
|
||||
|
||||
unsigned image_width, image_height;
|
||||
int bpp, is_16bit;
|
||||
- int raw_bytes, is_gray, is_alpha, is_palette;
|
||||
+ int raw_bytes, is_alpha, is_palette;
|
||||
int row_bytes, color_bits;
|
||||
grub_uint8_t *image_data;
|
||||
|
||||
@@ -280,13 +280,13 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
||||
data->bpp = 3;
|
||||
else
|
||||
{
|
||||
- data->is_gray = 1;
|
||||
- data->bpp = 1;
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "png: color type not supported");
|
||||
}
|
||||
|
||||
if ((color_bits != 8) && (color_bits != 16)
|
||||
&& (color_bits != 4
|
||||
- || !(data->is_gray || data->is_palette)))
|
||||
+ || !data->is_palette))
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
"png: bit depth must be 8 or 16");
|
||||
|
||||
@@ -315,7 +315,7 @@ grub_png_decode_image_header (struct grub_png_data *data)
|
||||
}
|
||||
|
||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||
- if (data->is_16bit || data->is_gray || data->is_palette)
|
||||
+ if (data->is_16bit || data->is_palette)
|
||||
#endif
|
||||
{
|
||||
data->image_data = grub_calloc (data->image_height, data->row_bytes);
|
||||
@@ -859,27 +859,8 @@ grub_png_convert_image (struct grub_png_data *data)
|
||||
int shift;
|
||||
int mask = (1 << data->color_bits) - 1;
|
||||
unsigned j;
|
||||
- if (data->is_gray)
|
||||
- {
|
||||
- /* Generic formula is
|
||||
- (0xff * i) / ((1U << data->color_bits) - 1)
|
||||
- but for allowed bit depth of 1, 2 and for it's
|
||||
- equivalent to
|
||||
- (0xff / ((1U << data->color_bits) - 1)) * i
|
||||
- Precompute the multipliers to avoid division.
|
||||
- */
|
||||
-
|
||||
- const grub_uint8_t multipliers[5] = { 0xff, 0xff, 0x55, 0x24, 0x11 };
|
||||
- for (i = 0; i < (1U << data->color_bits); i++)
|
||||
- {
|
||||
- grub_uint8_t col = multipliers[data->color_bits] * i;
|
||||
- palette[i][0] = col;
|
||||
- palette[i][1] = col;
|
||||
- palette[i][2] = col;
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- grub_memcpy (palette, data->palette, 3 << data->color_bits);
|
||||
+
|
||||
+ grub_memcpy (palette, data->palette, 3 << data->color_bits);
|
||||
d1c = d1;
|
||||
d2c = d2;
|
||||
for (j = 0; j < data->image_height; j++, d1c += data->image_width * 3,
|
||||
@@ -917,61 +898,7 @@ grub_png_convert_image (struct grub_png_data *data)
|
||||
return;
|
||||
}
|
||||
|
||||
- if (data->is_gray)
|
||||
- {
|
||||
- switch (data->bpp)
|
||||
- {
|
||||
- case 4:
|
||||
- /* 16-bit gray with alpha. */
|
||||
- for (i = 0; i < (data->image_width * data->image_height);
|
||||
- i++, d1 += 4, d2 += 4)
|
||||
- {
|
||||
- d1[R4] = d2[3];
|
||||
- d1[G4] = d2[3];
|
||||
- d1[B4] = d2[3];
|
||||
- d1[A4] = d2[1];
|
||||
- }
|
||||
- break;
|
||||
- case 2:
|
||||
- if (data->is_16bit)
|
||||
- /* 16-bit gray without alpha. */
|
||||
- {
|
||||
- for (i = 0; i < (data->image_width * data->image_height);
|
||||
- i++, d1 += 4, d2 += 2)
|
||||
- {
|
||||
- d1[R3] = d2[1];
|
||||
- d1[G3] = d2[1];
|
||||
- d1[B3] = d2[1];
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- /* 8-bit gray with alpha. */
|
||||
- {
|
||||
- for (i = 0; i < (data->image_width * data->image_height);
|
||||
- i++, d1 += 4, d2 += 2)
|
||||
- {
|
||||
- d1[R4] = d2[1];
|
||||
- d1[G4] = d2[1];
|
||||
- d1[B4] = d2[1];
|
||||
- d1[A4] = d2[0];
|
||||
- }
|
||||
- }
|
||||
- break;
|
||||
- /* 8-bit gray without alpha. */
|
||||
- case 1:
|
||||
- for (i = 0; i < (data->image_width * data->image_height);
|
||||
- i++, d1 += 3, d2++)
|
||||
- {
|
||||
- d1[R3] = d2[0];
|
||||
- d1[G3] = d2[0];
|
||||
- d1[B3] = d2[0];
|
||||
- }
|
||||
- break;
|
||||
- }
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- {
|
||||
+ {
|
||||
/* Only copy the upper 8 bit. */
|
||||
#ifndef GRUB_CPU_WORDS_BIGENDIAN
|
||||
for (i = 0; i < (data->image_width * data->image_height * data->bpp >> 1);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
46
meta/recipes-bsp/grub/files/CVE-2021-3696.patch
Normal file
46
meta/recipes-bsp/grub/files/CVE-2021-3696.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From b18ce59d6496a9313d75f9497a0efac61dcf4191 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 20 Jul 2022 10:05:42 +0530
|
||||
Subject: [PATCH] CVE-2021-3696
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=210245129c932dc9e1c2748d9d35524fb95b5042]
|
||||
CVE: CVE-2021-3696
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
video/readers/png: Avoid heap OOB R/W inserting huff table items
|
||||
|
||||
In fuzzing we observed crashes where a code would attempt to be inserted
|
||||
into a huffman table before the start, leading to a set of heap OOB reads
|
||||
and writes as table entries with negative indices were shifted around and
|
||||
the new code written in.
|
||||
|
||||
Catch the case where we would underflow the array and bail.
|
||||
|
||||
Fixes: CVE-2021-3696
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/video/readers/png.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c
|
||||
index 36b3f10..3c05951 100644
|
||||
--- a/grub-core/video/readers/png.c
|
||||
+++ b/grub-core/video/readers/png.c
|
||||
@@ -416,6 +416,13 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len)
|
||||
for (i = len; i < ht->max_length; i++)
|
||||
n += ht->maxval[i];
|
||||
|
||||
+ if (n > ht->num_values)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "png: out of range inserting huffman table item");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
for (i = 0; i < n; i++)
|
||||
ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1];
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
82
meta/recipes-bsp/grub/files/CVE-2021-3697.patch
Normal file
82
meta/recipes-bsp/grub/files/CVE-2021-3697.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
From 4de9de9d14f4ac27229e45514627534e32cc4406 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Tue, 19 Jul 2022 11:13:02 +0530
|
||||
Subject: [PATCH] CVE-2021-3697
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=22a3f97d39f6a10b08ad7fd1cc47c4dcd10413f6]
|
||||
CVE: CVE-2021-3697
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
video/readers/jpeg: Block int underflow -> wild pointer write
|
||||
|
||||
Certain 1 px wide images caused a wild pointer write in
|
||||
grub_jpeg_ycrcb_to_rgb(). This was caused because in grub_jpeg_decode_data(),
|
||||
we have the following loop:
|
||||
|
||||
for (; data->r1 < nr1 && (!data->dri || rst);
|
||||
data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3)
|
||||
|
||||
We did not check if vb * width >= hb * nc1.
|
||||
|
||||
On a 64-bit platform, if that turns out to be negative, it will underflow,
|
||||
be interpreted as unsigned 64-bit, then be added to the 64-bit pointer, so
|
||||
we see data->bitmap_ptr jump, e.g.:
|
||||
|
||||
0x6180_0000_0480 to
|
||||
0x6181_0000_0498
|
||||
^
|
||||
~--- carry has occurred and this pointer is now far away from
|
||||
any object.
|
||||
|
||||
On a 32-bit platform, it will decrement the pointer, creating a pointer
|
||||
that won't crash but will overwrite random data.
|
||||
|
||||
Catch the underflow and error out.
|
||||
|
||||
Fixes: CVE-2021-3697
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/video/readers/jpeg.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
||||
index 31359a4..545a60b 100644
|
||||
--- a/grub-core/video/readers/jpeg.c
|
||||
+++ b/grub-core/video/readers/jpeg.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/bufio.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -617,6 +618,7 @@ static grub_err_t
|
||||
grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
||||
{
|
||||
unsigned c1, vb, hb, nr1, nc1;
|
||||
+ unsigned stride_a, stride_b, stride;
|
||||
int rst = data->dri;
|
||||
|
||||
vb = 8 << data->log_vs;
|
||||
@@ -624,8 +626,14 @@ grub_jpeg_decode_data (struct grub_jpeg_data *data)
|
||||
nr1 = (data->image_height + vb - 1) >> (3 + data->log_vs);
|
||||
nc1 = (data->image_width + hb - 1) >> (3 + data->log_hs);
|
||||
|
||||
+ if (grub_mul(vb, data->image_width, &stride_a) ||
|
||||
+ grub_mul(hb, nc1, &stride_b) ||
|
||||
+ grub_sub(stride_a, stride_b, &stride))
|
||||
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
||||
+ "jpeg: cannot decode image with these dimensions");
|
||||
+
|
||||
for (; data->r1 < nr1 && (!data->dri || rst);
|
||||
- data->r1++, data->bitmap_ptr += (vb * data->image_width - hb * nc1) * 3)
|
||||
+ data->r1++, data->bitmap_ptr += stride * 3)
|
||||
for (c1 = 0; c1 < nc1 && (!data->dri || rst);
|
||||
c1++, rst--, data->bitmap_ptr += hb * 3)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
||||
60
meta/recipes-bsp/grub/files/CVE-2022-28733.patch
Normal file
60
meta/recipes-bsp/grub/files/CVE-2022-28733.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
From 415fb5eb83cbd3b5cfc25ac1290f2de4fe3d231c Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 1 Aug 2022 10:48:34 +0530
|
||||
Subject: [PATCH] CVE-2022-28733
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=3e4817538de828319ba6d59ced2fbb9b5ca13287]
|
||||
CVE: CVE-2022-28733
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
net/ip: Do IP fragment maths safely
|
||||
|
||||
We can receive packets with invalid IP fragmentation information. This
|
||||
can lead to rsm->total_len underflowing and becoming very large.
|
||||
|
||||
Then, in grub_netbuff_alloc(), we add to this very large number, which can
|
||||
cause it to overflow and wrap back around to a small positive number.
|
||||
The allocation then succeeds, but the resulting buffer is too small and
|
||||
subsequent operations can write past the end of the buffer.
|
||||
|
||||
Catch the underflow here.
|
||||
|
||||
Fixes: CVE-2022-28733
|
||||
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/net/ip.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/net/ip.c b/grub-core/net/ip.c
|
||||
index ea5edf8..74e4e8b 100644
|
||||
--- a/grub-core/net/ip.c
|
||||
+++ b/grub-core/net/ip.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <grub/net/netbuff.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/priority_queue.h>
|
||||
+#include <grub/safemath.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
struct iphdr {
|
||||
@@ -512,7 +513,14 @@ grub_net_recv_ip4_packets (struct grub_net_buff *nb,
|
||||
{
|
||||
rsm->total_len = (8 * (grub_be_to_cpu16 (iph->frags) & OFFSET_MASK)
|
||||
+ (nb->tail - nb->data));
|
||||
- rsm->total_len -= ((iph->verhdrlen & 0xf) * sizeof (grub_uint32_t));
|
||||
+
|
||||
+ if (grub_sub (rsm->total_len, (iph->verhdrlen & 0xf) * sizeof (grub_uint32_t),
|
||||
+ &rsm->total_len))
|
||||
+ {
|
||||
+ grub_dprintf ("net", "IP reassembly size underflow\n");
|
||||
+ return GRUB_ERR_NONE;
|
||||
+ }
|
||||
+
|
||||
rsm->asm_netbuff = grub_netbuff_alloc (rsm->total_len);
|
||||
if (!rsm->asm_netbuff)
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
||||
67
meta/recipes-bsp/grub/files/CVE-2022-28734.patch
Normal file
67
meta/recipes-bsp/grub/files/CVE-2022-28734.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From f03f09c2a07eae7f3a4646e33a406ae2689afb9e Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 1 Aug 2022 10:59:41 +0530
|
||||
Subject: [PATCH] CVE-2022-28734
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=b26b4c08e7119281ff30d0fb4a6169bd2afa8fe4]
|
||||
CVE: CVE-2022-28734
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
net/http: Fix OOB write for split http headers
|
||||
|
||||
GRUB has special code for handling an http header that is split
|
||||
across two packets.
|
||||
|
||||
The code tracks the end of line by looking for a "\n" byte. The
|
||||
code for split headers has always advanced the pointer just past the
|
||||
end of the line, whereas the code that handles unsplit headers does
|
||||
not advance the pointer. This extra advance causes the length to be
|
||||
one greater, which breaks an assumption in parse_line(), leading to
|
||||
it writing a NUL byte one byte past the end of the buffer where we
|
||||
reconstruct the line from the two packets.
|
||||
|
||||
It's conceivable that an attacker controlled set of packets could
|
||||
cause this to zero out the first byte of the "next" pointer of the
|
||||
grub_mm_region structure following the current_line buffer.
|
||||
|
||||
Do not advance the pointer in the split header case.
|
||||
|
||||
Fixes: CVE-2022-28734
|
||||
---
|
||||
grub-core/net/http.c | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
|
||||
index 5aa4ad3..a220d21 100644
|
||||
--- a/grub-core/net/http.c
|
||||
+++ b/grub-core/net/http.c
|
||||
@@ -68,7 +68,15 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
|
||||
char *end = ptr + len;
|
||||
while (end > ptr && *(end - 1) == '\r')
|
||||
end--;
|
||||
+
|
||||
+ /* LF without CR. */
|
||||
+ if (end == ptr + len)
|
||||
+ {
|
||||
+ data->errmsg = grub_strdup (_("invalid HTTP header - LF without CR"));
|
||||
+ return GRUB_ERR_NONE;
|
||||
+ }
|
||||
*end = 0;
|
||||
+
|
||||
/* Trailing CRLF. */
|
||||
if (data->in_chunk_len == 1)
|
||||
{
|
||||
@@ -190,9 +198,7 @@ http_receive (grub_net_tcp_socket_t sock __attribute__ ((unused)),
|
||||
int have_line = 1;
|
||||
char *t;
|
||||
ptr = grub_memchr (nb->data, '\n', nb->tail - nb->data);
|
||||
- if (ptr)
|
||||
- ptr++;
|
||||
- else
|
||||
+ if (ptr == NULL)
|
||||
{
|
||||
have_line = 0;
|
||||
ptr = (char *) nb->tail;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
275
meta/recipes-bsp/grub/files/CVE-2022-28736.patch
Normal file
275
meta/recipes-bsp/grub/files/CVE-2022-28736.patch
Normal file
@@ -0,0 +1,275 @@
|
||||
From 431a111c60095fc973d83fe9209f26f29ce78784 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 1 Aug 2022 11:17:17 +0530
|
||||
Subject: [PATCH] CVE-2022-28736
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=04c86e0bb7b58fc2f913f798cdb18934933e532d]
|
||||
CVE: CVE-2022-28736
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
loader/efi/chainloader: Use grub_loader_set_ex()
|
||||
|
||||
This ports the EFI chainloader to use grub_loader_set_ex() in order to fix
|
||||
a use-after-free bug that occurs when grub_cmd_chainloader() is executed
|
||||
more than once before a boot attempt is performed.
|
||||
|
||||
Fixes: CVE-2022-28736
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/commands/boot.c | 66 ++++++++++++++++++++++++++----
|
||||
grub-core/loader/efi/chainloader.c | 46 +++++++++++----------
|
||||
include/grub/loader.h | 5 +++
|
||||
3 files changed, 87 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/grub-core/commands/boot.c b/grub-core/commands/boot.c
|
||||
index bbca81e..6151478 100644
|
||||
--- a/grub-core/commands/boot.c
|
||||
+++ b/grub-core/commands/boot.c
|
||||
@@ -27,10 +27,20 @@
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
-static grub_err_t (*grub_loader_boot_func) (void);
|
||||
-static grub_err_t (*grub_loader_unload_func) (void);
|
||||
+static grub_err_t (*grub_loader_boot_func) (void *context);
|
||||
+static grub_err_t (*grub_loader_unload_func) (void *context);
|
||||
+static void *grub_loader_context;
|
||||
static int grub_loader_flags;
|
||||
|
||||
+struct grub_simple_loader_hooks
|
||||
+{
|
||||
+ grub_err_t (*boot) (void);
|
||||
+ grub_err_t (*unload) (void);
|
||||
+};
|
||||
+
|
||||
+/* Don't heap allocate this to avoid making grub_loader_set() fallible. */
|
||||
+static struct grub_simple_loader_hooks simple_loader_hooks;
|
||||
+
|
||||
struct grub_preboot
|
||||
{
|
||||
grub_err_t (*preboot_func) (int);
|
||||
@@ -44,6 +54,29 @@ static int grub_loader_loaded;
|
||||
static struct grub_preboot *preboots_head = 0,
|
||||
*preboots_tail = 0;
|
||||
|
||||
+static grub_err_t
|
||||
+grub_simple_boot_hook (void *context)
|
||||
+{
|
||||
+ struct grub_simple_loader_hooks *hooks;
|
||||
+
|
||||
+ hooks = (struct grub_simple_loader_hooks *) context;
|
||||
+ return hooks->boot ();
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_simple_unload_hook (void *context)
|
||||
+{
|
||||
+ struct grub_simple_loader_hooks *hooks;
|
||||
+ grub_err_t ret;
|
||||
+
|
||||
+ hooks = (struct grub_simple_loader_hooks *) context;
|
||||
+
|
||||
+ ret = hooks->unload ();
|
||||
+ grub_memset (hooks, 0, sizeof (*hooks));
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int
|
||||
grub_loader_is_loaded (void)
|
||||
{
|
||||
@@ -110,28 +143,45 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd)
|
||||
}
|
||||
|
||||
void
|
||||
-grub_loader_set (grub_err_t (*boot) (void),
|
||||
- grub_err_t (*unload) (void),
|
||||
- int flags)
|
||||
+grub_loader_set_ex (grub_err_t (*boot) (void *context),
|
||||
+ grub_err_t (*unload) (void *context),
|
||||
+ void *context,
|
||||
+ int flags)
|
||||
{
|
||||
if (grub_loader_loaded && grub_loader_unload_func)
|
||||
- grub_loader_unload_func ();
|
||||
+ grub_loader_unload_func (grub_loader_context);
|
||||
|
||||
grub_loader_boot_func = boot;
|
||||
grub_loader_unload_func = unload;
|
||||
+ grub_loader_context = context;
|
||||
grub_loader_flags = flags;
|
||||
|
||||
grub_loader_loaded = 1;
|
||||
}
|
||||
|
||||
+void
|
||||
+grub_loader_set (grub_err_t (*boot) (void),
|
||||
+ grub_err_t (*unload) (void),
|
||||
+ int flags)
|
||||
+{
|
||||
+ grub_loader_set_ex (grub_simple_boot_hook,
|
||||
+ grub_simple_unload_hook,
|
||||
+ &simple_loader_hooks,
|
||||
+ flags);
|
||||
+
|
||||
+ simple_loader_hooks.boot = boot;
|
||||
+ simple_loader_hooks.unload = unload;
|
||||
+}
|
||||
+
|
||||
void
|
||||
grub_loader_unset(void)
|
||||
{
|
||||
if (grub_loader_loaded && grub_loader_unload_func)
|
||||
- grub_loader_unload_func ();
|
||||
+ grub_loader_unload_func (grub_loader_context);
|
||||
|
||||
grub_loader_boot_func = 0;
|
||||
grub_loader_unload_func = 0;
|
||||
+ grub_loader_context = 0;
|
||||
|
||||
grub_loader_loaded = 0;
|
||||
}
|
||||
@@ -158,7 +208,7 @@ grub_loader_boot (void)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
- err = (grub_loader_boot_func) ();
|
||||
+ err = (grub_loader_boot_func) (grub_loader_context);
|
||||
|
||||
for (cur = preboots_tail; cur; cur = cur->prev)
|
||||
if (! err)
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index a8d7b91..93a028a 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -44,33 +44,28 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
-static grub_efi_physical_address_t address;
|
||||
-static grub_efi_uintn_t pages;
|
||||
-static grub_efi_device_path_t *file_path;
|
||||
-static grub_efi_handle_t image_handle;
|
||||
-static grub_efi_char16_t *cmdline;
|
||||
-
|
||||
static grub_err_t
|
||||
-grub_chainloader_unload (void)
|
||||
+grub_chainloader_unload (void *context)
|
||||
{
|
||||
+ grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
||||
+ grub_efi_loaded_image_t *loaded_image;
|
||||
grub_efi_boot_services_t *b;
|
||||
|
||||
+ loaded_image = grub_efi_get_loaded_image (image_handle);
|
||||
+ if (loaded_image != NULL)
|
||||
+ grub_free (loaded_image->load_options);
|
||||
+
|
||||
b = grub_efi_system_table->boot_services;
|
||||
efi_call_1 (b->unload_image, image_handle);
|
||||
- efi_call_2 (b->free_pages, address, pages);
|
||||
-
|
||||
- grub_free (file_path);
|
||||
- grub_free (cmdline);
|
||||
- cmdline = 0;
|
||||
- file_path = 0;
|
||||
|
||||
grub_dl_unref (my_mod);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
-grub_chainloader_boot (void)
|
||||
+grub_chainloader_boot (void *context)
|
||||
{
|
||||
+ grub_efi_handle_t image_handle = (grub_efi_handle_t) context;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_efi_status_t status;
|
||||
grub_efi_uintn_t exit_data_size;
|
||||
@@ -139,7 +134,7 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
char *dir_start;
|
||||
char *dir_end;
|
||||
grub_size_t size;
|
||||
- grub_efi_device_path_t *d;
|
||||
+ grub_efi_device_path_t *d, *file_path;
|
||||
|
||||
dir_start = grub_strchr (filename, ')');
|
||||
if (! dir_start)
|
||||
@@ -215,11 +210,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_efi_status_t status;
|
||||
grub_efi_boot_services_t *b;
|
||||
grub_device_t dev = 0;
|
||||
- grub_efi_device_path_t *dp = 0;
|
||||
+ grub_efi_device_path_t *dp = NULL, *file_path = NULL;
|
||||
grub_efi_loaded_image_t *loaded_image;
|
||||
char *filename;
|
||||
void *boot_image = 0;
|
||||
grub_efi_handle_t dev_handle = 0;
|
||||
+ grub_efi_physical_address_t address = 0;
|
||||
+ grub_efi_uintn_t pages = 0;
|
||||
+ grub_efi_char16_t *cmdline = NULL;
|
||||
+ grub_efi_handle_t image_handle = NULL;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
@@ -227,11 +226,6 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
grub_dl_ref (my_mod);
|
||||
|
||||
- /* Initialize some global variables. */
|
||||
- address = 0;
|
||||
- image_handle = 0;
|
||||
- file_path = 0;
|
||||
-
|
||||
b = grub_efi_system_table->boot_services;
|
||||
|
||||
file = grub_file_open (filename, GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE);
|
||||
@@ -401,7 +395,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_file_close (file);
|
||||
grub_device_close (dev);
|
||||
|
||||
- grub_loader_set (grub_chainloader_boot, grub_chainloader_unload, 0);
|
||||
+ /* We're finished with the source image buffer and file path now. */
|
||||
+ efi_call_2 (b->free_pages, address, pages);
|
||||
+ grub_free (file_path);
|
||||
+
|
||||
+ grub_loader_set_ex (grub_chainloader_boot, grub_chainloader_unload, image_handle, 0);
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
@@ -412,11 +410,15 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
|
||||
if (file)
|
||||
grub_file_close (file);
|
||||
|
||||
+ grub_free (cmdline);
|
||||
grub_free (file_path);
|
||||
|
||||
if (address)
|
||||
efi_call_2 (b->free_pages, address, pages);
|
||||
|
||||
+ if (image_handle != NULL)
|
||||
+ efi_call_1 (b->unload_image, image_handle);
|
||||
+
|
||||
grub_dl_unref (my_mod);
|
||||
|
||||
return grub_errno;
|
||||
diff --git a/include/grub/loader.h b/include/grub/loader.h
|
||||
index 7f82a49..3071a50 100644
|
||||
--- a/include/grub/loader.h
|
||||
+++ b/include/grub/loader.h
|
||||
@@ -39,6 +39,11 @@ void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void),
|
||||
grub_err_t (*unload) (void),
|
||||
int flags);
|
||||
|
||||
+void EXPORT_FUNC (grub_loader_set_ex) (grub_err_t (*boot) (void *context),
|
||||
+ grub_err_t (*unload) (void *context),
|
||||
+ void *context,
|
||||
+ int flags);
|
||||
+
|
||||
/* Unset current loader, if any. */
|
||||
void EXPORT_FUNC (grub_loader_unset) (void);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -95,7 +95,13 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
|
||||
file://0044-script-execute-Fix-NULL-dereference-in-grub_script_e.patch \
|
||||
file://0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch \
|
||||
file://0046-script-execute-Avoid-crash-when-using-outside-a-func.patch \
|
||||
file://CVE-2021-3981.patch\
|
||||
file://CVE-2021-3981.patch \
|
||||
file://CVE-2021-3695.patch \
|
||||
file://CVE-2021-3696.patch \
|
||||
file://CVE-2021-3697.patch \
|
||||
file://CVE-2022-28733.patch \
|
||||
file://CVE-2022-28734.patch \
|
||||
file://CVE-2022-28736.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
|
||||
SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
|
||||
|
||||
67
meta/recipes-connectivity/bind/bind/CVE-2022-2795.patch
Normal file
67
meta/recipes-connectivity/bind/bind/CVE-2022-2795.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 36c878a0124973f29b7ca49e6bb18310f9b2601f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= <michal@isc.org>
|
||||
Date: Thu, 8 Sep 2022 11:11:30 +0200
|
||||
Subject: [PATCH 1/3] Bound the amount of work performed for delegations
|
||||
|
||||
Limit the amount of database lookups that can be triggered in
|
||||
fctx_getaddresses() (i.e. when determining the name server addresses to
|
||||
query next) by setting a hard limit on the number of NS RRs processed
|
||||
for any delegation encountered. Without any limit in place, named can
|
||||
be forced to perform large amounts of database lookups per each query
|
||||
received, which severely impacts resolver performance.
|
||||
|
||||
The limit used (20) is an arbitrary value that is considered to be big
|
||||
enough for any sane DNS delegation.
|
||||
|
||||
(cherry picked from commit 3a44097fd6c6c260765b628cd1d2c9cb7efb0b2a)
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-2795
|
||||
Reference to upstream patch:
|
||||
https://gitlab.isc.org/isc-projects/bind9/-/commit/bf2ea6d8525bfd96a84dad221ba9e004adb710a8
|
||||
|
||||
Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com>
|
||||
---
|
||||
lib/dns/resolver.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
|
||||
index 8ae9a993bbd7..ac9a9ef5d009 100644
|
||||
--- a/lib/dns/resolver.c
|
||||
+++ b/lib/dns/resolver.c
|
||||
@@ -180,6 +180,12 @@
|
||||
*/
|
||||
#define NS_FAIL_LIMIT 4
|
||||
#define NS_RR_LIMIT 5
|
||||
+/*
|
||||
+ * IP address lookups are performed for at most NS_PROCESSING_LIMIT NS RRs in
|
||||
+ * any NS RRset encountered, to avoid excessive resource use while processing
|
||||
+ * large delegations.
|
||||
+ */
|
||||
+#define NS_PROCESSING_LIMIT 20
|
||||
|
||||
/* Number of hash buckets for zone counters */
|
||||
#ifndef RES_DOMAIN_BUCKETS
|
||||
@@ -3318,6 +3324,7 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) {
|
||||
bool need_alternate = false;
|
||||
bool all_spilled = true;
|
||||
unsigned int no_addresses = 0;
|
||||
+ unsigned int ns_processed = 0;
|
||||
|
||||
FCTXTRACE5("getaddresses", "fctx->depth=", fctx->depth);
|
||||
|
||||
@@ -3504,6 +3511,11 @@ fctx_getaddresses(fetchctx_t *fctx, bool badcache) {
|
||||
|
||||
dns_rdata_reset(&rdata);
|
||||
dns_rdata_freestruct(&ns);
|
||||
+
|
||||
+ if (++ns_processed >= NS_PROCESSING_LIMIT) {
|
||||
+ result = ISC_R_NOMORE;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
if (result != ISC_R_NOMORE) {
|
||||
return (result);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
31
meta/recipes-connectivity/bind/bind/CVE-2022-38177.patch
Normal file
31
meta/recipes-connectivity/bind/bind/CVE-2022-38177.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From ef3d1a84ff807eea27b4fef601a15932c5ffbfbf Mon Sep 17 00:00:00 2001
|
||||
From: Mark Andrews <marka@isc.org>
|
||||
Date: Thu, 11 Aug 2022 15:15:34 +1000
|
||||
Subject: [PATCH 2/3] Free eckey on siglen mismatch
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-38177
|
||||
Reference to upstream patch:
|
||||
https://gitlab.isc.org/isc-projects/bind9/-/commit/5b2282afff760b1ed3471f6666bdfe8e1d34e590
|
||||
|
||||
Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com>
|
||||
---
|
||||
lib/dns/opensslecdsa_link.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/dns/opensslecdsa_link.c b/lib/dns/opensslecdsa_link.c
|
||||
index 83b5b51cd78c..7576e04ac635 100644
|
||||
--- a/lib/dns/opensslecdsa_link.c
|
||||
+++ b/lib/dns/opensslecdsa_link.c
|
||||
@@ -224,7 +224,7 @@ opensslecdsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
||||
siglen = DNS_SIG_ECDSA384SIZE;
|
||||
|
||||
if (sig->length != siglen)
|
||||
- return (DST_R_VERIFYFAILURE);
|
||||
+ DST_RET(DST_R_VERIFYFAILURE);
|
||||
|
||||
if (!EVP_DigestFinal_ex(evp_md_ctx, digest, &dgstlen))
|
||||
DST_RET (dst__openssl_toresult3(dctx->category,
|
||||
--
|
||||
2.34.1
|
||||
|
||||
33
meta/recipes-connectivity/bind/bind/CVE-2022-38178.patch
Normal file
33
meta/recipes-connectivity/bind/bind/CVE-2022-38178.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 65f5b2f0162d5d2ab25f463aa14a8bae71ace3d9 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Andrews <marka@isc.org>
|
||||
Date: Thu, 11 Aug 2022 15:28:13 +1000
|
||||
Subject: [PATCH 3/3] Free ctx on invalid siglen
|
||||
|
||||
(cherry picked from commit 6ddb480a84836641a0711768a94122972c166825)
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-38178
|
||||
Reference to upstream patch:
|
||||
https://gitlab.isc.org/isc-projects/bind9/-/commit/1af23378ebb11da2eb0f412e4563d6
|
||||
|
||||
Signed-off-by: Mathieu Dubois-Briand <mbriand@witekio.com>
|
||||
---
|
||||
lib/dns/openssleddsa_link.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/dns/openssleddsa_link.c b/lib/dns/openssleddsa_link.c
|
||||
index 8b115ec283f0..b4fcd607c131 100644
|
||||
--- a/lib/dns/openssleddsa_link.c
|
||||
+++ b/lib/dns/openssleddsa_link.c
|
||||
@@ -325,7 +325,7 @@ openssleddsa_verify(dst_context_t *dctx, const isc_region_t *sig) {
|
||||
siglen = DNS_SIG_ED448SIZE;
|
||||
|
||||
if (sig->length != siglen)
|
||||
- return (DST_R_VERIFYFAILURE);
|
||||
+ DST_RET(ISC_R_NOTIMPLEMENTED);
|
||||
|
||||
isc_buffer_usedregion(buf, &tbsreg);
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -19,6 +19,9 @@ 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-2022-2795.patch \
|
||||
file://CVE-2022-38177.patch \
|
||||
file://CVE-2022-38178.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "0d8efbe7ec166ada90e46add4267b7e7c934790cba9bd5af6b8380a4fbfb5aff"
|
||||
|
||||
@@ -56,6 +56,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
|
||||
file://CVE-2021-3588.patch \
|
||||
file://CVE-2021-3658.patch \
|
||||
file://CVE-2022-0204.patch \
|
||||
file://CVE-2022-39176.patch \
|
||||
"
|
||||
S = "${WORKDIR}/bluez-${PV}"
|
||||
|
||||
|
||||
126
meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch
Normal file
126
meta/recipes-connectivity/bluez5/bluez5/CVE-2022-39176.patch
Normal file
@@ -0,0 +1,126 @@
|
||||
From 752c7f707c3cc1eb12eadc13bc336a5c484d4bdf Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 28 Sep 2022 10:45:53 +0530
|
||||
Subject: [PATCH] CVE-2022-39176
|
||||
|
||||
Upstream-Status: Backport [https://launchpad.net/ubuntu/+source/bluez/5.53-0ubuntu3.6]
|
||||
CVE: CVE-2022-39176
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
profiles/audio/avdtp.c | 56 +++++++++++++++++++++++++++---------------
|
||||
profiles/audio/avrcp.c | 8 ++++++
|
||||
2 files changed, 44 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
|
||||
index 782268c..0adf413 100644
|
||||
--- a/profiles/audio/avdtp.c
|
||||
+++ b/profiles/audio/avdtp.c
|
||||
@@ -1261,43 +1261,53 @@ struct avdtp_remote_sep *avdtp_find_remote_sep(struct avdtp *session,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static GSList *caps_to_list(uint8_t *data, int size,
|
||||
+static GSList *caps_to_list(uint8_t *data, size_t size,
|
||||
struct avdtp_service_capability **codec,
|
||||
gboolean *delay_reporting)
|
||||
{
|
||||
+ struct avdtp_service_capability *cap;
|
||||
GSList *caps;
|
||||
- int processed;
|
||||
|
||||
if (delay_reporting)
|
||||
*delay_reporting = FALSE;
|
||||
|
||||
- for (processed = 0, caps = NULL; processed + 2 <= size;) {
|
||||
- struct avdtp_service_capability *cap;
|
||||
- uint8_t length, category;
|
||||
+ if (size < sizeof(*cap))
|
||||
+ return NULL;
|
||||
+
|
||||
+ for (caps = NULL; size >= sizeof(*cap);) {
|
||||
+ struct avdtp_service_capability *cpy;
|
||||
|
||||
- category = data[0];
|
||||
- length = data[1];
|
||||
+ cap = (struct avdtp_service_capability *)data;
|
||||
|
||||
- if (processed + 2 + length > size) {
|
||||
+ if (sizeof(*cap) + cap->length > size) {
|
||||
error("Invalid capability data in getcap resp");
|
||||
break;
|
||||
}
|
||||
|
||||
- cap = g_malloc(sizeof(struct avdtp_service_capability) +
|
||||
- length);
|
||||
- memcpy(cap, data, 2 + length);
|
||||
+ if (cap->category == AVDTP_MEDIA_CODEC &&
|
||||
+ cap->length < sizeof(**codec)) {
|
||||
+ error("Invalid codec data in getcap resp");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ cpy = btd_malloc(sizeof(*cpy) + cap->length);
|
||||
+ memcpy(cpy, cap, sizeof(*cap) + cap->length);
|
||||
|
||||
- processed += 2 + length;
|
||||
- data += 2 + length;
|
||||
+ size -= sizeof(*cap) + cap->length;
|
||||
+ data += sizeof(*cap) + cap->length;
|
||||
|
||||
- caps = g_slist_append(caps, cap);
|
||||
+ caps = g_slist_append(caps, cpy);
|
||||
|
||||
- if (category == AVDTP_MEDIA_CODEC &&
|
||||
- length >=
|
||||
- sizeof(struct avdtp_media_codec_capability))
|
||||
- *codec = cap;
|
||||
- else if (category == AVDTP_DELAY_REPORTING && delay_reporting)
|
||||
- *delay_reporting = TRUE;
|
||||
+ switch (cap->category) {
|
||||
+ case AVDTP_MEDIA_CODEC:
|
||||
+ if (codec)
|
||||
+ *codec = cpy;
|
||||
+ break;
|
||||
+ case AVDTP_DELAY_REPORTING:
|
||||
+ if (delay_reporting)
|
||||
+ *delay_reporting = TRUE;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
return caps;
|
||||
@@ -1494,6 +1504,12 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session, uint8_t transaction,
|
||||
&stream->codec,
|
||||
&stream->delay_reporting);
|
||||
|
||||
+ if (!stream->caps || !stream->codec) {
|
||||
+ err = AVDTP_UNSUPPORTED_CONFIGURATION;
|
||||
+ category = 0x00;
|
||||
+ goto failed_stream;
|
||||
+ }
|
||||
+
|
||||
/* Verify that the Media Transport capability's length = 0. Reject otherwise */
|
||||
for (l = stream->caps; l != NULL; l = g_slist_next(l)) {
|
||||
struct avdtp_service_capability *cap = l->data;
|
||||
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
|
||||
index d9471c0..0233d53 100644
|
||||
--- a/profiles/audio/avrcp.c
|
||||
+++ b/profiles/audio/avrcp.c
|
||||
@@ -1916,6 +1916,14 @@ static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction,
|
||||
goto err_metadata;
|
||||
}
|
||||
|
||||
+ operands += sizeof(*pdu);
|
||||
+ operand_count -= sizeof(*pdu);
|
||||
+
|
||||
+ if (pdu->params_len != operand_count) {
|
||||
+ DBG("AVRCP PDU parameters length don't match");
|
||||
+ pdu->params_len = operand_count;
|
||||
+ }
|
||||
+
|
||||
for (handler = session->control_handlers; handler->pdu_id; handler++) {
|
||||
if (handler->pdu_id == pdu->pdu_id)
|
||||
break;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From d1a5ede5d255bde8ef707f8441b997563b9312bd Mon Sep 17 00:00:00 2001
|
||||
From: Nathan Crandall <ncrandall@tesla.com>
|
||||
Date: Tue, 12 Jul 2022 08:56:34 +0200
|
||||
Subject: gweb: Fix OOB write in received_data()
|
||||
|
||||
There is a mismatch of handling binary vs. C-string data with memchr
|
||||
and strlen, resulting in pos, count, and bytes_read to become out of
|
||||
sync and result in a heap overflow. Instead, do not treat the buffer
|
||||
as an ASCII C-string. We calculate the count based on the return value
|
||||
of memchr, instead of strlen.
|
||||
|
||||
Fixes: CVE-2022-32292
|
||||
|
||||
Upstream-Status: Backport
|
||||
https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=d1a5ede5d255bde8ef707f8441b997563b9312b
|
||||
CVE: CVE-2022-32292
|
||||
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
|
||||
---
|
||||
gweb/gweb.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gweb/gweb.c b/gweb/gweb.c
|
||||
index 12fcb1d8..13c6c5f2 100644
|
||||
--- a/gweb/gweb.c
|
||||
+++ b/gweb/gweb.c
|
||||
@@ -918,7 +918,7 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
|
||||
}
|
||||
|
||||
*pos = '\0';
|
||||
- count = strlen((char *) ptr);
|
||||
+ count = pos - ptr;
|
||||
if (count > 0 && ptr[count - 1] == '\r') {
|
||||
ptr[--count] = '\0';
|
||||
bytes_read--;
|
||||
--
|
||||
cgit
|
||||
|
||||
266
meta/recipes-connectivity/connman/connman/CVE-2022-32293.patch
Normal file
266
meta/recipes-connectivity/connman/connman/CVE-2022-32293.patch
Normal file
@@ -0,0 +1,266 @@
|
||||
From 358a44b1442fae0f82846e10da0708b5c4e1ce27 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Tue, 20 Sep 2022 17:58:19 +0530
|
||||
Subject: [PATCH] CVE-2022-32293
|
||||
|
||||
CVE: CVE-2022-32293
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=72343929836de80727a27d6744c869dff045757c && https://git.kernel.org/pub/scm/network/connman/connman.git/commit/src/wispr.c?id=416bfaff988882c553c672e5bfc2d4f648d29e8a]
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/wispr.c | 83 ++++++++++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 63 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/wispr.c b/src/wispr.c
|
||||
index 473c0e0..97e0242 100644
|
||||
--- a/src/wispr.c
|
||||
+++ b/src/wispr.c
|
||||
@@ -59,6 +59,7 @@ struct wispr_route {
|
||||
};
|
||||
|
||||
struct connman_wispr_portal_context {
|
||||
+ int refcount;
|
||||
struct connman_service *service;
|
||||
enum connman_ipconfig_type type;
|
||||
struct connman_wispr_portal *wispr_portal;
|
||||
@@ -96,10 +97,13 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data);
|
||||
|
||||
static GHashTable *wispr_portal_list = NULL;
|
||||
|
||||
+#define wispr_portal_context_ref(wp_context) \
|
||||
+ wispr_portal_context_ref_debug(wp_context, __FILE__, __LINE__, __func__)
|
||||
+#define wispr_portal_context_unref(wp_context) \
|
||||
+ wispr_portal_context_unref_debug(wp_context, __FILE__, __LINE__, __func__)
|
||||
+
|
||||
static void connman_wispr_message_init(struct connman_wispr_message *msg)
|
||||
{
|
||||
- DBG("");
|
||||
-
|
||||
msg->has_error = false;
|
||||
msg->current_element = NULL;
|
||||
|
||||
@@ -159,11 +163,6 @@ static void free_wispr_routes(struct connman_wispr_portal_context *wp_context)
|
||||
static void free_connman_wispr_portal_context(
|
||||
struct connman_wispr_portal_context *wp_context)
|
||||
{
|
||||
- DBG("context %p", wp_context);
|
||||
-
|
||||
- if (!wp_context)
|
||||
- return;
|
||||
-
|
||||
if (wp_context->wispr_portal) {
|
||||
if (wp_context->wispr_portal->ipv4_context == wp_context)
|
||||
wp_context->wispr_portal->ipv4_context = NULL;
|
||||
@@ -200,9 +199,38 @@ static void free_connman_wispr_portal_context(
|
||||
g_free(wp_context);
|
||||
}
|
||||
|
||||
+static struct connman_wispr_portal_context *
|
||||
+wispr_portal_context_ref_debug(struct connman_wispr_portal_context *wp_context,
|
||||
+ const char *file, int line, const char *caller)
|
||||
+{
|
||||
+ DBG("%p ref %d by %s:%d:%s()", wp_context,
|
||||
+ wp_context->refcount + 1, file, line, caller);
|
||||
+
|
||||
+ __sync_fetch_and_add(&wp_context->refcount, 1);
|
||||
+
|
||||
+ return wp_context;
|
||||
+}
|
||||
+
|
||||
+static void wispr_portal_context_unref_debug(
|
||||
+ struct connman_wispr_portal_context *wp_context,
|
||||
+ const char *file, int line, const char *caller)
|
||||
+{
|
||||
+ if (!wp_context)
|
||||
+ return;
|
||||
+
|
||||
+ DBG("%p ref %d by %s:%d:%s()", wp_context,
|
||||
+ wp_context->refcount - 1, file, line, caller);
|
||||
+
|
||||
+ if (__sync_fetch_and_sub(&wp_context->refcount, 1) != 1)
|
||||
+ return;
|
||||
+
|
||||
+ free_connman_wispr_portal_context(wp_context);
|
||||
+}
|
||||
+
|
||||
static struct connman_wispr_portal_context *create_wispr_portal_context(void)
|
||||
{
|
||||
- return g_try_new0(struct connman_wispr_portal_context, 1);
|
||||
+ return wispr_portal_context_ref(
|
||||
+ g_new0(struct connman_wispr_portal_context, 1));
|
||||
}
|
||||
|
||||
static void free_connman_wispr_portal(gpointer data)
|
||||
@@ -214,8 +242,8 @@ static void free_connman_wispr_portal(gpointer data)
|
||||
if (!wispr_portal)
|
||||
return;
|
||||
|
||||
- free_connman_wispr_portal_context(wispr_portal->ipv4_context);
|
||||
- free_connman_wispr_portal_context(wispr_portal->ipv6_context);
|
||||
+ wispr_portal_context_unref(wispr_portal->ipv4_context);
|
||||
+ wispr_portal_context_unref(wispr_portal->ipv6_context);
|
||||
|
||||
g_free(wispr_portal);
|
||||
}
|
||||
@@ -450,8 +478,6 @@ static void portal_manage_status(GWebResult *result,
|
||||
&str))
|
||||
connman_info("Client-Timezone: %s", str);
|
||||
|
||||
- free_connman_wispr_portal_context(wp_context);
|
||||
-
|
||||
__connman_service_ipconfig_indicate_state(service,
|
||||
CONNMAN_SERVICE_STATE_ONLINE, type);
|
||||
}
|
||||
@@ -509,14 +535,17 @@ static void wispr_portal_request_portal(
|
||||
{
|
||||
DBG("");
|
||||
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
wp_context->request_id = g_web_request_get(wp_context->web,
|
||||
wp_context->status_url,
|
||||
wispr_portal_web_result,
|
||||
wispr_route_request,
|
||||
wp_context);
|
||||
|
||||
- if (wp_context->request_id == 0)
|
||||
+ if (wp_context->request_id == 0) {
|
||||
wispr_portal_error(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool wispr_input(const guint8 **data, gsize *length,
|
||||
@@ -562,13 +591,15 @@ static void wispr_portal_browser_reply_cb(struct connman_service *service,
|
||||
return;
|
||||
|
||||
if (!authentication_done) {
|
||||
- wispr_portal_error(wp_context);
|
||||
free_wispr_routes(wp_context);
|
||||
+ wispr_portal_error(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Restarting the test */
|
||||
__connman_service_wispr_start(service, wp_context->type);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
}
|
||||
|
||||
static void wispr_portal_request_wispr_login(struct connman_service *service,
|
||||
@@ -592,7 +623,7 @@ static void wispr_portal_request_wispr_login(struct connman_service *service,
|
||||
return;
|
||||
}
|
||||
|
||||
- free_connman_wispr_portal_context(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -644,11 +675,13 @@ static bool wispr_manage_message(GWebResult *result,
|
||||
|
||||
wp_context->wispr_result = CONNMAN_WISPR_RESULT_LOGIN;
|
||||
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
if (__connman_agent_request_login_input(wp_context->service,
|
||||
wispr_portal_request_wispr_login,
|
||||
- wp_context) != -EINPROGRESS)
|
||||
+ wp_context) != -EINPROGRESS) {
|
||||
wispr_portal_error(wp_context);
|
||||
- else
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
+ } else
|
||||
return true;
|
||||
|
||||
break;
|
||||
@@ -697,6 +730,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
if (length > 0) {
|
||||
g_web_parser_feed_data(wp_context->wispr_parser,
|
||||
chunk, length);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -714,6 +748,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
|
||||
switch (status) {
|
||||
case 000:
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
__connman_agent_request_browser(wp_context->service,
|
||||
wispr_portal_browser_reply_cb,
|
||||
wp_context->status_url, wp_context);
|
||||
@@ -725,11 +760,14 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
if (g_web_result_get_header(result, "X-ConnMan-Status",
|
||||
&str)) {
|
||||
portal_manage_status(result, wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
return false;
|
||||
- } else
|
||||
+ } else {
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
__connman_agent_request_browser(wp_context->service,
|
||||
wispr_portal_browser_reply_cb,
|
||||
wp_context->redirect_url, wp_context);
|
||||
+ }
|
||||
|
||||
break;
|
||||
case 302:
|
||||
@@ -737,6 +775,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
!g_web_result_get_header(result, "Location",
|
||||
&redirect)) {
|
||||
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
__connman_agent_request_browser(wp_context->service,
|
||||
wispr_portal_browser_reply_cb,
|
||||
wp_context->status_url, wp_context);
|
||||
@@ -747,6 +786,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
|
||||
wp_context->redirect_url = g_strdup(redirect);
|
||||
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
wp_context->request_id = g_web_request_get(wp_context->web,
|
||||
redirect, wispr_portal_web_result,
|
||||
wispr_route_request, wp_context);
|
||||
@@ -763,6 +803,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
|
||||
break;
|
||||
case 505:
|
||||
+ wispr_portal_context_ref(wp_context);
|
||||
__connman_agent_request_browser(wp_context->service,
|
||||
wispr_portal_browser_reply_cb,
|
||||
wp_context->status_url, wp_context);
|
||||
@@ -775,6 +816,7 @@ static bool wispr_portal_web_result(GWebResult *result, gpointer user_data)
|
||||
wp_context->request_id = 0;
|
||||
done:
|
||||
wp_context->wispr_msg.message_type = -1;
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -809,6 +851,7 @@ static void proxy_callback(const char *proxy, void *user_data)
|
||||
xml_wispr_parser_callback, wp_context);
|
||||
|
||||
wispr_portal_request_portal(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
}
|
||||
|
||||
static gboolean no_proxy_callback(gpointer user_data)
|
||||
@@ -903,7 +946,7 @@ static int wispr_portal_detect(struct connman_wispr_portal_context *wp_context)
|
||||
|
||||
if (wp_context->token == 0) {
|
||||
err = -EINVAL;
|
||||
- free_connman_wispr_portal_context(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
}
|
||||
} else if (wp_context->timeout == 0) {
|
||||
wp_context->timeout = g_idle_add(no_proxy_callback, wp_context);
|
||||
@@ -952,7 +995,7 @@ int __connman_wispr_start(struct connman_service *service,
|
||||
|
||||
/* If there is already an existing context, we wipe it */
|
||||
if (wp_context)
|
||||
- free_connman_wispr_portal_context(wp_context);
|
||||
+ wispr_portal_context_unref(wp_context);
|
||||
|
||||
wp_context = create_wispr_portal_context();
|
||||
if (!wp_context)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -12,6 +12,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
|
||||
file://CVE-2021-33833.patch \
|
||||
file://CVE-2022-23096-7.patch \
|
||||
file://CVE-2022-23098.patch \
|
||||
file://CVE-2022-32292.patch \
|
||||
file://CVE-2022-32293.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From eaae65aac967f9628787dca4a2501ca860bb6598 Mon Sep 17 00:00:00 2001
|
||||
From: Minjae Kim <flowergom@gmail.com>
|
||||
Date: Mon, 26 Sep 2022 22:05:07 +0200
|
||||
Subject: [PATCH] telnetd: Handle early IAC EC or IAC EL receipt
|
||||
|
||||
Fix telnetd crash if the first two bytes of a new connection
|
||||
are 0xff 0xf7 (IAC EC) or 0xff 0xf8 (IAC EL).
|
||||
|
||||
The problem was reported in:
|
||||
<https://pierrekim.github.io/blog/2022-08-24-2-byte-dos-freebsd-netbsd-telnetd-netkit-telnetd-inetutils-telnetd-kerberos-telnetd.html>.
|
||||
|
||||
* NEWS: Mention fix.
|
||||
* telnetd/state.c (telrcv): Handle zero slctab[SLC_EC].sptr and
|
||||
zero slctab[SLC_EL].sptr.
|
||||
|
||||
CVE: CVE-2022-39028
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=fae8263e467380483c28513c0e5fac143e46f94f]
|
||||
Signed-off-by: Minjae Kim<flowergom@gmail.com>
|
||||
---
|
||||
telnetd/state.c | 12 +++++++++---
|
||||
1 file changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/telnetd/state.c b/telnetd/state.c
|
||||
index 2184bca..7948503 100644
|
||||
--- a/telnetd/state.c
|
||||
+++ b/telnetd/state.c
|
||||
@@ -314,15 +314,21 @@ telrcv (void)
|
||||
case EC:
|
||||
case EL:
|
||||
{
|
||||
- cc_t ch;
|
||||
+ cc_t ch = (cc_t) (_POSIX_VDISABLE);
|
||||
|
||||
DEBUG (debug_options, 1, printoption ("td: recv IAC", c));
|
||||
ptyflush (); /* half-hearted */
|
||||
init_termbuf ();
|
||||
if (c == EC)
|
||||
- ch = *slctab[SLC_EC].sptr;
|
||||
+ {
|
||||
+ if (slctab[SLC_EC].sptr)
|
||||
+ ch = *slctab[SLC_EC].sptr;
|
||||
+ }
|
||||
else
|
||||
- ch = *slctab[SLC_EL].sptr;
|
||||
+ {
|
||||
+ if (slctab[SLC_EL].sptr)
|
||||
+ ch = *slctab[SLC_EL].sptr;
|
||||
+ }
|
||||
if (ch != (cc_t) (_POSIX_VDISABLE))
|
||||
pty_output_byte ((unsigned char) ch);
|
||||
break;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -24,6 +24,7 @@ SRC_URI = "${GNU_MIRROR}/inetutils/inetutils-${PV}.tar.gz \
|
||||
file://0001-rcp-fix-to-work-with-large-files.patch \
|
||||
file://fix-buffer-fortify-tfpt.patch \
|
||||
file://CVE-2021-40491.patch \
|
||||
file://CVE-2022-39028.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "04852c26c47cc8c6b825f2b74f191f52"
|
||||
|
||||
@@ -5,8 +5,8 @@ SECTION = "network"
|
||||
LICENSE = "PD"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=87964579b2a8ece4bc6744d2dc9a8b04"
|
||||
|
||||
SRCREV = "3d5c8d0f7e0264768a2c000d0fd4b4d4a991e041"
|
||||
PV = "20220511"
|
||||
SRCREV = "fe19892a8168bf19d81e3bc4ee319bf7f9f058f5"
|
||||
PV = "20220725"
|
||||
PE = "1"
|
||||
|
||||
SRC_URI = "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https;branch=main"
|
||||
|
||||
@@ -190,7 +190,7 @@ FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"
|
||||
FILES_${PN}-misc = "${bindir}/ssh* ${libexecdir}/ssh*"
|
||||
FILES_${PN}-keygen = "${bindir}/ssh-keygen"
|
||||
|
||||
RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen"
|
||||
RDEPENDS_${PN} += "${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-keygen ${PN}-sftp-server"
|
||||
RDEPENDS_${PN}-sshd += "${PN}-keygen ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam-plugin-keyinit pam-plugin-loginuid', '', d)}"
|
||||
RRECOMMENDS_${PN}-sshd_append_class-target = "\
|
||||
${@bb.utils.filter('PACKAGECONFIG', 'rng-tools', d)} \
|
||||
|
||||
53
meta/recipes-core/expat/expat/CVE-2022-40674.patch
Normal file
53
meta/recipes-core/expat/expat/CVE-2022-40674.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 4a32da87e931ba54393d465bb77c40b5c33d343b Mon Sep 17 00:00:00 2001
|
||||
From: Rhodri James <rhodri@wildebeest.org.uk>
|
||||
Date: Wed, 17 Aug 2022 18:26:18 +0100
|
||||
Subject: [PATCH] Ensure raw tagnames are safe exiting internalEntityParser
|
||||
|
||||
It is possible to concoct a situation in which parsing is
|
||||
suspended while substituting in an internal entity, so that
|
||||
XML_ResumeParser directly uses internalEntityProcessor as
|
||||
its processor. If the subsequent parse includes some unclosed
|
||||
tags, this will return without calling storeRawNames to ensure
|
||||
that the raw versions of the tag names are stored in memory other
|
||||
than the parse buffer itself. If the parse buffer is then changed
|
||||
or reallocated (for example if processing a file line by line),
|
||||
badness will ensue.
|
||||
|
||||
This patch ensures storeRawNames is always called when needed
|
||||
after calling doContent. The earlier call do doContent does
|
||||
not need the same protection; it only deals with entity
|
||||
substitution, which cannot leave unbalanced tags, and in any
|
||||
case the raw names will be pointing into the stored entity
|
||||
value not the parse buffer.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/4a32da87e931ba54393d465bb77c40b5c33d343b]
|
||||
CVE: CVE-2022-40674
|
||||
Signed-off-by: Virendra Thakur <virendrak@kpit.com>
|
||||
---
|
||||
expat/lib/xmlparse.c | 13 +++++++++----
|
||||
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: expat/lib/xmlparse.c
|
||||
===================================================================
|
||||
--- a/lib/xmlparse.c
|
||||
+++ b/lib/xmlparse.c
|
||||
@@ -5657,10 +5657,15 @@ internalEntityProcessor(XML_Parser parse
|
||||
{
|
||||
parser->m_processor = contentProcessor;
|
||||
/* see externalEntityContentProcessor vs contentProcessor */
|
||||
- return doContent(parser, parser->m_parentParser ? 1 : 0, parser->m_encoding,
|
||||
- s, end, nextPtr,
|
||||
- (XML_Bool)! parser->m_parsingStatus.finalBuffer,
|
||||
- XML_ACCOUNT_DIRECT);
|
||||
+ result = doContent(parser, parser->m_parentParser ? 1 : 0,
|
||||
+ parser->m_encoding, s, end, nextPtr,
|
||||
+ (XML_Bool)! parser->m_parsingStatus.finalBuffer,
|
||||
+ XML_ACCOUNT_DIRECT);
|
||||
+ if (result == XML_ERROR_NONE) {
|
||||
+ if (! storeRawNames(parser))
|
||||
+ return XML_ERROR_NO_MEMORY;
|
||||
+ }
|
||||
+ return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ SRC_URI = "git://github.com/libexpat/libexpat.git;protocol=https;branch=master \
|
||||
file://CVE-2022-25314.patch \
|
||||
file://CVE-2022-25315.patch \
|
||||
file://libtool-tag.patch \
|
||||
file://CVE-2022-40674.patch \
|
||||
"
|
||||
|
||||
SRCREV = "a7bc26b69768f7fb24f0c7976fae24b157b85b13"
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "08bd8cc1148b7b8b353ba5002560b0c2b3973a71"
|
||||
SRCREV ?= "9ae91384970637cd8880c07071fb44b7f5574012"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
@@ -129,7 +129,7 @@ do_install () {
|
||||
update-rc.d -r ${D} rmnologin.sh start 99 2 3 4 5 .
|
||||
update-rc.d -r ${D} sendsigs start 20 0 6 .
|
||||
update-rc.d -r ${D} urandom start 38 S 0 6 .
|
||||
update-rc.d -r ${D} umountnfs.sh start 31 0 1 6 .
|
||||
update-rc.d -r ${D} umountnfs.sh stop 31 0 1 6 .
|
||||
update-rc.d -r ${D} umountfs start 40 0 6 .
|
||||
update-rc.d -r ${D} reboot start 90 6 .
|
||||
update-rc.d -r ${D} halt start 90 0 .
|
||||
|
||||
@@ -0,0 +1,813 @@
|
||||
From b5125000917810731bc28055c0445d571121f80e Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Thu, 21 Apr 2022 00:45:58 +0200
|
||||
Subject: [PATCH] Port gentest.py to Python 3
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/343fc1421cdae097fa6c4cffeb1a065a40be6bbb]
|
||||
|
||||
* fixes:
|
||||
|
||||
make[1]: 'testReader' is up to date.
|
||||
File "../libxml2-2.9.10/gentest.py", line 11
|
||||
print "libxml2 python bindings not available, skipping testapi.c generation"
|
||||
^
|
||||
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("libxml2 python bindings not available, skipping testapi.c generation")?
|
||||
make[1]: [Makefile:2078: testapi.c] Error 1 (ignored)
|
||||
|
||||
...
|
||||
|
||||
make[1]: 'testReader' is up to date.
|
||||
File "../libxml2-2.9.10/gentest.py", line 271
|
||||
return 1
|
||||
^
|
||||
TabError: inconsistent use of tabs and spaces in indentation
|
||||
make[1]: [Makefile:2078: testapi.c] Error 1 (ignored)
|
||||
|
||||
...
|
||||
|
||||
aarch64-oe-linux-gcc: error: testapi.c: No such file or directory
|
||||
aarch64-oe-linux-gcc: fatal error: no input files
|
||||
compilation terminated.
|
||||
make[1]: *** [Makefile:1275: testapi.o] Error 1
|
||||
|
||||
But there is still a bit mystery why it worked before, because check-am
|
||||
calls gentest.py with $(PYTHON), so it ignores the shebang in the script
|
||||
and libxml2 is using python3native (through python3targetconfig.bbclass)
|
||||
so something like:
|
||||
|
||||
libxml2/2.9.10-r0/recipe-sysroot-native/usr/bin/python3-native/python3 gentest.py
|
||||
|
||||
But that still fails (now without SyntaxError) with:
|
||||
libxml2 python bindings not available, skipping testapi.c generation
|
||||
|
||||
because we don't have dependency on libxml2-native (to provide libxml2
|
||||
python bindings form python3native) and exported PYTHON_SITE_PACKAGES
|
||||
might be useless (e.g. /usr/lib/python3.8/site-packages on Ubuntu-22.10
|
||||
which uses python 3.10 and there is no site-packages with libxml2)
|
||||
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
---
|
||||
gentest.py | 421 ++++++++++++++++++++++++++---------------------------
|
||||
1 file changed, 209 insertions(+), 212 deletions(-)
|
||||
|
||||
diff --git a/gentest.py b/gentest.py
|
||||
index b763300..0756706 100755
|
||||
--- a/gentest.py
|
||||
+++ b/gentest.py
|
||||
@@ -8,7 +8,7 @@ import string
|
||||
try:
|
||||
import libxml2
|
||||
except:
|
||||
- print "libxml2 python bindings not available, skipping testapi.c generation"
|
||||
+ print("libxml2 python bindings not available, skipping testapi.c generation")
|
||||
sys.exit(0)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
@@ -227,7 +227,7 @@ extra_post_call = {
|
||||
if (old != NULL) {
|
||||
xmlUnlinkNode(old);
|
||||
xmlFreeNode(old) ; old = NULL ; }
|
||||
- ret_val = NULL;""",
|
||||
+\t ret_val = NULL;""",
|
||||
"xmlTextMerge":
|
||||
"""if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
|
||||
xmlUnlinkNode(second);
|
||||
@@ -236,7 +236,7 @@ extra_post_call = {
|
||||
"""if ((ret_val != NULL) && (ret_val != ncname) &&
|
||||
(ret_val != prefix) && (ret_val != memory))
|
||||
xmlFree(ret_val);
|
||||
- ret_val = NULL;""",
|
||||
+\t ret_val = NULL;""",
|
||||
"xmlNewDocElementContent":
|
||||
"""xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;""",
|
||||
"xmlDictReference": "xmlDictFree(dict);",
|
||||
@@ -268,29 +268,29 @@ modules = []
|
||||
def is_skipped_module(name):
|
||||
for mod in skipped_modules:
|
||||
if mod == name:
|
||||
- return 1
|
||||
+ return 1
|
||||
return 0
|
||||
|
||||
def is_skipped_function(name):
|
||||
for fun in skipped_functions:
|
||||
if fun == name:
|
||||
- return 1
|
||||
+ return 1
|
||||
# Do not test destructors
|
||||
- if string.find(name, 'Free') != -1:
|
||||
+ if name.find('Free') != -1:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def is_skipped_memcheck(name):
|
||||
for fun in skipped_memcheck:
|
||||
if fun == name:
|
||||
- return 1
|
||||
+ return 1
|
||||
return 0
|
||||
|
||||
missing_types = {}
|
||||
def add_missing_type(name, func):
|
||||
try:
|
||||
list = missing_types[name]
|
||||
- list.append(func)
|
||||
+ list.append(func)
|
||||
except:
|
||||
missing_types[name] = [func]
|
||||
|
||||
@@ -310,7 +310,7 @@ def add_missing_functions(name, module):
|
||||
missing_functions_nr = missing_functions_nr + 1
|
||||
try:
|
||||
list = missing_functions[module]
|
||||
- list.append(name)
|
||||
+ list.append(name)
|
||||
except:
|
||||
missing_functions[module] = [name]
|
||||
|
||||
@@ -319,45 +319,45 @@ def add_missing_functions(name, module):
|
||||
#
|
||||
|
||||
def type_convert(str, name, info, module, function, pos):
|
||||
-# res = string.replace(str, " ", " ")
|
||||
-# res = string.replace(str, " ", " ")
|
||||
-# res = string.replace(str, " ", " ")
|
||||
- res = string.replace(str, " *", "_ptr")
|
||||
-# res = string.replace(str, "*", "_ptr")
|
||||
- res = string.replace(res, " ", "_")
|
||||
+# res = str.replace(" ", " ")
|
||||
+# res = str.replace(" ", " ")
|
||||
+# res = str.replace(" ", " ")
|
||||
+ res = str.replace(" *", "_ptr")
|
||||
+# res = str.replace("*", "_ptr")
|
||||
+ res = res.replace(" ", "_")
|
||||
if res == 'const_char_ptr':
|
||||
- if string.find(name, "file") != -1 or \
|
||||
- string.find(name, "uri") != -1 or \
|
||||
- string.find(name, "URI") != -1 or \
|
||||
- string.find(info, "filename") != -1 or \
|
||||
- string.find(info, "URI") != -1 or \
|
||||
- string.find(info, "URL") != -1:
|
||||
- if string.find(function, "Save") != -1 or \
|
||||
- string.find(function, "Create") != -1 or \
|
||||
- string.find(function, "Write") != -1 or \
|
||||
- string.find(function, "Fetch") != -1:
|
||||
- return('fileoutput')
|
||||
- return('filepath')
|
||||
+ if name.find("file") != -1 or \
|
||||
+ name.find("uri") != -1 or \
|
||||
+ name.find("URI") != -1 or \
|
||||
+ info.find("filename") != -1 or \
|
||||
+ info.find("URI") != -1 or \
|
||||
+ info.find("URL") != -1:
|
||||
+ if function.find("Save") != -1 or \
|
||||
+ function.find("Create") != -1 or \
|
||||
+ function.find("Write") != -1 or \
|
||||
+ function.find("Fetch") != -1:
|
||||
+ return('fileoutput')
|
||||
+ return('filepath')
|
||||
if res == 'void_ptr':
|
||||
if module == 'nanoftp' and name == 'ctx':
|
||||
- return('xmlNanoFTPCtxtPtr')
|
||||
+ return('xmlNanoFTPCtxtPtr')
|
||||
if function == 'xmlNanoFTPNewCtxt' or \
|
||||
- function == 'xmlNanoFTPConnectTo' or \
|
||||
- function == 'xmlNanoFTPOpen':
|
||||
- return('xmlNanoFTPCtxtPtr')
|
||||
+ function == 'xmlNanoFTPConnectTo' or \
|
||||
+ function == 'xmlNanoFTPOpen':
|
||||
+ return('xmlNanoFTPCtxtPtr')
|
||||
if module == 'nanohttp' and name == 'ctx':
|
||||
- return('xmlNanoHTTPCtxtPtr')
|
||||
- if function == 'xmlNanoHTTPMethod' or \
|
||||
- function == 'xmlNanoHTTPMethodRedir' or \
|
||||
- function == 'xmlNanoHTTPOpen' or \
|
||||
- function == 'xmlNanoHTTPOpenRedir':
|
||||
- return('xmlNanoHTTPCtxtPtr');
|
||||
+ return('xmlNanoHTTPCtxtPtr')
|
||||
+ if function == 'xmlNanoHTTPMethod' or \
|
||||
+ function == 'xmlNanoHTTPMethodRedir' or \
|
||||
+ function == 'xmlNanoHTTPOpen' or \
|
||||
+ function == 'xmlNanoHTTPOpenRedir':
|
||||
+ return('xmlNanoHTTPCtxtPtr');
|
||||
if function == 'xmlIOHTTPOpen':
|
||||
- return('xmlNanoHTTPCtxtPtr')
|
||||
- if string.find(name, "data") != -1:
|
||||
- return('userdata')
|
||||
- if string.find(name, "user") != -1:
|
||||
- return('userdata')
|
||||
+ return('xmlNanoHTTPCtxtPtr')
|
||||
+ if name.find("data") != -1:
|
||||
+ return('userdata')
|
||||
+ if name.find("user") != -1:
|
||||
+ return('userdata')
|
||||
if res == 'xmlDoc_ptr':
|
||||
res = 'xmlDocPtr'
|
||||
if res == 'xmlNode_ptr':
|
||||
@@ -366,18 +366,18 @@ def type_convert(str, name, info, module, function, pos):
|
||||
res = 'xmlDictPtr'
|
||||
if res == 'xmlNodePtr' and pos != 0:
|
||||
if (function == 'xmlAddChild' and pos == 2) or \
|
||||
- (function == 'xmlAddChildList' and pos == 2) or \
|
||||
+ (function == 'xmlAddChildList' and pos == 2) or \
|
||||
(function == 'xmlAddNextSibling' and pos == 2) or \
|
||||
(function == 'xmlAddSibling' and pos == 2) or \
|
||||
(function == 'xmlDocSetRootElement' and pos == 2) or \
|
||||
(function == 'xmlReplaceNode' and pos == 2) or \
|
||||
(function == 'xmlTextMerge') or \
|
||||
- (function == 'xmlAddPrevSibling' and pos == 2):
|
||||
- return('xmlNodePtr_in');
|
||||
+ (function == 'xmlAddPrevSibling' and pos == 2):
|
||||
+ return('xmlNodePtr_in');
|
||||
if res == 'const xmlBufferPtr':
|
||||
res = 'xmlBufferPtr'
|
||||
if res == 'xmlChar_ptr' and name == 'name' and \
|
||||
- string.find(function, "EatName") != -1:
|
||||
+ function.find("EatName") != -1:
|
||||
return('eaten_name')
|
||||
if res == 'void_ptr*':
|
||||
res = 'void_ptr_ptr'
|
||||
@@ -393,7 +393,7 @@ def type_convert(str, name, info, module, function, pos):
|
||||
res = 'debug_FILE_ptr';
|
||||
if res == 'int' and name == 'options':
|
||||
if module == 'parser' or module == 'xmlreader':
|
||||
- res = 'parseroptions'
|
||||
+ res = 'parseroptions'
|
||||
|
||||
return res
|
||||
|
||||
@@ -402,28 +402,28 @@ known_param_types = []
|
||||
def is_known_param_type(name):
|
||||
for type in known_param_types:
|
||||
if type == name:
|
||||
- return 1
|
||||
+ return 1
|
||||
return name[-3:] == 'Ptr' or name[-4:] == '_ptr'
|
||||
|
||||
def generate_param_type(name, rtype):
|
||||
global test
|
||||
for type in known_param_types:
|
||||
if type == name:
|
||||
- return
|
||||
+ return
|
||||
for type in generated_param_types:
|
||||
if type == name:
|
||||
- return
|
||||
+ return
|
||||
|
||||
if name[-3:] == 'Ptr' or name[-4:] == '_ptr':
|
||||
if rtype[0:6] == 'const ':
|
||||
- crtype = rtype[6:]
|
||||
- else:
|
||||
- crtype = rtype
|
||||
+ crtype = rtype[6:]
|
||||
+ else:
|
||||
+ crtype = rtype
|
||||
|
||||
define = 0
|
||||
- if modules_defines.has_key(module):
|
||||
- test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
- define = 1
|
||||
+ if module in modules_defines:
|
||||
+ test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
+ define = 1
|
||||
test.write("""
|
||||
#define gen_nb_%s 1
|
||||
static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
|
||||
@@ -433,7 +433,7 @@ static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTR
|
||||
}
|
||||
""" % (name, crtype, name, name, rtype))
|
||||
if define == 1:
|
||||
- test.write("#endif\n\n")
|
||||
+ test.write("#endif\n\n")
|
||||
add_generated_param_type(name)
|
||||
|
||||
#
|
||||
@@ -445,7 +445,7 @@ known_return_types = []
|
||||
def is_known_return_type(name):
|
||||
for type in known_return_types:
|
||||
if type == name:
|
||||
- return 1
|
||||
+ return 1
|
||||
return 0
|
||||
|
||||
#
|
||||
@@ -471,7 +471,7 @@ def compare_and_save():
|
||||
try:
|
||||
os.system("rm testapi.c; mv testapi.c.new testapi.c")
|
||||
except:
|
||||
- os.system("mv testapi.c.new testapi.c")
|
||||
+ os.system("mv testapi.c.new testapi.c")
|
||||
print("Updated testapi.c")
|
||||
else:
|
||||
print("Generated testapi.c is identical")
|
||||
@@ -481,17 +481,17 @@ while line != "":
|
||||
if line == "/* CUT HERE: everything below that line is generated */\n":
|
||||
break;
|
||||
if line[0:15] == "#define gen_nb_":
|
||||
- type = string.split(line[15:])[0]
|
||||
- known_param_types.append(type)
|
||||
+ type = line[15:].split()[0]
|
||||
+ known_param_types.append(type)
|
||||
if line[0:19] == "static void desret_":
|
||||
- type = string.split(line[19:], '(')[0]
|
||||
- known_return_types.append(type)
|
||||
+ type = line[19:].split('(')[0]
|
||||
+ known_return_types.append(type)
|
||||
test.write(line)
|
||||
line = input.readline()
|
||||
input.close()
|
||||
|
||||
if line == "":
|
||||
- print "Could not find the CUT marker in testapi.c skipping generation"
|
||||
+ print("Could not find the CUT marker in testapi.c skipping generation")
|
||||
test.close()
|
||||
sys.exit(0)
|
||||
|
||||
@@ -505,7 +505,7 @@ test.write("/* CUT HERE: everything below that line is generated */\n")
|
||||
#
|
||||
doc = libxml2.readFile(srcPref + 'doc/libxml2-api.xml', None, 0)
|
||||
if doc == None:
|
||||
- print "Failed to load doc/libxml2-api.xml"
|
||||
+ print("Failed to load doc/libxml2-api.xml")
|
||||
sys.exit(1)
|
||||
ctxt = doc.xpathNewContext()
|
||||
|
||||
@@ -519,9 +519,9 @@ for arg in args:
|
||||
mod = arg.xpathEval('string(../@file)')
|
||||
func = arg.xpathEval('string(../@name)')
|
||||
if (mod not in skipped_modules) and (func not in skipped_functions):
|
||||
- type = arg.xpathEval('string(@type)')
|
||||
- if not argtypes.has_key(type):
|
||||
- argtypes[type] = func
|
||||
+ type = arg.xpathEval('string(@type)')
|
||||
+ if type not in argtypes:
|
||||
+ argtypes[type] = func
|
||||
|
||||
# similarly for return types
|
||||
rettypes = {}
|
||||
@@ -531,8 +531,8 @@ for ret in rets:
|
||||
func = ret.xpathEval('string(../@name)')
|
||||
if (mod not in skipped_modules) and (func not in skipped_functions):
|
||||
type = ret.xpathEval('string(@type)')
|
||||
- if not rettypes.has_key(type):
|
||||
- rettypes[type] = func
|
||||
+ if type not in rettypes:
|
||||
+ rettypes[type] = func
|
||||
|
||||
#
|
||||
# Generate constructors and return type handling for all enums
|
||||
@@ -549,49 +549,49 @@ for enum in enums:
|
||||
continue;
|
||||
define = 0
|
||||
|
||||
- if argtypes.has_key(name) and is_known_param_type(name) == 0:
|
||||
- values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
|
||||
- i = 0
|
||||
- vals = []
|
||||
- for value in values:
|
||||
- vname = value.xpathEval('string(@name)')
|
||||
- if vname == None:
|
||||
- continue;
|
||||
- i = i + 1
|
||||
- if i >= 5:
|
||||
- break;
|
||||
- vals.append(vname)
|
||||
- if vals == []:
|
||||
- print "Didn't find any value for enum %s" % (name)
|
||||
- continue
|
||||
- if modules_defines.has_key(module):
|
||||
- test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
- define = 1
|
||||
- test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
|
||||
- test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
|
||||
- (name, name))
|
||||
- i = 1
|
||||
- for value in vals:
|
||||
- test.write(" if (no == %d) return(%s);\n" % (i, value))
|
||||
- i = i + 1
|
||||
- test.write(""" return(0);
|
||||
+ if (name in argtypes) and is_known_param_type(name) == 0:
|
||||
+ values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name)
|
||||
+ i = 0
|
||||
+ vals = []
|
||||
+ for value in values:
|
||||
+ vname = value.xpathEval('string(@name)')
|
||||
+ if vname == None:
|
||||
+ continue;
|
||||
+ i = i + 1
|
||||
+ if i >= 5:
|
||||
+ break;
|
||||
+ vals.append(vname)
|
||||
+ if vals == []:
|
||||
+ print("Didn't find any value for enum %s" % (name))
|
||||
+ continue
|
||||
+ if module in modules_defines:
|
||||
+ test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
+ define = 1
|
||||
+ test.write("#define gen_nb_%s %d\n" % (name, len(vals)))
|
||||
+ test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" %
|
||||
+ (name, name))
|
||||
+ i = 1
|
||||
+ for value in vals:
|
||||
+ test.write(" if (no == %d) return(%s);\n" % (i, value))
|
||||
+ i = i + 1
|
||||
+ test.write(""" return(0);
|
||||
}
|
||||
|
||||
static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
|
||||
""" % (name, name));
|
||||
- known_param_types.append(name)
|
||||
+ known_param_types.append(name)
|
||||
|
||||
if (is_known_return_type(name) == 0) and (name in rettypes):
|
||||
- if define == 0 and modules_defines.has_key(module):
|
||||
- test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
- define = 1
|
||||
+ if define == 0 and (module in modules_defines):
|
||||
+ test.write("#ifdef %s\n" % (modules_defines[module]))
|
||||
+ define = 1
|
||||
test.write("""static void desret_%s(%s val ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
|
||||
""" % (name, name))
|
||||
- known_return_types.append(name)
|
||||
+ known_return_types.append(name)
|
||||
if define == 1:
|
||||
test.write("#endif\n\n")
|
||||
|
||||
@@ -615,9 +615,9 @@ for file in headers:
|
||||
# do not test deprecated APIs
|
||||
#
|
||||
desc = file.xpathEval('string(description)')
|
||||
- if string.find(desc, 'DEPRECATED') != -1:
|
||||
- print "Skipping deprecated interface %s" % name
|
||||
- continue;
|
||||
+ if desc.find('DEPRECATED') != -1:
|
||||
+ print("Skipping deprecated interface %s" % name)
|
||||
+ continue;
|
||||
|
||||
test.write("#include <libxml/%s.h>\n" % name)
|
||||
modules.append(name)
|
||||
@@ -679,7 +679,7 @@ def generate_test(module, node):
|
||||
# and store the informations for the generation
|
||||
#
|
||||
try:
|
||||
- args = node.xpathEval("arg")
|
||||
+ args = node.xpathEval("arg")
|
||||
except:
|
||||
args = []
|
||||
t_args = []
|
||||
@@ -687,37 +687,37 @@ def generate_test(module, node):
|
||||
for arg in args:
|
||||
n = n + 1
|
||||
rtype = arg.xpathEval("string(@type)")
|
||||
- if rtype == 'void':
|
||||
- break;
|
||||
- info = arg.xpathEval("string(@info)")
|
||||
- nam = arg.xpathEval("string(@name)")
|
||||
+ if rtype == 'void':
|
||||
+ break;
|
||||
+ info = arg.xpathEval("string(@info)")
|
||||
+ nam = arg.xpathEval("string(@name)")
|
||||
type = type_convert(rtype, nam, info, module, name, n)
|
||||
- if is_known_param_type(type) == 0:
|
||||
- add_missing_type(type, name);
|
||||
- no_gen = 1
|
||||
+ if is_known_param_type(type) == 0:
|
||||
+ add_missing_type(type, name);
|
||||
+ no_gen = 1
|
||||
if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \
|
||||
- rtype[0:6] == 'const ':
|
||||
- crtype = rtype[6:]
|
||||
- else:
|
||||
- crtype = rtype
|
||||
- t_args.append((nam, type, rtype, crtype, info))
|
||||
+ rtype[0:6] == 'const ':
|
||||
+ crtype = rtype[6:]
|
||||
+ else:
|
||||
+ crtype = rtype
|
||||
+ t_args.append((nam, type, rtype, crtype, info))
|
||||
|
||||
try:
|
||||
- rets = node.xpathEval("return")
|
||||
+ rets = node.xpathEval("return")
|
||||
except:
|
||||
rets = []
|
||||
t_ret = None
|
||||
for ret in rets:
|
||||
rtype = ret.xpathEval("string(@type)")
|
||||
- info = ret.xpathEval("string(@info)")
|
||||
+ info = ret.xpathEval("string(@info)")
|
||||
type = type_convert(rtype, 'return', info, module, name, 0)
|
||||
- if rtype == 'void':
|
||||
- break
|
||||
- if is_known_return_type(type) == 0:
|
||||
- add_missing_type(type, name);
|
||||
- no_gen = 1
|
||||
- t_ret = (type, rtype, info)
|
||||
- break
|
||||
+ if rtype == 'void':
|
||||
+ break
|
||||
+ if is_known_return_type(type) == 0:
|
||||
+ add_missing_type(type, name);
|
||||
+ no_gen = 1
|
||||
+ t_ret = (type, rtype, info)
|
||||
+ break
|
||||
|
||||
if no_gen == 0:
|
||||
for t_arg in t_args:
|
||||
@@ -733,7 +733,7 @@ test_%s(void) {
|
||||
|
||||
if no_gen == 1:
|
||||
add_missing_functions(name, module)
|
||||
- test.write("""
|
||||
+ test.write("""
|
||||
/* missing type support */
|
||||
return(test_ret);
|
||||
}
|
||||
@@ -742,22 +742,22 @@ test_%s(void) {
|
||||
return
|
||||
|
||||
try:
|
||||
- conds = node.xpathEval("cond")
|
||||
- for cond in conds:
|
||||
- test.write("#if %s\n" % (cond.get_content()))
|
||||
- nb_cond = nb_cond + 1
|
||||
+ conds = node.xpathEval("cond")
|
||||
+ for cond in conds:
|
||||
+ test.write("#if %s\n" % (cond.get_content()))
|
||||
+ nb_cond = nb_cond + 1
|
||||
except:
|
||||
pass
|
||||
|
||||
define = 0
|
||||
- if function_defines.has_key(name):
|
||||
+ if name in function_defines:
|
||||
test.write("#ifdef %s\n" % (function_defines[name]))
|
||||
- define = 1
|
||||
+ define = 1
|
||||
|
||||
# Declare the memory usage counter
|
||||
no_mem = is_skipped_memcheck(name)
|
||||
if no_mem == 0:
|
||||
- test.write(" int mem_base;\n");
|
||||
+ test.write(" int mem_base;\n");
|
||||
|
||||
# Declare the return value
|
||||
if t_ret != None:
|
||||
@@ -766,29 +766,29 @@ test_%s(void) {
|
||||
# Declare the arguments
|
||||
for arg in t_args:
|
||||
(nam, type, rtype, crtype, info) = arg;
|
||||
- # add declaration
|
||||
- test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
|
||||
- test.write(" int n_%s;\n" % (nam))
|
||||
+ # add declaration
|
||||
+ test.write(" %s %s; /* %s */\n" % (crtype, nam, info))
|
||||
+ test.write(" int n_%s;\n" % (nam))
|
||||
test.write("\n")
|
||||
|
||||
# Cascade loop on of each argument list of values
|
||||
for arg in t_args:
|
||||
(nam, type, rtype, crtype, info) = arg;
|
||||
- #
|
||||
- test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
|
||||
- nam, nam, type, nam))
|
||||
+ #
|
||||
+ test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % (
|
||||
+ nam, nam, type, nam))
|
||||
|
||||
# log the memory usage
|
||||
if no_mem == 0:
|
||||
- test.write(" mem_base = xmlMemBlocks();\n");
|
||||
+ test.write(" mem_base = xmlMemBlocks();\n");
|
||||
|
||||
# prepare the call
|
||||
i = 0;
|
||||
for arg in t_args:
|
||||
(nam, type, rtype, crtype, info) = arg;
|
||||
- #
|
||||
- test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
|
||||
- i = i + 1;
|
||||
+ #
|
||||
+ test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i))
|
||||
+ i = i + 1;
|
||||
|
||||
# add checks to avoid out-of-bounds array access
|
||||
i = 0;
|
||||
@@ -797,7 +797,7 @@ test_%s(void) {
|
||||
# assume that "size", "len", and "start" parameters apply to either
|
||||
# the nearest preceding or following char pointer
|
||||
if type == "int" and (nam == "size" or nam == "len" or nam == "start"):
|
||||
- for j in range(i - 1, -1, -1) + range(i + 1, len(t_args)):
|
||||
+ for j in (*range(i - 1, -1, -1), *range(i + 1, len(t_args))):
|
||||
(bnam, btype) = t_args[j][:2]
|
||||
if btype == "const_char_ptr" or btype == "const_xmlChar_ptr":
|
||||
test.write(
|
||||
@@ -806,42 +806,42 @@ test_%s(void) {
|
||||
" continue;\n"
|
||||
% (bnam, nam, bnam))
|
||||
break
|
||||
- i = i + 1;
|
||||
+ i = i + 1;
|
||||
|
||||
# do the call, and clanup the result
|
||||
- if extra_pre_call.has_key(name):
|
||||
- test.write(" %s\n"% (extra_pre_call[name]))
|
||||
+ if name in extra_pre_call:
|
||||
+ test.write(" %s\n"% (extra_pre_call[name]))
|
||||
if t_ret != None:
|
||||
- test.write("\n ret_val = %s(" % (name))
|
||||
- need = 0
|
||||
- for arg in t_args:
|
||||
- (nam, type, rtype, crtype, info) = arg
|
||||
- if need:
|
||||
- test.write(", ")
|
||||
- else:
|
||||
- need = 1
|
||||
- if rtype != crtype:
|
||||
- test.write("(%s)" % rtype)
|
||||
- test.write("%s" % nam);
|
||||
- test.write(");\n")
|
||||
- if extra_post_call.has_key(name):
|
||||
- test.write(" %s\n"% (extra_post_call[name]))
|
||||
- test.write(" desret_%s(ret_val);\n" % t_ret[0])
|
||||
+ test.write("\n ret_val = %s(" % (name))
|
||||
+ need = 0
|
||||
+ for arg in t_args:
|
||||
+ (nam, type, rtype, crtype, info) = arg
|
||||
+ if need:
|
||||
+ test.write(", ")
|
||||
+ else:
|
||||
+ need = 1
|
||||
+ if rtype != crtype:
|
||||
+ test.write("(%s)" % rtype)
|
||||
+ test.write("%s" % nam);
|
||||
+ test.write(");\n")
|
||||
+ if name in extra_post_call:
|
||||
+ test.write(" %s\n"% (extra_post_call[name]))
|
||||
+ test.write(" desret_%s(ret_val);\n" % t_ret[0])
|
||||
else:
|
||||
- test.write("\n %s(" % (name));
|
||||
- need = 0;
|
||||
- for arg in t_args:
|
||||
- (nam, type, rtype, crtype, info) = arg;
|
||||
- if need:
|
||||
- test.write(", ")
|
||||
- else:
|
||||
- need = 1
|
||||
- if rtype != crtype:
|
||||
- test.write("(%s)" % rtype)
|
||||
- test.write("%s" % nam)
|
||||
- test.write(");\n")
|
||||
- if extra_post_call.has_key(name):
|
||||
- test.write(" %s\n"% (extra_post_call[name]))
|
||||
+ test.write("\n %s(" % (name));
|
||||
+ need = 0;
|
||||
+ for arg in t_args:
|
||||
+ (nam, type, rtype, crtype, info) = arg;
|
||||
+ if need:
|
||||
+ test.write(", ")
|
||||
+ else:
|
||||
+ need = 1
|
||||
+ if rtype != crtype:
|
||||
+ test.write("(%s)" % rtype)
|
||||
+ test.write("%s" % nam)
|
||||
+ test.write(");\n")
|
||||
+ if name in extra_post_call:
|
||||
+ test.write(" %s\n"% (extra_post_call[name]))
|
||||
|
||||
test.write(" call_tests++;\n");
|
||||
|
||||
@@ -849,32 +849,32 @@ test_%s(void) {
|
||||
i = 0;
|
||||
for arg in t_args:
|
||||
(nam, type, rtype, crtype, info) = arg;
|
||||
- # This is a hack to prevent generating a destructor for the
|
||||
- # 'input' argument in xmlTextReaderSetup. There should be
|
||||
- # a better, more generic way to do this!
|
||||
- if string.find(info, 'destroy') == -1:
|
||||
- test.write(" des_%s(n_%s, " % (type, nam))
|
||||
- if rtype != crtype:
|
||||
- test.write("(%s)" % rtype)
|
||||
- test.write("%s, %d);\n" % (nam, i))
|
||||
- i = i + 1;
|
||||
+ # This is a hack to prevent generating a destructor for the
|
||||
+ # 'input' argument in xmlTextReaderSetup. There should be
|
||||
+ # a better, more generic way to do this!
|
||||
+ if info.find('destroy') == -1:
|
||||
+ test.write(" des_%s(n_%s, " % (type, nam))
|
||||
+ if rtype != crtype:
|
||||
+ test.write("(%s)" % rtype)
|
||||
+ test.write("%s, %d);\n" % (nam, i))
|
||||
+ i = i + 1;
|
||||
|
||||
test.write(" xmlResetLastError();\n");
|
||||
# Check the memory usage
|
||||
if no_mem == 0:
|
||||
- test.write(""" if (mem_base != xmlMemBlocks()) {
|
||||
+ test.write(""" if (mem_base != xmlMemBlocks()) {
|
||||
printf("Leak of %%d blocks found in %s",
|
||||
- xmlMemBlocks() - mem_base);
|
||||
- test_ret++;
|
||||
+\t xmlMemBlocks() - mem_base);
|
||||
+\t test_ret++;
|
||||
""" % (name));
|
||||
- for arg in t_args:
|
||||
- (nam, type, rtype, crtype, info) = arg;
|
||||
- test.write(""" printf(" %%d", n_%s);\n""" % (nam))
|
||||
- test.write(""" printf("\\n");\n""")
|
||||
- test.write(" }\n")
|
||||
+ for arg in t_args:
|
||||
+ (nam, type, rtype, crtype, info) = arg;
|
||||
+ test.write(""" printf(" %%d", n_%s);\n""" % (nam))
|
||||
+ test.write(""" printf("\\n");\n""")
|
||||
+ test.write(" }\n")
|
||||
|
||||
for arg in t_args:
|
||||
- test.write(" }\n")
|
||||
+ test.write(" }\n")
|
||||
|
||||
test.write(" function_tests++;\n")
|
||||
#
|
||||
@@ -882,7 +882,7 @@ test_%s(void) {
|
||||
#
|
||||
while nb_cond > 0:
|
||||
test.write("#endif\n")
|
||||
- nb_cond = nb_cond -1
|
||||
+ nb_cond = nb_cond -1
|
||||
if define == 1:
|
||||
test.write("#endif\n")
|
||||
|
||||
@@ -900,10 +900,10 @@ test_%s(void) {
|
||||
for module in modules:
|
||||
# gather all the functions exported by that module
|
||||
try:
|
||||
- functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
|
||||
+ functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module))
|
||||
except:
|
||||
- print "Failed to gather functions from module %s" % (module)
|
||||
- continue;
|
||||
+ print("Failed to gather functions from module %s" % (module))
|
||||
+ continue;
|
||||
|
||||
# iterate over all functions in the module generating the test
|
||||
i = 0
|
||||
@@ -923,14 +923,14 @@ test_%s(void) {
|
||||
# iterate over all functions in the module generating the call
|
||||
for function in functions:
|
||||
name = function.xpathEval('string(@name)')
|
||||
- if is_skipped_function(name):
|
||||
- continue
|
||||
- test.write(" test_ret += test_%s();\n" % (name))
|
||||
+ if is_skipped_function(name):
|
||||
+ continue
|
||||
+ test.write(" test_ret += test_%s();\n" % (name))
|
||||
|
||||
# footer
|
||||
test.write("""
|
||||
if (test_ret != 0)
|
||||
- printf("Module %s: %%d errors\\n", test_ret);
|
||||
+\tprintf("Module %s: %%d errors\\n", test_ret);
|
||||
return(test_ret);
|
||||
}
|
||||
""" % (module))
|
||||
@@ -948,7 +948,7 @@ test.write(""" return(0);
|
||||
}
|
||||
""");
|
||||
|
||||
-print "Generated test for %d modules and %d functions" %(len(modules), nb_tests)
|
||||
+print("Generated test for %d modules and %d functions" %(len(modules), nb_tests))
|
||||
|
||||
compare_and_save()
|
||||
|
||||
@@ -960,11 +960,8 @@ for missing in missing_types.keys():
|
||||
n = len(missing_types[missing])
|
||||
missing_list.append((n, missing))
|
||||
|
||||
-def compare_missing(a, b):
|
||||
- return b[0] - a[0]
|
||||
-
|
||||
-missing_list.sort(compare_missing)
|
||||
-print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list))
|
||||
+missing_list.sort(key=lambda a: a[0])
|
||||
+print("Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)))
|
||||
lst = open("missing.lst", "w")
|
||||
lst.write("Missing support for %d types" % (len(missing_list)))
|
||||
lst.write("\n")
|
||||
@@ -974,9 +971,9 @@ for miss in missing_list:
|
||||
for n in missing_types[miss[1]]:
|
||||
i = i + 1
|
||||
if i > 5:
|
||||
- lst.write(" ...")
|
||||
- break
|
||||
- lst.write(" %s" % (n))
|
||||
+ lst.write(" ...")
|
||||
+ break
|
||||
+ lst.write(" %s" % (n))
|
||||
lst.write("\n")
|
||||
lst.write("\n")
|
||||
lst.write("\n")
|
||||
89
meta/recipes-core/libxml/libxml2/CVE-2016-3709.patch
Normal file
89
meta/recipes-core/libxml/libxml2/CVE-2016-3709.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From c1ba6f54d32b707ca6d91cb3257ce9de82876b6f Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Sat, 15 Aug 2020 18:32:29 +0200
|
||||
Subject: [PATCH] Revert "Do not URI escape in server side includes"
|
||||
|
||||
This reverts commit 960f0e275616cadc29671a218d7fb9b69eb35588.
|
||||
|
||||
This commit introduced
|
||||
|
||||
- an infinite loop, found by OSS-Fuzz, which could be easily fixed.
|
||||
- an algorithm with quadratic runtime
|
||||
- a security issue, see
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=769760
|
||||
|
||||
A better approach is to add an option not to escape URLs at all
|
||||
which libxml2 should have possibly done in the first place.
|
||||
|
||||
CVE: CVE-2016-3709
|
||||
Upstream-Status: Backport [https://github.com/GNOME/libxml2/commit/c1ba6f54d32b707ca6d91cb3257ce9de82876b6f]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
---
|
||||
HTMLtree.c | 49 +++++++++++--------------------------------------
|
||||
1 file changed, 11 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/HTMLtree.c b/HTMLtree.c
|
||||
index 8d236bb35..cdb7f86a6 100644
|
||||
--- a/HTMLtree.c
|
||||
+++ b/HTMLtree.c
|
||||
@@ -706,49 +706,22 @@ htmlAttrDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur,
|
||||
(!xmlStrcasecmp(cur->name, BAD_CAST "src")) ||
|
||||
((!xmlStrcasecmp(cur->name, BAD_CAST "name")) &&
|
||||
(!xmlStrcasecmp(cur->parent->name, BAD_CAST "a"))))) {
|
||||
+ xmlChar *escaped;
|
||||
xmlChar *tmp = value;
|
||||
- /* xmlURIEscapeStr() escapes '"' so it can be safely used. */
|
||||
- xmlBufCCat(buf->buffer, "\"");
|
||||
|
||||
while (IS_BLANK_CH(*tmp)) tmp++;
|
||||
|
||||
- /* URI Escape everything, except server side includes. */
|
||||
- for ( ; ; ) {
|
||||
- xmlChar *escaped;
|
||||
- xmlChar endChar;
|
||||
- xmlChar *end = NULL;
|
||||
- xmlChar *start = (xmlChar *)xmlStrstr(tmp, BAD_CAST "<!--");
|
||||
- if (start != NULL) {
|
||||
- end = (xmlChar *)xmlStrstr(tmp, BAD_CAST "-->");
|
||||
- if (end != NULL) {
|
||||
- *start = '\0';
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /* Escape the whole string, or until start (set to '\0'). */
|
||||
- escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+");
|
||||
- if (escaped != NULL) {
|
||||
- xmlBufCat(buf->buffer, escaped);
|
||||
- xmlFree(escaped);
|
||||
- } else {
|
||||
- xmlBufCat(buf->buffer, tmp);
|
||||
- }
|
||||
-
|
||||
- if (end == NULL) { /* Everything has been written. */
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- /* Do not escape anything within server side includes. */
|
||||
- *start = '<'; /* Restore the first character of "<!--". */
|
||||
- end += 3; /* strlen("-->") */
|
||||
- endChar = *end;
|
||||
- *end = '\0';
|
||||
- xmlBufCat(buf->buffer, start);
|
||||
- *end = endChar;
|
||||
- tmp = end;
|
||||
+ /*
|
||||
+ * the < and > have already been escaped at the entity level
|
||||
+ * And doing so here breaks server side includes
|
||||
+ */
|
||||
+ escaped = xmlURIEscapeStr(tmp, BAD_CAST"@/:=?;#%&,+<>");
|
||||
+ if (escaped != NULL) {
|
||||
+ xmlBufWriteQuotedString(buf->buffer, escaped);
|
||||
+ xmlFree(escaped);
|
||||
+ } else {
|
||||
+ xmlBufWriteQuotedString(buf->buffer, value);
|
||||
}
|
||||
-
|
||||
- xmlBufCCat(buf->buffer, "\"");
|
||||
} else {
|
||||
xmlBufWriteQuotedString(buf->buffer, value);
|
||||
}
|
||||
@@ -32,6 +32,8 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=te
|
||||
file://CVE-2022-23308-fix-regression.patch \
|
||||
file://CVE-2022-29824-dependent.patch \
|
||||
file://CVE-2022-29824.patch \
|
||||
file://0001-Port-gentest.py-to-Python-3.patch \
|
||||
file://CVE-2016-3709.patch \
|
||||
"
|
||||
|
||||
SRC_URI[archive.sha256sum] = "593b7b751dd18c2d6abcd0c4bcb29efc203d0b4373a6df98e3a455ea74ae2813"
|
||||
@@ -89,6 +91,16 @@ do_configure_prepend () {
|
||||
}
|
||||
|
||||
do_compile_ptest() {
|
||||
# Make sure that testapi.c is newer than gentests.py, because
|
||||
# with reproducible builds, they will both get e.g. Jan 1 1970
|
||||
# modification time from SOURCE_DATE_EPOCH and then check-am
|
||||
# might try to rebuild_testapi, which will fail even with
|
||||
# 0001-Port-gentest.py-to-Python-3.patch, because it needs
|
||||
# libxml2 module (libxml2-native dependency and correctly
|
||||
# set PYTHON_SITE_PACKAGES), it's easier to
|
||||
# just rely on pre-generated testapi.c from the release
|
||||
touch ${S}/testapi.c
|
||||
|
||||
oe_runmake check-am
|
||||
}
|
||||
|
||||
|
||||
@@ -65,9 +65,7 @@ python do_fetch() {
|
||||
|
||||
# Connect to database
|
||||
conn = sqlite3.connect(db_file)
|
||||
c = conn.cursor()
|
||||
|
||||
initialize_db(c)
|
||||
initialize_db(conn)
|
||||
|
||||
with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
|
||||
total_years = date.today().year + 1 - YEAR_START
|
||||
@@ -96,18 +94,20 @@ python do_fetch() {
|
||||
return
|
||||
|
||||
# Compare with current db last modified date
|
||||
c.execute("select DATE from META where YEAR = ?", (year,))
|
||||
meta = c.fetchone()
|
||||
cursor = conn.execute("select DATE from META where YEAR = ?", (year,))
|
||||
meta = cursor.fetchone()
|
||||
cursor.close()
|
||||
|
||||
if not meta or meta[0] != last_modified:
|
||||
# Clear products table entries corresponding to current year
|
||||
c.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,))
|
||||
conn.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)).close()
|
||||
|
||||
# Update db with current year json file
|
||||
try:
|
||||
response = urllib.request.urlopen(json_url)
|
||||
if response:
|
||||
update_db(c, gzip.decompress(response.read()).decode('utf-8'))
|
||||
c.execute("insert or replace into META values (?, ?)", [year, last_modified])
|
||||
update_db(conn, gzip.decompress(response.read()).decode('utf-8'))
|
||||
conn.execute("insert or replace into META values (?, ?)", [year, last_modified]).close()
|
||||
except urllib.error.URLError as e:
|
||||
cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
|
||||
bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
|
||||
@@ -125,21 +125,26 @@ do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
|
||||
do_fetch[file-checksums] = ""
|
||||
do_fetch[vardeps] = ""
|
||||
|
||||
def initialize_db(c):
|
||||
c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
|
||||
def initialize_db(conn):
|
||||
with conn:
|
||||
c = conn.cursor()
|
||||
|
||||
c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
|
||||
SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
|
||||
c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
|
||||
|
||||
c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
|
||||
VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
|
||||
VERSION_END TEXT, OPERATOR_END TEXT)")
|
||||
c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);")
|
||||
c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
|
||||
SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
|
||||
|
||||
def parse_node_and_insert(c, node, cveId):
|
||||
c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
|
||||
VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
|
||||
VERSION_END TEXT, OPERATOR_END TEXT)")
|
||||
c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);")
|
||||
|
||||
c.close()
|
||||
|
||||
def parse_node_and_insert(conn, node, cveId):
|
||||
# Parse children node if needed
|
||||
for child in node.get('children', ()):
|
||||
parse_node_and_insert(c, child, cveId)
|
||||
parse_node_and_insert(conn, child, cveId)
|
||||
|
||||
def cpe_generator():
|
||||
for cpe in node.get('cpe_match', ()):
|
||||
@@ -196,9 +201,9 @@ def parse_node_and_insert(c, node, cveId):
|
||||
# Save processing by representing as -.
|
||||
yield [cveId, vendor, product, '-', '', '', '']
|
||||
|
||||
c.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator())
|
||||
conn.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator()).close()
|
||||
|
||||
def update_db(c, jsondata):
|
||||
def update_db(conn, jsondata):
|
||||
import json
|
||||
root = json.loads(jsondata)
|
||||
|
||||
@@ -222,12 +227,12 @@ def update_db(c, jsondata):
|
||||
accessVector = accessVector or "UNKNOWN"
|
||||
cvssv3 = 0.0
|
||||
|
||||
c.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
|
||||
[cveId, cveDesc, cvssv2, cvssv3, date, accessVector])
|
||||
conn.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
|
||||
[cveId, cveDesc, cvssv2, cvssv3, date, accessVector]).close()
|
||||
|
||||
configurations = elt['configurations']['nodes']
|
||||
for config in configurations:
|
||||
parse_node_and_insert(c, config, cveId)
|
||||
parse_node_and_insert(conn, config, cveId)
|
||||
|
||||
|
||||
do_fetch[nostamp] = "1"
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
# inside /var/log.
|
||||
|
||||
|
||||
d /run/lock 1777 - - -
|
||||
d /var/volatile/log - - - -
|
||||
d /var/volatile/tmp 1777 - -
|
||||
|
||||
@@ -162,6 +162,7 @@ PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native do
|
||||
PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
|
||||
PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
|
||||
PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
|
||||
PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers="
|
||||
PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false"
|
||||
PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
|
||||
PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
|
||||
|
||||
44
meta/recipes-core/zlib/zlib/CVE-2022-37434.patch
Normal file
44
meta/recipes-core/zlib/zlib/CVE-2022-37434.patch
Normal file
@@ -0,0 +1,44 @@
|
||||
From 8617d83d6939754ae3a04fc2d22daa18eeea2a43 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 17 Aug 2022 10:15:57 +0530
|
||||
Subject: [PATCH] CVE-2022-37434
|
||||
|
||||
Upstream-Status: Backport [https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1 & https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d]
|
||||
CVE: CVE-2022-37434
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
Fix a bug when getting a gzip header extra field with inflate().
|
||||
|
||||
If the extra field was larger than the space the user provided with
|
||||
inflateGetHeader(), and if multiple calls of inflate() delivered
|
||||
the extra header data, then there could be a buffer overflow of the
|
||||
provided space. This commit assures that provided space is not
|
||||
exceeded.
|
||||
|
||||
Fix extra field processing bug that dereferences NULL state->head.
|
||||
|
||||
The recent commit to fix a gzip header extra field processing bug
|
||||
introduced the new bug fixed here.
|
||||
---
|
||||
inflate.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index ac333e8..cd01857 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -759,8 +759,9 @@ int flush;
|
||||
if (copy > have) copy = have;
|
||||
if (copy) {
|
||||
if (state->head != Z_NULL &&
|
||||
- state->head->extra != Z_NULL) {
|
||||
- len = state->head->extra_len - state->length;
|
||||
+ state->head->extra != Z_NULL &&
|
||||
+ (len = state->head->extra_len - state->length) <
|
||||
+ state->head->extra_max) {
|
||||
zmemcpy(state->head->extra + len, next,
|
||||
len + copy > state->head->extra_max ?
|
||||
state->head->extra_max - len : copy);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -10,6 +10,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/libpng/${BPN}/${PV}/${BPN}-${PV}.tar.xz \
|
||||
file://ldflags-tests.patch \
|
||||
file://CVE-2018-25032.patch \
|
||||
file://run-ptest \
|
||||
file://CVE-2022-37434.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_URI = "http://zlib.net/"
|
||||
|
||||
|
||||
@@ -52,5 +52,6 @@ SRC_URI = "\
|
||||
file://CVE-2021-3549.patch \
|
||||
file://CVE-2020-16593.patch \
|
||||
file://0001-CVE-2021-45078.patch \
|
||||
file://CVE-2022-38533.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
37
meta/recipes-devtools/binutils/binutils/CVE-2022-38533.patch
Normal file
37
meta/recipes-devtools/binutils/binutils/CVE-2022-38533.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From ef186fe54aa6d281a3ff8a9528417e5cc614c797 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Sat, 13 Aug 2022 15:32:47 +0930
|
||||
Subject: [PATCH] PR29482 - strip: heap-buffer-overflow
|
||||
|
||||
PR 29482
|
||||
* coffcode.h (coff_set_section_contents): Sanity check _LIB.
|
||||
|
||||
CVE: CVE-2022-38533
|
||||
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ef186fe54aa6d281a3ff8a9528417e5cc614c797]
|
||||
|
||||
Signed-off-by: Florin Diaconescu <florin.diaconescu009@gmail.com>
|
||||
|
||||
---
|
||||
bfd/coffcode.h | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
|
||||
index dec2e9c6370..75c18d88602 100644
|
||||
--- a/bfd/coffcode.h
|
||||
+++ b/bfd/coffcode.h
|
||||
@@ -4170,10 +4170,13 @@ coff_set_section_contents (bfd * abfd,
|
||||
|
||||
rec = (bfd_byte *) location;
|
||||
recend = rec + count;
|
||||
- while (rec < recend)
|
||||
+ while (recend - rec >= 4)
|
||||
{
|
||||
+ size_t len = bfd_get_32 (abfd, rec);
|
||||
+ if (len == 0 || len > (size_t) (recend - rec) / 4)
|
||||
+ break;
|
||||
+ rec += len * 4;
|
||||
++section->lma;
|
||||
- rec += bfd_get_32 (abfd, rec) * 4;
|
||||
}
|
||||
|
||||
BFD_ASSERT (rec == recend);
|
||||
@@ -25,6 +25,22 @@ SRC_URI += "\
|
||||
file://CVE-2021-44717.patch \
|
||||
file://CVE-2022-24675.patch \
|
||||
file://CVE-2021-31525.patch \
|
||||
file://CVE-2022-30629.patch \
|
||||
file://CVE-2022-30631.patch \
|
||||
file://CVE-2022-30632.patch \
|
||||
file://CVE-2022-30633.patch \
|
||||
file://CVE-2022-30635.patch \
|
||||
file://CVE-2022-32148.patch \
|
||||
file://CVE-2022-32189.patch \
|
||||
file://CVE-2021-27918.patch \
|
||||
file://CVE-2021-36221.patch \
|
||||
file://CVE-2021-39293.patch \
|
||||
file://CVE-2021-41771.patch \
|
||||
file://CVE-2022-27664.patch \
|
||||
file://0001-CVE-2022-32190.patch \
|
||||
file://0002-CVE-2022-32190.patch \
|
||||
file://0003-CVE-2022-32190.patch \
|
||||
file://0004-CVE-2022-32190.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
@@ -35,3 +51,9 @@ SRC_URI[main.sha256sum] = "7ed13b2209e54a451835997f78035530b331c5b6943cdcd68a3d8
|
||||
# https://github.com/golang/go/issues/30999#issuecomment-910470358
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-29923"
|
||||
|
||||
# this issue affected go1.15 onwards
|
||||
# https://security-tracker.debian.org/tracker/CVE-2022-29526
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-29526"
|
||||
|
||||
# Issue only on windows
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-30634"
|
||||
|
||||
74
meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch
Normal file
74
meta/recipes-devtools/go/go-1.14/0001-CVE-2022-32190.patch
Normal file
@@ -0,0 +1,74 @@
|
||||
From 755f2dc35a19e6806de3ecbf836fa06ad875c67a Mon Sep 17 00:00:00 2001
|
||||
From: Carl Johnson <me@carlmjohnson.net>
|
||||
Date: Fri, 4 Mar 2022 14:49:52 +0000
|
||||
Subject: [PATCH 1/4] net/url: add JoinPath, URL.JoinPath
|
||||
|
||||
Builds on CL 332209.
|
||||
|
||||
Fixes #47005
|
||||
|
||||
Change-Id: I82708dede05d79a196ca63f5a4e7cb5ac9a041ea
|
||||
GitHub-Last-Rev: 51b735066eef74f5e67c3e8899c58f44c0383c61
|
||||
GitHub-Pull-Request: golang/go#50383
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/374654
|
||||
Reviewed-by: Russ Cox <rsc@golang.org>
|
||||
Auto-Submit: Russ Cox <rsc@golang.org>
|
||||
Trust: Ian Lance Taylor <iant@golang.org>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Run-TryBot: Ian Lance Taylor <iant@golang.org>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/604140d93111f89911e17cb147dcf6a02d2700d0]
|
||||
CVE: CVE-2022-32190
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/net/url/url.go | 23 +++++++++++++++++++++++
|
||||
1 file changed, 23 insertions(+)
|
||||
|
||||
diff --git a/src/net/url/url.go b/src/net/url/url.go
|
||||
index 2880e82..dea8bfe 100644
|
||||
--- a/src/net/url/url.go
|
||||
+++ b/src/net/url/url.go
|
||||
@@ -13,6 +13,7 @@ package url
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
+ "path"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -1104,6 +1105,17 @@ func (u *URL) UnmarshalBinary(text []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
+// JoinPath returns a new URL with the provided path elements joined to
|
||||
+// any existing path and the resulting path cleaned of any ./ or ../ elements.
|
||||
+func (u *URL) JoinPath(elem ...string) *URL {
|
||||
+ url := *u
|
||||
+ if len(elem) > 0 {
|
||||
+ elem = append([]string{u.Path}, elem...)
|
||||
+ url.setPath(path.Join(elem...))
|
||||
+ }
|
||||
+ return &url
|
||||
+}
|
||||
+
|
||||
// validUserinfo reports whether s is a valid userinfo string per RFC 3986
|
||||
// Section 3.2.1:
|
||||
// userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
|
||||
@@ -1144,3 +1156,14 @@ func stringContainsCTLByte(s string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
+
|
||||
+// JoinPath returns a URL string with the provided path elements joined to
|
||||
+// the existing path of base and the resulting path cleaned of any ./ or ../ elements.
|
||||
+func JoinPath(base string, elem ...string) (result string, err error) {
|
||||
+ url, err := Parse(base)
|
||||
+ if err != nil {
|
||||
+ return
|
||||
+ }
|
||||
+ result = url.JoinPath(elem...).String()
|
||||
+ return
|
||||
+}
|
||||
--
|
||||
2.7.4
|
||||
48
meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch
Normal file
48
meta/recipes-devtools/go/go-1.14/0002-CVE-2022-32190.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 985108de87e7d2ecb2b28cb53b323d530387b884 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Thu, 31 Mar 2022 13:21:39 -0700
|
||||
Subject: [PATCH 2/4] net/url: preserve a trailing slash in JoinPath
|
||||
|
||||
Fixes #52074
|
||||
|
||||
Change-Id: I30897f32e70a6ca0c4e11aaf07088c27336efaba
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/397256
|
||||
Trust: Ian Lance Taylor <iant@golang.org>
|
||||
Run-TryBot: Ian Lance Taylor <iant@golang.org>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Matt Layher <mdlayher@gmail.com>
|
||||
Trust: Matt Layher <mdlayher@gmail.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/dbb52cc9f3e83a3040f46c2ae7650c15ab342179]
|
||||
CVE: CVE-2022-32190
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/net/url/url.go | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/net/url/url.go b/src/net/url/url.go
|
||||
index dea8bfe..3436707 100644
|
||||
--- a/src/net/url/url.go
|
||||
+++ b/src/net/url/url.go
|
||||
@@ -1107,11 +1107,18 @@ func (u *URL) UnmarshalBinary(text []byte) error {
|
||||
|
||||
// JoinPath returns a new URL with the provided path elements joined to
|
||||
// any existing path and the resulting path cleaned of any ./ or ../ elements.
|
||||
+// Any sequences of multiple / characters will be reduced to a single /.
|
||||
func (u *URL) JoinPath(elem ...string) *URL {
|
||||
url := *u
|
||||
if len(elem) > 0 {
|
||||
elem = append([]string{u.Path}, elem...)
|
||||
- url.setPath(path.Join(elem...))
|
||||
+ p := path.Join(elem...)
|
||||
+ // path.Join will remove any trailing slashes.
|
||||
+ // Preserve at least one.
|
||||
+ if strings.HasSuffix(elem[len(elem)-1], "/") && !strings.HasSuffix(p, "/") {
|
||||
+ p += "/"
|
||||
+ }
|
||||
+ url.setPath(p)
|
||||
}
|
||||
return &url
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
36
meta/recipes-devtools/go/go-1.14/0003-CVE-2022-32190.patch
Normal file
36
meta/recipes-devtools/go/go-1.14/0003-CVE-2022-32190.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 2c632b883b0f11084cc247c8b50ad6c71fa7b447 Mon Sep 17 00:00:00 2001
|
||||
From: Sean Liao <sean@liao.dev>
|
||||
Date: Sat, 9 Jul 2022 18:38:45 +0100
|
||||
Subject: [PATCH 3/4] net/url: use EscapedPath for url.JoinPath
|
||||
|
||||
Fixes #53763
|
||||
|
||||
Change-Id: I08b53f159ebdce7907e8cc17316fd0c982363239
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/416774
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Bryan Mills <bcmills@google.com>
|
||||
Run-TryBot: Ian Lance Taylor <iant@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/bf5898ef53d1693aa572da0da746c05e9a6f15c5]
|
||||
CVE: CVE-2022-32190
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/net/url/url.go | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/net/url/url.go b/src/net/url/url.go
|
||||
index 3436707..73079a5 100644
|
||||
--- a/src/net/url/url.go
|
||||
+++ b/src/net/url/url.go
|
||||
@@ -1111,7 +1111,7 @@ func (u *URL) UnmarshalBinary(text []byte) error {
|
||||
func (u *URL) JoinPath(elem ...string) *URL {
|
||||
url := *u
|
||||
if len(elem) > 0 {
|
||||
- elem = append([]string{u.Path}, elem...)
|
||||
+ elem = append([]string{u.EscapedPath()}, elem...)
|
||||
p := path.Join(elem...)
|
||||
// path.Join will remove any trailing slashes.
|
||||
// Preserve at least one.
|
||||
--
|
||||
2.7.4
|
||||
82
meta/recipes-devtools/go/go-1.14/0004-CVE-2022-32190.patch
Normal file
82
meta/recipes-devtools/go/go-1.14/0004-CVE-2022-32190.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
From f61e428699cbb52bab31fe2c124f49d085a209fe Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Fri, 12 Aug 2022 16:21:09 -0700
|
||||
Subject: [PATCH 4/4] net/url: consistently remove ../ elements in JoinPath
|
||||
|
||||
JoinPath would fail to remove relative elements from the start of
|
||||
the path when the first path element is "".
|
||||
|
||||
In addition, JoinPath would return the original path unmodified
|
||||
when provided with no elements to join, violating the documented
|
||||
behavior of always cleaning the resulting path.
|
||||
|
||||
Correct both these cases.
|
||||
|
||||
JoinPath("http://go.dev", "../go")
|
||||
// before: http://go.dev/../go
|
||||
// after: http://go.dev/go
|
||||
|
||||
JoinPath("http://go.dev/../go")
|
||||
// before: http://go.dev/../go
|
||||
// after: http://go.dev/go
|
||||
|
||||
For #54385.
|
||||
Fixes #54635.
|
||||
Fixes CVE-2022-32190.
|
||||
|
||||
Change-Id: I6d22cd160d097c50703dd96e4f453c6c118fd5d9
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/423514
|
||||
Reviewed-by: David Chase <drchase@google.com>
|
||||
Reviewed-by: Alan Donovan <adonovan@google.com>
|
||||
(cherry picked from commit 0765da5884adcc8b744979303a36a27092d8fc51)
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/425357
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/28335508913a46e05ef0c04a18e8a1a6beb775ec]
|
||||
CVE: CVE-2022-32190
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/net/url/url.go | 26 ++++++++++++++++----------
|
||||
1 file changed, 16 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/net/url/url.go b/src/net/url/url.go
|
||||
index 73079a5..1e8baf9 100644
|
||||
--- a/src/net/url/url.go
|
||||
+++ b/src/net/url/url.go
|
||||
@@ -1109,17 +1109,23 @@ func (u *URL) UnmarshalBinary(text []byte) error {
|
||||
// any existing path and the resulting path cleaned of any ./ or ../ elements.
|
||||
// Any sequences of multiple / characters will be reduced to a single /.
|
||||
func (u *URL) JoinPath(elem ...string) *URL {
|
||||
- url := *u
|
||||
- if len(elem) > 0 {
|
||||
- elem = append([]string{u.EscapedPath()}, elem...)
|
||||
- p := path.Join(elem...)
|
||||
- // path.Join will remove any trailing slashes.
|
||||
- // Preserve at least one.
|
||||
- if strings.HasSuffix(elem[len(elem)-1], "/") && !strings.HasSuffix(p, "/") {
|
||||
- p += "/"
|
||||
- }
|
||||
- url.setPath(p)
|
||||
+ elem = append([]string{u.EscapedPath()}, elem...)
|
||||
+ var p string
|
||||
+ if !strings.HasPrefix(elem[0], "/") {
|
||||
+ // Return a relative path if u is relative,
|
||||
+ // but ensure that it contains no ../ elements.
|
||||
+ elem[0] = "/" + elem[0]
|
||||
+ p = path.Join(elem...)[1:]
|
||||
+ } else {
|
||||
+ p = path.Join(elem...)
|
||||
}
|
||||
+ // path.Join will remove any trailing slashes.
|
||||
+ // Preserve at least one.
|
||||
+ if strings.HasSuffix(elem[len(elem)-1], "/") && !strings.HasSuffix(p, "/") {
|
||||
+ p += "/"
|
||||
+ }
|
||||
+ url := *u
|
||||
+ url.setPath(p)
|
||||
return &url
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
191
meta/recipes-devtools/go/go-1.14/CVE-2021-27918.patch
Normal file
191
meta/recipes-devtools/go/go-1.14/CVE-2021-27918.patch
Normal file
@@ -0,0 +1,191 @@
|
||||
From d0b79e3513a29628f3599dc8860666b6eed75372 Mon Sep 17 00:00:00 2001
|
||||
From: Katie Hockman <katie@golang.org>
|
||||
Date: Mon, 1 Mar 2021 09:54:00 -0500
|
||||
Subject: [PATCH] encoding/xml: prevent infinite loop while decoding
|
||||
|
||||
This change properly handles a TokenReader which
|
||||
returns an EOF in the middle of an open XML
|
||||
element.
|
||||
|
||||
Thanks to Sam Whited for reporting this.
|
||||
|
||||
Fixes CVE-2021-27918
|
||||
Fixes #44913
|
||||
|
||||
Change-Id: Id02a3f3def4a1b415fa2d9a8e3b373eb6cb0f433
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1004594
|
||||
Reviewed-by: Russ Cox <rsc@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Filippo Valsorda <valsorda@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/300391
|
||||
Trust: Katie Hockman <katie@golang.org>
|
||||
Run-TryBot: Katie Hockman <katie@golang.org>
|
||||
TryBot-Result: Go Bot <gobot@golang.org>
|
||||
Reviewed-by: Alexander Rakoczy <alex@golang.org>
|
||||
Reviewed-by: Filippo Valsorda <filippo@golang.org>
|
||||
|
||||
https://github.com/golang/go/commit/d0b79e3513a29628f3599dc8860666b6eed75372
|
||||
CVE: CVE-2021-27918
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
src/encoding/xml/xml.go | 19 ++++---
|
||||
src/encoding/xml/xml_test.go | 104 +++++++++++++++++++++++++++--------
|
||||
2 files changed, 92 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/encoding/xml/xml.go b/src/encoding/xml/xml.go
|
||||
index adaf4daf198b9..6f9594d7ba7a3 100644
|
||||
--- a/src/encoding/xml/xml.go
|
||||
+++ b/src/encoding/xml/xml.go
|
||||
@@ -271,7 +271,7 @@ func NewTokenDecoder(t TokenReader) *Decoder {
|
||||
// it will return an error.
|
||||
//
|
||||
// Token implements XML name spaces as described by
|
||||
-// https://www.w3.org/TR/REC-xml-names/. Each of the
|
||||
+// https://www.w3.org/TR/REC-xml-names/. Each of the
|
||||
// Name structures contained in the Token has the Space
|
||||
// set to the URL identifying its name space when known.
|
||||
// If Token encounters an unrecognized name space prefix,
|
||||
@@ -285,16 +285,17 @@ func (d *Decoder) Token() (Token, error) {
|
||||
if d.nextToken != nil {
|
||||
t = d.nextToken
|
||||
d.nextToken = nil
|
||||
- } else if t, err = d.rawToken(); err != nil {
|
||||
- switch {
|
||||
- case err == io.EOF && d.t != nil:
|
||||
- err = nil
|
||||
- case err == io.EOF && d.stk != nil && d.stk.kind != stkEOF:
|
||||
- err = d.syntaxError("unexpected EOF")
|
||||
+ } else {
|
||||
+ if t, err = d.rawToken(); t == nil && err != nil {
|
||||
+ if err == io.EOF && d.stk != nil && d.stk.kind != stkEOF {
|
||||
+ err = d.syntaxError("unexpected EOF")
|
||||
+ }
|
||||
+ return nil, err
|
||||
}
|
||||
- return t, err
|
||||
+ // We still have a token to process, so clear any
|
||||
+ // errors (e.g. EOF) and proceed.
|
||||
+ err = nil
|
||||
}
|
||||
-
|
||||
if !d.Strict {
|
||||
if t1, ok := d.autoClose(t); ok {
|
||||
d.nextToken = t
|
||||
diff --git a/src/encoding/xml/xml_test.go b/src/encoding/xml/xml_test.go
|
||||
index efddca43e9102..5672ebb375f0d 100644
|
||||
--- a/src/encoding/xml/xml_test.go
|
||||
+++ b/src/encoding/xml/xml_test.go
|
||||
@@ -33,30 +33,90 @@ func (t *toks) Token() (Token, error) {
|
||||
|
||||
func TestDecodeEOF(t *testing.T) {
|
||||
start := StartElement{Name: Name{Local: "test"}}
|
||||
- t.Run("EarlyEOF", func(t *testing.T) {
|
||||
- d := NewTokenDecoder(&toks{earlyEOF: true, t: []Token{
|
||||
- start,
|
||||
- start.End(),
|
||||
- }})
|
||||
- err := d.Decode(&struct {
|
||||
- XMLName Name `xml:"test"`
|
||||
- }{})
|
||||
- if err != nil {
|
||||
- t.Error(err)
|
||||
+ tests := []struct {
|
||||
+ name string
|
||||
+ tokens []Token
|
||||
+ ok bool
|
||||
+ }{
|
||||
+ {
|
||||
+ name: "OK",
|
||||
+ tokens: []Token{
|
||||
+ start,
|
||||
+ start.End(),
|
||||
+ },
|
||||
+ ok: true,
|
||||
+ },
|
||||
+ {
|
||||
+ name: "Malformed",
|
||||
+ tokens: []Token{
|
||||
+ start,
|
||||
+ StartElement{Name: Name{Local: "bad"}},
|
||||
+ start.End(),
|
||||
+ },
|
||||
+ ok: false,
|
||||
+ },
|
||||
+ }
|
||||
+ for _, tc := range tests {
|
||||
+ for _, eof := range []bool{true, false} {
|
||||
+ name := fmt.Sprintf("%s/earlyEOF=%v", tc.name, eof)
|
||||
+ t.Run(name, func(t *testing.T) {
|
||||
+ d := NewTokenDecoder(&toks{
|
||||
+ earlyEOF: eof,
|
||||
+ t: tc.tokens,
|
||||
+ })
|
||||
+ err := d.Decode(&struct {
|
||||
+ XMLName Name `xml:"test"`
|
||||
+ }{})
|
||||
+ if tc.ok && err != nil {
|
||||
+ t.Fatalf("d.Decode: expected nil error, got %v", err)
|
||||
+ }
|
||||
+ if _, ok := err.(*SyntaxError); !tc.ok && !ok {
|
||||
+ t.Errorf("d.Decode: expected syntax error, got %v", err)
|
||||
+ }
|
||||
+ })
|
||||
}
|
||||
- })
|
||||
- t.Run("LateEOF", func(t *testing.T) {
|
||||
- d := NewTokenDecoder(&toks{t: []Token{
|
||||
- start,
|
||||
- start.End(),
|
||||
- }})
|
||||
- err := d.Decode(&struct {
|
||||
- XMLName Name `xml:"test"`
|
||||
- }{})
|
||||
- if err != nil {
|
||||
- t.Error(err)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+type toksNil struct {
|
||||
+ returnEOF bool
|
||||
+ t []Token
|
||||
+}
|
||||
+
|
||||
+func (t *toksNil) Token() (Token, error) {
|
||||
+ if len(t.t) == 0 {
|
||||
+ if !t.returnEOF {
|
||||
+ // Return nil, nil before returning an EOF. It's legal, but
|
||||
+ // discouraged.
|
||||
+ t.returnEOF = true
|
||||
+ return nil, nil
|
||||
}
|
||||
- })
|
||||
+ return nil, io.EOF
|
||||
+ }
|
||||
+ var tok Token
|
||||
+ tok, t.t = t.t[0], t.t[1:]
|
||||
+ return tok, nil
|
||||
+}
|
||||
+
|
||||
+func TestDecodeNilToken(t *testing.T) {
|
||||
+ for _, strict := range []bool{true, false} {
|
||||
+ name := fmt.Sprintf("Strict=%v", strict)
|
||||
+ t.Run(name, func(t *testing.T) {
|
||||
+ start := StartElement{Name: Name{Local: "test"}}
|
||||
+ bad := StartElement{Name: Name{Local: "bad"}}
|
||||
+ d := NewTokenDecoder(&toksNil{
|
||||
+ // Malformed
|
||||
+ t: []Token{start, bad, start.End()},
|
||||
+ })
|
||||
+ d.Strict = strict
|
||||
+ err := d.Decode(&struct {
|
||||
+ XMLName Name `xml:"test"`
|
||||
+ }{})
|
||||
+ if _, ok := err.(*SyntaxError); !ok {
|
||||
+ t.Errorf("d.Decode: expected syntax error, got %v", err)
|
||||
+ }
|
||||
+ })
|
||||
+ }
|
||||
}
|
||||
|
||||
const testInput = `
|
||||
101
meta/recipes-devtools/go/go-1.14/CVE-2021-36221.patch
Normal file
101
meta/recipes-devtools/go/go-1.14/CVE-2021-36221.patch
Normal file
@@ -0,0 +1,101 @@
|
||||
From b7a85e0003cedb1b48a1fd3ae5b746ec6330102e Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Wed, 7 Jul 2021 16:34:34 -0700
|
||||
Subject: [PATCH] net/http/httputil: close incoming ReverseProxy request body
|
||||
|
||||
Reading from an incoming request body after the request handler aborts
|
||||
with a panic can cause a panic, becuse http.Server does not (contrary
|
||||
to its documentation) close the request body in this case.
|
||||
|
||||
Always close the incoming request body in ReverseProxy.ServeHTTP to
|
||||
ensure that any in-flight outgoing requests using the body do not
|
||||
read from it.
|
||||
|
||||
Updates #46866
|
||||
Fixes CVE-2021-36221
|
||||
|
||||
Change-Id: I310df269200ad8732c5d9f1a2b00de68725831df
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/333191
|
||||
Trust: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
||||
Reviewed-by: Filippo Valsorda <filippo@golang.org>
|
||||
|
||||
https://github.com/golang/go/commit/b7a85e0003cedb1b48a1fd3ae5b746ec6330102e
|
||||
CVE: CVE-2021-36221
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
src/net/http/httputil/reverseproxy.go | 9 +++++
|
||||
src/net/http/httputil/reverseproxy_test.go | 39 ++++++++++++++++++++++
|
||||
2 files changed, 48 insertions(+)
|
||||
|
||||
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
|
||||
index 5d39955d62d15..8b63368386f43 100644
|
||||
--- a/src/net/http/httputil/reverseproxy.go
|
||||
+++ b/src/net/http/httputil/reverseproxy.go
|
||||
@@ -235,6 +235,15 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if req.ContentLength == 0 {
|
||||
outreq.Body = nil // Issue 16036: nil Body for http.Transport retries
|
||||
}
|
||||
+ if outreq.Body != nil {
|
||||
+ // Reading from the request body after returning from a handler is not
|
||||
+ // allowed, and the RoundTrip goroutine that reads the Body can outlive
|
||||
+ // this handler. This can lead to a crash if the handler panics (see
|
||||
+ // Issue 46866). Although calling Close doesn't guarantee there isn't
|
||||
+ // any Read in flight after the handle returns, in practice it's safe to
|
||||
+ // read after closing it.
|
||||
+ defer outreq.Body.Close()
|
||||
+ }
|
||||
if outreq.Header == nil {
|
||||
outreq.Header = make(http.Header) // Issue 33142: historical behavior was to always allocate
|
||||
}
|
||||
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
|
||||
index 1898ed8b8afde..4b6ad77a29466 100644
|
||||
--- a/src/net/http/httputil/reverseproxy_test.go
|
||||
+++ b/src/net/http/httputil/reverseproxy_test.go
|
||||
@@ -1122,6 +1122,45 @@ func TestReverseProxy_PanicBodyError(t *testing.T) {
|
||||
rproxy.ServeHTTP(httptest.NewRecorder(), req)
|
||||
}
|
||||
|
||||
+// Issue #46866: panic without closing incoming request body causes a panic
|
||||
+func TestReverseProxy_PanicClosesIncomingBody(t *testing.T) {
|
||||
+ backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
+ out := "this call was relayed by the reverse proxy"
|
||||
+ // Coerce a wrong content length to induce io.ErrUnexpectedEOF
|
||||
+ w.Header().Set("Content-Length", fmt.Sprintf("%d", len(out)*2))
|
||||
+ fmt.Fprintln(w, out)
|
||||
+ }))
|
||||
+ defer backend.Close()
|
||||
+ backendURL, err := url.Parse(backend.URL)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ proxyHandler := NewSingleHostReverseProxy(backendURL)
|
||||
+ proxyHandler.ErrorLog = log.New(io.Discard, "", 0) // quiet for tests
|
||||
+ frontend := httptest.NewServer(proxyHandler)
|
||||
+ defer frontend.Close()
|
||||
+ frontendClient := frontend.Client()
|
||||
+
|
||||
+ var wg sync.WaitGroup
|
||||
+ for i := 0; i < 2; i++ {
|
||||
+ wg.Add(1)
|
||||
+ go func() {
|
||||
+ defer wg.Done()
|
||||
+ for j := 0; j < 10; j++ {
|
||||
+ const reqLen = 6 * 1024 * 1024
|
||||
+ req, _ := http.NewRequest("POST", frontend.URL, &io.LimitedReader{R: neverEnding('x'), N: reqLen})
|
||||
+ req.ContentLength = reqLen
|
||||
+ resp, _ := frontendClient.Transport.RoundTrip(req)
|
||||
+ if resp != nil {
|
||||
+ io.Copy(io.Discard, resp.Body)
|
||||
+ resp.Body.Close()
|
||||
+ }
|
||||
+ }
|
||||
+ }()
|
||||
+ }
|
||||
+ wg.Wait()
|
||||
+}
|
||||
+
|
||||
func TestSelectFlushInterval(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
79
meta/recipes-devtools/go/go-1.14/CVE-2021-39293.patch
Normal file
79
meta/recipes-devtools/go/go-1.14/CVE-2021-39293.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
From 6c480017ae600b2c90a264a922e041df04dfa785 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <roland@golang.org>
|
||||
Date: Wed, 18 Aug 2021 11:49:29 -0700
|
||||
Subject: [PATCH] [release-branch.go1.16] archive/zip: prevent preallocation
|
||||
check from overflowing
|
||||
|
||||
If the indicated directory size in the archive header is so large that
|
||||
subtracting it from the archive size overflows a uint64, the check that
|
||||
the indicated number of files in the archive can be effectively
|
||||
bypassed. Prevent this from happening by checking that the indicated
|
||||
directory size is less than the size of the archive.
|
||||
|
||||
Thanks to the OSS-Fuzz project for discovering this issue and to
|
||||
Emmanuel Odeke for reporting it.
|
||||
|
||||
Fixes #47985
|
||||
Updates #47801
|
||||
Fixes CVE-2021-39293
|
||||
|
||||
Change-Id: Ifade26b98a40f3b37398ca86bd5252d12394dd24
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/343434
|
||||
Trust: Roland Shoemaker <roland@golang.org>
|
||||
Run-TryBot: Roland Shoemaker <roland@golang.org>
|
||||
TryBot-Result: Go Bot <gobot@golang.org>
|
||||
Reviewed-by: Russ Cox <rsc@golang.org>
|
||||
(cherry picked from commit bacbc33439b124ffd7392c91a5f5d96eca8c0c0b)
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/345409
|
||||
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
|
||||
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
|
||||
Trust: Cherry Mui <cherryyz@google.com>
|
||||
|
||||
https://github.com/golang/go/commit/6c480017ae600b2c90a264a922e041df04dfa785
|
||||
CVE: CVE-2021-39293
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
src/archive/zip/reader.go | 2 +-
|
||||
src/archive/zip/reader_test.go | 18 ++++++++++++++++++
|
||||
2 files changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/archive/zip/reader.go b/src/archive/zip/reader.go
|
||||
index ddef2b7b5a517..801d1313b6c32 100644
|
||||
--- a/src/archive/zip/reader.go
|
||||
+++ b/src/archive/zip/reader.go
|
||||
@@ -105,7 +105,7 @@ func (z *Reader) init(r io.ReaderAt, size int64) error {
|
||||
// indicate it contains up to 1 << 128 - 1 files. Since each file has a
|
||||
// header which will be _at least_ 30 bytes we can safely preallocate
|
||||
// if (data size / 30) >= end.directoryRecords.
|
||||
- if (uint64(size)-end.directorySize)/30 >= end.directoryRecords {
|
||||
+ if end.directorySize < uint64(size) && (uint64(size)-end.directorySize)/30 >= end.directoryRecords {
|
||||
z.File = make([]*File, 0, end.directoryRecords)
|
||||
}
|
||||
z.Comment = end.comment
|
||||
diff --git a/src/archive/zip/reader_test.go b/src/archive/zip/reader_test.go
|
||||
index 471be27bb1004..99f13345d8d06 100644
|
||||
--- a/src/archive/zip/reader_test.go
|
||||
+++ b/src/archive/zip/reader_test.go
|
||||
@@ -1225,3 +1225,21 @@ func TestCVE202133196(t *testing.T) {
|
||||
t.Errorf("Archive has unexpected number of files, got %d, want 5", len(r.File))
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestCVE202139293(t *testing.T) {
|
||||
+ // directory size is so large, that the check in Reader.init
|
||||
+ // overflows when subtracting from the archive size, causing
|
||||
+ // the pre-allocation check to be bypassed.
|
||||
+ data := []byte{
|
||||
+ 0x50, 0x4b, 0x06, 0x06, 0x05, 0x06, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4b,
|
||||
+ 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
+ 0x00, 0x00, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x4b,
|
||||
+ 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
+ 0x00, 0x00, 0x00, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
+ 0xff, 0x50, 0xfe, 0x00, 0xff, 0x00, 0x3a, 0x00, 0x00, 0x00, 0xff,
|
||||
+ }
|
||||
+ _, err := NewReader(bytes.NewReader(data), int64(len(data)))
|
||||
+ if err != ErrFormat {
|
||||
+ t.Fatalf("unexpected error, got: %v, want: %v", err, ErrFormat)
|
||||
+ }
|
||||
+}
|
||||
86
meta/recipes-devtools/go/go-1.14/CVE-2021-41771.patch
Normal file
86
meta/recipes-devtools/go/go-1.14/CVE-2021-41771.patch
Normal file
File diff suppressed because one or more lines are too long
68
meta/recipes-devtools/go/go-1.14/CVE-2022-27664.patch
Normal file
68
meta/recipes-devtools/go/go-1.14/CVE-2022-27664.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From 48c9076dcfc2dc894842ff758c8cfae7957c9565 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 29 Sep 2022 17:06:18 +0530
|
||||
Subject: [PATCH] CVE-2022-27664
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/5bc9106458fc07851ac324a4157132a91b1f3479]
|
||||
CVE: CVE-2022-27664
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/net/http/h2_bundle.go | 21 +++++++++++++--------
|
||||
1 file changed, 13 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
|
||||
index 65d851d..83f2a72 100644
|
||||
--- a/src/net/http/h2_bundle.go
|
||||
+++ b/src/net/http/h2_bundle.go
|
||||
@@ -3254,10 +3254,11 @@ var (
|
||||
// name (key). See httpguts.ValidHeaderName for the base rules.
|
||||
//
|
||||
// Further, http2 says:
|
||||
-// "Just as in HTTP/1.x, header field names are strings of ASCII
|
||||
-// characters that are compared in a case-insensitive
|
||||
-// fashion. However, header field names MUST be converted to
|
||||
-// lowercase prior to their encoding in HTTP/2. "
|
||||
+//
|
||||
+// "Just as in HTTP/1.x, header field names are strings of ASCII
|
||||
+// characters that are compared in a case-insensitive
|
||||
+// fashion. However, header field names MUST be converted to
|
||||
+// lowercase prior to their encoding in HTTP/2. "
|
||||
func http2validWireHeaderFieldName(v string) bool {
|
||||
if len(v) == 0 {
|
||||
return false
|
||||
@@ -3446,8 +3447,8 @@ func (s *http2sorter) SortStrings(ss []string) {
|
||||
// validPseudoPath reports whether v is a valid :path pseudo-header
|
||||
// value. It must be either:
|
||||
//
|
||||
-// *) a non-empty string starting with '/'
|
||||
-// *) the string '*', for OPTIONS requests.
|
||||
+// *) a non-empty string starting with '/'
|
||||
+// *) the string '*', for OPTIONS requests.
|
||||
//
|
||||
// For now this is only used a quick check for deciding when to clean
|
||||
// up Opaque URLs before sending requests from the Transport.
|
||||
@@ -4897,6 +4898,9 @@ func (sc *http2serverConn) startGracefulShutdownInternal() {
|
||||
func (sc *http2serverConn) goAway(code http2ErrCode) {
|
||||
sc.serveG.check()
|
||||
if sc.inGoAway {
|
||||
+ if sc.goAwayCode == http2ErrCodeNo {
|
||||
+ sc.goAwayCode = code
|
||||
+ }
|
||||
return
|
||||
}
|
||||
sc.inGoAway = true
|
||||
@@ -6091,8 +6095,9 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||
// prior to the headers being written. If the set of trailers is fixed
|
||||
// or known before the header is written, the normal Go trailers mechanism
|
||||
// is preferred:
|
||||
-// https://golang.org/pkg/net/http/#ResponseWriter
|
||||
-// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
|
||||
+//
|
||||
+// https://golang.org/pkg/net/http/#ResponseWriter
|
||||
+// https://golang.org/pkg/net/http/#example_ResponseWriter_trailers
|
||||
const http2TrailerPrefix = "Trailer:"
|
||||
|
||||
// promoteUndeclaredTrailers permits http.Handlers to set trailers
|
||||
--
|
||||
2.25.1
|
||||
|
||||
47
meta/recipes-devtools/go/go-1.14/CVE-2022-30629.patch
Normal file
47
meta/recipes-devtools/go/go-1.14/CVE-2022-30629.patch
Normal file
@@ -0,0 +1,47 @@
|
||||
From 8d0bbb5a6280c2cf951241ec7f6579c90d38df57 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 25 Aug 2022 10:55:08 +0530
|
||||
Subject: [PATCH] CVE-2022-30629
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/c15a8e2dbb5ac376a6ed890735341b812d6b965c]
|
||||
CVE: CVE-2022-30629
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/crypto/tls/handshake_server_tls13.go | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
|
||||
index 5432145..d91797e 100644
|
||||
--- a/src/crypto/tls/handshake_server_tls13.go
|
||||
+++ b/src/crypto/tls/handshake_server_tls13.go
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"crypto"
|
||||
"crypto/hmac"
|
||||
"crypto/rsa"
|
||||
+ "encoding/binary"
|
||||
"errors"
|
||||
"hash"
|
||||
"io"
|
||||
@@ -742,6 +743,19 @@ func (hs *serverHandshakeStateTLS13) sendSessionTickets() error {
|
||||
}
|
||||
m.lifetime = uint32(maxSessionTicketLifetime / time.Second)
|
||||
|
||||
+ // ticket_age_add is a random 32-bit value. See RFC 8446, section 4.6.1
|
||||
+ // The value is not stored anywhere; we never need to check the ticket age
|
||||
+ // because 0-RTT is not supported.
|
||||
+ ageAdd := make([]byte, 4)
|
||||
+ _, err = hs.c.config.rand().Read(ageAdd)
|
||||
+ if err != nil {
|
||||
+ return err
|
||||
+ }
|
||||
+ m.ageAdd = binary.LittleEndian.Uint32(ageAdd)
|
||||
+
|
||||
+ // ticket_nonce, which must be unique per connection, is always left at
|
||||
+ // zero because we only ever send one ticket per connection.
|
||||
+
|
||||
if _, err := c.writeRecord(recordTypeHandshake, m.marshal()); err != nil {
|
||||
return err
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
116
meta/recipes-devtools/go/go-1.14/CVE-2022-30631.patch
Normal file
116
meta/recipes-devtools/go/go-1.14/CVE-2022-30631.patch
Normal file
@@ -0,0 +1,116 @@
|
||||
From d10fc3a84e3344f2421c1dd3046faa50709ab4d5 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 25 Aug 2022 11:01:21 +0530
|
||||
Subject: [PATCH] CVE-2022-30631
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/0117dee7dccbbd7803d88f65a2ce8bd686219ad3]
|
||||
CVE: CVE-2022-30631
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/compress/gzip/gunzip.go | 60 +++++++++++++++-----------------
|
||||
src/compress/gzip/gunzip_test.go | 16 +++++++++
|
||||
2 files changed, 45 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/src/compress/gzip/gunzip.go b/src/compress/gzip/gunzip.go
|
||||
index 924bce1..237b2b9 100644
|
||||
--- a/src/compress/gzip/gunzip.go
|
||||
+++ b/src/compress/gzip/gunzip.go
|
||||
@@ -248,42 +248,40 @@ func (z *Reader) Read(p []byte) (n int, err error) {
|
||||
return 0, z.err
|
||||
}
|
||||
|
||||
- n, z.err = z.decompressor.Read(p)
|
||||
- z.digest = crc32.Update(z.digest, crc32.IEEETable, p[:n])
|
||||
- z.size += uint32(n)
|
||||
- if z.err != io.EOF {
|
||||
- // In the normal case we return here.
|
||||
- return n, z.err
|
||||
- }
|
||||
+ for n == 0 {
|
||||
+ n, z.err = z.decompressor.Read(p)
|
||||
+ z.digest = crc32.Update(z.digest, crc32.IEEETable, p[:n])
|
||||
+ z.size += uint32(n)
|
||||
+ if z.err != io.EOF {
|
||||
+ // In the normal case we return here.
|
||||
+ return n, z.err
|
||||
+ }
|
||||
|
||||
- // Finished file; check checksum and size.
|
||||
- if _, err := io.ReadFull(z.r, z.buf[:8]); err != nil {
|
||||
- z.err = noEOF(err)
|
||||
- return n, z.err
|
||||
- }
|
||||
- digest := le.Uint32(z.buf[:4])
|
||||
- size := le.Uint32(z.buf[4:8])
|
||||
- if digest != z.digest || size != z.size {
|
||||
- z.err = ErrChecksum
|
||||
- return n, z.err
|
||||
- }
|
||||
- z.digest, z.size = 0, 0
|
||||
+ // Finished file; check checksum and size.
|
||||
+ if _, err := io.ReadFull(z.r, z.buf[:8]); err != nil {
|
||||
+ z.err = noEOF(err)
|
||||
+ return n, z.err
|
||||
+ }
|
||||
+ digest := le.Uint32(z.buf[:4])
|
||||
+ size := le.Uint32(z.buf[4:8])
|
||||
+ if digest != z.digest || size != z.size {
|
||||
+ z.err = ErrChecksum
|
||||
+ return n, z.err
|
||||
+ }
|
||||
+ z.digest, z.size = 0, 0
|
||||
|
||||
- // File is ok; check if there is another.
|
||||
- if !z.multistream {
|
||||
- return n, io.EOF
|
||||
- }
|
||||
- z.err = nil // Remove io.EOF
|
||||
+ // File is ok; check if there is another.
|
||||
+ if !z.multistream {
|
||||
+ return n, io.EOF
|
||||
+ }
|
||||
+ z.err = nil // Remove io.EOF
|
||||
|
||||
- if _, z.err = z.readHeader(); z.err != nil {
|
||||
- return n, z.err
|
||||
+ if _, z.err = z.readHeader(); z.err != nil {
|
||||
+ return n, z.err
|
||||
+ }
|
||||
}
|
||||
|
||||
- // Read from next file, if necessary.
|
||||
- if n > 0 {
|
||||
- return n, nil
|
||||
- }
|
||||
- return z.Read(p)
|
||||
+ return n, nil
|
||||
}
|
||||
|
||||
// Close closes the Reader. It does not close the underlying io.Reader.
|
||||
diff --git a/src/compress/gzip/gunzip_test.go b/src/compress/gzip/gunzip_test.go
|
||||
index 1b01404..95220ae 100644
|
||||
--- a/src/compress/gzip/gunzip_test.go
|
||||
+++ b/src/compress/gzip/gunzip_test.go
|
||||
@@ -516,3 +516,19 @@ func TestTruncatedStreams(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestCVE202230631(t *testing.T) {
|
||||
+ var empty = []byte{0x1f, 0x8b, 0x08, 0x00, 0xa7, 0x8f, 0x43, 0x62, 0x00,
|
||||
+ 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
|
||||
+ r := bytes.NewReader(bytes.Repeat(empty, 4e6))
|
||||
+ z, err := NewReader(r)
|
||||
+ if err != nil {
|
||||
+ t.Fatalf("NewReader: got %v, want nil", err)
|
||||
+ }
|
||||
+ // Prior to CVE-2022-30631 fix, this would cause an unrecoverable panic due
|
||||
+ // to stack exhaustion.
|
||||
+ _, err = z.Read(make([]byte, 10))
|
||||
+ if err != io.EOF {
|
||||
+ t.Errorf("Reader.Read: got %v, want %v", err, io.EOF)
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
71
meta/recipes-devtools/go/go-1.14/CVE-2022-30632.patch
Normal file
71
meta/recipes-devtools/go/go-1.14/CVE-2022-30632.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
From 35d1dfe9746029aea9027b405c75555d41ffd2f8 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 25 Aug 2022 13:12:40 +0530
|
||||
Subject: [PATCH] CVE-2022-30632
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/76f8b7304d1f7c25834e2a0cc9e88c55276c47df]
|
||||
CVE: CVE-2022-30632
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/path/filepath/match.go | 16 +++++++++++++++-
|
||||
src/path/filepath/match_test.go | 10 ++++++++++
|
||||
2 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/path/filepath/match.go b/src/path/filepath/match.go
|
||||
index 46badb5..ba68daa 100644
|
||||
--- a/src/path/filepath/match.go
|
||||
+++ b/src/path/filepath/match.go
|
||||
@@ -232,6 +232,20 @@ func getEsc(chunk string) (r rune, nchunk string, err error) {
|
||||
// The only possible returned error is ErrBadPattern, when pattern
|
||||
// is malformed.
|
||||
func Glob(pattern string) (matches []string, err error) {
|
||||
+ return globWithLimit(pattern, 0)
|
||||
+}
|
||||
+
|
||||
+func globWithLimit(pattern string, depth int) (matches []string, err error) {
|
||||
+ // This limit is used prevent stack exhaustion issues. See CVE-2022-30632.
|
||||
+ const pathSeparatorsLimit = 10000
|
||||
+ if depth == pathSeparatorsLimit {
|
||||
+ return nil, ErrBadPattern
|
||||
+ }
|
||||
+
|
||||
+ // Check pattern is well-formed.
|
||||
+ if _, err := Match(pattern, ""); err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
if !hasMeta(pattern) {
|
||||
if _, err = os.Lstat(pattern); err != nil {
|
||||
return nil, nil
|
||||
@@ -257,7 +271,7 @@ func Glob(pattern string) (matches []string, err error) {
|
||||
}
|
||||
|
||||
var m []string
|
||||
- m, err = Glob(dir)
|
||||
+ m, err = globWithLimit(dir, depth+1)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
diff --git a/src/path/filepath/match_test.go b/src/path/filepath/match_test.go
|
||||
index b865762..c37c812 100644
|
||||
--- a/src/path/filepath/match_test.go
|
||||
+++ b/src/path/filepath/match_test.go
|
||||
@@ -154,6 +154,16 @@ func TestGlob(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
+func TestCVE202230632(t *testing.T) {
|
||||
+ // Prior to CVE-2022-30632, this would cause a stack exhaustion given a
|
||||
+ // large number of separators (more than 4,000,000). There is now a limit
|
||||
+ // of 10,000.
|
||||
+ _, err := Glob("/*" + strings.Repeat("/", 10001))
|
||||
+ if err != ErrBadPattern {
|
||||
+ t.Fatalf("Glob returned err=%v, want ErrBadPattern", err)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
func TestGlobError(t *testing.T) {
|
||||
_, err := Glob("[]")
|
||||
if err == nil {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
131
meta/recipes-devtools/go/go-1.14/CVE-2022-30633.patch
Normal file
131
meta/recipes-devtools/go/go-1.14/CVE-2022-30633.patch
Normal file
@@ -0,0 +1,131 @@
|
||||
From ab6e2ffdcab0501bcc2de4b196c1c18ae2301d4b Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 25 Aug 2022 13:29:55 +0530
|
||||
Subject: [PATCH] CVE-2022-30633
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/2678d0c957193dceef336c969a9da74dd716a827]
|
||||
CVE: CVE-2022-30633
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/encoding/xml/read.go | 27 +++++++++++++++++++--------
|
||||
src/encoding/xml/read_test.go | 14 ++++++++++++++
|
||||
2 files changed, 33 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/encoding/xml/read.go b/src/encoding/xml/read.go
|
||||
index 10a60ee..4ffed80 100644
|
||||
--- a/src/encoding/xml/read.go
|
||||
+++ b/src/encoding/xml/read.go
|
||||
@@ -148,7 +148,7 @@ func (d *Decoder) DecodeElement(v interface{}, start *StartElement) error {
|
||||
if val.Kind() != reflect.Ptr {
|
||||
return errors.New("non-pointer passed to Unmarshal")
|
||||
}
|
||||
- return d.unmarshal(val.Elem(), start)
|
||||
+ return d.unmarshal(val.Elem(), start, 0)
|
||||
}
|
||||
|
||||
// An UnmarshalError represents an error in the unmarshaling process.
|
||||
@@ -304,8 +304,15 @@ var (
|
||||
textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
|
||||
)
|
||||
|
||||
+const maxUnmarshalDepth = 10000
|
||||
+
|
||||
+var errExeceededMaxUnmarshalDepth = errors.New("exceeded max depth")
|
||||
+
|
||||
// Unmarshal a single XML element into val.
|
||||
-func (d *Decoder) unmarshal(val reflect.Value, start *StartElement) error {
|
||||
+func (d *Decoder) unmarshal(val reflect.Value, start *StartElement, depth int) error {
|
||||
+ if depth >= maxUnmarshalDepth {
|
||||
+ return errExeceededMaxUnmarshalDepth
|
||||
+ }
|
||||
// Find start element if we need it.
|
||||
if start == nil {
|
||||
for {
|
||||
@@ -398,7 +405,7 @@ func (d *Decoder) unmarshal(val reflect.Value, start *StartElement) error {
|
||||
v.Set(reflect.Append(val, reflect.Zero(v.Type().Elem())))
|
||||
|
||||
// Recur to read element into slice.
|
||||
- if err := d.unmarshal(v.Index(n), start); err != nil {
|
||||
+ if err := d.unmarshal(v.Index(n), start, depth+1); err != nil {
|
||||
v.SetLen(n)
|
||||
return err
|
||||
}
|
||||
@@ -521,13 +528,15 @@ Loop:
|
||||
case StartElement:
|
||||
consumed := false
|
||||
if sv.IsValid() {
|
||||
- consumed, err = d.unmarshalPath(tinfo, sv, nil, &t)
|
||||
+ // unmarshalPath can call unmarshal, so we need to pass the depth through so that
|
||||
+ // we can continue to enforce the maximum recusion limit.
|
||||
+ consumed, err = d.unmarshalPath(tinfo, sv, nil, &t, depth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !consumed && saveAny.IsValid() {
|
||||
consumed = true
|
||||
- if err := d.unmarshal(saveAny, &t); err != nil {
|
||||
+ if err := d.unmarshal(saveAny, &t, depth+1); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -672,7 +681,7 @@ func copyValue(dst reflect.Value, src []byte) (err error) {
|
||||
// The consumed result tells whether XML elements have been consumed
|
||||
// from the Decoder until start's matching end element, or if it's
|
||||
// still untouched because start is uninteresting for sv's fields.
|
||||
-func (d *Decoder) unmarshalPath(tinfo *typeInfo, sv reflect.Value, parents []string, start *StartElement) (consumed bool, err error) {
|
||||
+func (d *Decoder) unmarshalPath(tinfo *typeInfo, sv reflect.Value, parents []string, start *StartElement, depth int) (consumed bool, err error) {
|
||||
recurse := false
|
||||
Loop:
|
||||
for i := range tinfo.fields {
|
||||
@@ -687,7 +696,7 @@ Loop:
|
||||
}
|
||||
if len(finfo.parents) == len(parents) && finfo.name == start.Name.Local {
|
||||
// It's a perfect match, unmarshal the field.
|
||||
- return true, d.unmarshal(finfo.value(sv), start)
|
||||
+ return true, d.unmarshal(finfo.value(sv), start, depth+1)
|
||||
}
|
||||
if len(finfo.parents) > len(parents) && finfo.parents[len(parents)] == start.Name.Local {
|
||||
// It's a prefix for the field. Break and recurse
|
||||
@@ -716,7 +725,9 @@ Loop:
|
||||
}
|
||||
switch t := tok.(type) {
|
||||
case StartElement:
|
||||
- consumed2, err := d.unmarshalPath(tinfo, sv, parents, &t)
|
||||
+ // the recursion depth of unmarshalPath is limited to the path length specified
|
||||
+ // by the struct field tag, so we don't increment the depth here.
|
||||
+ consumed2, err := d.unmarshalPath(tinfo, sv, parents, &t, depth)
|
||||
if err != nil {
|
||||
return true, err
|
||||
}
|
||||
diff --git a/src/encoding/xml/read_test.go b/src/encoding/xml/read_test.go
|
||||
index 8c2e70f..6a20b1a 100644
|
||||
--- a/src/encoding/xml/read_test.go
|
||||
+++ b/src/encoding/xml/read_test.go
|
||||
@@ -5,6 +5,7 @@
|
||||
package xml
|
||||
|
||||
import (
|
||||
+ "errors"
|
||||
"io"
|
||||
"reflect"
|
||||
"strings"
|
||||
@@ -1079,3 +1080,16 @@ func TestUnmarshalWhitespaceAttrs(t *testing.T) {
|
||||
t.Fatalf("whitespace attrs: Unmarshal:\nhave: %#+v\nwant: %#+v", v, want)
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestCVE202228131(t *testing.T) {
|
||||
+ type nested struct {
|
||||
+ Parent *nested `xml:",any"`
|
||||
+ }
|
||||
+ var n nested
|
||||
+ err := Unmarshal(bytes.Repeat([]byte("<a>"), maxUnmarshalDepth+1), &n)
|
||||
+ if err == nil {
|
||||
+ t.Fatal("Unmarshal did not fail")
|
||||
+ } else if !errors.Is(err, errExeceededMaxUnmarshalDepth) {
|
||||
+ t.Fatalf("Unmarshal unexpected error: got %q, want %q", err, errExeceededMaxUnmarshalDepth)
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
120
meta/recipes-devtools/go/go-1.14/CVE-2022-30635.patch
Normal file
120
meta/recipes-devtools/go/go-1.14/CVE-2022-30635.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
From fdd4316737ed5681689a1f40802ffa0805e5b11c Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Fri, 26 Aug 2022 12:17:05 +0530
|
||||
Subject: [PATCH] CVE-2022-30635
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/cd54600b866db0ad068ab8df06c7f5f6cb55c9b3]
|
||||
CVE-2022-30635
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/encoding/gob/decode.go | 19 ++++++++++++-------
|
||||
src/encoding/gob/gobencdec_test.go | 24 ++++++++++++++++++++++++
|
||||
2 files changed, 36 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/encoding/gob/decode.go b/src/encoding/gob/decode.go
|
||||
index d2f6c74..0e0ec75 100644
|
||||
--- a/src/encoding/gob/decode.go
|
||||
+++ b/src/encoding/gob/decode.go
|
||||
@@ -871,8 +871,13 @@ func (dec *Decoder) decOpFor(wireId typeId, rt reflect.Type, name string, inProg
|
||||
return &op
|
||||
}
|
||||
|
||||
+var maxIgnoreNestingDepth = 10000
|
||||
+
|
||||
// decIgnoreOpFor returns the decoding op for a field that has no destination.
|
||||
-func (dec *Decoder) decIgnoreOpFor(wireId typeId, inProgress map[typeId]*decOp) *decOp {
|
||||
+func (dec *Decoder) decIgnoreOpFor(wireId typeId, inProgress map[typeId]*decOp, depth int) *decOp {
|
||||
+ if depth > maxIgnoreNestingDepth {
|
||||
+ error_(errors.New("invalid nesting depth"))
|
||||
+ }
|
||||
// If this type is already in progress, it's a recursive type (e.g. map[string]*T).
|
||||
// Return the pointer to the op we're already building.
|
||||
if opPtr := inProgress[wireId]; opPtr != nil {
|
||||
@@ -896,7 +901,7 @@ func (dec *Decoder) decIgnoreOpFor(wireId typeId, inProgress map[typeId]*decOp)
|
||||
errorf("bad data: undefined type %s", wireId.string())
|
||||
case wire.ArrayT != nil:
|
||||
elemId := wire.ArrayT.Elem
|
||||
- elemOp := dec.decIgnoreOpFor(elemId, inProgress)
|
||||
+ elemOp := dec.decIgnoreOpFor(elemId, inProgress, depth+1)
|
||||
op = func(i *decInstr, state *decoderState, value reflect.Value) {
|
||||
state.dec.ignoreArray(state, *elemOp, wire.ArrayT.Len)
|
||||
}
|
||||
@@ -904,15 +909,15 @@ func (dec *Decoder) decIgnoreOpFor(wireId typeId, inProgress map[typeId]*decOp)
|
||||
case wire.MapT != nil:
|
||||
keyId := dec.wireType[wireId].MapT.Key
|
||||
elemId := dec.wireType[wireId].MapT.Elem
|
||||
- keyOp := dec.decIgnoreOpFor(keyId, inProgress)
|
||||
- elemOp := dec.decIgnoreOpFor(elemId, inProgress)
|
||||
+ keyOp := dec.decIgnoreOpFor(keyId, inProgress, depth+1)
|
||||
+ elemOp := dec.decIgnoreOpFor(elemId, inProgress, depth+1)
|
||||
op = func(i *decInstr, state *decoderState, value reflect.Value) {
|
||||
state.dec.ignoreMap(state, *keyOp, *elemOp)
|
||||
}
|
||||
|
||||
case wire.SliceT != nil:
|
||||
elemId := wire.SliceT.Elem
|
||||
- elemOp := dec.decIgnoreOpFor(elemId, inProgress)
|
||||
+ elemOp := dec.decIgnoreOpFor(elemId, inProgress, depth+1)
|
||||
op = func(i *decInstr, state *decoderState, value reflect.Value) {
|
||||
state.dec.ignoreSlice(state, *elemOp)
|
||||
}
|
||||
@@ -1073,7 +1078,7 @@ func (dec *Decoder) compileSingle(remoteId typeId, ut *userTypeInfo) (engine *de
|
||||
func (dec *Decoder) compileIgnoreSingle(remoteId typeId) *decEngine {
|
||||
engine := new(decEngine)
|
||||
engine.instr = make([]decInstr, 1) // one item
|
||||
- op := dec.decIgnoreOpFor(remoteId, make(map[typeId]*decOp))
|
||||
+ op := dec.decIgnoreOpFor(remoteId, make(map[typeId]*decOp), 0)
|
||||
ovfl := overflow(dec.typeString(remoteId))
|
||||
engine.instr[0] = decInstr{*op, 0, nil, ovfl}
|
||||
engine.numInstr = 1
|
||||
@@ -1118,7 +1123,7 @@ func (dec *Decoder) compileDec(remoteId typeId, ut *userTypeInfo) (engine *decEn
|
||||
localField, present := srt.FieldByName(wireField.Name)
|
||||
// TODO(r): anonymous names
|
||||
if !present || !isExported(wireField.Name) {
|
||||
- op := dec.decIgnoreOpFor(wireField.Id, make(map[typeId]*decOp))
|
||||
+ op := dec.decIgnoreOpFor(wireField.Id, make(map[typeId]*decOp), 0)
|
||||
engine.instr[fieldnum] = decInstr{*op, fieldnum, nil, ovfl}
|
||||
continue
|
||||
}
|
||||
diff --git a/src/encoding/gob/gobencdec_test.go b/src/encoding/gob/gobencdec_test.go
|
||||
index 6d2c8db..1b52ecc 100644
|
||||
--- a/src/encoding/gob/gobencdec_test.go
|
||||
+++ b/src/encoding/gob/gobencdec_test.go
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
+ "reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -796,3 +797,26 @@ func TestNetIP(t *testing.T) {
|
||||
t.Errorf("decoded to %v, want 1.2.3.4", ip.String())
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestIngoreDepthLimit(t *testing.T) {
|
||||
+ // We don't test the actual depth limit because it requires building an
|
||||
+ // extremely large message, which takes quite a while.
|
||||
+ oldNestingDepth := maxIgnoreNestingDepth
|
||||
+ maxIgnoreNestingDepth = 100
|
||||
+ defer func() { maxIgnoreNestingDepth = oldNestingDepth }()
|
||||
+ b := new(bytes.Buffer)
|
||||
+ enc := NewEncoder(b)
|
||||
+ typ := reflect.TypeOf(int(0))
|
||||
+ nested := reflect.ArrayOf(1, typ)
|
||||
+ for i := 0; i < 100; i++ {
|
||||
+ nested = reflect.ArrayOf(1, nested)
|
||||
+ }
|
||||
+ badStruct := reflect.New(reflect.StructOf([]reflect.StructField{{Name: "F", Type: nested}}))
|
||||
+ enc.Encode(badStruct.Interface())
|
||||
+ dec := NewDecoder(b)
|
||||
+ var output struct{ Hello int }
|
||||
+ expectedErr := "invalid nesting depth"
|
||||
+ if err := dec.Decode(&output); err == nil || err.Error() != expectedErr {
|
||||
+ t.Errorf("Decode didn't fail with depth limit of 100: want %q, got %q", expectedErr, err)
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
49
meta/recipes-devtools/go/go-1.14/CVE-2022-32148.patch
Normal file
49
meta/recipes-devtools/go/go-1.14/CVE-2022-32148.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0fe3adec199e8cd2c101933f75d8cd617de70350 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Fri, 26 Aug 2022 12:48:13 +0530
|
||||
Subject: [PATCH] CVE-2022-32148
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/ed2f33e1a7e0d18f61bd56f7ee067331d612c27e]
|
||||
CVE: CVE-2022-32148
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/net/http/header.go | 6 ++++++
|
||||
src/net/http/header_test.go | 5 +++++
|
||||
2 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/src/net/http/header.go b/src/net/http/header.go
|
||||
index b9b5391..221f613 100644
|
||||
--- a/src/net/http/header.go
|
||||
+++ b/src/net/http/header.go
|
||||
@@ -100,6 +100,12 @@ func (h Header) Clone() Header {
|
||||
sv := make([]string, nv) // shared backing array for headers' values
|
||||
h2 := make(Header, len(h))
|
||||
for k, vv := range h {
|
||||
+ if vv == nil {
|
||||
+ // Preserve nil values. ReverseProxy distinguishes
|
||||
+ // between nil and zero-length header values.
|
||||
+ h2[k] = nil
|
||||
+ continue
|
||||
+ }
|
||||
n := copy(sv, vv)
|
||||
h2[k] = sv[:n:n]
|
||||
sv = sv[n:]
|
||||
diff --git a/src/net/http/header_test.go b/src/net/http/header_test.go
|
||||
index 4789362..80c0035 100644
|
||||
--- a/src/net/http/header_test.go
|
||||
+++ b/src/net/http/header_test.go
|
||||
@@ -235,6 +235,11 @@ func TestCloneOrMakeHeader(t *testing.T) {
|
||||
in: Header{"foo": {"bar"}},
|
||||
want: Header{"foo": {"bar"}},
|
||||
},
|
||||
+ {
|
||||
+ name: "nil value",
|
||||
+ in: Header{"foo": nil},
|
||||
+ want: Header{"foo": nil},
|
||||
+ },
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
113
meta/recipes-devtools/go/go-1.14/CVE-2022-32189.patch
Normal file
113
meta/recipes-devtools/go/go-1.14/CVE-2022-32189.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
From 027e7e1578d3d7614f7586eff3894b83d9709e14 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 29 Aug 2022 10:08:34 +0530
|
||||
Subject: [PATCH] CVE-2022-32189
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/703c8ab7e5ba75c95553d4e249309297abad7102]
|
||||
CVE: CVE-2022-32189
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/math/big/floatmarsh.go | 7 +++++++
|
||||
src/math/big/floatmarsh_test.go | 12 ++++++++++++
|
||||
src/math/big/ratmarsh.go | 6 ++++++
|
||||
src/math/big/ratmarsh_test.go | 12 ++++++++++++
|
||||
4 files changed, 37 insertions(+)
|
||||
|
||||
diff --git a/src/math/big/floatmarsh.go b/src/math/big/floatmarsh.go
|
||||
index d1c1dab..990e085 100644
|
||||
--- a/src/math/big/floatmarsh.go
|
||||
+++ b/src/math/big/floatmarsh.go
|
||||
@@ -8,6 +8,7 @@ package big
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
+ "errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
@@ -67,6 +68,9 @@ func (z *Float) GobDecode(buf []byte) error {
|
||||
*z = Float{}
|
||||
return nil
|
||||
}
|
||||
+ if len(buf) < 6 {
|
||||
+ return errors.New("Float.GobDecode: buffer too small")
|
||||
+ }
|
||||
|
||||
if buf[0] != floatGobVersion {
|
||||
return fmt.Errorf("Float.GobDecode: encoding version %d not supported", buf[0])
|
||||
@@ -83,6 +87,9 @@ func (z *Float) GobDecode(buf []byte) error {
|
||||
z.prec = binary.BigEndian.Uint32(buf[2:])
|
||||
|
||||
if z.form == finite {
|
||||
+ if len(buf) < 10 {
|
||||
+ return errors.New("Float.GobDecode: buffer too small for finite form float")
|
||||
+ }
|
||||
z.exp = int32(binary.BigEndian.Uint32(buf[6:]))
|
||||
z.mant = z.mant.setBytes(buf[10:])
|
||||
}
|
||||
diff --git a/src/math/big/floatmarsh_test.go b/src/math/big/floatmarsh_test.go
|
||||
index c056d78..401f45a 100644
|
||||
--- a/src/math/big/floatmarsh_test.go
|
||||
+++ b/src/math/big/floatmarsh_test.go
|
||||
@@ -137,3 +137,15 @@ func TestFloatJSONEncoding(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestFloatGobDecodeShortBuffer(t *testing.T) {
|
||||
+ for _, tc := range [][]byte{
|
||||
+ []byte{0x1, 0x0, 0x0, 0x0},
|
||||
+ []byte{0x1, 0xfa, 0x0, 0x0, 0x0, 0x0},
|
||||
+ } {
|
||||
+ err := NewFloat(0).GobDecode(tc)
|
||||
+ if err == nil {
|
||||
+ t.Error("expected GobDecode to return error for malformed input")
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/math/big/ratmarsh.go b/src/math/big/ratmarsh.go
|
||||
index fbc7b60..56102e8 100644
|
||||
--- a/src/math/big/ratmarsh.go
|
||||
+++ b/src/math/big/ratmarsh.go
|
||||
@@ -45,12 +45,18 @@ func (z *Rat) GobDecode(buf []byte) error {
|
||||
*z = Rat{}
|
||||
return nil
|
||||
}
|
||||
+ if len(buf) < 5 {
|
||||
+ return errors.New("Rat.GobDecode: buffer too small")
|
||||
+ }
|
||||
b := buf[0]
|
||||
if b>>1 != ratGobVersion {
|
||||
return fmt.Errorf("Rat.GobDecode: encoding version %d not supported", b>>1)
|
||||
}
|
||||
const j = 1 + 4
|
||||
i := j + binary.BigEndian.Uint32(buf[j-4:j])
|
||||
+ if len(buf) < int(i) {
|
||||
+ return errors.New("Rat.GobDecode: buffer too small")
|
||||
+ }
|
||||
z.a.neg = b&1 != 0
|
||||
z.a.abs = z.a.abs.setBytes(buf[j:i])
|
||||
z.b.abs = z.b.abs.setBytes(buf[i:])
|
||||
diff --git a/src/math/big/ratmarsh_test.go b/src/math/big/ratmarsh_test.go
|
||||
index 351d109..55a9878 100644
|
||||
--- a/src/math/big/ratmarsh_test.go
|
||||
+++ b/src/math/big/ratmarsh_test.go
|
||||
@@ -123,3 +123,15 @@ func TestRatXMLEncoding(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+func TestRatGobDecodeShortBuffer(t *testing.T) {
|
||||
+ for _, tc := range [][]byte{
|
||||
+ []byte{0x2},
|
||||
+ []byte{0x2, 0x0, 0x0, 0x0, 0xff},
|
||||
+ } {
|
||||
+ err := NewRat(1, 2).GobDecode(tc)
|
||||
+ if err == nil {
|
||||
+ t.Error("expected GobDecode to return error for malformed input")
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -37,6 +37,7 @@ EXTRA_CPAN_BUILD_FLAGS = "--create_packlist=0"
|
||||
|
||||
do_install_append () {
|
||||
rm -rf ${D}${docdir}/perl/html
|
||||
sed -i "s:^#!.*:#!/usr/bin/env perl:" ${D}${bindir}/config_data
|
||||
}
|
||||
|
||||
do_install_ptest() {
|
||||
|
||||
135
meta/recipes-devtools/python/python3/CVE-2021-28861.patch
Normal file
135
meta/recipes-devtools/python/python3/CVE-2021-28861.patch
Normal file
@@ -0,0 +1,135 @@
|
||||
From 4dc2cae3abd75f386374d0635d00443b897d0672 Mon Sep 17 00:00:00 2001
|
||||
From: "Miss Islington (bot)"
|
||||
<31488909+miss-islington@users.noreply.github.com>
|
||||
Date: Wed, 22 Jun 2022 01:42:52 -0700
|
||||
Subject: [PATCH] gh-87389: Fix an open redirection vulnerability in
|
||||
http.server. (GH-93879) (GH-94094)
|
||||
|
||||
Fix an open redirection vulnerability in the `http.server` module when
|
||||
an URI path starts with `//` that could produce a 301 Location header
|
||||
with a misleading target. Vulnerability discovered, and logic fix
|
||||
proposed, by Hamza Avvan (@hamzaavvan).
|
||||
|
||||
Test and comments authored by Gregory P. Smith [Google].
|
||||
(cherry picked from commit 4abab6b603dd38bec1168e9a37c40a48ec89508e)
|
||||
|
||||
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
||||
|
||||
Signed-off-by: Riyaz Khan <Riyaz.Khan@kpit.com>
|
||||
|
||||
CVE: CVE-2021-28861
|
||||
|
||||
Upstream-Status: Backport [https://github.com/python/cpython/commit/4dc2cae3abd75f386374d0635d00443b897d0672]
|
||||
|
||||
---
|
||||
Lib/http/server.py | 7 +++
|
||||
Lib/test/test_httpservers.py | 53 ++++++++++++++++++-
|
||||
...2-06-15-20-09-23.gh-issue-87389.QVaC3f.rst | 3 ++
|
||||
3 files changed, 61 insertions(+), 2 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2022-06-15-20-09-23.gh-issue-87389.QVaC3f.rst
|
||||
|
||||
diff --git a/Lib/http/server.py b/Lib/http/server.py
|
||||
index 38f7accad7a3..39de35458c38 100644
|
||||
--- a/Lib/http/server.py
|
||||
+++ b/Lib/http/server.py
|
||||
@@ -332,6 +332,13 @@ def parse_request(self):
|
||||
return False
|
||||
self.command, self.path = command, path
|
||||
|
||||
+ # gh-87389: The purpose of replacing '//' with '/' is to protect
|
||||
+ # against open redirect attacks possibly triggered if the path starts
|
||||
+ # with '//' because http clients treat //path as an absolute URI
|
||||
+ # without scheme (similar to http://path) rather than a path.
|
||||
+ if self.path.startswith('//'):
|
||||
+ self.path = '/' + self.path.lstrip('/') # Reduce to a single /
|
||||
+
|
||||
# Examine the headers and look for a Connection directive.
|
||||
try:
|
||||
self.headers = http.client.parse_headers(self.rfile,
|
||||
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
|
||||
index 87d4924a34b3..fb026188f0b4 100644
|
||||
--- a/Lib/test/test_httpservers.py
|
||||
+++ b/Lib/test/test_httpservers.py
|
||||
@@ -330,7 +330,7 @@ class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler):
|
||||
pass
|
||||
|
||||
def setUp(self):
|
||||
- BaseTestCase.setUp(self)
|
||||
+ super().setUp()
|
||||
self.cwd = os.getcwd()
|
||||
basetempdir = tempfile.gettempdir()
|
||||
os.chdir(basetempdir)
|
||||
@@ -358,7 +358,7 @@ def tearDown(self):
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
- BaseTestCase.tearDown(self)
|
||||
+ super().tearDown()
|
||||
|
||||
def check_status_and_reason(self, response, status, data=None):
|
||||
def close_conn():
|
||||
@@ -414,6 +414,55 @@ def test_undecodable_filename(self):
|
||||
self.check_status_and_reason(response, HTTPStatus.OK,
|
||||
data=support.TESTFN_UNDECODABLE)
|
||||
|
||||
+ def test_get_dir_redirect_location_domain_injection_bug(self):
|
||||
+ """Ensure //evil.co/..%2f../../X does not put //evil.co/ in Location.
|
||||
+
|
||||
+ //netloc/ in a Location header is a redirect to a new host.
|
||||
+ https://github.com/python/cpython/issues/87389
|
||||
+
|
||||
+ This checks that a path resolving to a directory on our server cannot
|
||||
+ resolve into a redirect to another server.
|
||||
+ """
|
||||
+ os.mkdir(os.path.join(self.tempdir, 'existing_directory'))
|
||||
+ url = f'/python.org/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../{self.tempdir_name}/existing_directory'
|
||||
+ expected_location = f'{url}/' # /python.org.../ single slash single prefix, trailing slash
|
||||
+ # Canonicalizes to /tmp/tempdir_name/existing_directory which does
|
||||
+ # exist and is a dir, triggering the 301 redirect logic.
|
||||
+ response = self.request(url)
|
||||
+ self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
|
||||
+ location = response.getheader('Location')
|
||||
+ self.assertEqual(location, expected_location, msg='non-attack failed!')
|
||||
+
|
||||
+ # //python.org... multi-slash prefix, no trailing slash
|
||||
+ attack_url = f'/{url}'
|
||||
+ response = self.request(attack_url)
|
||||
+ self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
|
||||
+ location = response.getheader('Location')
|
||||
+ self.assertFalse(location.startswith('//'), msg=location)
|
||||
+ self.assertEqual(location, expected_location,
|
||||
+ msg='Expected Location header to start with a single / and '
|
||||
+ 'end with a / as this is a directory redirect.')
|
||||
+
|
||||
+ # ///python.org... triple-slash prefix, no trailing slash
|
||||
+ attack3_url = f'//{url}'
|
||||
+ response = self.request(attack3_url)
|
||||
+ self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
|
||||
+ self.assertEqual(response.getheader('Location'), expected_location)
|
||||
+
|
||||
+ # If the second word in the http request (Request-URI for the http
|
||||
+ # method) is a full URI, we don't worry about it, as that'll be parsed
|
||||
+ # and reassembled as a full URI within BaseHTTPRequestHandler.send_head
|
||||
+ # so no errant scheme-less //netloc//evil.co/ domain mixup can happen.
|
||||
+ attack_scheme_netloc_2slash_url = f'https://pypi.org/{url}'
|
||||
+ expected_scheme_netloc_location = f'{attack_scheme_netloc_2slash_url}/'
|
||||
+ response = self.request(attack_scheme_netloc_2slash_url)
|
||||
+ self.check_status_and_reason(response, HTTPStatus.MOVED_PERMANENTLY)
|
||||
+ location = response.getheader('Location')
|
||||
+ # We're just ensuring that the scheme and domain make it through, if
|
||||
+ # there are or aren't multiple slashes at the start of the path that
|
||||
+ # follows that isn't important in this Location: header.
|
||||
+ self.assertTrue(location.startswith('https://pypi.org/'), msg=location)
|
||||
+
|
||||
def test_get(self):
|
||||
#constructs the path relative to the root directory of the HTTPServer
|
||||
response = self.request(self.base_url + '/test')
|
||||
diff --git a/Misc/NEWS.d/next/Security/2022-06-15-20-09-23.gh-issue-87389.QVaC3f.rst b/Misc/NEWS.d/next/Security/2022-06-15-20-09-23.gh-issue-87389.QVaC3f.rst
|
||||
new file mode 100644
|
||||
index 000000000000..029d437190de
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2022-06-15-20-09-23.gh-issue-87389.QVaC3f.rst
|
||||
@@ -0,0 +1,3 @@
|
||||
+:mod:`http.server`: Fix an open redirection vulnerability in the HTTP server
|
||||
+when an URI path starts with ``//``. Vulnerability discovered, and initial
|
||||
+fix proposed, by Hamza Avvan.
|
||||
@@ -34,6 +34,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
|
||||
file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \
|
||||
file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
|
||||
file://makerace.patch \
|
||||
file://CVE-2021-28861.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-native = " \
|
||||
|
||||
@@ -98,6 +98,19 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://CVE-2020-13253_4.patch \
|
||||
file://CVE-2020-13253_5.patch \
|
||||
file://CVE-2020-13791.patch \
|
||||
file://CVE-2022-35414.patch \
|
||||
file://CVE-2020-27821.patch \
|
||||
file://CVE-2020-13754-1.patch \
|
||||
file://CVE-2020-13754-2.patch \
|
||||
file://CVE-2020-13754-3.patch \
|
||||
file://CVE-2020-13754-4.patch \
|
||||
file://CVE-2021-3713.patch \
|
||||
file://CVE-2021-3748.patch \
|
||||
file://CVE-2021-3930.patch \
|
||||
file://CVE-2021-4206.patch \
|
||||
file://CVE-2021-4207.patch \
|
||||
file://CVE-2022-0216-1.patch \
|
||||
file://CVE-2022-0216-2.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
@@ -115,6 +128,9 @@ CVE_CHECK_WHITELIST += "CVE-2007-0998"
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
|
||||
CVE_CHECK_WHITELIST += "CVE-2018-18438"
|
||||
|
||||
# the issue introduced in v5.1.0-rc0
|
||||
CVE_CHECK_WHITELIST += "CVE-2020-27661"
|
||||
|
||||
COMPATIBLE_HOST_mipsarchn32 = "null"
|
||||
COMPATIBLE_HOST_mipsarchn64 = "null"
|
||||
|
||||
@@ -255,6 +271,9 @@ PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
|
||||
PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
|
||||
PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
|
||||
PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone"
|
||||
# libnfs is currently provided by meta-kodi
|
||||
PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
|
||||
PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi"
|
||||
|
||||
INSANE_SKIP_${PN} = "arch"
|
||||
|
||||
|
||||
91
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-1.patch
Normal file
91
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-1.patch
Normal file
@@ -0,0 +1,91 @@
|
||||
From 5d971f9e672507210e77d020d89e0e89165c8fc9 Mon Sep 17 00:00:00 2001
|
||||
From: "Michael S. Tsirkin" <mst@redhat.com>
|
||||
Date: Wed, 10 Jun 2020 09:47:49 -0400
|
||||
Subject: [PATCH] memory: Revert "memory: accept mismatching sizes in
|
||||
memory_region_access_valid"
|
||||
|
||||
Memory API documentation documents valid .min_access_size and .max_access_size
|
||||
fields and explains that any access outside these boundaries is blocked.
|
||||
|
||||
This is what devices seem to assume.
|
||||
|
||||
However this is not what the implementation does: it simply
|
||||
ignores the boundaries unless there's an "accepts" callback.
|
||||
|
||||
Naturally, this breaks a bunch of devices.
|
||||
|
||||
Revert to the documented behaviour.
|
||||
|
||||
Devices that want to allow any access can just drop the valid field,
|
||||
or add the impl field to have accesses converted to appropriate
|
||||
length.
|
||||
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reviewed-by: Richard Henderson <rth@twiddle.net>
|
||||
Fixes: CVE-2020-13754
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1842363
|
||||
Fixes: a014ed07bd5a ("memory: accept mismatching sizes in memory_region_access_valid")
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Message-Id: <20200610134731.1514409-1-mst@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://git.qemu.org/?p=qemu.git;a=patch;h=5d971f9e672507210e77d020d89e0e89165c8fc9
|
||||
CVE: CVE-2020-13754
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
memory.c | 29 +++++++++--------------------
|
||||
1 file changed, 9 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/memory.c b/memory.c
|
||||
index 2f15a4b..9200b20 100644
|
||||
--- a/memory.c
|
||||
+++ b/memory.c
|
||||
@@ -1352,35 +1352,24 @@ bool memory_region_access_valid(MemoryRegion *mr,
|
||||
bool is_write,
|
||||
MemTxAttrs attrs)
|
||||
{
|
||||
- int access_size_min, access_size_max;
|
||||
- int access_size, i;
|
||||
-
|
||||
- if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
|
||||
+ if (mr->ops->valid.accepts
|
||||
+ && !mr->ops->valid.accepts(mr->opaque, addr, size, is_write, attrs)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (!mr->ops->valid.accepts) {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- access_size_min = mr->ops->valid.min_access_size;
|
||||
- if (!mr->ops->valid.min_access_size) {
|
||||
- access_size_min = 1;
|
||||
+ if (!mr->ops->valid.unaligned && (addr & (size - 1))) {
|
||||
+ return false;
|
||||
}
|
||||
|
||||
- access_size_max = mr->ops->valid.max_access_size;
|
||||
+ /* Treat zero as compatibility all valid */
|
||||
if (!mr->ops->valid.max_access_size) {
|
||||
- access_size_max = 4;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
- access_size = MAX(MIN(size, access_size_max), access_size_min);
|
||||
- for (i = 0; i < size; i += access_size) {
|
||||
- if (!mr->ops->valid.accepts(mr->opaque, addr + i, access_size,
|
||||
- is_write, attrs)) {
|
||||
- return false;
|
||||
- }
|
||||
+ if (size > mr->ops->valid.max_access_size
|
||||
+ || size < mr->ops->valid.min_access_size) {
|
||||
+ return false;
|
||||
}
|
||||
-
|
||||
return true;
|
||||
}
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
69
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-2.patch
Normal file
69
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-2.patch
Normal file
@@ -0,0 +1,69 @@
|
||||
From dba04c3488c4699f5afe96f66e448b1d447cf3fb Mon Sep 17 00:00:00 2001
|
||||
From: Michael Tokarev <mjt@tls.msk.ru>
|
||||
Date: Mon, 20 Jul 2020 19:06:27 +0300
|
||||
Subject: [PATCH] acpi: accept byte and word access to core ACPI registers
|
||||
|
||||
All ISA registers should be accessible as bytes, words or dwords
|
||||
(if wide enough). Fix the access constraints for acpi-pm-evt,
|
||||
acpi-pm-tmr & acpi-cnt registers.
|
||||
|
||||
Fixes: 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memory_region_access_valid")
|
||||
Fixes: afafe4bbe0 (apci: switch cnt to memory api)
|
||||
Fixes: 77d58b1e47 (apci: switch timer to memory api)
|
||||
Fixes: b5a7c024d2 (apci: switch evt to memory api)
|
||||
Buglink: https://lore.kernel.org/xen-devel/20200630170913.123646-1-anthony.perard@citrix.com/T/
|
||||
Buglink: https://bugs.debian.org/964793
|
||||
BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964247
|
||||
BugLink: https://bugs.launchpad.net/bugs/1886318
|
||||
Reported-By: Simon John <git@the-jedi.co.uk>
|
||||
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
||||
Message-Id: <20200720160627.15491-1-mjt@msgid.tls.msk.ru>
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
||||
|
||||
https://git.qemu.org/?p=qemu.git;a=patch;h=dba04c3488c4699f5afe96f66e448b1d447cf3fb
|
||||
CVE: CVE-2020-13754
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/acpi/core.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
|
||||
index f6d9ec4..ac06db3 100644
|
||||
--- a/hw/acpi/core.c
|
||||
+++ b/hw/acpi/core.c
|
||||
@@ -458,7 +458,8 @@ static void acpi_pm_evt_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
static const MemoryRegionOps acpi_pm_evt_ops = {
|
||||
.read = acpi_pm_evt_read,
|
||||
.write = acpi_pm_evt_write,
|
||||
- .valid.min_access_size = 2,
|
||||
+ .impl.min_access_size = 2,
|
||||
+ .valid.min_access_size = 1,
|
||||
.valid.max_access_size = 2,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
@@ -527,7 +528,8 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
static const MemoryRegionOps acpi_pm_tmr_ops = {
|
||||
.read = acpi_pm_tmr_read,
|
||||
.write = acpi_pm_tmr_write,
|
||||
- .valid.min_access_size = 4,
|
||||
+ .impl.min_access_size = 4,
|
||||
+ .valid.min_access_size = 1,
|
||||
.valid.max_access_size = 4,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
@@ -599,7 +601,8 @@ static void acpi_pm_cnt_write(void *opaque, hwaddr addr, uint64_t val,
|
||||
static const MemoryRegionOps acpi_pm_cnt_ops = {
|
||||
.read = acpi_pm_cnt_read,
|
||||
.write = acpi_pm_cnt_write,
|
||||
- .valid.min_access_size = 2,
|
||||
+ .impl.min_access_size = 2,
|
||||
+ .valid.min_access_size = 1,
|
||||
.valid.max_access_size = 2,
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
65
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-3.patch
Normal file
65
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-3.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From 8e67fda2dd6202ccec093fda561107ba14830a17 Mon Sep 17 00:00:00 2001
|
||||
From: Laurent Vivier <lvivier@redhat.com>
|
||||
Date: Tue, 21 Jul 2020 10:33:22 +0200
|
||||
Subject: [PATCH] xhci: fix valid.max_access_size to access address registers
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=utf8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
QEMU XHCI advertises AC64 (64-bit addressing) but doesn't allow
|
||||
64-bit mode access in "runtime" and "operational" MemoryRegionOps.
|
||||
|
||||
Set the max_access_size based on sizeof(dma_addr_t) as AC64 is set.
|
||||
|
||||
XHCI specs:
|
||||
"If the xHC supports 64-bit addressing (AC64 = â1â), then software
|
||||
should write 64-bit registers using only Qword accesses. If a
|
||||
system is incapable of issuing Qword accesses, then writes to the
|
||||
64-bit address fields shall be performed using 2 Dword accesses;
|
||||
low Dword-first, high-Dword second. If the xHC supports 32-bit
|
||||
addressing (AC64 = â0â), then the high Dword of registers containing
|
||||
64-bit address fields are unused and software should write addresses
|
||||
using only Dword accesses"
|
||||
|
||||
The problem has been detected with SLOF, as linux kernel always accesses
|
||||
registers using 32-bit access even if AC64 is set and revealed by
|
||||
5d971f9e6725 ("memory: Revert "memory: accept mismatching sizes in memory_region_access_valid"")
|
||||
|
||||
Suggested-by: Alexey Kardashevskiy <aik@au1.ibm.com>
|
||||
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
||||
Message-id: 20200721083322.90651-1-lvivier@redhat.com
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
||||
https://git.qemu.org/?p=qemu.git;a=patch;h=8e67fda2dd6202ccec093fda561107ba14830a17
|
||||
CVE: CVE-2020-13754
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/usb/hcd-xhci.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
|
||||
index b330e36..67a18fe 100644
|
||||
--- a/hw/usb/hcd-xhci.c
|
||||
+++ b/hw/usb/hcd-xhci.c
|
||||
@@ -3184,7 +3184,7 @@ static const MemoryRegionOps xhci_oper_ops = {
|
||||
.read = xhci_oper_read,
|
||||
.write = xhci_oper_write,
|
||||
.valid.min_access_size = 4,
|
||||
- .valid.max_access_size = 4,
|
||||
+ .valid.max_access_size = sizeof(dma_addr_t),
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
@@ -3200,7 +3200,7 @@ static const MemoryRegionOps xhci_runtime_ops = {
|
||||
.read = xhci_runtime_read,
|
||||
.write = xhci_runtime_write,
|
||||
.valid.min_access_size = 4,
|
||||
- .valid.max_access_size = 4,
|
||||
+ .valid.max_access_size = sizeof(dma_addr_t),
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
};
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
39
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-4.patch
Normal file
39
meta/recipes-devtools/qemu/qemu/CVE-2020-13754-4.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 70b78d4e71494c90d2ccb40381336bc9b9a22f79 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Francis <alistair.francis@wdc.com>
|
||||
Date: Tue, 30 Jun 2020 13:12:11 -0700
|
||||
Subject: [PATCH] hw/riscv: Allow 64 bit access to SiFive CLINT
|
||||
|
||||
Commit 5d971f9e672507210e77d020d89e0e89165c8fc9
|
||||
"memory: Revert "memory: accept mismatching sizes in
|
||||
memory_region_access_valid"" broke most RISC-V boards as they do 64 bit
|
||||
accesses to the CLINT and QEMU would trigger a fault. Fix this failure
|
||||
by allowing 8 byte accesses.
|
||||
|
||||
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
|
||||
Reviewed-by: LIU Zhiwei<zhiwei_liu@c-sky.com>
|
||||
Message-Id: <122b78825b077e4dfd39b444d3a46fe894a7804c.1593547870.git.alistair.francis@wdc.com>
|
||||
|
||||
https://git.qemu.org/?p=qemu.git;a=patch;h=70b78d4e71494c90d2ccb40381336bc9b9a22f79
|
||||
CVE: CVE-2020-13754
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/riscv/sifive_clint.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/riscv/sifive_clint.c b/hw/riscv/sifive_clint.c
|
||||
index b11ffa0..669c21a 100644
|
||||
--- a/hw/riscv/sifive_clint.c
|
||||
+++ b/hw/riscv/sifive_clint.c
|
||||
@@ -181,7 +181,7 @@ static const MemoryRegionOps sifive_clint_ops = {
|
||||
.endianness = DEVICE_LITTLE_ENDIAN,
|
||||
.valid = {
|
||||
.min_access_size = 4,
|
||||
- .max_access_size = 4
|
||||
+ .max_access_size = 8
|
||||
}
|
||||
};
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
73
meta/recipes-devtools/qemu/qemu/CVE-2020-27821.patch
Normal file
73
meta/recipes-devtools/qemu/qemu/CVE-2020-27821.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 15222d4636d742f3395fd211fad0cd7e36d9f43e Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Tue, 16 Aug 2022 10:07:01 +0530
|
||||
Subject: [PATCH] CVE-2020-27821
|
||||
|
||||
Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=4bfb024bc76973d40a359476dc0291f46e435442]
|
||||
CVE: CVE-2020-27821
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
memory: clamp cached translation in case it points to an MMIO region
|
||||
|
||||
In using the address_space_translate_internal API, address_space_cache_init
|
||||
forgot one piece of advice that can be found in the code for
|
||||
address_space_translate_internal:
|
||||
|
||||
/* MMIO registers can be expected to perform full-width accesses based only
|
||||
* on their address, without considering adjacent registers that could
|
||||
* decode to completely different MemoryRegions. When such registers
|
||||
* exist (e.g. I/O ports 0xcf8 and 0xcf9 on most PC chipsets), MMIO
|
||||
* regions overlap wildly. For this reason we cannot clamp the accesses
|
||||
* here.
|
||||
*
|
||||
* If the length is small (as is the case for address_space_ldl/stl),
|
||||
* everything works fine. If the incoming length is large, however,
|
||||
* the caller really has to do the clamping through memory_access_size.
|
||||
*/
|
||||
|
||||
address_space_cache_init is exactly one such case where "the incoming length
|
||||
is large", therefore we need to clamp the resulting length---not to
|
||||
memory_access_size though, since we are not doing an access yet, but to
|
||||
the size of the resulting section. This ensures that subsequent accesses
|
||||
to the cached MemoryRegionSection will be in range.
|
||||
|
||||
With this patch, the enclosed testcase notices that the used ring does
|
||||
not fit into the MSI-X table and prints a "qemu-system-x86_64: Cannot map used"
|
||||
error.
|
||||
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
---
|
||||
exec.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/exec.c b/exec.c
|
||||
index 2d6add46..1360051a 100644
|
||||
--- a/exec.c
|
||||
+++ b/exec.c
|
||||
@@ -3632,6 +3632,7 @@ int64_t address_space_cache_init(MemoryRegionCache *cache,
|
||||
AddressSpaceDispatch *d;
|
||||
hwaddr l;
|
||||
MemoryRegion *mr;
|
||||
+ Int128 diff;
|
||||
|
||||
assert(len > 0);
|
||||
|
||||
@@ -3640,6 +3641,15 @@ int64_t address_space_cache_init(MemoryRegionCache *cache,
|
||||
d = flatview_to_dispatch(cache->fv);
|
||||
cache->mrs = *address_space_translate_internal(d, addr, &cache->xlat, &l, true);
|
||||
|
||||
+ /*
|
||||
+ * cache->xlat is now relative to cache->mrs.mr, not to the section itself.
|
||||
+ * Take that into account to compute how many bytes are there between
|
||||
+ * cache->xlat and the end of the section.
|
||||
+ */
|
||||
+ diff = int128_sub(cache->mrs.size,
|
||||
+ int128_make64(cache->xlat - cache->mrs.offset_within_region));
|
||||
+ l = int128_get64(int128_min(diff, int128_make64(l)));
|
||||
+
|
||||
mr = cache->mrs.mr;
|
||||
memory_region_ref(mr);
|
||||
if (memory_access_is_direct(mr, is_write)) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
67
meta/recipes-devtools/qemu/qemu/CVE-2021-3713.patch
Normal file
67
meta/recipes-devtools/qemu/qemu/CVE-2021-3713.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From a114d6baedf2cccb454a46d36e399fec1bc3e1c0 Mon Sep 17 00:00:00 2001
|
||||
From: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Date: Wed, 18 Aug 2021 14:05:05 +0200
|
||||
Subject: [PATCH] uas: add stream number sanity checks.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The device uses the guest-supplied stream number unchecked, which can
|
||||
lead to guest-triggered out-of-band access to the UASDevice->data3 and
|
||||
UASDevice->status3 fields. Add the missing checks.
|
||||
|
||||
Fixes: CVE-2021-3713
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
Reported-by: Chen Zhe <chenzhe@huawei.com>
|
||||
Reported-by: Tan Jingguo <tanjingguo@huawei.com>
|
||||
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
||||
Message-Id: <20210818120505.1258262-2-kraxel@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/13b250b12ad3c59114a6a17d59caf073ce45b33a
|
||||
CVE: CVE-2021-3713
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/usb/dev-uas.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
|
||||
index 6d6d1073..0b8cd4dd 100644
|
||||
--- a/hw/usb/dev-uas.c
|
||||
+++ b/hw/usb/dev-uas.c
|
||||
@@ -830,6 +830,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
|
||||
}
|
||||
break;
|
||||
case UAS_PIPE_ID_STATUS:
|
||||
+ if (p->stream > UAS_MAX_STREAMS) {
|
||||
+ goto err_stream;
|
||||
+ }
|
||||
if (p->stream) {
|
||||
QTAILQ_FOREACH(st, &uas->results, next) {
|
||||
if (st->stream == p->stream) {
|
||||
@@ -857,6 +860,9 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
|
||||
break;
|
||||
case UAS_PIPE_ID_DATA_IN:
|
||||
case UAS_PIPE_ID_DATA_OUT:
|
||||
+ if (p->stream > UAS_MAX_STREAMS) {
|
||||
+ goto err_stream;
|
||||
+ }
|
||||
if (p->stream) {
|
||||
req = usb_uas_find_request(uas, p->stream);
|
||||
} else {
|
||||
@@ -892,6 +898,11 @@ static void usb_uas_handle_data(USBDevice *dev, USBPacket *p)
|
||||
p->status = USB_RET_STALL;
|
||||
break;
|
||||
}
|
||||
+
|
||||
+err_stream:
|
||||
+ error_report("%s: invalid stream %d", __func__, p->stream);
|
||||
+ p->status = USB_RET_STALL;
|
||||
+ return;
|
||||
}
|
||||
|
||||
static void usb_uas_unrealize(USBDevice *dev, Error **errp)
|
||||
124
meta/recipes-devtools/qemu/qemu/CVE-2021-3748.patch
Normal file
124
meta/recipes-devtools/qemu/qemu/CVE-2021-3748.patch
Normal file
@@ -0,0 +1,124 @@
|
||||
From bedd7e93d01961fcb16a97ae45d93acf357e11f6 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Wang <jasowang@redhat.com>
|
||||
Date: Thu, 2 Sep 2021 13:44:12 +0800
|
||||
Subject: [PATCH] virtio-net: fix use after unmap/free for sg
|
||||
|
||||
When mergeable buffer is enabled, we try to set the num_buffers after
|
||||
the virtqueue elem has been unmapped. This will lead several issues,
|
||||
E.g a use after free when the descriptor has an address which belongs
|
||||
to the non direct access region. In this case we use bounce buffer
|
||||
that is allocated during address_space_map() and freed during
|
||||
address_space_unmap().
|
||||
|
||||
Fixing this by storing the elems temporarily in an array and delay the
|
||||
unmap after we set the the num_buffers.
|
||||
|
||||
This addresses CVE-2021-3748.
|
||||
|
||||
Reported-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Fixes: fbe78f4f55c6 ("virtio-net support")
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
||||
|
||||
https://github.com/qemu/qemu/commit/bedd7e93d01961fcb16a97ae45d93acf357e11f6
|
||||
CVE: CVE-2021-3748
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/net/virtio-net.c | 39 ++++++++++++++++++++++++++++++++-------
|
||||
1 file changed, 32 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
|
||||
index 16d20cdee52a..f205331dcf8c 100644
|
||||
--- a/hw/net/virtio-net.c
|
||||
+++ b/hw/net/virtio-net.c
|
||||
@@ -1746,10 +1746,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
VirtIONet *n = qemu_get_nic_opaque(nc);
|
||||
VirtIONetQueue *q = virtio_net_get_subqueue(nc);
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(n);
|
||||
+ VirtQueueElement *elems[VIRTQUEUE_MAX_SIZE];
|
||||
+ size_t lens[VIRTQUEUE_MAX_SIZE];
|
||||
struct iovec mhdr_sg[VIRTQUEUE_MAX_SIZE];
|
||||
struct virtio_net_hdr_mrg_rxbuf mhdr;
|
||||
unsigned mhdr_cnt = 0;
|
||||
- size_t offset, i, guest_offset;
|
||||
+ size_t offset, i, guest_offset, j;
|
||||
+ ssize_t err;
|
||||
|
||||
if (!virtio_net_can_receive(nc)) {
|
||||
return -1;
|
||||
@@ -1780,6 +1783,12 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
|
||||
total = 0;
|
||||
|
||||
+ if (i == VIRTQUEUE_MAX_SIZE) {
|
||||
+ virtio_error(vdev, "virtio-net unexpected long buffer chain");
|
||||
+ err = size;
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
elem = virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement));
|
||||
if (!elem) {
|
||||
if (i) {
|
||||
@@ -1791,7 +1800,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
n->guest_hdr_len, n->host_hdr_len,
|
||||
vdev->guest_features);
|
||||
}
|
||||
- return -1;
|
||||
+ err = -1;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
if (elem->in_num < 1) {
|
||||
@@ -1799,7 +1809,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
"virtio-net receive queue contains no in buffers");
|
||||
virtqueue_detach_element(q->rx_vq, elem, 0);
|
||||
g_free(elem);
|
||||
- return -1;
|
||||
+ err = -1;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
sg = elem->in_sg;
|
||||
@@ -1836,12 +1847,13 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
if (!n->mergeable_rx_bufs && offset < size) {
|
||||
virtqueue_unpop(q->rx_vq, elem, total);
|
||||
g_free(elem);
|
||||
- return size;
|
||||
+ err = size;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
- /* signal other side */
|
||||
- virtqueue_fill(q->rx_vq, elem, total, i++);
|
||||
- g_free(elem);
|
||||
+ elems[i] = elem;
|
||||
+ lens[i] = total;
|
||||
+ i++;
|
||||
}
|
||||
|
||||
if (mhdr_cnt) {
|
||||
@@ -1851,10 +1863,23 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
|
||||
&mhdr.num_buffers, sizeof mhdr.num_buffers);
|
||||
}
|
||||
|
||||
+ for (j = 0; j < i; j++) {
|
||||
+ /* signal other side */
|
||||
+ virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
|
||||
+ g_free(elems[j]);
|
||||
+ }
|
||||
+
|
||||
virtqueue_flush(q->rx_vq, i);
|
||||
virtio_notify(vdev, q->rx_vq);
|
||||
|
||||
return size;
|
||||
+
|
||||
+err:
|
||||
+ for (j = 0; j < i; j++) {
|
||||
+ g_free(elems[j]);
|
||||
+ }
|
||||
+
|
||||
+ return err;
|
||||
}
|
||||
|
||||
static ssize_t virtio_net_do_receive(NetClientState *nc, const uint8_t *buf,
|
||||
53
meta/recipes-devtools/qemu/qemu/CVE-2021-3930.patch
Normal file
53
meta/recipes-devtools/qemu/qemu/CVE-2021-3930.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 4 Nov 2021 17:31:38 +0100
|
||||
Subject: [PATCH] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT
|
||||
commands
|
||||
|
||||
This avoids an off-by-one read of 'mode_sense_valid' buffer in
|
||||
hw/scsi/scsi-disk.c:mode_sense_page().
|
||||
|
||||
Fixes: CVE-2021-3930
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reported-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
|
||||
Fixes: #546
|
||||
Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8
|
||||
CVE: CVE-2021-3930
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/scsi-disk.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
|
||||
index e8a547dbb7..d4914178ea 100644
|
||||
--- a/hw/scsi/scsi-disk.c
|
||||
+++ b/hw/scsi/scsi-disk.c
|
||||
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
|
||||
uint8_t *p = *p_outbuf + 2;
|
||||
int length;
|
||||
|
||||
+ assert(page < ARRAY_SIZE(mode_sense_valid));
|
||||
if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
|
||||
+ if (page == MODE_PAGE_ALLS) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
p = mode_current;
|
||||
memset(mode_current, 0, inlen + 2);
|
||||
len = mode_sense_page(s, page, &p, 0);
|
||||
--
|
||||
GitLab
|
||||
|
||||
89
meta/recipes-devtools/qemu/qemu/CVE-2021-4206.patch
Normal file
89
meta/recipes-devtools/qemu/qemu/CVE-2021-4206.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From fa892e9abb728e76afcf27323ab29c57fb0fe7aa Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 7 Apr 2022 10:17:12 +0200
|
||||
Subject: [PATCH] ui/cursor: fix integer overflow in cursor_alloc
|
||||
(CVE-2021-4206)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Prevent potential integer overflow by limiting 'width' and 'height' to
|
||||
512x512. Also change 'datasize' type to size_t. Refer to security
|
||||
advisory https://starlabs.sg/advisories/22-4206/ for more information.
|
||||
|
||||
Fixes: CVE-2021-4206
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-Id: <20220407081712.345609-1-mcascell@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/fa892e9a
|
||||
CVE: CVE-2021-4206
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/display/qxl-render.c | 7 +++++++
|
||||
hw/display/vmware_vga.c | 2 ++
|
||||
ui/cursor.c | 8 +++++++-
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
|
||||
index 237ed293ba..ca217004bf 100644
|
||||
--- a/hw/display/qxl-render.c
|
||||
+++ b/hw/display/qxl-render.c
|
||||
@@ -247,6 +247,13 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
|
||||
size_t size;
|
||||
|
||||
c = cursor_alloc(cursor->header.width, cursor->header.height);
|
||||
+
|
||||
+ if (!c) {
|
||||
+ qxl_set_guest_bug(qxl, "%s: cursor %ux%u alloc error", __func__,
|
||||
+ cursor->header.width, cursor->header.height);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
c->hot_x = cursor->header.hot_spot_x;
|
||||
c->hot_y = cursor->header.hot_spot_y;
|
||||
switch (cursor->header.type) {
|
||||
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
|
||||
index 98c83474ad..45d06cbe25 100644
|
||||
--- a/hw/display/vmware_vga.c
|
||||
+++ b/hw/display/vmware_vga.c
|
||||
@@ -515,6 +515,8 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
|
||||
int i, pixels;
|
||||
|
||||
qc = cursor_alloc(c->width, c->height);
|
||||
+ assert(qc != NULL);
|
||||
+
|
||||
qc->hot_x = c->hot_x;
|
||||
qc->hot_y = c->hot_y;
|
||||
switch (c->bpp) {
|
||||
diff --git a/ui/cursor.c b/ui/cursor.c
|
||||
index 1d62ddd4d0..835f0802f9 100644
|
||||
--- a/ui/cursor.c
|
||||
+++ b/ui/cursor.c
|
||||
@@ -46,6 +46,8 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])
|
||||
|
||||
/* parse pixel data */
|
||||
c = cursor_alloc(width, height);
|
||||
+ assert(c != NULL);
|
||||
+
|
||||
for (pixel = 0, y = 0; y < height; y++, line++) {
|
||||
for (x = 0; x < height; x++, pixel++) {
|
||||
idx = xpm[line][x];
|
||||
@@ -91,7 +93,11 @@ QEMUCursor *cursor_builtin_left_ptr(void)
|
||||
QEMUCursor *cursor_alloc(int width, int height)
|
||||
{
|
||||
QEMUCursor *c;
|
||||
- int datasize = width * height * sizeof(uint32_t);
|
||||
+ size_t datasize = width * height * sizeof(uint32_t);
|
||||
+
|
||||
+ if (width > 512 || height > 512) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
c = g_malloc0(sizeof(QEMUCursor) + datasize);
|
||||
c->width = width;
|
||||
--
|
||||
GitLab
|
||||
|
||||
43
meta/recipes-devtools/qemu/qemu/CVE-2021-4207.patch
Normal file
43
meta/recipes-devtools/qemu/qemu/CVE-2021-4207.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 9569f5cb5b4bffa9d3ebc8ba7da1e03830a9a895 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 7 Apr 2022 10:11:06 +0200
|
||||
Subject: [PATCH] display/qxl-render: fix race condition in qxl_cursor
|
||||
(CVE-2021-4207)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Avoid fetching 'width' and 'height' a second time to prevent possible
|
||||
race condition. Refer to security advisory
|
||||
https://starlabs.sg/advisories/22-4207/ for more information.
|
||||
|
||||
Fixes: CVE-2021-4207
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-Id: <20220407081106.343235-1-mcascell@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/9569f5cb
|
||||
CVE: CVE-2021-4207
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/display/qxl-render.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
|
||||
index d28849b121..237ed293ba 100644
|
||||
--- a/hw/display/qxl-render.c
|
||||
+++ b/hw/display/qxl-render.c
|
||||
@@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
|
||||
}
|
||||
break;
|
||||
case SPICE_CURSOR_TYPE_ALPHA:
|
||||
- size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;
|
||||
+ size = sizeof(uint32_t) * c->width * c->height;
|
||||
qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id);
|
||||
if (qxl->debug > 2) {
|
||||
cursor_print_ascii_art(c, "qxl/alpha");
|
||||
--
|
||||
GitLab
|
||||
|
||||
42
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-1.patch
Normal file
42
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-1.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 6c8fa961da5e60f574bb52fd3ad44b1e9e8ad4b8 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Tue, 5 Jul 2022 22:05:43 +0200
|
||||
Subject: [PATCH] scsi/lsi53c895a: fix use-after-free in lsi_do_msgout
|
||||
(CVE-2022-0216)
|
||||
|
||||
Set current_req->req to NULL to prevent reusing a free'd buffer in case of
|
||||
repeated SCSI cancel requests. Thanks to Thomas Huth for suggesting the patch.
|
||||
|
||||
Fixes: CVE-2022-0216
|
||||
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
||||
Message-Id: <20220705200543.2366809-1-mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/6c8fa961da5e60f574bb52fd3ad44b1e9e8ad4b8
|
||||
CVE: CVE-2022-0216
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/lsi53c895a.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
|
||||
index c8773f73f7..99ea42d49b 100644
|
||||
--- a/hw/scsi/lsi53c895a.c
|
||||
+++ b/hw/scsi/lsi53c895a.c
|
||||
@@ -1028,8 +1028,9 @@ static void lsi_do_msgout(LSIState *s)
|
||||
case 0x0d:
|
||||
/* The ABORT TAG message clears the current I/O process only. */
|
||||
trace_lsi_do_msgout_abort(current_tag);
|
||||
- if (current_req) {
|
||||
+ if (current_req && current_req->req) {
|
||||
scsi_req_cancel(current_req->req);
|
||||
+ current_req->req = NULL;
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
--
|
||||
GitLab
|
||||
|
||||
52
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-2.patch
Normal file
52
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-2.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 4367a20cc442c56b05611b4224de9a61908f9eac Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Mon, 11 Jul 2022 14:33:16 +0200
|
||||
Subject: [PATCH] scsi/lsi53c895a: really fix use-after-free in lsi_do_msgout
|
||||
(CVE-2022-0216)
|
||||
|
||||
Set current_req to NULL, not current_req->req, to prevent reusing a free'd
|
||||
buffer in case of repeated SCSI cancel requests. Also apply the fix to
|
||||
CLEAR QUEUE and BUS DEVICE RESET messages as well, since they also cancel
|
||||
the request.
|
||||
|
||||
Thanks to Alexander Bulekov for providing a reproducer.
|
||||
|
||||
Fixes: CVE-2022-0216
|
||||
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Tested-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Message-Id: <20220711123316.421279-1-mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/4367a20cc4
|
||||
CVE: CVE-2022-0216
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/lsi53c895a.c | 3 +-
|
||||
1 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
|
||||
index 99ea42d49b..ad5f5e5f39 100644
|
||||
--- a/hw/scsi/lsi53c895a.c
|
||||
+++ b/hw/scsi/lsi53c895a.c
|
||||
@@ -1030,7 +1030,7 @@ static void lsi_do_msgout(LSIState *s)
|
||||
trace_lsi_do_msgout_abort(current_tag);
|
||||
if (current_req && current_req->req) {
|
||||
scsi_req_cancel(current_req->req);
|
||||
- current_req->req = NULL;
|
||||
+ current_req = NULL;
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
@@ -1056,6 +1056,7 @@ static void lsi_do_msgout(LSIState *s)
|
||||
/* clear the current I/O process */
|
||||
if (s->current) {
|
||||
scsi_req_cancel(s->current->req);
|
||||
+ current_req = NULL;
|
||||
}
|
||||
|
||||
/* As the current implemented devices scsi_disk and scsi_generic
|
||||
--
|
||||
GitLab
|
||||
|
||||
53
meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch
Normal file
53
meta/recipes-devtools/qemu/qemu/CVE-2022-35414.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 09a07b5b39c87423df9e8f6574c19a14d36beac5 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 27 Jul 2022 10:34:12 +0530
|
||||
Subject: [PATCH] CVE-2022-35414
|
||||
|
||||
Upstream-Status: Backport [https://github.com/qemu/qemu/commit/418ade7849ce7641c0f7333718caf5091a02fd4c]
|
||||
CVE: CVE-2022-35414
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
exec.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/exec.c b/exec.c
|
||||
index 43c70ffb..2d6add46 100644
|
||||
--- a/exec.c
|
||||
+++ b/exec.c
|
||||
@@ -685,7 +685,7 @@ static void tcg_iommu_free_notifier_list(CPUState *cpu)
|
||||
|
||||
/* Called from RCU critical section */
|
||||
MemoryRegionSection *
|
||||
-address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
|
||||
+address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr orig_addr,
|
||||
hwaddr *xlat, hwaddr *plen,
|
||||
MemTxAttrs attrs, int *prot)
|
||||
{
|
||||
@@ -694,6 +694,7 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
|
||||
IOMMUMemoryRegionClass *imrc;
|
||||
IOMMUTLBEntry iotlb;
|
||||
int iommu_idx;
|
||||
+ hwaddr addr = orig_addr;
|
||||
AddressSpaceDispatch *d = atomic_rcu_read(&cpu->cpu_ases[asidx].memory_dispatch);
|
||||
|
||||
for (;;) {
|
||||
@@ -737,6 +738,16 @@ address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr,
|
||||
return section;
|
||||
|
||||
translate_fail:
|
||||
+ /*
|
||||
+ * We should be given a page-aligned address -- certainly
|
||||
+ * tlb_set_page_with_attrs() does so. The page offset of xlat
|
||||
+ * is used to index sections[], and PHYS_SECTION_UNASSIGNED = 0.
|
||||
+ * The page portion of xlat will be logged by memory_region_access_valid()
|
||||
+ * when this memory access is rejected, so use the original untranslated
|
||||
+ * physical address.
|
||||
+ */
|
||||
+ assert((orig_addr & ~TARGET_PAGE_MASK) == 0);
|
||||
+ *xlat = orig_addr;
|
||||
return &d->map.sections[PHYS_SECTION_UNASSIGNED];
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
|
||||
146
meta/recipes-devtools/subversion/subversion/CVE-2021-28544.patch
Normal file
146
meta/recipes-devtools/subversion/subversion/CVE-2021-28544.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
From 61382fd8ea66000bd9ee8e203a6eab443220ee40 Mon Sep 17 00:00:00 2001
|
||||
From: Nathan Hartman <hartmannathan@apache.org>
|
||||
Date: Sun, 27 Mar 2022 05:59:18 +0000
|
||||
Subject: [PATCH] On the 1.14.x-r1899227 branch: Merge r1899227 from trunk
|
||||
w/testlist variation
|
||||
|
||||
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.14.x-r1899227@1899229 13f79535-47bb-0310-9956-ffa450edef68
|
||||
|
||||
CVE: CVE-2021-28544 [https://github.com/apache/subversion/commit/61382fd8ea66000bd9ee8e203a6eab443220ee40]
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
subversion/libsvn_repos/log.c | 26 +++++-------
|
||||
subversion/tests/cmdline/authz_tests.py | 55 +++++++++++++++++++++++++
|
||||
2 files changed, 65 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/subversion/libsvn_repos/log.c b/subversion/libsvn_repos/log.c
|
||||
index d9a1fb1085e16..41ca8aed27174 100644
|
||||
--- a/subversion/libsvn_repos/log.c
|
||||
+++ b/subversion/libsvn_repos/log.c
|
||||
@@ -337,42 +337,36 @@ detect_changed(svn_repos_revision_access_level_t *access_level,
|
||||
if ( (change->change_kind == svn_fs_path_change_add)
|
||||
|| (change->change_kind == svn_fs_path_change_replace))
|
||||
{
|
||||
- const char *copyfrom_path = change->copyfrom_path;
|
||||
- svn_revnum_t copyfrom_rev = change->copyfrom_rev;
|
||||
-
|
||||
/* the following is a potentially expensive operation since on FSFS
|
||||
we will follow the DAG from ROOT to PATH and that requires
|
||||
actually reading the directories along the way. */
|
||||
if (!change->copyfrom_known)
|
||||
{
|
||||
- SVN_ERR(svn_fs_copied_from(©from_rev, ©from_path,
|
||||
+ SVN_ERR(svn_fs_copied_from(&change->copyfrom_rev, &change->copyfrom_path,
|
||||
root, path, iterpool));
|
||||
change->copyfrom_known = TRUE;
|
||||
}
|
||||
|
||||
- if (copyfrom_path && SVN_IS_VALID_REVNUM(copyfrom_rev))
|
||||
+ if (change->copyfrom_path && SVN_IS_VALID_REVNUM(change->copyfrom_rev))
|
||||
{
|
||||
- svn_boolean_t readable = TRUE;
|
||||
-
|
||||
if (callbacks->authz_read_func)
|
||||
{
|
||||
svn_fs_root_t *copyfrom_root;
|
||||
+ svn_boolean_t readable;
|
||||
|
||||
SVN_ERR(svn_fs_revision_root(©from_root, fs,
|
||||
- copyfrom_rev, iterpool));
|
||||
+ change->copyfrom_rev, iterpool));
|
||||
SVN_ERR(callbacks->authz_read_func(&readable,
|
||||
copyfrom_root,
|
||||
- copyfrom_path,
|
||||
+ change->copyfrom_path,
|
||||
callbacks->authz_read_baton,
|
||||
iterpool));
|
||||
if (! readable)
|
||||
- found_unreadable = TRUE;
|
||||
- }
|
||||
-
|
||||
- if (readable)
|
||||
- {
|
||||
- change->copyfrom_path = copyfrom_path;
|
||||
- change->copyfrom_rev = copyfrom_rev;
|
||||
+ {
|
||||
+ found_unreadable = TRUE;
|
||||
+ change->copyfrom_path = NULL;
|
||||
+ change->copyfrom_rev = SVN_INVALID_REVNUM;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/subversion/tests/cmdline/authz_tests.py b/subversion/tests/cmdline/authz_tests.py
|
||||
index 760cb3663d02f..92e8a5e1935c9 100755
|
||||
--- a/subversion/tests/cmdline/authz_tests.py
|
||||
+++ b/subversion/tests/cmdline/authz_tests.py
|
||||
@@ -1731,6 +1731,60 @@ def empty_group(sbox):
|
||||
'--username', svntest.main.wc_author,
|
||||
sbox.repo_url)
|
||||
|
||||
+@Skip(svntest.main.is_ra_type_file)
|
||||
+def log_inaccessible_copyfrom(sbox):
|
||||
+ "log doesn't leak inaccessible copyfrom paths"
|
||||
+
|
||||
+ sbox.build(empty=True)
|
||||
+ sbox.simple_add_text('secret', 'private')
|
||||
+ sbox.simple_commit(message='log message for r1')
|
||||
+ sbox.simple_copy('private', 'public')
|
||||
+ sbox.simple_commit(message='log message for r2')
|
||||
+
|
||||
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
|
||||
+ # Remove svn:date and svn:author for predictable output.
|
||||
+ svntest.actions.run_and_verify_svn(None, [], 'propdel', '--revprop',
|
||||
+ '-r2', 'svn:date', sbox.repo_url)
|
||||
+ svntest.actions.run_and_verify_svn(None, [], 'propdel', '--revprop',
|
||||
+ '-r2', 'svn:author', sbox.repo_url)
|
||||
+
|
||||
+ write_restrictive_svnserve_conf(sbox.repo_dir)
|
||||
+
|
||||
+ # First test with blanket access.
|
||||
+ write_authz_file(sbox,
|
||||
+ {"/" : "* = rw"})
|
||||
+ expected_output = svntest.verify.ExpectedOutput([
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ "r2 | (no author) | (no date) | 1 line\n",
|
||||
+ "Changed paths:\n",
|
||||
+ " A /public (from /private:1)\n",
|
||||
+ "\n",
|
||||
+ "log message for r2\n",
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ ])
|
||||
+ svntest.actions.run_and_verify_svn(expected_output, [],
|
||||
+ 'log', '-r2', '-v',
|
||||
+ sbox.repo_url)
|
||||
+
|
||||
+ # Now test with an inaccessible copy source (/private).
|
||||
+ write_authz_file(sbox,
|
||||
+ {"/" : "* = rw"},
|
||||
+ {"/private" : "* ="})
|
||||
+ expected_output = svntest.verify.ExpectedOutput([
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ "r2 | (no author) | (no date) | 1 line\n",
|
||||
+ "Changed paths:\n",
|
||||
+ # The copy is shown as a plain add with no copyfrom info.
|
||||
+ " A /public\n",
|
||||
+ "\n",
|
||||
+ # No log message, as the revision is only partially visible.
|
||||
+ "\n",
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ ])
|
||||
+ svntest.actions.run_and_verify_svn(expected_output, [],
|
||||
+ 'log', '-r2', '-v',
|
||||
+ sbox.repo_url)
|
||||
+
|
||||
|
||||
########################################################################
|
||||
# Run the tests
|
||||
@@ -1771,6 +1825,7 @@ def empty_group(sbox):
|
||||
inverted_group_membership,
|
||||
group_member_empty_string,
|
||||
empty_group,
|
||||
+ log_inaccessible_copyfrom,
|
||||
]
|
||||
serial_only = True
|
||||
|
||||
@@ -13,6 +13,7 @@ SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
|
||||
file://0001-Fix-libtool-name-in-configure.ac.patch \
|
||||
file://serfmacro.patch \
|
||||
file://CVE-2020-17525.patch \
|
||||
file://CVE-2021-28544.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "3004b4dae18bf45a0b6ea4ef8820064d"
|
||||
|
||||
183
meta/recipes-extended/libarchive/libarchive/CVE-2021-23177.patch
Normal file
183
meta/recipes-extended/libarchive/libarchive/CVE-2021-23177.patch
Normal file
@@ -0,0 +1,183 @@
|
||||
Description: Fix handling of symbolic link ACLs
|
||||
Published as CVE-2021-23177
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/fba4f123cc456d2b2538f811bb831483bf336bad
|
||||
Bug-Debian: https://bugs.debian.org/1001986
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Updated: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-23177
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/libarchive/archive_disk_acl_freebsd.c
|
||||
+++ b/libarchive/archive_disk_acl_freebsd.c
|
||||
@@ -319,7 +319,7 @@
|
||||
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
int acl_type = 0;
|
||||
@@ -364,6 +364,13 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
|
||||
+ errno = EINVAL;
|
||||
+ archive_set_error(a, errno,
|
||||
+ "Cannot set default ACL on non-directory");
|
||||
+ return (ARCHIVE_WARN);
|
||||
+ }
|
||||
+
|
||||
acl = acl_init(entries);
|
||||
if (acl == (acl_t)NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -542,7 +549,10 @@
|
||||
else if (acl_set_link_np(name, acl_type, acl) != 0)
|
||||
#else
|
||||
/* FreeBSD older than 8.0 */
|
||||
- else if (acl_set_file(name, acl_type, acl) != 0)
|
||||
+ else if (S_ISLNK(mode)) {
|
||||
+ /* acl_set_file() follows symbolic links, skip */
|
||||
+ ret = ARCHIVE_OK;
|
||||
+ } else if (acl_set_file(name, acl_type, acl) != 0)
|
||||
#endif
|
||||
{
|
||||
if (errno == EOPNOTSUPP) {
|
||||
@@ -677,14 +687,14 @@
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
|
||||
if (ret != ARCHIVE_OK)
|
||||
return (ret);
|
||||
}
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
|
||||
|
||||
/* Simultaneous POSIX.1e and NFSv4 is not supported */
|
||||
@@ -693,7 +703,7 @@
|
||||
#if ARCHIVE_ACL_FREEBSD_NFS4
|
||||
else if ((archive_acl_types(abstract_acl) &
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
|
||||
}
|
||||
#endif
|
||||
--- a/libarchive/archive_disk_acl_linux.c
|
||||
+++ b/libarchive/archive_disk_acl_linux.c
|
||||
@@ -343,6 +343,11 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Linux does not support RichACLs on symbolic links */
|
||||
+ return (ARCHIVE_OK);
|
||||
+ }
|
||||
+
|
||||
richacl = richacl_alloc(entries);
|
||||
if (richacl == NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -455,7 +460,7 @@
|
||||
#if ARCHIVE_ACL_LIBACL
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
int acl_type = 0;
|
||||
@@ -488,6 +493,18 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Linux does not support ACLs on symbolic links */
|
||||
+ return (ARCHIVE_OK);
|
||||
+ }
|
||||
+
|
||||
+ if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
|
||||
+ errno = EINVAL;
|
||||
+ archive_set_error(a, errno,
|
||||
+ "Cannot set default ACL on non-directory");
|
||||
+ return (ARCHIVE_WARN);
|
||||
+ }
|
||||
+
|
||||
acl = acl_init(entries);
|
||||
if (acl == (acl_t)NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -727,14 +744,14 @@
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
|
||||
if (ret != ARCHIVE_OK)
|
||||
return (ret);
|
||||
}
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
|
||||
}
|
||||
#endif /* ARCHIVE_ACL_LIBACL */
|
||||
--- a/libarchive/archive_disk_acl_sunos.c
|
||||
+++ b/libarchive/archive_disk_acl_sunos.c
|
||||
@@ -443,7 +443,7 @@
|
||||
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
aclent_t *aclent;
|
||||
@@ -467,7 +467,6 @@
|
||||
if (entries == 0)
|
||||
return (ARCHIVE_OK);
|
||||
|
||||
-
|
||||
switch (ae_requested_type) {
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
|
||||
cmd = SETACL;
|
||||
@@ -492,6 +491,12 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Skip ACLs on symbolic links */
|
||||
+ ret = ARCHIVE_OK;
|
||||
+ goto exit_free;
|
||||
+ }
|
||||
+
|
||||
e = 0;
|
||||
|
||||
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
|
||||
@@ -801,7 +806,7 @@
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
/* Solaris writes POSIX.1e access and default ACLs together */
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");
|
||||
|
||||
/* Simultaneous POSIX.1e and NFSv4 is not supported */
|
||||
@@ -810,7 +815,7 @@
|
||||
#if ARCHIVE_ACL_SUNOS_NFS4
|
||||
else if ((archive_acl_types(abstract_acl) &
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
Description: Never follow symlinks when setting file flags on Linux
|
||||
Published as CVE-2021-31566
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/e2ad1a2c3064fa9eba6274b3641c4c1beed25c0b
|
||||
Bug-Debian: https://bugs.debian.org/1001990
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Update: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-31566
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/libarchive/archive_write_disk_posix.c
|
||||
+++ b/libarchive/archive_write_disk_posix.c
|
||||
@@ -3927,7 +3927,8 @@
|
||||
|
||||
/* If we weren't given an fd, open it ourselves. */
|
||||
if (myfd < 0) {
|
||||
- myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY | O_CLOEXEC);
|
||||
+ myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY |
|
||||
+ O_CLOEXEC | O_NOFOLLOW);
|
||||
__archive_ensure_cloexec_flag(myfd);
|
||||
}
|
||||
if (myfd < 0)
|
||||
@@ -0,0 +1,172 @@
|
||||
Description: Do not follow symlinks when processing the fixup list
|
||||
Published as CVE-2021-31566
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/b41daecb5ccb4c8e3b2c53fd6147109fc12c3043
|
||||
Bug-Debian: https://bugs.debian.org/1001990
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Update: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-31566
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -556,6 +556,7 @@
|
||||
libarchive/test/test_write_disk.c \
|
||||
libarchive/test/test_write_disk_appledouble.c \
|
||||
libarchive/test/test_write_disk_failures.c \
|
||||
+ libarchive/test/test_write_disk_fixup.c \
|
||||
libarchive/test/test_write_disk_hardlink.c \
|
||||
libarchive/test/test_write_disk_hfs_compression.c \
|
||||
libarchive/test/test_write_disk_lookup.c \
|
||||
--- a/libarchive/archive_write_disk_posix.c
|
||||
+++ b/libarchive/archive_write_disk_posix.c
|
||||
@@ -2461,6 +2461,7 @@
|
||||
{
|
||||
struct archive_write_disk *a = (struct archive_write_disk *)_a;
|
||||
struct fixup_entry *next, *p;
|
||||
+ struct stat st;
|
||||
int fd, ret;
|
||||
|
||||
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
|
||||
@@ -2478,6 +2479,20 @@
|
||||
(TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) {
|
||||
fd = open(p->name,
|
||||
O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC);
|
||||
+ if (fd == -1) {
|
||||
+ /* If we cannot lstat, skip entry */
|
||||
+ if (lstat(p->name, &st) != 0)
|
||||
+ goto skip_fixup_entry;
|
||||
+ /*
|
||||
+ * If we deal with a symbolic link, mark
|
||||
+ * it in the fixup mode to ensure no
|
||||
+ * modifications are made to its target.
|
||||
+ */
|
||||
+ if (S_ISLNK(st.st_mode)) {
|
||||
+ p->mode &= ~S_IFMT;
|
||||
+ p->mode |= S_IFLNK;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
if (p->fixup & TODO_TIMES) {
|
||||
set_times(a, fd, p->mode, p->name,
|
||||
@@ -2492,7 +2507,12 @@
|
||||
fchmod(fd, p->mode);
|
||||
else
|
||||
#endif
|
||||
- chmod(p->name, p->mode);
|
||||
+#ifdef HAVE_LCHMOD
|
||||
+ lchmod(p->name, p->mode);
|
||||
+#else
|
||||
+ if (!S_ISLNK(p->mode))
|
||||
+ chmod(p->name, p->mode);
|
||||
+#endif
|
||||
}
|
||||
if (p->fixup & TODO_ACLS)
|
||||
archive_write_disk_set_acls(&a->archive, fd,
|
||||
@@ -2503,6 +2523,7 @@
|
||||
if (p->fixup & TODO_MAC_METADATA)
|
||||
set_mac_metadata(a, p->name, p->mac_metadata,
|
||||
p->mac_metadata_size);
|
||||
+skip_fixup_entry:
|
||||
next = p->next;
|
||||
archive_acl_clear(&p->acl);
|
||||
free(p->mac_metadata);
|
||||
@@ -2643,6 +2664,7 @@
|
||||
fe->next = a->fixup_list;
|
||||
a->fixup_list = fe;
|
||||
fe->fixup = 0;
|
||||
+ fe->mode = 0;
|
||||
fe->name = strdup(pathname);
|
||||
return (fe);
|
||||
}
|
||||
--- a/libarchive/test/CMakeLists.txt
|
||||
+++ b/libarchive/test/CMakeLists.txt
|
||||
@@ -208,6 +208,7 @@
|
||||
test_write_disk.c
|
||||
test_write_disk_appledouble.c
|
||||
test_write_disk_failures.c
|
||||
+ test_write_disk_fixup.c
|
||||
test_write_disk_hardlink.c
|
||||
test_write_disk_hfs_compression.c
|
||||
test_write_disk_lookup.c
|
||||
--- /dev/null
|
||||
+++ b/libarchive/test/test_write_disk_fixup.c
|
||||
@@ -0,0 +1,77 @@
|
||||
+/*-
|
||||
+ * Copyright (c) 2021 Martin Matuska
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+#include "test.h"
|
||||
+
|
||||
+/*
|
||||
+ * Test fixup entries don't follow symlinks
|
||||
+ */
|
||||
+DEFINE_TEST(test_write_disk_fixup)
|
||||
+{
|
||||
+ struct archive *ad;
|
||||
+ struct archive_entry *ae;
|
||||
+ int r;
|
||||
+
|
||||
+ if (!canSymlink()) {
|
||||
+ skipping("Symlinks not supported");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Write entries to disk. */
|
||||
+ assert((ad = archive_write_disk_new()) != NULL);
|
||||
+
|
||||
+ /*
|
||||
+ * Create a file
|
||||
+ */
|
||||
+ assertMakeFile("victim", 0600, "a");
|
||||
+
|
||||
+ /*
|
||||
+ * Create a directory and a symlink with the same name
|
||||
+ */
|
||||
+
|
||||
+ /* Directory: dir */
|
||||
+ assert((ae = archive_entry_new()) != NULL);
|
||||
+ archive_entry_copy_pathname(ae, "dir");
|
||||
+ archive_entry_set_mode(ae, AE_IFDIR | 0606);
|
||||
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
|
||||
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
|
||||
+ archive_entry_free(ae);
|
||||
+
|
||||
+ /* Symbolic Link: dir -> foo */
|
||||
+ assert((ae = archive_entry_new()) != NULL);
|
||||
+ archive_entry_copy_pathname(ae, "dir");
|
||||
+ archive_entry_set_mode(ae, AE_IFLNK | 0777);
|
||||
+ archive_entry_set_size(ae, 0);
|
||||
+ archive_entry_copy_symlink(ae, "victim");
|
||||
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
|
||||
+ if (r >= ARCHIVE_WARN)
|
||||
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
|
||||
+ archive_entry_free(ae);
|
||||
+
|
||||
+ assertEqualInt(ARCHIVE_OK, archive_write_free(ad));
|
||||
+
|
||||
+ /* Test the entries on disk. */
|
||||
+ assertIsSymlink("dir", "victim", 0);
|
||||
+ assertFileMode("victim", 0600);
|
||||
+}
|
||||
@@ -36,6 +36,9 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
|
||||
file://CVE-2021-36976-1.patch \
|
||||
file://CVE-2021-36976-2.patch \
|
||||
file://CVE-2021-36976-3.patch \
|
||||
file://CVE-2021-23177.patch \
|
||||
file://CVE-2021-31566-01.patch \
|
||||
file://CVE-2021-31566-02.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d953ed6b47694dadf0e6042f8f9ff451"
|
||||
|
||||
155
meta/recipes-extended/libtirpc/libtirpc/CVE-2021-46828.patch
Normal file
155
meta/recipes-extended/libtirpc/libtirpc/CVE-2021-46828.patch
Normal file
@@ -0,0 +1,155 @@
|
||||
From 48309e7cb230fc539c3edab0b3363f8ce973194f Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 28 Jul 2022 09:11:04 +0530
|
||||
Subject: [PATCH] CVE-2021-46828
|
||||
|
||||
Upstream-Status: Backport [http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=86529758570cef4c73fb9b9c4104fdc510f701ed}
|
||||
CVE: CVE-2021-46828
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/svc.c | 17 +++++++++++++-
|
||||
src/svc_vc.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 77 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/svc.c b/src/svc.c
|
||||
index 6db164b..3a8709f 100644
|
||||
--- a/src/svc.c
|
||||
+++ b/src/svc.c
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#define max(a, b) (a > b ? a : b)
|
||||
|
||||
-static SVCXPRT **__svc_xports;
|
||||
+SVCXPRT **__svc_xports;
|
||||
int __svc_maxrec;
|
||||
|
||||
/*
|
||||
@@ -194,6 +194,21 @@ __xprt_do_unregister (xprt, dolock)
|
||||
rwlock_unlock (&svc_fd_lock);
|
||||
}
|
||||
|
||||
+int
|
||||
+svc_open_fds()
|
||||
+{
|
||||
+ int ix;
|
||||
+ int nfds = 0;
|
||||
+
|
||||
+ rwlock_rdlock (&svc_fd_lock);
|
||||
+ for (ix = 0; ix < svc_max_pollfd; ++ix) {
|
||||
+ if (svc_pollfd[ix].fd != -1)
|
||||
+ nfds++;
|
||||
+ }
|
||||
+ rwlock_unlock (&svc_fd_lock);
|
||||
+ return (nfds);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Add a service program to the callout list.
|
||||
* The dispatch routine will be called when a rpc request for this
|
||||
diff --git a/src/svc_vc.c b/src/svc_vc.c
|
||||
index c23cd36..1729963 100644
|
||||
--- a/src/svc_vc.c
|
||||
+++ b/src/svc_vc.c
|
||||
@@ -64,6 +64,8 @@
|
||||
|
||||
|
||||
extern rwlock_t svc_fd_lock;
|
||||
+extern SVCXPRT **__svc_xports;
|
||||
+extern int svc_open_fds();
|
||||
|
||||
static SVCXPRT *makefd_xprt(int, u_int, u_int);
|
||||
static bool_t rendezvous_request(SVCXPRT *, struct rpc_msg *);
|
||||
@@ -82,6 +84,7 @@ static void svc_vc_ops(SVCXPRT *);
|
||||
static bool_t svc_vc_control(SVCXPRT *xprt, const u_int rq, void *in);
|
||||
static bool_t svc_vc_rendezvous_control (SVCXPRT *xprt, const u_int rq,
|
||||
void *in);
|
||||
+static int __svc_destroy_idle(int timeout);
|
||||
|
||||
struct cf_rendezvous { /* kept in xprt->xp_p1 for rendezvouser */
|
||||
u_int sendsize;
|
||||
@@ -312,13 +315,14 @@ done:
|
||||
return (xprt);
|
||||
}
|
||||
|
||||
+
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
rendezvous_request(xprt, msg)
|
||||
SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
- int sock, flags;
|
||||
+ int sock, flags, nfds, cnt;
|
||||
struct cf_rendezvous *r;
|
||||
struct cf_conn *cd;
|
||||
struct sockaddr_storage addr;
|
||||
@@ -378,6 +382,16 @@ again:
|
||||
|
||||
gettimeofday(&cd->last_recv_time, NULL);
|
||||
|
||||
+ nfds = svc_open_fds();
|
||||
+ if (nfds >= (_rpc_dtablesize() / 5) * 4) {
|
||||
+ /* destroy idle connections */
|
||||
+ cnt = __svc_destroy_idle(15);
|
||||
+ if (cnt == 0) {
|
||||
+ /* destroy least active */
|
||||
+ __svc_destroy_idle(0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return (FALSE); /* there is never an rpc msg to be processed */
|
||||
}
|
||||
|
||||
@@ -819,3 +833,49 @@ __svc_clean_idle(fd_set *fds, int timeout, bool_t cleanblock)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
+
|
||||
+static int
|
||||
+__svc_destroy_idle(int timeout)
|
||||
+{
|
||||
+ int i, ncleaned = 0;
|
||||
+ SVCXPRT *xprt, *least_active;
|
||||
+ struct timeval tv, tdiff, tmax;
|
||||
+ struct cf_conn *cd;
|
||||
+
|
||||
+ gettimeofday(&tv, NULL);
|
||||
+ tmax.tv_sec = tmax.tv_usec = 0;
|
||||
+ least_active = NULL;
|
||||
+ rwlock_wrlock(&svc_fd_lock);
|
||||
+
|
||||
+ for (i = 0; i <= svc_max_pollfd; i++) {
|
||||
+ if (svc_pollfd[i].fd == -1)
|
||||
+ continue;
|
||||
+ xprt = __svc_xports[i];
|
||||
+ if (xprt == NULL || xprt->xp_ops == NULL ||
|
||||
+ xprt->xp_ops->xp_recv != svc_vc_recv)
|
||||
+ continue;
|
||||
+ cd = (struct cf_conn *)xprt->xp_p1;
|
||||
+ if (!cd->nonblock)
|
||||
+ continue;
|
||||
+ if (timeout == 0) {
|
||||
+ timersub(&tv, &cd->last_recv_time, &tdiff);
|
||||
+ if (timercmp(&tdiff, &tmax, >)) {
|
||||
+ tmax = tdiff;
|
||||
+ least_active = xprt;
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (tv.tv_sec - cd->last_recv_time.tv_sec > timeout) {
|
||||
+ __xprt_unregister_unlocked(xprt);
|
||||
+ __svc_vc_dodestroy(xprt);
|
||||
+ ncleaned++;
|
||||
+ }
|
||||
+ }
|
||||
+ if (timeout == 0 && least_active != NULL) {
|
||||
+ __xprt_unregister_unlocked(least_active);
|
||||
+ __svc_vc_dodestroy(least_active);
|
||||
+ ncleaned++;
|
||||
+ }
|
||||
+ rwlock_unlock(&svc_fd_lock);
|
||||
+ return (ncleaned);
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -9,7 +9,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=f835cce8852481e4b2bbbdd23b5e47f3 \
|
||||
|
||||
PROVIDES = "virtual/librpc"
|
||||
|
||||
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2"
|
||||
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2 \
|
||||
file://CVE-2021-46828.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/libtirpc/files/libtirpc/"
|
||||
UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
|
||||
SRC_URI[md5sum] = "b25f9cc18bfad50f7c446c77f4ae00bb"
|
||||
|
||||
@@ -6,7 +6,7 @@ SECTION = "base"
|
||||
LICENSE = "PD & BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba"
|
||||
|
||||
PV = "2022a"
|
||||
PV = "2022c"
|
||||
|
||||
SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \
|
||||
http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \
|
||||
@@ -14,6 +14,6 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz
|
||||
|
||||
UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
|
||||
|
||||
SRC_URI[tzcode.sha256sum] = "f8575e7e33be9ee265df2081092526b81c80abac3f4a04399ae9d4d91cdadac7"
|
||||
SRC_URI[tzdata.sha256sum] = "ef7fffd9f4f50f4f58328b35022a32a5a056b245c5cb3d6791dddb342f871664"
|
||||
SRC_URI[tzcode.sha256sum] = "3e7ce1f3620cc0481907c7e074d69910793285bffe0ca331ef1a6d1ae3ea90cc"
|
||||
SRC_URI[tzdata.sha256sum] = "6974f4e348bf2323274b56dff9e7500247e3159eaa4b485dfa0cd66e75c14bfe"
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
From bdf3a2630c02a63803309cf0ad4b274234c814ce Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Tue, 9 Aug 2022 09:45:42 +0530
|
||||
Subject: [PATCH] CVE-2021-46829
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/commit/5398f04d772f7f8baf5265715696ed88db0f0512]
|
||||
CVE: CVE-2021-46829
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
gdk-pixbuf/io-gif-animation.c | 21 +++++++++++++--------
|
||||
1 file changed, 13 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
|
||||
index d742963..9544391 100644
|
||||
--- a/gdk-pixbuf/io-gif-animation.c
|
||||
+++ b/gdk-pixbuf/io-gif-animation.c
|
||||
@@ -364,7 +364,7 @@ composite_frame (GdkPixbufGifAnim *anim, GdkPixbufFrame *frame)
|
||||
for (i = 0; i < n_indexes; i++) {
|
||||
guint8 index = index_buffer[i];
|
||||
guint x, y;
|
||||
- int offset;
|
||||
+ gsize offset;
|
||||
|
||||
if (index == frame->transparent_index)
|
||||
continue;
|
||||
@@ -374,11 +374,13 @@ composite_frame (GdkPixbufGifAnim *anim, GdkPixbufFrame *frame)
|
||||
if (x >= anim->width || y >= anim->height)
|
||||
continue;
|
||||
|
||||
- offset = y * gdk_pixbuf_get_rowstride (anim->last_frame_data) + x * 4;
|
||||
- pixels[offset + 0] = frame->color_map[index * 3 + 0];
|
||||
- pixels[offset + 1] = frame->color_map[index * 3 + 1];
|
||||
- pixels[offset + 2] = frame->color_map[index * 3 + 2];
|
||||
- pixels[offset + 3] = 255;
|
||||
+ if (g_size_checked_mul (&offset, gdk_pixbuf_get_rowstride (anim->last_frame_data), y) &&
|
||||
+ g_size_checked_add (&offset, offset, x * 4)) {
|
||||
+ pixels[offset + 0] = frame->color_map[index * 3 + 0];
|
||||
+ pixels[offset + 1] = frame->color_map[index * 3 + 1];
|
||||
+ pixels[offset + 2] = frame->color_map[index * 3 + 2];
|
||||
+ pixels[offset + 3] = 255;
|
||||
+ }
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -443,8 +445,11 @@ gdk_pixbuf_gif_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
|
||||
x_end = MIN (anim->last_frame->x_offset + anim->last_frame->width, anim->width);
|
||||
y_end = MIN (anim->last_frame->y_offset + anim->last_frame->height, anim->height);
|
||||
for (y = anim->last_frame->y_offset; y < y_end; y++) {
|
||||
- guchar *line = pixels + y * gdk_pixbuf_get_rowstride (anim->last_frame_data) + anim->last_frame->x_offset * 4;
|
||||
- memset (line, 0, (x_end - anim->last_frame->x_offset) * 4);
|
||||
+ gsize offset;
|
||||
+ if (g_size_checked_mul (&offset, gdk_pixbuf_get_rowstride (anim->last_frame_data), y) &&
|
||||
+ g_size_checked_add (&offset, offset, anim->last_frame->x_offset * 4)) {
|
||||
+ memset (pixels + offset, 0, (x_end - anim->last_frame->x_offset) * 4);
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case GDK_PIXBUF_FRAME_REVERT:
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -26,6 +26,7 @@ SRC_URI = "${GNOME_MIRROR}/${BPN}/${MAJ_VER}/${BPN}-${PV}.tar.xz \
|
||||
file://missing-test-data.patch \
|
||||
file://CVE-2020-29385.patch \
|
||||
file://CVE-2021-20240.patch \
|
||||
file://CVE-2021-46829.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-target = " \
|
||||
|
||||
133
meta/recipes-graphics/jpeg/files/CVE-2021-46822.patch
Normal file
133
meta/recipes-graphics/jpeg/files/CVE-2021-46822.patch
Normal file
@@ -0,0 +1,133 @@
|
||||
From f35fd27ec641c42d6b115bfa595e483ec58188d2 Mon Sep 17 00:00:00 2001
|
||||
From: DRC <information@libjpeg-turbo.org>
|
||||
Date: Tue, 6 Apr 2021 12:51:03 -0500
|
||||
Subject: [PATCH] tjLoadImage: Fix issues w/loading 16-bit PPMs/PGMs
|
||||
|
||||
- The PPM reader now throws an error rather than segfaulting (due to a
|
||||
buffer overrun) if an application attempts to load a 16-bit PPM file
|
||||
into a grayscale uncompressed image buffer. No known applications
|
||||
allowed that (not even the test applications in libjpeg-turbo),
|
||||
because that mode of operation was never expected to work and did not
|
||||
work under any circumstances. (In fact, it was necessary to modify
|
||||
TJBench in order to reproduce the issue outside of a fuzzing
|
||||
environment.) This was purely a matter of making the library bow out
|
||||
gracefully rather than crash if an application tries to do something
|
||||
really stupid.
|
||||
|
||||
- The PPM reader now throws an error rather than generating incorrect
|
||||
pixels if an application attempts to load a 16-bit PGM file into an
|
||||
RGB uncompressed image buffer.
|
||||
|
||||
- The PPM reader now correctly loads 16-bit PPM files into extended
|
||||
RGB uncompressed image buffers. (Previously it generated incorrect
|
||||
pixels unless the input colorspace was JCS_RGB or JCS_EXT_RGB.)
|
||||
|
||||
The only way that users could have potentially encountered these issues
|
||||
was through the tjLoadImage() function. cjpeg and TJBench were
|
||||
unaffected.
|
||||
|
||||
CVE: CVE-2021-46822
|
||||
Upstream-Status: Backport [https://github.com/libjpeg-turbo/libjpeg-turbo/commit/f35fd27ec641c42d6b115bfa595e483ec58188d2.patch]
|
||||
Comment: Refreshed hunks from ChangeLog.md
|
||||
Refreshed hunks from rdppm.c
|
||||
|
||||
Signed-off-by: Bhabu Bindu <bhabu.bindu@kpit.com>
|
||||
|
||||
---
|
||||
ChangeLog.md | 10 ++++++++++
|
||||
rdppm.c | 26 ++++++++++++++++++++------
|
||||
2 files changed, 30 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
||||
index 968969c6b..12e730a0e 100644
|
||||
--- a/ChangeLog.md
|
||||
+++ b/ChangeLog.md
|
||||
@@ -44,6 +44,15 @@
|
||||
that maximum value was less than 255. libjpeg-turbo 1.5.0 already included a
|
||||
similar fix for binary PPM/PGM files with maximum values greater than 255.
|
||||
|
||||
+7. The PPM reader now throws an error, rather than segfaulting (due to a buffer
|
||||
+overrun) or generating incorrect pixels, if an application attempts to use the
|
||||
+`tjLoadImage()` function to load a 16-bit binary PPM file (a binary PPM file
|
||||
+with a maximum value greater than 255) into a grayscale image buffer or to load
|
||||
+a 16-bit binary PGM file into an RGB image buffer.
|
||||
+
|
||||
+8. Fixed an issue in the PPM reader that caused incorrect pixels to be
|
||||
+generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
|
||||
+file into an extended RGB image buffer.
|
||||
|
||||
2.0.3
|
||||
=====
|
||||
diff --git a/rdppm.c b/rdppm.c
|
||||
index c4c937e8a..6ac8fdbf7 100644
|
||||
--- a/rdppm.c
|
||||
+++ b/rdppm.c
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2009 by Bill Allombert, Guido Vollbeding.
|
||||
* libjpeg-turbo Modifications:
|
||||
- * Copyright (C) 2015-2017, 2020, D. R. Commander.
|
||||
+ * Copyright (C) 2015-2017, 2020-2021, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -516,6 +516,11 @@ get_word_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
register JSAMPLE *rescale = source->rescale;
|
||||
JDIMENSION col;
|
||||
unsigned int maxval = source->maxval;
|
||||
+ register int rindex = rgb_red[cinfo->in_color_space];
|
||||
+ register int gindex = rgb_green[cinfo->in_color_space];
|
||||
+ register int bindex = rgb_blue[cinfo->in_color_space];
|
||||
+ register int aindex = alpha_index[cinfo->in_color_space];
|
||||
+ register int ps = rgb_pixelsize[cinfo->in_color_space];
|
||||
|
||||
if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width))
|
||||
ERREXIT(cinfo, JERR_INPUT_EOF);
|
||||
@@ -527,17 +532,20 @@ get_word_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
temp |= UCH(*bufferptr++);
|
||||
if (temp > maxval)
|
||||
ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
|
||||
- *ptr++ = rescale[temp];
|
||||
+ ptr[rindex] = rescale[temp];
|
||||
temp = UCH(*bufferptr++) << 8;
|
||||
temp |= UCH(*bufferptr++);
|
||||
if (temp > maxval)
|
||||
ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
|
||||
- *ptr++ = rescale[temp];
|
||||
+ ptr[gindex] = rescale[temp];
|
||||
temp = UCH(*bufferptr++) << 8;
|
||||
temp |= UCH(*bufferptr++);
|
||||
if (temp > maxval)
|
||||
ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
|
||||
- *ptr++ = rescale[temp];
|
||||
+ ptr[bindex] = rescale[temp];
|
||||
+ if (aindex >= 0)
|
||||
+ ptr[aindex] = 0xFF;
|
||||
+ ptr += ps;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -624,7 +632,10 @@ start_input_ppm(j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
|
||||
cinfo->in_color_space = JCS_GRAYSCALE;
|
||||
TRACEMS2(cinfo, 1, JTRC_PGM, w, h);
|
||||
if (maxval > 255) {
|
||||
- source->pub.get_pixel_rows = get_word_gray_row;
|
||||
+ if (cinfo->in_color_space == JCS_GRAYSCALE)
|
||||
+ source->pub.get_pixel_rows = get_word_gray_row;
|
||||
+ else
|
||||
+ ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
} else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&
|
||||
cinfo->in_color_space == JCS_GRAYSCALE) {
|
||||
source->pub.get_pixel_rows = get_raw_row;
|
||||
@@ -657,7 +657,10 @@
|
||||
cinfo->in_color_space = JCS_EXT_RGB;
|
||||
TRACEMS2(cinfo, 1, JTRC_PPM, w, h);
|
||||
if (maxval > 255) {
|
||||
- source->pub.get_pixel_rows = get_word_rgb_row;
|
||||
+ if (IsExtRGB(cinfo->in_color_space))
|
||||
+ source->pub.get_pixel_rows = get_word_rgb_row;
|
||||
+ else
|
||||
+ ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
|
||||
} else if (maxval == MAXJSAMPLE && sizeof(JSAMPLE) == sizeof(U_CHAR) &&
|
||||
(cinfo->in_color_space == JCS_EXT_RGB
|
||||
#if RGB_RED == 0 && RGB_GREEN == 1 && RGB_BLUE == 2 && RGB_PIXELSIZE == 3
|
||||
@@ -13,6 +13,7 @@ DEPENDS_append_x86_class-target = " nasm-native"
|
||||
SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
|
||||
file://0001-libjpeg-turbo-fix-package_qa-error.patch \
|
||||
file://CVE-2020-13790.patch \
|
||||
file://CVE-2021-46822.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d01d9e0c28c27bc0de9f4e2e8ff49855"
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
From 95e581fd181b213c2ed7cdc63f2abc03eaaa77ec Mon Sep 17 00:00:00 2001
|
||||
From: Gert Wollny <gert.wollny@collabora.com>
|
||||
Date: Tue, 30 Nov 2021 10:17:26 +0100
|
||||
Subject: [PATCH] vrend: Add test to resource OOB write and fix it
|
||||
|
||||
v2: Also check that no depth != 1 has been send when none is due
|
||||
|
||||
Closes: #250
|
||||
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
|
||||
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
|
||||
|
||||
https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/95e581fd181b213c2ed7cdc63f2abc03eaaa77ec
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-0135
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
src/vrend_renderer.c | 3 +++
|
||||
tests/test_fuzzer_formats.c | 43 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 46 insertions(+)
|
||||
|
||||
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
|
||||
index 28f669727..357b81b20 100644
|
||||
--- a/src/vrend_renderer.c
|
||||
+++ b/src/vrend_renderer.c
|
||||
@@ -7833,8 +7833,11 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
|
||||
info->box->height) * elsize;
|
||||
if (res->target == GL_TEXTURE_3D ||
|
||||
res->target == GL_TEXTURE_2D_ARRAY ||
|
||||
+ res->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
|
||||
res->target == GL_TEXTURE_CUBE_MAP_ARRAY)
|
||||
send_size *= info->box->depth;
|
||||
+ else if (need_temp && info->box->depth != 1)
|
||||
+ return EINVAL;
|
||||
|
||||
if (need_temp) {
|
||||
data = malloc(send_size);
|
||||
diff --git a/tests/test_fuzzer_formats.c b/tests/test_fuzzer_formats.c
|
||||
index 59d6fb671..2de9a9a3f 100644
|
||||
--- a/tests/test_fuzzer_formats.c
|
||||
+++ b/tests/test_fuzzer_formats.c
|
||||
@@ -957,6 +957,48 @@ static void test_vrend_set_signle_abo_heap_overflow() {
|
||||
virgl_renderer_submit_cmd((void *) cmd, ctx_id, 0xde);
|
||||
}
|
||||
|
||||
+/* Test adapted from yaojun8558363@gmail.com:
|
||||
+ * https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/250
|
||||
+*/
|
||||
+static void test_vrend_3d_resource_overflow() {
|
||||
+
|
||||
+ struct virgl_renderer_resource_create_args resource;
|
||||
+ resource.handle = 0x4c474572;
|
||||
+ resource.target = PIPE_TEXTURE_2D_ARRAY;
|
||||
+ resource.format = VIRGL_FORMAT_Z24X8_UNORM;
|
||||
+ resource.nr_samples = 2;
|
||||
+ resource.last_level = 0;
|
||||
+ resource.array_size = 3;
|
||||
+ resource.bind = VIRGL_BIND_SAMPLER_VIEW;
|
||||
+ resource.depth = 1;
|
||||
+ resource.width = 8;
|
||||
+ resource.height = 4;
|
||||
+ resource.flags = 0;
|
||||
+
|
||||
+ virgl_renderer_resource_create(&resource, NULL, 0);
|
||||
+ virgl_renderer_ctx_attach_resource(ctx_id, resource.handle);
|
||||
+
|
||||
+ uint32_t size = 0x400;
|
||||
+ uint32_t cmd[size];
|
||||
+ int i = 0;
|
||||
+ cmd[i++] = (size - 1) << 16 | 0 << 8 | VIRGL_CCMD_RESOURCE_INLINE_WRITE;
|
||||
+ cmd[i++] = resource.handle;
|
||||
+ cmd[i++] = 0; // level
|
||||
+ cmd[i++] = 0; // usage
|
||||
+ cmd[i++] = 0; // stride
|
||||
+ cmd[i++] = 0; // layer_stride
|
||||
+ cmd[i++] = 0; // x
|
||||
+ cmd[i++] = 0; // y
|
||||
+ cmd[i++] = 0; // z
|
||||
+ cmd[i++] = 8; // w
|
||||
+ cmd[i++] = 4; // h
|
||||
+ cmd[i++] = 3; // d
|
||||
+ memset(&cmd[i], 0, size - i);
|
||||
+
|
||||
+ virgl_renderer_submit_cmd((void *) cmd, ctx_id, size);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int main()
|
||||
{
|
||||
initialize_environment();
|
||||
@@ -979,6 +1021,7 @@ int main()
|
||||
test_cs_nullpointer_deference();
|
||||
test_vrend_set_signle_abo_heap_overflow();
|
||||
|
||||
+ test_vrend_3d_resource_overflow();
|
||||
|
||||
virgl_renderer_context_destroy(ctx_id);
|
||||
virgl_renderer_cleanup(&cookie);
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -13,6 +13,7 @@ SRCREV = "7d204f3927be65fb3365dce01dbcd04d447a4985"
|
||||
SRC_URI = "git://anongit.freedesktop.org/git/virglrenderer;branch=master \
|
||||
file://0001-gallium-Expand-libc-check-to-be-platform-OS-check.patch \
|
||||
file://0001-meson.build-use-python3-directly-for-python.patch \
|
||||
file://CVE-2022-0135.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
@@ -11,6 +11,7 @@ SRC_URI += " \
|
||||
file://0001-Disable-installing-header-file-provided-by-another-p.patch \
|
||||
file://0001-Fix-build-for-Linux-5.8-rc1.patch \
|
||||
file://0001-Fix-build-for-Linux-5.9-rc1.patch \
|
||||
file://fix-build-for-Linux-5.11-rc1.patch \
|
||||
"
|
||||
|
||||
EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user