mirror of
https://git.yoctoproject.org/poky
synced 2026-02-23 18:09:40 +01:00
Compare commits
109 Commits
yocto-3.1.
...
dunfell-23
| 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 |
@@ -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.19"
|
||||
DISTRO : "3.1.21"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.19"
|
||||
YOCTO_DOC_VERSION : "3.1.21"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.19"
|
||||
DOCCONF_VERSION : "3.1.19"
|
||||
DISTRO_REL_TAG : "yocto-3.1.21"
|
||||
DOCCONF_VERSION : "3.1.21"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.19"
|
||||
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.19"
|
||||
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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -59,6 +59,9 @@ 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
|
||||
#
|
||||
@@ -479,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
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -168,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':
|
||||
@@ -191,6 +191,8 @@ class TestImage(OESelftestTestCase):
|
||||
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')
|
||||
|
||||
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"
|
||||
|
||||
@@ -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 ?= "23322786e02469c08e3db007043da1091bf0f466"
|
||||
SRCREV ?= "2b7d97af746e4713036050e730d28b9b13a3c4a2"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -33,6 +33,7 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=te
|
||||
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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -100,6 +100,19 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
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"
|
||||
|
||||
@@ -117,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"
|
||||
|
||||
@@ -257,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
|
||||
|
||||
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,
|
||||
180
meta/recipes-devtools/qemu/qemu/CVE-2021-3750.patch
Normal file
180
meta/recipes-devtools/qemu/qemu/CVE-2021-3750.patch
Normal file
@@ -0,0 +1,180 @@
|
||||
From 1938fbc7ec197e2612ab2ce36dd69bff19208aa5 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 10 Oct 2022 17:44:41 +0530
|
||||
Subject: [PATCH] CVE-2021-3750
|
||||
|
||||
Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=commit;h=b9d383ab797f54ae5fa8746117770709921dc529 && https://git.qemu.org/?p=qemu.git;a=commit;h=3ab6fdc91b72e156da22848f0003ff4225690ced && https://git.qemu.org/?p=qemu.git;a=commit;h=58e74682baf4e1ad26b064d8c02e5bc99c75c5d9]
|
||||
CVE: CVE-2021-3750
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
exec.c | 55 +++++++++++++++++++++++++++++++-------
|
||||
hw/intc/arm_gicv3_redist.c | 4 +--
|
||||
include/exec/memattrs.h | 9 +++++++
|
||||
3 files changed, 56 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/exec.c b/exec.c
|
||||
index 1360051a..10581d8d 100644
|
||||
--- a/exec.c
|
||||
+++ b/exec.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
+#include "qemu/log.h"
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
#include "qemu.h"
|
||||
#else /* !CONFIG_USER_ONLY */
|
||||
@@ -3118,6 +3119,33 @@ static bool prepare_mmio_access(MemoryRegion *mr)
|
||||
return release_lock;
|
||||
}
|
||||
|
||||
+/**
|
||||
++ * flatview_access_allowed
|
||||
++ * @mr: #MemoryRegion to be accessed
|
||||
++ * @attrs: memory transaction attributes
|
||||
++ * @addr: address within that memory region
|
||||
++ * @len: the number of bytes to access
|
||||
++ *
|
||||
++ * Check if a memory transaction is allowed.
|
||||
++ *
|
||||
++ * Returns: true if transaction is allowed, false if denied.
|
||||
++ */
|
||||
+static bool flatview_access_allowed(MemoryRegion *mr, MemTxAttrs attrs,
|
||||
+ hwaddr addr, hwaddr len)
|
||||
+{
|
||||
+ if (likely(!attrs.memory)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ if (memory_region_is_ram(mr)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ qemu_log_mask(LOG_GUEST_ERROR,
|
||||
+ "Invalid access to non-RAM device at "
|
||||
+ "addr 0x%" HWADDR_PRIX ", size %" HWADDR_PRIu ", "
|
||||
+ "region '%s'\n", addr, len, memory_region_name(mr));
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
/* Called within RCU critical section. */
|
||||
static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
MemTxAttrs attrs,
|
||||
@@ -3131,7 +3159,10 @@ static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,
|
||||
bool release_lock = false;
|
||||
|
||||
for (;;) {
|
||||
- if (!memory_access_is_direct(mr, true)) {
|
||||
+ if (!flatview_access_allowed(mr, attrs, addr1, l)) {
|
||||
+ result |= MEMTX_ACCESS_ERROR;
|
||||
+ /* Keep going. */
|
||||
+ } else if (!memory_access_is_direct(mr, true)) {
|
||||
release_lock |= prepare_mmio_access(mr);
|
||||
l = memory_access_size(mr, l, addr1);
|
||||
/* XXX: could force current_cpu to NULL to avoid
|
||||
@@ -3173,14 +3204,14 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
|
||||
hwaddr l;
|
||||
hwaddr addr1;
|
||||
MemoryRegion *mr;
|
||||
- MemTxResult result = MEMTX_OK;
|
||||
|
||||
l = len;
|
||||
mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);
|
||||
- result = flatview_write_continue(fv, addr, attrs, buf, len,
|
||||
- addr1, l, mr);
|
||||
-
|
||||
- return result;
|
||||
+ if (!flatview_access_allowed(mr, attrs, addr, len)) {
|
||||
+ return MEMTX_ACCESS_ERROR;
|
||||
+ }
|
||||
+ return flatview_write_continue(fv, addr, attrs, buf, len,
|
||||
+ addr1, l, mr);
|
||||
}
|
||||
|
||||
/* Called within RCU critical section. */
|
||||
@@ -3195,7 +3226,10 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
|
||||
bool release_lock = false;
|
||||
|
||||
for (;;) {
|
||||
- if (!memory_access_is_direct(mr, false)) {
|
||||
+ if (!flatview_access_allowed(mr, attrs, addr1, l)) {
|
||||
+ result |= MEMTX_ACCESS_ERROR;
|
||||
+ /* Keep going. */
|
||||
+ } else if (!memory_access_is_direct(mr, false)) {
|
||||
/* I/O case */
|
||||
release_lock |= prepare_mmio_access(mr);
|
||||
l = memory_access_size(mr, l, addr1);
|
||||
@@ -3238,6 +3272,9 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
|
||||
|
||||
l = len;
|
||||
mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);
|
||||
+ if (!flatview_access_allowed(mr, attrs, addr, len)) {
|
||||
+ return MEMTX_ACCESS_ERROR;
|
||||
+ }
|
||||
return flatview_read_continue(fv, addr, attrs, buf, len,
|
||||
addr1, l, mr);
|
||||
}
|
||||
@@ -3474,12 +3511,10 @@ bool address_space_access_valid(AddressSpace *as, hwaddr addr,
|
||||
MemTxAttrs attrs)
|
||||
{
|
||||
FlatView *fv;
|
||||
- bool result;
|
||||
|
||||
RCU_READ_LOCK_GUARD();
|
||||
fv = address_space_to_flatview(as);
|
||||
- result = flatview_access_valid(fv, addr, len, is_write, attrs);
|
||||
- return result;
|
||||
+ return flatview_access_valid(fv, addr, len, is_write, attrs);
|
||||
}
|
||||
|
||||
static hwaddr
|
||||
diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c
|
||||
index 8645220d..44368e28 100644
|
||||
--- a/hw/intc/arm_gicv3_redist.c
|
||||
+++ b/hw/intc/arm_gicv3_redist.c
|
||||
@@ -450,7 +450,7 @@ MemTxResult gicv3_redist_read(void *opaque, hwaddr offset, uint64_t *data,
|
||||
break;
|
||||
}
|
||||
|
||||
- if (r == MEMTX_ERROR) {
|
||||
+ if (r != MEMTX_OK) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: invalid guest read at offset " TARGET_FMT_plx
|
||||
"size %u\n", __func__, offset, size);
|
||||
@@ -507,7 +507,7 @@ MemTxResult gicv3_redist_write(void *opaque, hwaddr offset, uint64_t data,
|
||||
break;
|
||||
}
|
||||
|
||||
- if (r == MEMTX_ERROR) {
|
||||
+ if (r != MEMTX_OK) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: invalid guest write at offset " TARGET_FMT_plx
|
||||
"size %u\n", __func__, offset, size);
|
||||
diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
|
||||
index 95f2d20d..9fb98bc1 100644
|
||||
--- a/include/exec/memattrs.h
|
||||
+++ b/include/exec/memattrs.h
|
||||
@@ -35,6 +35,14 @@ typedef struct MemTxAttrs {
|
||||
unsigned int secure:1;
|
||||
/* Memory access is usermode (unprivileged) */
|
||||
unsigned int user:1;
|
||||
+ /*
|
||||
+ * Bus interconnect and peripherals can access anything (memories,
|
||||
+ * devices) by default. By setting the 'memory' bit, bus transaction
|
||||
+ * are restricted to "normal" memories (per the AMBA documentation)
|
||||
+ * versus devices. Access to devices will be logged and rejected
|
||||
+ * (see MEMTX_ACCESS_ERROR).
|
||||
+ */
|
||||
+ unsigned int memory:1;
|
||||
/* Requester ID (for MSI for example) */
|
||||
unsigned int requester_id:16;
|
||||
/* Invert endianness for this page */
|
||||
@@ -66,6 +74,7 @@ typedef struct MemTxAttrs {
|
||||
#define MEMTX_OK 0
|
||||
#define MEMTX_ERROR (1U << 0) /* device returned an error */
|
||||
#define MEMTX_DECODE_ERROR (1U << 1) /* nothing at that address */
|
||||
+#define MEMTX_ACCESS_ERROR (1U << 2) /* access denied */
|
||||
typedef uint32_t MemTxResult;
|
||||
|
||||
#endif
|
||||
--
|
||||
2.25.1
|
||||
|
||||
53
meta/recipes-devtools/qemu/qemu/CVE-2021-3930.patch
Normal file
53
meta/recipes-devtools/qemu/qemu/CVE-2021-3930.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 4 Nov 2021 17:31:38 +0100
|
||||
Subject: [PATCH] hw/scsi/scsi-disk: MODE_PAGE_ALLS not allowed in MODE SELECT
|
||||
commands
|
||||
|
||||
This avoids an off-by-one read of 'mode_sense_valid' buffer in
|
||||
hw/scsi/scsi-disk.c:mode_sense_page().
|
||||
|
||||
Fixes: CVE-2021-3930
|
||||
Cc: qemu-stable@nongnu.org
|
||||
Reported-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Fixes: a8f4bbe2900 ("scsi-disk: store valid mode pages in a table")
|
||||
Fixes: #546
|
||||
Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/b3af7fdf9cc537f8f0dd3e2423d83f5c99a457e8
|
||||
CVE: CVE-2021-3930
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/scsi-disk.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
|
||||
index e8a547dbb7..d4914178ea 100644
|
||||
--- a/hw/scsi/scsi-disk.c
|
||||
+++ b/hw/scsi/scsi-disk.c
|
||||
@@ -1087,6 +1087,7 @@ static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
|
||||
uint8_t *p = *p_outbuf + 2;
|
||||
int length;
|
||||
|
||||
+ assert(page < ARRAY_SIZE(mode_sense_valid));
|
||||
if ((mode_sense_valid[page] & (1 << s->qdev.type)) == 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -1428,6 +1429,11 @@ static int scsi_disk_check_mode_select(SCSIDiskState *s, int page,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ /* MODE_PAGE_ALLS is only valid for MODE SENSE commands */
|
||||
+ if (page == MODE_PAGE_ALLS) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
p = mode_current;
|
||||
memset(mode_current, 0, inlen + 2);
|
||||
len = mode_sense_page(s, page, &p, 0);
|
||||
--
|
||||
GitLab
|
||||
|
||||
89
meta/recipes-devtools/qemu/qemu/CVE-2021-4206.patch
Normal file
89
meta/recipes-devtools/qemu/qemu/CVE-2021-4206.patch
Normal file
@@ -0,0 +1,89 @@
|
||||
From fa892e9abb728e76afcf27323ab29c57fb0fe7aa Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 7 Apr 2022 10:17:12 +0200
|
||||
Subject: [PATCH] ui/cursor: fix integer overflow in cursor_alloc
|
||||
(CVE-2021-4206)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Prevent potential integer overflow by limiting 'width' and 'height' to
|
||||
512x512. Also change 'datasize' type to size_t. Refer to security
|
||||
advisory https://starlabs.sg/advisories/22-4206/ for more information.
|
||||
|
||||
Fixes: CVE-2021-4206
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-Id: <20220407081712.345609-1-mcascell@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/fa892e9a
|
||||
CVE: CVE-2021-4206
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/display/qxl-render.c | 7 +++++++
|
||||
hw/display/vmware_vga.c | 2 ++
|
||||
ui/cursor.c | 8 +++++++-
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
|
||||
index 237ed293ba..ca217004bf 100644
|
||||
--- a/hw/display/qxl-render.c
|
||||
+++ b/hw/display/qxl-render.c
|
||||
@@ -247,6 +247,13 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
|
||||
size_t size;
|
||||
|
||||
c = cursor_alloc(cursor->header.width, cursor->header.height);
|
||||
+
|
||||
+ if (!c) {
|
||||
+ qxl_set_guest_bug(qxl, "%s: cursor %ux%u alloc error", __func__,
|
||||
+ cursor->header.width, cursor->header.height);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
c->hot_x = cursor->header.hot_spot_x;
|
||||
c->hot_y = cursor->header.hot_spot_y;
|
||||
switch (cursor->header.type) {
|
||||
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
|
||||
index 98c83474ad..45d06cbe25 100644
|
||||
--- a/hw/display/vmware_vga.c
|
||||
+++ b/hw/display/vmware_vga.c
|
||||
@@ -515,6 +515,8 @@ static inline void vmsvga_cursor_define(struct vmsvga_state_s *s,
|
||||
int i, pixels;
|
||||
|
||||
qc = cursor_alloc(c->width, c->height);
|
||||
+ assert(qc != NULL);
|
||||
+
|
||||
qc->hot_x = c->hot_x;
|
||||
qc->hot_y = c->hot_y;
|
||||
switch (c->bpp) {
|
||||
diff --git a/ui/cursor.c b/ui/cursor.c
|
||||
index 1d62ddd4d0..835f0802f9 100644
|
||||
--- a/ui/cursor.c
|
||||
+++ b/ui/cursor.c
|
||||
@@ -46,6 +46,8 @@ static QEMUCursor *cursor_parse_xpm(const char *xpm[])
|
||||
|
||||
/* parse pixel data */
|
||||
c = cursor_alloc(width, height);
|
||||
+ assert(c != NULL);
|
||||
+
|
||||
for (pixel = 0, y = 0; y < height; y++, line++) {
|
||||
for (x = 0; x < height; x++, pixel++) {
|
||||
idx = xpm[line][x];
|
||||
@@ -91,7 +93,11 @@ QEMUCursor *cursor_builtin_left_ptr(void)
|
||||
QEMUCursor *cursor_alloc(int width, int height)
|
||||
{
|
||||
QEMUCursor *c;
|
||||
- int datasize = width * height * sizeof(uint32_t);
|
||||
+ size_t datasize = width * height * sizeof(uint32_t);
|
||||
+
|
||||
+ if (width > 512 || height > 512) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
c = g_malloc0(sizeof(QEMUCursor) + datasize);
|
||||
c->width = width;
|
||||
--
|
||||
GitLab
|
||||
|
||||
43
meta/recipes-devtools/qemu/qemu/CVE-2021-4207.patch
Normal file
43
meta/recipes-devtools/qemu/qemu/CVE-2021-4207.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 9569f5cb5b4bffa9d3ebc8ba7da1e03830a9a895 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Thu, 7 Apr 2022 10:11:06 +0200
|
||||
Subject: [PATCH] display/qxl-render: fix race condition in qxl_cursor
|
||||
(CVE-2021-4207)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Avoid fetching 'width' and 'height' a second time to prevent possible
|
||||
race condition. Refer to security advisory
|
||||
https://starlabs.sg/advisories/22-4207/ for more information.
|
||||
|
||||
Fixes: CVE-2021-4207
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
||||
Message-Id: <20220407081106.343235-1-mcascell@redhat.com>
|
||||
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/9569f5cb
|
||||
CVE: CVE-2021-4207
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/display/qxl-render.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
|
||||
index d28849b121..237ed293ba 100644
|
||||
--- a/hw/display/qxl-render.c
|
||||
+++ b/hw/display/qxl-render.c
|
||||
@@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,
|
||||
}
|
||||
break;
|
||||
case SPICE_CURSOR_TYPE_ALPHA:
|
||||
- size = sizeof(uint32_t) * cursor->header.width * cursor->header.height;
|
||||
+ size = sizeof(uint32_t) * c->width * c->height;
|
||||
qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id);
|
||||
if (qxl->debug > 2) {
|
||||
cursor_print_ascii_art(c, "qxl/alpha");
|
||||
--
|
||||
GitLab
|
||||
|
||||
42
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-1.patch
Normal file
42
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-1.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 6c8fa961da5e60f574bb52fd3ad44b1e9e8ad4b8 Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Tue, 5 Jul 2022 22:05:43 +0200
|
||||
Subject: [PATCH] scsi/lsi53c895a: fix use-after-free in lsi_do_msgout
|
||||
(CVE-2022-0216)
|
||||
|
||||
Set current_req->req to NULL to prevent reusing a free'd buffer in case of
|
||||
repeated SCSI cancel requests. Thanks to Thomas Huth for suggesting the patch.
|
||||
|
||||
Fixes: CVE-2022-0216
|
||||
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Reviewed-by: Thomas Huth <thuth@redhat.com>
|
||||
Message-Id: <20220705200543.2366809-1-mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/6c8fa961da5e60f574bb52fd3ad44b1e9e8ad4b8
|
||||
CVE: CVE-2022-0216
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/lsi53c895a.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
|
||||
index c8773f73f7..99ea42d49b 100644
|
||||
--- a/hw/scsi/lsi53c895a.c
|
||||
+++ b/hw/scsi/lsi53c895a.c
|
||||
@@ -1028,8 +1028,9 @@ static void lsi_do_msgout(LSIState *s)
|
||||
case 0x0d:
|
||||
/* The ABORT TAG message clears the current I/O process only. */
|
||||
trace_lsi_do_msgout_abort(current_tag);
|
||||
- if (current_req) {
|
||||
+ if (current_req && current_req->req) {
|
||||
scsi_req_cancel(current_req->req);
|
||||
+ current_req->req = NULL;
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
--
|
||||
GitLab
|
||||
|
||||
52
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-2.patch
Normal file
52
meta/recipes-devtools/qemu/qemu/CVE-2022-0216-2.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 4367a20cc442c56b05611b4224de9a61908f9eac Mon Sep 17 00:00:00 2001
|
||||
From: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Date: Mon, 11 Jul 2022 14:33:16 +0200
|
||||
Subject: [PATCH] scsi/lsi53c895a: really fix use-after-free in lsi_do_msgout
|
||||
(CVE-2022-0216)
|
||||
|
||||
Set current_req to NULL, not current_req->req, to prevent reusing a free'd
|
||||
buffer in case of repeated SCSI cancel requests. Also apply the fix to
|
||||
CLEAR QUEUE and BUS DEVICE RESET messages as well, since they also cancel
|
||||
the request.
|
||||
|
||||
Thanks to Alexander Bulekov for providing a reproducer.
|
||||
|
||||
Fixes: CVE-2022-0216
|
||||
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/972
|
||||
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
|
||||
Tested-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Message-Id: <20220711123316.421279-1-mcascell@redhat.com>
|
||||
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
||||
|
||||
https://gitlab.com/qemu-project/qemu/-/commit/4367a20cc4
|
||||
CVE: CVE-2022-0216
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
hw/scsi/lsi53c895a.c | 3 +-
|
||||
1 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
|
||||
index 99ea42d49b..ad5f5e5f39 100644
|
||||
--- a/hw/scsi/lsi53c895a.c
|
||||
+++ b/hw/scsi/lsi53c895a.c
|
||||
@@ -1030,7 +1030,7 @@ static void lsi_do_msgout(LSIState *s)
|
||||
trace_lsi_do_msgout_abort(current_tag);
|
||||
if (current_req && current_req->req) {
|
||||
scsi_req_cancel(current_req->req);
|
||||
- current_req->req = NULL;
|
||||
+ current_req = NULL;
|
||||
}
|
||||
lsi_disconnect(s);
|
||||
break;
|
||||
@@ -1056,6 +1056,7 @@ static void lsi_do_msgout(LSIState *s)
|
||||
/* clear the current I/O process */
|
||||
if (s->current) {
|
||||
scsi_req_cancel(s->current->req);
|
||||
+ current_req = NULL;
|
||||
}
|
||||
|
||||
/* As the current implemented devices scsi_disk and scsi_generic
|
||||
--
|
||||
GitLab
|
||||
|
||||
146
meta/recipes-devtools/subversion/subversion/CVE-2021-28544.patch
Normal file
146
meta/recipes-devtools/subversion/subversion/CVE-2021-28544.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
From 61382fd8ea66000bd9ee8e203a6eab443220ee40 Mon Sep 17 00:00:00 2001
|
||||
From: Nathan Hartman <hartmannathan@apache.org>
|
||||
Date: Sun, 27 Mar 2022 05:59:18 +0000
|
||||
Subject: [PATCH] On the 1.14.x-r1899227 branch: Merge r1899227 from trunk
|
||||
w/testlist variation
|
||||
|
||||
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/1.14.x-r1899227@1899229 13f79535-47bb-0310-9956-ffa450edef68
|
||||
|
||||
CVE: CVE-2021-28544 [https://github.com/apache/subversion/commit/61382fd8ea66000bd9ee8e203a6eab443220ee40]
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
subversion/libsvn_repos/log.c | 26 +++++-------
|
||||
subversion/tests/cmdline/authz_tests.py | 55 +++++++++++++++++++++++++
|
||||
2 files changed, 65 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/subversion/libsvn_repos/log.c b/subversion/libsvn_repos/log.c
|
||||
index d9a1fb1085e16..41ca8aed27174 100644
|
||||
--- a/subversion/libsvn_repos/log.c
|
||||
+++ b/subversion/libsvn_repos/log.c
|
||||
@@ -337,42 +337,36 @@ detect_changed(svn_repos_revision_access_level_t *access_level,
|
||||
if ( (change->change_kind == svn_fs_path_change_add)
|
||||
|| (change->change_kind == svn_fs_path_change_replace))
|
||||
{
|
||||
- const char *copyfrom_path = change->copyfrom_path;
|
||||
- svn_revnum_t copyfrom_rev = change->copyfrom_rev;
|
||||
-
|
||||
/* the following is a potentially expensive operation since on FSFS
|
||||
we will follow the DAG from ROOT to PATH and that requires
|
||||
actually reading the directories along the way. */
|
||||
if (!change->copyfrom_known)
|
||||
{
|
||||
- SVN_ERR(svn_fs_copied_from(©from_rev, ©from_path,
|
||||
+ SVN_ERR(svn_fs_copied_from(&change->copyfrom_rev, &change->copyfrom_path,
|
||||
root, path, iterpool));
|
||||
change->copyfrom_known = TRUE;
|
||||
}
|
||||
|
||||
- if (copyfrom_path && SVN_IS_VALID_REVNUM(copyfrom_rev))
|
||||
+ if (change->copyfrom_path && SVN_IS_VALID_REVNUM(change->copyfrom_rev))
|
||||
{
|
||||
- svn_boolean_t readable = TRUE;
|
||||
-
|
||||
if (callbacks->authz_read_func)
|
||||
{
|
||||
svn_fs_root_t *copyfrom_root;
|
||||
+ svn_boolean_t readable;
|
||||
|
||||
SVN_ERR(svn_fs_revision_root(©from_root, fs,
|
||||
- copyfrom_rev, iterpool));
|
||||
+ change->copyfrom_rev, iterpool));
|
||||
SVN_ERR(callbacks->authz_read_func(&readable,
|
||||
copyfrom_root,
|
||||
- copyfrom_path,
|
||||
+ change->copyfrom_path,
|
||||
callbacks->authz_read_baton,
|
||||
iterpool));
|
||||
if (! readable)
|
||||
- found_unreadable = TRUE;
|
||||
- }
|
||||
-
|
||||
- if (readable)
|
||||
- {
|
||||
- change->copyfrom_path = copyfrom_path;
|
||||
- change->copyfrom_rev = copyfrom_rev;
|
||||
+ {
|
||||
+ found_unreadable = TRUE;
|
||||
+ change->copyfrom_path = NULL;
|
||||
+ change->copyfrom_rev = SVN_INVALID_REVNUM;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/subversion/tests/cmdline/authz_tests.py b/subversion/tests/cmdline/authz_tests.py
|
||||
index 760cb3663d02f..92e8a5e1935c9 100755
|
||||
--- a/subversion/tests/cmdline/authz_tests.py
|
||||
+++ b/subversion/tests/cmdline/authz_tests.py
|
||||
@@ -1731,6 +1731,60 @@ def empty_group(sbox):
|
||||
'--username', svntest.main.wc_author,
|
||||
sbox.repo_url)
|
||||
|
||||
+@Skip(svntest.main.is_ra_type_file)
|
||||
+def log_inaccessible_copyfrom(sbox):
|
||||
+ "log doesn't leak inaccessible copyfrom paths"
|
||||
+
|
||||
+ sbox.build(empty=True)
|
||||
+ sbox.simple_add_text('secret', 'private')
|
||||
+ sbox.simple_commit(message='log message for r1')
|
||||
+ sbox.simple_copy('private', 'public')
|
||||
+ sbox.simple_commit(message='log message for r2')
|
||||
+
|
||||
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
|
||||
+ # Remove svn:date and svn:author for predictable output.
|
||||
+ svntest.actions.run_and_verify_svn(None, [], 'propdel', '--revprop',
|
||||
+ '-r2', 'svn:date', sbox.repo_url)
|
||||
+ svntest.actions.run_and_verify_svn(None, [], 'propdel', '--revprop',
|
||||
+ '-r2', 'svn:author', sbox.repo_url)
|
||||
+
|
||||
+ write_restrictive_svnserve_conf(sbox.repo_dir)
|
||||
+
|
||||
+ # First test with blanket access.
|
||||
+ write_authz_file(sbox,
|
||||
+ {"/" : "* = rw"})
|
||||
+ expected_output = svntest.verify.ExpectedOutput([
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ "r2 | (no author) | (no date) | 1 line\n",
|
||||
+ "Changed paths:\n",
|
||||
+ " A /public (from /private:1)\n",
|
||||
+ "\n",
|
||||
+ "log message for r2\n",
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ ])
|
||||
+ svntest.actions.run_and_verify_svn(expected_output, [],
|
||||
+ 'log', '-r2', '-v',
|
||||
+ sbox.repo_url)
|
||||
+
|
||||
+ # Now test with an inaccessible copy source (/private).
|
||||
+ write_authz_file(sbox,
|
||||
+ {"/" : "* = rw"},
|
||||
+ {"/private" : "* ="})
|
||||
+ expected_output = svntest.verify.ExpectedOutput([
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ "r2 | (no author) | (no date) | 1 line\n",
|
||||
+ "Changed paths:\n",
|
||||
+ # The copy is shown as a plain add with no copyfrom info.
|
||||
+ " A /public\n",
|
||||
+ "\n",
|
||||
+ # No log message, as the revision is only partially visible.
|
||||
+ "\n",
|
||||
+ "------------------------------------------------------------------------\n",
|
||||
+ ])
|
||||
+ svntest.actions.run_and_verify_svn(expected_output, [],
|
||||
+ 'log', '-r2', '-v',
|
||||
+ sbox.repo_url)
|
||||
+
|
||||
|
||||
########################################################################
|
||||
# Run the tests
|
||||
@@ -1771,6 +1825,7 @@ def empty_group(sbox):
|
||||
inverted_group_membership,
|
||||
group_member_empty_string,
|
||||
empty_group,
|
||||
+ log_inaccessible_copyfrom,
|
||||
]
|
||||
serial_only = True
|
||||
|
||||
@@ -13,6 +13,7 @@ SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
|
||||
file://0001-Fix-libtool-name-in-configure.ac.patch \
|
||||
file://serfmacro.patch \
|
||||
file://CVE-2020-17525.patch \
|
||||
file://CVE-2021-28544.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "3004b4dae18bf45a0b6ea4ef8820064d"
|
||||
|
||||
183
meta/recipes-extended/libarchive/libarchive/CVE-2021-23177.patch
Normal file
183
meta/recipes-extended/libarchive/libarchive/CVE-2021-23177.patch
Normal file
@@ -0,0 +1,183 @@
|
||||
Description: Fix handling of symbolic link ACLs
|
||||
Published as CVE-2021-23177
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/fba4f123cc456d2b2538f811bb831483bf336bad
|
||||
Bug-Debian: https://bugs.debian.org/1001986
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Updated: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-23177
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/libarchive/archive_disk_acl_freebsd.c
|
||||
+++ b/libarchive/archive_disk_acl_freebsd.c
|
||||
@@ -319,7 +319,7 @@
|
||||
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
int acl_type = 0;
|
||||
@@ -364,6 +364,13 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
|
||||
+ errno = EINVAL;
|
||||
+ archive_set_error(a, errno,
|
||||
+ "Cannot set default ACL on non-directory");
|
||||
+ return (ARCHIVE_WARN);
|
||||
+ }
|
||||
+
|
||||
acl = acl_init(entries);
|
||||
if (acl == (acl_t)NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -542,7 +549,10 @@
|
||||
else if (acl_set_link_np(name, acl_type, acl) != 0)
|
||||
#else
|
||||
/* FreeBSD older than 8.0 */
|
||||
- else if (acl_set_file(name, acl_type, acl) != 0)
|
||||
+ else if (S_ISLNK(mode)) {
|
||||
+ /* acl_set_file() follows symbolic links, skip */
|
||||
+ ret = ARCHIVE_OK;
|
||||
+ } else if (acl_set_file(name, acl_type, acl) != 0)
|
||||
#endif
|
||||
{
|
||||
if (errno == EOPNOTSUPP) {
|
||||
@@ -677,14 +687,14 @@
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
|
||||
if (ret != ARCHIVE_OK)
|
||||
return (ret);
|
||||
}
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
|
||||
|
||||
/* Simultaneous POSIX.1e and NFSv4 is not supported */
|
||||
@@ -693,7 +703,7 @@
|
||||
#if ARCHIVE_ACL_FREEBSD_NFS4
|
||||
else if ((archive_acl_types(abstract_acl) &
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
|
||||
}
|
||||
#endif
|
||||
--- a/libarchive/archive_disk_acl_linux.c
|
||||
+++ b/libarchive/archive_disk_acl_linux.c
|
||||
@@ -343,6 +343,11 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Linux does not support RichACLs on symbolic links */
|
||||
+ return (ARCHIVE_OK);
|
||||
+ }
|
||||
+
|
||||
richacl = richacl_alloc(entries);
|
||||
if (richacl == NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -455,7 +460,7 @@
|
||||
#if ARCHIVE_ACL_LIBACL
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
int acl_type = 0;
|
||||
@@ -488,6 +493,18 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Linux does not support ACLs on symbolic links */
|
||||
+ return (ARCHIVE_OK);
|
||||
+ }
|
||||
+
|
||||
+ if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
|
||||
+ errno = EINVAL;
|
||||
+ archive_set_error(a, errno,
|
||||
+ "Cannot set default ACL on non-directory");
|
||||
+ return (ARCHIVE_WARN);
|
||||
+ }
|
||||
+
|
||||
acl = acl_init(entries);
|
||||
if (acl == (acl_t)NULL) {
|
||||
archive_set_error(a, errno,
|
||||
@@ -727,14 +744,14 @@
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
|
||||
if (ret != ARCHIVE_OK)
|
||||
return (ret);
|
||||
}
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
|
||||
}
|
||||
#endif /* ARCHIVE_ACL_LIBACL */
|
||||
--- a/libarchive/archive_disk_acl_sunos.c
|
||||
+++ b/libarchive/archive_disk_acl_sunos.c
|
||||
@@ -443,7 +443,7 @@
|
||||
|
||||
static int
|
||||
set_acl(struct archive *a, int fd, const char *name,
|
||||
- struct archive_acl *abstract_acl,
|
||||
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
|
||||
int ae_requested_type, const char *tname)
|
||||
{
|
||||
aclent_t *aclent;
|
||||
@@ -467,7 +467,6 @@
|
||||
if (entries == 0)
|
||||
return (ARCHIVE_OK);
|
||||
|
||||
-
|
||||
switch (ae_requested_type) {
|
||||
case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
|
||||
cmd = SETACL;
|
||||
@@ -492,6 +491,12 @@
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
+ if (S_ISLNK(mode)) {
|
||||
+ /* Skip ACLs on symbolic links */
|
||||
+ ret = ARCHIVE_OK;
|
||||
+ goto exit_free;
|
||||
+ }
|
||||
+
|
||||
e = 0;
|
||||
|
||||
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
|
||||
@@ -801,7 +806,7 @@
|
||||
if ((archive_acl_types(abstract_acl)
|
||||
& ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
|
||||
/* Solaris writes POSIX.1e access and default ACLs together */
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");
|
||||
|
||||
/* Simultaneous POSIX.1e and NFSv4 is not supported */
|
||||
@@ -810,7 +815,7 @@
|
||||
#if ARCHIVE_ACL_SUNOS_NFS4
|
||||
else if ((archive_acl_types(abstract_acl) &
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
|
||||
- ret = set_acl(a, fd, name, abstract_acl,
|
||||
+ ret = set_acl(a, fd, name, abstract_acl, mode,
|
||||
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
Description: Never follow symlinks when setting file flags on Linux
|
||||
Published as CVE-2021-31566
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/e2ad1a2c3064fa9eba6274b3641c4c1beed25c0b
|
||||
Bug-Debian: https://bugs.debian.org/1001990
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Update: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-31566
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/libarchive/archive_write_disk_posix.c
|
||||
+++ b/libarchive/archive_write_disk_posix.c
|
||||
@@ -3927,7 +3927,8 @@
|
||||
|
||||
/* If we weren't given an fd, open it ourselves. */
|
||||
if (myfd < 0) {
|
||||
- myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY | O_CLOEXEC);
|
||||
+ myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY |
|
||||
+ O_CLOEXEC | O_NOFOLLOW);
|
||||
__archive_ensure_cloexec_flag(myfd);
|
||||
}
|
||||
if (myfd < 0)
|
||||
@@ -0,0 +1,172 @@
|
||||
Description: Do not follow symlinks when processing the fixup list
|
||||
Published as CVE-2021-31566
|
||||
Origin: upstream, https://github.com/libarchive/libarchive/commit/b41daecb5ccb4c8e3b2c53fd6147109fc12c3043
|
||||
Bug-Debian: https://bugs.debian.org/1001990
|
||||
Author: Martin Matuska <martin@matuska.org>
|
||||
Last-Update: 2021-12-20
|
||||
|
||||
CVE: CVE-2021-31566
|
||||
Upstream-Status: Backport [http://deb.debian.org/debian/pool/main/liba/libarchive/libarchive_3.4.3-2+deb11u1.debian.tar.xz]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -556,6 +556,7 @@
|
||||
libarchive/test/test_write_disk.c \
|
||||
libarchive/test/test_write_disk_appledouble.c \
|
||||
libarchive/test/test_write_disk_failures.c \
|
||||
+ libarchive/test/test_write_disk_fixup.c \
|
||||
libarchive/test/test_write_disk_hardlink.c \
|
||||
libarchive/test/test_write_disk_hfs_compression.c \
|
||||
libarchive/test/test_write_disk_lookup.c \
|
||||
--- a/libarchive/archive_write_disk_posix.c
|
||||
+++ b/libarchive/archive_write_disk_posix.c
|
||||
@@ -2461,6 +2461,7 @@
|
||||
{
|
||||
struct archive_write_disk *a = (struct archive_write_disk *)_a;
|
||||
struct fixup_entry *next, *p;
|
||||
+ struct stat st;
|
||||
int fd, ret;
|
||||
|
||||
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
|
||||
@@ -2478,6 +2479,20 @@
|
||||
(TODO_TIMES | TODO_MODE_BASE | TODO_ACLS | TODO_FFLAGS)) {
|
||||
fd = open(p->name,
|
||||
O_WRONLY | O_BINARY | O_NOFOLLOW | O_CLOEXEC);
|
||||
+ if (fd == -1) {
|
||||
+ /* If we cannot lstat, skip entry */
|
||||
+ if (lstat(p->name, &st) != 0)
|
||||
+ goto skip_fixup_entry;
|
||||
+ /*
|
||||
+ * If we deal with a symbolic link, mark
|
||||
+ * it in the fixup mode to ensure no
|
||||
+ * modifications are made to its target.
|
||||
+ */
|
||||
+ if (S_ISLNK(st.st_mode)) {
|
||||
+ p->mode &= ~S_IFMT;
|
||||
+ p->mode |= S_IFLNK;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
if (p->fixup & TODO_TIMES) {
|
||||
set_times(a, fd, p->mode, p->name,
|
||||
@@ -2492,7 +2507,12 @@
|
||||
fchmod(fd, p->mode);
|
||||
else
|
||||
#endif
|
||||
- chmod(p->name, p->mode);
|
||||
+#ifdef HAVE_LCHMOD
|
||||
+ lchmod(p->name, p->mode);
|
||||
+#else
|
||||
+ if (!S_ISLNK(p->mode))
|
||||
+ chmod(p->name, p->mode);
|
||||
+#endif
|
||||
}
|
||||
if (p->fixup & TODO_ACLS)
|
||||
archive_write_disk_set_acls(&a->archive, fd,
|
||||
@@ -2503,6 +2523,7 @@
|
||||
if (p->fixup & TODO_MAC_METADATA)
|
||||
set_mac_metadata(a, p->name, p->mac_metadata,
|
||||
p->mac_metadata_size);
|
||||
+skip_fixup_entry:
|
||||
next = p->next;
|
||||
archive_acl_clear(&p->acl);
|
||||
free(p->mac_metadata);
|
||||
@@ -2643,6 +2664,7 @@
|
||||
fe->next = a->fixup_list;
|
||||
a->fixup_list = fe;
|
||||
fe->fixup = 0;
|
||||
+ fe->mode = 0;
|
||||
fe->name = strdup(pathname);
|
||||
return (fe);
|
||||
}
|
||||
--- a/libarchive/test/CMakeLists.txt
|
||||
+++ b/libarchive/test/CMakeLists.txt
|
||||
@@ -208,6 +208,7 @@
|
||||
test_write_disk.c
|
||||
test_write_disk_appledouble.c
|
||||
test_write_disk_failures.c
|
||||
+ test_write_disk_fixup.c
|
||||
test_write_disk_hardlink.c
|
||||
test_write_disk_hfs_compression.c
|
||||
test_write_disk_lookup.c
|
||||
--- /dev/null
|
||||
+++ b/libarchive/test/test_write_disk_fixup.c
|
||||
@@ -0,0 +1,77 @@
|
||||
+/*-
|
||||
+ * Copyright (c) 2021 Martin Matuska
|
||||
+ * All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notice, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+#include "test.h"
|
||||
+
|
||||
+/*
|
||||
+ * Test fixup entries don't follow symlinks
|
||||
+ */
|
||||
+DEFINE_TEST(test_write_disk_fixup)
|
||||
+{
|
||||
+ struct archive *ad;
|
||||
+ struct archive_entry *ae;
|
||||
+ int r;
|
||||
+
|
||||
+ if (!canSymlink()) {
|
||||
+ skipping("Symlinks not supported");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /* Write entries to disk. */
|
||||
+ assert((ad = archive_write_disk_new()) != NULL);
|
||||
+
|
||||
+ /*
|
||||
+ * Create a file
|
||||
+ */
|
||||
+ assertMakeFile("victim", 0600, "a");
|
||||
+
|
||||
+ /*
|
||||
+ * Create a directory and a symlink with the same name
|
||||
+ */
|
||||
+
|
||||
+ /* Directory: dir */
|
||||
+ assert((ae = archive_entry_new()) != NULL);
|
||||
+ archive_entry_copy_pathname(ae, "dir");
|
||||
+ archive_entry_set_mode(ae, AE_IFDIR | 0606);
|
||||
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
|
||||
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
|
||||
+ archive_entry_free(ae);
|
||||
+
|
||||
+ /* Symbolic Link: dir -> foo */
|
||||
+ assert((ae = archive_entry_new()) != NULL);
|
||||
+ archive_entry_copy_pathname(ae, "dir");
|
||||
+ archive_entry_set_mode(ae, AE_IFLNK | 0777);
|
||||
+ archive_entry_set_size(ae, 0);
|
||||
+ archive_entry_copy_symlink(ae, "victim");
|
||||
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
|
||||
+ if (r >= ARCHIVE_WARN)
|
||||
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
|
||||
+ archive_entry_free(ae);
|
||||
+
|
||||
+ assertEqualInt(ARCHIVE_OK, archive_write_free(ad));
|
||||
+
|
||||
+ /* Test the entries on disk. */
|
||||
+ assertIsSymlink("dir", "victim", 0);
|
||||
+ assertFileMode("victim", 0600);
|
||||
+}
|
||||
@@ -36,6 +36,9 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
|
||||
file://CVE-2021-36976-1.patch \
|
||||
file://CVE-2021-36976-2.patch \
|
||||
file://CVE-2021-36976-3.patch \
|
||||
file://CVE-2021-23177.patch \
|
||||
file://CVE-2021-31566-01.patch \
|
||||
file://CVE-2021-31566-02.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d953ed6b47694dadf0e6042f8f9ff451"
|
||||
|
||||
@@ -6,7 +6,7 @@ SECTION = "base"
|
||||
LICENSE = "PD & BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba"
|
||||
|
||||
PV = "2022a"
|
||||
PV = "2022d"
|
||||
|
||||
SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \
|
||||
http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \
|
||||
@@ -14,6 +14,6 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz
|
||||
|
||||
UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
|
||||
|
||||
SRC_URI[tzcode.sha256sum] = "f8575e7e33be9ee265df2081092526b81c80abac3f4a04399ae9d4d91cdadac7"
|
||||
SRC_URI[tzdata.sha256sum] = "ef7fffd9f4f50f4f58328b35022a32a5a056b245c5cb3d6791dddb342f871664"
|
||||
SRC_URI[tzcode.sha256sum] = "d644ba0f938899374ea8cb554e35fb4afa0f7bd7b716c61777cd00500b8759e0"
|
||||
SRC_URI[tzdata.sha256sum] = "6ecdbee27fa43dcfa49f3d4fd8bb1dfef54c90da1abcd82c9abcf2dc4f321de0"
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
From 95e581fd181b213c2ed7cdc63f2abc03eaaa77ec Mon Sep 17 00:00:00 2001
|
||||
From: Gert Wollny <gert.wollny@collabora.com>
|
||||
Date: Tue, 30 Nov 2021 10:17:26 +0100
|
||||
Subject: [PATCH] vrend: Add test to resource OOB write and fix it
|
||||
|
||||
v2: Also check that no depth != 1 has been send when none is due
|
||||
|
||||
Closes: #250
|
||||
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
|
||||
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
|
||||
|
||||
https://gitlab.freedesktop.org/virgl/virglrenderer/-/commit/95e581fd181b213c2ed7cdc63f2abc03eaaa77ec
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-0135
|
||||
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
|
||||
---
|
||||
src/vrend_renderer.c | 3 +++
|
||||
tests/test_fuzzer_formats.c | 43 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 46 insertions(+)
|
||||
|
||||
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
|
||||
index 28f669727..357b81b20 100644
|
||||
--- a/src/vrend_renderer.c
|
||||
+++ b/src/vrend_renderer.c
|
||||
@@ -7833,8 +7833,11 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
|
||||
info->box->height) * elsize;
|
||||
if (res->target == GL_TEXTURE_3D ||
|
||||
res->target == GL_TEXTURE_2D_ARRAY ||
|
||||
+ res->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY ||
|
||||
res->target == GL_TEXTURE_CUBE_MAP_ARRAY)
|
||||
send_size *= info->box->depth;
|
||||
+ else if (need_temp && info->box->depth != 1)
|
||||
+ return EINVAL;
|
||||
|
||||
if (need_temp) {
|
||||
data = malloc(send_size);
|
||||
diff --git a/tests/test_fuzzer_formats.c b/tests/test_fuzzer_formats.c
|
||||
index 59d6fb671..2de9a9a3f 100644
|
||||
--- a/tests/test_fuzzer_formats.c
|
||||
+++ b/tests/test_fuzzer_formats.c
|
||||
@@ -957,6 +957,48 @@ static void test_vrend_set_signle_abo_heap_overflow() {
|
||||
virgl_renderer_submit_cmd((void *) cmd, ctx_id, 0xde);
|
||||
}
|
||||
|
||||
+/* Test adapted from yaojun8558363@gmail.com:
|
||||
+ * https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/250
|
||||
+*/
|
||||
+static void test_vrend_3d_resource_overflow() {
|
||||
+
|
||||
+ struct virgl_renderer_resource_create_args resource;
|
||||
+ resource.handle = 0x4c474572;
|
||||
+ resource.target = PIPE_TEXTURE_2D_ARRAY;
|
||||
+ resource.format = VIRGL_FORMAT_Z24X8_UNORM;
|
||||
+ resource.nr_samples = 2;
|
||||
+ resource.last_level = 0;
|
||||
+ resource.array_size = 3;
|
||||
+ resource.bind = VIRGL_BIND_SAMPLER_VIEW;
|
||||
+ resource.depth = 1;
|
||||
+ resource.width = 8;
|
||||
+ resource.height = 4;
|
||||
+ resource.flags = 0;
|
||||
+
|
||||
+ virgl_renderer_resource_create(&resource, NULL, 0);
|
||||
+ virgl_renderer_ctx_attach_resource(ctx_id, resource.handle);
|
||||
+
|
||||
+ uint32_t size = 0x400;
|
||||
+ uint32_t cmd[size];
|
||||
+ int i = 0;
|
||||
+ cmd[i++] = (size - 1) << 16 | 0 << 8 | VIRGL_CCMD_RESOURCE_INLINE_WRITE;
|
||||
+ cmd[i++] = resource.handle;
|
||||
+ cmd[i++] = 0; // level
|
||||
+ cmd[i++] = 0; // usage
|
||||
+ cmd[i++] = 0; // stride
|
||||
+ cmd[i++] = 0; // layer_stride
|
||||
+ cmd[i++] = 0; // x
|
||||
+ cmd[i++] = 0; // y
|
||||
+ cmd[i++] = 0; // z
|
||||
+ cmd[i++] = 8; // w
|
||||
+ cmd[i++] = 4; // h
|
||||
+ cmd[i++] = 3; // d
|
||||
+ memset(&cmd[i], 0, size - i);
|
||||
+
|
||||
+ virgl_renderer_submit_cmd((void *) cmd, ctx_id, size);
|
||||
+}
|
||||
+
|
||||
+
|
||||
int main()
|
||||
{
|
||||
initialize_environment();
|
||||
@@ -979,6 +1021,7 @@ int main()
|
||||
test_cs_nullpointer_deference();
|
||||
test_vrend_set_signle_abo_heap_overflow();
|
||||
|
||||
+ test_vrend_3d_resource_overflow();
|
||||
|
||||
virgl_renderer_context_destroy(ctx_id);
|
||||
virgl_renderer_cleanup(&cookie);
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -13,6 +13,7 @@ SRCREV = "7d204f3927be65fb3365dce01dbcd04d447a4985"
|
||||
SRC_URI = "git://anongit.freedesktop.org/git/virglrenderer;branch=master \
|
||||
file://0001-gallium-Expand-libc-check-to-be-platform-OS-check.patch \
|
||||
file://0001-meson.build-use-python3-directly-for-python.patch \
|
||||
file://CVE-2022-0135.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
58
meta/recipes-graphics/xorg-lib/libx11/CVE-2022-3554.patch
Normal file
58
meta/recipes-graphics/xorg-lib/libx11/CVE-2022-3554.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 8b51d1375a4dd6a7cf3a919da83d8e87e57e7333 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Wed, 2 Nov 2022 17:04:15 +0530
|
||||
Subject: [PATCH] CVE-2022-3554
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/1d11822601fd24a396b354fa616b04ed3df8b4ef]
|
||||
CVE: CVE-2022-3554
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
fix a memory leak in XRegisterIMInstantiateCallback
|
||||
|
||||
Analysis:
|
||||
|
||||
_XimRegisterIMInstantiateCallback() opens an XIM and closes it using
|
||||
the internal function pointers, but the internal close function does
|
||||
not free the pointer to the XIM (this would be done in XCloseIM()).
|
||||
|
||||
Report/patch:
|
||||
|
||||
Date: Mon, 03 Oct 2022 18:47:32 +0800
|
||||
From: Po Lu <luangruo@yahoo.com>
|
||||
To: xorg-devel@lists.x.org
|
||||
Subject: Re: Yet another leak in Xlib
|
||||
|
||||
For reference, here's how I'm calling XRegisterIMInstantiateCallback:
|
||||
|
||||
XSetLocaleModifiers ("");
|
||||
XRegisterIMInstantiateCallback (compositor.display,
|
||||
XrmGetDatabase (compositor.display),
|
||||
(char *) compositor.resource_name,
|
||||
(char *) compositor.app_name,
|
||||
IMInstantiateCallback, NULL);
|
||||
and XMODIFIERS is:
|
||||
|
||||
@im=ibus
|
||||
|
||||
Signed-off-by: Thomas E. Dickey's avatarThomas E. Dickey <dickey@invisible-island.net>
|
||||
---
|
||||
modules/im/ximcp/imInsClbk.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/modules/im/ximcp/imInsClbk.c b/modules/im/ximcp/imInsClbk.c
|
||||
index 961aaba..0a8a874 100644
|
||||
--- a/modules/im/ximcp/imInsClbk.c
|
||||
+++ b/modules/im/ximcp/imInsClbk.c
|
||||
@@ -204,6 +204,9 @@ _XimRegisterIMInstantiateCallback(
|
||||
if( xim ) {
|
||||
lock = True;
|
||||
xim->methods->close( (XIM)xim );
|
||||
+ /* XIMs must be freed manually after being opened; close just
|
||||
+ does the protocol to deinitialize the IM. */
|
||||
+ XFree( xim );
|
||||
lock = False;
|
||||
icb->call = True;
|
||||
callback( display, client_data, NULL );
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -16,6 +16,7 @@ SRC_URI += "file://Fix-hanging-issue-in-_XReply.patch \
|
||||
file://CVE-2020-14344.patch \
|
||||
file://CVE-2020-14363.patch \
|
||||
file://CVE-2021-31535.patch \
|
||||
file://CVE-2022-3554.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "55adbfb6d4370ecac5e70598c4e7eed2"
|
||||
|
||||
@@ -11,6 +11,7 @@ SRC_URI += " \
|
||||
file://0001-Disable-installing-header-file-provided-by-another-p.patch \
|
||||
file://0001-Fix-build-for-Linux-5.8-rc1.patch \
|
||||
file://0001-Fix-build-for-Linux-5.9-rc1.patch \
|
||||
file://fix-build-for-Linux-5.11-rc1.patch \
|
||||
"
|
||||
|
||||
EXTRA_OEMAKE='KERNEL_DIR="${STAGING_KERNEL_DIR}" PREFIX="${D}"'
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
From 55c6315058fc0dd189ffd116f2cc27ba4fa84cb6 Mon Sep 17 00:00:00 2001
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Mon, 28 Dec 2020 01:41:31 +0100
|
||||
Subject: [PATCH] Fix build for Linux 5.11-rc1
|
||||
|
||||
ksys_close was removed, as far as I can tell, close_fd replaces it.
|
||||
|
||||
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8760c909f54a82aaa6e76da19afe798a0c77c3c3
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1572bfdf21d4d50e51941498ffe0b56c2289f783
|
||||
|
||||
Upstream-Status: Backport [https://github.com/cryptodev-linux/cryptodev-linux/commit/55c6315058fc0dd189ffd116f2cc27ba4fa84cb6]
|
||||
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
|
||||
---
|
||||
ioctl.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ioctl.c b/ioctl.c
|
||||
index 3d332380..95481d4f 100644
|
||||
--- a/ioctl.c
|
||||
+++ b/ioctl.c
|
||||
@@ -871,8 +871,10 @@ cryptodev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg_)
|
||||
if (unlikely(ret)) {
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0))
|
||||
sys_close(fd);
|
||||
-#else
|
||||
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
|
||||
ksys_close(fd);
|
||||
+#else
|
||||
+ close_fd(fd);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user