mirror of
https://git.yoctoproject.org/poky
synced 2026-02-22 09:29:40 +01:00
Compare commits
78 Commits
yocto-3.1.
...
dunfell-23
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d695bd0d3d | ||
|
|
08bd8cc114 | ||
|
|
eb32f7f5e6 | ||
|
|
88be415b10 | ||
|
|
24fc40faef | ||
|
|
868ebed326 | ||
|
|
17c23e485e | ||
|
|
61ea9f7665 | ||
|
|
b38628041b | ||
|
|
dee08141f2 | ||
|
|
61023f9e61 | ||
|
|
7350f515b3 | ||
|
|
50aa474c84 | ||
|
|
9c5b33ccba | ||
|
|
eb12590623 | ||
|
|
35bcc28983 | ||
|
|
48ea7812c7 | ||
|
|
010094a2ae | ||
|
|
43980058ca | ||
|
|
a985415ec2 | ||
|
|
79ac8cf161 | ||
|
|
3860414240 | ||
|
|
387d23c02e | ||
|
|
232fdbf0e5 | ||
|
|
60a98feb86 | ||
|
|
6a3d60d873 | ||
|
|
1c38d0d3d6 | ||
|
|
ca90350d13 | ||
|
|
159a2de146 | ||
|
|
684c5d4c12 | ||
|
|
8dfc7162e3 | ||
|
|
d2f8a57a30 | ||
|
|
0a0e0663ab | ||
|
|
79b3e05767 | ||
|
|
b6f4778e37 | ||
|
|
6e79d96c6d | ||
|
|
31b4392e6e | ||
|
|
4bc2324a25 | ||
|
|
6013fc2606 | ||
|
|
3f2da49c2b | ||
|
|
02867c9039 | ||
|
|
33a08f7b8f | ||
|
|
07eca06c71 | ||
|
|
9f20f682ff | ||
|
|
6d1f8412be | ||
|
|
872caf23ad | ||
|
|
b9bffd7650 | ||
|
|
0b84202a2b | ||
|
|
ae90fa778a | ||
|
|
fe6c34c48d | ||
|
|
2ae3d43628 | ||
|
|
5582ab6aae | ||
|
|
d4c7b40039 | ||
|
|
a2805141e9 | ||
|
|
7d9d97368b | ||
|
|
69fb63b4fc | ||
|
|
9638dc4826 | ||
|
|
f51a254415 | ||
|
|
1487d68388 | ||
|
|
8a382d8655 | ||
|
|
8d6f9680e4 | ||
|
|
23ed0037b6 | ||
|
|
95cda9d091 | ||
|
|
238fb89434 | ||
|
|
7f694e46a8 | ||
|
|
e873840317 | ||
|
|
9868f99149 | ||
|
|
f2d12bc50b | ||
|
|
6cf824520a | ||
|
|
42bb9689a0 | ||
|
|
7da79fcac2 | ||
|
|
1be2437fd2 | ||
|
|
d3d92d7852 | ||
|
|
6be9d793a3 | ||
|
|
77332ffb9b | ||
|
|
99478d73c5 | ||
|
|
196895a482 | ||
|
|
27877797c7 |
48
bitbake/bin/bitbake-getvar
Executable file
48
bitbake/bin/bitbake-getvar
Executable file
@@ -0,0 +1,48 @@
|
||||
#! /usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2021 Richard Purdie
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
|
||||
import argparse
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
|
||||
bindir = os.path.dirname(__file__)
|
||||
topdir = os.path.dirname(bindir)
|
||||
sys.path[0:0] = [os.path.join(topdir, 'lib')]
|
||||
|
||||
import bb.tinfoil
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Bitbake Query Variable")
|
||||
parser.add_argument("variable", help="variable name to query")
|
||||
parser.add_argument("-r", "--recipe", help="Recipe name to query", default=None, required=False)
|
||||
parser.add_argument('-u', '--unexpand', help='Do not expand the value (with --value)', action="store_true")
|
||||
parser.add_argument('-f', '--flag', help='Specify a variable flag to query (with --value)', default=None)
|
||||
parser.add_argument('--value', help='Only report the value, no history and no variable name', action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.unexpand and not args.value:
|
||||
print("--unexpand only makes sense with --value")
|
||||
sys.exit(1)
|
||||
|
||||
if args.flag and not args.value:
|
||||
print("--flag only makes sense with --value")
|
||||
sys.exit(1)
|
||||
|
||||
with bb.tinfoil.Tinfoil(tracking=True) as tinfoil:
|
||||
if args.recipe:
|
||||
tinfoil.prepare(quiet=2)
|
||||
d = tinfoil.parse_recipe(args.recipe)
|
||||
else:
|
||||
tinfoil.prepare(quiet=2, config_only=True)
|
||||
d = tinfoil.config_data
|
||||
if args.flag:
|
||||
print(str(d.getVarFlag(args.variable, args.flag, expand=(not args.unexpand))))
|
||||
elif args.value:
|
||||
print(str(d.getVar(args.variable, expand=(not args.unexpand))))
|
||||
else:
|
||||
bb.data.emit_var(args.variable, d=d, all=True)
|
||||
@@ -20,6 +20,7 @@ Commands are queued in a CommandQueue
|
||||
|
||||
from collections import OrderedDict, defaultdict
|
||||
|
||||
import io
|
||||
import bb.event
|
||||
import bb.cooker
|
||||
import bb.remotedata
|
||||
@@ -478,6 +479,17 @@ class CommandsSync:
|
||||
d = command.remotedatastores[dsindex].varhistory
|
||||
return getattr(d, method)(*args, **kwargs)
|
||||
|
||||
def dataStoreConnectorVarHistCmdEmit(self, command, params):
|
||||
dsindex = params[0]
|
||||
var = params[1]
|
||||
oval = params[2]
|
||||
val = params[3]
|
||||
d = command.remotedatastores[params[4]]
|
||||
|
||||
o = io.StringIO()
|
||||
command.remotedatastores[dsindex].varhistory.emit(var, oval, val, o, d)
|
||||
return o.getvalue()
|
||||
|
||||
def dataStoreConnectorIncHistCmd(self, command, params):
|
||||
dsindex = params[0]
|
||||
method = params[1]
|
||||
|
||||
@@ -224,7 +224,12 @@ class Git(FetchMethod):
|
||||
ud.shallow = False
|
||||
|
||||
if ud.usehead:
|
||||
ud.unresolvedrev['default'] = 'HEAD'
|
||||
# When usehead is set let's associate 'HEAD' with the unresolved
|
||||
# rev of this repository. This will get resolved into a revision
|
||||
# later. If an actual revision happens to have also been provided
|
||||
# then this setting will be overridden.
|
||||
for name in ud.names:
|
||||
ud.unresolvedrev[name] = 'HEAD'
|
||||
|
||||
ud.basecmd = d.getVar("FETCHCMD_git") or "git -c core.fsyncobjectfiles=0"
|
||||
|
||||
|
||||
@@ -91,10 +91,9 @@ class Wget(FetchMethod):
|
||||
|
||||
fetchcmd = self.basecmd
|
||||
|
||||
if 'downloadfilename' in ud.parm:
|
||||
localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile)
|
||||
bb.utils.mkdirhier(os.path.dirname(localpath))
|
||||
fetchcmd += " -O %s" % shlex.quote(localpath)
|
||||
localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp"
|
||||
bb.utils.mkdirhier(os.path.dirname(localpath))
|
||||
fetchcmd += " -O %s" % shlex.quote(localpath)
|
||||
|
||||
if ud.user and ud.pswd:
|
||||
fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (ud.user, ud.pswd)
|
||||
@@ -108,6 +107,10 @@ class Wget(FetchMethod):
|
||||
|
||||
self._runwget(ud, d, fetchcmd, False)
|
||||
|
||||
# Remove the ".tmp" and move the file into position atomically
|
||||
# Our lock prevents multiple writers but mirroring code may grab incomplete files
|
||||
os.rename(localpath, localpath[:-4])
|
||||
|
||||
# Sanity check since wget can pretend it succeed when it didn't
|
||||
# Also, this used to happen if sourceforge sent us to the mirror page
|
||||
if not os.path.exists(ud.localpath):
|
||||
|
||||
@@ -650,6 +650,58 @@ class FetcherLocalTest(FetcherTest):
|
||||
with self.assertRaises(bb.fetch2.UnpackError):
|
||||
self.fetchUnpack(['file://a;subdir=/bin/sh'])
|
||||
|
||||
def test_local_gitfetch_usehead(self):
|
||||
# Create dummy local Git repo
|
||||
src_dir = tempfile.mkdtemp(dir=self.tempdir,
|
||||
prefix='gitfetch_localusehead_')
|
||||
src_dir = os.path.abspath(src_dir)
|
||||
bb.process.run("git init", cwd=src_dir)
|
||||
bb.process.run("git commit --allow-empty -m'Dummy commit'",
|
||||
cwd=src_dir)
|
||||
# Use other branch than master
|
||||
bb.process.run("git checkout -b my-devel", cwd=src_dir)
|
||||
bb.process.run("git commit --allow-empty -m'Dummy commit 2'",
|
||||
cwd=src_dir)
|
||||
stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir)
|
||||
orig_rev = stdout[0].strip()
|
||||
|
||||
# Fetch and check revision
|
||||
self.d.setVar("SRCREV", "AUTOINC")
|
||||
url = "git://" + src_dir + ";protocol=file;usehead=1"
|
||||
fetcher = bb.fetch.Fetch([url], self.d)
|
||||
fetcher.download()
|
||||
fetcher.unpack(self.unpackdir)
|
||||
stdout = bb.process.run("git rev-parse HEAD",
|
||||
cwd=os.path.join(self.unpackdir, 'git'))
|
||||
unpack_rev = stdout[0].strip()
|
||||
self.assertEqual(orig_rev, unpack_rev)
|
||||
|
||||
def test_local_gitfetch_usehead_withname(self):
|
||||
# Create dummy local Git repo
|
||||
src_dir = tempfile.mkdtemp(dir=self.tempdir,
|
||||
prefix='gitfetch_localusehead_')
|
||||
src_dir = os.path.abspath(src_dir)
|
||||
bb.process.run("git init", cwd=src_dir)
|
||||
bb.process.run("git commit --allow-empty -m'Dummy commit'",
|
||||
cwd=src_dir)
|
||||
# Use other branch than master
|
||||
bb.process.run("git checkout -b my-devel", cwd=src_dir)
|
||||
bb.process.run("git commit --allow-empty -m'Dummy commit 2'",
|
||||
cwd=src_dir)
|
||||
stdout = bb.process.run("git rev-parse HEAD", cwd=src_dir)
|
||||
orig_rev = stdout[0].strip()
|
||||
|
||||
# Fetch and check revision
|
||||
self.d.setVar("SRCREV", "AUTOINC")
|
||||
url = "git://" + src_dir + ";protocol=file;usehead=1;name=newName"
|
||||
fetcher = bb.fetch.Fetch([url], self.d)
|
||||
fetcher.download()
|
||||
fetcher.unpack(self.unpackdir)
|
||||
stdout = bb.process.run("git rev-parse HEAD",
|
||||
cwd=os.path.join(self.unpackdir, 'git'))
|
||||
unpack_rev = stdout[0].strip()
|
||||
self.assertEqual(orig_rev, unpack_rev)
|
||||
|
||||
class FetcherNoNetworkTest(FetcherTest):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
@@ -53,6 +53,10 @@ class TinfoilDataStoreConnectorVarHistory:
|
||||
def remoteCommand(self, cmd, *args, **kwargs):
|
||||
return self.tinfoil.run_command('dataStoreConnectorVarHistCmd', self.dsindex, cmd, args, kwargs)
|
||||
|
||||
def emit(self, var, oval, val, o, d):
|
||||
ret = self.tinfoil.run_command('dataStoreConnectorVarHistCmdEmit', self.dsindex, var, oval, val, d.dsindex)
|
||||
o.write(ret)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if not hasattr(bb.data_smart.VariableHistory, name):
|
||||
raise AttributeError("VariableHistory has no such method %s" % name)
|
||||
|
||||
@@ -227,7 +227,9 @@ class TerminalFilter(object):
|
||||
|
||||
def keepAlive(self, t):
|
||||
if not self.cuu:
|
||||
print("Bitbake still alive (%ds)" % t)
|
||||
print("Bitbake still alive (no events for %ds). Active tasks:" % t)
|
||||
for t in self.helper.running_tasks:
|
||||
print(t)
|
||||
sys.stdout.flush()
|
||||
|
||||
def updateFooter(self):
|
||||
@@ -597,7 +599,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
||||
warnings = 0
|
||||
taskfailures = []
|
||||
|
||||
printinterval = 5000
|
||||
printintervaldelta = 10 * 60 # 10 minutes
|
||||
printinterval = printintervaldelta
|
||||
lastprint = time.time()
|
||||
|
||||
termfilter = tf(main, helper, console_handlers, params.options.quiet)
|
||||
@@ -607,7 +610,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
||||
try:
|
||||
if (lastprint + printinterval) <= time.time():
|
||||
termfilter.keepAlive(printinterval)
|
||||
printinterval += 5000
|
||||
printinterval += printintervaldelta
|
||||
event = eventHandler.waitEvent(0)
|
||||
if event is None:
|
||||
if main.shutdown > 1:
|
||||
@@ -638,7 +641,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
|
||||
|
||||
if isinstance(event, logging.LogRecord):
|
||||
lastprint = time.time()
|
||||
printinterval = 5000
|
||||
printinterval = printintervaldelta
|
||||
if event.levelno >= bb.msg.BBLogFormatter.ERROR:
|
||||
errors = errors + 1
|
||||
return_value = 1
|
||||
|
||||
@@ -222,19 +222,10 @@ an entire Linux distribution, including the toolchain, from source.
|
||||
.. tip::
|
||||
|
||||
You can significantly speed up your build and guard against fetcher
|
||||
failures by using mirrors. To use mirrors, add these lines to your
|
||||
local.conf file in the Build directory: ::
|
||||
failures by using mirrors. To use mirrors, add this line to your
|
||||
``local.conf`` file in the :term:`Build Directory`: ::
|
||||
|
||||
SSTATE_MIRRORS = "\
|
||||
file://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \n \
|
||||
file://.* http://sstate.yoctoproject.org/&YOCTO_DOC_VERSION_MINUS_ONE;/PATH;downloadfilename=PATH \n \
|
||||
file://.* http://sstate.yoctoproject.org/&YOCTO_DOC_VERSION;/PATH;downloadfilename=PATH \n \
|
||||
"
|
||||
|
||||
|
||||
The previous examples showed how to add sstate paths for Yocto Project
|
||||
&YOCTO_DOC_VERSION_MINUS_ONE;, &YOCTO_DOC_VERSION;, and a development
|
||||
area. For a complete index of sstate locations, see http://sstate.yoctoproject.org/.
|
||||
SSTATE_MIRRORS ?= "file://.* https://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
|
||||
|
||||
#. **Start the Build:** Continue with the following command to build an OS
|
||||
image for the target, which is ``core-image-sato`` in this example:
|
||||
|
||||
@@ -1986,9 +1986,7 @@ Behind the scenes, the shared state code works by looking in
|
||||
shared state files. Here is an example:
|
||||
::
|
||||
|
||||
SSTATE_MIRRORS ?= "\
|
||||
file://.\* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
|
||||
file://.\* file:///some/local/dir/sstate/PATH"
|
||||
SSTATE_MIRRORS ?= "file://.* https://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.17"
|
||||
DISTRO : "3.1.18"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.17"
|
||||
YOCTO_DOC_VERSION : "3.1.18"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.17"
|
||||
DOCCONF_VERSION : "3.1.17"
|
||||
DISTRO_REL_TAG : "yocto-3.1.18"
|
||||
DOCCONF_VERSION : "3.1.18"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.17"
|
||||
POKYVERSION : "23.0.18"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -7542,7 +7542,7 @@ system and gives an overview of their function and contents.
|
||||
``SYSTEMD_BOOT_CFG`` as follows:
|
||||
::
|
||||
|
||||
SYSTEMD_BOOT_CFG ?= "${:term:`S`}/loader.conf"
|
||||
SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
|
||||
|
||||
For information on Systemd-boot, see the `Systemd-boot
|
||||
documentation <http://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`__.
|
||||
@@ -8745,4 +8745,22 @@ system and gives an overview of their function and contents.
|
||||
|
||||
The default value of ``XSERVER``, if not specified in the machine
|
||||
configuration, is "xserver-xorg xf86-video-fbdev xf86-input-evdev".
|
||||
|
||||
|
||||
:term:`XZ_THREADS`
|
||||
Specifies the number of parallel threads that should be used when
|
||||
using xz compression.
|
||||
|
||||
By default this scales with core count, but is never set less than 2
|
||||
to ensure that multi-threaded mode is always used so that the output
|
||||
file contents are deterministic. Builds will work with a value of 1
|
||||
but the output will differ compared to the output from the compression
|
||||
generated when more than one thread is used.
|
||||
|
||||
On systems where many tasks run in parallel, setting a limit to this
|
||||
can be helpful in controlling system resource usage.
|
||||
|
||||
:term:`XZ_MEMLIMIT`
|
||||
Specifies the maximum memory the xz compression should use as a percentage
|
||||
of system memory. If unconstrained the xz compressor can use large amounts of
|
||||
memory and become problematic with parallelism elsewhere in the build.
|
||||
"50%" has been found to be a good value.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.17"
|
||||
DISTRO_VERSION = "3.1.18"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
|
||||
@@ -231,7 +231,7 @@ BB_DISKMON_DIRS ??= "\
|
||||
# present in the cache. It assumes you can download something faster than you can build it
|
||||
# which will depend on your network.
|
||||
#
|
||||
#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/2.5/PATH;downloadfilename=PATH"
|
||||
#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
|
||||
|
||||
#
|
||||
# Qemu configuration
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SUMMARY = "An image used during oe-selftest tests"
|
||||
|
||||
IMAGE_INSTALL = "packagegroup-core-boot dropbear"
|
||||
IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-dropbear"
|
||||
IMAGE_FEATURES = "debug-tweaks"
|
||||
|
||||
IMAGE_LINGUAS = " "
|
||||
|
||||
@@ -54,9 +54,10 @@ ARCHIVER_MODE[mirror] ?= "split"
|
||||
|
||||
DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
|
||||
ARCHIVER_TOPDIR ?= "${WORKDIR}/archiver-sources"
|
||||
ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${TARGET_SYS}/${PF}/"
|
||||
ARCHIVER_ARCH = "${TARGET_SYS}"
|
||||
ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${ARCHIVER_ARCH}/${PF}/"
|
||||
ARCHIVER_RPMTOPDIR ?= "${WORKDIR}/deploy-sources-rpm"
|
||||
ARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${TARGET_SYS}/${PF}/"
|
||||
ARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${ARCHIVER_ARCH}/${PF}/"
|
||||
ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/"
|
||||
|
||||
# When producing a combined mirror directory, allow duplicates for the case
|
||||
@@ -100,6 +101,10 @@ python () {
|
||||
bb.debug(1, 'archiver: %s is excluded, covered by gcc-source' % pn)
|
||||
return
|
||||
|
||||
# TARGET_SYS in ARCHIVER_ARCH will break the stamp for gcc-source in multiconfig
|
||||
if pn.startswith('gcc-source'):
|
||||
d.setVar('ARCHIVER_ARCH', "allarch")
|
||||
|
||||
def hasTask(task):
|
||||
return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False))
|
||||
|
||||
@@ -578,7 +583,7 @@ python do_dumpdata () {
|
||||
|
||||
SSTATETASKS += "do_deploy_archives"
|
||||
do_deploy_archives () {
|
||||
echo "Deploying source archive files from ${ARCHIVER_TOPDIR} to ${DEPLOY_DIR_SRC}."
|
||||
bbnote "Deploying source archive files from ${ARCHIVER_TOPDIR} to ${DEPLOY_DIR_SRC}."
|
||||
}
|
||||
python do_deploy_archives_setscene () {
|
||||
sstate_setscene(d)
|
||||
|
||||
@@ -47,7 +47,9 @@ CVE_CHECK_MANIFEST_JSON ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX
|
||||
CVE_CHECK_COPY_FILES ??= "1"
|
||||
CVE_CHECK_CREATE_MANIFEST ??= "1"
|
||||
|
||||
# Report Patched or Ignored/Whitelisted CVEs
|
||||
CVE_CHECK_REPORT_PATCHED ??= "1"
|
||||
|
||||
CVE_CHECK_SHOW_WARNINGS ??= "1"
|
||||
|
||||
# Provide text output
|
||||
@@ -56,6 +58,9 @@ CVE_CHECK_FORMAT_TEXT ??= "1"
|
||||
# Provide JSON output - disabled by default for backward compatibility
|
||||
CVE_CHECK_FORMAT_JSON ??= "0"
|
||||
|
||||
# Check for packages without CVEs (no issues or missing product name)
|
||||
CVE_CHECK_COVERAGE ??= "1"
|
||||
|
||||
# Whitelist for packages (PN)
|
||||
CVE_CHECK_PN_WHITELIST ?= ""
|
||||
|
||||
@@ -76,16 +81,10 @@ CVE_CHECK_LAYER_INCLUDELIST ??= ""
|
||||
# set to "alphabetical" for version using single alphabetical character as increment release
|
||||
CVE_VERSION_SUFFIX ??= ""
|
||||
|
||||
def update_symlinks(target_path, link_path):
|
||||
if link_path != target_path and os.path.exists(target_path):
|
||||
if os.path.exists(os.path.realpath(link_path)):
|
||||
os.remove(link_path)
|
||||
os.symlink(os.path.basename(target_path), link_path)
|
||||
|
||||
def generate_json_report(d, out_path, link_path):
|
||||
if os.path.exists(d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")):
|
||||
import json
|
||||
from oe.cve_check import cve_check_merge_jsons
|
||||
from oe.cve_check import cve_check_merge_jsons, update_symlinks
|
||||
|
||||
bb.note("Generating JSON CVE summary")
|
||||
index_file = d.getVar("CVE_CHECK_SUMMARY_INDEX_PATH")
|
||||
@@ -106,6 +105,7 @@ def generate_json_report(d, out_path, link_path):
|
||||
python cve_save_summary_handler () {
|
||||
import shutil
|
||||
import datetime
|
||||
from oe.cve_check import update_symlinks
|
||||
|
||||
cve_tmp_file = d.getVar("CVE_CHECK_TMP_FILE")
|
||||
|
||||
@@ -136,16 +136,17 @@ python do_cve_check () {
|
||||
"""
|
||||
Check recipe for patched and unpatched CVEs
|
||||
"""
|
||||
from oe.cve_check import get_patched_cves
|
||||
|
||||
if os.path.exists(d.getVar("CVE_CHECK_DB_FILE")):
|
||||
try:
|
||||
patched_cves = get_patches_cves(d)
|
||||
patched_cves = get_patched_cves(d)
|
||||
except FileNotFoundError:
|
||||
bb.fatal("Failure in searching patches")
|
||||
whitelisted, patched, unpatched = check_cves(d, patched_cves)
|
||||
if patched or unpatched:
|
||||
cve_data = get_cve_info(d, patched + unpatched)
|
||||
cve_write_data(d, patched, unpatched, whitelisted, cve_data)
|
||||
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")
|
||||
|
||||
@@ -164,7 +165,7 @@ python cve_check_cleanup () {
|
||||
}
|
||||
|
||||
addhandler cve_check_cleanup
|
||||
cve_check_cleanup[eventmask] = "bb.cooker.CookerExit"
|
||||
cve_check_cleanup[eventmask] = "bb.event.BuildCompleted"
|
||||
|
||||
python cve_check_write_rootfs_manifest () {
|
||||
"""
|
||||
@@ -174,7 +175,7 @@ python cve_check_write_rootfs_manifest () {
|
||||
import shutil
|
||||
import json
|
||||
from oe.rootfs import image_list_installed_packages
|
||||
from oe.cve_check import cve_check_merge_jsons
|
||||
from oe.cve_check import cve_check_merge_jsons, update_symlinks
|
||||
|
||||
if d.getVar("CVE_CHECK_COPY_FILES") == "1":
|
||||
deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE")
|
||||
@@ -247,65 +248,6 @@ ROOTFS_POSTPROCESS_COMMAND_prepend = "${@'cve_check_write_rootfs_manifest; ' if
|
||||
do_rootfs[recrdeptask] += "${@'do_cve_check' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"
|
||||
do_populate_sdk[recrdeptask] += "${@'do_cve_check' if d.getVar('CVE_CHECK_CREATE_MANIFEST') == '1' else ''}"
|
||||
|
||||
def get_patches_cves(d):
|
||||
"""
|
||||
Get patches that solve CVEs using the "CVE: " tag.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
pn = d.getVar("PN")
|
||||
cve_match = re.compile("CVE:( CVE\-\d{4}\-\d+)+")
|
||||
|
||||
# Matches the last "CVE-YYYY-ID" in the file name, also if written
|
||||
# in lowercase. Possible to have multiple CVE IDs in a single
|
||||
# file name, but only the last one will be detected from the file name.
|
||||
# However, patch files contents addressing multiple CVE IDs are supported
|
||||
# (cve_match regular expression)
|
||||
|
||||
cve_file_name_match = re.compile(".*([Cc][Vv][Ee]\-\d{4}\-\d+)")
|
||||
|
||||
patched_cves = set()
|
||||
bb.debug(2, "Looking for patches that solves CVEs for %s" % pn)
|
||||
for url in src_patches(d):
|
||||
patch_file = bb.fetch.decodeurl(url)[2]
|
||||
|
||||
if not os.path.isfile(patch_file):
|
||||
bb.error("File Not found: %s" % patch_file)
|
||||
raise FileNotFoundError
|
||||
|
||||
# Check patch file name for CVE ID
|
||||
fname_match = cve_file_name_match.search(patch_file)
|
||||
if fname_match:
|
||||
cve = fname_match.group(1).upper()
|
||||
patched_cves.add(cve)
|
||||
bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
|
||||
|
||||
with open(patch_file, "r", encoding="utf-8") as f:
|
||||
try:
|
||||
patch_text = f.read()
|
||||
except UnicodeDecodeError:
|
||||
bb.debug(1, "Failed to read patch %s using UTF-8 encoding"
|
||||
" trying with iso8859-1" % patch_file)
|
||||
f.close()
|
||||
with open(patch_file, "r", encoding="iso8859-1") as f:
|
||||
patch_text = f.read()
|
||||
|
||||
# Search for one or more "CVE: " lines
|
||||
text_match = False
|
||||
for match in cve_match.finditer(patch_text):
|
||||
# Get only the CVEs without the "CVE: " tag
|
||||
cves = patch_text[match.start()+5:match.end()]
|
||||
for cve in cves.split():
|
||||
bb.debug(2, "Patch %s solves %s" % (patch_file, cve))
|
||||
patched_cves.add(cve)
|
||||
text_match = True
|
||||
|
||||
if not fname_match and not text_match:
|
||||
bb.debug(2, "Patch %s doesn't solve CVEs" % patch_file)
|
||||
|
||||
return patched_cves
|
||||
|
||||
def check_cves(d, patched_cves):
|
||||
"""
|
||||
Connect to the NVD database and find unpatched cves.
|
||||
@@ -317,17 +259,20 @@ def check_cves(d, patched_cves):
|
||||
suffix = d.getVar("CVE_VERSION_SUFFIX")
|
||||
|
||||
cves_unpatched = []
|
||||
cves_ignored = []
|
||||
cves_status = []
|
||||
cves_in_recipe = False
|
||||
# CVE_PRODUCT can contain more than one product (eg. curl/libcurl)
|
||||
products = d.getVar("CVE_PRODUCT").split()
|
||||
# If this has been unset then we're not scanning for CVEs here (for example, image recipes)
|
||||
if not products:
|
||||
return ([], [], [])
|
||||
return ([], [], [], [])
|
||||
pv = d.getVar("CVE_VERSION").split("+git")[0]
|
||||
|
||||
# If the recipe has been whitelisted we return empty lists
|
||||
if pn in d.getVar("CVE_CHECK_PN_WHITELIST").split():
|
||||
bb.note("Recipe has been whitelisted, skipping check")
|
||||
return ([], [], [])
|
||||
return ([], [], [], [])
|
||||
|
||||
cve_whitelist = d.getVar("CVE_CHECK_WHITELIST").split()
|
||||
|
||||
@@ -337,6 +282,7 @@ def check_cves(d, patched_cves):
|
||||
|
||||
# For each of the known product names (e.g. curl has CPEs using curl and libcurl)...
|
||||
for product in products:
|
||||
cves_in_product = False
|
||||
if ":" in product:
|
||||
vendor, product = product.split(":", 1)
|
||||
else:
|
||||
@@ -348,17 +294,25 @@ def check_cves(d, patched_cves):
|
||||
|
||||
if cve in cve_whitelist:
|
||||
bb.note("%s-%s has been whitelisted for %s" % (product, pv, cve))
|
||||
# TODO: this should be in the report as 'whitelisted'
|
||||
patched_cves.add(cve)
|
||||
cves_ignored.append(cve)
|
||||
continue
|
||||
elif cve in patched_cves:
|
||||
bb.note("%s has been patched" % (cve))
|
||||
continue
|
||||
# Write status once only for each product
|
||||
if not cves_in_product:
|
||||
cves_status.append([product, True])
|
||||
cves_in_product = True
|
||||
cves_in_recipe = True
|
||||
|
||||
vulnerable = False
|
||||
ignored = False
|
||||
|
||||
for row in conn.execute("SELECT * FROM PRODUCTS WHERE ID IS ? AND PRODUCT IS ? AND VENDOR LIKE ?", (cve, product, vendor)):
|
||||
(_, _, _, version_start, operator_start, version_end, operator_end) = row
|
||||
#bb.debug(2, "Evaluating row " + str(row))
|
||||
if cve in cve_whitelist:
|
||||
ignored = True
|
||||
|
||||
if (operator_start == '=' and pv == version_start) or version_start == '-':
|
||||
vulnerable = True
|
||||
@@ -391,18 +345,25 @@ def check_cves(d, patched_cves):
|
||||
vulnerable = vulnerable_start or vulnerable_end
|
||||
|
||||
if vulnerable:
|
||||
bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
|
||||
cves_unpatched.append(cve)
|
||||
if ignored:
|
||||
bb.note("%s is ignored in %s-%s" % (cve, pn, real_pv))
|
||||
cves_ignored.append(cve)
|
||||
else:
|
||||
bb.note("%s-%s is vulnerable to %s" % (pn, real_pv, cve))
|
||||
cves_unpatched.append(cve)
|
||||
break
|
||||
|
||||
if not vulnerable:
|
||||
bb.note("%s-%s is not vulnerable to %s" % (pn, real_pv, cve))
|
||||
# TODO: not patched but not vulnerable
|
||||
patched_cves.add(cve)
|
||||
|
||||
if not cves_in_product:
|
||||
bb.note("No CVE records found for product %s, pn %s" % (product, pn))
|
||||
cves_status.append([product, False])
|
||||
|
||||
conn.close()
|
||||
|
||||
return (list(cve_whitelist), list(patched_cves), cves_unpatched)
|
||||
return (list(cves_ignored), list(patched_cves), cves_unpatched, cves_status)
|
||||
|
||||
def get_cve_info(d, cves):
|
||||
"""
|
||||
@@ -433,7 +394,6 @@ def cve_write_data_text(d, patched, unpatched, whitelisted, cve_data):
|
||||
CVE manifest if enabled.
|
||||
"""
|
||||
|
||||
|
||||
cve_file = d.getVar("CVE_CHECK_LOG")
|
||||
fdir_name = d.getVar("FILE_DIRNAME")
|
||||
layer = fdir_name.split("/")[-3]
|
||||
@@ -441,12 +401,18 @@ def cve_write_data_text(d, patched, unpatched, whitelisted, cve_data):
|
||||
include_layers = d.getVar("CVE_CHECK_LAYER_INCLUDELIST").split()
|
||||
exclude_layers = d.getVar("CVE_CHECK_LAYER_EXCLUDELIST").split()
|
||||
|
||||
report_all = d.getVar("CVE_CHECK_REPORT_PATCHED") == "1"
|
||||
|
||||
if exclude_layers and layer in exclude_layers:
|
||||
return
|
||||
|
||||
if include_layers and layer not in include_layers:
|
||||
return
|
||||
|
||||
# Early exit, the text format does not report packages without CVEs
|
||||
if not patched+unpatched+whitelisted:
|
||||
return
|
||||
|
||||
nvd_link = "https://nvd.nist.gov/vuln/detail/"
|
||||
write_string = ""
|
||||
unpatched_cves = []
|
||||
@@ -454,13 +420,16 @@ def cve_write_data_text(d, patched, unpatched, whitelisted, cve_data):
|
||||
|
||||
for cve in sorted(cve_data):
|
||||
is_patched = cve in patched
|
||||
if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"):
|
||||
is_ignored = cve in whitelisted
|
||||
|
||||
if (is_patched or is_ignored) and not report_all:
|
||||
continue
|
||||
|
||||
write_string += "LAYER: %s\n" % layer
|
||||
write_string += "PACKAGE NAME: %s\n" % d.getVar("PN")
|
||||
write_string += "PACKAGE VERSION: %s%s\n" % (d.getVar("EXTENDPE"), d.getVar("PV"))
|
||||
write_string += "CVE: %s\n" % cve
|
||||
if cve in whitelisted:
|
||||
if is_ignored:
|
||||
write_string += "CVE STATUS: Whitelisted\n"
|
||||
elif is_patched:
|
||||
write_string += "CVE STATUS: Patched\n"
|
||||
@@ -476,23 +445,22 @@ def cve_write_data_text(d, patched, unpatched, whitelisted, cve_data):
|
||||
if unpatched_cves and d.getVar("CVE_CHECK_SHOW_WARNINGS") == "1":
|
||||
bb.warn("Found unpatched CVE (%s), for more information check %s" % (" ".join(unpatched_cves),cve_file))
|
||||
|
||||
if write_string:
|
||||
with open(cve_file, "w") as f:
|
||||
bb.note("Writing file %s with CVE information" % cve_file)
|
||||
with open(cve_file, "w") as f:
|
||||
bb.note("Writing file %s with CVE information" % cve_file)
|
||||
f.write(write_string)
|
||||
|
||||
if d.getVar("CVE_CHECK_COPY_FILES") == "1":
|
||||
deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE")
|
||||
bb.utils.mkdirhier(os.path.dirname(deploy_file))
|
||||
with open(deploy_file, "w") as f:
|
||||
f.write(write_string)
|
||||
|
||||
if d.getVar("CVE_CHECK_COPY_FILES") == "1":
|
||||
deploy_file = d.getVar("CVE_CHECK_RECIPE_FILE")
|
||||
bb.utils.mkdirhier(os.path.dirname(deploy_file))
|
||||
with open(deploy_file, "w") as f:
|
||||
f.write(write_string)
|
||||
if d.getVar("CVE_CHECK_CREATE_MANIFEST") == "1":
|
||||
cvelogpath = d.getVar("CVE_CHECK_SUMMARY_DIR")
|
||||
bb.utils.mkdirhier(cvelogpath)
|
||||
|
||||
if d.getVar("CVE_CHECK_CREATE_MANIFEST") == "1":
|
||||
cvelogpath = d.getVar("CVE_CHECK_SUMMARY_DIR")
|
||||
bb.utils.mkdirhier(cvelogpath)
|
||||
|
||||
with open(d.getVar("CVE_CHECK_TMP_FILE"), "a") as f:
|
||||
f.write("%s" % write_string)
|
||||
with open(d.getVar("CVE_CHECK_TMP_FILE"), "a") as f:
|
||||
f.write("%s" % write_string)
|
||||
|
||||
def cve_check_write_json_output(d, output, direct_file, deploy_file, manifest_file):
|
||||
"""
|
||||
@@ -524,7 +492,7 @@ def cve_check_write_json_output(d, output, direct_file, deploy_file, manifest_fi
|
||||
with open(index_path, "a+") as f:
|
||||
f.write("%s\n" % fragment_path)
|
||||
|
||||
def cve_write_data_json(d, patched, unpatched, ignored, cve_data):
|
||||
def cve_write_data_json(d, patched, unpatched, ignored, cve_data, cve_status):
|
||||
"""
|
||||
Prepare CVE data for the JSON format, then write it.
|
||||
"""
|
||||
@@ -538,6 +506,8 @@ def cve_write_data_json(d, patched, unpatched, ignored, cve_data):
|
||||
include_layers = d.getVar("CVE_CHECK_LAYER_INCLUDELIST").split()
|
||||
exclude_layers = d.getVar("CVE_CHECK_LAYER_EXCLUDELIST").split()
|
||||
|
||||
report_all = d.getVar("CVE_CHECK_REPORT_PATCHED") == "1"
|
||||
|
||||
if exclude_layers and layer in exclude_layers:
|
||||
return
|
||||
|
||||
@@ -546,20 +516,29 @@ def cve_write_data_json(d, patched, unpatched, ignored, cve_data):
|
||||
|
||||
unpatched_cves = []
|
||||
|
||||
product_data = []
|
||||
for s in cve_status:
|
||||
p = {"product": s[0], "cvesInRecord": "Yes"}
|
||||
if s[1] == False:
|
||||
p["cvesInRecord"] = "No"
|
||||
product_data.append(p)
|
||||
|
||||
package_version = "%s%s" % (d.getVar("EXTENDPE"), d.getVar("PV"))
|
||||
package_data = {
|
||||
"name" : d.getVar("PN"),
|
||||
"layer" : layer,
|
||||
"version" : package_version
|
||||
"version" : package_version,
|
||||
"products": product_data
|
||||
}
|
||||
cve_list = []
|
||||
|
||||
for cve in sorted(cve_data):
|
||||
is_patched = cve in patched
|
||||
is_ignored = cve in ignored
|
||||
status = "Unpatched"
|
||||
if is_patched and (d.getVar("CVE_CHECK_REPORT_PATCHED") != "1"):
|
||||
if (is_patched or is_ignored) and not report_all:
|
||||
continue
|
||||
if cve in ignored:
|
||||
if is_ignored:
|
||||
status = "Ignored"
|
||||
elif is_patched:
|
||||
status = "Patched"
|
||||
@@ -589,7 +568,7 @@ def cve_write_data_json(d, patched, unpatched, ignored, cve_data):
|
||||
|
||||
cve_check_write_json_output(d, output, direct_file, deploy_file, manifest_file)
|
||||
|
||||
def cve_write_data(d, patched, unpatched, ignored, cve_data):
|
||||
def cve_write_data(d, patched, unpatched, ignored, cve_data, status):
|
||||
"""
|
||||
Write CVE data in each enabled format.
|
||||
"""
|
||||
@@ -597,4 +576,4 @@ def cve_write_data(d, patched, unpatched, ignored, cve_data):
|
||||
if d.getVar("CVE_CHECK_FORMAT_TEXT") == "1":
|
||||
cve_write_data_text(d, patched, unpatched, ignored, cve_data)
|
||||
if d.getVar("CVE_CHECK_FORMAT_JSON") == "1":
|
||||
cve_write_data_json(d, patched, unpatched, ignored, cve_data)
|
||||
cve_write_data_json(d, patched, unpatched, ignored, cve_data, status)
|
||||
|
||||
@@ -124,7 +124,7 @@ python () {
|
||||
def rootfs_variables(d):
|
||||
from oe.rootfs import variable_depends
|
||||
variables = ['IMAGE_DEVICE_TABLE','IMAGE_DEVICE_TABLES','BUILD_IMAGES_FROM_FEEDS','IMAGE_TYPES_MASKED','IMAGE_ROOTFS_ALIGNMENT','IMAGE_OVERHEAD_FACTOR','IMAGE_ROOTFS_SIZE','IMAGE_ROOTFS_EXTRA_SPACE',
|
||||
'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', 'IMAGE_LINGUAS_COMPLEMENTARY',
|
||||
'IMAGE_ROOTFS_MAXSIZE','IMAGE_NAME','IMAGE_LINK_NAME','IMAGE_MANIFEST','DEPLOY_DIR_IMAGE','IMAGE_FSTYPES','IMAGE_INSTALL_COMPLEMENTARY','IMAGE_LINGUAS', 'IMAGE_LINGUAS_COMPLEMENTARY', 'IMAGE_LOCALES_ARCHIVE',
|
||||
'MULTILIBRE_ALLOW_REP','MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS',
|
||||
'PACKAGE_ARCHS','PACKAGE_CLASSES','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS',
|
||||
'CONVERSIONTYPES', 'IMAGE_GEN_DEBUGFS', 'ROOTFS_RO_UNNEEDED', 'IMGDEPLOYDIR', 'PACKAGE_EXCLUDE_COMPLEMENTARY', 'REPRODUCIBLE_TIMESTAMP_ROOTFS', 'IMAGE_INSTALL_DEBUGFS']
|
||||
@@ -176,6 +176,9 @@ IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
|
||||
|
||||
LINGUAS_INSTALL ?= "${@" ".join(map(lambda s: "locale-base-%s" % s, d.getVar('IMAGE_LINGUAS').split()))}"
|
||||
|
||||
# per default create a locale archive
|
||||
IMAGE_LOCALES_ARCHIVE ?= '1'
|
||||
|
||||
# Prefer image, but use the fallback files for lookups if the image ones
|
||||
# aren't yet available.
|
||||
PSEUDO_PASSWD = "${IMAGE_ROOTFS}:${STAGING_DIR_NATIVE}"
|
||||
|
||||
@@ -945,7 +945,7 @@ def package_qa_check_host_user(path, name, d, elf, messages):
|
||||
|
||||
dest = d.getVar('PKGDEST')
|
||||
pn = d.getVar('PN')
|
||||
home = os.path.join(dest, 'home')
|
||||
home = os.path.join(dest, name, 'home')
|
||||
if path == home or path.startswith(home + os.sep):
|
||||
return
|
||||
|
||||
|
||||
@@ -269,6 +269,8 @@ do_kernel_metadata() {
|
||||
bbnote "KERNEL_FEATURES: $KERNEL_FEATURES_FINAL"
|
||||
bbnote "Final scc/cfg list: $sccs_defconfig $bsp_definition $sccs $KERNEL_FEATURES_FINAL"
|
||||
fi
|
||||
|
||||
set -e
|
||||
}
|
||||
|
||||
do_patch() {
|
||||
@@ -298,6 +300,8 @@ do_patch() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
set -e
|
||||
}
|
||||
|
||||
do_kernel_checkout() {
|
||||
@@ -356,6 +360,8 @@ do_kernel_checkout() {
|
||||
git commit -q -m "baseline commit: creating repo for ${PN}-${PV}"
|
||||
git clean -d -f
|
||||
fi
|
||||
|
||||
set -e
|
||||
}
|
||||
do_kernel_checkout[dirs] = "${S}"
|
||||
|
||||
@@ -523,6 +529,8 @@ do_validate_branches() {
|
||||
kgit-s2q --clean
|
||||
fi
|
||||
fi
|
||||
|
||||
set -e
|
||||
}
|
||||
|
||||
OE_TERMINAL_EXPORTS += "KBUILD_OUTPUT"
|
||||
|
||||
@@ -91,17 +91,17 @@ def copy_license_files(lic_files_paths, destdir):
|
||||
os.link(src, dst)
|
||||
except OSError as err:
|
||||
if err.errno == errno.EXDEV:
|
||||
# Copy license files if hard-link is not possible even if st_dev is the
|
||||
# Copy license files if hardlink is not possible even if st_dev is the
|
||||
# same on source and destination (docker container with device-mapper?)
|
||||
canlink = False
|
||||
else:
|
||||
raise
|
||||
# Only chown if we did hardling, and, we're running under pseudo
|
||||
# Only chown if we did hardlink and we're running under pseudo
|
||||
if canlink and os.environ.get('PSEUDO_DISABLED') == '0':
|
||||
os.chown(dst,0,0)
|
||||
if not canlink:
|
||||
begin_idx = int(beginline)-1 if beginline is not None else None
|
||||
end_idx = int(endline) if endline is not None else None
|
||||
begin_idx = max(0, int(beginline) - 1) if beginline is not None else None
|
||||
end_idx = max(0, int(endline)) if endline is not None else None
|
||||
if begin_idx is None and end_idx is None:
|
||||
shutil.copyfile(src, dst)
|
||||
else:
|
||||
|
||||
@@ -53,24 +53,23 @@ CVE-2015-4778 CVE-2015-4779 CVE-2015-4780 CVE-2015-4781 CVE-2015-4782 CVE-2015-4
|
||||
CVE-2015-4785 CVE-2015-4786 CVE-2015-4787 CVE-2015-4788 CVE-2015-4789 CVE-2015-4790 CVE-2016-0682 \
|
||||
CVE-2016-0689 CVE-2016-0692 CVE-2016-0694 CVE-2016-3418 CVE-2020-2981"
|
||||
|
||||
#### CPE update pending ####
|
||||
|
||||
# groff:groff-native https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2000-0803
|
||||
# Appears it was fixed in https://git.savannah.gnu.org/cgit/groff.git/commit/?id=07f95f1674217275ed4612f1dcaa95a88435c6a7
|
||||
# so from 1.17 onwards. Reported to the database for update by RP 2021/5/9. Update accepted 2021/5/10.
|
||||
#CVE_CHECK_WHITELIST += "CVE-2000-0803"
|
||||
|
||||
|
||||
|
||||
#### Upstream still working on ####
|
||||
|
||||
# qemu:qemu-native:qemu-system-native https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-20255
|
||||
# There was a proposed patch https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg06098.html
|
||||
# however qemu maintainers are sure the patch is incorrect and should not be applied.
|
||||
# qemu maintainers say the patch is incorrect and should not be applied
|
||||
# Ignore from OE's perspectivee as the issue is of low impact, at worst sitting in an infinite loop rather than exploitable
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-20255"
|
||||
|
||||
# wget https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2021-31879
|
||||
# https://mail.gnu.org/archive/html/bug-wget/2021-02/msg00002.html
|
||||
# No response upstream as of 2021/5/12
|
||||
# qemu:qemu-native:qemu-system-native https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-12067
|
||||
# There was a proposed patch but rejected by upstream qemu. It is unclear if the issue can
|
||||
# still be reproduced or where exactly any bug is.
|
||||
# Ignore from OE's perspective as we'll pick up any fix when upstream accepts one.
|
||||
CVE_CHECK_WHITELIST += "CVE-2019-12067"
|
||||
|
||||
# nasm:nasm-native https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2020-18974
|
||||
# It is a fuzzing related buffer overflow. It is of low impact since most devices
|
||||
# wouldn't expose an assembler. The upstream is inactive and there is little to be
|
||||
# done about the bug, ignore from an OE perspective.
|
||||
CVE_CHECK_WHITELIST += "CVE-2020-18974"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,3 +79,95 @@ def cve_check_merge_jsons(output, data):
|
||||
return
|
||||
|
||||
output["package"].append(data["package"][0])
|
||||
|
||||
def update_symlinks(target_path, link_path):
|
||||
"""
|
||||
Update a symbolic link link_path to point to target_path.
|
||||
Remove the link and recreate it if exist and is different.
|
||||
"""
|
||||
if link_path != target_path and os.path.exists(target_path):
|
||||
if os.path.exists(os.path.realpath(link_path)):
|
||||
os.remove(link_path)
|
||||
os.symlink(os.path.basename(target_path), link_path)
|
||||
|
||||
def get_patched_cves(d):
|
||||
"""
|
||||
Get patches that solve CVEs using the "CVE: " tag.
|
||||
"""
|
||||
|
||||
import re
|
||||
import oe.patch
|
||||
|
||||
pn = d.getVar("PN")
|
||||
cve_match = re.compile("CVE:( CVE\-\d{4}\-\d+)+")
|
||||
|
||||
# Matches the last "CVE-YYYY-ID" in the file name, also if written
|
||||
# in lowercase. Possible to have multiple CVE IDs in a single
|
||||
# file name, but only the last one will be detected from the file name.
|
||||
# However, patch files contents addressing multiple CVE IDs are supported
|
||||
# (cve_match regular expression)
|
||||
|
||||
cve_file_name_match = re.compile(".*([Cc][Vv][Ee]\-\d{4}\-\d+)")
|
||||
|
||||
patched_cves = set()
|
||||
bb.debug(2, "Looking for patches that solves CVEs for %s" % pn)
|
||||
for url in oe.patch.src_patches(d):
|
||||
patch_file = bb.fetch.decodeurl(url)[2]
|
||||
|
||||
if not os.path.isfile(patch_file):
|
||||
bb.error("File Not found: %s" % patch_file)
|
||||
raise FileNotFoundError
|
||||
|
||||
# Check patch file name for CVE ID
|
||||
fname_match = cve_file_name_match.search(patch_file)
|
||||
if fname_match:
|
||||
cve = fname_match.group(1).upper()
|
||||
patched_cves.add(cve)
|
||||
bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
|
||||
|
||||
with open(patch_file, "r", encoding="utf-8") as f:
|
||||
try:
|
||||
patch_text = f.read()
|
||||
except UnicodeDecodeError:
|
||||
bb.debug(1, "Failed to read patch %s using UTF-8 encoding"
|
||||
" trying with iso8859-1" % patch_file)
|
||||
f.close()
|
||||
with open(patch_file, "r", encoding="iso8859-1") as f:
|
||||
patch_text = f.read()
|
||||
|
||||
# Search for one or more "CVE: " lines
|
||||
text_match = False
|
||||
for match in cve_match.finditer(patch_text):
|
||||
# Get only the CVEs without the "CVE: " tag
|
||||
cves = patch_text[match.start()+5:match.end()]
|
||||
for cve in cves.split():
|
||||
bb.debug(2, "Patch %s solves %s" % (patch_file, cve))
|
||||
patched_cves.add(cve)
|
||||
text_match = True
|
||||
|
||||
if not fname_match and not text_match:
|
||||
bb.debug(2, "Patch %s doesn't solve CVEs" % patch_file)
|
||||
|
||||
return patched_cves
|
||||
|
||||
|
||||
def get_cpe_ids(cve_product, version):
|
||||
"""
|
||||
Get list of CPE identifiers for the given product and version
|
||||
"""
|
||||
|
||||
version = version.split("+git")[0]
|
||||
|
||||
cpe_ids = []
|
||||
for product in cve_product.split():
|
||||
# CVE_PRODUCT in recipes may include vendor information for CPE identifiers. If not,
|
||||
# use wildcard for vendor.
|
||||
if ":" in product:
|
||||
vendor, product = product.split(":", 1)
|
||||
else:
|
||||
vendor = "*"
|
||||
|
||||
cpe_id = f'cpe:2.3:a:{vendor}:{product}:{version}:*:*:*:*:*:*:*'
|
||||
cpe_ids.append(cpe_id)
|
||||
|
||||
return cpe_ids
|
||||
|
||||
@@ -611,12 +611,13 @@ class PackageManager(object, metaclass=ABCMeta):
|
||||
"'%s' returned %d:\n%s" %
|
||||
(' '.join(cmd), e.returncode, e.output.decode("utf-8")))
|
||||
|
||||
target_arch = self.d.getVar('TARGET_ARCH')
|
||||
localedir = oe.path.join(self.target_rootfs, self.d.getVar("libdir"), "locale")
|
||||
if os.path.exists(localedir) and os.listdir(localedir):
|
||||
generate_locale_archive(self.d, self.target_rootfs, target_arch, localedir)
|
||||
# And now delete the binary locales
|
||||
self.remove(fnmatch.filter(self.list_installed(), "glibc-binary-localedata-*"), False)
|
||||
if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1':
|
||||
target_arch = self.d.getVar('TARGET_ARCH')
|
||||
localedir = oe.path.join(self.target_rootfs, self.d.getVar("libdir"), "locale")
|
||||
if os.path.exists(localedir) and os.listdir(localedir):
|
||||
generate_locale_archive(self.d, self.target_rootfs, target_arch, localedir)
|
||||
# And now delete the binary locales
|
||||
self.remove(fnmatch.filter(self.list_installed(), "glibc-binary-localedata-*"), False)
|
||||
|
||||
def deploy_dir_lock(self):
|
||||
if self.deploy_dir is None:
|
||||
|
||||
@@ -321,7 +321,9 @@ class Rootfs(object, metaclass=ABCMeta):
|
||||
if not os.path.exists(kernel_abi_ver_file):
|
||||
bb.fatal("No kernel-abiversion file found (%s), cannot run depmod, aborting" % kernel_abi_ver_file)
|
||||
|
||||
kernel_ver = open(kernel_abi_ver_file).read().strip(' \n')
|
||||
with open(kernel_abi_ver_file) as f:
|
||||
kernel_ver = f.read().strip(' \n')
|
||||
|
||||
versioned_modules_dir = os.path.join(self.image_rootfs, modules_dir, kernel_ver)
|
||||
|
||||
bb.utils.mkdirhier(versioned_modules_dir)
|
||||
|
||||
@@ -23,7 +23,7 @@ class ScpTest(OERuntimeTestCase):
|
||||
os.remove(cls.tmp_path)
|
||||
|
||||
@OETestDepends(['ssh.SSHTest.test_ssh'])
|
||||
@OEHasPackage(['openssh-scp', 'dropbear'])
|
||||
@OEHasPackage(['openssh-scp'])
|
||||
def test_scp_file(self):
|
||||
dst = '/tmp/test_scp_file'
|
||||
|
||||
|
||||
@@ -117,3 +117,85 @@ CVE_CHECK_FORMAT_JSON = "1"
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertEqual(len(report["package"]), 1)
|
||||
self.assertEqual(report["package"][0]["name"], recipename)
|
||||
|
||||
|
||||
def test_recipe_report_json_unpatched(self):
|
||||
config = """
|
||||
INHERIT += "cve-check"
|
||||
CVE_CHECK_FORMAT_JSON = "1"
|
||||
CVE_CHECK_REPORT_PATCHED = "0"
|
||||
"""
|
||||
self.write_config(config)
|
||||
|
||||
vars = get_bb_vars(["CVE_CHECK_SUMMARY_DIR", "CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
summary_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], vars["CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
recipe_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], "m4-native_cve.json")
|
||||
|
||||
try:
|
||||
os.remove(summary_json)
|
||||
os.remove(recipe_json)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
bitbake("m4-native -c cve_check")
|
||||
|
||||
def check_m4_json(filename):
|
||||
with open(filename) as f:
|
||||
report = json.load(f)
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertEqual(len(report["package"]), 1)
|
||||
package = report["package"][0]
|
||||
self.assertEqual(package["name"], "m4-native")
|
||||
#m4 had only Patched CVEs, so the issues array will be empty
|
||||
self.assertEqual(package["issue"], [])
|
||||
|
||||
self.assertExists(summary_json)
|
||||
check_m4_json(summary_json)
|
||||
self.assertExists(recipe_json)
|
||||
check_m4_json(recipe_json)
|
||||
|
||||
|
||||
def test_recipe_report_json_ignored(self):
|
||||
config = """
|
||||
INHERIT += "cve-check"
|
||||
CVE_CHECK_FORMAT_JSON = "1"
|
||||
CVE_CHECK_REPORT_PATCHED = "1"
|
||||
"""
|
||||
self.write_config(config)
|
||||
|
||||
vars = get_bb_vars(["CVE_CHECK_SUMMARY_DIR", "CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
summary_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], vars["CVE_CHECK_SUMMARY_FILE_NAME_JSON"])
|
||||
recipe_json = os.path.join(vars["CVE_CHECK_SUMMARY_DIR"], "logrotate_cve.json")
|
||||
|
||||
try:
|
||||
os.remove(summary_json)
|
||||
os.remove(recipe_json)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
bitbake("logrotate -c cve_check")
|
||||
|
||||
def check_m4_json(filename):
|
||||
with open(filename) as f:
|
||||
report = json.load(f)
|
||||
self.assertEqual(report["version"], "1")
|
||||
self.assertEqual(len(report["package"]), 1)
|
||||
package = report["package"][0]
|
||||
self.assertEqual(package["name"], "logrotate")
|
||||
found_cves = { issue["id"]: issue["status"] for issue in package["issue"]}
|
||||
# m4 CVE should not be in logrotate
|
||||
self.assertNotIn("CVE-2008-1687", found_cves)
|
||||
# logrotate has both Patched and Ignored CVEs
|
||||
self.assertIn("CVE-2011-1098", found_cves)
|
||||
self.assertEqual(found_cves["CVE-2011-1098"], "Patched")
|
||||
self.assertIn("CVE-2011-1548", found_cves)
|
||||
self.assertEqual(found_cves["CVE-2011-1548"], "Ignored")
|
||||
self.assertIn("CVE-2011-1549", found_cves)
|
||||
self.assertEqual(found_cves["CVE-2011-1549"], "Ignored")
|
||||
self.assertIn("CVE-2011-1550", found_cves)
|
||||
self.assertEqual(found_cves["CVE-2011-1550"], "Ignored")
|
||||
|
||||
self.assertExists(summary_json)
|
||||
check_m4_json(summary_json)
|
||||
self.assertExists(recipe_json)
|
||||
check_m4_json(recipe_json)
|
||||
|
||||
@@ -133,7 +133,8 @@ class OEListPackageconfigTests(OEScriptTests):
|
||||
def check_endlines(self, results, expected_endlines):
|
||||
for line in results.output.splitlines():
|
||||
for el in expected_endlines:
|
||||
if line.split() == el.split():
|
||||
if line and line.split()[0] == el.split()[0] and \
|
||||
' '.join(sorted(el.split())) in ' '.join(sorted(line.split())):
|
||||
expected_endlines.remove(el)
|
||||
break
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=6626bb1e20189cfa95f2c508ba286393"
|
||||
|
||||
COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
|
||||
|
||||
SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=master;protocol=https \
|
||||
SRC_URI = "git://github.com/rhinstaller/efivar.git;branch=main;protocol=https \
|
||||
file://determinism.patch \
|
||||
file://no-werror.patch"
|
||||
SRCREV = "c1d6b10e1ed4ba2be07f385eae5bceb694478a10"
|
||||
|
||||
32
meta/recipes-bsp/grub/files/CVE-2021-3981.patch
Normal file
32
meta/recipes-bsp/grub/files/CVE-2021-3981.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 67740c43c9326956ea5cd6be77f813b5499a56a5 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 27 Jun 2022 10:15:29 +0530
|
||||
Subject: [PATCH] CVE-2021-3981
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/diff/util/grub-mkconfig.in?id=0adec29674561034771c13e446069b41ef41e4d4]
|
||||
CVE: CVE-2021-3981
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
util/grub-mkconfig.in | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
||||
index 9f477ff..ead94a6 100644
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -287,7 +287,11 @@ and /etc/grub.d/* files or please file a bug report with
|
||||
exit 1
|
||||
else
|
||||
# none of the children aborted with error, install the new grub.cfg
|
||||
- mv -f ${grub_cfg}.new ${grub_cfg}
|
||||
+ oldumask=$(umask)
|
||||
+ umask 077
|
||||
+ cat ${grub_cfg}.new > ${grub_cfg}
|
||||
+ umask $oldumask
|
||||
+ rm -f ${grub_cfg}.new
|
||||
fi
|
||||
fi
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -95,6 +95,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
|
||||
file://0044-script-execute-Fix-NULL-dereference-in-grub_script_e.patch \
|
||||
file://0045-commands-ls-Require-device_name-is-not-NULL-before-p.patch \
|
||||
file://0046-script-execute-Avoid-crash-when-using-outside-a-func.patch \
|
||||
file://CVE-2021-3981.patch\
|
||||
"
|
||||
SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
|
||||
SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
|
||||
|
||||
@@ -60,6 +60,13 @@ CVE_CHECK_WHITELIST += "CVE-2008-3844"
|
||||
# https://ubuntu.com/security/CVE-2016-20012
|
||||
CVE_CHECK_WHITELIST += "CVE-2016-20012"
|
||||
|
||||
# As per debian, the issue is fixed by a feature called "agent restriction" in openssh 8.9
|
||||
# Urgency is unimportant as per debian, Hence this CVE is whitelisting.
|
||||
# https://security-tracker.debian.org/tracker/CVE-2021-36368
|
||||
# https://bugzilla.mindrot.org/show_bug.cgi?id=3316#c2
|
||||
# https://docs.ssh-mitm.at/trivialauth.html
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-36368"
|
||||
|
||||
PAM_SRC_URI = "file://sshd"
|
||||
|
||||
inherit manpages useradd update-rc.d update-alternatives systemd
|
||||
@@ -189,6 +196,11 @@ RRECOMMENDS_${PN}-sshd_append_class-target = "\
|
||||
${@bb.utils.filter('PACKAGECONFIG', 'rng-tools', d)} \
|
||||
"
|
||||
|
||||
# break dependency on base package for -dev package
|
||||
# otherwise SDK fails to build as the main openssh and dropbear packages
|
||||
# conflict with each other
|
||||
RDEPENDS:${PN}-dev = ""
|
||||
|
||||
# gdb would make attach-ptrace test pass rather than skip but not worth the build dependencies
|
||||
RDEPENDS_${PN}-ptest += "${PN}-sftp ${PN}-misc ${PN}-sftp-server make sed sudo coreutils"
|
||||
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
From 770aea88c3888cc5cb3ebc94ffcef706c68bc1d2 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Mraz <tomas@openssl.org>
|
||||
Date: Wed, 1 Jun 2022 12:06:33 +0200
|
||||
Subject: [PATCH] Update expired SCT issuer certificate
|
||||
|
||||
Fixes #15179
|
||||
|
||||
Reviewed-by: Matt Caswell <matt@openssl.org>
|
||||
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
|
||||
(Merged from https://github.com/openssl/openssl/pull/18444)
|
||||
|
||||
Upstream-Status: Backport
|
||||
[Fixes ptest failures in OE-Core]
|
||||
---
|
||||
test/certs/embeddedSCTs1_issuer.pem | 30 ++++++++++++++---------------
|
||||
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/test/certs/embeddedSCTs1_issuer.pem b/test/certs/embeddedSCTs1_issuer.pem
|
||||
index 1fa449d5a098..6aa9455f09ed 100644
|
||||
--- a/test/certs/embeddedSCTs1_issuer.pem
|
||||
+++ b/test/certs/embeddedSCTs1_issuer.pem
|
||||
@@ -1,18 +1,18 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
-MIIC0DCCAjmgAwIBAgIBADANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJHQjEk
|
||||
+MIIC0jCCAjugAwIBAgIBADANBgkqhkiG9w0BAQsFADBVMQswCQYDVQQGEwJHQjEk
|
||||
MCIGA1UEChMbQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5IENBMQ4wDAYDVQQIEwVX
|
||||
-YWxlczEQMA4GA1UEBxMHRXJ3IFdlbjAeFw0xMjA2MDEwMDAwMDBaFw0yMjA2MDEw
|
||||
-MDAwMDBaMFUxCzAJBgNVBAYTAkdCMSQwIgYDVQQKExtDZXJ0aWZpY2F0ZSBUcmFu
|
||||
-c3BhcmVuY3kgQ0ExDjAMBgNVBAgTBVdhbGVzMRAwDgYDVQQHEwdFcncgV2VuMIGf
|
||||
-MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVimhTYhCicRmTbneDIRgcKkATxtB7
|
||||
-jHbrkVfT0PtLO1FuzsvRyY2RxS90P6tjXVUJnNE6uvMa5UFEJFGnTHgW8iQ8+EjP
|
||||
-KDHM5nugSlojgZ88ujfmJNnDvbKZuDnd/iYx0ss6hPx7srXFL8/BT/9Ab1zURmnL
|
||||
-svfP34b7arnRsQIDAQABo4GvMIGsMB0GA1UdDgQWBBRfnYgNyHPmVNT4DdjmsMEk
|
||||
-tEfDVTB9BgNVHSMEdjB0gBRfnYgNyHPmVNT4DdjmsMEktEfDVaFZpFcwVTELMAkG
|
||||
-A1UEBhMCR0IxJDAiBgNVBAoTG0NlcnRpZmljYXRlIFRyYW5zcGFyZW5jeSBDQTEO
|
||||
-MAwGA1UECBMFV2FsZXMxEDAOBgNVBAcTB0VydyBXZW6CAQAwDAYDVR0TBAUwAwEB
|
||||
-/zANBgkqhkiG9w0BAQUFAAOBgQAGCMxKbWTyIF4UbASydvkrDvqUpdryOvw4BmBt
|
||||
-OZDQoeojPUApV2lGOwRmYef6HReZFSCa6i4Kd1F2QRIn18ADB8dHDmFYT9czQiRy
|
||||
-f1HWkLxHqd81TbD26yWVXeGJPE3VICskovPkQNJ0tU4b03YmnKliibduyqQQkOFP
|
||||
-OwqULg==
|
||||
+YWxlczEQMA4GA1UEBxMHRXJ3IFdlbjAgFw0yMjA2MDExMDM4MDJaGA8yMTIyMDUw
|
||||
+ODEwMzgwMlowVTELMAkGA1UEBhMCR0IxJDAiBgNVBAoTG0NlcnRpZmljYXRlIFRy
|
||||
+YW5zcGFyZW5jeSBDQTEOMAwGA1UECBMFV2FsZXMxEDAOBgNVBAcTB0VydyBXZW4w
|
||||
+gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANWKaFNiEKJxGZNud4MhGBwqQBPG
|
||||
+0HuMduuRV9PQ+0s7UW7Oy9HJjZHFL3Q/q2NdVQmc0Tq68xrlQUQkUadMeBbyJDz4
|
||||
+SM8oMczme6BKWiOBnzy6N+Yk2cO9spm4Od3+JjHSyzqE/HuytcUvz8FP/0BvXNRG
|
||||
+acuy98/fhvtqudGxAgMBAAGjga8wgawwHQYDVR0OBBYEFF+diA3Ic+ZU1PgN2Oaw
|
||||
+wSS0R8NVMH0GA1UdIwR2MHSAFF+diA3Ic+ZU1PgN2OawwSS0R8NVoVmkVzBVMQsw
|
||||
+CQYDVQQGEwJHQjEkMCIGA1UEChMbQ2VydGlmaWNhdGUgVHJhbnNwYXJlbmN5IENB
|
||||
+MQ4wDAYDVQQIEwVXYWxlczEQMA4GA1UEBxMHRXJ3IFdlboIBADAMBgNVHRMEBTAD
|
||||
+AQH/MA0GCSqGSIb3DQEBCwUAA4GBAD0aYh9OkFYfXV7kBfhrtD0PJG2U47OV/1qq
|
||||
++uFpqB0S1WO06eJT0pzYf1ebUcxjBkajbJZm/FHT85VthZ1lFHsky87aFD8XlJCo
|
||||
+2IOhKOkvvWKPUdFLoO/ZVXqEVKkcsS1eXK1glFvb07eJZya3JVG0KdMhV2YoDg6c
|
||||
+Doud4XrO
|
||||
-----END CERTIFICATE-----
|
||||
@@ -18,14 +18,13 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
|
||||
file://afalg.patch \
|
||||
file://reproducible.patch \
|
||||
file://reproducibility.patch \
|
||||
file://770aea88c3888cc5cb3ebc94ffcef706c68bc1d2.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f"
|
||||
SRC_URI[sha256sum] = "d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -12,6 +12,11 @@ DEPENDS = "zlib virtual/crypt"
|
||||
RPROVIDES_${PN} = "ssh sshd"
|
||||
RCONFLICTS_${PN} = "openssh-sshd openssh"
|
||||
|
||||
# break dependency on base package for -dev package
|
||||
# otherwise SDK fails to build as the main openssh and dropbear packages
|
||||
# conflict with each other
|
||||
RDEPENDS:${PN}-dev = ""
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
|
||||
|
||||
SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "8a7fd5f633a2b72185501d4c4a8a51ed1fc7cea1"
|
||||
SRCREV ?= "08bd8cc1148b7b8b353ba5002560b0c2b3973a71"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
@@ -14,6 +14,15 @@ finish_run() {
|
||||
|
||||
info "Switching root to '$ROOTFS_DIR'..."
|
||||
|
||||
debug "Moving basic mounts onto rootfs"
|
||||
for dir in `awk '/\/dev.* \/run\/media/{print $2}' /proc/mounts`; do
|
||||
# Parse any OCT or HEX encoded chars such as spaces
|
||||
# in the mount points to actual ASCII chars
|
||||
dir=`printf $dir`
|
||||
mkdir -p "${ROOTFS_DIR}/media/${dir##*/}"
|
||||
mount -n --move "$dir" "${ROOTFS_DIR}/media/${dir##*/}"
|
||||
done
|
||||
|
||||
debug "Moving /dev, /proc and /sys onto rootfs..."
|
||||
mount --move /dev $ROOTFS_DIR/dev
|
||||
mount --move /proc $ROOTFS_DIR/proc
|
||||
|
||||
@@ -14,6 +14,7 @@ deltask do_populate_sysroot
|
||||
|
||||
# CVE database update interval, in seconds. By default: once a day (24*60*60).
|
||||
# Use 0 to force the update
|
||||
# Use a negative value to skip the update
|
||||
CVE_DB_UPDATE_INTERVAL ?= "86400"
|
||||
|
||||
python () {
|
||||
@@ -51,8 +52,9 @@ python do_fetch() {
|
||||
try:
|
||||
import time
|
||||
update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
|
||||
if (update_interval < 0):
|
||||
update_interval = 0
|
||||
if update_interval < 0:
|
||||
bb.note("CVE database update skipped")
|
||||
return
|
||||
if time.time() - os.path.getmtime(db_file) < update_interval:
|
||||
return
|
||||
|
||||
|
||||
@@ -4,3 +4,4 @@ PR = "r1"
|
||||
inherit packagegroup
|
||||
|
||||
RDEPENDS_${PN} = "dropbear"
|
||||
RRECOMMENDS_${PN} = "openssh-sftp-server"
|
||||
|
||||
@@ -11,6 +11,7 @@ import re
|
||||
import sys
|
||||
|
||||
from collections import namedtuple
|
||||
from itertools import chain
|
||||
from pathlib import Path
|
||||
|
||||
version = 1.0
|
||||
@@ -25,12 +26,16 @@ locations = list()
|
||||
|
||||
class SystemdFile():
|
||||
"""Class representing a single systemd configuration file"""
|
||||
def __init__(self, root, path):
|
||||
def __init__(self, root, path, instance_unit_name):
|
||||
self.sections = dict()
|
||||
self._parse(root, path)
|
||||
dirname = os.path.basename(path.name) + ".d"
|
||||
for location in locations:
|
||||
for path2 in sorted((root / location / "system" / dirname).glob("*.conf")):
|
||||
files = (root / location / "system" / dirname).glob("*.conf")
|
||||
if instance_unit_name:
|
||||
inst_dirname = instance_unit_name + ".d"
|
||||
files = chain(files, (root / location / "system" / inst_dirname).glob("*.conf"))
|
||||
for path2 in sorted(files):
|
||||
self._parse(root, path2)
|
||||
|
||||
def _parse(self, root, path):
|
||||
@@ -193,8 +198,11 @@ class SystemdUnit():
|
||||
# if we're enabling an instance, first extract the actual instance
|
||||
# then figure out what the template unit is
|
||||
template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit)
|
||||
instance_unit_name = None
|
||||
if template:
|
||||
instance = template.group('instance')
|
||||
if instance != "":
|
||||
instance_unit_name = self.unit
|
||||
unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
|
||||
else:
|
||||
instance = None
|
||||
@@ -206,7 +214,7 @@ class SystemdUnit():
|
||||
# ignore aliases
|
||||
return
|
||||
|
||||
config = SystemdFile(self.root, path)
|
||||
config = SystemdFile(self.root, path, instance_unit_name)
|
||||
if instance == "":
|
||||
try:
|
||||
default_instance = config.get('Install', 'DefaultInstance')[0]
|
||||
|
||||
@@ -18,5 +18,5 @@ SRC_URI_append_class-native = " \
|
||||
file://tweak-options-require-tar-1.27.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "60f57c5494e6dfa177504d47bfa0e383"
|
||||
SRC_URI[sha256sum] = "4c27fededf620c0aa522fff1a48577ba08144445341257502e7730f2b1a296e8"
|
||||
SRC_URI[md5sum] = "9d170c8baa1aa36b09698c909f304508"
|
||||
SRC_URI[sha256sum] = "2632c00b0cf0ea19ed7bd6700e6ec5faca93f0045af629d356dc03ad74ae6f10"
|
||||
@@ -0,0 +1,42 @@
|
||||
From a66071ed6a0d1fa666d22dcb78fa6fcb3bf22df3 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Fri, 27 May 2022 14:01:50 +0530
|
||||
Subject: [PATCH] CVE-2022-1304
|
||||
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/commit/?h=maint&id=ab51d587bb9b229b1fade1afd02e1574c1ba5c76]
|
||||
CVE: CVE-2022-1304
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
---
|
||||
lib/ext2fs/extent.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
|
||||
index ac3dbfec9..a1b1905cd 100644
|
||||
--- a/lib/ext2fs/extent.c
|
||||
+++ b/lib/ext2fs/extent.c
|
||||
@@ -495,6 +495,10 @@ retry:
|
||||
ext2fs_le16_to_cpu(eh->eh_entries);
|
||||
newpath->max_entries = ext2fs_le16_to_cpu(eh->eh_max);
|
||||
|
||||
+ /* Make sure there is at least one extent present */
|
||||
+ if (newpath->left <= 0)
|
||||
+ return EXT2_ET_EXTENT_NO_DOWN;
|
||||
+
|
||||
if (path->left > 0) {
|
||||
ix++;
|
||||
newpath->end_blk = ext2fs_le32_to_cpu(ix->ei_block);
|
||||
@@ -1630,6 +1634,10 @@ errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags)
|
||||
|
||||
cp = path->curr;
|
||||
|
||||
+ /* Sanity check before memmove() */
|
||||
+ if (path->left < 0)
|
||||
+ return EXT2_ET_EXTENT_LEAF_BAD;
|
||||
+
|
||||
if (path->left) {
|
||||
memmove(cp, cp + sizeof(struct ext3_extent_idx),
|
||||
path->left * sizeof(struct ext3_extent_idx));
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -6,6 +6,7 @@ SRC_URI += "file://remove.ldconfig.call.patch \
|
||||
file://mkdir_p.patch \
|
||||
file://0001-configure.ac-correct-AM_GNU_GETTEXT.patch \
|
||||
file://0001-intl-do-not-try-to-use-gettext-defines-that-no-longe.patch \
|
||||
file://CVE-2022-1304.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch \
|
||||
@@ -53,6 +54,7 @@ do_install () {
|
||||
oe_multilib_header ext2fs/ext2_types.h
|
||||
install -d ${D}${base_bindir}
|
||||
mv ${D}${bindir}/chattr ${D}${base_bindir}/chattr.e2fsprogs
|
||||
mv ${D}${bindir}/lsattr ${D}${base_bindir}/lsattr.e2fsprogs
|
||||
|
||||
install -v -m 755 ${S}/contrib/populate-extfs.sh ${D}${base_sbindir}/
|
||||
|
||||
@@ -101,10 +103,12 @@ FILES_libe2p = "${base_libdir}/libe2p.so.*"
|
||||
FILES_libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
|
||||
FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so ${bindir}/compile_et ${bindir}/mk_cmds"
|
||||
|
||||
ALTERNATIVE_${PN} = "chattr"
|
||||
ALTERNATIVE_${PN} = "chattr lsattr"
|
||||
ALTERNATIVE_PRIORITY = "100"
|
||||
ALTERNATIVE_LINK_NAME[chattr] = "${base_bindir}/chattr"
|
||||
ALTERNATIVE_TARGET[chattr] = "${base_bindir}/chattr.e2fsprogs"
|
||||
ALTERNATIVE_LINK_NAME[lsattr] = "${base_bindir}/lsattr"
|
||||
ALTERNATIVE_TARGET[lsattr] = "${base_bindir}/lsattr.e2fsprogs"
|
||||
|
||||
ALTERNATIVE_${PN}-doc = "fsck.8"
|
||||
ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
|
||||
|
||||
@@ -100,7 +100,7 @@ BINV = "${PV}"
|
||||
#S = "${WORKDIR}/gcc-${PV}"
|
||||
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
|
||||
|
||||
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
|
||||
B ?= "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
|
||||
|
||||
target_includedir ?= "${includedir}"
|
||||
target_libdir ?= "${libdir}"
|
||||
|
||||
@@ -18,6 +18,7 @@ INHIBIT_DEFAULT_DEPS = "1"
|
||||
DEPENDS = ""
|
||||
PACKAGES = ""
|
||||
|
||||
B = "${WORKDIR}/build"
|
||||
|
||||
# This needs to be Python to avoid lots of shell variables becoming dependencies.
|
||||
python do_preconfigure () {
|
||||
|
||||
@@ -22,6 +22,9 @@ SRC_URI += "\
|
||||
file://CVE-2021-38297.patch \
|
||||
file://CVE-2022-23806.patch \
|
||||
file://CVE-2022-23772.patch \
|
||||
file://CVE-2021-44717.patch \
|
||||
file://CVE-2022-24675.patch \
|
||||
file://CVE-2021-31525.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
38
meta/recipes-devtools/go/go-1.14/CVE-2021-31525.patch
Normal file
38
meta/recipes-devtools/go/go-1.14/CVE-2021-31525.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From efb465ada003d23353a91ef930be408eb575dba6 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 16 Jun 2022 17:40:12 +0530
|
||||
Subject: [PATCH] CVE-2021-31525
|
||||
|
||||
Upstream-Status: Backport [https://github.com/argoheyard/lang-net/commit/701957006ef151feb43f86aa99c8a1f474f69282]
|
||||
CVE: CVE-2021-31525
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
---
|
||||
src/vendor/golang.org/x/net/http/httpguts/httplex.go | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/vendor/golang.org/x/net/http/httpguts/httplex.go b/src/vendor/golang.org/x/net/http/httpguts/httplex.go
|
||||
index e7de24e..c79aa73 100644
|
||||
--- a/src/vendor/golang.org/x/net/http/httpguts/httplex.go
|
||||
+++ b/src/vendor/golang.org/x/net/http/httpguts/httplex.go
|
||||
@@ -137,11 +137,13 @@ func trimOWS(x string) string {
|
||||
// contains token amongst its comma-separated tokens, ASCII
|
||||
// case-insensitively.
|
||||
func headerValueContainsToken(v string, token string) bool {
|
||||
- v = trimOWS(v)
|
||||
- if comma := strings.IndexByte(v, ','); comma != -1 {
|
||||
- return tokenEqual(trimOWS(v[:comma]), token) || headerValueContainsToken(v[comma+1:], token)
|
||||
+ for comma := strings.IndexByte(v, ','); comma != -1; comma = strings.IndexByte(v, ',') {
|
||||
+ if tokenEqual(trimOWS(v[:comma]), token) {
|
||||
+ return true
|
||||
+ }
|
||||
+ v = v[comma+1:]
|
||||
}
|
||||
- return tokenEqual(v, token)
|
||||
+ return tokenEqual(trimOWS(v), token)
|
||||
}
|
||||
|
||||
// lowerASCII returns the ASCII lowercase version of b.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
83
meta/recipes-devtools/go/go-1.14/CVE-2021-44717.patch
Normal file
83
meta/recipes-devtools/go/go-1.14/CVE-2021-44717.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From 9171c664e7af479aa26bc72f2e7cf4e69d8e0a6f Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Fri, 17 Jun 2022 10:22:47 +0530
|
||||
Subject: [PATCH] CVE-2021-44717
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/44a3fb49]
|
||||
CVE: CVE-2021-44717
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
syscall: fix ForkLock spurious close(0) on pipe failure
|
||||
Pipe (and therefore forkLockPipe) does not make any guarantees
|
||||
about the state of p after a failed Pipe(p). Avoid that assumption
|
||||
and the too-clever goto, so that we don't accidentally Close a real fd
|
||||
if the failed pipe leaves p[0] or p[1] set >= 0.
|
||||
|
||||
Updates #50057
|
||||
Fixes CVE-2021-44717
|
||||
|
||||
Change-Id: Iff8e19a6efbba0c73cc8b13ecfae381c87600bb4
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1291270
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/370514
|
||||
Trust: Filippo Valsorda <filippo@golang.org>
|
||||
Run-TryBot: Filippo Valsorda <filippo@golang.org>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Alex Rakoczy <alex@golang.org>
|
||||
---
|
||||
src/syscall/exec_unix.go | 20 ++++++--------------
|
||||
1 file changed, 6 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go
|
||||
index b3798b6..b73782c 100644
|
||||
--- a/src/syscall/exec_unix.go
|
||||
+++ b/src/syscall/exec_unix.go
|
||||
@@ -151,9 +151,6 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
|
||||
sys = &zeroSysProcAttr
|
||||
}
|
||||
|
||||
- p[0] = -1
|
||||
- p[1] = -1
|
||||
-
|
||||
// Convert args to C form.
|
||||
argv0p, err := BytePtrFromString(argv0)
|
||||
if err != nil {
|
||||
@@ -194,14 +191,17 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
|
||||
|
||||
// Allocate child status pipe close on exec.
|
||||
if err = forkExecPipe(p[:]); err != nil {
|
||||
- goto error
|
||||
+ ForkLock.Unlock()
|
||||
+ return 0, err
|
||||
}
|
||||
|
||||
// Kick off child.
|
||||
pid, err1 = forkAndExecInChild(argv0p, argvp, envvp, chroot, dir, attr, sys, p[1])
|
||||
if err1 != 0 {
|
||||
- err = Errno(err1)
|
||||
- goto error
|
||||
+ Close(p[0])
|
||||
+ Close(p[1])
|
||||
+ ForkLock.Unlock()
|
||||
+ return 0, Errno(err1)
|
||||
}
|
||||
ForkLock.Unlock()
|
||||
|
||||
@@ -228,14 +228,6 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err error)
|
||||
|
||||
// Read got EOF, so pipe closed on exec, so exec succeeded.
|
||||
return pid, nil
|
||||
-
|
||||
-error:
|
||||
- if p[0] >= 0 {
|
||||
- Close(p[0])
|
||||
- Close(p[1])
|
||||
- }
|
||||
- ForkLock.Unlock()
|
||||
- return 0, err
|
||||
}
|
||||
|
||||
// Combination of fork and exec, careful to be thread safe.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
271
meta/recipes-devtools/go/go-1.14/CVE-2022-24675.patch
Normal file
271
meta/recipes-devtools/go/go-1.14/CVE-2022-24675.patch
Normal file
@@ -0,0 +1,271 @@
|
||||
From 1eb931d60a24501a9668e5cb4647593e19115507 Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Fri, 17 Jun 2022 12:22:53 +0530
|
||||
Subject: [PATCH] CVE-2022-24675
|
||||
|
||||
Upstream-Status: Backport [https://go-review.googlesource.com/c/go/+/399816/]
|
||||
CVE: CVE-2022-24675
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/encoding/pem/pem.go | 174 +++++++++++++++--------------------
|
||||
src/encoding/pem/pem_test.go | 28 +++++-
|
||||
2 files changed, 101 insertions(+), 101 deletions(-)
|
||||
|
||||
diff --git a/src/encoding/pem/pem.go b/src/encoding/pem/pem.go
|
||||
index a7272da..1bee1c1 100644
|
||||
--- a/src/encoding/pem/pem.go
|
||||
+++ b/src/encoding/pem/pem.go
|
||||
@@ -87,123 +87,97 @@ func Decode(data []byte) (p *Block, rest []byte) {
|
||||
// pemStart begins with a newline. However, at the very beginning of
|
||||
// the byte array, we'll accept the start string without it.
|
||||
rest = data
|
||||
- if bytes.HasPrefix(data, pemStart[1:]) {
|
||||
- rest = rest[len(pemStart)-1 : len(data)]
|
||||
- } else if i := bytes.Index(data, pemStart); i >= 0 {
|
||||
- rest = rest[i+len(pemStart) : len(data)]
|
||||
- } else {
|
||||
- return nil, data
|
||||
- }
|
||||
-
|
||||
- typeLine, rest := getLine(rest)
|
||||
- if !bytes.HasSuffix(typeLine, pemEndOfLine) {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
- typeLine = typeLine[0 : len(typeLine)-len(pemEndOfLine)]
|
||||
-
|
||||
- p = &Block{
|
||||
- Headers: make(map[string]string),
|
||||
- Type: string(typeLine),
|
||||
- }
|
||||
-
|
||||
for {
|
||||
- // This loop terminates because getLine's second result is
|
||||
- // always smaller than its argument.
|
||||
- if len(rest) == 0 {
|
||||
+ if bytes.HasPrefix(rest, pemStart[1:]) {
|
||||
+ rest = rest[len(pemStart)-1:]
|
||||
+ } else if i := bytes.Index(rest, pemStart); i >= 0 {
|
||||
+ rest = rest[i+len(pemStart) : len(rest)]
|
||||
+ } else {
|
||||
return nil, data
|
||||
}
|
||||
- line, next := getLine(rest)
|
||||
|
||||
- i := bytes.IndexByte(line, ':')
|
||||
- if i == -1 {
|
||||
- break
|
||||
+ var typeLine []byte
|
||||
+ typeLine, rest = getLine(rest)
|
||||
+ if !bytes.HasSuffix(typeLine, pemEndOfLine) {
|
||||
+ continue
|
||||
}
|
||||
+ typeLine = typeLine[0 : len(typeLine)-len(pemEndOfLine)]
|
||||
|
||||
- // TODO(agl): need to cope with values that spread across lines.
|
||||
- key, val := line[:i], line[i+1:]
|
||||
- key = bytes.TrimSpace(key)
|
||||
- val = bytes.TrimSpace(val)
|
||||
- p.Headers[string(key)] = string(val)
|
||||
- rest = next
|
||||
- }
|
||||
+ p = &Block{
|
||||
+ Headers: make(map[string]string),
|
||||
+ Type: string(typeLine),
|
||||
+ }
|
||||
|
||||
- var endIndex, endTrailerIndex int
|
||||
+ for {
|
||||
+ // This loop terminates because getLine's second result is
|
||||
+ // always smaller than its argument.
|
||||
+ if len(rest) == 0 {
|
||||
+ return nil, data
|
||||
+ }
|
||||
+ line, next := getLine(rest)
|
||||
|
||||
- // If there were no headers, the END line might occur
|
||||
- // immediately, without a leading newline.
|
||||
- if len(p.Headers) == 0 && bytes.HasPrefix(rest, pemEnd[1:]) {
|
||||
- endIndex = 0
|
||||
- endTrailerIndex = len(pemEnd) - 1
|
||||
- } else {
|
||||
- endIndex = bytes.Index(rest, pemEnd)
|
||||
- endTrailerIndex = endIndex + len(pemEnd)
|
||||
- }
|
||||
+ i := bytes.IndexByte(line, ':')
|
||||
+ if i == -1 {
|
||||
+ break
|
||||
+ }
|
||||
|
||||
- if endIndex < 0 {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
+ // TODO(agl): need to cope with values that spread across lines.
|
||||
+ key, val := line[:i], line[i+1:]
|
||||
+ key = bytes.TrimSpace(key)
|
||||
+ val = bytes.TrimSpace(val)
|
||||
+ p.Headers[string(key)] = string(val)
|
||||
+ rest = next
|
||||
+ }
|
||||
|
||||
- // After the "-----" of the ending line, there should be the same type
|
||||
- // and then a final five dashes.
|
||||
- endTrailer := rest[endTrailerIndex:]
|
||||
- endTrailerLen := len(typeLine) + len(pemEndOfLine)
|
||||
- if len(endTrailer) < endTrailerLen {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
+ var endIndex, endTrailerIndex int
|
||||
|
||||
- restOfEndLine := endTrailer[endTrailerLen:]
|
||||
- endTrailer = endTrailer[:endTrailerLen]
|
||||
- if !bytes.HasPrefix(endTrailer, typeLine) ||
|
||||
- !bytes.HasSuffix(endTrailer, pemEndOfLine) {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
+ // If there were no headers, the END line might occur
|
||||
+ // immediately, without a leading newline.
|
||||
+ if len(p.Headers) == 0 && bytes.HasPrefix(rest, pemEnd[1:]) {
|
||||
+ endIndex = 0
|
||||
+ endTrailerIndex = len(pemEnd) - 1
|
||||
+ } else {
|
||||
+ endIndex = bytes.Index(rest, pemEnd)
|
||||
+ endTrailerIndex = endIndex + len(pemEnd)
|
||||
+ }
|
||||
|
||||
- // The line must end with only whitespace.
|
||||
- if s, _ := getLine(restOfEndLine); len(s) != 0 {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
+ if endIndex < 0 {
|
||||
+ continue
|
||||
+ }
|
||||
|
||||
- base64Data := removeSpacesAndTabs(rest[:endIndex])
|
||||
- p.Bytes = make([]byte, base64.StdEncoding.DecodedLen(len(base64Data)))
|
||||
- n, err := base64.StdEncoding.Decode(p.Bytes, base64Data)
|
||||
- if err != nil {
|
||||
- return decodeError(data, rest)
|
||||
- }
|
||||
- p.Bytes = p.Bytes[:n]
|
||||
+ // After the "-----" of the ending line, there should be the same type
|
||||
+ // and then a final five dashes.
|
||||
+ endTrailer := rest[endTrailerIndex:]
|
||||
+ endTrailerLen := len(typeLine) + len(pemEndOfLine)
|
||||
+ if len(endTrailer) < endTrailerLen {
|
||||
+ continue
|
||||
+ }
|
||||
+
|
||||
+ restOfEndLine := endTrailer[endTrailerLen:]
|
||||
+ endTrailer = endTrailer[:endTrailerLen]
|
||||
+ if !bytes.HasPrefix(endTrailer, typeLine) ||
|
||||
+ !bytes.HasSuffix(endTrailer, pemEndOfLine) {
|
||||
+ continue
|
||||
+ }
|
||||
|
||||
- // the -1 is because we might have only matched pemEnd without the
|
||||
- // leading newline if the PEM block was empty.
|
||||
- _, rest = getLine(rest[endIndex+len(pemEnd)-1:])
|
||||
+ // The line must end with only whitespace.
|
||||
+ if s, _ := getLine(restOfEndLine); len(s) != 0 {
|
||||
+ continue
|
||||
+ }
|
||||
|
||||
- return
|
||||
-}
|
||||
+ base64Data := removeSpacesAndTabs(rest[:endIndex])
|
||||
+ p.Bytes = make([]byte, base64.StdEncoding.DecodedLen(len(base64Data)))
|
||||
+ n, err := base64.StdEncoding.Decode(p.Bytes, base64Data)
|
||||
+ if err != nil {
|
||||
+ continue
|
||||
+ }
|
||||
+ p.Bytes = p.Bytes[:n]
|
||||
|
||||
-func decodeError(data, rest []byte) (*Block, []byte) {
|
||||
- // If we get here then we have rejected a likely looking, but
|
||||
- // ultimately invalid PEM block. We need to start over from a new
|
||||
- // position. We have consumed the preamble line and will have consumed
|
||||
- // any lines which could be header lines. However, a valid preamble
|
||||
- // line is not a valid header line, therefore we cannot have consumed
|
||||
- // the preamble line for the any subsequent block. Thus, we will always
|
||||
- // find any valid block, no matter what bytes precede it.
|
||||
- //
|
||||
- // For example, if the input is
|
||||
- //
|
||||
- // -----BEGIN MALFORMED BLOCK-----
|
||||
- // junk that may look like header lines
|
||||
- // or data lines, but no END line
|
||||
- //
|
||||
- // -----BEGIN ACTUAL BLOCK-----
|
||||
- // realdata
|
||||
- // -----END ACTUAL BLOCK-----
|
||||
- //
|
||||
- // we've failed to parse using the first BEGIN line
|
||||
- // and now will try again, using the second BEGIN line.
|
||||
- p, rest := Decode(rest)
|
||||
- if p == nil {
|
||||
- rest = data
|
||||
+ // the -1 is because we might have only matched pemEnd without the
|
||||
+ // leading newline if the PEM block was empty.
|
||||
+ _, rest = getLine(rest[endIndex+len(pemEnd)-1:])
|
||||
+ return p, rest
|
||||
}
|
||||
- return p, rest
|
||||
}
|
||||
|
||||
const pemLineLength = 64
|
||||
diff --git a/src/encoding/pem/pem_test.go b/src/encoding/pem/pem_test.go
|
||||
index 8515b46..4485581 100644
|
||||
--- a/src/encoding/pem/pem_test.go
|
||||
+++ b/src/encoding/pem/pem_test.go
|
||||
@@ -107,6 +107,12 @@ const pemMissingEndingSpace = `
|
||||
dGVzdA==
|
||||
-----ENDBAR-----`
|
||||
|
||||
+const pemMissingEndLine = `
|
||||
+-----BEGIN FOO-----
|
||||
+Header: 1`
|
||||
+
|
||||
+var pemRepeatingBegin = strings.Repeat("-----BEGIN \n", 10)
|
||||
+
|
||||
var badPEMTests = []struct {
|
||||
name string
|
||||
input string
|
||||
@@ -131,14 +137,34 @@ var badPEMTests = []struct {
|
||||
"missing ending space",
|
||||
pemMissingEndingSpace,
|
||||
},
|
||||
+ {
|
||||
+ "repeating begin",
|
||||
+ pemRepeatingBegin,
|
||||
+ },
|
||||
+ {
|
||||
+ "missing end line",
|
||||
+ pemMissingEndLine,
|
||||
+ },
|
||||
}
|
||||
|
||||
func TestBadDecode(t *testing.T) {
|
||||
for _, test := range badPEMTests {
|
||||
- result, _ := Decode([]byte(test.input))
|
||||
+ result, rest := Decode([]byte(test.input))
|
||||
if result != nil {
|
||||
t.Errorf("unexpected success while parsing %q", test.name)
|
||||
}
|
||||
+ if string(rest) != test.input {
|
||||
+ t.Errorf("unexpected rest: %q; want = %q", rest, test.input)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+func TestCVE202224675(t *testing.T) {
|
||||
+ // Prior to CVE-2022-24675, this input would cause a stack overflow.
|
||||
+ input := []byte(strings.Repeat("-----BEGIN \n", 10000000))
|
||||
+ result, rest := Decode(input)
|
||||
+ if result != nil || !reflect.DeepEqual(rest, input) {
|
||||
+ t.Errorf("Encode of %#v decoded as %#v", input, rest)
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
48
meta/recipes-devtools/python/python3-pip/CVE-2021-3572.patch
Normal file
48
meta/recipes-devtools/python/python3-pip/CVE-2021-3572.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From c4fd13410b9a219f77fc30775d4a0ac9f69725bd Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Thu, 16 Jun 2022 09:52:43 +0530
|
||||
Subject: [PATCH] CVE-2021-3572
|
||||
|
||||
Upstream-Status: Backport [https://github.com/pypa/pip/commit/e46bdda9711392fec0c45c1175bae6db847cb30b]
|
||||
CVE: CVE-2021-3572
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
news/9827.bugfix.rst | 3 +++
|
||||
src/pip/_internal/vcs/git.py | 10 ++++++++--
|
||||
2 files changed, 11 insertions(+), 2 deletions(-)
|
||||
create mode 100644 news/9827.bugfix.rst
|
||||
|
||||
diff --git a/news/9827.bugfix.rst b/news/9827.bugfix.rst
|
||||
new file mode 100644
|
||||
index 0000000..e0d27c3
|
||||
--- /dev/null
|
||||
+++ b/news/9827.bugfix.rst
|
||||
@@ -0,0 +1,3 @@
|
||||
+**SECURITY**: Stop splitting on unicode separators in git references,
|
||||
+which could be maliciously used to install a different revision on the
|
||||
+repository.
|
||||
diff --git a/src/pip/_internal/vcs/git.py b/src/pip/_internal/vcs/git.py
|
||||
index 7483303..1b895f6 100644
|
||||
--- a/src/pip/_internal/vcs/git.py
|
||||
+++ b/src/pip/_internal/vcs/git.py
|
||||
@@ -137,9 +137,15 @@ class Git(VersionControl):
|
||||
output = cls.run_command(['show-ref', rev], cwd=dest,
|
||||
show_stdout=False, on_returncode='ignore')
|
||||
refs = {}
|
||||
- for line in output.strip().splitlines():
|
||||
+ # NOTE: We do not use splitlines here since that would split on other
|
||||
+ # unicode separators, which can be maliciously used to install a
|
||||
+ # different revision.
|
||||
+ for line in output.strip().split("\n"):
|
||||
+ line = line.rstrip("\r")
|
||||
+ if not line:
|
||||
+ continue
|
||||
try:
|
||||
- sha, ref = line.split()
|
||||
+ ref_sha, ref_name = line.split(" ", maxsplit=2)
|
||||
except ValueError:
|
||||
# Include the offending line to simplify troubleshooting if
|
||||
# this error ever occurs.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8ba06d529c955048e5ddd7c45459eb2e"
|
||||
|
||||
DEPENDS += "python3 python3-setuptools-native"
|
||||
|
||||
SRC_URI = "file://CVE-2021-3572.patch "
|
||||
SRC_URI[md5sum] = "7d42ba49b809604f0df3d55df1c3fd86"
|
||||
SRC_URI[sha256sum] = "7db0c8ea4c7ea51c8049640e8e6e7fde949de672bfa4949920675563a5a6967f"
|
||||
|
||||
|
||||
@@ -254,6 +254,7 @@ PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
|
||||
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"
|
||||
|
||||
INSANE_SKIP_${PN} = "arch"
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.t
|
||||
file://0002-don-t-try-to-run-generated-binaries.patch \
|
||||
file://0003-cups_1.4.6.bb-Fix-build-on-ppc64.patch \
|
||||
file://0004-cups-fix-multilib-install-file-conflicts.patch\
|
||||
file://CVE-2022-26691.patch \
|
||||
"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
|
||||
@@ -119,4 +120,4 @@ cups_sysroot_preprocess () {
|
||||
|
||||
# -25317 concerns /var/log/cups having lp ownership. Our /var/log/cups is
|
||||
# root:root, so this doesn't apply.
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-25317"
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-25317"
|
||||
|
||||
33
meta/recipes-extended/cups/cups/CVE-2022-26691.patch
Normal file
33
meta/recipes-extended/cups/cups/CVE-2022-26691.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
From de4f8c196106033e4c372dce3e91b9d42b0b9444 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Dohnal <zdohnal@redhat.com>
|
||||
Date: Thu, 26 May 2022 06:27:04 +0200
|
||||
Subject: [PATCH] scheduler/cert.c: Fix string comparison (fixes
|
||||
CVE-2022-26691)
|
||||
|
||||
The previous algorithm didn't expect the strings can have a different
|
||||
length, so one string can be a substring of the other and such substring
|
||||
was reported as equal to the longer string.
|
||||
|
||||
CVE: CVE-2022-26691
|
||||
Upstream-Status: Backport [https://github.com/OpenPrinting/cups/commit/de4f8c196106033e4c372dce3e91b9d42b0b9444]
|
||||
Signed-off-by: Steve Sakoman
|
||||
|
||||
---
|
||||
diff --git a/scheduler/cert.c b/scheduler/cert.c
|
||||
index b268bf1b2..9b65b96c9 100644
|
||||
--- a/scheduler/cert.c
|
||||
+++ b/scheduler/cert.c
|
||||
@@ -434,5 +434,12 @@ ctcompare(const char *a, /* I - First string */
|
||||
b ++;
|
||||
}
|
||||
|
||||
- return (result);
|
||||
+ /*
|
||||
+ * The while loop finishes when *a == '\0' or *b == '\0'
|
||||
+ * so after the while loop either both *a and *b == '\0',
|
||||
+ * or one points inside a string, so when we apply logical OR on *a,
|
||||
+ * *b and result, we get a non-zero return value if the compared strings don't match.
|
||||
+ */
|
||||
+
|
||||
+ return (result | *a | *b);
|
||||
}
|
||||
67
meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
Normal file
67
meta/recipes-extended/unzip/unzip/CVE-2021-4217.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 731d698377dbd1f5b1b90efeb8094602ed59fc40 Mon Sep 17 00:00:00 2001
|
||||
From: Nils Bars <nils.bars@t-online.de>
|
||||
Date: Mon, 17 Jan 2022 16:53:16 +0000
|
||||
Subject: [PATCH] Fix null pointer dereference and use of uninitialized data
|
||||
|
||||
This fixes a bug that causes use of uninitialized heap data if `readbuf` fails
|
||||
to read as many bytes as indicated by the extra field length attribute.
|
||||
Furthermore, this fixes a null pointer dereference if an archive contains an
|
||||
`EF_UNIPATH` extra field but does not have a filename set.
|
||||
---
|
||||
fileio.c | 5 ++++-
|
||||
process.c | 6 +++++-
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
---
|
||||
|
||||
Patch from:
|
||||
https://bugs.launchpad.net/ubuntu/+source/unzip/+bug/1957077
|
||||
https://launchpadlibrarian.net/580782282/0001-Fix-null-pointer-dereference-and-use-of-uninitialized-data.patch
|
||||
Regenerated to apply without offsets.
|
||||
|
||||
CVE: CVE-2021-4217
|
||||
|
||||
Upstream-Status: Pending [infozip upstream inactive]
|
||||
|
||||
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||
|
||||
|
||||
diff --git a/fileio.c b/fileio.c
|
||||
index 14460f3..1dc319e 100644
|
||||
--- a/fileio.c
|
||||
+++ b/fileio.c
|
||||
@@ -2301,8 +2301,11 @@ int do_string(__G__ length, option) /* return PK-type error code */
|
||||
seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
|
||||
(G.inptr-G.inbuf) + length);
|
||||
} else {
|
||||
- if (readbuf(__G__ (char *)G.extra_field, length) == 0)
|
||||
+ unsigned bytes_read = readbuf(__G__ (char *)G.extra_field, length);
|
||||
+ if (bytes_read == 0)
|
||||
return PK_EOF;
|
||||
+ if (bytes_read != length)
|
||||
+ return PK_ERR;
|
||||
/* Looks like here is where extra fields are read */
|
||||
if (getZip64Data(__G__ G.extra_field, length) != PK_COOL)
|
||||
{
|
||||
diff --git a/process.c b/process.c
|
||||
index 5f8f6c6..de843a5 100644
|
||||
--- a/process.c
|
||||
+++ b/process.c
|
||||
@@ -2058,10 +2058,14 @@ int getUnicodeData(__G__ ef_buf, ef_len)
|
||||
G.unipath_checksum = makelong(offset + ef_buf);
|
||||
offset += 4;
|
||||
|
||||
+ if (!G.filename_full) {
|
||||
+ /* Check if we have a unicode extra section but no filename set */
|
||||
+ return PK_ERR;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Compute 32-bit crc
|
||||
*/
|
||||
-
|
||||
chksum = crc32(chksum, (uch *)(G.filename_full),
|
||||
strlen(G.filename_full));
|
||||
|
||||
--
|
||||
2.32.0
|
||||
|
||||
39
meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch
Normal file
39
meta/recipes-extended/unzip/unzip/CVE-2022-0529.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010355
|
||||
|
||||
CVE: CVE-2022-0529
|
||||
Upstream-Status: Inactive-Upstream [need a new release]
|
||||
|
||||
diff --git a/process.c b/process.c
|
||||
index d2a846e..99b9c7b 100644
|
||||
--- a/process.c
|
||||
+++ b/process.c
|
||||
@@ -2507,13 +2507,15 @@ char *wide_to_local_string(wide_string, escape_all)
|
||||
char buf[9];
|
||||
char *buffer = NULL;
|
||||
char *local_string = NULL;
|
||||
+ size_t buffer_size;
|
||||
|
||||
for (wsize = 0; wide_string[wsize]; wsize++) ;
|
||||
|
||||
if (max_bytes < MAX_ESCAPE_BYTES)
|
||||
max_bytes = MAX_ESCAPE_BYTES;
|
||||
|
||||
- if ((buffer = (char *)malloc(wsize * max_bytes + 1)) == NULL) {
|
||||
+ buffer_size = wsize * max_bytes + 1;
|
||||
+ if ((buffer = (char *)malloc(buffer_size)) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2552,7 +2554,11 @@ char *wide_to_local_string(wide_string, escape_all)
|
||||
/* no MB for this wide */
|
||||
/* use escape for wide character */
|
||||
char *escape_string = wide_to_escape_string(wide_string[i]);
|
||||
- strcat(buffer, escape_string);
|
||||
+ size_t buffer_len = strlen(buffer);
|
||||
+ size_t escape_string_len = strlen(escape_string);
|
||||
+ if (buffer_len + escape_string_len + 1 > buffer_size)
|
||||
+ escape_string_len = buffer_size - buffer_len - 1;
|
||||
+ strncat(buffer, escape_string, escape_string_len);
|
||||
free(escape_string);
|
||||
}
|
||||
}
|
||||
33
meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch
Normal file
33
meta/recipes-extended/unzip/unzip/CVE-2022-0530.patch
Normal file
@@ -0,0 +1,33 @@
|
||||
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1010355
|
||||
|
||||
CVE: CVE-2022-0530
|
||||
Upstream-Status: Inactive-Upstream [need a new release]
|
||||
|
||||
diff --git a/fileio.c b/fileio.c
|
||||
index 6290824..77e4b5f 100644
|
||||
--- a/fileio.c
|
||||
+++ b/fileio.c
|
||||
@@ -2361,6 +2361,9 @@ int do_string(__G__ length, option) /* return PK-type error code */
|
||||
/* convert UTF-8 to local character set */
|
||||
fn = utf8_to_local_string(G.unipath_filename,
|
||||
G.unicode_escape_all);
|
||||
+ if (fn == NULL)
|
||||
+ return PK_ERR;
|
||||
+
|
||||
/* make sure filename is short enough */
|
||||
if (strlen(fn) >= FILNAMSIZ) {
|
||||
fn[FILNAMSIZ - 1] = '\0';
|
||||
diff --git a/process.c b/process.c
|
||||
index d2a846e..715bc0f 100644
|
||||
--- a/process.c
|
||||
+++ b/process.c
|
||||
@@ -2605,6 +2605,8 @@ char *utf8_to_local_string(utf8_string, escape_all)
|
||||
int escape_all;
|
||||
{
|
||||
zwchar *wide = utf8_to_wide_string(utf8_string);
|
||||
+ if (wide == NULL)
|
||||
+ return NULL;
|
||||
char *loc = wide_to_local_string(wide, escape_all);
|
||||
free(wide);
|
||||
return loc;
|
||||
|
||||
@@ -26,6 +26,9 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
|
||||
file://CVE-2019-13232_p1.patch \
|
||||
file://CVE-2019-13232_p2.patch \
|
||||
file://CVE-2019-13232_p3.patch \
|
||||
file://CVE-2021-4217.patch \
|
||||
file://CVE-2022-0529.patch \
|
||||
file://CVE-2022-0530.patch \
|
||||
"
|
||||
UPSTREAM_VERSION_UNKNOWN = "1"
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
From 71514e74f35f2b51ca24062573d6d913525b30db Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Weihmann <kweihmann@outlook.com>
|
||||
Date: Mon, 9 May 2022 12:57:57 +0200
|
||||
Subject: [PATCH] Makefile: replace mkdir by install
|
||||
|
||||
mkdir -p creates paths that are bound to user's settings and therefore
|
||||
can lead to different file mode bits of the base paths accross different
|
||||
machines.
|
||||
Use install instead, as this tool is not prone to such behavior.
|
||||
|
||||
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
|
||||
Upstream-Status: Submitted [https://lore.kernel.org/linux-firmware/PR2PR09MB310088EA719E6D7CA5C268F1A8C69@PR2PR09MB3100.eurprd09.prod.outlook.com/]
|
||||
---
|
||||
Makefile | 2 +-
|
||||
carl9170fw/toolchain/Makefile | 4 ++--
|
||||
copy-firmware.sh | 6 +++---
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index e1c362f..83a0ec6 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,5 +9,5 @@ check:
|
||||
@./check_whence.py
|
||||
|
||||
install:
|
||||
- mkdir -p $(DESTDIR)$(FIRMWAREDIR)
|
||||
+ install -d $(DESTDIR)$(FIRMWAREDIR)
|
||||
./copy-firmware.sh $(DESTDIR)$(FIRMWAREDIR)
|
||||
diff --git a/carl9170fw/toolchain/Makefile b/carl9170fw/toolchain/Makefile
|
||||
index 2b25ffe..aaea8e8 100644
|
||||
--- a/carl9170fw/toolchain/Makefile
|
||||
+++ b/carl9170fw/toolchain/Makefile
|
||||
@@ -46,14 +46,14 @@ src/gcc-$(GCC_VER): src/$(GCC_TAR) src/newlib-$(NEWLIB_VER)
|
||||
ln -s $(BASEDIR)/src/newlib-$(NEWLIB_VER)/libgloss $@
|
||||
|
||||
binutils: src/binutils-$(BINUTILS_VER)
|
||||
- mkdir -p build/binutils
|
||||
+ install -d build/binutils
|
||||
cd build/binutils; \
|
||||
$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst; \
|
||||
$(MAKE) -j3; \
|
||||
$(MAKE) install
|
||||
|
||||
gcc: src/gcc-$(GCC_VER) binutils
|
||||
- mkdir -p build/gcc
|
||||
+ install -d build/gcc
|
||||
cd build/gcc; \
|
||||
$(BASEDIR)/$</configure --target=sh-elf --prefix=$(BASEDIR)/inst -enable-languages=c --without-pkgversion --with-newlib; \
|
||||
$(MAKE) -j3; \
|
||||
diff --git a/copy-firmware.sh b/copy-firmware.sh
|
||||
index 9b46b63..bbacb92 100755
|
||||
--- a/copy-firmware.sh
|
||||
+++ b/copy-firmware.sh
|
||||
@@ -34,7 +34,7 @@ done
|
||||
grep '^File:' WHENCE | sed -e's/^File: *//g' -e's/"//g' | while read f; do
|
||||
test -f "$f" || continue
|
||||
$verbose "copying file $f"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
cp -d "$f" $destdir/"$f"
|
||||
done
|
||||
|
||||
@@ -42,7 +42,7 @@ grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; d
|
||||
if test -L "$f"; then
|
||||
test -f "$destdir/$f" && continue
|
||||
$verbose "copying link $f"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
cp -d "$f" $destdir/"$f"
|
||||
|
||||
if test "x$d" != "x"; then
|
||||
@@ -63,7 +63,7 @@ grep -E '^Link:' WHENCE | sed -e's/^Link: *//g' -e's/-> //g' | while read f d; d
|
||||
fi
|
||||
else
|
||||
$verbose "creating link $f -> $d"
|
||||
- mkdir -p $destdir/$(dirname "$f")
|
||||
+ install -d $destdir/$(dirname "$f")
|
||||
ln -sf "$d" "$destdir/$f"
|
||||
fi
|
||||
done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -69,6 +69,7 @@ LICENSE = "\
|
||||
& WHENCE \
|
||||
"
|
||||
|
||||
WHENCE_CHKSUM = "385947b278a6646ae4c3d39ba8c9b1bb"
|
||||
LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \
|
||||
file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \
|
||||
@@ -132,7 +133,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.xc4000;md5=0ff51d2dc49fce04814c9155081092f0 \
|
||||
file://LICENCE.xc5000;md5=1e170c13175323c32c7f4d0998d53f66 \
|
||||
file://LICENCE.xc5000c;md5=12b02efa3049db65d524aeb418dd87ca \
|
||||
file://WHENCE;md5=d3eb82686904888f8bbbe8d865371404 \
|
||||
file://WHENCE;md5=${WHENCE_CHKSUM} \
|
||||
"
|
||||
|
||||
# These are not common licenses, set NO_GENERIC_LICENSE for them
|
||||
@@ -205,10 +206,14 @@ PE = "1"
|
||||
|
||||
SRC_URI = "\
|
||||
${KERNELORG_MIRROR}/linux/kernel/firmware/${BPN}-${PV}.tar.xz \
|
||||
file://0001-Makefile-replace-mkdir-by-install.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "376e0b3d7b4f8aaa2abf7f5ab74803dcf14b06b94e3d841b1467cd9a2848255e"
|
||||
BBCLASSEXTEND = "devupstream:target"
|
||||
SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git;protocol=https;branch=main"
|
||||
# Pin this to the 20220509 release, override this in local.conf
|
||||
SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae"
|
||||
|
||||
SRC_URI[sha256sum] = "faf3aedf89530e61f4fa1e8c7303dead9127cc24416945647797d079feb12837"
|
||||
|
||||
inherit allarch
|
||||
|
||||
@@ -11,13 +11,13 @@ python () {
|
||||
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
|
||||
}
|
||||
|
||||
SRCREV_machine ?= "24d323fa0e17bcd62c9cfe1fd4153c304a06f38c"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
SRCREV_machine ?= "cc478e363cc35064b58a871a4cc535aa973c5891"
|
||||
SRCREV_meta ?= "aaaf9f090dfb3160154b24fbc2f9a6e669babc87"
|
||||
|
||||
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
|
||||
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
LINUX_VERSION ?= "5.4.205"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
|
||||
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
LINUX_VERSION ?= "5.4.205"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
|
||||
KMETA = "kernel-meta"
|
||||
KCONF_BSP_AUDIT_LEVEL = "2"
|
||||
|
||||
SRCREV_machine_qemuarm ?= "460de085c07ab1a221317e6804c13657456c5368"
|
||||
SRCREV_machine ?= "b414a2fc5ce5f68c33d297d9cde4fef5437b773b"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
SRCREV_machine_qemuarm ?= "6a3e65256e24a2ff0e4e9fcd877987fb8afd12f2"
|
||||
SRCREV_machine ?= "d730b865a7cb7ff89efcf8ac725ca247283f3eeb"
|
||||
SRCREV_meta ?= "aaaf9f090dfb3160154b24fbc2f9a6e669babc87"
|
||||
|
||||
PV = "${LINUX_VERSION}+git${SRCPV}"
|
||||
|
||||
|
||||
@@ -12,16 +12,16 @@ KBRANCH_qemux86 ?= "v5.4/standard/base"
|
||||
KBRANCH_qemux86-64 ?= "v5.4/standard/base"
|
||||
KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
|
||||
|
||||
SRCREV_machine_qemuarm ?= "68a2ce69aaf2e8d96eef4aaccd70fc0ef7368a46"
|
||||
SRCREV_machine_qemuarm64 ?= "acfed0930d37a714d705645ff7cfbfbd0ad040e7"
|
||||
SRCREV_machine_qemumips ?= "e7046a2c8972e925cd2e6ac7f392abe87cbec5f5"
|
||||
SRCREV_machine_qemuppc ?= "997e06e0af674c27627eaa76a60b2f63cb16f38d"
|
||||
SRCREV_machine_qemuriscv64 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemux86 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemux86-64 ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_machine_qemumips64 ?= "7b526cde12d78604b6f1e1ad62da31dcb729f35f"
|
||||
SRCREV_machine ?= "85f0668fea1442bbcc2c8b1509d9f711b4b73649"
|
||||
SRCREV_meta ?= "3fecb08507e286d1458497faaf31d1a07cc7d373"
|
||||
SRCREV_machine_qemuarm ?= "943e7e1f32e61dc7dd7a7029062e789219d81b14"
|
||||
SRCREV_machine_qemuarm64 ?= "24d18667d92b460ee33480942306a0d9c80c491b"
|
||||
SRCREV_machine_qemumips ?= "2d469a0343033962ecea678491852aa9457b8ff6"
|
||||
SRCREV_machine_qemuppc ?= "85932dee050f49fa824fd9b49af7b8159fe28a8e"
|
||||
SRCREV_machine_qemuriscv64 ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_machine_qemux86 ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_machine_qemux86-64 ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_machine_qemumips64 ?= "0edbd472c7f0b51994d20d07bb26ead379dc10ed"
|
||||
SRCREV_machine ?= "8a59dfded81659402005acfb06fbb00b71c8ce86"
|
||||
SRCREV_meta ?= "aaaf9f090dfb3160154b24fbc2f9a6e669babc87"
|
||||
|
||||
# remap qemuarm to qemuarma15 for the 5.4 kernel
|
||||
# KMACHINE_qemuarm ?= "qemuarma15"
|
||||
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
|
||||
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
|
||||
LINUX_VERSION ?= "5.4.192"
|
||||
LINUX_VERSION ?= "5.4.205"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 25b70c486bb96de0caf7cea1da42ed07801cca84 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 4 Apr 2022 14:33:42 -0400
|
||||
Subject: [PATCH 17/19] fix: random: remove unused tracepoints (v5.18)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit 14c174633f349cb41ea90c2c0aaddac157012f74
|
||||
Author: Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
Date: Thu Feb 10 16:40:44 2022 +0100
|
||||
|
||||
random: remove unused tracepoints
|
||||
|
||||
These explicit tracepoints aren't really used and show sign of aging.
|
||||
It's work to keep these up to date, and before I attempted to keep them
|
||||
up to date, they weren't up to date, which indicates that they're not
|
||||
really used. These days there are better ways of introspecting anyway.
|
||||
|
||||
Upstream-Status: Backport [369d82bb1746447514c877088d7c5fd0f39140f8]
|
||||
Change-Id: I3b8c3e2732e7efdd76ce63204ac53a48784d0df6
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
---
|
||||
probes/Kbuild | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/probes/Kbuild b/probes/Kbuild
|
||||
index 3ae2d39e..58da82b8 100644
|
||||
--- a/probes/Kbuild
|
||||
+++ b/probes/Kbuild
|
||||
@@ -215,8 +215,11 @@ ifneq ($(CONFIG_FRAME_WARN),0)
|
||||
CFLAGS_lttng-probe-printk.o += -Wframe-larger-than=2200
|
||||
endif
|
||||
|
||||
+# Introduced in v3.6, remove in v5.18
|
||||
obj-$(CONFIG_LTTNG) += $(shell \
|
||||
- if [ $(VERSION) -ge 4 \
|
||||
+ if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) \) \
|
||||
+ -a \
|
||||
+ $(VERSION) -ge 4 \
|
||||
-o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
|
||||
-o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
|
||||
-o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
From da956d1444139883f5d01078d945078738ffade4 Mon Sep 17 00:00:00 2001
|
||||
From: He Zhe <zhe.he@windriver.com>
|
||||
Date: Thu, 2 Jun 2022 06:36:08 +0000
|
||||
Subject: [PATCH 18/19] fix: random: remove unused tracepoints (v5.10, v5.15)
|
||||
|
||||
The following kernel commit has been back ported to v5.10.119 and v5.15.44.
|
||||
|
||||
commit 14c174633f349cb41ea90c2c0aaddac157012f74
|
||||
Author: Jason A. Donenfeld <Jason@zx2c4.com>
|
||||
Date: Thu Feb 10 16:40:44 2022 +0100
|
||||
|
||||
random: remove unused tracepoints
|
||||
|
||||
These explicit tracepoints aren't really used and show sign of aging.
|
||||
It's work to keep these up to date, and before I attempted to keep them
|
||||
up to date, they weren't up to date, which indicates that they're not
|
||||
really used. These days there are better ways of introspecting anyway.
|
||||
|
||||
Upstream-Status: Backport [1901e0eb58795e850e8fdcb5e1c235e4397b470d]
|
||||
Signed-off-by: He Zhe <zhe.he@windriver.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: I0b7eb8aa78b5bd2039e20ae3e1da4c5eb9018789
|
||||
---
|
||||
probes/Kbuild | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/probes/Kbuild b/probes/Kbuild
|
||||
index 58da82b8..87f2d681 100644
|
||||
--- a/probes/Kbuild
|
||||
+++ b/probes/Kbuild
|
||||
@@ -217,7 +217,10 @@ endif
|
||||
|
||||
# Introduced in v3.6, remove in v5.18
|
||||
obj-$(CONFIG_LTTNG) += $(shell \
|
||||
- if [ \( ! \( $(VERSION) -ge 6 -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \) \) \
|
||||
+ if [ \( ! \( $(VERSION) -ge 6 \
|
||||
+ -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \
|
||||
+ -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 15 -a $(SUBLEVEL) -ge 44 \) \
|
||||
+ -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 10 -a $(SUBLEVEL) -ge 119\) \) \) \
|
||||
-a \
|
||||
$(VERSION) -ge 4 \
|
||||
-o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 2c98e0cd03eba0aa935796bc7413c51b5e4b055c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Tue, 31 May 2022 15:24:48 -0400
|
||||
Subject: [PATCH 19/19] fix: 'random' tracepoints removed in stable kernels
|
||||
|
||||
The upstream commit 14c174633f349cb41ea90c2c0aaddac157012f74 removing
|
||||
the 'random' tracepoints is being backported to multiple stable kernel
|
||||
branches, I don't see how that qualifies as a fix but here we are.
|
||||
|
||||
Use the presence of 'include/trace/events/random.h' in the kernel source
|
||||
tree instead of the rather tortuous version check to determine if we
|
||||
need to build 'lttng-probe-random.ko'.
|
||||
|
||||
Upstream-Status: Backport [ed1149ef88fb62c365ac66cf62c58ac6abd8d7e8]
|
||||
Change-Id: I8f5f2f4c9e09c61127c49c7949b22dd3fab0460d
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
---
|
||||
probes/Kbuild | 16 ++++------------
|
||||
1 file changed, 4 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/probes/Kbuild b/probes/Kbuild
|
||||
index 87f2d681..f09d6b65 100644
|
||||
--- a/probes/Kbuild
|
||||
+++ b/probes/Kbuild
|
||||
@@ -216,18 +216,10 @@ ifneq ($(CONFIG_FRAME_WARN),0)
|
||||
endif
|
||||
|
||||
# Introduced in v3.6, remove in v5.18
|
||||
-obj-$(CONFIG_LTTNG) += $(shell \
|
||||
- if [ \( ! \( $(VERSION) -ge 6 \
|
||||
- -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -ge 18 \) \
|
||||
- -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 15 -a $(SUBLEVEL) -ge 44 \) \
|
||||
- -o \( $(VERSION) -eq 5 -a $(PATCHLEVEL) -eq 10 -a $(SUBLEVEL) -ge 119\) \) \) \
|
||||
- -a \
|
||||
- $(VERSION) -ge 4 \
|
||||
- -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -ge 6 \) \
|
||||
- -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 5 -a $(SUBLEVEL) -ge 2 \) \
|
||||
- -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 4 -a $(SUBLEVEL) -ge 9 \) \
|
||||
- -o \( $(VERSION) -eq 3 -a $(PATCHLEVEL) -eq 0 -a $(SUBLEVEL) -ge 41 \) ] ; then \
|
||||
- echo "lttng-probe-random.o" ; fi;)
|
||||
+random_dep = $(srctree)/include/trace/events/random.h
|
||||
+ifneq ($(wildcard $(random_dep)),)
|
||||
+ obj-$(CONFIG_LTTNG) += lttng-probe-random.o
|
||||
+endif
|
||||
|
||||
obj-$(CONFIG_LTTNG) += $(shell \
|
||||
if [ $(VERSION) -ge 4 \
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@@ -28,6 +28,9 @@ SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
|
||||
file://0014-Revert-fix-include-order-for-older-kernels.patch \
|
||||
file://0015-fix-backport-of-fix-tracepoint-Optimize-using-static.patch \
|
||||
file://0016-fix-adjust-version-range-for-trace_find_free_extent.patch \
|
||||
file://0017-fix-random-remove-unused-tracepoints-v5.18.patch \
|
||||
file://0018-fix-random-remove-unused-tracepoints-v5.10-v5.15.patch \
|
||||
file://0019-fix-random-tracepoints-removed-in-stable-kernels.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "8ef09fdfcdec669d33f7fc1c1c80f2c4"
|
||||
|
||||
@@ -5,7 +5,7 @@ LICENSE = "ISC"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
|
||||
|
||||
SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
|
||||
SRC_URI[sha256sum] = "884ba2e3c1e8b98762b6dc25ff60b5ec75c8d33a39e019b3ed4aa615491460d3"
|
||||
SRC_URI[sha256sum] = "ac00f97efecce5046ed069d1d93f3365fdf994c7c7854a8fc50831e959537230"
|
||||
|
||||
inherit bin_package allarch
|
||||
|
||||
@@ -36,7 +36,7 @@ PACKAGECONFIG ??= "\
|
||||
speexdsp \
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'pulseaudio', d)} \
|
||||
"
|
||||
PACKAGECONFIG[aaf] = "--enable-aaf,--disable-aaf,avtp"
|
||||
PACKAGECONFIG[aaf] = "--enable-aaf,--disable-aaf,libavtp"
|
||||
PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack"
|
||||
PACKAGECONFIG[libav] = "--enable-libav,--disable-libav,libav"
|
||||
PACKAGECONFIG[maemo-plugin] = "--enable-maemo-plugin,--disable-maemo-plugin"
|
||||
|
||||
45
meta/recipes-support/curl/curl/CVE-2022-27774-1.patch
Normal file
45
meta/recipes-support/curl/curl/CVE-2022-27774-1.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 2a797e099731facf62a2c675396334bc2ad3bc7c Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 25 Apr 2022 16:24:33 +0200
|
||||
Subject: [PATCH] connect: store "conn_remote_port" in the info struct
|
||||
|
||||
To make it available after the connection ended.
|
||||
|
||||
Prerequisite for the patches that address CVE-2022-27774.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/connect.c | 1 +
|
||||
lib/urldata.h | 6 +++++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/connect.c b/lib/connect.c
|
||||
index b3d4057..a977d67 100644
|
||||
--- a/lib/connect.c
|
||||
+++ b/lib/connect.c
|
||||
@@ -624,6 +624,7 @@ void Curl_persistconninfo(struct connectdata *conn)
|
||||
conn->data->info.conn_scheme = conn->handler->scheme;
|
||||
conn->data->info.conn_protocol = conn->handler->protocol;
|
||||
conn->data->info.conn_primary_port = conn->primary_port;
|
||||
+ conn->data->info.conn_remote_port = conn->remote_port;
|
||||
conn->data->info.conn_local_port = conn->local_port;
|
||||
}
|
||||
|
||||
diff --git a/lib/urldata.h b/lib/urldata.h
|
||||
index fafb7a3..ab1b267 100644
|
||||
--- a/lib/urldata.h
|
||||
+++ b/lib/urldata.h
|
||||
@@ -1148,7 +1148,11 @@ struct PureInfo {
|
||||
reused, in the connection cache. */
|
||||
|
||||
char conn_primary_ip[MAX_IPADR_LEN];
|
||||
- long conn_primary_port;
|
||||
+ long conn_primary_port; /* this is the destination port to the connection,
|
||||
+ which might have been a proxy */
|
||||
+ long conn_remote_port; /* this is the "remote port", which is the port
|
||||
+ number of the used URL, independent of proxy or
|
||||
+ not */
|
||||
char conn_local_ip[MAX_IPADR_LEN];
|
||||
long conn_local_port;
|
||||
const char *conn_scheme;
|
||||
80
meta/recipes-support/curl/curl/CVE-2022-27774-2.patch
Normal file
80
meta/recipes-support/curl/curl/CVE-2022-27774-2.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From 5c2f3b3a5f115625134669d90d591de9c5aafc8e Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 25 Apr 2022 16:24:33 +0200
|
||||
Subject: [PATCH] transfer: redirects to other protocols or ports clear auth
|
||||
|
||||
... unless explicitly permitted.
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-27774.html
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #8748
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/620ea21410030a9977396b4661806bc187231b79]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/transfer.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 48 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/transfer.c b/lib/transfer.c
|
||||
index 744e1c0..ac69d27 100644
|
||||
--- a/lib/transfer.c
|
||||
+++ b/lib/transfer.c
|
||||
@@ -1627,10 +1627,57 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
else {
|
||||
-
|
||||
uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0);
|
||||
if(uc)
|
||||
return Curl_uc_to_curlcode(uc);
|
||||
+
|
||||
+ /* Clear auth if this redirects to a different port number or protocol,
|
||||
+ unless permitted */
|
||||
+ if(!data->set.allow_auth_to_other_hosts && (type != FOLLOW_FAKE)) {
|
||||
+ char *portnum;
|
||||
+ int port;
|
||||
+ bool clear = FALSE;
|
||||
+
|
||||
+ if(data->set.use_port && data->state.allow_port)
|
||||
+ /* a custom port is used */
|
||||
+ port = (int)data->set.use_port;
|
||||
+ else {
|
||||
+ uc = curl_url_get(data->state.uh, CURLUPART_PORT, &portnum,
|
||||
+ CURLU_DEFAULT_PORT);
|
||||
+ if(uc) {
|
||||
+ free(newurl);
|
||||
+ return Curl_uc_to_curlcode(uc);
|
||||
+ }
|
||||
+ port = atoi(portnum);
|
||||
+ free(portnum);
|
||||
+ }
|
||||
+ if(port != data->info.conn_remote_port) {
|
||||
+ infof(data, "Clear auth, redirects to port from %u to %u",
|
||||
+ data->info.conn_remote_port, port);
|
||||
+ clear = TRUE;
|
||||
+ }
|
||||
+ else {
|
||||
+ char *scheme;
|
||||
+ const struct Curl_handler *p;
|
||||
+ uc = curl_url_get(data->state.uh, CURLUPART_SCHEME, &scheme, 0);
|
||||
+ if(uc) {
|
||||
+ free(newurl);
|
||||
+ return Curl_uc_to_curlcode(uc);
|
||||
+ }
|
||||
+
|
||||
+ p = Curl_builtin_scheme(scheme);
|
||||
+ if(p && (p->protocol != data->info.conn_protocol)) {
|
||||
+ infof(data, "Clear auth, redirects scheme from %s to %s",
|
||||
+ data->info.conn_scheme, scheme);
|
||||
+ clear = TRUE;
|
||||
+ }
|
||||
+ free(scheme);
|
||||
+ }
|
||||
+ if(clear) {
|
||||
+ Curl_safefree(data->set.str[STRING_USERNAME]);
|
||||
+ Curl_safefree(data->set.str[STRING_PASSWORD]);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
if(type == FOLLOW_FAKE) {
|
||||
83
meta/recipes-support/curl/curl/CVE-2022-27774-3.patch
Normal file
83
meta/recipes-support/curl/curl/CVE-2022-27774-3.patch
Normal file
@@ -0,0 +1,83 @@
|
||||
From 5dccf21ad49eed925e8f76b0cb844877239ce23d Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 25 Apr 2022 17:59:15 +0200
|
||||
Subject: [PATCH] openssl: don't leak the SRP credentials in redirects either
|
||||
|
||||
Follow-up to 620ea21410030
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #8751
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/139a54ed0a172adaaf1a78d6f4fff50b2c3f9e08]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/http.c | 10 +++++-----
|
||||
lib/http.h | 6 ++++++
|
||||
lib/vtls/openssl.c | 3 ++-
|
||||
3 files changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/lib/http.c b/lib/http.c
|
||||
index 8b16c09..5291c07 100644
|
||||
--- a/lib/http.c
|
||||
+++ b/lib/http.c
|
||||
@@ -732,10 +732,10 @@ output_auth_headers(struct connectdata *conn,
|
||||
}
|
||||
|
||||
/*
|
||||
- * allow_auth_to_host() tells if autentication, cookies or other "sensitive
|
||||
- * data" can (still) be sent to this host.
|
||||
+ * Curl_allow_auth_to_host() tells if authentication, cookies or other
|
||||
+ * "sensitive data" can (still) be sent to this host.
|
||||
*/
|
||||
-static bool allow_auth_to_host(struct Curl_easy *data)
|
||||
+bool Curl_allow_auth_to_host(struct Curl_easy *data)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
return (!data->state.this_is_a_follow ||
|
||||
@@ -816,7 +816,7 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
|
||||
/* To prevent the user+password to get sent to other than the original host
|
||||
due to a location-follow */
|
||||
- if(allow_auth_to_host(data)
|
||||
+ if(Curl_allow_auth_to_host(data)
|
||||
|| conn->bits.netrc
|
||||
)
|
||||
result = output_auth_headers(conn, authhost, request, path, FALSE);
|
||||
@@ -1891,7 +1891,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
|
||||
checkprefix("Cookie:", compare)) &&
|
||||
/* be careful of sending this potentially sensitive header to
|
||||
other hosts */
|
||||
- !allow_auth_to_host(data))
|
||||
+ !Curl_allow_auth_to_host(data))
|
||||
;
|
||||
else {
|
||||
result = Curl_add_bufferf(&req_buffer, "%s\r\n", compare);
|
||||
diff --git a/lib/http.h b/lib/http.h
|
||||
index 4c1825f..4fbae1d 100644
|
||||
--- a/lib/http.h
|
||||
+++ b/lib/http.h
|
||||
@@ -273,4 +273,10 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
bool proxytunnel); /* TRUE if this is the request setting
|
||||
up the proxy tunnel */
|
||||
|
||||
+/*
|
||||
+ * Curl_allow_auth_to_host() tells if authentication, cookies or other
|
||||
+ * "sensitive data" can (still) be sent to this host.
|
||||
+ */
|
||||
+bool Curl_allow_auth_to_host(struct Curl_easy *data);
|
||||
+
|
||||
#endif /* HEADER_CURL_HTTP_H */
|
||||
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
|
||||
index 006a8c8..a14cecc 100644
|
||||
--- a/lib/vtls/openssl.c
|
||||
+++ b/lib/vtls/openssl.c
|
||||
@@ -2739,7 +2739,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
#endif
|
||||
|
||||
#ifdef USE_TLS_SRP
|
||||
- if(ssl_authtype == CURL_TLSAUTH_SRP) {
|
||||
+ if((ssl_authtype == CURL_TLSAUTH_SRP) &&
|
||||
+ Curl_allow_auth_to_host(data)) {
|
||||
char * const ssl_username = SSL_SET_OPTION(username);
|
||||
|
||||
infof(data, "Using TLS-SRP username: %s\n", ssl_username);
|
||||
35
meta/recipes-support/curl/curl/CVE-2022-27774-4.patch
Normal file
35
meta/recipes-support/curl/curl/CVE-2022-27774-4.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 7395752e2f7b87dc8c8f2a7137075e2da554aaea Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Tue, 26 Apr 2022 07:46:19 +0200
|
||||
Subject: [PATCH] gnutls: don't leak the SRP credentials in redirects
|
||||
|
||||
Follow-up to 620ea21410030 and 139a54ed0a172a
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #8752
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/093531556203decd92d92bccd431edbe5561781c]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/vtls/gtls.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
|
||||
index 8c05102..3d0758d 100644
|
||||
--- a/lib/vtls/gtls.c
|
||||
+++ b/lib/vtls/gtls.c
|
||||
@@ -581,11 +581,11 @@ gtls_connect_step1(struct connectdata *conn,
|
||||
}
|
||||
|
||||
#ifdef USE_TLS_SRP
|
||||
- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
|
||||
+ if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
|
||||
+ Curl_allow_auth_to_host(data)) {
|
||||
infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username));
|
||||
|
||||
- rc = gnutls_srp_allocate_client_credentials(
|
||||
- &BACKEND->srp_client_cred);
|
||||
+ rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred);
|
||||
if(rc != GNUTLS_E_SUCCESS) {
|
||||
failf(data, "gnutls_srp_allocate_client_cred() failed: %s",
|
||||
gnutls_strerror(rc));
|
||||
46
meta/recipes-support/curl/curl/CVE-2022-27781.patch
Normal file
46
meta/recipes-support/curl/curl/CVE-2022-27781.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
From 7a1f183039a6a6c9099a114f5e5c94777413c767 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 9 May 2022 10:07:15 +0200
|
||||
Subject: [PATCH] nss: return error if seemingly stuck in a cert loop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CVE-2022-27781
|
||||
|
||||
Reported-by: Florian Kohnhäuser
|
||||
Bug: https://curl.se/docs/CVE-2022-27781.html
|
||||
Closes #8822
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/5c7da89d404bf59c8dd82a001119a16d18365917]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/vtls/nss.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
|
||||
index 375c78b..86102f7 100644
|
||||
--- a/lib/vtls/nss.c
|
||||
+++ b/lib/vtls/nss.c
|
||||
@@ -950,6 +950,9 @@ static void display_cert_info(struct Curl_easy *data,
|
||||
PR_Free(common_name);
|
||||
}
|
||||
|
||||
+/* A number of certs that will never occur in a real server handshake */
|
||||
+#define TOO_MANY_CERTS 300
|
||||
+
|
||||
static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
@@ -986,6 +989,11 @@ static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock)
|
||||
cert2 = CERT_FindCertIssuer(cert, now, certUsageSSLCA);
|
||||
while(cert2) {
|
||||
i++;
|
||||
+ if(i >= TOO_MANY_CERTS) {
|
||||
+ CERT_DestroyCertificate(cert2);
|
||||
+ failf(data, "certificate loop");
|
||||
+ return CURLE_SSL_CERTPROBLEM;
|
||||
+ }
|
||||
if(cert2->isRoot) {
|
||||
CERT_DestroyCertificate(cert2);
|
||||
break;
|
||||
363
meta/recipes-support/curl/curl/CVE-2022-27782-1.patch
Normal file
363
meta/recipes-support/curl/curl/CVE-2022-27782-1.patch
Normal file
@@ -0,0 +1,363 @@
|
||||
From 907a16c832d9ce0ffa7e9b2297548063095a7242 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 9 May 2022 23:13:53 +0200
|
||||
Subject: [PATCH] tls: check more TLS details for connection reuse
|
||||
|
||||
CVE-2022-27782
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Bug: https://curl.se/docs/CVE-2022-27782.html
|
||||
Closes #8825
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/setopt.c | 29 +++++++++++++++++------------
|
||||
lib/url.c | 17 ++++++++++-------
|
||||
lib/urldata.h | 13 +++++++------
|
||||
lib/vtls/gtls.c | 30 ++++++++++++++++--------------
|
||||
lib/vtls/mbedtls.c | 2 +-
|
||||
lib/vtls/nss.c | 6 +++---
|
||||
lib/vtls/openssl.c | 10 +++++-----
|
||||
lib/vtls/vtls.c | 1 +
|
||||
8 files changed, 60 insertions(+), 48 deletions(-)
|
||||
|
||||
diff --git a/lib/setopt.c b/lib/setopt.c
|
||||
index 4648c87..bebb2e4 100644
|
||||
--- a/lib/setopt.c
|
||||
+++ b/lib/setopt.c
|
||||
@@ -2130,6 +2130,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
|
||||
case CURLOPT_SSL_OPTIONS:
|
||||
arg = va_arg(param, long);
|
||||
+ data->set.ssl.primary.ssl_options = (unsigned char)(arg & 0xff);
|
||||
data->set.ssl.enable_beast =
|
||||
(bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
|
||||
data->set.ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
|
||||
@@ -2139,6 +2140,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
case CURLOPT_PROXY_SSL_OPTIONS:
|
||||
arg = va_arg(param, long);
|
||||
+ data->set.proxy_ssl.primary.ssl_options = (unsigned char)(arg & 0xff);
|
||||
data->set.proxy_ssl.enable_beast =
|
||||
(bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
|
||||
data->set.proxy_ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
|
||||
@@ -2541,44 +2543,47 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
|
||||
case CURLOPT_TLSAUTH_USERNAME:
|
||||
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_ORIG],
|
||||
va_arg(param, char *));
|
||||
- if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype)
|
||||
- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
+ if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] &&
|
||||
+ !data->set.ssl.primary.authtype)
|
||||
+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
break;
|
||||
case CURLOPT_PROXY_TLSAUTH_USERNAME:
|
||||
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY],
|
||||
va_arg(param, char *));
|
||||
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
|
||||
- !data->set.proxy_ssl.authtype)
|
||||
- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
+ !data->set.proxy_ssl.primary.authtype)
|
||||
+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to
|
||||
+ SRP */
|
||||
break;
|
||||
case CURLOPT_TLSAUTH_PASSWORD:
|
||||
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_ORIG],
|
||||
va_arg(param, char *));
|
||||
- if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype)
|
||||
- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
+ if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] &&
|
||||
+ !data->set.ssl.primary.authtype)
|
||||
+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
break;
|
||||
case CURLOPT_PROXY_TLSAUTH_PASSWORD:
|
||||
result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY],
|
||||
va_arg(param, char *));
|
||||
if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
|
||||
- !data->set.proxy_ssl.authtype)
|
||||
- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
|
||||
+ !data->set.proxy_ssl.primary.authtype)
|
||||
+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */
|
||||
break;
|
||||
case CURLOPT_TLSAUTH_TYPE:
|
||||
argptr = va_arg(param, char *);
|
||||
if(!argptr ||
|
||||
strncasecompare(argptr, "SRP", strlen("SRP")))
|
||||
- data->set.ssl.authtype = CURL_TLSAUTH_SRP;
|
||||
+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP;
|
||||
else
|
||||
- data->set.ssl.authtype = CURL_TLSAUTH_NONE;
|
||||
+ data->set.ssl.primary.authtype = CURL_TLSAUTH_NONE;
|
||||
break;
|
||||
case CURLOPT_PROXY_TLSAUTH_TYPE:
|
||||
argptr = va_arg(param, char *);
|
||||
if(!argptr ||
|
||||
strncasecompare(argptr, "SRP", strlen("SRP")))
|
||||
- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP;
|
||||
+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP;
|
||||
else
|
||||
- data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE;
|
||||
+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_NONE;
|
||||
break;
|
||||
#endif
|
||||
#ifdef USE_ARES
|
||||
diff --git a/lib/url.c b/lib/url.c
|
||||
index efa3dc7..6518be9 100644
|
||||
--- a/lib/url.c
|
||||
+++ b/lib/url.c
|
||||
@@ -482,7 +482,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
|
||||
set->ssl.primary.verifypeer = TRUE;
|
||||
set->ssl.primary.verifyhost = TRUE;
|
||||
#ifdef USE_TLS_SRP
|
||||
- set->ssl.authtype = CURL_TLSAUTH_NONE;
|
||||
+ set->ssl.primary.authtype = CURL_TLSAUTH_NONE;
|
||||
#endif
|
||||
set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
|
||||
type */
|
||||
@@ -3594,8 +3594,9 @@ static CURLcode create_conn(struct Curl_easy *data,
|
||||
data->set.proxy_ssl.primary.pinned_key =
|
||||
data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY];
|
||||
|
||||
- data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
|
||||
- data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY];
|
||||
+ data->set.ssl.primary.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
|
||||
+ data->set.proxy_ssl.primary.CRLfile =
|
||||
+ data->set.str[STRING_SSL_CRLFILE_PROXY];
|
||||
data->set.ssl.cert = data->set.str[STRING_CERT_ORIG];
|
||||
data->set.proxy_ssl.cert = data->set.str[STRING_CERT_PROXY];
|
||||
data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE_ORIG];
|
||||
@@ -3609,10 +3610,12 @@ static CURLcode create_conn(struct Curl_easy *data,
|
||||
data->set.ssl.primary.clientcert = data->set.str[STRING_CERT_ORIG];
|
||||
data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY];
|
||||
#ifdef USE_TLS_SRP
|
||||
- data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG];
|
||||
- data->set.proxy_ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
|
||||
- data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
|
||||
- data->set.proxy_ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_PROXY];
|
||||
+ data->set.ssl.primary.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG];
|
||||
+ data->set.proxy_ssl.primary.username =
|
||||
+ data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
|
||||
+ data->set.ssl.primary.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
|
||||
+ data->set.proxy_ssl.primary.password =
|
||||
+ data->set.str[STRING_TLSAUTH_PASSWORD_PROXY];
|
||||
#endif
|
||||
|
||||
if(!Curl_clone_primary_ssl_config(&data->set.ssl.primary,
|
||||
diff --git a/lib/urldata.h b/lib/urldata.h
|
||||
index ab1b267..ad0ef8f 100644
|
||||
--- a/lib/urldata.h
|
||||
+++ b/lib/urldata.h
|
||||
@@ -231,6 +231,13 @@ struct ssl_primary_config {
|
||||
char *cipher_list; /* list of ciphers to use */
|
||||
char *cipher_list13; /* list of TLS 1.3 cipher suites to use */
|
||||
char *pinned_key;
|
||||
+ char *CRLfile; /* CRL to check certificate revocation */
|
||||
+ #ifdef USE_TLS_SRP
|
||||
+ char *username; /* TLS username (for, e.g., SRP) */
|
||||
+ char *password; /* TLS password (for, e.g., SRP) */
|
||||
+ enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
|
||||
+ #endif
|
||||
+ unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */
|
||||
BIT(verifypeer); /* set TRUE if this is desired */
|
||||
BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */
|
||||
BIT(verifystatus); /* set TRUE if certificate status must be checked */
|
||||
@@ -240,7 +247,6 @@ struct ssl_primary_config {
|
||||
struct ssl_config_data {
|
||||
struct ssl_primary_config primary;
|
||||
long certverifyresult; /* result from the certificate verification */
|
||||
- char *CRLfile; /* CRL to check certificate revocation */
|
||||
curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
|
||||
void *fsslctxp; /* parameter for call back */
|
||||
char *cert; /* client certificate file name */
|
||||
@@ -248,11 +254,6 @@ struct ssl_config_data {
|
||||
char *key; /* private key file name */
|
||||
char *key_type; /* format for private key (default: PEM) */
|
||||
char *key_passwd; /* plain text private key password */
|
||||
-#ifdef USE_TLS_SRP
|
||||
- char *username; /* TLS username (for, e.g., SRP) */
|
||||
- char *password; /* TLS password (for, e.g., SRP) */
|
||||
- enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
|
||||
-#endif
|
||||
BIT(certinfo); /* gather lots of certificate info */
|
||||
BIT(falsestart);
|
||||
BIT(enable_beast); /* allow this flaw for interoperability's sake*/
|
||||
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
|
||||
index 3d0758d..92c301c 100644
|
||||
--- a/lib/vtls/gtls.c
|
||||
+++ b/lib/vtls/gtls.c
|
||||
@@ -581,9 +581,10 @@ gtls_connect_step1(struct connectdata *conn,
|
||||
}
|
||||
|
||||
#ifdef USE_TLS_SRP
|
||||
- if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
|
||||
+ if((SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) &&
|
||||
Curl_allow_auth_to_host(data)) {
|
||||
- infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username));
|
||||
+ infof(data, "Using TLS-SRP username: %s\n",
|
||||
+ SSL_SET_OPTION(primary.username));
|
||||
|
||||
rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred);
|
||||
if(rc != GNUTLS_E_SUCCESS) {
|
||||
@@ -593,8 +594,8 @@ gtls_connect_step1(struct connectdata *conn,
|
||||
}
|
||||
|
||||
rc = gnutls_srp_set_client_credentials(BACKEND->srp_client_cred,
|
||||
- SSL_SET_OPTION(username),
|
||||
- SSL_SET_OPTION(password));
|
||||
+ SSL_SET_OPTION(primary.username),
|
||||
+ SSL_SET_OPTION(primary.password));
|
||||
if(rc != GNUTLS_E_SUCCESS) {
|
||||
failf(data, "gnutls_srp_set_client_cred() failed: %s",
|
||||
gnutls_strerror(rc));
|
||||
@@ -648,19 +649,19 @@ gtls_connect_step1(struct connectdata *conn,
|
||||
}
|
||||
#endif
|
||||
|
||||
- if(SSL_SET_OPTION(CRLfile)) {
|
||||
+ if(SSL_SET_OPTION(primary.CRLfile)) {
|
||||
/* set the CRL list file */
|
||||
rc = gnutls_certificate_set_x509_crl_file(BACKEND->cred,
|
||||
- SSL_SET_OPTION(CRLfile),
|
||||
+ SSL_SET_OPTION(primary.CRLfile),
|
||||
GNUTLS_X509_FMT_PEM);
|
||||
if(rc < 0) {
|
||||
failf(data, "error reading crl file %s (%s)",
|
||||
- SSL_SET_OPTION(CRLfile), gnutls_strerror(rc));
|
||||
+ SSL_SET_OPTION(primary.CRLfile), gnutls_strerror(rc));
|
||||
return CURLE_SSL_CRL_BADFILE;
|
||||
}
|
||||
else
|
||||
infof(data, "found %d CRL in %s\n",
|
||||
- rc, SSL_SET_OPTION(CRLfile));
|
||||
+ rc, SSL_SET_OPTION(primary.CRLfile));
|
||||
}
|
||||
|
||||
/* Initialize TLS session as a client */
|
||||
@@ -879,7 +880,7 @@ gtls_connect_step1(struct connectdata *conn,
|
||||
|
||||
#ifdef USE_TLS_SRP
|
||||
/* put the credentials to the current session */
|
||||
- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
|
||||
+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) {
|
||||
rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP,
|
||||
BACKEND->srp_client_cred);
|
||||
if(rc != GNUTLS_E_SUCCESS) {
|
||||
@@ -1061,8 +1062,8 @@ gtls_connect_step3(struct connectdata *conn,
|
||||
SSL_CONN_CONFIG(verifyhost) ||
|
||||
SSL_CONN_CONFIG(issuercert)) {
|
||||
#ifdef USE_TLS_SRP
|
||||
- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
|
||||
- && SSL_SET_OPTION(username) != NULL
|
||||
+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP
|
||||
+ && SSL_SET_OPTION(primary.username) != NULL
|
||||
&& !SSL_CONN_CONFIG(verifypeer)
|
||||
&& gnutls_cipher_get(session)) {
|
||||
/* no peer cert, but auth is ok if we have SRP user and cipher and no
|
||||
@@ -1116,7 +1117,8 @@ gtls_connect_step3(struct connectdata *conn,
|
||||
failf(data, "server certificate verification failed. CAfile: %s "
|
||||
"CRLfile: %s", SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile):
|
||||
"none",
|
||||
- SSL_SET_OPTION(CRLfile)?SSL_SET_OPTION(CRLfile):"none");
|
||||
+ SSL_SET_OPTION(primary.CRLfile) ?
|
||||
+ SSL_SET_OPTION(primary.CRLfile) : "none");
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
}
|
||||
else
|
||||
@@ -1703,8 +1705,8 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
|
||||
gnutls_certificate_free_credentials(BACKEND->cred);
|
||||
|
||||
#ifdef USE_TLS_SRP
|
||||
- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
|
||||
- && SSL_SET_OPTION(username) != NULL)
|
||||
+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP
|
||||
+ && SSL_SET_OPTION(primary.username) != NULL)
|
||||
gnutls_srp_free_client_credentials(BACKEND->srp_client_cred);
|
||||
#endif
|
||||
|
||||
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
|
||||
index 19df847..62d2b00 100644
|
||||
--- a/lib/vtls/mbedtls.c
|
||||
+++ b/lib/vtls/mbedtls.c
|
||||
@@ -245,7 +245,7 @@ mbed_connect_step1(struct connectdata *conn,
|
||||
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
|
||||
const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
|
||||
char * const ssl_cert = SSL_SET_OPTION(cert);
|
||||
- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
|
||||
+ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile);
|
||||
const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
|
||||
conn->host.name;
|
||||
const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
|
||||
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
|
||||
index 86102f7..62fd7a2 100644
|
||||
--- a/lib/vtls/nss.c
|
||||
+++ b/lib/vtls/nss.c
|
||||
@@ -1955,13 +1955,13 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
|
||||
}
|
||||
}
|
||||
|
||||
- if(SSL_SET_OPTION(CRLfile)) {
|
||||
- const CURLcode rv = nss_load_crl(SSL_SET_OPTION(CRLfile));
|
||||
+ if(SSL_SET_OPTION(primary.CRLfile)) {
|
||||
+ const CURLcode rv = nss_load_crl(SSL_SET_OPTION(primary.CRLfile));
|
||||
if(rv) {
|
||||
result = rv;
|
||||
goto error;
|
||||
}
|
||||
- infof(data, " CRLfile: %s\n", SSL_SET_OPTION(CRLfile));
|
||||
+ infof(data, " CRLfile: %s\n", SSL_SET_OPTION(primary.CRLfile));
|
||||
}
|
||||
|
||||
if(SSL_SET_OPTION(cert)) {
|
||||
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
|
||||
index a14cecc..ec5a8f5 100644
|
||||
--- a/lib/vtls/openssl.c
|
||||
+++ b/lib/vtls/openssl.c
|
||||
@@ -2454,14 +2454,14 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
&data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult;
|
||||
const long int ssl_version = SSL_CONN_CONFIG(version);
|
||||
#ifdef USE_TLS_SRP
|
||||
- const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype);
|
||||
+ const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(primary.authtype);
|
||||
#endif
|
||||
char * const ssl_cert = SSL_SET_OPTION(cert);
|
||||
const char * const ssl_cert_type = SSL_SET_OPTION(cert_type);
|
||||
const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
|
||||
const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
|
||||
const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
|
||||
- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
|
||||
+ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile);
|
||||
char error_buffer[256];
|
||||
|
||||
DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);
|
||||
@@ -2741,15 +2741,15 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
|
||||
#ifdef USE_TLS_SRP
|
||||
if((ssl_authtype == CURL_TLSAUTH_SRP) &&
|
||||
Curl_allow_auth_to_host(data)) {
|
||||
- char * const ssl_username = SSL_SET_OPTION(username);
|
||||
-
|
||||
+ char * const ssl_username = SSL_SET_OPTION(primary.username);
|
||||
+ char * const ssl_password = SSL_SET_OPTION(primary.password);
|
||||
infof(data, "Using TLS-SRP username: %s\n", ssl_username);
|
||||
|
||||
if(!SSL_CTX_set_srp_username(BACKEND->ctx, ssl_username)) {
|
||||
failf(data, "Unable to set SRP user name");
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
- if(!SSL_CTX_set_srp_password(BACKEND->ctx, SSL_SET_OPTION(password))) {
|
||||
+ if(!SSL_CTX_set_srp_password(BACKEND->ctx, ssl_password)) {
|
||||
failf(data, "failed setting SRP password");
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
|
||||
index e38f74e..e8cb70f 100644
|
||||
--- a/lib/vtls/vtls.c
|
||||
+++ b/lib/vtls/vtls.c
|
||||
@@ -89,6 +89,7 @@ Curl_ssl_config_matches(struct ssl_primary_config* data,
|
||||
{
|
||||
if((data->version == needle->version) &&
|
||||
(data->version_max == needle->version_max) &&
|
||||
+ (data->ssl_options == needle->ssl_options) &&
|
||||
(data->verifypeer == needle->verifypeer) &&
|
||||
(data->verifyhost == needle->verifyhost) &&
|
||||
(data->verifystatus == needle->verifystatus) &&
|
||||
71
meta/recipes-support/curl/curl/CVE-2022-27782-2.patch
Normal file
71
meta/recipes-support/curl/curl/CVE-2022-27782-2.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
From 0a115a8903dffc7f723d1d4d71fb821d69eb8761 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 9 May 2022 23:13:53 +0200
|
||||
Subject: [PATCH] url: check SSH config match on connection reuse
|
||||
|
||||
CVE-2022-27782
|
||||
|
||||
Reported-by: Harry Sintonen
|
||||
Bug: https://curl.se/docs/CVE-2022-27782.html
|
||||
Closes #8825
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/1645e9b44505abd5cbaf65da5282c3f33b5924a5]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/url.c | 11 +++++++++++
|
||||
lib/vssh/ssh.h | 6 +++---
|
||||
2 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/url.c b/lib/url.c
|
||||
index 6518be9..8da0245 100644
|
||||
--- a/lib/url.c
|
||||
+++ b/lib/url.c
|
||||
@@ -1027,6 +1027,12 @@ static void prune_dead_connections(struct Curl_easy *data)
|
||||
}
|
||||
}
|
||||
|
||||
+static bool ssh_config_matches(struct connectdata *one,
|
||||
+ struct connectdata *two)
|
||||
+{
|
||||
+ return (Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) &&
|
||||
+ Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub));
|
||||
+}
|
||||
/*
|
||||
* Given one filled in connection struct (named needle), this function should
|
||||
* detect if there already is one that has all the significant details
|
||||
@@ -1260,6 +1266,11 @@ ConnectionExists(struct Curl_easy *data,
|
||||
}
|
||||
}
|
||||
|
||||
+ if(get_protocol_family(needle->handler->protocol) == PROTO_FAMILY_SSH) {
|
||||
+ if(!ssh_config_matches(needle, check))
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if(!needle->bits.httpproxy || (needle->handler->flags&PROTOPT_SSL) ||
|
||||
needle->bits.tunnel_proxy) {
|
||||
/* The requested connection does not use a HTTP proxy or it uses SSL or
|
||||
diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h
|
||||
index 0d4ee52..8f2632e 100644
|
||||
--- a/lib/vssh/ssh.h
|
||||
+++ b/lib/vssh/ssh.h
|
||||
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -120,8 +120,8 @@ struct ssh_conn {
|
||||
|
||||
/* common */
|
||||
const char *passphrase; /* pass-phrase to use */
|
||||
- char *rsa_pub; /* path name */
|
||||
- char *rsa; /* path name */
|
||||
+ char *rsa_pub; /* strdup'ed public key file */
|
||||
+ char *rsa; /* strdup'ed private key file */
|
||||
bool authed; /* the connection has been authenticated fine */
|
||||
sshstate state; /* always use ssh.c:state() to change state! */
|
||||
sshstate nextstate; /* the state to goto after stopping */
|
||||
52
meta/recipes-support/curl/curl/CVE-2022-32206.patch
Normal file
52
meta/recipes-support/curl/curl/CVE-2022-32206.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 25e7be39be5f8ed696b6085ced9cf6c17e6128f4 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Mon, 16 May 2022 16:28:13 +0200
|
||||
Subject: [PATCH] content_encoding: return error on too many compression steps
|
||||
|
||||
The max allowed steps is arbitrarily set to 5.
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-32206.html
|
||||
CVE-2022-32206
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #9049
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/3a09fbb7f264c67c43]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/content_encoding.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/lib/content_encoding.c b/lib/content_encoding.c
|
||||
index 6d47537..91e621f 100644
|
||||
--- a/lib/content_encoding.c
|
||||
+++ b/lib/content_encoding.c
|
||||
@@ -934,6 +934,9 @@ static const content_encoding *find_encoding(const char *name, size_t len)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+/* allow no more than 5 "chained" compression steps */
|
||||
+#define MAX_ENCODE_STACK 5
|
||||
+
|
||||
/* Set-up the unencoding stack from the Content-Encoding header value.
|
||||
* See RFC 7231 section 3.1.2.2. */
|
||||
CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
|
||||
@@ -941,6 +944,7 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
|
||||
{
|
||||
struct Curl_easy *data = conn->data;
|
||||
struct SingleRequest *k = &data->req;
|
||||
+ int counter = 0;
|
||||
|
||||
do {
|
||||
const char *name;
|
||||
@@ -975,6 +979,11 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
|
||||
if(!encoding)
|
||||
encoding = &error_encoding; /* Defer error at stack use. */
|
||||
|
||||
+ if(++counter >= MAX_ENCODE_STACK) {
|
||||
+ failf(data, "Reject response due to %u content encodings",
|
||||
+ counter);
|
||||
+ return CURLE_BAD_CONTENT_ENCODING;
|
||||
+ }
|
||||
/* Stack the unencoding stage. */
|
||||
writer = new_unencoding_writer(conn, encoding, k->writer_stack);
|
||||
if(!writer)
|
||||
284
meta/recipes-support/curl/curl/CVE-2022-32207.patch
Normal file
284
meta/recipes-support/curl/curl/CVE-2022-32207.patch
Normal file
@@ -0,0 +1,284 @@
|
||||
From af92181055d7d64dfc0bc9d5a13c8b98af3196be Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Wed, 25 May 2022 10:09:53 +0200
|
||||
Subject: [PATCH] fopen: add Curl_fopen() for better overwriting of files
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-32207.html
|
||||
CVE-2022-32207
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #9050
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/20f9dd6bae50b]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
CMakeLists.txt | 1 +
|
||||
configure.ac | 1 +
|
||||
lib/Makefile.inc | 4 +-
|
||||
lib/cookie.c | 19 ++-----
|
||||
lib/curl_config.h.cmake | 3 ++
|
||||
lib/fopen.c | 113 ++++++++++++++++++++++++++++++++++++++++
|
||||
lib/fopen.h | 30 +++++++++++
|
||||
7 files changed, 155 insertions(+), 16 deletions(-)
|
||||
create mode 100644 lib/fopen.c
|
||||
create mode 100644 lib/fopen.h
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 73b053b..cc587b0 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -869,6 +869,7 @@ elseif(HAVE_LIBSOCKET)
|
||||
set(CMAKE_REQUIRED_LIBRARIES socket)
|
||||
endif()
|
||||
|
||||
+check_symbol_exists(fchmod "${CURL_INCLUDES}" HAVE_FCHMOD)
|
||||
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d090622..7071077 100755
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -4059,6 +4059,7 @@ AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Se
|
||||
|
||||
|
||||
AC_CHECK_FUNCS([fnmatch \
|
||||
+ fchmod \
|
||||
geteuid \
|
||||
getpass_r \
|
||||
getppid \
|
||||
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
|
||||
index 46ded90..79307d8 100644
|
||||
--- a/lib/Makefile.inc
|
||||
+++ b/lib/Makefile.inc
|
||||
@@ -63,7 +63,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
curl_multibyte.c hostcheck.c conncache.c dotdot.c \
|
||||
x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \
|
||||
mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c psl.c \
|
||||
- doh.c urlapi.c curl_get_line.c altsvc.c socketpair.c rename.c
|
||||
+ doh.c urlapi.c curl_get_line.c altsvc.c socketpair.c rename.c fopen.c
|
||||
|
||||
LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
|
||||
formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
|
||||
@@ -84,7 +84,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
|
||||
x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
|
||||
curl_printf.h system_win32.h rand.h mime.h curl_sha256.h setopt.h \
|
||||
curl_path.h curl_ctype.h curl_range.h psl.h doh.h urlapi-int.h \
|
||||
- curl_get_line.h altsvc.h quic.h socketpair.h rename.h
|
||||
+ curl_get_line.h altsvc.h quic.h socketpair.h rename.h fopen.h
|
||||
|
||||
LIB_RCFILES = libcurl.rc
|
||||
|
||||
diff --git a/lib/cookie.c b/lib/cookie.c
|
||||
index 68054e1..a9ad20a 100644
|
||||
--- a/lib/cookie.c
|
||||
+++ b/lib/cookie.c
|
||||
@@ -97,8 +97,8 @@ Example set of cookies:
|
||||
#include "curl_memrchr.h"
|
||||
#include "inet_pton.h"
|
||||
#include "parsedate.h"
|
||||
-#include "rand.h"
|
||||
#include "rename.h"
|
||||
+#include "fopen.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
@@ -1524,18 +1524,9 @@ static int cookie_output(struct Curl_easy *data,
|
||||
use_stdout = TRUE;
|
||||
}
|
||||
else {
|
||||
- unsigned char randsuffix[9];
|
||||
-
|
||||
- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
|
||||
- return 2;
|
||||
-
|
||||
- tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
|
||||
- if(!tempstore)
|
||||
- return 1;
|
||||
-
|
||||
- out = fopen(tempstore, FOPEN_WRITETEXT);
|
||||
- if(!out)
|
||||
- goto error;
|
||||
+ error = Curl_fopen(data, filename, &out, &tempstore);
|
||||
+ if(error)
|
||||
+ goto error;
|
||||
}
|
||||
|
||||
fputs("# Netscape HTTP Cookie File\n"
|
||||
@@ -1581,7 +1572,7 @@ static int cookie_output(struct Curl_easy *data,
|
||||
if(!use_stdout) {
|
||||
fclose(out);
|
||||
out = NULL;
|
||||
- if(Curl_rename(tempstore, filename)) {
|
||||
+ if(tempstore && Curl_rename(tempstore, filename)) {
|
||||
unlink(tempstore);
|
||||
goto error;
|
||||
}
|
||||
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
|
||||
index 98cdf51..fe43751 100644
|
||||
--- a/lib/curl_config.h.cmake
|
||||
+++ b/lib/curl_config.h.cmake
|
||||
@@ -124,6 +124,9 @@
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#cmakedefine HAVE_ASSERT_H 1
|
||||
|
||||
+/* Define to 1 if you have the `fchmod' function. */
|
||||
+#cmakedefine HAVE_FCHMOD 1
|
||||
+
|
||||
/* Define to 1 if you have the `basename' function. */
|
||||
#cmakedefine HAVE_BASENAME 1
|
||||
|
||||
diff --git a/lib/fopen.c b/lib/fopen.c
|
||||
new file mode 100644
|
||||
index 0000000..ad3691b
|
||||
--- /dev/null
|
||||
+++ b/lib/fopen.c
|
||||
@@ -0,0 +1,113 @@
|
||||
+/***************************************************************************
|
||||
+ * _ _ ____ _
|
||||
+ * Project ___| | | | _ \| |
|
||||
+ * / __| | | | |_) | |
|
||||
+ * | (__| |_| | _ <| |___
|
||||
+ * \___|\___/|_| \_\_____|
|
||||
+ *
|
||||
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
+ *
|
||||
+ * This software is licensed as described in the file COPYING, which
|
||||
+ * you should have received as part of this distribution. The terms
|
||||
+ * are also available at https://curl.se/docs/copyright.html.
|
||||
+ *
|
||||
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
+ * copies of the Software, and permit persons to whom the Software is
|
||||
+ * furnished to do so, under the terms of the COPYING file.
|
||||
+ *
|
||||
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
+ * KIND, either express or implied.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: curl
|
||||
+ *
|
||||
+ ***************************************************************************/
|
||||
+
|
||||
+#include "curl_setup.h"
|
||||
+
|
||||
+#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
|
||||
+ !defined(CURL_DISABLE_HSTS)
|
||||
+
|
||||
+#ifdef HAVE_FCNTL_H
|
||||
+#include <fcntl.h>
|
||||
+#endif
|
||||
+
|
||||
+#include "urldata.h"
|
||||
+#include "rand.h"
|
||||
+#include "fopen.h"
|
||||
+/* The last 3 #include files should be in this order */
|
||||
+#include "curl_printf.h"
|
||||
+#include "curl_memory.h"
|
||||
+#include "memdebug.h"
|
||||
+
|
||||
+/*
|
||||
+ * Curl_fopen() opens a file for writing with a temp name, to be renamed
|
||||
+ * to the final name when completed. If there is an existing file using this
|
||||
+ * name at the time of the open, this function will clone the mode from that
|
||||
+ * file. if 'tempname' is non-NULL, it needs a rename after the file is
|
||||
+ * written.
|
||||
+ */
|
||||
+CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
|
||||
+ FILE **fh, char **tempname)
|
||||
+{
|
||||
+ CURLcode result = CURLE_WRITE_ERROR;
|
||||
+ unsigned char randsuffix[9];
|
||||
+ char *tempstore = NULL;
|
||||
+ struct_stat sb;
|
||||
+ int fd = -1;
|
||||
+ *tempname = NULL;
|
||||
+
|
||||
+ if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
|
||||
+ /* a non-regular file, fallback to direct fopen() */
|
||||
+ *fh = fopen(filename, FOPEN_WRITETEXT);
|
||||
+ if(*fh)
|
||||
+ return CURLE_OK;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
|
||||
+ if(result)
|
||||
+ goto fail;
|
||||
+
|
||||
+ tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
|
||||
+ if(!tempstore) {
|
||||
+ result = CURLE_OUT_OF_MEMORY;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ result = CURLE_WRITE_ERROR;
|
||||
+ fd = open(tempstore, O_WRONLY | O_CREAT | O_EXCL, 0600);
|
||||
+ if(fd == -1)
|
||||
+ goto fail;
|
||||
+
|
||||
+#ifdef HAVE_FCHMOD
|
||||
+ {
|
||||
+ struct_stat nsb;
|
||||
+ if((fstat(fd, &nsb) != -1) &&
|
||||
+ (nsb.st_uid == sb.st_uid) && (nsb.st_gid == sb.st_gid)) {
|
||||
+ /* if the user and group are the same, clone the original mode */
|
||||
+ if(fchmod(fd, sb.st_mode) == -1)
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ *fh = fdopen(fd, FOPEN_WRITETEXT);
|
||||
+ if(!*fh)
|
||||
+ goto fail;
|
||||
+
|
||||
+ *tempname = tempstore;
|
||||
+ return CURLE_OK;
|
||||
+
|
||||
+fail:
|
||||
+ if(fd != -1) {
|
||||
+ close(fd);
|
||||
+ unlink(tempstore);
|
||||
+ }
|
||||
+
|
||||
+ free(tempstore);
|
||||
+
|
||||
+ *tempname = NULL;
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+#endif /* ! disabled */
|
||||
diff --git a/lib/fopen.h b/lib/fopen.h
|
||||
new file mode 100644
|
||||
index 0000000..289e55f
|
||||
--- /dev/null
|
||||
+++ b/lib/fopen.h
|
||||
@@ -0,0 +1,30 @@
|
||||
+#ifndef HEADER_CURL_FOPEN_H
|
||||
+#define HEADER_CURL_FOPEN_H
|
||||
+/***************************************************************************
|
||||
+ * _ _ ____ _
|
||||
+ * Project ___| | | | _ \| |
|
||||
+ * / __| | | | |_) | |
|
||||
+ * | (__| |_| | _ <| |___
|
||||
+ * \___|\___/|_| \_\_____|
|
||||
+ *
|
||||
+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
+ *
|
||||
+ * This software is licensed as described in the file COPYING, which
|
||||
+ * you should have received as part of this distribution. The terms
|
||||
+ * are also available at https://curl.se/docs/copyright.html.
|
||||
+ *
|
||||
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
+ * copies of the Software, and permit persons to whom the Software is
|
||||
+ * furnished to do so, under the terms of the COPYING file.
|
||||
+ *
|
||||
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
+ * KIND, either express or implied.
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: curl
|
||||
+ *
|
||||
+ ***************************************************************************/
|
||||
+
|
||||
+CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
|
||||
+ FILE **fh, char **tempname);
|
||||
+
|
||||
+#endif
|
||||
72
meta/recipes-support/curl/curl/CVE-2022-32208.patch
Normal file
72
meta/recipes-support/curl/curl/CVE-2022-32208.patch
Normal file
@@ -0,0 +1,72 @@
|
||||
From 3b90f0b2a7a84645acce151c86b40d25b5de6615 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Stenberg <daniel@haxx.se>
|
||||
Date: Thu, 9 Jun 2022 09:27:24 +0200
|
||||
Subject: [PATCH] krb5: return error properly on decode errors
|
||||
|
||||
Bug: https://curl.se/docs/CVE-2022-32208.html
|
||||
CVE-2022-32208
|
||||
Reported-by: Harry Sintonen
|
||||
Closes #9051
|
||||
|
||||
Upstream-Status: Backport [https://github.com/curl/curl/commit/6ecdf5136b52af7]
|
||||
Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
|
||||
---
|
||||
lib/krb5.c | 5 +----
|
||||
lib/security.c | 13 ++++++++++---
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/lib/krb5.c b/lib/krb5.c
|
||||
index f50287a..5b77e35 100644
|
||||
--- a/lib/krb5.c
|
||||
+++ b/lib/krb5.c
|
||||
@@ -86,11 +86,8 @@ krb5_decode(void *app_data, void *buf, int len,
|
||||
enc.value = buf;
|
||||
enc.length = len;
|
||||
maj = gss_unwrap(&min, *context, &enc, &dec, NULL, NULL);
|
||||
- if(maj != GSS_S_COMPLETE) {
|
||||
- if(len >= 4)
|
||||
- strcpy(buf, "599 ");
|
||||
+ if(maj != GSS_S_COMPLETE)
|
||||
return -1;
|
||||
- }
|
||||
|
||||
memcpy(buf, dec.value, dec.length);
|
||||
len = curlx_uztosi(dec.length);
|
||||
diff --git a/lib/security.c b/lib/security.c
|
||||
index fbfa707..3542210 100644
|
||||
--- a/lib/security.c
|
||||
+++ b/lib/security.c
|
||||
@@ -192,6 +192,7 @@ static CURLcode read_data(struct connectdata *conn,
|
||||
{
|
||||
int len;
|
||||
CURLcode result;
|
||||
+ int nread;
|
||||
|
||||
result = socket_read(fd, &len, sizeof(len));
|
||||
if(result)
|
||||
@@ -200,7 +201,10 @@ static CURLcode read_data(struct connectdata *conn,
|
||||
if(len) {
|
||||
/* only realloc if there was a length */
|
||||
len = ntohl(len);
|
||||
- buf->data = Curl_saferealloc(buf->data, len);
|
||||
+ if(len > CURL_MAX_INPUT_LENGTH)
|
||||
+ len = 0;
|
||||
+ else
|
||||
+ buf->data = Curl_saferealloc(buf->data, len);
|
||||
}
|
||||
if(!len || !buf->data)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@@ -208,8 +212,11 @@ static CURLcode read_data(struct connectdata *conn,
|
||||
result = socket_read(fd, buf->data, len);
|
||||
if(result)
|
||||
return result;
|
||||
- buf->size = conn->mech->decode(conn->app_data, buf->data, len,
|
||||
- conn->data_prot, conn);
|
||||
+ nread = buf->size = conn->mech->decode(conn->app_data, buf->data, len,
|
||||
+ conn->data_prot, conn);
|
||||
+ if(nread < 0)
|
||||
+ return CURLE_RECV_ERROR;
|
||||
+ buf->size = (size_t)nread;
|
||||
buf->index = 0;
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -28,6 +28,16 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
|
||||
file://CVE-2022-27776.patch \
|
||||
file://CVE-2022-27775.patch \
|
||||
file://CVE-2022-22576.patch \
|
||||
file://CVE-2022-27774-1.patch \
|
||||
file://CVE-2022-27774-2.patch \
|
||||
file://CVE-2022-27774-3.patch \
|
||||
file://CVE-2022-27774-4.patch \
|
||||
file://CVE-2022-27781.patch \
|
||||
file://CVE-2022-27782-1.patch \
|
||||
file://CVE-2022-27782-2.patch \
|
||||
file://CVE-2022-32206.patch \
|
||||
file://CVE-2022-32207.patch \
|
||||
file://CVE-2022-32208.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
|
||||
@@ -35,7 +45,7 @@ SRC_URI[sha256sum] = "2ff5e5bd507adf6aa88ff4bbafd4c7af464867ffb688be93b9930717a5
|
||||
|
||||
# Curl has used many names over the years...
|
||||
CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl"
|
||||
CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-22945"
|
||||
CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-2021-22945"
|
||||
|
||||
# As per link https://security-tracker.debian.org/tracker/CVE-2021-22897
|
||||
# and https://ubuntu.com/security/CVE-2021-22897
|
||||
|
||||
660
meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch
Normal file
660
meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch
Normal file
@@ -0,0 +1,660 @@
|
||||
From aa5aac0d209e3debf80fc2db924d9401fc50454b Mon Sep 17 00:00:00 2001
|
||||
From: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
Date: Mon, 23 May 2022 14:11:11 +0530
|
||||
Subject: [PATCH] CVE-2022-1587
|
||||
|
||||
Upstream-Status: Backport [https://github.com/PCRE2Project/pcre2/commit/03654e751e7f0700693526b67dfcadda6b42c9d0]
|
||||
CVE: CVE-2022-1587
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
|
||||
---
|
||||
ChangeLog | 3 +
|
||||
src/pcre2_jit_compile.c | 290 ++++++++++++++++++++++++++--------------
|
||||
src/pcre2_jit_test.c | 1 +
|
||||
3 files changed, 194 insertions(+), 100 deletions(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index b5d72dc..de82de9 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -4,6 +4,9 @@ Change Log for PCRE2
|
||||
23. Fixed a unicode properrty matching issue in JIT. The character was not
|
||||
fully read in caseless matching.
|
||||
|
||||
+24. Fixed an issue affecting recursions in JIT caused by duplicated data
|
||||
+transfers.
|
||||
+
|
||||
|
||||
Version 10.34 21-November-2019
|
||||
------------------------------
|
||||
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
|
||||
index 5d43865..493c96d 100644
|
||||
--- a/src/pcre2_jit_compile.c
|
||||
+++ b/src/pcre2_jit_compile.c
|
||||
@@ -407,6 +407,9 @@ typedef struct compiler_common {
|
||||
/* Locals used by fast fail optimization. */
|
||||
sljit_s32 fast_fail_start_ptr;
|
||||
sljit_s32 fast_fail_end_ptr;
|
||||
+ /* Variables used by recursive call generator. */
|
||||
+ sljit_s32 recurse_bitset_size;
|
||||
+ uint8_t *recurse_bitset;
|
||||
|
||||
/* Flipped and lower case tables. */
|
||||
const sljit_u8 *fcc;
|
||||
@@ -2109,19 +2112,39 @@ for (i = 0; i < RECURSE_TMP_REG_COUNT; i++)
|
||||
|
||||
#undef RECURSE_TMP_REG_COUNT
|
||||
|
||||
+static BOOL recurse_check_bit(compiler_common *common, sljit_sw bit_index)
|
||||
+{
|
||||
+uint8_t *byte;
|
||||
+uint8_t mask;
|
||||
+
|
||||
+SLJIT_ASSERT((bit_index & (sizeof(sljit_sw) - 1)) == 0);
|
||||
+
|
||||
+bit_index >>= SLJIT_WORD_SHIFT;
|
||||
+
|
||||
+mask = 1 << (bit_index & 0x7);
|
||||
+byte = common->recurse_bitset + (bit_index >> 3);
|
||||
+
|
||||
+if (*byte & mask)
|
||||
+ return FALSE;
|
||||
+
|
||||
+*byte |= mask;
|
||||
+return TRUE;
|
||||
+}
|
||||
+
|
||||
static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
|
||||
BOOL *needs_control_head, BOOL *has_quit, BOOL *has_accept)
|
||||
{
|
||||
int length = 1;
|
||||
-int size;
|
||||
+int size, offset;
|
||||
PCRE2_SPTR alternative;
|
||||
BOOL quit_found = FALSE;
|
||||
BOOL accept_found = FALSE;
|
||||
BOOL setsom_found = FALSE;
|
||||
BOOL setmark_found = FALSE;
|
||||
-BOOL capture_last_found = FALSE;
|
||||
BOOL control_head_found = FALSE;
|
||||
|
||||
+memset(common->recurse_bitset, 0, common->recurse_bitset_size);
|
||||
+
|
||||
#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
|
||||
SLJIT_ASSERT(common->control_head_ptr != 0);
|
||||
control_head_found = TRUE;
|
||||
@@ -2144,15 +2167,17 @@ while (cc < ccend)
|
||||
setsom_found = TRUE;
|
||||
if (common->mark_ptr != 0)
|
||||
setmark_found = TRUE;
|
||||
- if (common->capture_last_ptr != 0)
|
||||
- capture_last_found = TRUE;
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
+ length++;
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
case OP_KET:
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0)
|
||||
{
|
||||
- length++;
|
||||
+ if (recurse_check_bit(common, offset))
|
||||
+ length++;
|
||||
SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
|
||||
cc += PRIVATE_DATA(cc + 1);
|
||||
}
|
||||
@@ -2169,39 +2194,55 @@ while (cc < ccend)
|
||||
case OP_SBRA:
|
||||
case OP_SBRAPOS:
|
||||
case OP_SCOND:
|
||||
- length++;
|
||||
SLJIT_ASSERT(PRIVATE_DATA(cc) != 0);
|
||||
+ if (recurse_check_bit(common, PRIVATE_DATA(cc)))
|
||||
+ length++;
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
case OP_CBRA:
|
||||
case OP_SCBRA:
|
||||
- length += 2;
|
||||
- if (common->capture_last_ptr != 0)
|
||||
- capture_last_found = TRUE;
|
||||
- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
|
||||
+ offset = GET2(cc, 1 + LINK_SIZE);
|
||||
+ if (recurse_check_bit(common, OVECTOR(offset << 1)))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1)));
|
||||
+ length += 2;
|
||||
+ }
|
||||
+ if (common->optimized_cbracket[offset] == 0 && recurse_check_bit(common, OVECTOR_PRIV(offset)))
|
||||
+ length++;
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
length++;
|
||||
cc += 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_CBRAPOS:
|
||||
case OP_SCBRAPOS:
|
||||
- length += 2 + 2;
|
||||
- if (common->capture_last_ptr != 0)
|
||||
- capture_last_found = TRUE;
|
||||
+ offset = GET2(cc, 1 + LINK_SIZE);
|
||||
+ if (recurse_check_bit(common, OVECTOR(offset << 1)))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1)));
|
||||
+ length += 2;
|
||||
+ }
|
||||
+ if (recurse_check_bit(common, OVECTOR_PRIV(offset)))
|
||||
+ length++;
|
||||
+ if (recurse_check_bit(common, PRIVATE_DATA(cc)))
|
||||
+ length++;
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
+ length++;
|
||||
cc += 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_COND:
|
||||
/* Might be a hidden SCOND. */
|
||||
alternative = cc + GET(cc, 1);
|
||||
- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
|
||||
+ if ((*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) && recurse_check_bit(common, PRIVATE_DATA(cc)))
|
||||
length++;
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_1
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
length++;
|
||||
cc += 2;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
@@ -2210,8 +2251,12 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_2A
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
|
||||
length += 2;
|
||||
+ }
|
||||
cc += 2;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
|
||||
@@ -2219,8 +2264,12 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_2B
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
|
||||
length += 2;
|
||||
+ }
|
||||
cc += 2 + IMM2_SIZE;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
|
||||
@@ -2228,20 +2277,29 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_1
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
length++;
|
||||
cc += 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
|
||||
length += 2;
|
||||
+ }
|
||||
cc += 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
+ {
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
|
||||
length += 2;
|
||||
+ }
|
||||
cc += 1 + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
@@ -2253,7 +2311,9 @@ while (cc < ccend)
|
||||
#else
|
||||
size = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
|
||||
#endif
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+
|
||||
+ offset = PRIVATE_DATA(cc);
|
||||
+ if (offset != 0 && recurse_check_bit(common, offset))
|
||||
length += get_class_iterator_size(cc + size);
|
||||
cc += size;
|
||||
break;
|
||||
@@ -2288,8 +2348,7 @@ while (cc < ccend)
|
||||
case OP_THEN:
|
||||
SLJIT_ASSERT(common->control_head_ptr != 0);
|
||||
quit_found = TRUE;
|
||||
- if (!control_head_found)
|
||||
- control_head_found = TRUE;
|
||||
+ control_head_found = TRUE;
|
||||
cc++;
|
||||
break;
|
||||
|
||||
@@ -2309,8 +2368,6 @@ SLJIT_ASSERT(cc == ccend);
|
||||
|
||||
if (control_head_found)
|
||||
length++;
|
||||
-if (capture_last_found)
|
||||
- length++;
|
||||
if (quit_found)
|
||||
{
|
||||
if (setsom_found)
|
||||
@@ -2343,14 +2400,12 @@ sljit_sw shared_srcw[3];
|
||||
sljit_sw kept_shared_srcw[2];
|
||||
int private_count, shared_count, kept_shared_count;
|
||||
int from_sp, base_reg, offset, i;
|
||||
-BOOL setsom_found = FALSE;
|
||||
-BOOL setmark_found = FALSE;
|
||||
-BOOL capture_last_found = FALSE;
|
||||
-BOOL control_head_found = FALSE;
|
||||
+
|
||||
+memset(common->recurse_bitset, 0, common->recurse_bitset_size);
|
||||
|
||||
#if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
|
||||
SLJIT_ASSERT(common->control_head_ptr != 0);
|
||||
-control_head_found = TRUE;
|
||||
+recurse_check_bit(common, common->control_head_ptr);
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
@@ -2438,11 +2493,10 @@ while (cc < ccend)
|
||||
{
|
||||
case OP_SET_SOM:
|
||||
SLJIT_ASSERT(common->has_set_som);
|
||||
- if (has_quit && !setsom_found)
|
||||
+ if (has_quit && recurse_check_bit(common, OVECTOR(0)))
|
||||
{
|
||||
kept_shared_srcw[0] = OVECTOR(0);
|
||||
kept_shared_count = 1;
|
||||
- setsom_found = TRUE;
|
||||
}
|
||||
cc += 1;
|
||||
break;
|
||||
@@ -2450,33 +2504,31 @@ while (cc < ccend)
|
||||
case OP_RECURSE:
|
||||
if (has_quit)
|
||||
{
|
||||
- if (common->has_set_som && !setsom_found)
|
||||
+ if (common->has_set_som && recurse_check_bit(common, OVECTOR(0)))
|
||||
{
|
||||
kept_shared_srcw[0] = OVECTOR(0);
|
||||
kept_shared_count = 1;
|
||||
- setsom_found = TRUE;
|
||||
}
|
||||
- if (common->mark_ptr != 0 && !setmark_found)
|
||||
+ if (common->mark_ptr != 0 && recurse_check_bit(common, common->mark_ptr))
|
||||
{
|
||||
kept_shared_srcw[kept_shared_count] = common->mark_ptr;
|
||||
kept_shared_count++;
|
||||
- setmark_found = TRUE;
|
||||
}
|
||||
}
|
||||
- if (common->capture_last_ptr != 0 && !capture_last_found)
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
{
|
||||
shared_srcw[0] = common->capture_last_ptr;
|
||||
shared_count = 1;
|
||||
- capture_last_found = TRUE;
|
||||
}
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
case OP_KET:
|
||||
- if (PRIVATE_DATA(cc) != 0)
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0)
|
||||
{
|
||||
- private_count = 1;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ private_count = 1;
|
||||
SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
|
||||
cc += PRIVATE_DATA(cc + 1);
|
||||
}
|
||||
@@ -2493,50 +2545,66 @@ while (cc < ccend)
|
||||
case OP_SBRA:
|
||||
case OP_SBRAPOS:
|
||||
case OP_SCOND:
|
||||
- private_count = 1;
|
||||
private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ private_count = 1;
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
case OP_CBRA:
|
||||
case OP_SCBRA:
|
||||
- offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
|
||||
- shared_srcw[0] = OVECTOR(offset);
|
||||
- shared_srcw[1] = OVECTOR(offset + 1);
|
||||
- shared_count = 2;
|
||||
+ offset = GET2(cc, 1 + LINK_SIZE);
|
||||
+ shared_srcw[0] = OVECTOR(offset << 1);
|
||||
+ if (recurse_check_bit(common, shared_srcw[0]))
|
||||
+ {
|
||||
+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
|
||||
+ shared_count = 2;
|
||||
+ }
|
||||
|
||||
- if (common->capture_last_ptr != 0 && !capture_last_found)
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
{
|
||||
- shared_srcw[2] = common->capture_last_ptr;
|
||||
- shared_count = 3;
|
||||
- capture_last_found = TRUE;
|
||||
+ shared_srcw[shared_count] = common->capture_last_ptr;
|
||||
+ shared_count++;
|
||||
}
|
||||
|
||||
- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
|
||||
+ if (common->optimized_cbracket[offset] == 0)
|
||||
{
|
||||
- private_count = 1;
|
||||
- private_srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
|
||||
+ private_srcw[0] = OVECTOR_PRIV(offset);
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ private_count = 1;
|
||||
}
|
||||
+
|
||||
cc += 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
case OP_CBRAPOS:
|
||||
case OP_SCBRAPOS:
|
||||
- offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
|
||||
- shared_srcw[0] = OVECTOR(offset);
|
||||
- shared_srcw[1] = OVECTOR(offset + 1);
|
||||
- shared_count = 2;
|
||||
+ offset = GET2(cc, 1 + LINK_SIZE);
|
||||
+ shared_srcw[0] = OVECTOR(offset << 1);
|
||||
+ if (recurse_check_bit(common, shared_srcw[0]))
|
||||
+ {
|
||||
+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
|
||||
+ shared_count = 2;
|
||||
+ }
|
||||
|
||||
- if (common->capture_last_ptr != 0 && !capture_last_found)
|
||||
+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
|
||||
{
|
||||
- shared_srcw[2] = common->capture_last_ptr;
|
||||
- shared_count = 3;
|
||||
- capture_last_found = TRUE;
|
||||
+ shared_srcw[shared_count] = common->capture_last_ptr;
|
||||
+ shared_count++;
|
||||
}
|
||||
|
||||
- private_count = 2;
|
||||
private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- private_srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ private_count = 1;
|
||||
+
|
||||
+ offset = OVECTOR_PRIV(offset);
|
||||
+ if (recurse_check_bit(common, offset))
|
||||
+ {
|
||||
+ private_srcw[private_count] = offset;
|
||||
+ private_count++;
|
||||
+ }
|
||||
cc += 1 + LINK_SIZE + IMM2_SIZE;
|
||||
break;
|
||||
|
||||
@@ -2545,18 +2613,17 @@ while (cc < ccend)
|
||||
alternative = cc + GET(cc, 1);
|
||||
if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
|
||||
{
|
||||
- private_count = 1;
|
||||
private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ private_count = 1;
|
||||
}
|
||||
cc += 1 + LINK_SIZE;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_1
|
||||
- if (PRIVATE_DATA(cc))
|
||||
- {
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
private_count = 1;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- }
|
||||
cc += 2;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
|
||||
@@ -2564,11 +2631,12 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_2A
|
||||
- if (PRIVATE_DATA(cc))
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
{
|
||||
private_count = 2;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
|
||||
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
|
||||
}
|
||||
cc += 2;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
@@ -2577,11 +2645,12 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_PRIVATE_DATA_2B
|
||||
- if (PRIVATE_DATA(cc))
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
{
|
||||
private_count = 2;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
|
||||
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
|
||||
}
|
||||
cc += 2 + IMM2_SIZE;
|
||||
#ifdef SUPPORT_UNICODE
|
||||
@@ -2590,30 +2659,30 @@ while (cc < ccend)
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_1
|
||||
- if (PRIVATE_DATA(cc))
|
||||
- {
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
private_count = 1;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- }
|
||||
cc += 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
|
||||
- if (PRIVATE_DATA(cc))
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
{
|
||||
private_count = 2;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
|
||||
}
|
||||
cc += 1;
|
||||
break;
|
||||
|
||||
CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
|
||||
- if (PRIVATE_DATA(cc))
|
||||
+ private_srcw[0] = PRIVATE_DATA(cc);
|
||||
+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
|
||||
{
|
||||
private_count = 2;
|
||||
- private_srcw[0] = PRIVATE_DATA(cc);
|
||||
private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
|
||||
}
|
||||
cc += 1 + IMM2_SIZE;
|
||||
break;
|
||||
@@ -2630,14 +2699,17 @@ while (cc < ccend)
|
||||
switch(get_class_iterator_size(cc + i))
|
||||
{
|
||||
case 1:
|
||||
- private_count = 1;
|
||||
private_srcw[0] = PRIVATE_DATA(cc);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
- private_count = 2;
|
||||
private_srcw[0] = PRIVATE_DATA(cc);
|
||||
- private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ if (recurse_check_bit(common, private_srcw[0]))
|
||||
+ {
|
||||
+ private_count = 2;
|
||||
+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
|
||||
+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
|
||||
+ }
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -2652,28 +2724,25 @@ while (cc < ccend)
|
||||
case OP_PRUNE_ARG:
|
||||
case OP_THEN_ARG:
|
||||
SLJIT_ASSERT(common->mark_ptr != 0);
|
||||
- if (has_quit && !setmark_found)
|
||||
+ if (has_quit && recurse_check_bit(common, common->mark_ptr))
|
||||
{
|
||||
kept_shared_srcw[0] = common->mark_ptr;
|
||||
kept_shared_count = 1;
|
||||
- setmark_found = TRUE;
|
||||
}
|
||||
- if (common->control_head_ptr != 0 && !control_head_found)
|
||||
+ if (common->control_head_ptr != 0 && recurse_check_bit(common, common->control_head_ptr))
|
||||
{
|
||||
shared_srcw[0] = common->control_head_ptr;
|
||||
shared_count = 1;
|
||||
- control_head_found = TRUE;
|
||||
}
|
||||
cc += 1 + 2 + cc[1];
|
||||
break;
|
||||
|
||||
case OP_THEN:
|
||||
SLJIT_ASSERT(common->control_head_ptr != 0);
|
||||
- if (!control_head_found)
|
||||
+ if (recurse_check_bit(common, common->control_head_ptr))
|
||||
{
|
||||
shared_srcw[0] = common->control_head_ptr;
|
||||
shared_count = 1;
|
||||
- control_head_found = TRUE;
|
||||
}
|
||||
cc++;
|
||||
break;
|
||||
@@ -2681,7 +2750,7 @@ while (cc < ccend)
|
||||
default:
|
||||
cc = next_opcode(common, cc);
|
||||
SLJIT_ASSERT(cc != NULL);
|
||||
- break;
|
||||
+ continue;
|
||||
}
|
||||
|
||||
if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
|
||||
@@ -13262,7 +13331,7 @@ SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
|
||||
common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
|
||||
|
||||
total_length = ccend - common->start;
|
||||
-common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data);
|
||||
+common->private_data_ptrs = (sljit_s32*)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data);
|
||||
if (!common->private_data_ptrs)
|
||||
{
|
||||
SLJIT_FREE(common->optimized_cbracket, allocator_data);
|
||||
@@ -13304,6 +13373,7 @@ if (!compiler)
|
||||
common->compiler = compiler;
|
||||
|
||||
/* Main pcre_jit_exec entry. */
|
||||
+LJIT_ASSERT((private_data_size & (sizeof(sljit_sw) - 1)) == 0);
|
||||
sljit_emit_enter(compiler, 0, SLJIT_ARG1(SW), 5, 5, 0, 0, private_data_size);
|
||||
|
||||
/* Register init. */
|
||||
@@ -13524,20 +13594,40 @@ common->fast_fail_end_ptr = 0;
|
||||
common->currententry = common->entries;
|
||||
common->local_quit_available = TRUE;
|
||||
quit_label = common->quit_label;
|
||||
-while (common->currententry != NULL)
|
||||
+if (common->currententry != NULL)
|
||||
{
|
||||
- /* Might add new entries. */
|
||||
- compile_recurse(common);
|
||||
- if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
|
||||
+ /* A free bit for each private data. */
|
||||
+ common->recurse_bitset_size = ((private_data_size / (int)sizeof(sljit_sw)) + 7) >> 3;
|
||||
+ SLJIT_ASSERT(common->recurse_bitset_size > 0);
|
||||
+ common->recurse_bitset = (sljit_u8*)SLJIT_MALLOC(common->recurse_bitset_size, allocator_data);;
|
||||
+
|
||||
+ if (common->recurse_bitset != NULL)
|
||||
+ {
|
||||
+ do
|
||||
+ {
|
||||
+ /* Might add new entries. */
|
||||
+ compile_recurse(common);
|
||||
+ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
|
||||
+ break;
|
||||
+ flush_stubs(common);
|
||||
+ common->currententry = common->currententry->next;
|
||||
+ }
|
||||
+ while (common->currententry != NULL);
|
||||
+
|
||||
+ SLJIT_FREE(common->recurse_bitset, allocator_data);
|
||||
+ }
|
||||
+
|
||||
+ if (common->currententry != NULL)
|
||||
{
|
||||
+ /* The common->recurse_bitset has been freed. */
|
||||
+ SLJIT_ASSERT(sljit_get_compiler_error(compiler) || common->recurse_bitset == NULL);
|
||||
+
|
||||
sljit_free_compiler(compiler);
|
||||
SLJIT_FREE(common->optimized_cbracket, allocator_data);
|
||||
SLJIT_FREE(common->private_data_ptrs, allocator_data);
|
||||
PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data);
|
||||
return PCRE2_ERROR_NOMEMORY;
|
||||
}
|
||||
- flush_stubs(common);
|
||||
- common->currententry = common->currententry->next;
|
||||
}
|
||||
common->local_quit_available = FALSE;
|
||||
common->quit_label = quit_label;
|
||||
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
|
||||
index 9df87fd..2f84834 100644
|
||||
--- a/src/pcre2_jit_test.c
|
||||
+++ b/src/pcre2_jit_test.c
|
||||
@@ -746,6 +746,7 @@ static struct regression_test_case regression_test_cases[] = {
|
||||
{ MU, A, 0, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
|
||||
{ MU, A, 0, 0, "((.)(?:.|\\2(?1))){0}#(?1)#", "#aabbccdde# #aabbccddee#" },
|
||||
{ MU, A, 0, 0, "((.)(?:\\2|\\2{4}b)){0}#(?:(?1))+#", "#aaaab# #aaaaab#" },
|
||||
+ { MU, A, 0, 0 | F_NOMATCH, "(?1)$((.|\\2xx){1,2})", "abc" },
|
||||
|
||||
/* 16 bit specific tests. */
|
||||
{ CM, A, 0, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" },
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -13,6 +13,7 @@ LIC_FILES_CHKSUM = "file://LICENCE;md5=b1588d3bb4cb0e1f5a597d908f8c5b37"
|
||||
SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/pcre2-${PV}.tar.bz2 \
|
||||
file://pcre-cross.patch \
|
||||
file://CVE-2022-1586.patch \
|
||||
file://CVE-2022-1587.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d280b62ded13f9ccf2fac16ee5286366"
|
||||
|
||||
201
meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch
Normal file
201
meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch
Normal file
@@ -0,0 +1,201 @@
|
||||
From 50f9c9cd3b7dfe9b3c8c795247752d1fdcadcac8 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Sat, 12 Jun 2021 20:02:53 +0200
|
||||
Subject: [PATCH] Fix use-after-free in xsltApplyTemplates
|
||||
|
||||
xsltApplyTemplates without a select expression could delete nodes in
|
||||
the source document.
|
||||
|
||||
1. Text nodes with strippable whitespace
|
||||
|
||||
Whitespace from input documents is already stripped, so there's no
|
||||
need to strip it again. Under certain circumstances, xsltApplyTemplates
|
||||
could be fooled into deleting text nodes that are still referenced,
|
||||
resulting in a use-after-free.
|
||||
|
||||
2. The DTD
|
||||
|
||||
The DTD was only unlinked, but there's no good reason to do this just
|
||||
now. Maybe it was meant as a micro-optimization.
|
||||
|
||||
3. Unknown nodes
|
||||
|
||||
Useless and dangerous as well, especially with XInclude nodes.
|
||||
See https://gitlab.gnome.org/GNOME/libxml2/-/issues/268
|
||||
|
||||
Simply stop trying to uselessly delete nodes when applying a template.
|
||||
This part of the code is probably a leftover from a time where
|
||||
xsltApplyStripSpaces wasn't implemented yet. Also note that
|
||||
xsltApplyTemplates with a select expression never tried to delete
|
||||
nodes.
|
||||
|
||||
Also stop xsltDefaultProcessOneNode from deleting nodes for the same
|
||||
reasons.
|
||||
|
||||
This fixes CVE-2021-30560.
|
||||
|
||||
CVE: CVE-2021-30560
|
||||
Upstream-Status: Backport [https://github.com/GNOME/libxslt/commit/50f9c9cd3b7dfe9b3c8c795247752d1fdcadcac8.patch]
|
||||
Comment: No change in any hunk
|
||||
Signed-off-by: Omkar Patil <Omkar.Patil@kpit.com>
|
||||
|
||||
---
|
||||
libxslt/transform.c | 119 +++-----------------------------------------
|
||||
1 file changed, 7 insertions(+), 112 deletions(-)
|
||||
|
||||
diff --git a/libxslt/transform.c b/libxslt/transform.c
|
||||
index 04522154..3aba354f 100644
|
||||
--- a/libxslt/transform.c
|
||||
+++ b/libxslt/transform.c
|
||||
@@ -1895,7 +1895,7 @@ static void
|
||||
xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xsltStackElemPtr params) {
|
||||
xmlNodePtr copy;
|
||||
- xmlNodePtr delete = NULL, cur;
|
||||
+ xmlNodePtr cur;
|
||||
int nbchild = 0, oldSize;
|
||||
int childno = 0, oldPos;
|
||||
xsltTemplatePtr template;
|
||||
@@ -1968,54 +1968,13 @@ xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
return;
|
||||
}
|
||||
/*
|
||||
- * Handling of Elements: first pass, cleanup and counting
|
||||
+ * Handling of Elements: first pass, counting
|
||||
*/
|
||||
cur = node->children;
|
||||
while (cur != NULL) {
|
||||
- switch (cur->type) {
|
||||
- case XML_TEXT_NODE:
|
||||
- case XML_CDATA_SECTION_NODE:
|
||||
- case XML_DOCUMENT_NODE:
|
||||
- case XML_HTML_DOCUMENT_NODE:
|
||||
- case XML_ELEMENT_NODE:
|
||||
- case XML_PI_NODE:
|
||||
- case XML_COMMENT_NODE:
|
||||
- nbchild++;
|
||||
- break;
|
||||
- case XML_DTD_NODE:
|
||||
- /* Unlink the DTD, it's still reachable using doc->intSubset */
|
||||
- if (cur->next != NULL)
|
||||
- cur->next->prev = cur->prev;
|
||||
- if (cur->prev != NULL)
|
||||
- cur->prev->next = cur->next;
|
||||
- break;
|
||||
- default:
|
||||
-#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
|
||||
- "xsltDefaultProcessOneNode: skipping node type %d\n",
|
||||
- cur->type));
|
||||
-#endif
|
||||
- delete = cur;
|
||||
- }
|
||||
+ if (IS_XSLT_REAL_NODE(cur))
|
||||
+ nbchild++;
|
||||
cur = cur->next;
|
||||
- if (delete != NULL) {
|
||||
-#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
|
||||
- "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
|
||||
-#endif
|
||||
- xmlUnlinkNode(delete);
|
||||
- xmlFreeNode(delete);
|
||||
- delete = NULL;
|
||||
- }
|
||||
- }
|
||||
- if (delete != NULL) {
|
||||
-#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
|
||||
- "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
|
||||
-#endif
|
||||
- xmlUnlinkNode(delete);
|
||||
- xmlFreeNode(delete);
|
||||
- delete = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4864,7 +4823,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
xsltStylePreCompPtr comp = (xsltStylePreCompPtr) castedComp;
|
||||
#endif
|
||||
int i;
|
||||
- xmlNodePtr cur, delNode = NULL, oldContextNode;
|
||||
+ xmlNodePtr cur, oldContextNode;
|
||||
xmlNodeSetPtr list = NULL, oldList;
|
||||
xsltStackElemPtr withParams = NULL;
|
||||
int oldXPProximityPosition, oldXPContextSize;
|
||||
@@ -4998,73 +4957,9 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
|
||||
else
|
||||
cur = NULL;
|
||||
while (cur != NULL) {
|
||||
- switch (cur->type) {
|
||||
- case XML_TEXT_NODE:
|
||||
- if ((IS_BLANK_NODE(cur)) &&
|
||||
- (cur->parent != NULL) &&
|
||||
- (cur->parent->type == XML_ELEMENT_NODE) &&
|
||||
- (ctxt->style->stripSpaces != NULL)) {
|
||||
- const xmlChar *val;
|
||||
-
|
||||
- if (cur->parent->ns != NULL) {
|
||||
- val = (const xmlChar *)
|
||||
- xmlHashLookup2(ctxt->style->stripSpaces,
|
||||
- cur->parent->name,
|
||||
- cur->parent->ns->href);
|
||||
- if (val == NULL) {
|
||||
- val = (const xmlChar *)
|
||||
- xmlHashLookup2(ctxt->style->stripSpaces,
|
||||
- BAD_CAST "*",
|
||||
- cur->parent->ns->href);
|
||||
- }
|
||||
- } else {
|
||||
- val = (const xmlChar *)
|
||||
- xmlHashLookup2(ctxt->style->stripSpaces,
|
||||
- cur->parent->name, NULL);
|
||||
- }
|
||||
- if ((val != NULL) &&
|
||||
- (xmlStrEqual(val, (xmlChar *) "strip"))) {
|
||||
- delNode = cur;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- /* Intentional fall-through */
|
||||
- case XML_ELEMENT_NODE:
|
||||
- case XML_DOCUMENT_NODE:
|
||||
- case XML_HTML_DOCUMENT_NODE:
|
||||
- case XML_CDATA_SECTION_NODE:
|
||||
- case XML_PI_NODE:
|
||||
- case XML_COMMENT_NODE:
|
||||
- xmlXPathNodeSetAddUnique(list, cur);
|
||||
- break;
|
||||
- case XML_DTD_NODE:
|
||||
- /* Unlink the DTD, it's still reachable
|
||||
- * using doc->intSubset */
|
||||
- if (cur->next != NULL)
|
||||
- cur->next->prev = cur->prev;
|
||||
- if (cur->prev != NULL)
|
||||
- cur->prev->next = cur->next;
|
||||
- break;
|
||||
- case XML_NAMESPACE_DECL:
|
||||
- break;
|
||||
- default:
|
||||
-#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
- XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
|
||||
- "xsltApplyTemplates: skipping cur type %d\n",
|
||||
- cur->type));
|
||||
-#endif
|
||||
- delNode = cur;
|
||||
- }
|
||||
+ if (IS_XSLT_REAL_NODE(cur))
|
||||
+ xmlXPathNodeSetAddUnique(list, cur);
|
||||
cur = cur->next;
|
||||
- if (delNode != NULL) {
|
||||
-#ifdef WITH_XSLT_DEBUG_PROCESS
|
||||
- XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
|
||||
- "xsltApplyTemplates: removing ignorable blank cur\n"));
|
||||
-#endif
|
||||
- xmlUnlinkNode(delNode);
|
||||
- xmlFreeNode(delNode);
|
||||
- delNode = NULL;
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ SECTION = "libs"
|
||||
DEPENDS = "libxml2"
|
||||
|
||||
SRC_URI = "http://xmlsoft.org/sources/libxslt-${PV}.tar.gz \
|
||||
file://CVE-2021-30560.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "db8765c8d076f1b6caafd9f2542a304a"
|
||||
@@ -21,6 +22,10 @@ SRC_URI[sha256sum] = "98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7
|
||||
|
||||
UPSTREAM_CHECK_REGEX = "libxslt-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
# We have libxml2 2.9.10 and we don't link statically with it anyway
|
||||
# so this isn't an issue.
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-29824"
|
||||
|
||||
S = "${WORKDIR}/libxslt-${PV}"
|
||||
|
||||
BINCONFIG = "${bindir}/xslt-config"
|
||||
|
||||
@@ -11,7 +11,7 @@ RSUGGESTS_${PN} = "diffutils"
|
||||
|
||||
LICENSE = "vim"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=6b30ea4fa660c483b619924bc709ef99 \
|
||||
file://runtime/doc/uganda.txt;md5=daf48235bb824c77fe8ae88d5f575f74"
|
||||
file://runtime/doc/uganda.txt;md5=001ef779f422a0e9106d428c84495b4d"
|
||||
|
||||
SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
|
||||
file://disable_acl_header_check.patch \
|
||||
@@ -21,8 +21,8 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
|
||||
file://racefix.patch \
|
||||
"
|
||||
|
||||
PV .= ".5034"
|
||||
SRCREV = "5a6ec10cc80ab02eeff644ab19b82312630ea855"
|
||||
PV .= ".0021"
|
||||
SRCREV = "5e59ea54c0c37c2f84770f068d95280069828774"
|
||||
|
||||
# Remove when 8.3 is out
|
||||
UPSTREAM_VERSION_UNKNOWN = "1"
|
||||
|
||||
@@ -206,7 +206,7 @@ def wic_create_subcommand(options, usage_str):
|
||||
logger.info(" (Please check that the build artifacts for the machine")
|
||||
logger.info(" selected in local.conf actually exist and that they")
|
||||
logger.info(" are the correct artifacts for the image (.wks file)).\n")
|
||||
raise WicError("The artifact that couldn't be found was %s:\n %s", not_found, not_found_dir)
|
||||
raise WicError("The artifact that couldn't be found was %s:\n %s" % (not_found, not_found_dir))
|
||||
|
||||
krootfs_dir = options.rootfs_dir
|
||||
if krootfs_dir is None:
|
||||
|
||||
Reference in New Issue
Block a user