mirror of
https://git.yoctoproject.org/poky
synced 2026-02-21 00:49:41 +01:00
Compare commits
142 Commits
yocto-3.1.
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa00730418 | ||
|
|
2b7d97af74 | ||
|
|
0711fd83cd | ||
|
|
b7420c15b3 | ||
|
|
f6f7f22992 | ||
|
|
a6aa9198ae | ||
|
|
ef1a755b3c | ||
|
|
c3c1224664 | ||
|
|
01cafb753b | ||
|
|
c0b9a560b7 | ||
|
|
308cefb86b | ||
|
|
9d340b5ed2 | ||
|
|
d86149ba65 | ||
|
|
93fa878377 | ||
|
|
213cf8004c | ||
|
|
b39245d723 | ||
|
|
21370990c6 | ||
|
|
4ddc26f4e4 | ||
|
|
50c5d5a788 | ||
|
|
6000f42a26 | ||
|
|
d143bac2a1 | ||
|
|
600261eafa | ||
|
|
5502d7326c | ||
|
|
32c25a0202 | ||
|
|
3903d753f9 | ||
|
|
eb8e26214e | ||
|
|
43a224f247 | ||
|
|
8ce85b6c6c | ||
|
|
bff6562223 | ||
|
|
3a7007cb35 | ||
|
|
b6df248293 | ||
|
|
e736037243 | ||
|
|
8e9e9263e3 | ||
|
|
2ea050d3fb | ||
|
|
29ae351d1d | ||
|
|
a83b2d8200 | ||
|
|
7bf5de9a3f | ||
|
|
1a9dac1b51 | ||
|
|
87ecc7cef6 | ||
|
|
e1f932366f | ||
|
|
17ecf62a19 | ||
|
|
f593a11bf5 | ||
|
|
90a6f6a110 | ||
|
|
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)
|
||||
|
||||
@@ -1750,7 +1750,7 @@ class GitShallowTest(FetcherTest):
|
||||
self.add_empty_file('bsub', cwd=smdir)
|
||||
|
||||
self.git('submodule init', cwd=self.srcdir)
|
||||
self.git('submodule add file://%s' % smdir, cwd=self.srcdir)
|
||||
self.git('-c protocol.file.allow=always submodule add file://%s' % smdir, cwd=self.srcdir)
|
||||
self.git('submodule update', cwd=self.srcdir)
|
||||
self.git('commit -m submodule -a', cwd=self.srcdir)
|
||||
|
||||
@@ -1782,7 +1782,7 @@ class GitShallowTest(FetcherTest):
|
||||
self.add_empty_file('bsub', cwd=smdir)
|
||||
|
||||
self.git('submodule init', cwd=self.srcdir)
|
||||
self.git('submodule add file://%s' % smdir, cwd=self.srcdir)
|
||||
self.git('-c protocol.file.allow=always submodule add file://%s' % smdir, cwd=self.srcdir)
|
||||
self.git('submodule update', cwd=self.srcdir)
|
||||
self.git('commit -m submodule -a', cwd=self.srcdir)
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -459,9 +461,16 @@ def lockfile(name, shared=False, retry=True, block=False):
|
||||
consider the possibility of sending a signal to the process to break
|
||||
out - at which point you want block=True rather than retry=True.
|
||||
"""
|
||||
basename = os.path.basename(name)
|
||||
if len(basename) > 255:
|
||||
root, ext = os.path.splitext(basename)
|
||||
basename = root[:255 - len(ext)] + ext
|
||||
|
||||
dirname = os.path.dirname(name)
|
||||
mkdirhier(dirname)
|
||||
|
||||
name = os.path.join(dirname, basename)
|
||||
|
||||
if not os.access(dirname, os.W_OK):
|
||||
logger.error("Unable to acquire lock '%s', directory is not writable",
|
||||
name)
|
||||
@@ -495,7 +504,7 @@ def lockfile(name, shared=False, retry=True, block=False):
|
||||
return lf
|
||||
lf.close()
|
||||
except OSError as e:
|
||||
if e.errno == errno.EACCES:
|
||||
if e.errno == errno.EACCES or e.errno == errno.ENAMETOOLONG:
|
||||
logger.error("Unable to acquire lock '%s', %s",
|
||||
e.strerror, name)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -2628,7 +2628,7 @@ Recipe Syntax
|
||||
Understanding recipe file syntax is important for writing recipes. The
|
||||
following list overviews the basic items that make up a BitBake recipe
|
||||
file. For more complete BitBake syntax descriptions, see the
|
||||
":doc:`bitbake-user-manual/bitbake-user-manual-metadata`"
|
||||
":doc:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata`"
|
||||
chapter of the BitBake User Manual.
|
||||
|
||||
- *Variable Assignments and Manipulations:* Variable assignments allow
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.18"
|
||||
DISTRO : "3.1.21"
|
||||
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.21"
|
||||
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.21"
|
||||
DOCCONF_VERSION : "3.1.21"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.18"
|
||||
POKYVERSION : "23.0.21"
|
||||
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.21"
|
||||
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
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ python () {
|
||||
if externalsrcbuild:
|
||||
d.setVar('B', externalsrcbuild)
|
||||
else:
|
||||
d.setVar('B', '${WORKDIR}/${BPN}-${PV}/')
|
||||
d.setVar('B', '${WORKDIR}/${BPN}-${PV}')
|
||||
|
||||
local_srcuri = []
|
||||
fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
|
||||
@@ -207,8 +207,8 @@ def srctree_hash_files(d, srcdir=None):
|
||||
try:
|
||||
git_dir = os.path.join(s_dir,
|
||||
subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
|
||||
top_git_dir = os.path.join(s_dir, subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'],
|
||||
stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
|
||||
top_git_dir = os.path.join(d.getVar("TOPDIR"),
|
||||
subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip())
|
||||
if git_dir == top_git_dir:
|
||||
git_dir = None
|
||||
except subprocess.CalledProcessError:
|
||||
@@ -225,15 +225,16 @@ def srctree_hash_files(d, srcdir=None):
|
||||
env['GIT_INDEX_FILE'] = tmp_index.name
|
||||
subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
|
||||
git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
|
||||
submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8")
|
||||
for line in submodule_helper.splitlines():
|
||||
module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
|
||||
if os.path.isdir(module_dir):
|
||||
proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
proc.communicate()
|
||||
proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
stdout, _ = proc.communicate()
|
||||
git_sha1 += stdout.decode("utf-8")
|
||||
if os.path.exists(".gitmodules"):
|
||||
submodule_helper = subprocess.check_output(["git", "config", "--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, env=env).decode("utf-8")
|
||||
for line in submodule_helper.splitlines():
|
||||
module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
|
||||
if os.path.isdir(module_dir):
|
||||
proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
proc.communicate()
|
||||
proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||
stdout, _ = proc.communicate()
|
||||
git_sha1 += stdout.decode("utf-8")
|
||||
sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
|
||||
with open(oe_hash_file, 'w') as fobj:
|
||||
fobj.write(sha1)
|
||||
|
||||
@@ -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,12 @@ FIT_HASH_ALG ?= "sha256"
|
||||
# fitImage Signature Algo
|
||||
FIT_SIGN_ALG ?= "rsa2048"
|
||||
|
||||
# fitImage Padding Algo
|
||||
FIT_PAD_ALG ?= "pkcs-1.5"
|
||||
|
||||
# Arguments passed to mkimage for signing
|
||||
UBOOT_MKIMAGE_SIGN_ARGS ?= ""
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS header
|
||||
#
|
||||
@@ -250,6 +256,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 +340,7 @@ EOF
|
||||
signature-1 {
|
||||
algo = "${conf_csum},${conf_sign_algo}";
|
||||
key-name-hint = "${conf_sign_keyname}";
|
||||
padding = "${conf_padding_algo}";
|
||||
${sign_line}
|
||||
};
|
||||
EOF
|
||||
@@ -474,7 +482,8 @@ fitimage_assemble() {
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
-F -k "${UBOOT_SIGN_KEYDIR}" \
|
||||
$add_key_to_u_boot \
|
||||
-r arch/${ARCH}/boot/${2}
|
||||
-r arch/${ARCH}/boot/${2} \
|
||||
${UBOOT_MKIMAGE_SIGN_ARGS}
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -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)"
|
||||
|
||||
|
||||
@@ -561,6 +561,14 @@ def check_tar_version(sanity_data):
|
||||
version = result.split()[3]
|
||||
if LooseVersion(version) < LooseVersion("1.28"):
|
||||
return "Your version of tar is older than 1.28 and does not have the support needed to enable reproducible builds. Please install a newer version of tar (you could use the project's buildtools-tarball from our last release or use scripts/install-buildtools).\n"
|
||||
|
||||
try:
|
||||
result = subprocess.check_output(["tar", "--help"], stderr=subprocess.STDOUT).decode('utf-8')
|
||||
if "--xattrs" not in result:
|
||||
return "Your tar doesn't support --xattrs, please use GNU tar.\n"
|
||||
except subprocess.CalledProcessError as e:
|
||||
return "Unable to execute tar --help, exit code %d\n%s\n" % (e.returncode, e.output)
|
||||
|
||||
return None
|
||||
|
||||
# We use git parameters and functionality only found in 1.7.8 or later
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
# to the distro running on the build machine.
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.35"
|
||||
UNINATIVE_VERSION = "3.6"
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.36"
|
||||
UNINATIVE_VERSION = "3.7"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "d64831cf2792c8e470c2e42230660e1a8e5de56a579cdd59978791f663c2f3ed"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "2f0ee9b66b1bb2c85e2b592fb3c9c7f5d77399fa638d74961330cdb8de34ca3b"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "9bfc4c970495b3716b2f9e52c4df9f968c02463a9a95000f6657fbc3fde1f098"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "6a29bcae4b5b716d2d520e18800b33943b65f8a835eac1ff8793fc5ee65b4be6"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "3f6d52e64996570c716108d49f8108baccf499a283bbefae438c7266b7a93305"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "b110bf2e10fe420f5ca2f3ec55f048ee5f0a54c7e34856a3594e51eb2aea0570"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1323,7 +1323,7 @@ class DevtoolExtractTests(DevtoolBase):
|
||||
# Now really test deploy-target
|
||||
result = runCmd('devtool deploy-target -c %s root@%s' % (testrecipe, qemu.ip))
|
||||
# Run a test command to see if it was installed properly
|
||||
sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
|
||||
sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o HostKeyAlgorithms=+ssh-rsa'
|
||||
result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, testcommand))
|
||||
# Check if it deployed all of the files with the right ownership/perms
|
||||
# First look on the host - need to do this under pseudo to get the correct ownership/perms
|
||||
|
||||
@@ -175,8 +175,8 @@ class TestImage(OESelftestTestCase):
|
||||
if "DISPLAY" not in os.environ:
|
||||
self.skipTest("virgl gtk test must be run inside a X session")
|
||||
distro = oe.lsb.distro_identifier()
|
||||
if distro and distro == 'almalinux-8.6':
|
||||
self.skipTest('virgl isn\'t working with Alma 8')
|
||||
if distro and distro.startswith('almalinux'):
|
||||
self.skipTest('virgl isn\'t working with Alma Linux')
|
||||
if distro and distro == 'debian-8':
|
||||
self.skipTest('virgl isn\'t working with Debian 8')
|
||||
if distro and distro == 'centos-7':
|
||||
@@ -187,8 +187,12 @@ 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')
|
||||
if distro and distro == 'ubuntu-22.04':
|
||||
self.skipTest('virgl isn\'t working with Ubuntu 22.04')
|
||||
|
||||
qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
|
||||
sdl_packageconfig = get_bb_var('PACKAGECONFIG', 'libsdl2-native')
|
||||
|
||||
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"
|
||||
|
||||
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
|
||||
file://COPYING.LIB;md5=fb504b67c50331fc78734fed90fb0e09 \
|
||||
file://src/main.c;beginline=1;endline=24;md5=9bc54b93cd7e17bf03f52513f39f926e"
|
||||
DEPENDS = "dbus glib-2.0"
|
||||
RDEPENDS:${PN} += "dbus"
|
||||
PROVIDES += "bluez-hcidump"
|
||||
RPROVIDES_${PN} += "bluez-hcidump"
|
||||
|
||||
@@ -56,6 +57,8 @@ 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 \
|
||||
file://CVE-2022-3637.patch \
|
||||
"
|
||||
S = "${WORKDIR}/bluez-${PV}"
|
||||
|
||||
|
||||
39
meta/recipes-connectivity/bluez5/bluez5/CVE-2022-3637.patch
Normal file
39
meta/recipes-connectivity/bluez5/bluez5/CVE-2022-3637.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From b808b2852a0b48c6f9dbb038f932613cea3126c2 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 27 Oct 2022 09:51:27 +0530
|
||||
Subject: [PATCH] CVE-2022-3637
|
||||
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/monitor/jlink.c?id=1d6cfb8e625a944010956714c1802bc1e1fc6c4f]
|
||||
CVE: CVE-2022-3637
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
monitor: Fix crash when using RTT backend
|
||||
|
||||
This fix regression introduced by "monitor: Fix memory leaks".
|
||||
J-Link shared library is in use if jlink_init() returns 0 and thus
|
||||
handle shall not be closed.
|
||||
---
|
||||
monitor/jlink.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/monitor/jlink.c b/monitor/jlink.c
|
||||
index afa9d93..5bd4aed 100644
|
||||
--- a/monitor/jlink.c
|
||||
+++ b/monitor/jlink.c
|
||||
@@ -120,9 +120,12 @@ int jlink_init(void)
|
||||
!jlink.tif_select || !jlink.setspeed ||
|
||||
!jlink.connect || !jlink.getsn ||
|
||||
!jlink.emu_getproductname ||
|
||||
- !jlink.rtterminal_control || !jlink.rtterminal_read)
|
||||
+ !jlink.rtterminal_control || !jlink.rtterminal_read) {
|
||||
+ dlclose(so);
|
||||
return -EIO;
|
||||
+ }
|
||||
|
||||
+ /* don't dlclose(so) here cause symbols from it are in use now */
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
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"
|
||||
|
||||
120
meta/recipes-connectivity/dhcp/dhcp/CVE-2022-2928.patch
Normal file
120
meta/recipes-connectivity/dhcp/dhcp/CVE-2022-2928.patch
Normal file
@@ -0,0 +1,120 @@
|
||||
From 8a5d739eea10ee6e193f053b1662142d5657cbc6 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 6 Oct 2022 09:39:18 +0530
|
||||
Subject: [PATCH] CVE-2022-2928
|
||||
|
||||
Upstream-Status: Backport [https://downloads.isc.org/isc/dhcp/4.4.3-P1/patches/]
|
||||
CVE: CVE-2022-2928
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
common/options.c | 7 +++++
|
||||
common/tests/option_unittest.c | 54 ++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 61 insertions(+)
|
||||
|
||||
diff --git a/common/options.c b/common/options.c
|
||||
index a7ed84c..4e53bb4 100644
|
||||
--- a/common/options.c
|
||||
+++ b/common/options.c
|
||||
@@ -4452,6 +4452,8 @@ add_option(struct option_state *options,
|
||||
if (!option_cache_allocate(&oc, MDL)) {
|
||||
log_error("No memory for option cache adding %s (option %d).",
|
||||
option->name, option_num);
|
||||
+ /* Get rid of reference created during hash lookup. */
|
||||
+ option_dereference(&option, MDL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4463,6 +4465,8 @@ add_option(struct option_state *options,
|
||||
MDL)) {
|
||||
log_error("No memory for constant data adding %s (option %d).",
|
||||
option->name, option_num);
|
||||
+ /* Get rid of reference created during hash lookup. */
|
||||
+ option_dereference(&option, MDL);
|
||||
option_cache_dereference(&oc, MDL);
|
||||
return 0;
|
||||
}
|
||||
@@ -4471,6 +4475,9 @@ add_option(struct option_state *options,
|
||||
save_option(&dhcp_universe, options, oc);
|
||||
option_cache_dereference(&oc, MDL);
|
||||
|
||||
+ /* Get rid of reference created during hash lookup. */
|
||||
+ option_dereference(&option, MDL);
|
||||
+
|
||||
return 1;
|
||||
}
|
||||
|
||||
diff --git a/common/tests/option_unittest.c b/common/tests/option_unittest.c
|
||||
index cd52cfb..690704d 100644
|
||||
--- a/common/tests/option_unittest.c
|
||||
+++ b/common/tests/option_unittest.c
|
||||
@@ -130,6 +130,59 @@ ATF_TC_BODY(pretty_print_option, tc)
|
||||
}
|
||||
|
||||
|
||||
+ATF_TC(add_option_ref_cnt);
|
||||
+
|
||||
+ATF_TC_HEAD(add_option_ref_cnt, tc)
|
||||
+{
|
||||
+ atf_tc_set_md_var(tc, "descr",
|
||||
+ "Verify add_option() does not leak option ref counts.");
|
||||
+}
|
||||
+
|
||||
+ATF_TC_BODY(add_option_ref_cnt, tc)
|
||||
+{
|
||||
+ struct option_state *options = NULL;
|
||||
+ struct option *option = NULL;
|
||||
+ unsigned int cid_code = DHO_DHCP_CLIENT_IDENTIFIER;
|
||||
+ char *cid_str = "1234";
|
||||
+ int refcnt_before = 0;
|
||||
+
|
||||
+ // Look up the option we're going to add.
|
||||
+ initialize_common_option_spaces();
|
||||
+ if (!option_code_hash_lookup(&option, dhcp_universe.code_hash,
|
||||
+ &cid_code, 0, MDL)) {
|
||||
+ atf_tc_fail("cannot find option definition?");
|
||||
+ }
|
||||
+
|
||||
+ // Get the option's reference count before we call add_options.
|
||||
+ refcnt_before = option->refcnt;
|
||||
+
|
||||
+ // Allocate a option_state to which to add an option.
|
||||
+ if (!option_state_allocate(&options, MDL)) {
|
||||
+ atf_tc_fail("cannot allocat options state");
|
||||
+ }
|
||||
+
|
||||
+ // Call add_option() to add the option to the option state.
|
||||
+ if (!add_option(options, cid_code, cid_str, strlen(cid_str))) {
|
||||
+ atf_tc_fail("add_option returned 0");
|
||||
+ }
|
||||
+
|
||||
+ // Verify that calling add_option() only adds 1 to the option ref count.
|
||||
+ if (option->refcnt != (refcnt_before + 1)) {
|
||||
+ atf_tc_fail("after add_option(), count is wrong, before %d, after: %d",
|
||||
+ refcnt_before, option->refcnt);
|
||||
+ }
|
||||
+
|
||||
+ // Derefrence the option_state, this should reduce the ref count to
|
||||
+ // it's starting value.
|
||||
+ option_state_dereference(&options, MDL);
|
||||
+
|
||||
+ // Verify that dereferencing option_state restores option ref count.
|
||||
+ if (option->refcnt != refcnt_before) {
|
||||
+ atf_tc_fail("after state deref, count is wrong, before %d, after: %d",
|
||||
+ refcnt_before, option->refcnt);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* This macro defines main() method that will call specified
|
||||
test cases. tp and simple_test_case names can be whatever you want
|
||||
as long as it is a valid variable identifier. */
|
||||
@@ -137,6 +190,7 @@ ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
ATF_TP_ADD_TC(tp, option_refcnt);
|
||||
ATF_TP_ADD_TC(tp, pretty_print_option);
|
||||
+ ATF_TP_ADD_TC(tp, add_option_ref_cnt);
|
||||
|
||||
return (atf_no_error());
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
40
meta/recipes-connectivity/dhcp/dhcp/CVE-2022-2929.patch
Normal file
40
meta/recipes-connectivity/dhcp/dhcp/CVE-2022-2929.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From 5c959166ebee7605e2048de573f2475b4d731ff7 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 6 Oct 2022 09:42:59 +0530
|
||||
Subject: [PATCH] CVE-2022-2929
|
||||
|
||||
Upstream-Status: Backport [https://downloads.isc.org/isc/dhcp/4.4.3-P1/patches/]
|
||||
CVE: CVE-2022-2929
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
common/options.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/common/options.c b/common/options.c
|
||||
index 4e53bb4..28800fc 100644
|
||||
--- a/common/options.c
|
||||
+++ b/common/options.c
|
||||
@@ -454,16 +454,16 @@ int fqdn_universe_decode (struct option_state *options,
|
||||
while (s < &bp -> data[0] + length + 2) {
|
||||
len = *s;
|
||||
if (len > 63) {
|
||||
- log_info ("fancy bits in fqdn option");
|
||||
- return 0;
|
||||
+ log_info ("label length exceeds 63 in fqdn option");
|
||||
+ goto bad;
|
||||
}
|
||||
if (len == 0) {
|
||||
terminated = 1;
|
||||
break;
|
||||
}
|
||||
if (s + len > &bp -> data [0] + length + 3) {
|
||||
- log_info ("fqdn tag longer than buffer");
|
||||
- return 0;
|
||||
+ log_info ("fqdn label longer than buffer");
|
||||
+ goto bad;
|
||||
}
|
||||
|
||||
if (first_len == 0) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -11,6 +11,8 @@ SRC_URI += "file://0001-define-macro-_PATH_DHCPD_CONF-and-_PATH_DHCLIENT_CON.pat
|
||||
file://0013-fixup_use_libbind.patch \
|
||||
file://0001-workaround-busybox-limitation-in-linux-dhclient-script.patch \
|
||||
file://CVE-2021-25217.patch \
|
||||
file://CVE-2022-2928.patch \
|
||||
file://CVE-2022-2929.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "2afdaf8498dc1edaf3012efdd589b3e1"
|
||||
|
||||
@@ -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)} \
|
||||
|
||||
@@ -24,7 +24,7 @@ SRC_URI_append_class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca"
|
||||
SRC_URI[sha256sum] = "c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -51,6 +51,7 @@ PACKAGECONFIG_class-nativesdk ??= "xattr"
|
||||
PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
|
||||
PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
|
||||
PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
|
||||
PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl"
|
||||
|
||||
# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
|
||||
bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
|
||||
|
||||
@@ -10,8 +10,7 @@ SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
|
||||
file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "dfe8a71f412e0b53be26ed4fbfdc91c4"
|
||||
SRC_URI[sha256sum] = "f77620140ecb4cdc67f37fb444f8a6bea70b5b6461f12f1cbe2cec60fa7de5fe"
|
||||
SRC_URI[sha256sum] = "bc42d196c1756ac520d61bf3ccd6f42013617def45dd1e591a6091abf51dca38"
|
||||
|
||||
EXTRA_OECONF = "--disable-xml-docs \
|
||||
--disable-doxygen-docs \
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
33
meta/recipes-core/expat/expat/CVE-2022-43680.patch
Normal file
33
meta/recipes-core/expat/expat/CVE-2022-43680.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From 5290462a7ea1278a8d5c0d5b2860d4e244f997e4 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Pipping <sebastian@pipping.org>
|
||||
Date: Tue, 20 Sep 2022 02:44:34 +0200
|
||||
Subject: [PATCH] lib: Fix overeager DTD destruction in
|
||||
XML_ExternalEntityParserCreate
|
||||
|
||||
CVE: CVE-2022-43680
|
||||
Upstream-Status: Backport [https://github.com/libexpat/libexpat/commit/5290462a7ea1278a8d5c0d5b2860d4e244f997e4.patch]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
Comments: Hunk refreshed
|
||||
---
|
||||
lib/xmlparse.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
||||
index aacd6e7fc..57bf103cc 100644
|
||||
--- a/lib/xmlparse.c
|
||||
+++ b/lib/xmlparse.c
|
||||
@@ -1035,6 +1035,14 @@ parserCreate(const XML_Char *encodingNam
|
||||
parserInit(parser, encodingName);
|
||||
|
||||
if (encodingName && ! parser->m_protocolEncodingName) {
|
||||
+ if (dtd) {
|
||||
+ // We need to stop the upcoming call to XML_ParserFree from happily
|
||||
+ // destroying parser->m_dtd because the DTD is shared with the parent
|
||||
+ // parser and the only guard that keeps XML_ParserFree from destroying
|
||||
+ // parser->m_dtd is parser->m_isParamEntity but it will be set to
|
||||
+ // XML_TRUE only later in XML_ExternalEntityParserCreate (or not at all).
|
||||
+ parser->m_dtd = NULL;
|
||||
+ }
|
||||
XML_ParserFree(parser);
|
||||
return NULL;
|
||||
}
|
||||
@@ -20,6 +20,8 @@ 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 \
|
||||
file://CVE-2022-43680.patch \
|
||||
"
|
||||
|
||||
SRCREV = "a7bc26b69768f7fb24f0c7976fae24b157b85b13"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SRCBRANCH ?= "release/2.31/master"
|
||||
PV = "2.31+git${SRCPV}"
|
||||
SRCREV_glibc ?= "3ef8be9b89ef98300951741f381eb79126ac029f"
|
||||
SRCREV_glibc ?= "d4b75594574ab8a9c2c41209cd8c62aac76b5a04"
|
||||
SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
|
||||
|
||||
GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
|
||||
|
||||
@@ -11,14 +11,10 @@ CVE: CVE-2021-33574 patch#1
|
||||
Signed-off-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
NEWS | 4 ++++
|
||||
sysdeps/unix/sysv/linux/mq_notify.c | 15 ++++++++++-----
|
||||
2 files changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: git/NEWS
|
||||
===================================================================
|
||||
--- git.orig/NEWS
|
||||
+++ git/NEWS
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 8a20d3c4e3..be489243ac 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -7,6 +7,10 @@ using `glibc' in the "product" field.
|
||||
|
||||
Version 2.31.1
|
||||
@@ -28,12 +24,12 @@ Index: git/NEWS
|
||||
+ attribute with a non-default affinity mask.
|
||||
+
|
||||
The following bugs are resolved with this release:
|
||||
[14231] stdio-common tests memory requirements
|
||||
[19519] iconv(1) with -c option hangs on illegal multi-byte sequences
|
||||
(CVE-2016-10228)
|
||||
Index: git/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
===================================================================
|
||||
--- git.orig/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
+++ git/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
index f288bac477..dd47f0b777 100644
|
||||
--- a/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
@@ -135,8 +135,11 @@ helper_thread (void *arg)
|
||||
(void) __pthread_barrier_wait (¬ify_barrier);
|
||||
}
|
||||
@@ -48,7 +44,7 @@ Index: git/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -257,8 +260,7 @@ mq_notify (mqd_t mqdes, const struct sig
|
||||
@@ -257,8 +260,7 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
|
||||
if (data.attr == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -58,7 +54,7 @@ Index: git/sysdeps/unix/sysv/linux/mq_notify.c
|
||||
}
|
||||
|
||||
/* Construct the new request. */
|
||||
@@ -272,7 +274,10 @@ mq_notify (mqd_t mqdes, const struct sig
|
||||
@@ -272,7 +274,10 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
|
||||
|
||||
/* If it failed, free the allocated memory. */
|
||||
if (__glibc_unlikely (retval != 0))
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "08bd8cc1148b7b8b353ba5002560b0c2b3973a71"
|
||||
SRCREV ?= "2b7d97af746e4713036050e730d28b9b13a3c4a2"
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ deltask do_populate_sysroot
|
||||
# Use a negative value to skip the update
|
||||
CVE_DB_UPDATE_INTERVAL ?= "86400"
|
||||
|
||||
# Timeout for blocking socket operations, such as the connection attempt.
|
||||
CVE_SOCKET_TIMEOUT ?= "60"
|
||||
|
||||
python () {
|
||||
if not bb.data.inherits_class("cve-check", d):
|
||||
raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
|
||||
@@ -39,6 +42,8 @@ python do_fetch() {
|
||||
db_file = d.getVar("CVE_CHECK_DB_FILE")
|
||||
db_dir = os.path.dirname(db_file)
|
||||
|
||||
cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT"))
|
||||
|
||||
if os.path.exists("{0}-journal".format(db_file)):
|
||||
# If a journal is present the last update might have been interrupted. In that case,
|
||||
# just wipe any leftovers and force the DB to be recreated.
|
||||
@@ -65,9 +70,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
|
||||
@@ -79,7 +82,7 @@ python do_fetch() {
|
||||
|
||||
# Retrieve meta last modified date
|
||||
try:
|
||||
response = urllib.request.urlopen(meta_url)
|
||||
response = urllib.request.urlopen(meta_url, timeout=cve_socket_timeout)
|
||||
except urllib.error.URLError as e:
|
||||
cve_f.write('Warning: CVE db update error, Unable to fetch CVE data.\n\n')
|
||||
bb.warn("Failed to fetch CVE data (%s)" % e.reason)
|
||||
@@ -96,18 +99,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)
|
||||
response = urllib.request.urlopen(json_url, timeout=cve_socket_timeout)
|
||||
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 +130,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 +206,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 +232,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/"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ BRANCH ?= "binutils-2_34-branch"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
|
||||
|
||||
SRCREV ?= "d4b50999b3b287b5f984ade2f8734aa8c9359440"
|
||||
SRCREV ?= "c4e78c0868a22971680217a41fdb73516a26813d"
|
||||
BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git"
|
||||
SRC_URI = "\
|
||||
${BINUTILS_GIT_URI} \
|
||||
@@ -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"
|
||||
|
||||
@@ -199,6 +199,6 @@ Index: git/bfd/ChangeLog
|
||||
+ * dwarf2.c (scan_unit_for_symbols): Wrap overlong lines. Don't
|
||||
+ strdup(0).
|
||||
+
|
||||
2020-02-19 H.J. Lu <hongjiu.lu@intel.com>
|
||||
2021-05-03 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR binutils/25355
|
||||
PR 27755
|
||||
|
||||
@@ -7,31 +7,49 @@ Adds missing sanity checks for avr device info note, to avoid
|
||||
potential buffer overflows. Uses bfd_malloc_and_get_section for
|
||||
sanity checking section size.
|
||||
|
||||
PR 27290
|
||||
PR 27293
|
||||
PR 27295
|
||||
* od-elf32_avr.c (elf32_avr_get_note_section_contents): Formatting.
|
||||
Use bfd_malloc_and_get_section.
|
||||
(elf32_avr_get_note_desc): Formatting. Return descsz. Sanity
|
||||
check namesz. Return NULL if descsz is too small. Ensure
|
||||
string table is terminated.
|
||||
(elf32_avr_get_device_info): Formatting. Add note_size param.
|
||||
Sanity check note.
|
||||
(elf32_avr_dump_mem_usage): Adjust to suit.
|
||||
PR 27290
|
||||
PR 27293
|
||||
PR 27295
|
||||
* od-elf32_avr.c (elf32_avr_get_note_section_contents): Formatting.
|
||||
Use bfd_malloc_and_get_section.
|
||||
(elf32_avr_get_note_desc): Formatting. Return descsz. Sanity
|
||||
check namesz. Return NULL if descsz is too small. Ensure
|
||||
string table is terminated.
|
||||
(elf32_avr_get_device_info): Formatting. Add note_size param.
|
||||
Sanity check note.
|
||||
(elf32_avr_dump_mem_usage): Adjust to suit.
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2021-3549
|
||||
Signed-of-by: Armin Kuster <akuster@mvista.com>
|
||||
|
||||
---
|
||||
binutils/ChangeLog | 14 +++++++++
|
||||
binutils/od-elf32_avr.c | 66 ++++++++++++++++++++++++++---------------
|
||||
2 files changed, 56 insertions(+), 24 deletions(-)
|
||||
|
||||
Index: git/binutils/od-elf32_avr.c
|
||||
===================================================================
|
||||
--- git.orig/binutils/od-elf32_avr.c
|
||||
+++ git/binutils/od-elf32_avr.c
|
||||
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
|
||||
index 1e9a96c9bb6..02e5019204e 100644
|
||||
--- a/binutils/ChangeLog
|
||||
+++ b/binutils/ChangeLog
|
||||
@@ -1,3 +1,17 @@
|
||||
+2021-02-11 Alan Modra <amodra@gmail.com>
|
||||
+
|
||||
+ PR 27290
|
||||
+ PR 27293
|
||||
+ PR 27295
|
||||
+ * od-elf32_avr.c (elf32_avr_get_note_section_contents): Formatting.
|
||||
+ Use bfd_malloc_and_get_section.
|
||||
+ (elf32_avr_get_note_desc): Formatting. Return descsz. Sanity
|
||||
+ check namesz. Return NULL if descsz is too small. Ensure
|
||||
+ string table is terminated.
|
||||
+ (elf32_avr_get_device_info): Formatting. Add note_size param.
|
||||
+ Sanity check note.
|
||||
+ (elf32_avr_dump_mem_usage): Adjust to suit.
|
||||
+
|
||||
2020-03-25 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* ar.c (main): Update bfd_plugin_set_program_name call.
|
||||
diff --git a/binutils/od-elf32_avr.c b/binutils/od-elf32_avr.c
|
||||
index 5ec99957fe9..1d32bce918e 100644
|
||||
--- a/binutils/od-elf32_avr.c
|
||||
+++ b/binutils/od-elf32_avr.c
|
||||
@@ -77,23 +77,29 @@ elf32_avr_filter (bfd *abfd)
|
||||
return bfd_get_flavour (abfd) == bfd_target_elf_flavour;
|
||||
}
|
||||
@@ -70,7 +88,7 @@ Index: git/binutils/od-elf32_avr.c
|
||||
{
|
||||
Elf_External_Note *xnp = (Elf_External_Note *) contents;
|
||||
Elf_Internal_Note in;
|
||||
@@ -107,42 +113,54 @@ static char* elf32_avr_get_note_desc (bf
|
||||
@@ -107,42 +113,54 @@ static char* elf32_avr_get_note_desc (bfd *abfd, char *contents,
|
||||
if (in.namesz > contents - in.namedata + size)
|
||||
return NULL;
|
||||
|
||||
@@ -163,25 +181,3 @@ Index: git/binutils/od-elf32_avr.c
|
||||
}
|
||||
|
||||
elf32_avr_get_memory_usage (abfd, &text_usage, &data_usage,
|
||||
Index: git/binutils/ChangeLog
|
||||
===================================================================
|
||||
--- git.orig/binutils/ChangeLog
|
||||
+++ git/binutils/ChangeLog
|
||||
@@ -1,3 +1,17 @@
|
||||
+2021-02-11 Alan Modra <amodra@gmail.com>
|
||||
+
|
||||
+ PR 27290
|
||||
+ PR 27293
|
||||
+ PR 27295
|
||||
+ * od-elf32_avr.c (elf32_avr_get_note_section_contents): Formatting.
|
||||
+ Use bfd_malloc_and_get_section.
|
||||
+ (elf32_avr_get_note_desc): Formatting. Return descsz. Sanity
|
||||
+ check namesz. Return NULL if descsz is too small. Ensure
|
||||
+ string table is terminated.
|
||||
+ (elf32_avr_get_device_info): Formatting. Add note_size param.
|
||||
+ Sanity check note.
|
||||
+ (elf32_avr_dump_mem_usage): Adjust to suit.
|
||||
+
|
||||
2020-02-01 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
||||
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,24 @@ 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 \
|
||||
file://CVE-2022-2880.patch \
|
||||
file://CVE-2022-2879.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
@@ -35,3 +53,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
|
||||
|
||||
111
meta/recipes-devtools/go/go-1.14/CVE-2022-2879.patch
Normal file
111
meta/recipes-devtools/go/go-1.14/CVE-2022-2879.patch
Normal file
@@ -0,0 +1,111 @@
|
||||
From 9d339f1d0f53c4116a7cb4acfa895f31a07212ee Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Fri, 2 Sep 2022 20:45:18 -0700
|
||||
Subject: [PATCH] archive/tar: limit size of headers
|
||||
|
||||
Set a 1MiB limit on special file blocks (PAX headers, GNU long names,
|
||||
GNU link names), to avoid reading arbitrarily large amounts of data
|
||||
into memory.
|
||||
|
||||
Thanks to Adam Korczynski (ADA Logics) and OSS-Fuzz for reporting
|
||||
this issue.
|
||||
|
||||
Fixes CVE-2022-2879
|
||||
Updates #54853
|
||||
Fixes #55926
|
||||
|
||||
Change-Id: I85136d6ff1e0af101a112190e027987ab4335680
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1565555
|
||||
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
(cherry picked from commit 6ee768cef6b82adf7a90dcf367a1699ef694f3b2)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1591053
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/438498
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
|
||||
Run-TryBot: Carlos Amedee <carlos@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/0a723816cd2]
|
||||
CVE: CVE-2022-2879
|
||||
Signed-off-by: Sunil Kumar <sukumar@mvista.com>
|
||||
---
|
||||
src/archive/tar/format.go | 4 ++++
|
||||
src/archive/tar/reader.go | 14 ++++++++++++--
|
||||
src/archive/tar/writer.go | 3 +++
|
||||
3 files changed, 19 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/archive/tar/format.go b/src/archive/tar/format.go
|
||||
index cfe24a5..6642364 100644
|
||||
--- a/src/archive/tar/format.go
|
||||
+++ b/src/archive/tar/format.go
|
||||
@@ -143,6 +143,10 @@ const (
|
||||
blockSize = 512 // Size of each block in a tar stream
|
||||
nameSize = 100 // Max length of the name field in USTAR format
|
||||
prefixSize = 155 // Max length of the prefix field in USTAR format
|
||||
+
|
||||
+ // Max length of a special file (PAX header, GNU long name or link).
|
||||
+ // This matches the limit used by libarchive.
|
||||
+ maxSpecialFileSize = 1 << 20
|
||||
)
|
||||
|
||||
// blockPadding computes the number of bytes needed to pad offset up to the
|
||||
diff --git a/src/archive/tar/reader.go b/src/archive/tar/reader.go
|
||||
index 4f9135b..e996595 100644
|
||||
--- a/src/archive/tar/reader.go
|
||||
+++ b/src/archive/tar/reader.go
|
||||
@@ -104,7 +104,7 @@ func (tr *Reader) next() (*Header, error) {
|
||||
continue // This is a meta header affecting the next header
|
||||
case TypeGNULongName, TypeGNULongLink:
|
||||
format.mayOnlyBe(FormatGNU)
|
||||
- realname, err := ioutil.ReadAll(tr)
|
||||
+ realname, err := readSpecialFile(tr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -294,7 +294,7 @@ func mergePAX(hdr *Header, paxHdrs map[string]string) (err error) {
|
||||
// parsePAX parses PAX headers.
|
||||
// If an extended header (type 'x') is invalid, ErrHeader is returned
|
||||
func parsePAX(r io.Reader) (map[string]string, error) {
|
||||
- buf, err := ioutil.ReadAll(r)
|
||||
+ buf, err := readSpecialFile(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -827,6 +827,16 @@ func tryReadFull(r io.Reader, b []byte) (n int, err error) {
|
||||
return n, err
|
||||
}
|
||||
|
||||
+// readSpecialFile is like ioutil.ReadAll except it returns
|
||||
+// ErrFieldTooLong if more than maxSpecialFileSize is read.
|
||||
+func readSpecialFile(r io.Reader) ([]byte, error) {
|
||||
+ buf, err := ioutil.ReadAll(io.LimitReader(r, maxSpecialFileSize+1))
|
||||
+ if len(buf) > maxSpecialFileSize {
|
||||
+ return nil, ErrFieldTooLong
|
||||
+ }
|
||||
+ return buf, err
|
||||
+}
|
||||
+
|
||||
// discard skips n bytes in r, reporting an error if unable to do so.
|
||||
func discard(r io.Reader, n int64) error {
|
||||
// If possible, Seek to the last byte before the end of the data section.
|
||||
diff --git a/src/archive/tar/writer.go b/src/archive/tar/writer.go
|
||||
index e80498d..893eac0 100644
|
||||
--- a/src/archive/tar/writer.go
|
||||
+++ b/src/archive/tar/writer.go
|
||||
@@ -199,6 +199,9 @@ func (tw *Writer) writePAXHeader(hdr *Header, paxHdrs map[string]string) error {
|
||||
flag = TypeXHeader
|
||||
}
|
||||
data := buf.String()
|
||||
+ if len(data) > maxSpecialFileSize {
|
||||
+ return ErrFieldTooLong
|
||||
+ }
|
||||
if err := tw.writeRawFile(name, data, flag, FormatPAX); err != nil || isGlobal {
|
||||
return err // Global headers return here
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
164
meta/recipes-devtools/go/go-1.14/CVE-2022-2880.patch
Normal file
164
meta/recipes-devtools/go/go-1.14/CVE-2022-2880.patch
Normal file
@@ -0,0 +1,164 @@
|
||||
From 753e3f8da191c2ac400407d83c70f46900769417 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 27 Oct 2022 12:22:41 +0530
|
||||
Subject: [PATCH] CVE-2022-2880
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/9d2c73a9fd69e45876509bb3bdb2af99bf77da1e]
|
||||
CVE: CVE-2022-2880
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
net/http/httputil: avoid query parameter
|
||||
|
||||
Query parameter smuggling occurs when a proxy's interpretation
|
||||
of query parameters differs from that of a downstream server.
|
||||
Change ReverseProxy to avoid forwarding ignored query parameters.
|
||||
|
||||
Remove unparsable query parameters from the outbound request
|
||||
|
||||
* if req.Form != nil after calling ReverseProxy.Director; and
|
||||
* before calling ReverseProxy.Rewrite.
|
||||
|
||||
This change preserves the existing behavior of forwarding the
|
||||
raw query untouched if a Director hook does not parse the query
|
||||
by calling Request.ParseForm (possibly indirectly).
|
||||
---
|
||||
src/net/http/httputil/reverseproxy.go | 36 +++++++++++
|
||||
src/net/http/httputil/reverseproxy_test.go | 74 ++++++++++++++++++++++
|
||||
2 files changed, 110 insertions(+)
|
||||
|
||||
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
|
||||
index 2072a5f..c6fb873 100644
|
||||
--- a/src/net/http/httputil/reverseproxy.go
|
||||
+++ b/src/net/http/httputil/reverseproxy.go
|
||||
@@ -212,6 +212,9 @@ func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
p.Director(outreq)
|
||||
+ if outreq.Form != nil {
|
||||
+ outreq.URL.RawQuery = cleanQueryParams(outreq.URL.RawQuery)
|
||||
+ }
|
||||
outreq.Close = false
|
||||
|
||||
reqUpType := upgradeType(outreq.Header)
|
||||
@@ -561,3 +564,36 @@ func (c switchProtocolCopier) copyToBackend(errc chan<- error) {
|
||||
_, err := io.Copy(c.backend, c.user)
|
||||
errc <- err
|
||||
}
|
||||
+
|
||||
+func cleanQueryParams(s string) string {
|
||||
+ reencode := func(s string) string {
|
||||
+ v, _ := url.ParseQuery(s)
|
||||
+ return v.Encode()
|
||||
+ }
|
||||
+ for i := 0; i < len(s); {
|
||||
+ switch s[i] {
|
||||
+ case ';':
|
||||
+ return reencode(s)
|
||||
+ case '%':
|
||||
+ if i+2 >= len(s) || !ishex(s[i+1]) || !ishex(s[i+2]) {
|
||||
+ return reencode(s)
|
||||
+ }
|
||||
+ i += 3
|
||||
+ default:
|
||||
+ i++
|
||||
+ }
|
||||
+ }
|
||||
+ return s
|
||||
+}
|
||||
+
|
||||
+func ishex(c byte) bool {
|
||||
+ switch {
|
||||
+ case '0' <= c && c <= '9':
|
||||
+ return true
|
||||
+ case 'a' <= c && c <= 'f':
|
||||
+ return true
|
||||
+ case 'A' <= c && c <= 'F':
|
||||
+ return true
|
||||
+ }
|
||||
+ return false
|
||||
+}
|
||||
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
|
||||
index 9a7223a..bc87a3b 100644
|
||||
--- a/src/net/http/httputil/reverseproxy_test.go
|
||||
+++ b/src/net/http/httputil/reverseproxy_test.go
|
||||
@@ -1269,3 +1269,77 @@ func TestSingleJoinSlash(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+const (
|
||||
+ testWantsCleanQuery = true
|
||||
+ testWantsRawQuery = false
|
||||
+)
|
||||
+
|
||||
+func TestReverseProxyQueryParameterSmugglingDirectorDoesNotParseForm(t *testing.T) {
|
||||
+ testReverseProxyQueryParameterSmuggling(t, testWantsRawQuery, func(u *url.URL) *ReverseProxy {
|
||||
+ proxyHandler := NewSingleHostReverseProxy(u)
|
||||
+ oldDirector := proxyHandler.Director
|
||||
+ proxyHandler.Director = func(r *http.Request) {
|
||||
+ oldDirector(r)
|
||||
+ }
|
||||
+ return proxyHandler
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+func TestReverseProxyQueryParameterSmugglingDirectorParsesForm(t *testing.T) {
|
||||
+ testReverseProxyQueryParameterSmuggling(t, testWantsCleanQuery, func(u *url.URL) *ReverseProxy {
|
||||
+ proxyHandler := NewSingleHostReverseProxy(u)
|
||||
+ oldDirector := proxyHandler.Director
|
||||
+ proxyHandler.Director = func(r *http.Request) {
|
||||
+ // Parsing the form causes ReverseProxy to remove unparsable
|
||||
+ // query parameters before forwarding.
|
||||
+ r.FormValue("a")
|
||||
+ oldDirector(r)
|
||||
+ }
|
||||
+ return proxyHandler
|
||||
+ })
|
||||
+}
|
||||
+
|
||||
+func testReverseProxyQueryParameterSmuggling(t *testing.T, wantCleanQuery bool, newProxy func(*url.URL) *ReverseProxy) {
|
||||
+ const content = "response_content"
|
||||
+ backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
+ w.Write([]byte(r.URL.RawQuery))
|
||||
+ }))
|
||||
+ defer backend.Close()
|
||||
+ backendURL, err := url.Parse(backend.URL)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ proxyHandler := newProxy(backendURL)
|
||||
+ frontend := httptest.NewServer(proxyHandler)
|
||||
+ defer frontend.Close()
|
||||
+
|
||||
+ // Don't spam output with logs of queries containing semicolons.
|
||||
+ backend.Config.ErrorLog = log.New(io.Discard, "", 0)
|
||||
+ frontend.Config.ErrorLog = log.New(io.Discard, "", 0)
|
||||
+
|
||||
+ for _, test := range []struct {
|
||||
+ rawQuery string
|
||||
+ cleanQuery string
|
||||
+ }{{
|
||||
+ rawQuery: "a=1&a=2;b=3",
|
||||
+ cleanQuery: "a=1",
|
||||
+ }, {
|
||||
+ rawQuery: "a=1&a=%zz&b=3",
|
||||
+ cleanQuery: "a=1&b=3",
|
||||
+ }} {
|
||||
+ res, err := frontend.Client().Get(frontend.URL + "?" + test.rawQuery)
|
||||
+ if err != nil {
|
||||
+ t.Fatalf("Get: %v", err)
|
||||
+ }
|
||||
+ defer res.Body.Close()
|
||||
+ body, _ := io.ReadAll(res.Body)
|
||||
+ wantQuery := test.rawQuery
|
||||
+ if wantCleanQuery {
|
||||
+ wantQuery = test.cleanQuery
|
||||
+ }
|
||||
+ if got, want := string(body), wantQuery; got != want {
|
||||
+ t.Errorf("proxy forwarded raw query %q as %q, want %q", test.rawQuery, got, want)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
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() {
|
||||
|
||||
@@ -42,8 +42,8 @@ SRC_URI_append_class-native = " \
|
||||
file://0001-Don-t-search-system-for-headers-libraries.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "c4b7100dcaace9d33ab1fda9a3a038d6"
|
||||
SRC_URI[sha256sum] = "6f309077012040aa39fe8f0c61db8c0fa1c45136763299d375c9e5756f09cf57"
|
||||
SRC_URI[md5sum] = "78710eed185b71f4198d354502ff62c9"
|
||||
SRC_URI[sha256sum] = "5d77e278271ba803e9909a41a4f3baca006181c93ada682a5e5fe8dc4a24c5f3"
|
||||
|
||||
# exclude pre-releases for both python 2.x and 3.x
|
||||
UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
|
||||
@@ -98,6 +98,21 @@ 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 \
|
||||
file://CVE-2021-3750.patch \
|
||||
file://CVE-2021-3638.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
@@ -115,6 +130,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 +273,12 @@ 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"
|
||||
PACKAGECONFIG[vde] = "--enable-vde,--disable-vde"
|
||||
PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd"
|
||||
PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma"
|
||||
|
||||
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
|
||||
|
||||
80
meta/recipes-devtools/qemu/qemu/CVE-2021-3638.patch
Normal file
80
meta/recipes-devtools/qemu/qemu/CVE-2021-3638.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From b68d13531d8882ba66994b9f767b6a8f822464f3 Mon Sep 17 00:00:00 2001
|
||||
From: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
Date: Fri, 11 Nov 2022 12:43:26 +0530
|
||||
Subject: [PATCH] CVE-2021-3638
|
||||
|
||||
Upstream-Status: Backport [https://lists.nongnu.org/archive/html/qemu-devel/2021-09/msg01682.html]
|
||||
CVE: CVE-2021-3638
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
|
||||
When building QEMU with DEBUG_ATI defined then running with
|
||||
'-device ati-vga,romfile="" -d unimp,guest_errors -trace ati\*'
|
||||
we get:
|
||||
|
||||
ati_mm_write 4 0x16c0 DP_CNTL <- 0x1
|
||||
ati_mm_write 4 0x146c DP_GUI_MASTER_CNTL <- 0x2
|
||||
ati_mm_write 4 0x16c8 DP_MIX <- 0xff0000
|
||||
ati_mm_write 4 0x16c4 DP_DATATYPE <- 0x2
|
||||
ati_mm_write 4 0x224 CRTC_OFFSET <- 0x0
|
||||
ati_mm_write 4 0x142c DST_PITCH_OFFSET <- 0xfe00000
|
||||
ati_mm_write 4 0x1420 DST_Y <- 0x3fff
|
||||
ati_mm_write 4 0x1410 DST_HEIGHT <- 0x3fff
|
||||
ati_mm_write 4 0x1588 DST_WIDTH_X <- 0x3fff3fff
|
||||
ati_2d_blt: vram:0x7fff5fa00000 addr:0 ds:0x7fff61273800 stride:2560 bpp:32
|
||||
rop:0xff
|
||||
ati_2d_blt: 0 0 0, 0 127 0, (0,0) -> (16383,16383) 16383x16383 > ^
|
||||
ati_2d_blt: pixman_fill(dst:0x7fff5fa00000, stride:254, bpp:8, x:16383,
|
||||
y:16383, w:16383, h:16383, xor:0xff000000)
|
||||
Thread 3 "qemu-system-i38" received signal SIGSEGV, Segmentation fault.
|
||||
(gdb) bt
|
||||
#0 0x00007ffff7f62ce0 in sse2_fill.lto_priv () at /lib64/libpixman-1.so.0
|
||||
#1 0x00007ffff7f09278 in pixman_fill () at /lib64/libpixman-1.so.0
|
||||
#2 0x0000555557b5a9af in ati_2d_blt (s=0x631000028800) at
|
||||
hw/display/ati_2d.c:196
|
||||
#3 0x0000555557b4b5a2 in ati_mm_write (opaque=0x631000028800, addr=5512,
|
||||
data=1073692671, size=4) at hw/display/ati.c:843
|
||||
#4 0x0000555558b90ec4 in memory_region_write_accessor (mr=0x631000039cc0,
|
||||
addr=5512, ..., size=4, ...) at softmmu/memory.c:492
|
||||
|
||||
Commit 584acf34cb0 ("ati-vga: Fix reverse bit blts") introduced
|
||||
the local dst_x and dst_y which adjust the (x, y) coordinates
|
||||
depending on the direction in the SRCCOPY ROP3 operation, but
|
||||
forgot to address the same issue for the PATCOPY, BLACKNESS and
|
||||
WHITENESS operations, which also call pixman_fill().
|
||||
|
||||
Fix that now by using the adjusted coordinates in the pixman_fill
|
||||
call, and update the related debug printf().
|
||||
---
|
||||
hw/display/ati_2d.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c
|
||||
index 4dc10ea7..692bec91 100644
|
||||
--- a/hw/display/ati_2d.c
|
||||
+++ b/hw/display/ati_2d.c
|
||||
@@ -84,7 +84,7 @@ void ati_2d_blt(ATIVGAState *s)
|
||||
DPRINTF("%d %d %d, %d %d %d, (%d,%d) -> (%d,%d) %dx%d %c %c\n",
|
||||
s->regs.src_offset, s->regs.dst_offset, s->regs.default_offset,
|
||||
s->regs.src_pitch, s->regs.dst_pitch, s->regs.default_pitch,
|
||||
- s->regs.src_x, s->regs.src_y, s->regs.dst_x, s->regs.dst_y,
|
||||
+ s->regs.src_x, s->regs.src_y, dst_x, dst_y,
|
||||
s->regs.dst_width, s->regs.dst_height,
|
||||
(s->regs.dp_cntl & DST_X_LEFT_TO_RIGHT ? '>' : '<'),
|
||||
(s->regs.dp_cntl & DST_Y_TOP_TO_BOTTOM ? 'v' : '^'));
|
||||
@@ -180,11 +180,11 @@ void ati_2d_blt(ATIVGAState *s)
|
||||
dst_stride /= sizeof(uint32_t);
|
||||
DPRINTF("pixman_fill(%p, %d, %d, %d, %d, %d, %d, %x)\n",
|
||||
dst_bits, dst_stride, bpp,
|
||||
- s->regs.dst_x, s->regs.dst_y,
|
||||
+ dst_x, dst_y,
|
||||
s->regs.dst_width, s->regs.dst_height,
|
||||
filler);
|
||||
pixman_fill((uint32_t *)dst_bits, dst_stride, bpp,
|
||||
- s->regs.dst_x, s->regs.dst_y,
|
||||
+ dst_x, dst_y,
|
||||
s->regs.dst_width, s->regs.dst_height,
|
||||
filler);
|
||||
if (dst_bits >= s->vga.vram_ptr + s->vga.vbe_start_addr &&
|
||||
--
|
||||
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,
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user