mirror of
https://git.yoctoproject.org/poky
synced 2026-02-22 09:29:40 +01:00
Compare commits
95 Commits
dunfell-23
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11f05ffddd | ||
|
|
9fbfbf002e | ||
|
|
6b2a22bc7b | ||
|
|
10108d0ebf | ||
|
|
ba90fb0f3d | ||
|
|
1982d0cc7c | ||
|
|
3acc83f91a | ||
|
|
2a1cf26ba4 | ||
|
|
9ab9e48d36 | ||
|
|
a2147d6d27 | ||
|
|
e2b5de2c77 | ||
|
|
144748fed8 | ||
|
|
507f16e1bc | ||
|
|
e0059335fb | ||
|
|
75022804d8 | ||
|
|
818ad186ae | ||
|
|
1904daa987 | ||
|
|
c86b92df02 | ||
|
|
76b5620df7 | ||
|
|
d47b9fe7c8 | ||
|
|
4c78aab891 | ||
|
|
d20a4df83b | ||
|
|
139406c025 | ||
|
|
1231009682 | ||
|
|
aa673e1427 | ||
|
|
770bb4a64a | ||
|
|
d7fa5a35aa | ||
|
|
7b9f7437ed | ||
|
|
c35692c6eb | ||
|
|
9fa2eba749 | ||
|
|
f1dbb005c8 | ||
|
|
1a96c7537f | ||
|
|
7618011039 | ||
|
|
b4802e2fdb | ||
|
|
0d3339a23a | ||
|
|
3d32267b52 | ||
|
|
9d8cb501f7 | ||
|
|
59bfcd7299 | ||
|
|
c3fb76fc72 | ||
|
|
b4675ad33f | ||
|
|
3f4da8c618 | ||
|
|
358c909fc7 | ||
|
|
1d3f2be1e6 | ||
|
|
e22da98e79 | ||
|
|
580df9b4c4 | ||
|
|
50108e2180 | ||
|
|
3c3039aac4 | ||
|
|
4853705635 | ||
|
|
c58bdcd15c | ||
|
|
ba201fc313 | ||
|
|
d160225d21 | ||
|
|
86e2430d3f | ||
|
|
bf604a8fa8 | ||
|
|
f6899f9b94 | ||
|
|
3c76d0ad71 | ||
|
|
826011d497 | ||
|
|
0922cef2f4 | ||
|
|
e5414e5962 | ||
|
|
17aad7feac | ||
|
|
b200c2d16e | ||
|
|
eb79d76099 | ||
|
|
aec83663aa | ||
|
|
f5e8301b20 | ||
|
|
d2a464dd59 | ||
|
|
6b4ee014f3 | ||
|
|
a99017d705 | ||
|
|
88cf58e2f5 | ||
|
|
a4d08aebae | ||
|
|
81a5f76511 | ||
|
|
25ace79510 | ||
|
|
8369253493 | ||
|
|
fe25a5ea27 | ||
|
|
8d7596c0eb | ||
|
|
b952c3f07a | ||
|
|
560a0ba359 | ||
|
|
fb8372aa70 | ||
|
|
4f6333a564 | ||
|
|
262f47eff8 | ||
|
|
82af51171e | ||
|
|
2d6b838a3a | ||
|
|
97f9525f2f | ||
|
|
c28f0905a2 | ||
|
|
a8de3a2233 | ||
|
|
c611f71574 | ||
|
|
c8149df17e | ||
|
|
40bfc5ff44 | ||
|
|
e3af3f6915 | ||
|
|
6c3fc7df68 | ||
|
|
113f05b50e | ||
|
|
c7fafc86a1 | ||
|
|
a4eed21341 | ||
|
|
4d69f69082 | ||
|
|
accc5ad750 | ||
|
|
b93a3fcbcd | ||
|
|
7d78d5f6e9 |
@@ -405,8 +405,8 @@ This fetcher supports the following parameters:
|
||||
|
||||
- *"nobranch":* Tells the fetcher to not check the SHA validation for
|
||||
the branch when set to "1". The default is "0". Set this option for
|
||||
the recipe that refers to the commit that is valid for a tag instead
|
||||
of the branch.
|
||||
the recipe that refers to the commit that is valid for any namespace
|
||||
(branch, tag, ...) instead of the branch.
|
||||
|
||||
- *"bareclone":* Tells the fetcher to clone a bare clone into the
|
||||
destination directory without checking out a working tree. Only the
|
||||
|
||||
@@ -13,7 +13,6 @@ import sys, os, glob, os.path, re, time
|
||||
import itertools
|
||||
import logging
|
||||
import multiprocessing
|
||||
import sre_constants
|
||||
import threading
|
||||
from io import StringIO, UnsupportedOperation
|
||||
from contextlib import closing
|
||||
@@ -1795,7 +1794,7 @@ class CookerCollectFiles(object):
|
||||
try:
|
||||
re.compile(mask)
|
||||
bbmasks.append(mask)
|
||||
except sre_constants.error:
|
||||
except re.error:
|
||||
collectlog.critical("BBMASK contains an invalid regular expression, ignoring: %s" % mask)
|
||||
|
||||
# Then validate the combined regular expressions. This should never
|
||||
@@ -1803,7 +1802,7 @@ class CookerCollectFiles(object):
|
||||
bbmask = "|".join(bbmasks)
|
||||
try:
|
||||
bbmask_compiled = re.compile(bbmask)
|
||||
except sre_constants.error:
|
||||
except re.error:
|
||||
collectlog.critical("BBMASK is not a valid regular expression, ignoring: %s" % bbmask)
|
||||
bbmask = None
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ Supported SRC_URI options are:
|
||||
|
||||
- nobranch
|
||||
Don't check the SHA validation for branch. set this option for the recipe
|
||||
referring to commit which is valid in tag instead of branch.
|
||||
referring to commit which is valid in any namespace (branch, tag, ...)
|
||||
instead of branch.
|
||||
The default is "0", set nobranch=1 if needed.
|
||||
|
||||
- usehead
|
||||
@@ -63,6 +64,7 @@ import errno
|
||||
import fnmatch
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
import bb
|
||||
@@ -352,7 +354,7 @@ class Git(FetchMethod):
|
||||
# We do this since git will use a "-l" option automatically for local urls where possible
|
||||
if repourl.startswith("file://"):
|
||||
repourl = repourl[7:]
|
||||
clone_cmd = "LANG=C %s clone --bare --mirror \"%s\" %s --progress" % (ud.basecmd, repourl, ud.clonedir)
|
||||
clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, shlex.quote(repourl), ud.clonedir)
|
||||
if ud.proto.lower() != 'file':
|
||||
bb.fetch2.check_network_access(d, clone_cmd, ud.url)
|
||||
progresshandler = GitProgressHandler(d)
|
||||
@@ -364,8 +366,12 @@ class Git(FetchMethod):
|
||||
if "origin" in output:
|
||||
runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
|
||||
|
||||
runfetchcmd("%s remote add --mirror=fetch origin \"%s\"" % (ud.basecmd, repourl), d, workdir=ud.clonedir)
|
||||
fetch_cmd = "LANG=C %s fetch -f --progress \"%s\" refs/*:refs/*" % (ud.basecmd, repourl)
|
||||
runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=ud.clonedir)
|
||||
|
||||
if ud.nobranch:
|
||||
fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl))
|
||||
else:
|
||||
fetch_cmd = "LANG=C %s fetch -f --progress %s refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*" % (ud.basecmd, shlex.quote(repourl))
|
||||
if ud.proto.lower() != 'file':
|
||||
bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
|
||||
progresshandler = GitProgressHandler(d)
|
||||
@@ -559,7 +565,7 @@ class Git(FetchMethod):
|
||||
raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url)
|
||||
|
||||
repourl = self._get_repo_url(ud)
|
||||
runfetchcmd("%s remote set-url origin \"%s\"" % (ud.basecmd, repourl), d, workdir=destdir)
|
||||
runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir)
|
||||
|
||||
if self._contains_lfs(ud, d, destdir):
|
||||
if need_lfs and not self._find_git_lfs(d):
|
||||
@@ -687,8 +693,8 @@ class Git(FetchMethod):
|
||||
d.setVar('_BB_GIT_IN_LSREMOTE', '1')
|
||||
try:
|
||||
repourl = self._get_repo_url(ud)
|
||||
cmd = "%s ls-remote \"%s\" %s" % \
|
||||
(ud.basecmd, repourl, search)
|
||||
cmd = "%s ls-remote %s %s" % \
|
||||
(ud.basecmd, shlex.quote(repourl), search)
|
||||
if ud.proto.lower() != 'file':
|
||||
bb.fetch2.check_network_access(d, cmd, repourl)
|
||||
output = runfetchcmd(cmd, d, True)
|
||||
|
||||
@@ -1975,6 +1975,12 @@ class RunQueueExecute:
|
||||
self.setbuildable(revdep)
|
||||
logger.debug(1, "Marking task %s as buildable", revdep)
|
||||
|
||||
for t in self.sq_deferred.copy():
|
||||
if self.sq_deferred[t] == task:
|
||||
logger.debug(2, "Deferred task %s now buildable" % t)
|
||||
del self.sq_deferred[t]
|
||||
update_scenequeue_data([t], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
|
||||
|
||||
def task_complete(self, task):
|
||||
self.stats.taskCompleted()
|
||||
bb.event.fire(runQueueTaskCompleted(task, self.stats, self.rq), self.cfgData)
|
||||
@@ -2084,8 +2090,6 @@ class RunQueueExecute:
|
||||
logger.debug(1, "%s didn't become valid, skipping setscene" % nexttask)
|
||||
self.sq_task_failoutright(nexttask)
|
||||
return True
|
||||
else:
|
||||
self.sqdata.outrightfail.remove(nexttask)
|
||||
if nexttask in self.sqdata.outrightfail:
|
||||
logger.debug(2, 'No package found, so skipping setscene task %s', nexttask)
|
||||
self.sq_task_failoutright(nexttask)
|
||||
@@ -2236,7 +2240,8 @@ class RunQueueExecute:
|
||||
if self.sq_deferred:
|
||||
tid = self.sq_deferred.pop(list(self.sq_deferred.keys())[0])
|
||||
logger.warning("Runqeueue deadlocked on deferred tasks, forcing task %s" % tid)
|
||||
self.sq_task_failoutright(tid)
|
||||
if tid not in self.runq_complete:
|
||||
self.sq_task_failoutright(tid)
|
||||
return True
|
||||
|
||||
if len(self.failed_tids) != 0:
|
||||
@@ -2350,10 +2355,16 @@ class RunQueueExecute:
|
||||
self.updated_taskhash_queue.remove((tid, unihash))
|
||||
|
||||
if unihash != self.rqdata.runtaskentries[tid].unihash:
|
||||
hashequiv_logger.verbose("Task %s unihash changed to %s" % (tid, unihash))
|
||||
self.rqdata.runtaskentries[tid].unihash = unihash
|
||||
bb.parse.siggen.set_unihash(tid, unihash)
|
||||
toprocess.add(tid)
|
||||
# Make sure we rehash any other tasks with the same task hash that we're deferred against.
|
||||
torehash = [tid]
|
||||
for deftid in self.sq_deferred:
|
||||
if self.sq_deferred[deftid] == tid:
|
||||
torehash.append(deftid)
|
||||
for hashtid in torehash:
|
||||
hashequiv_logger.verbose("Task %s unihash changed to %s" % (hashtid, unihash))
|
||||
self.rqdata.runtaskentries[hashtid].unihash = unihash
|
||||
bb.parse.siggen.set_unihash(hashtid, unihash)
|
||||
toprocess.add(hashtid)
|
||||
|
||||
# Work out all tasks which depend upon these
|
||||
total = set()
|
||||
@@ -2492,6 +2503,14 @@ class RunQueueExecute:
|
||||
|
||||
if update_tasks:
|
||||
self.sqdone = False
|
||||
for mc in sorted(self.sqdata.multiconfigs):
|
||||
for tid in sorted([t[0] for t in update_tasks]):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
h = pending_hash_index(tid, self.rqdata)
|
||||
if h in self.sqdata.hashes and tid != self.sqdata.hashes[h]:
|
||||
self.sq_deferred[tid] = self.sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, self.sqdata.hashes[h]))
|
||||
update_scenequeue_data([t[0] for t in update_tasks], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
|
||||
|
||||
for (tid, harddepfail, origvalid) in update_tasks:
|
||||
@@ -2832,6 +2851,19 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
|
||||
sqdata.stamppresent = set()
|
||||
sqdata.valid = set()
|
||||
|
||||
sqdata.hashes = {}
|
||||
sqrq.sq_deferred = {}
|
||||
for mc in sorted(sqdata.multiconfigs):
|
||||
for tid in sorted(sqdata.sq_revdeps):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
h = pending_hash_index(tid, rqdata)
|
||||
if h not in sqdata.hashes:
|
||||
sqdata.hashes[h] = tid
|
||||
else:
|
||||
sqrq.sq_deferred[tid] = sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
|
||||
|
||||
update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
|
||||
|
||||
def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True):
|
||||
@@ -2843,6 +2875,8 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
|
||||
sqdata.stamppresent.remove(tid)
|
||||
if tid in sqdata.valid:
|
||||
sqdata.valid.remove(tid)
|
||||
if tid in sqdata.outrightfail:
|
||||
sqdata.outrightfail.remove(tid)
|
||||
|
||||
(mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
|
||||
|
||||
@@ -2870,32 +2904,20 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, s
|
||||
|
||||
sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
|
||||
|
||||
sqdata.hashes = {}
|
||||
sqrq.sq_deferred = {}
|
||||
for mc in sorted(sqdata.multiconfigs):
|
||||
for tid in sorted(sqdata.sq_revdeps):
|
||||
if mc_from_tid(tid) != mc:
|
||||
continue
|
||||
if tid in sqdata.stamppresent:
|
||||
continue
|
||||
if tid in sqdata.valid:
|
||||
continue
|
||||
if tid in sqdata.noexec:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_notcovered:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_covered:
|
||||
continue
|
||||
|
||||
sqdata.outrightfail.add(tid)
|
||||
|
||||
h = pending_hash_index(tid, rqdata)
|
||||
if h not in sqdata.hashes:
|
||||
sqdata.hashes[h] = tid
|
||||
else:
|
||||
sqrq.sq_deferred[tid] = sqdata.hashes[h]
|
||||
bb.note("Deferring %s after %s" % (tid, sqdata.hashes[h]))
|
||||
|
||||
for tid in tids:
|
||||
if tid in sqdata.stamppresent:
|
||||
continue
|
||||
if tid in sqdata.valid:
|
||||
continue
|
||||
if tid in sqdata.noexec:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_covered:
|
||||
continue
|
||||
if tid in sqrq.scenequeue_notcovered:
|
||||
continue
|
||||
if tid in sqrq.sq_deferred:
|
||||
continue
|
||||
sqdata.outrightfail.add(tid)
|
||||
|
||||
class TaskFailure(Exception):
|
||||
"""
|
||||
|
||||
@@ -1570,21 +1570,22 @@ def set_process_name(name):
|
||||
|
||||
# export common proxies variables from datastore to environment
|
||||
def export_proxies(d):
|
||||
import os
|
||||
""" export common proxies variables from datastore to environment """
|
||||
|
||||
variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
|
||||
'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY',
|
||||
'GIT_PROXY_COMMAND']
|
||||
'GIT_PROXY_COMMAND', 'SSL_CERT_FILE', 'SSL_CERT_DIR']
|
||||
exported = False
|
||||
|
||||
for v in variables:
|
||||
if v in os.environ.keys():
|
||||
origenv = d.getVar("BB_ORIGENV")
|
||||
|
||||
for name in variables:
|
||||
value = d.getVar(name)
|
||||
if not value and origenv:
|
||||
value = origenv.getVar(name)
|
||||
if value:
|
||||
os.environ[name] = value
|
||||
exported = True
|
||||
else:
|
||||
v_proxy = d.getVar(v)
|
||||
if v_proxy is not None:
|
||||
os.environ[v] = v_proxy
|
||||
exported = True
|
||||
|
||||
return exported
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ extlinks = {
|
||||
'yocto_git': ('https://git.yoctoproject.org%s', None),
|
||||
'oe_home': ('https://www.openembedded.org%s', None),
|
||||
'oe_lists': ('https://lists.openembedded.org%s', None),
|
||||
'oe_git': ('https://git.openembedded.org%s', None),
|
||||
}
|
||||
|
||||
# Intersphinx config to use cross reference with Bitbake user manual
|
||||
|
||||
@@ -377,7 +377,7 @@ activities using the Yocto Project:
|
||||
Index <http://layers.openembedded.org/layerindex/layers/>`__, which
|
||||
is a website that indexes OpenEmbedded-Core layers.
|
||||
|
||||
- *Patchwork:* `Patchwork <http://jk.ozlabs.org/projects/patchwork/>`__
|
||||
- *Patchwork:* `Patchwork <https://patchwork.yoctoproject.org/>`__
|
||||
is a fork of a project originally started by
|
||||
`OzLabs <http://ozlabs.org/>`__. The project is a web-based tracking
|
||||
system designed to streamline the process of bringing contributions
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.22"
|
||||
DISTRO : "3.1.24"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.22"
|
||||
YOCTO_DOC_VERSION : "3.1.24"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.22"
|
||||
DOCCONF_VERSION : "3.1.22"
|
||||
DISTRO_REL_TAG : "yocto-3.1.24"
|
||||
DOCCONF_VERSION : "3.1.24"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.22"
|
||||
POKYVERSION : "23.0.24"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -1734,7 +1734,7 @@ events':
|
||||
|
||||
The tool is pretty self-explanatory, but for more detailed information
|
||||
on navigating through the data, see the `kernelshark
|
||||
website <http://rostedt.homelinux.com/kernelshark/>`__.
|
||||
website <https://kernelshark.org/Documentation.html>`__.
|
||||
|
||||
.. _ftrace-documentation:
|
||||
|
||||
@@ -1765,8 +1765,8 @@ There is a nice series of articles on using ftrace and trace-cmd at LWN:
|
||||
- `trace-cmd: A front-end for
|
||||
Ftrace <https://lwn.net/Articles/410200/>`__
|
||||
|
||||
There's more detailed documentation kernelshark usage here:
|
||||
`KernelShark <http://rostedt.homelinux.com/kernelshark/>`__
|
||||
See also `KernelShark's documentation <https://kernelshark.org/Documentation.html>`__
|
||||
for further usage details.
|
||||
|
||||
An amusing yet useful README (a tracing mini-HOWTO) can be found in
|
||||
``/sys/kernel/debug/tracing/README``.
|
||||
|
||||
@@ -45,6 +45,8 @@ distributions:
|
||||
|
||||
- Ubuntu 20.04
|
||||
|
||||
- Ubuntu 22.04
|
||||
|
||||
- Fedora 28
|
||||
|
||||
- Fedora 29
|
||||
@@ -61,6 +63,8 @@ distributions:
|
||||
|
||||
- Fedora 35
|
||||
|
||||
- Fedora 36
|
||||
|
||||
- CentOS 7.x
|
||||
|
||||
- Debian GNU/Linux 8.x (Jessie)
|
||||
@@ -79,6 +83,8 @@ distributions:
|
||||
|
||||
- AlmaLinux 8.5
|
||||
|
||||
- AlmaLinux 8.7
|
||||
|
||||
.. note::
|
||||
|
||||
- While the Yocto Project Team attempts to ensure all Yocto Project
|
||||
|
||||
@@ -7147,6 +7147,32 @@ system and gives an overview of their function and contents.
|
||||
:term:`SSTATE_DIR`
|
||||
The directory for the shared state cache.
|
||||
|
||||
:term:`SSTATE_EXCLUDEDEPS_SYSROOT`
|
||||
This variable allows to specify indirect dependencies to exclude
|
||||
from sysroots, for example to avoid the situations when a dependency on
|
||||
any ``-native`` recipe will pull in all dependencies of that recipe
|
||||
in the recipe sysroot. This behaviour might not always be wanted,
|
||||
for example when that ``-native`` recipe depends on build tools
|
||||
that are not relevant for the current recipe.
|
||||
|
||||
This way, irrelevant dependencies are ignored, which could have
|
||||
prevented the reuse of prebuilt artifacts stored in the Shared
|
||||
State Cache.
|
||||
|
||||
:term:`SSTATE_EXCLUDEDEPS_SYSROOT` is evaluated as two regular
|
||||
expressions of recipe and dependency to ignore. An example
|
||||
is the rule in :oe_git:`meta/conf/layer.conf </openembedded-core/tree/meta/conf/layer.conf>`::
|
||||
|
||||
# Nothing needs to depend on libc-initial
|
||||
# base-passwd/shadow-sysroot don't need their dependencies
|
||||
SSTATE_EXCLUDEDEPS_SYSROOT += "\
|
||||
.*->.*-initial.* \
|
||||
.*(base-passwd|shadow-sysroot)->.* \
|
||||
"
|
||||
|
||||
The ``->`` substring represents the dependency between
|
||||
the two regular expressions.
|
||||
|
||||
:term:`SSTATE_MIRROR_ALLOW_NETWORK`
|
||||
If set to "1", allows fetches from mirrors that are specified in
|
||||
:term:`SSTATE_MIRRORS` to work even when
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.22"
|
||||
DISTRO_VERSION = "3.1.24"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
@@ -47,12 +47,14 @@ SANITY_TESTED_DISTROS ?= " \
|
||||
ubuntu-18.04 \n \
|
||||
ubuntu-19.04 \n \
|
||||
ubuntu-20.04 \n \
|
||||
ubuntu-22.04 \n \
|
||||
fedora-30 \n \
|
||||
fedora-31 \n \
|
||||
fedora-32 \n \
|
||||
fedora-33 \n \
|
||||
fedora-34 \n \
|
||||
fedora-35 \n \
|
||||
fedora-36 \n \
|
||||
centos-7 \n \
|
||||
centos-8 \n \
|
||||
debian-8 \n \
|
||||
@@ -63,6 +65,7 @@ SANITY_TESTED_DISTROS ?= " \
|
||||
opensuseleap-15.2 \n \
|
||||
opensuseleap-15.3 \n \
|
||||
almalinux-8.5 \n \
|
||||
almalinux-8.7 \n \
|
||||
"
|
||||
# add poky sanity bbclass
|
||||
INHERIT += "poky-sanity"
|
||||
|
||||
@@ -42,8 +42,8 @@ CVE_CHECK_LOG_JSON ?= "${T}/cve.json"
|
||||
CVE_CHECK_DIR ??= "${DEPLOY_DIR}/cve"
|
||||
CVE_CHECK_RECIPE_FILE ?= "${CVE_CHECK_DIR}/${PN}"
|
||||
CVE_CHECK_RECIPE_FILE_JSON ?= "${CVE_CHECK_DIR}/${PN}_cve.json"
|
||||
CVE_CHECK_MANIFEST ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cve"
|
||||
CVE_CHECK_MANIFEST_JSON ?= "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.json"
|
||||
CVE_CHECK_MANIFEST ?= "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.cve"
|
||||
CVE_CHECK_MANIFEST_JSON ?= "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.json"
|
||||
CVE_CHECK_COPY_FILES ??= "1"
|
||||
CVE_CHECK_CREATE_MANIFEST ??= "1"
|
||||
|
||||
@@ -195,7 +195,7 @@ python cve_check_write_rootfs_manifest () {
|
||||
recipies.add(pkg_data["PN"])
|
||||
|
||||
bb.note("Writing rootfs CVE manifest")
|
||||
deploy_dir = d.getVar("DEPLOY_DIR_IMAGE")
|
||||
deploy_dir = d.getVar("IMGDEPLOYDIR")
|
||||
link_name = d.getVar("IMAGE_LINK_NAME")
|
||||
|
||||
json_data = {"version":"1", "package": []}
|
||||
|
||||
@@ -2,8 +2,6 @@ inherit terminal
|
||||
|
||||
DEVSHELL = "${SHELL}"
|
||||
|
||||
PATH:prepend:task-devshell = "${COREBASE}/scripts/git-intercept:"
|
||||
|
||||
python do_devshell () {
|
||||
if d.getVarFlag("do_devshell", "manualfakeroot"):
|
||||
d.prependVar("DEVSHELL", "pseudo ")
|
||||
|
||||
@@ -225,7 +225,7 @@ def srctree_hash_files(d, srcdir=None):
|
||||
env['GIT_INDEX_FILE'] = tmp_index.name
|
||||
subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
|
||||
git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
|
||||
if os.path.exists(os.path.join(s_dir, ".gitmodules")):
|
||||
if os.path.exists(os.path.join(s_dir, ".gitmodules")) and os.path.getsize(os.path.join(s_dir, ".gitmodules")) > 0:
|
||||
submodule_helper = subprocess.check_output(["git", "config", "--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, env=env).decode("utf-8")
|
||||
for line in submodule_helper.splitlines():
|
||||
module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1])
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
def get_rootfs_uuid(d):
|
||||
import subprocess
|
||||
rootfs = d.getVar('ROOTFS')
|
||||
output = subprocess.check_output(['tune2fs', '-l', rootfs])
|
||||
output = subprocess.check_output(['tune2fs', '-l', rootfs], text=True)
|
||||
for line in output.split('\n'):
|
||||
if line.startswith('Filesystem UUID:'):
|
||||
uuid = line.split()[-1]
|
||||
|
||||
@@ -311,7 +311,7 @@ fakeroot python do_image_qa () {
|
||||
except oe.utils.ImageQAFailed as e:
|
||||
qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
|
||||
except Exception as e:
|
||||
qamsg = qamsg + '\tImage QA function %s failed\n' % cmd
|
||||
qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (cmd, e)
|
||||
|
||||
if qamsg:
|
||||
imgname = d.getVar('IMAGE_NAME')
|
||||
@@ -437,7 +437,7 @@ python () {
|
||||
localdata.delVar('DATETIME')
|
||||
localdata.delVar('DATE')
|
||||
localdata.delVar('TMPDIR')
|
||||
vardepsexclude = (d.getVarFlag('IMAGE_CMD_' + realt, 'vardepsexclude', True) or '').split()
|
||||
vardepsexclude = (d.getVarFlag('IMAGE_CMD_' + realt, 'vardepsexclude') or '').split()
|
||||
for dep in vardepsexclude:
|
||||
localdata.delVar(dep)
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ do_kernel_metadata() {
|
||||
# SRC_URI. If they were supplied, we convert them into include directives
|
||||
# for the update part of the process
|
||||
for f in ${feat_dirs}; do
|
||||
if [ -d "${WORKDIR}/$f/meta" ]; then
|
||||
if [ -d "${WORKDIR}/$f/kernel-meta" ]; then
|
||||
includes="$includes -I${WORKDIR}/$f/kernel-meta"
|
||||
elif [ -d "${WORKDIR}/../oe-local-files/$f" ]; then
|
||||
includes="$includes -I${WORKDIR}/../oe-local-files/$f"
|
||||
|
||||
@@ -595,7 +595,7 @@ do_savedefconfig() {
|
||||
do_savedefconfig[nostamp] = "1"
|
||||
addtask savedefconfig after do_configure
|
||||
|
||||
inherit cml1
|
||||
inherit cml1 pkgconfig
|
||||
|
||||
KCONFIG_CONFIG_COMMAND_append = " LD='${KERNEL_LD}' HOSTLDFLAGS='${BUILD_LDFLAGS}'"
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ PACKAGE_NO_GCONV ?= "0"
|
||||
OVERRIDES_append = ":${TARGET_ARCH}-${TARGET_OS}"
|
||||
|
||||
locale_base_postinst_ontarget() {
|
||||
mkdir ${libdir}/locale
|
||||
localedef --inputfile=${datadir}/i18n/locales/%s --charmap=%s %s
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ def get_deployed_dependencies(d):
|
||||
deploy = {}
|
||||
# Get all the dependencies for the current task (rootfs).
|
||||
taskdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
pn = d.getVar("PN", True)
|
||||
pn = d.getVar("PN")
|
||||
depends = list(set([dep[0] for dep
|
||||
in list(taskdata.values())
|
||||
if not dep[0].endswith("-native") and not dep[0] == pn]))
|
||||
|
||||
@@ -113,3 +113,5 @@ do_packagedata[stamp-extra-info] = ""
|
||||
USE_NLS = "${SDKUSE_NLS}"
|
||||
|
||||
OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}"
|
||||
|
||||
PATH_prepend = "${COREBASE}/scripts/nativesdk-intercept:"
|
||||
|
||||
@@ -117,7 +117,7 @@ python write_host_sdk_ext_manifest () {
|
||||
f.write("%s %s %s\n" % (info[1], info[2], info[3]))
|
||||
}
|
||||
|
||||
SDK_POSTPROCESS_COMMAND_append_task-populate-sdk-ext = "write_target_sdk_ext_manifest; write_host_sdk_ext_manifest; "
|
||||
SDK_POSTPROCESS_COMMAND_append_task-populate-sdk-ext = " write_target_sdk_ext_manifest; write_host_sdk_ext_manifest; "
|
||||
|
||||
SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME') or d.getVar('DISTRO')} Extensible SDK"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ toolchain_create_sdk_env_script () {
|
||||
echo '# http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html#AEN80' >> $script
|
||||
echo '# http://xahlee.info/UnixResource_dir/_/ldpath.html' >> $script
|
||||
echo '# Only disable this check if you are absolutely know what you are doing!' >> $script
|
||||
echo 'if [ ! -z "$LD_LIBRARY_PATH" ]; then' >> $script
|
||||
echo 'if [ ! -z "${LD_LIBRARY_PATH:-}" ]; then' >> $script
|
||||
echo " echo \"Your environment is misconfigured, you probably need to 'unset LD_LIBRARY_PATH'\"" >> $script
|
||||
echo " echo \"but please check why this was set in the first place and that it's safe to unset.\"" >> $script
|
||||
echo ' echo "The SDK will not operate correctly in most cases when LD_LIBRARY_PATH is set."' >> $script
|
||||
|
||||
@@ -62,7 +62,8 @@ def get_source_date_epoch_from_git(d, sourcedir):
|
||||
return None
|
||||
|
||||
bb.debug(1, "git repository: %s" % gitpath)
|
||||
p = subprocess.run(['git', '--git-dir', gitpath, 'log', '-1', '--pretty=%ct'], check=True, stdout=subprocess.PIPE)
|
||||
p = subprocess.run(['git', '-c', 'log.showSignature=false', '--git-dir', gitpath, 'log', '-1', '--pretty=%ct'],
|
||||
check=True, stdout=subprocess.PIPE)
|
||||
return int(p.stdout.decode('utf-8'))
|
||||
|
||||
def get_source_date_epoch_from_youngest_file(d, sourcedir):
|
||||
|
||||
@@ -67,11 +67,11 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
|
||||
% self.default_target_type)
|
||||
runtime_group.add_argument('--target-ip', action='store',
|
||||
default=self.default_target_ip,
|
||||
help="IP address of device under test, default: %s" \
|
||||
help="IP address and optionally ssh port (default 22) of device under test, for example '192.168.0.7:22'. Default: %s" \
|
||||
% self.default_target_ip)
|
||||
runtime_group.add_argument('--server-ip', action='store',
|
||||
default=self.default_target_ip,
|
||||
help="IP address of device under test, default: %s" \
|
||||
help="IP address of the test host from test target machine, default: %s" \
|
||||
% self.default_server_ip)
|
||||
|
||||
runtime_group.add_argument('--host-dumper-dir', action='store',
|
||||
|
||||
@@ -75,7 +75,7 @@ class BitbakePrTests(OESelftestTestCase):
|
||||
exported_db_path = os.path.join(self.builddir, 'export.inc')
|
||||
export_result = runCmd("bitbake-prserv-tool export %s" % exported_db_path, ignore_status=True)
|
||||
self.assertEqual(export_result.status, 0, msg="PR Service database export failed: %s" % export_result.output)
|
||||
self.assertTrue(os.path.exists(exported_db_path))
|
||||
self.assertTrue(os.path.exists(exported_db_path), msg="%s didn't exist, tool output %s" % (exported_db_path, export_result.output))
|
||||
|
||||
if replace_current_db:
|
||||
current_db_path = os.path.join(get_bb_var('PERSISTENT_DIR'), 'prserv.sqlite3')
|
||||
|
||||
@@ -39,7 +39,6 @@ exclude_packages = [
|
||||
'gstreamer1.0-python',
|
||||
'hwlatdetect',
|
||||
'kernel-devsrc',
|
||||
'libaprutil',
|
||||
'libcap-ng',
|
||||
'libjson',
|
||||
'libproxy',
|
||||
|
||||
@@ -236,7 +236,7 @@ class TestImage(OESelftestTestCase):
|
||||
except FileNotFoundError:
|
||||
self.skipTest("/dev/dri directory does not exist; no render nodes available on this machine.")
|
||||
try:
|
||||
dripath = subprocess.check_output("pkg-config --variable=dridriverdir dri", shell=True)
|
||||
dripath = subprocess.check_output("PATH=/bin:/usr/bin:$PATH pkg-config --variable=dridriverdir dri", shell=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.skipTest("Could not determine the path to dri drivers on the host via pkg-config.\nPlease install Mesa development files (particularly, dri.pc) on the host machine.")
|
||||
qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
|
||||
|
||||
@@ -432,10 +432,13 @@ class QemuRunner:
|
||||
except OSError as e:
|
||||
if e.errno != errno.ESRCH:
|
||||
raise
|
||||
endtime = time.time() + self.runqemutime
|
||||
while self.runqemu.poll() is None and time.time() < endtime:
|
||||
time.sleep(1)
|
||||
if self.runqemu.poll() is None:
|
||||
try:
|
||||
outs, errs = self.runqemu.communicate(timeout = self.runqemutime)
|
||||
if outs:
|
||||
self.logger.info("Output from runqemu:\n%s", outs.decode("utf-8"))
|
||||
if errs:
|
||||
self.logger.info("Stderr from runqemu:\n%s", errs.decode("utf-8"))
|
||||
except TimeoutExpired:
|
||||
self.logger.debug("Sending SIGKILL to runqemu")
|
||||
os.killpg(os.getpgid(self.runqemu.pid), signal.SIGKILL)
|
||||
if not self.runqemu.stdout.closed:
|
||||
|
||||
@@ -6,6 +6,13 @@ SRC_URI[sha256sum] = "8863717113c4897e2ad3271fc808ea245319e6fd95eed2e934fae8e089
|
||||
# These issues have kernel fixes rather than bluez fixes so exclude here
|
||||
CVE_CHECK_WHITELIST += "CVE-2020-12352 CVE-2020-24490"
|
||||
|
||||
# Commit 7a80d2096f1b7125085e21448112aa02f49f5e9a, e2b0f0d8d63e1223bb714a9efb37e2257818268b
|
||||
# and 0388794dc5fdb73a4ea88bcf148de0a12b4364d4 to fix CVE-2022-39177
|
||||
# already backport in CVE-2022-39176.patch
|
||||
# https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/1977968
|
||||
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-39177"
|
||||
|
||||
# noinst programs in Makefile.tools that are conditional on READLINE
|
||||
# support
|
||||
NOINST_TOOLS_READLINE ?= " \
|
||||
|
||||
@@ -24,7 +24,7 @@ SRC_URI_append_class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa"
|
||||
SRC_URI[sha256sum] = "8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -139,6 +139,10 @@ do_configure () {
|
||||
do_prepare_config
|
||||
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
|
||||
cml1_do_configure
|
||||
|
||||
# Save a copy of .config and autoconf.h.
|
||||
cp .config .config.orig
|
||||
cp include/autoconf.h include/autoconf.h.orig
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
@@ -146,13 +150,17 @@ do_compile() {
|
||||
if [ "${BUILD_REPRODUCIBLE_BINARIES}" = "1" ]; then
|
||||
export KCONFIG_NOTIMESTAMP=1
|
||||
fi
|
||||
|
||||
# Ensure we start do_compile with the original .config and autoconf.h.
|
||||
# These files should always have matching timestamps.
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
|
||||
if [ "${BUSYBOX_SPLIT_SUID}" = "1" -a x`grep "CONFIG_FEATURE_INDIVIDUAL=y" .config` = x ]; then
|
||||
# Guard againt interrupted do_compile: clean temporary files.
|
||||
rm -f .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
|
||||
# split the .config into two parts, and make two busybox binaries
|
||||
if [ -e .config.orig ]; then
|
||||
# Need to guard again an interrupted do_compile - restore any backup
|
||||
cp .config.orig .config
|
||||
fi
|
||||
cp .config .config.orig
|
||||
oe_runmake busybox.cfg.suid
|
||||
oe_runmake busybox.cfg.nosuid
|
||||
|
||||
@@ -189,15 +197,18 @@ do_compile() {
|
||||
bbfatal "busybox suid binary incorrectly provides /bin/sh"
|
||||
fi
|
||||
|
||||
# copy .config.orig back to .config, because the install process may check this file
|
||||
cp .config.orig .config
|
||||
# cleanup
|
||||
rm .config.orig .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
rm .config.app.suid .config.app.nosuid .config.disable.apps .config.nonapps
|
||||
else
|
||||
oe_runmake busybox_unstripped
|
||||
cp busybox_unstripped busybox
|
||||
oe_runmake busybox.links
|
||||
fi
|
||||
|
||||
# restore original .config and autoconf.h, because the install process
|
||||
# may check these files
|
||||
cp .config.orig .config
|
||||
cp include/autoconf.h.orig include/autoconf.h
|
||||
}
|
||||
|
||||
do_install () {
|
||||
|
||||
82
meta/recipes-core/glibc/glibc/CVE-2023-0687.patch
Normal file
82
meta/recipes-core/glibc/glibc/CVE-2023-0687.patch
Normal file
@@ -0,0 +1,82 @@
|
||||
From 952aff5c00ad7c6b83c3f310f2643939538827f8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?=
|
||||
=?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= <leo@yuriev.ru>
|
||||
Date: Sat, 4 Feb 2023 14:41:38 +0300
|
||||
Subject: [PATCH] gmon: Fix allocated buffer overflow (bug 29444)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `__monstartup()` allocates a buffer used to store all the data
|
||||
accumulated by the monitor.
|
||||
|
||||
The size of this buffer depends on the size of the internal structures
|
||||
used and the address range for which the monitor is activated, as well
|
||||
as on the maximum density of call instructions and/or callable functions
|
||||
that could be potentially on a segment of executable code.
|
||||
|
||||
In particular a hash table of arcs is placed at the end of this buffer.
|
||||
The size of this hash table is calculated in bytes as
|
||||
p->fromssize = p->textsize / HASHFRACTION;
|
||||
|
||||
but actually should be
|
||||
p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
|
||||
This results in writing beyond the end of the allocated buffer when an
|
||||
added arc corresponds to a call near from the end of the monitored
|
||||
address range, since `_mcount()` check the incoming caller address for
|
||||
monitored range but not the intermediate result hash-like index that
|
||||
uses to write into the table.
|
||||
|
||||
It should be noted that when the results are output to `gmon.out`, the
|
||||
table is read to the last element calculated from the allocated size in
|
||||
bytes, so the arcs stored outside the buffer boundary did not fall into
|
||||
`gprof` for analysis. Thus this "feature" help me to found this bug
|
||||
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
|
||||
|
||||
Just in case, I will explicitly note that the problem breaks the
|
||||
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
|
||||
There, the arc of the `f3()` call disappears from the output, since in
|
||||
the DSO case, the call to `f3` is located close to the end of the
|
||||
monitored range.
|
||||
|
||||
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
|
||||
|
||||
Another minor error seems a related typo in the calculation of
|
||||
`kcountsize`, but since kcounts are smaller than froms, this is
|
||||
actually to align the p->froms data.
|
||||
|
||||
Co-authored-by: DJ Delorie <dj@redhat.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=801af9fafd4689337ebf27260aa115335a0cb2bc]
|
||||
CVE: CVE-2023-0687
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
gmon/gmon.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gmon/gmon.c b/gmon/gmon.c
|
||||
index dee6480..bf76358 100644
|
||||
--- a/gmon/gmon.c
|
||||
+++ b/gmon/gmon.c
|
||||
@@ -132,6 +132,8 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->textsize = p->highpc - p->lowpc;
|
||||
+ /* This looks like a typo, but it's here to align the p->froms
|
||||
+ section. */
|
||||
p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
|
||||
p->hashfraction = HASHFRACTION;
|
||||
p->log_hashfraction = -1;
|
||||
@@ -142,7 +144,7 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
instead of integer division. Precompute shift amount. */
|
||||
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
|
||||
}
|
||||
- p->fromssize = p->textsize / HASHFRACTION;
|
||||
+ p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
p->tolimit = p->textsize * ARCDENSITY / 100;
|
||||
if (p->tolimit < MINARCS)
|
||||
p->tolimit = MINARCS;
|
||||
--
|
||||
2.7.4
|
||||
@@ -79,6 +79,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
|
||||
file://0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \
|
||||
file://0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \
|
||||
file://0037-Avoid-deadlock-between-pthread_create-and-ctors.patch \
|
||||
file://CVE-2023-0687.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
B = "${WORKDIR}/build-${TARGET_SYS}"
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "f1292a552f33a329ff27bbdea4c90250908d6301"
|
||||
SRCREV ?= "9fbfbf002e210dbdb2a4b9f3adf8012f245cf38f"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
@@ -19,6 +19,9 @@ CVE_DB_UPDATE_INTERVAL ?= "86400"
|
||||
|
||||
# Timeout for blocking socket operations, such as the connection attempt.
|
||||
CVE_SOCKET_TIMEOUT ?= "60"
|
||||
NVDCVE_URL ?= "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-"
|
||||
|
||||
CVE_DB_TEMP_FILE ?= "${CVE_CHECK_DB_DIR}/temp_nvdcve_1.1.db"
|
||||
|
||||
python () {
|
||||
if not bb.data.inherits_class("cve-check", d):
|
||||
@@ -31,26 +34,15 @@ python do_fetch() {
|
||||
"""
|
||||
import bb.utils
|
||||
import bb.progress
|
||||
import sqlite3, urllib, urllib.parse, shutil, gzip
|
||||
from datetime import date
|
||||
import shutil
|
||||
|
||||
bb.utils.export_proxies(d)
|
||||
|
||||
BASE_URL = "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-"
|
||||
YEAR_START = 2002
|
||||
|
||||
db_file = d.getVar("CVE_CHECK_DB_FILE")
|
||||
db_dir = os.path.dirname(db_file)
|
||||
db_tmp_file = d.getVar("CVE_DB_TEMP_FILE")
|
||||
|
||||
cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT"))
|
||||
|
||||
if os.path.exists("{0}-journal".format(db_file)):
|
||||
# If a journal is present the last update might have been interrupted. In that case,
|
||||
# just wipe any leftovers and force the DB to be recreated.
|
||||
os.remove("{0}-journal".format(db_file))
|
||||
|
||||
if os.path.exists(db_file):
|
||||
os.remove(db_file)
|
||||
cleanup_db_download(db_file, db_tmp_file)
|
||||
|
||||
# The NVD database changes once a day, so no need to update more frequently
|
||||
# Allow the user to force-update
|
||||
@@ -67,16 +59,68 @@ python do_fetch() {
|
||||
pass
|
||||
|
||||
bb.utils.mkdirhier(db_dir)
|
||||
if os.path.exists(db_file):
|
||||
shutil.copy2(db_file, db_tmp_file)
|
||||
|
||||
if update_db_file(db_tmp_file, d) == True:
|
||||
# Update downloaded correctly, can swap files
|
||||
shutil.move(db_tmp_file, db_file)
|
||||
else:
|
||||
# Update failed, do not modify the database
|
||||
bb.note("CVE database update failed")
|
||||
os.remove(db_tmp_file)
|
||||
}
|
||||
|
||||
do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
|
||||
do_fetch[file-checksums] = ""
|
||||
do_fetch[vardeps] = ""
|
||||
|
||||
def cleanup_db_download(db_file, db_tmp_file):
|
||||
"""
|
||||
Cleanup the download space from possible failed downloads
|
||||
"""
|
||||
|
||||
# Clean up the updates done on the main file
|
||||
# Remove it only if a journal file exists - it means a complete re-download
|
||||
if os.path.exists("{0}-journal".format(db_file)):
|
||||
# If a journal is present the last update might have been interrupted. In that case,
|
||||
# just wipe any leftovers and force the DB to be recreated.
|
||||
os.remove("{0}-journal".format(db_file))
|
||||
|
||||
if os.path.exists(db_file):
|
||||
os.remove(db_file)
|
||||
|
||||
# Clean-up the temporary file downloads, we can remove both journal
|
||||
# and the temporary database
|
||||
if os.path.exists("{0}-journal".format(db_tmp_file)):
|
||||
# If a journal is present the last update might have been interrupted. In that case,
|
||||
# just wipe any leftovers and force the DB to be recreated.
|
||||
os.remove("{0}-journal".format(db_tmp_file))
|
||||
|
||||
if os.path.exists(db_tmp_file):
|
||||
os.remove(db_tmp_file)
|
||||
|
||||
def update_db_file(db_tmp_file, d):
|
||||
"""
|
||||
Update the given database file
|
||||
"""
|
||||
import bb.utils, bb.progress
|
||||
from datetime import date
|
||||
import urllib, gzip, sqlite3
|
||||
|
||||
YEAR_START = 2002
|
||||
cve_socket_timeout = int(d.getVar("CVE_SOCKET_TIMEOUT"))
|
||||
|
||||
# Connect to database
|
||||
conn = sqlite3.connect(db_file)
|
||||
conn = sqlite3.connect(db_tmp_file)
|
||||
initialize_db(conn)
|
||||
|
||||
with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
|
||||
total_years = date.today().year + 1 - YEAR_START
|
||||
for i, year in enumerate(range(YEAR_START, date.today().year + 1)):
|
||||
bb.debug(2, "Updating %d" % year)
|
||||
ph.update((float(i + 1) / total_years) * 100)
|
||||
year_url = BASE_URL + str(year)
|
||||
year_url = (d.getVar('NVDCVE_URL')) + str(year)
|
||||
meta_url = year_url + ".meta"
|
||||
json_url = year_url + ".json.gz"
|
||||
|
||||
@@ -85,8 +129,11 @@ python do_fetch() {
|
||||
response = urllib.request.urlopen(meta_url, timeout=cve_socket_timeout)
|
||||
except urllib.error.URLError as e:
|
||||
cve_f.write('Warning: CVE db update error, Unable to fetch CVE data.\n\n')
|
||||
bb.warn("Failed to fetch CVE data (%s)" % e.reason)
|
||||
return
|
||||
bb.warn("Failed to fetch CVE data (%s)" % e)
|
||||
import socket
|
||||
result = socket.getaddrinfo("nvd.nist.gov", 443, proto=socket.IPPROTO_TCP)
|
||||
bb.warn("Host IPs are %s" % (", ".join(t[4][0] for t in result)))
|
||||
return False
|
||||
|
||||
if response:
|
||||
for l in response.read().decode("utf-8").splitlines():
|
||||
@@ -96,7 +143,7 @@ python do_fetch() {
|
||||
break
|
||||
else:
|
||||
bb.warn("Cannot parse CVE metadata, update failed")
|
||||
return
|
||||
return False
|
||||
|
||||
# Compare with current db last modified date
|
||||
cursor = conn.execute("select DATE from META where YEAR = ?", (year,))
|
||||
@@ -104,6 +151,7 @@ python do_fetch() {
|
||||
cursor.close()
|
||||
|
||||
if not meta or meta[0] != last_modified:
|
||||
bb.debug(2, "Updating entries")
|
||||
# Clear products table entries corresponding to current year
|
||||
conn.execute("delete from PRODUCTS where ID like ?", ('CVE-%d%%' % year,)).close()
|
||||
|
||||
@@ -116,19 +164,16 @@ python do_fetch() {
|
||||
except urllib.error.URLError as e:
|
||||
cve_f.write('Warning: CVE db update error, CVE data is outdated.\n\n')
|
||||
bb.warn("Cannot parse CVE data (%s), update failed" % e.reason)
|
||||
return
|
||||
|
||||
return False
|
||||
else:
|
||||
bb.debug(2, "Already up to date (last modified %s)" % last_modified)
|
||||
# Update success, set the date to cve_check file.
|
||||
if year == date.today().year:
|
||||
cve_f.write('CVE database update : %s\n\n' % date.today())
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
}
|
||||
|
||||
do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}"
|
||||
do_fetch[file-checksums] = ""
|
||||
do_fetch[vardeps] = ""
|
||||
return True
|
||||
|
||||
def initialize_db(conn):
|
||||
with conn:
|
||||
|
||||
@@ -404,9 +404,9 @@ FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
|
||||
${rootlibexecdir}/systemd/systemd-binfmt \
|
||||
${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \
|
||||
${systemd_unitdir}/system/systemd-binfmt.service"
|
||||
RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc"
|
||||
RRECOMMENDS_${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}"
|
||||
|
||||
RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps"
|
||||
RRECOMMENDS_${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}"
|
||||
|
||||
|
||||
FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
|
||||
|
||||
@@ -69,6 +69,7 @@ SRC_URI = "\
|
||||
file://0037-CVE-2019-14250-Check-zero-value-in-simple_object_elf.patch \
|
||||
file://0038-gentypes-genmodes-Do-not-use-__LINE__-for-maintainin.patch \
|
||||
file://0039-process_alt_operands-Don-t-match-user-defined-regs-o.patch \
|
||||
file://0002-libstdc-Fix-inconsistent-noexcept-specific-for-valar.patch \
|
||||
"
|
||||
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
|
||||
SRC_URI[sha256sum] = "27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f"
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
From 60d966708d7cf105dccf128d2b7a38b0b2580a1a Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Wakely <jwakely@redhat.com>
|
||||
Date: Fri, 5 Nov 2021 21:42:20 +0000
|
||||
Subject: [PATCH] libstdc++: Fix inconsistent noexcept-specific for valarray
|
||||
begin/end
|
||||
|
||||
These declarations should be noexcept after I added it to the
|
||||
definitions in <valarray>.
|
||||
|
||||
libstdc++-v3/ChangeLog:
|
||||
|
||||
* include/bits/range_access.h (begin(valarray), end(valarray)):
|
||||
Add noexcept.
|
||||
|
||||
(cherry picked from commit 2b2d97fc545635a0f6aa9c9ee3b017394bc494bf)
|
||||
|
||||
Upstream-Status: Backport [https://github.com/hkaelber/gcc/commit/2b2d97fc545635a0f6aa9c9ee3b017394bc494bf]
|
||||
Signed-off-by: Virendra Thakur <virendrak@kpit.com>
|
||||
|
||||
---
|
||||
libstdc++-v3/include/bits/range_access.h | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h
|
||||
index 3d99ea92027..4736e75fda1 100644
|
||||
--- a/libstdc++-v3/include/bits/range_access.h
|
||||
+++ b/libstdc++-v3/include/bits/range_access.h
|
||||
@@ -101,10 +101,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
|
||||
template<typename _Tp> class valarray;
|
||||
// These overloads must be declared for cbegin and cend to use them.
|
||||
- template<typename _Tp> _Tp* begin(valarray<_Tp>&);
|
||||
- template<typename _Tp> const _Tp* begin(const valarray<_Tp>&);
|
||||
- template<typename _Tp> _Tp* end(valarray<_Tp>&);
|
||||
- template<typename _Tp> const _Tp* end(const valarray<_Tp>&);
|
||||
+ template<typename _Tp> _Tp* begin(valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
|
||||
+ template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
|
||||
|
||||
/**
|
||||
* @brief Return an iterator pointing to the first element of
|
||||
--
|
||||
2.25.1
|
||||
367
meta/recipes-devtools/git/files/CVE-2022-23521.patch
Normal file
367
meta/recipes-devtools/git/files/CVE-2022-23521.patch
Normal file
@@ -0,0 +1,367 @@
|
||||
From eb22e7dfa23da6bd9aed9bd1dad69e1e8e167d24 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:45:15 +0100
|
||||
Subject: [PATCH] CVE-2022-23521
|
||||
|
||||
attr: fix overflow when upserting attribute with overly long name
|
||||
|
||||
The function `git_attr_internal()` is called to upsert attributes into
|
||||
the global map. And while all callers pass a `size_t`, the function
|
||||
itself accepts an `int` as the attribute name's length. This can lead to
|
||||
an integer overflow in case the attribute name is longer than `INT_MAX`.
|
||||
|
||||
Now this overflow seems harmless as the first thing we do is to call
|
||||
`attr_name_valid()`, and that function only succeeds in case all chars
|
||||
in the range of `namelen` match a certain small set of chars. We thus
|
||||
can't do an out-of-bounds read as NUL is not part of that set and all
|
||||
strings passed to this function are NUL-terminated. And furthermore, we
|
||||
wouldn't ever read past the current attribute name anyway due to the
|
||||
same reason. And if validation fails we will return early.
|
||||
|
||||
On the other hand it feels fragile to rely on this behaviour, even more
|
||||
so given that we pass `namelen` to `FLEX_ALLOC_MEM()`. So let's instead
|
||||
just do the correct thing here and accept a `size_t` as line length.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/eb22e7dfa23da6bd9aed9bd1dad69e1e8e167d24 &https://github.com/git/git/commit/8d0d48cf2157cfb914db1f53b3fe40785b86f3aa & https://github.com/git/git/commit/24557209500e6ed618f04a8795a111a0c491a29c & https://github.com/git/git/commit/34ace8bad02bb14ecc5b631f7e3daaa7a9bba7d9 & https://github.com/git/git/commit/447ac906e189535e77dcb1f4bbe3f1bc917d4c12 & https://github.com/git/git/commit/e1e12e97ac73ded85f7d000da1063a774b3cc14f & https://github.com/git/git/commit/a60a66e409c265b2944f18bf43581c146812586d & https://github.com/git/git/commit/d74b1fd54fdbc45966d12ea907dece11e072fb2b & https://github.com/git/git/commit/dfa6b32b5e599d97448337ed4fc18dd50c90758f & https://github.com/git/git/commit/3c50032ff5289cc45659f21949c8d09e52164579
|
||||
|
||||
CVE: CVE-2022-23521
|
||||
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
attr.c | 97 +++++++++++++++++++++++++++----------------
|
||||
attr.h | 12 ++++++
|
||||
t/t0003-attributes.sh | 59 ++++++++++++++++++++++++++
|
||||
3 files changed, 132 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/attr.c b/attr.c
|
||||
index 11f19b5..63484ab 100644
|
||||
--- a/attr.c
|
||||
+++ b/attr.c
|
||||
@@ -29,7 +29,7 @@ static const char git_attr__unknown[] = "(builtin)unknown";
|
||||
#endif
|
||||
|
||||
struct git_attr {
|
||||
- int attr_nr; /* unique attribute number */
|
||||
+ unsigned int attr_nr; /* unique attribute number */
|
||||
char name[FLEX_ARRAY]; /* attribute name */
|
||||
};
|
||||
|
||||
@@ -221,7 +221,7 @@ static void report_invalid_attr(const char *name, size_t len,
|
||||
* dictionary. If no entry is found, create a new attribute and store it in
|
||||
* the dictionary.
|
||||
*/
|
||||
-static const struct git_attr *git_attr_internal(const char *name, int namelen)
|
||||
+static const struct git_attr *git_attr_internal(const char *name, size_t namelen)
|
||||
{
|
||||
struct git_attr *a;
|
||||
|
||||
@@ -237,8 +237,8 @@ static const struct git_attr *git_attr_internal(const char *name, int namelen)
|
||||
a->attr_nr = hashmap_get_size(&g_attr_hashmap.map);
|
||||
|
||||
attr_hashmap_add(&g_attr_hashmap, a->name, namelen, a);
|
||||
- assert(a->attr_nr ==
|
||||
- (hashmap_get_size(&g_attr_hashmap.map) - 1));
|
||||
+ if (a->attr_nr != hashmap_get_size(&g_attr_hashmap.map) - 1)
|
||||
+ die(_("unable to add additional attribute"));
|
||||
}
|
||||
|
||||
hashmap_unlock(&g_attr_hashmap);
|
||||
@@ -283,7 +283,7 @@ struct match_attr {
|
||||
const struct git_attr *attr;
|
||||
} u;
|
||||
char is_macro;
|
||||
- unsigned num_attr;
|
||||
+ size_t num_attr;
|
||||
struct attr_state state[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
@@ -300,7 +300,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
|
||||
struct attr_state *e)
|
||||
{
|
||||
const char *ep, *equals;
|
||||
- int len;
|
||||
+ size_t len;
|
||||
|
||||
ep = cp + strcspn(cp, blank);
|
||||
equals = strchr(cp, '=');
|
||||
@@ -344,8 +344,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
|
||||
static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
int lineno, int macro_ok)
|
||||
{
|
||||
- int namelen;
|
||||
- int num_attr, i;
|
||||
+ size_t namelen, num_attr, i;
|
||||
const char *cp, *name, *states;
|
||||
struct match_attr *res = NULL;
|
||||
int is_macro;
|
||||
@@ -356,6 +355,11 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
return NULL;
|
||||
name = cp;
|
||||
|
||||
+ if (strlen(line) >= ATTR_MAX_LINE_LENGTH) {
|
||||
+ warning(_("ignoring overly long attributes line %d"), lineno);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
if (*cp == '"' && !unquote_c_style(&pattern, name, &states)) {
|
||||
name = pattern.buf;
|
||||
namelen = pattern.len;
|
||||
@@ -392,10 +396,9 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
|
||||
goto fail_return;
|
||||
}
|
||||
|
||||
- res = xcalloc(1,
|
||||
- sizeof(*res) +
|
||||
- sizeof(struct attr_state) * num_attr +
|
||||
- (is_macro ? 0 : namelen + 1));
|
||||
+ res = xcalloc(1, st_add3(sizeof(*res),
|
||||
+ st_mult(sizeof(struct attr_state), num_attr),
|
||||
+ is_macro ? 0 : namelen + 1));
|
||||
if (is_macro) {
|
||||
res->u.attr = git_attr_internal(name, namelen);
|
||||
} else {
|
||||
@@ -458,11 +461,12 @@ struct attr_stack {
|
||||
|
||||
static void attr_stack_free(struct attr_stack *e)
|
||||
{
|
||||
- int i;
|
||||
+ unsigned i;
|
||||
free(e->origin);
|
||||
for (i = 0; i < e->num_matches; i++) {
|
||||
struct match_attr *a = e->attrs[i];
|
||||
- int j;
|
||||
+ size_t j;
|
||||
+
|
||||
for (j = 0; j < a->num_attr; j++) {
|
||||
const char *setto = a->state[j].setto;
|
||||
if (setto == ATTR__TRUE ||
|
||||
@@ -671,8 +675,8 @@ static void handle_attr_line(struct attr_stack *res,
|
||||
a = parse_attr_line(line, src, lineno, macro_ok);
|
||||
if (!a)
|
||||
return;
|
||||
- ALLOC_GROW(res->attrs, res->num_matches + 1, res->alloc);
|
||||
- res->attrs[res->num_matches++] = a;
|
||||
+ ALLOC_GROW_BY(res->attrs, res->num_matches, 1, res->alloc);
|
||||
+ res->attrs[res->num_matches - 1] = a;
|
||||
}
|
||||
|
||||
static struct attr_stack *read_attr_from_array(const char **list)
|
||||
@@ -711,21 +715,37 @@ void git_attr_set_direction(enum git_attr_direction new_direction)
|
||||
|
||||
static struct attr_stack *read_attr_from_file(const char *path, int macro_ok)
|
||||
{
|
||||
+ struct strbuf buf = STRBUF_INIT;
|
||||
FILE *fp = fopen_or_warn(path, "r");
|
||||
struct attr_stack *res;
|
||||
- char buf[2048];
|
||||
int lineno = 0;
|
||||
+ int fd;
|
||||
+ struct stat st;
|
||||
|
||||
if (!fp)
|
||||
return NULL;
|
||||
- res = xcalloc(1, sizeof(*res));
|
||||
- while (fgets(buf, sizeof(buf), fp)) {
|
||||
- char *bufp = buf;
|
||||
- if (!lineno)
|
||||
- skip_utf8_bom(&bufp, strlen(bufp));
|
||||
- handle_attr_line(res, bufp, path, ++lineno, macro_ok);
|
||||
+
|
||||
+ fd = fileno(fp);
|
||||
+ if (fstat(fd, &st)) {
|
||||
+ warning_errno(_("cannot fstat gitattributes file '%s'"), path);
|
||||
+ fclose(fp);
|
||||
+ return NULL;
|
||||
}
|
||||
+ if (st.st_size >= ATTR_MAX_FILE_SIZE) {
|
||||
+ warning(_("ignoring overly large gitattributes file '%s'"), path);
|
||||
+ fclose(fp);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ CALLOC_ARRAY(res, 1);
|
||||
+ while (strbuf_getline(&buf, fp) != EOF) {
|
||||
+ if (!lineno && starts_with(buf.buf, utf8_bom))
|
||||
+ strbuf_remove(&buf, 0, strlen(utf8_bom));
|
||||
+ handle_attr_line(res, buf.buf, path, ++lineno, macro_ok);
|
||||
+ }
|
||||
+
|
||||
fclose(fp);
|
||||
+ strbuf_release(&buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -736,13 +756,18 @@ static struct attr_stack *read_attr_from_index(const struct index_state *istate,
|
||||
struct attr_stack *res;
|
||||
char *buf, *sp;
|
||||
int lineno = 0;
|
||||
+ size_t size;
|
||||
|
||||
if (!istate)
|
||||
return NULL;
|
||||
|
||||
- buf = read_blob_data_from_index(istate, path, NULL);
|
||||
+ buf = read_blob_data_from_index(istate, path, &size);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
+ if (size >= ATTR_MAX_FILE_SIZE) {
|
||||
+ warning(_("ignoring overly large gitattributes blob '%s'"), path);
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
res = xcalloc(1, sizeof(*res));
|
||||
for (sp = buf; *sp; ) {
|
||||
@@ -1012,12 +1037,12 @@ static int macroexpand_one(struct all_attrs_item *all_attrs, int nr, int rem);
|
||||
static int fill_one(const char *what, struct all_attrs_item *all_attrs,
|
||||
const struct match_attr *a, int rem)
|
||||
{
|
||||
- int i;
|
||||
+ size_t i;
|
||||
|
||||
- for (i = a->num_attr - 1; rem > 0 && i >= 0; i--) {
|
||||
- const struct git_attr *attr = a->state[i].attr;
|
||||
+ for (i = a->num_attr; rem > 0 && i > 0; i--) {
|
||||
+ const struct git_attr *attr = a->state[i - 1].attr;
|
||||
const char **n = &(all_attrs[attr->attr_nr].value);
|
||||
- const char *v = a->state[i].setto;
|
||||
+ const char *v = a->state[i - 1].setto;
|
||||
|
||||
if (*n == ATTR__UNKNOWN) {
|
||||
debug_set(what,
|
||||
@@ -1036,11 +1061,11 @@ static int fill(const char *path, int pathlen, int basename_offset,
|
||||
struct all_attrs_item *all_attrs, int rem)
|
||||
{
|
||||
for (; rem > 0 && stack; stack = stack->prev) {
|
||||
- int i;
|
||||
+ unsigned i;
|
||||
const char *base = stack->origin ? stack->origin : "";
|
||||
|
||||
- for (i = stack->num_matches - 1; 0 < rem && 0 <= i; i--) {
|
||||
- const struct match_attr *a = stack->attrs[i];
|
||||
+ for (i = stack->num_matches; 0 < rem && 0 < i; i--) {
|
||||
+ const struct match_attr *a = stack->attrs[i - 1];
|
||||
if (a->is_macro)
|
||||
continue;
|
||||
if (path_matches(path, pathlen, basename_offset,
|
||||
@@ -1071,11 +1096,11 @@ static void determine_macros(struct all_attrs_item *all_attrs,
|
||||
const struct attr_stack *stack)
|
||||
{
|
||||
for (; stack; stack = stack->prev) {
|
||||
- int i;
|
||||
- for (i = stack->num_matches - 1; i >= 0; i--) {
|
||||
- const struct match_attr *ma = stack->attrs[i];
|
||||
+ unsigned i;
|
||||
+ for (i = stack->num_matches; i > 0; i--) {
|
||||
+ const struct match_attr *ma = stack->attrs[i - 1];
|
||||
if (ma->is_macro) {
|
||||
- int n = ma->u.attr->attr_nr;
|
||||
+ unsigned int n = ma->u.attr->attr_nr;
|
||||
if (!all_attrs[n].macro) {
|
||||
all_attrs[n].macro = ma;
|
||||
}
|
||||
@@ -1127,7 +1152,7 @@ void git_check_attr(const struct index_state *istate,
|
||||
collect_some_attrs(istate, path, check);
|
||||
|
||||
for (i = 0; i < check->nr; i++) {
|
||||
- size_t n = check->items[i].attr->attr_nr;
|
||||
+ unsigned int n = check->items[i].attr->attr_nr;
|
||||
const char *value = check->all_attrs[n].value;
|
||||
if (value == ATTR__UNKNOWN)
|
||||
value = ATTR__UNSET;
|
||||
diff --git a/attr.h b/attr.h
|
||||
index b0378bf..f424285 100644
|
||||
--- a/attr.h
|
||||
+++ b/attr.h
|
||||
@@ -1,6 +1,18 @@
|
||||
#ifndef ATTR_H
|
||||
#define ATTR_H
|
||||
|
||||
+/**
|
||||
+ * The maximum line length for a gitattributes file. If the line exceeds this
|
||||
+ * length we will ignore it.
|
||||
+ */
|
||||
+#define ATTR_MAX_LINE_LENGTH 2048
|
||||
+
|
||||
+ /**
|
||||
+ * The maximum size of the giattributes file. If the file exceeds this size we
|
||||
+ * will ignore it.
|
||||
+ */
|
||||
+#define ATTR_MAX_FILE_SIZE (100 * 1024 * 1024)
|
||||
+
|
||||
struct index_state;
|
||||
|
||||
/* An attribute is a pointer to this opaque structure */
|
||||
diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
|
||||
index 71e63d8..556245b 100755
|
||||
--- a/t/t0003-attributes.sh
|
||||
+++ b/t/t0003-attributes.sh
|
||||
@@ -342,4 +342,63 @@ test_expect_success 'query binary macro directly' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'large attributes line ignored in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ printf "path %02043d" 1 >.gitattributes &&
|
||||
+ git check-attr --all path >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignores trailing content in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ # older versions of Git broke lines at 2048 bytes; the 2045 bytes
|
||||
+ # of 0-padding here is accounting for the three bytes of "a 1", which
|
||||
+ # would knock "trailing" to the "next" line, where it would be
|
||||
+ # erroneously parsed.
|
||||
+ printf "a %02045dtrailing attribute\n" 1 >.gitattributes &&
|
||||
+ git check-attr --all trailing >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE 'large attributes file ignored in tree' '
|
||||
+ test_when_finished "rm .gitattributes" &&
|
||||
+ dd if=/dev/zero of=.gitattributes bs=101M count=1 2>/dev/null &&
|
||||
+ git check-attr --all path >/dev/null 2>err &&
|
||||
+ echo "warning: ignoring overly large gitattributes file ${SQ}.gitattributes${SQ}" >expect &&
|
||||
+ test_cmp expect err
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignored in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(printf "path %02043d" 1 | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all path >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'large attributes line ignores trailing content in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(printf "a %02045dtrailing attribute\n" 1 | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all trailing >actual 2>err &&
|
||||
+ echo "warning: ignoring overly long attributes line 1" >expect &&
|
||||
+ test_cmp expect err &&
|
||||
+ test_must_be_empty actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE 'large attributes file ignored in index' '
|
||||
+ test_when_finished "git update-index --remove .gitattributes" &&
|
||||
+ blob=$(dd if=/dev/zero bs=101M count=1 2>/dev/null | git hash-object -w --stdin) &&
|
||||
+ git update-index --add --cacheinfo 100644,$blob,.gitattributes &&
|
||||
+ git check-attr --cached --all path >/dev/null 2>err &&
|
||||
+ echo "warning: ignoring overly large gitattributes blob ${SQ}.gitattributes${SQ}" >expect &&
|
||||
+ test_cmp expect err
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
39
meta/recipes-devtools/git/files/CVE-2022-41903-01.patch
Normal file
39
meta/recipes-devtools/git/files/CVE-2022-41903-01.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From a244dc5b0a629290881641467c7a545de7508ab2 Mon Sep 17 00:00:00 2001
|
||||
From: Carlo Marcelo Arenas Belón <carenas@gmail.com>
|
||||
Date: Tue, 2 Nov 2021 15:46:06 +0000
|
||||
Subject: [PATCH 01/12] test-lib: add prerequisite for 64-bit platforms
|
||||
|
||||
Allow tests that assume a 64-bit `size_t` to be skipped in 32-bit
|
||||
platforms and regardless of the size of `long`.
|
||||
|
||||
This imitates the `LONG_IS_64BIT` prerequisite.
|
||||
|
||||
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/a244dc5b0a629290881641467c7a545de7508ab2]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/test-lib.sh | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/t/test-lib.sh b/t/test-lib.sh
|
||||
index e06fa02..db5ec2f 100644
|
||||
--- a/t/test-lib.sh
|
||||
+++ b/t/test-lib.sh
|
||||
@@ -1613,6 +1613,10 @@ build_option () {
|
||||
sed -ne "s/^$1: //p"
|
||||
}
|
||||
|
||||
+test_lazy_prereq SIZE_T_IS_64BIT '
|
||||
+ test 8 -eq "$(build_option sizeof-size_t)"
|
||||
+'
|
||||
+
|
||||
test_lazy_prereq LONG_IS_64BIT '
|
||||
test 8 -le "$(build_option sizeof-long)"
|
||||
'
|
||||
--
|
||||
2.25.1
|
||||
|
||||
187
meta/recipes-devtools/git/files/CVE-2022-41903-02.patch
Normal file
187
meta/recipes-devtools/git/files/CVE-2022-41903-02.patch
Normal file
@@ -0,0 +1,187 @@
|
||||
From 81dc898df9b4b4035534a927f3234a3839b698bf Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:25 +0100
|
||||
Subject: [PATCH 02/12] pretty: fix out-of-bounds write caused by integer overflow
|
||||
|
||||
When using a padding specifier in the pretty format passed to git-log(1)
|
||||
we need to calculate the string length in several places. These string
|
||||
lengths are stored in `int`s though, which means that these can easily
|
||||
overflow when the input lengths exceeds 2GB. This can ultimately lead to
|
||||
an out-of-bounds write when these are used in a call to memcpy(3P):
|
||||
|
||||
==8340==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f1ec62f97fe at pc 0x7f2127e5f427 bp 0x7ffd3bd63de0 sp 0x7ffd3bd63588
|
||||
WRITE of size 1 at 0x7f1ec62f97fe thread T0
|
||||
#0 0x7f2127e5f426 in __interceptor_memcpy /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
|
||||
#1 0x5628e96aa605 in format_and_pad_commit pretty.c:1762
|
||||
#2 0x5628e96aa7f4 in format_commit_item pretty.c:1801
|
||||
#3 0x5628e97cdb24 in strbuf_expand strbuf.c:429
|
||||
#4 0x5628e96ab060 in repo_format_commit_message pretty.c:1869
|
||||
#5 0x5628e96acd0f in pretty_print_commit pretty.c:2161
|
||||
#6 0x5628e95a44c8 in show_log log-tree.c:781
|
||||
#7 0x5628e95a76ba in log_tree_commit log-tree.c:1117
|
||||
#8 0x5628e922bed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#9 0x5628e922c35b in cmd_log_walk builtin/log.c:549
|
||||
#10 0x5628e922f1a2 in cmd_log builtin/log.c:883
|
||||
#11 0x5628e9106993 in run_builtin git.c:466
|
||||
#12 0x5628e9107397 in handle_builtin git.c:721
|
||||
#13 0x5628e9107b07 in run_argv git.c:788
|
||||
#14 0x5628e91088a7 in cmd_main git.c:923
|
||||
#15 0x5628e939d682 in main common-main.c:57
|
||||
#16 0x7f2127c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#17 0x7f2127c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#18 0x5628e91020e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x7f1ec62f97fe is located 2 bytes to the left of 4831838265-byte region [0x7f1ec62f9800,0x7f1fe62f9839)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f2127ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x5628e98774d4 in xrealloc wrapper.c:136
|
||||
#2 0x5628e97cb01c in strbuf_grow strbuf.c:99
|
||||
#3 0x5628e97ccd42 in strbuf_addchars strbuf.c:327
|
||||
#4 0x5628e96aa55c in format_and_pad_commit pretty.c:1761
|
||||
#5 0x5628e96aa7f4 in format_commit_item pretty.c:1801
|
||||
#6 0x5628e97cdb24 in strbuf_expand strbuf.c:429
|
||||
#7 0x5628e96ab060 in repo_format_commit_message pretty.c:1869
|
||||
#8 0x5628e96acd0f in pretty_print_commit pretty.c:2161
|
||||
#9 0x5628e95a44c8 in show_log log-tree.c:781
|
||||
#10 0x5628e95a76ba in log_tree_commit log-tree.c:1117
|
||||
#11 0x5628e922bed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#12 0x5628e922c35b in cmd_log_walk builtin/log.c:549
|
||||
#13 0x5628e922f1a2 in cmd_log builtin/log.c:883
|
||||
#14 0x5628e9106993 in run_builtin git.c:466
|
||||
#15 0x5628e9107397 in handle_builtin git.c:721
|
||||
#16 0x5628e9107b07 in run_argv git.c:788
|
||||
#17 0x5628e91088a7 in cmd_main git.c:923
|
||||
#18 0x5628e939d682 in main common-main.c:57
|
||||
#19 0x7f2127c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#20 0x7f2127c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#21 0x5628e91020e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 in __interceptor_memcpy
|
||||
Shadow bytes around the buggy address:
|
||||
0x0fe458c572a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0fe458c572e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
=>0x0fe458c572f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
|
||||
0x0fe458c57300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
0x0fe458c57340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==8340==ABORTING
|
||||
|
||||
The pretty format can also be used in `git archive` operations via the
|
||||
`export-subst` attribute. So this is what in our opinion makes this a
|
||||
critical issue in the context of Git forges which allow to download an
|
||||
archive of user supplied Git repositories.
|
||||
|
||||
Fix this vulnerability by using `size_t` instead of `int` to track the
|
||||
string lengths. Add tests which detect this vulnerability when Git is
|
||||
compiled with the address sanitizer.
|
||||
|
||||
Reported-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
|
||||
Original-patch-by: Joern Schneeweisz <jschneeweisz@gitlab.com>
|
||||
Modified-by: Taylor Blau <me@ttalorr.com>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/81dc898df9b4b4035534a927f3234a3839b698bf]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 11 ++++++-----
|
||||
t/t4205-log-pretty-formats.sh | 17 +++++++++++++++++
|
||||
2 files changed, 23 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index b32f036..637e344 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1427,7 +1427,9 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
struct format_commit_context *c)
|
||||
{
|
||||
struct strbuf local_sb = STRBUF_INIT;
|
||||
- int total_consumed = 0, len, padding = c->padding;
|
||||
+ size_t total_consumed = 0;
|
||||
+ int len, padding = c->padding;
|
||||
+
|
||||
if (padding < 0) {
|
||||
const char *start = strrchr(sb->buf, '\n');
|
||||
int occupied;
|
||||
@@ -1439,7 +1441,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
}
|
||||
while (1) {
|
||||
int modifier = *placeholder == 'C';
|
||||
- int consumed = format_commit_one(&local_sb, placeholder, c);
|
||||
+ size_t consumed = format_commit_one(&local_sb, placeholder, c);
|
||||
total_consumed += consumed;
|
||||
|
||||
if (!modifier)
|
||||
@@ -1505,7 +1507,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
}
|
||||
strbuf_addbuf(sb, &local_sb);
|
||||
} else {
|
||||
- int sb_len = sb->len, offset = 0;
|
||||
+ size_t sb_len = sb->len, offset = 0;
|
||||
if (c->flush_type == flush_left)
|
||||
offset = padding - len;
|
||||
else if (c->flush_type == flush_both)
|
||||
@@ -1528,8 +1530,7 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
|
||||
const char *placeholder,
|
||||
void *context)
|
||||
{
|
||||
- int consumed;
|
||||
- size_t orig_len;
|
||||
+ size_t consumed, orig_len;
|
||||
enum {
|
||||
NO_MAGIC,
|
||||
ADD_LF_BEFORE_NON_EMPTY,
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index f42a69f..a2acee1 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -788,4 +788,21 @@ test_expect_success '%S in git log --format works with other placeholders (part
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
+ # We only assert that this command does not crash. This needs to be
|
||||
+ # executed with the address sanitizer to demonstrate failure.
|
||||
+ git log -1 --pretty="format:%>(2147483646)%x41%41%>(2147483646)%x41" >/dev/null
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'set up huge commit' '
|
||||
+ test-tool genzeros 2147483649 | tr "\000" "1" >expect &&
|
||||
+ huge_commit=$(git commit-tree -F expect HEAD^{tree})
|
||||
+'
|
||||
+
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
+ git log -1 --format="%B%<(1)%x30" $huge_commit >actual &&
|
||||
+ echo 0 >>expect &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
146
meta/recipes-devtools/git/files/CVE-2022-41903-03.patch
Normal file
146
meta/recipes-devtools/git/files/CVE-2022-41903-03.patch
Normal file
@@ -0,0 +1,146 @@
|
||||
From b49f309aa16febeddb65e82526640a91bbba3be3 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:30 +0100
|
||||
Subject: [PATCH 03/12] pretty: fix out-of-bounds read when left-flushing with stealing
|
||||
|
||||
With the `%>>(<N>)` pretty formatter, you can ask git-log(1) et al to
|
||||
steal spaces. To do so we need to look ahead of the next token to see
|
||||
whether there are spaces there. This loop takes into account ANSI
|
||||
sequences that end with an `m`, and if it finds any it will skip them
|
||||
until it finds the first space. While doing so it does not take into
|
||||
account the buffer's limits though and easily does an out-of-bounds
|
||||
read.
|
||||
|
||||
Add a test that hits this behaviour. While we don't have an easy way to
|
||||
verify this, the test causes the following failure when run with
|
||||
`SANITIZE=address`:
|
||||
|
||||
==37941==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000000baf at pc 0x55ba6f88e0d0 bp 0x7ffc84c50d20 sp 0x7ffc84c50d10
|
||||
READ of size 1 at 0x603000000baf thread T0
|
||||
#0 0x55ba6f88e0cf in format_and_pad_commit pretty.c:1712
|
||||
#1 0x55ba6f88e7b4 in format_commit_item pretty.c:1801
|
||||
#2 0x55ba6f9b1ae4 in strbuf_expand strbuf.c:429
|
||||
#3 0x55ba6f88f020 in repo_format_commit_message pretty.c:1869
|
||||
#4 0x55ba6f890ccf in pretty_print_commit pretty.c:2161
|
||||
#5 0x55ba6f7884c8 in show_log log-tree.c:781
|
||||
#6 0x55ba6f78b6ba in log_tree_commit log-tree.c:1117
|
||||
#7 0x55ba6f40fed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#8 0x55ba6f41035b in cmd_log_walk builtin/log.c:549
|
||||
#9 0x55ba6f4131a2 in cmd_log builtin/log.c:883
|
||||
#10 0x55ba6f2ea993 in run_builtin git.c:466
|
||||
#11 0x55ba6f2eb397 in handle_builtin git.c:721
|
||||
#12 0x55ba6f2ebb07 in run_argv git.c:788
|
||||
#13 0x55ba6f2ec8a7 in cmd_main git.c:923
|
||||
#14 0x55ba6f581682 in main common-main.c:57
|
||||
#15 0x7f2d08c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#16 0x7f2d08c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#17 0x55ba6f2e60e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x603000000baf is located 1 bytes to the left of 24-byte region [0x603000000bb0,0x603000000bc8)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f2d08ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x55ba6fa5b494 in xrealloc wrapper.c:136
|
||||
#2 0x55ba6f9aefdc in strbuf_grow strbuf.c:99
|
||||
#3 0x55ba6f9b0a06 in strbuf_add strbuf.c:298
|
||||
#4 0x55ba6f9b1a25 in strbuf_expand strbuf.c:418
|
||||
#5 0x55ba6f88f020 in repo_format_commit_message pretty.c:1869
|
||||
#6 0x55ba6f890ccf in pretty_print_commit pretty.c:2161
|
||||
#7 0x55ba6f7884c8 in show_log log-tree.c:781
|
||||
#8 0x55ba6f78b6ba in log_tree_commit log-tree.c:1117
|
||||
#9 0x55ba6f40fed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#10 0x55ba6f41035b in cmd_log_walk builtin/log.c:549
|
||||
#11 0x55ba6f4131a2 in cmd_log builtin/log.c:883
|
||||
#12 0x55ba6f2ea993 in run_builtin git.c:466
|
||||
#13 0x55ba6f2eb397 in handle_builtin git.c:721
|
||||
#14 0x55ba6f2ebb07 in run_argv git.c:788
|
||||
#15 0x55ba6f2ec8a7 in cmd_main git.c:923
|
||||
#16 0x55ba6f581682 in main common-main.c:57
|
||||
#17 0x7f2d08c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#18 0x7f2d08c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#19 0x55ba6f2e60e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow pretty.c:1712 in format_and_pad_commit
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c067fff8120: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
||||
0x0c067fff8130: fd fd fa fa fd fd fd fd fa fa fd fd fd fa fa fa
|
||||
0x0c067fff8140: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
|
||||
0x0c067fff8150: fa fa fd fd fd fd fa fa 00 00 00 fa fa fa fd fd
|
||||
0x0c067fff8160: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
||||
=>0x0c067fff8170: fd fd fd fa fa[fa]00 00 00 fa fa fa 00 00 00 fa
|
||||
0x0c067fff8180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff81c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
|
||||
Luckily enough, this would only cause us to copy the out-of-bounds data
|
||||
into the formatted commit in case we really had an ANSI sequence
|
||||
preceding our buffer. So this bug likely has no security consequences.
|
||||
|
||||
Fix it regardless by not traversing past the buffer's start.
|
||||
|
||||
Reported-by: Patrick Steinhardt <ps@pks.im>
|
||||
Reported-by: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/b49f309aa16febeddb65e82526640a91bbba3be3]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 2 +-
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 637e344..4348a82 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1468,7 +1468,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
if (*ch != 'm')
|
||||
break;
|
||||
p = ch - 1;
|
||||
- while (ch - p < 10 && *p != '\033')
|
||||
+ while (p > sb->buf && ch - p < 10 && *p != '\033')
|
||||
p--;
|
||||
if (*p != '\033' ||
|
||||
ch + 1 - p != display_mode_esc_sequence_len(p))
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index a2acee1..e69caba 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -788,6 +788,12 @@ test_expect_success '%S in git log --format works with other placeholders (part
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with space stealing' '
|
||||
+ printf mm0 >expect &&
|
||||
+ git log -1 --pretty="format:mm%>>|(1)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
150
meta/recipes-devtools/git/files/CVE-2022-41903-04.patch
Normal file
150
meta/recipes-devtools/git/files/CVE-2022-41903-04.patch
Normal file
@@ -0,0 +1,150 @@
|
||||
From f6e0b9f38987ad5e47bab551f8760b70689a5905 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:34 +0100
|
||||
Subject: [PATCH 04/12] pretty: fix out-of-bounds read when parsing invalid padding format
|
||||
|
||||
An out-of-bounds read can be triggered when parsing an incomplete
|
||||
padding format string passed via `--pretty=format` or in Git archives
|
||||
when files are marked with the `export-subst` gitattribute.
|
||||
|
||||
This bug exists since we have introduced support for truncating output
|
||||
via the `trunc` keyword a7f01c6 (pretty: support truncating in %>, %<
|
||||
and %><, 2013-04-19). Before this commit, we used to find the end of the
|
||||
formatting string by using strchr(3P). This function returns a `NULL`
|
||||
pointer in case the character in question wasn't found. The subsequent
|
||||
check whether any character was found thus simply checked the returned
|
||||
pointer. After the commit we switched to strcspn(3P) though, which only
|
||||
returns the offset to the first found character or to the trailing NUL
|
||||
byte. As the end pointer is now computed by adding the offset to the
|
||||
start pointer it won't be `NULL` anymore, and as a consequence the check
|
||||
doesn't do anything anymore.
|
||||
|
||||
The out-of-bounds data that is being read can in fact end up in the
|
||||
formatted string. As a consequence, it is possible to leak memory
|
||||
contents either by calling git-log(1) or via git-archive(1) when any of
|
||||
the archived files is marked with the `export-subst` gitattribute.
|
||||
|
||||
==10888==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000398 at pc 0x7f0356047cb2 bp 0x7fff3ffb95d0 sp 0x7fff3ffb8d78
|
||||
READ of size 1 at 0x602000000398 thread T0
|
||||
#0 0x7f0356047cb1 in __interceptor_strchrnul /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:725
|
||||
#1 0x563b7cec9a43 in strbuf_expand strbuf.c:417
|
||||
#2 0x563b7cda7060 in repo_format_commit_message pretty.c:1869
|
||||
#3 0x563b7cda8d0f in pretty_print_commit pretty.c:2161
|
||||
#4 0x563b7cca04c8 in show_log log-tree.c:781
|
||||
#5 0x563b7cca36ba in log_tree_commit log-tree.c:1117
|
||||
#6 0x563b7c927ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#7 0x563b7c92835b in cmd_log_walk builtin/log.c:549
|
||||
#8 0x563b7c92b1a2 in cmd_log builtin/log.c:883
|
||||
#9 0x563b7c802993 in run_builtin git.c:466
|
||||
#10 0x563b7c803397 in handle_builtin git.c:721
|
||||
#11 0x563b7c803b07 in run_argv git.c:788
|
||||
#12 0x563b7c8048a7 in cmd_main git.c:923
|
||||
#13 0x563b7ca99682 in main common-main.c:57
|
||||
#14 0x7f0355e3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#15 0x7f0355e3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#16 0x563b7c7fe0e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x602000000398 is located 0 bytes to the right of 8-byte region [0x602000000390,0x602000000398)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f0356072faa in __interceptor_strdup /usr/src/debug/gcc/libsanitizer/asan/asan_interceptors.cpp:439
|
||||
#1 0x563b7cf7317c in xstrdup wrapper.c:39
|
||||
#2 0x563b7cd9a06a in save_user_format pretty.c:40
|
||||
#3 0x563b7cd9b3e5 in get_commit_format pretty.c:173
|
||||
#4 0x563b7ce54ea0 in handle_revision_opt revision.c:2456
|
||||
#5 0x563b7ce597c9 in setup_revisions revision.c:2850
|
||||
#6 0x563b7c9269e0 in cmd_log_init_finish builtin/log.c:269
|
||||
#7 0x563b7c927362 in cmd_log_init builtin/log.c:348
|
||||
#8 0x563b7c92b193 in cmd_log builtin/log.c:882
|
||||
#9 0x563b7c802993 in run_builtin git.c:466
|
||||
#10 0x563b7c803397 in handle_builtin git.c:721
|
||||
#11 0x563b7c803b07 in run_argv git.c:788
|
||||
#12 0x563b7c8048a7 in cmd_main git.c:923
|
||||
#13 0x563b7ca99682 in main common-main.c:57
|
||||
#14 0x7f0355e3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#15 0x7f0355e3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#16 0x563b7c7fe0e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:725 in __interceptor_strchrnul
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c047fff8020: fa fa fd fd fa fa 00 06 fa fa 05 fa fa fa fd fd
|
||||
0x0c047fff8030: fa fa 00 02 fa fa 06 fa fa fa 05 fa fa fa fd fd
|
||||
0x0c047fff8040: fa fa 00 07 fa fa 03 fa fa fa fd fd fa fa 00 00
|
||||
0x0c047fff8050: fa fa 00 01 fa fa fd fd fa fa 00 00 fa fa 00 01
|
||||
0x0c047fff8060: fa fa 00 06 fa fa 00 06 fa fa 05 fa fa fa 05 fa
|
||||
=>0x0c047fff8070: fa fa 00[fa]fa fa fd fa fa fa fd fd fa fa fd fd
|
||||
0x0c047fff8080: fa fa fd fd fa fa 00 00 fa fa 00 fa fa fa fd fa
|
||||
0x0c047fff8090: fa fa fd fd fa fa 00 00 fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c047fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==10888==ABORTING
|
||||
|
||||
Fix this bug by checking whether `end` points at the trailing NUL byte.
|
||||
Add a test which catches this out-of-bounds read and which demonstrates
|
||||
that we used to write out-of-bounds data into the formatted message.
|
||||
|
||||
Reported-by: Markus Vervier <markus.vervier@x41-dsec.de>
|
||||
Original-patch-by: Markus Vervier <markus.vervier@x41-dsec.de>
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/f6e0b9f38987ad5e47bab551f8760b70689a5905]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 2 +-
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 4348a82..c49e818 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1024,7 +1024,7 @@ static size_t parse_padding_placeholder(const char *placeholder,
|
||||
const char *end = start + strcspn(start, ",)");
|
||||
char *next;
|
||||
int width;
|
||||
- if (!end || end == start)
|
||||
+ if (!*end || end == start)
|
||||
return 0;
|
||||
width = strtol(start, &next, 10);
|
||||
if (next == start || width == 0)
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index e69caba..8a349df 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -794,6 +794,12 @@ test_expect_success 'log --pretty with space stealing' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with invalid padding format' '
|
||||
+ printf "%s%%<(20" "$(git rev-parse HEAD)" >expect &&
|
||||
+ git log -1 --pretty="format:%H%<(20" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
98
meta/recipes-devtools/git/files/CVE-2022-41903-05.patch
Normal file
98
meta/recipes-devtools/git/files/CVE-2022-41903-05.patch
Normal file
@@ -0,0 +1,98 @@
|
||||
From 1de69c0cdd388b0a5b7bdde0bfa0bda514a354b0 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:39 +0100
|
||||
Subject: [PATCH 05/12] pretty: fix adding linefeed when placeholder is not expanded
|
||||
|
||||
When a formatting directive has a `+` or ` ` after the `%`, then we add
|
||||
either a line feed or space if the placeholder expands to a non-empty
|
||||
string. In specific cases though this logic doesn't work as expected,
|
||||
and we try to add the character even in the case where the formatting
|
||||
directive is empty.
|
||||
|
||||
One such pattern is `%w(1)%+d%+w(2)`. `%+d` expands to reference names
|
||||
pointing to a certain commit, like in `git log --decorate`. For a tagged
|
||||
commit this would for example expand to `\n (tag: v1.0.0)`, which has a
|
||||
leading newline due to the `+` modifier and a space added by `%d`. Now
|
||||
the second wrapping directive will cause us to rewrap the text to
|
||||
`\n(tag:\nv1.0.0)`, which is one byte shorter due to the missing leading
|
||||
space. The code that handles the `+` magic now notices that the length
|
||||
has changed and will thus try to insert a leading line feed at the
|
||||
original posititon. But as the string was shortened, the original
|
||||
position is past the buffer's boundary and thus we die with an error.
|
||||
|
||||
Now there are two issues here:
|
||||
|
||||
1. We check whether the buffer length has changed, not whether it
|
||||
has been extended. This causes us to try and add the character
|
||||
past the string boundary.
|
||||
|
||||
2. The current logic does not make any sense whatsoever. When the
|
||||
string got expanded due to the rewrap, putting the separator into
|
||||
the original position is likely to put it somewhere into the
|
||||
middle of the rewrapped contents.
|
||||
|
||||
It is debatable whether `%+w()` makes any sense in the first place.
|
||||
Strictly speaking, the placeholder never expands to a non-empty string,
|
||||
and consequentially we shouldn't ever accept this combination. We thus
|
||||
fix the bug by simply refusing `%+w()`.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/1de69c0cdd388b0a5b7bdde0bfa0bda514a354b0]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 14 +++++++++++++-
|
||||
t/t4205-log-pretty-formats.sh | 8 ++++++++
|
||||
2 files changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index c49e818..195d005 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1551,9 +1551,21 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
- if (magic != NO_MAGIC)
|
||||
+ if (magic != NO_MAGIC) {
|
||||
placeholder++;
|
||||
|
||||
+ switch (placeholder[0]) {
|
||||
+ case 'w':
|
||||
+ /*
|
||||
+ * `%+w()` cannot ever expand to a non-empty string,
|
||||
+ * and it potentially changes the layout of preceding
|
||||
+ * contents. We're thus not able to handle the magic in
|
||||
+ * this combination and refuse the pattern.
|
||||
+ */
|
||||
+ return 0;
|
||||
+ };
|
||||
+ }
|
||||
+
|
||||
orig_len = sb->len;
|
||||
if (((struct format_commit_context *)context)->flush_type != no_flush)
|
||||
consumed = format_and_pad_commit(sb, placeholder, context);
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 8a349df..fa1bc2b 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -800,6 +800,14 @@ test_expect_success 'log --pretty with invalid padding format' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
+ commit_id=$(git commit-tree HEAD^{tree} -m "describe me") &&
|
||||
+ git tag describe-me $commit_id &&
|
||||
+ printf "\n(tag:\ndescribe-me)%%+w(2)" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1)%+d%+w(2)" $commit_id >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
90
meta/recipes-devtools/git/files/CVE-2022-41903-06.patch
Normal file
90
meta/recipes-devtools/git/files/CVE-2022-41903-06.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From 48050c42c73c28b0c001d63d11dffac7e116847b Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:49 +0100
|
||||
Subject: [PATCH 06/12] pretty: fix integer overflow in wrapping format
|
||||
|
||||
The `%w(width,indent1,indent2)` formatting directive can be used to
|
||||
rewrap text to a specific width and is designed after git-shortlog(1)'s
|
||||
`-w` parameter. While the three parameters are all stored as `size_t`
|
||||
internally, `strbuf_add_wrapped_text()` accepts integers as input. As a
|
||||
result, the casted integers may overflow. As these now-negative integers
|
||||
are later on passed to `strbuf_addchars()`, we will ultimately run into
|
||||
implementation-defined behaviour due to casting a negative number back
|
||||
to `size_t` again. On my platform, this results in trying to allocate
|
||||
9000 petabyte of memory.
|
||||
|
||||
Fix this overflow by using `cast_size_t_to_int()` so that we reject
|
||||
inputs that cannot be represented as an integer.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/48050c42c73c28b0c001d63d11dffac7e116847b]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
git-compat-util.h | 8 ++++++++
|
||||
pretty.c | 4 +++-
|
||||
t/t4205-log-pretty-formats.sh | 12 ++++++++++++
|
||||
3 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/git-compat-util.h b/git-compat-util.h
|
||||
index a1ecfd3..b0f3890 100644
|
||||
--- a/git-compat-util.h
|
||||
+++ b/git-compat-util.h
|
||||
@@ -854,6 +854,14 @@ static inline size_t st_sub(size_t a, size_t b)
|
||||
return a - b;
|
||||
}
|
||||
|
||||
+static inline int cast_size_t_to_int(size_t a)
|
||||
+{
|
||||
+ if (a > INT_MAX)
|
||||
+ die("number too large to represent as int on this platform: %"PRIuMAX,
|
||||
+ (uintmax_t)a);
|
||||
+ return (int)a;
|
||||
+}
|
||||
+
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# define xalloca(size) (alloca(size))
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index 195d005..ff9fc97 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -898,7 +898,9 @@ static void strbuf_wrap(struct strbuf *sb, size_t pos,
|
||||
if (pos)
|
||||
strbuf_add(&tmp, sb->buf, pos);
|
||||
strbuf_add_wrapped_text(&tmp, sb->buf + pos,
|
||||
- (int) indent1, (int) indent2, (int) width);
|
||||
+ cast_size_t_to_int(indent1),
|
||||
+ cast_size_t_to_int(indent2),
|
||||
+ cast_size_t_to_int(width));
|
||||
strbuf_swap(&tmp, sb);
|
||||
strbuf_release(&tmp);
|
||||
}
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index fa1bc2b..23ac508 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -808,6 +808,18 @@ test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping directive' '
|
||||
+ cat >expect <<-EOF &&
|
||||
+ fatal: number too large to represent as int on this platform: 2147483649
|
||||
+ EOF
|
||||
+ test_must_fail git log -1 --pretty="format:%w(2147483649,1,1)%d" 2>error &&
|
||||
+ test_cmp expect error &&
|
||||
+ test_must_fail git log -1 --pretty="format:%w(1,2147483649,1)%d" 2>error &&
|
||||
+ test_cmp expect error &&
|
||||
+ test_must_fail git log -1 --pretty="format:%w(1,1,2147483649)%d" 2>error &&
|
||||
+ test_cmp expect error
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
--
|
||||
2.25.1
|
||||
|
||||
123
meta/recipes-devtools/git/files/CVE-2022-41903-07.patch
Normal file
123
meta/recipes-devtools/git/files/CVE-2022-41903-07.patch
Normal file
@@ -0,0 +1,123 @@
|
||||
From 522cc87fdc25449222a5894a428eebf4b8d5eaa9 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:46:53 +0100
|
||||
Subject: [PATCH 07/12] utf8: fix truncated string lengths in utf8_strnwidth()
|
||||
|
||||
The `utf8_strnwidth()` function accepts an optional string length as
|
||||
input parameter. This parameter can either be set to `-1`, in which case
|
||||
we call `strlen()` on the input. Or it can be set to a positive integer
|
||||
that indicates a precomputed length, which callers typically compute by
|
||||
calling `strlen()` at some point themselves.
|
||||
|
||||
The input parameter is an `int` though, whereas `strlen()` returns a
|
||||
`size_t`. This can lead to implementation-defined behaviour though when
|
||||
the `size_t` cannot be represented by the `int`. In the general case
|
||||
though this leads to wrap-around and thus to negative string sizes,
|
||||
which is sure enough to not lead to well-defined behaviour.
|
||||
|
||||
Fix this by accepting a `size_t` instead of an `int` as string length.
|
||||
While this takes away the ability of callers to simply pass in `-1` as
|
||||
string length, it really is trivial enough to convert them to instead
|
||||
pass in `strlen()` instead.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/522cc87fdc25449222a5894a428eebf4b8d5eaa9]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
column.c | 2 +-
|
||||
pretty.c | 4 ++--
|
||||
utf8.c | 8 +++-----
|
||||
utf8.h | 2 +-
|
||||
4 files changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/column.c b/column.c
|
||||
index 4a38eed..0c79850 100644
|
||||
--- a/column.c
|
||||
+++ b/column.c
|
||||
@@ -23,7 +23,7 @@ struct column_data {
|
||||
/* return length of 's' in letters, ANSI escapes stripped */
|
||||
static int item_length(const char *s)
|
||||
{
|
||||
- return utf8_strnwidth(s, -1, 1);
|
||||
+ return utf8_strnwidth(s, strlen(s), 1);
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index ff9fc97..c3c1443 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -1437,7 +1437,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
int occupied;
|
||||
if (!start)
|
||||
start = sb->buf;
|
||||
- occupied = utf8_strnwidth(start, -1, 1);
|
||||
+ occupied = utf8_strnwidth(start, strlen(start), 1);
|
||||
occupied += c->pretty_ctx->graph_width;
|
||||
padding = (-padding) - occupied;
|
||||
}
|
||||
@@ -1455,7 +1455,7 @@ static size_t format_and_pad_commit(struct strbuf *sb, /* in UTF-8 */
|
||||
placeholder++;
|
||||
total_consumed++;
|
||||
}
|
||||
- len = utf8_strnwidth(local_sb.buf, -1, 1);
|
||||
+ len = utf8_strnwidth(local_sb.buf, local_sb.len, 1);
|
||||
|
||||
if (c->flush_type == flush_left_and_steal) {
|
||||
const char *ch = sb->buf + sb->len - 1;
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 5c8f151..a66984b 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -206,13 +206,11 @@ int utf8_width(const char **start, size_t *remainder_p)
|
||||
* string, assuming that the string is utf8. Returns strlen() instead
|
||||
* if the string does not look like a valid utf8 string.
|
||||
*/
|
||||
-int utf8_strnwidth(const char *string, int len, int skip_ansi)
|
||||
+int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
{
|
||||
int width = 0;
|
||||
const char *orig = string;
|
||||
|
||||
- if (len == -1)
|
||||
- len = strlen(string);
|
||||
while (string && string < orig + len) {
|
||||
int skip;
|
||||
while (skip_ansi &&
|
||||
@@ -225,7 +223,7 @@ int utf8_strnwidth(const char *string, int len, int skip_ansi)
|
||||
|
||||
int utf8_strwidth(const char *string)
|
||||
{
|
||||
- return utf8_strnwidth(string, -1, 0);
|
||||
+ return utf8_strnwidth(string, strlen(string), 0);
|
||||
}
|
||||
|
||||
int is_utf8(const char *text)
|
||||
@@ -792,7 +790,7 @@ int skip_utf8_bom(char **text, size_t len)
|
||||
void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int width,
|
||||
const char *s)
|
||||
{
|
||||
- int slen = strlen(s);
|
||||
+ size_t slen = strlen(s);
|
||||
int display_len = utf8_strnwidth(s, slen, 0);
|
||||
int utf8_compensation = slen - display_len;
|
||||
|
||||
diff --git a/utf8.h b/utf8.h
|
||||
index fcd5167..6da1b6d 100644
|
||||
--- a/utf8.h
|
||||
+++ b/utf8.h
|
||||
@@ -7,7 +7,7 @@ typedef unsigned int ucs_char_t; /* assuming 32bit int */
|
||||
|
||||
size_t display_mode_esc_sequence_len(const char *s);
|
||||
int utf8_width(const char **start, size_t *remainder_p);
|
||||
-int utf8_strnwidth(const char *string, int len, int skip_ansi);
|
||||
+int utf8_strnwidth(const char *string, size_t len, int skip_ansi);
|
||||
int utf8_strwidth(const char *string);
|
||||
int is_utf8(const char *text);
|
||||
int is_encoding_utf8(const char *name);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
67
meta/recipes-devtools/git/files/CVE-2022-41903-08.patch
Normal file
67
meta/recipes-devtools/git/files/CVE-2022-41903-08.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 17d23e8a3812a5ca3dd6564e74d5250f22e5d76d Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:00 +0100
|
||||
Subject: [PATCH 08/12] utf8: fix returning negative string width
|
||||
|
||||
The `utf8_strnwidth()` function calls `utf8_width()` in a loop and adds
|
||||
its returned width to the end result. `utf8_width()` can return `-1`
|
||||
though in case it reads a control character, which means that the
|
||||
computed string width is going to be wrong. In the worst case where
|
||||
there are more control characters than non-control characters, we may
|
||||
even return a negative string width.
|
||||
|
||||
Fix this bug by treating control characters as having zero width.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/17d23e8a3812a5ca3dd6564e74d5250f22e5d76d]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 6 ++++++
|
||||
utf8.c | 8 ++++++--
|
||||
2 files changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 23ac508..261a6f0 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -820,6 +820,12 @@ test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping dire
|
||||
test_cmp expect error
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
+ printf "\20\20 0" >expect &&
|
||||
+ git log -1 --pretty="format:%x10%x10%>|(4)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index a66984b..6632bd2 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -212,11 +212,15 @@ int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
const char *orig = string;
|
||||
|
||||
while (string && string < orig + len) {
|
||||
- int skip;
|
||||
+ int glyph_width, skip;
|
||||
+
|
||||
while (skip_ansi &&
|
||||
(skip = display_mode_esc_sequence_len(string)) != 0)
|
||||
string += skip;
|
||||
- width += utf8_width(&string, NULL);
|
||||
+
|
||||
+ glyph_width = utf8_width(&string, NULL);
|
||||
+ if (glyph_width > 0)
|
||||
+ width += glyph_width;
|
||||
}
|
||||
return string ? width : len;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
162
meta/recipes-devtools/git/files/CVE-2022-41903-09.patch
Normal file
162
meta/recipes-devtools/git/files/CVE-2022-41903-09.patch
Normal file
@@ -0,0 +1,162 @@
|
||||
From 937b71cc8b5b998963a7f9a33312ba3549d55510 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:04 +0100
|
||||
Subject: [PATCH 09/12] utf8: fix overflow when returning string width
|
||||
|
||||
The return type of both `utf8_strwidth()` and `utf8_strnwidth()` is
|
||||
`int`, but we operate on string lengths which are typically of type
|
||||
`size_t`. This means that when the string is longer than `INT_MAX`, we
|
||||
will overflow and thus return a negative result.
|
||||
|
||||
This can lead to an out-of-bounds write with `--pretty=format:%<1)%B`
|
||||
and a commit message that is 2^31+1 bytes long:
|
||||
|
||||
=================================================================
|
||||
==26009==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000001168 at pc 0x7f95c4e5f427 bp 0x7ffd8541c900 sp 0x7ffd8541c0a8
|
||||
WRITE of size 2147483649 at 0x603000001168 thread T0
|
||||
#0 0x7f95c4e5f426 in __interceptor_memcpy /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827
|
||||
#1 0x5612bbb1068c in format_and_pad_commit pretty.c:1763
|
||||
#2 0x5612bbb1087a in format_commit_item pretty.c:1801
|
||||
#3 0x5612bbc33bab in strbuf_expand strbuf.c:429
|
||||
#4 0x5612bbb110e7 in repo_format_commit_message pretty.c:1869
|
||||
#5 0x5612bbb12d96 in pretty_print_commit pretty.c:2161
|
||||
#6 0x5612bba0a4d5 in show_log log-tree.c:781
|
||||
#7 0x5612bba0d6c7 in log_tree_commit log-tree.c:1117
|
||||
#8 0x5612bb691ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#9 0x5612bb69235b in cmd_log_walk builtin/log.c:549
|
||||
#10 0x5612bb6951a2 in cmd_log builtin/log.c:883
|
||||
#11 0x5612bb56c993 in run_builtin git.c:466
|
||||
#12 0x5612bb56d397 in handle_builtin git.c:721
|
||||
#13 0x5612bb56db07 in run_argv git.c:788
|
||||
#14 0x5612bb56e8a7 in cmd_main git.c:923
|
||||
#15 0x5612bb803682 in main common-main.c:57
|
||||
#16 0x7f95c4c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
#17 0x7f95c4c3c349 in __libc_start_main (/usr/lib/libc.so.6+0x23349)
|
||||
#18 0x5612bb5680e4 in _start ../sysdeps/x86_64/start.S:115
|
||||
|
||||
0x603000001168 is located 0 bytes to the right of 24-byte region [0x603000001150,0x603000001168)
|
||||
allocated by thread T0 here:
|
||||
#0 0x7f95c4ebe7ea in __interceptor_realloc /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
|
||||
#1 0x5612bbcdd556 in xrealloc wrapper.c:136
|
||||
#2 0x5612bbc310a3 in strbuf_grow strbuf.c:99
|
||||
#3 0x5612bbc32acd in strbuf_add strbuf.c:298
|
||||
#4 0x5612bbc33aec in strbuf_expand strbuf.c:418
|
||||
#5 0x5612bbb110e7 in repo_format_commit_message pretty.c:1869
|
||||
#6 0x5612bbb12d96 in pretty_print_commit pretty.c:2161
|
||||
#7 0x5612bba0a4d5 in show_log log-tree.c:781
|
||||
#8 0x5612bba0d6c7 in log_tree_commit log-tree.c:1117
|
||||
#9 0x5612bb691ed5 in cmd_log_walk_no_free builtin/log.c:508
|
||||
#10 0x5612bb69235b in cmd_log_walk builtin/log.c:549
|
||||
#11 0x5612bb6951a2 in cmd_log builtin/log.c:883
|
||||
#12 0x5612bb56c993 in run_builtin git.c:466
|
||||
#13 0x5612bb56d397 in handle_builtin git.c:721
|
||||
#14 0x5612bb56db07 in run_argv git.c:788
|
||||
#15 0x5612bb56e8a7 in cmd_main git.c:923
|
||||
#16 0x5612bb803682 in main common-main.c:57
|
||||
#17 0x7f95c4c3c28f (/usr/lib/libc.so.6+0x2328f)
|
||||
|
||||
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:827 in __interceptor_memcpy
|
||||
Shadow bytes around the buggy address:
|
||||
0x0c067fff81d0: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
|
||||
0x0c067fff81e0: fa fa fd fd fd fd fa fa fd fd fd fd fa fa fd fd
|
||||
0x0c067fff81f0: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
||||
0x0c067fff8200: fd fd fd fa fa fa fd fd fd fd fa fa 00 00 00 fa
|
||||
0x0c067fff8210: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
||||
=>0x0c067fff8220: fd fa fa fa fd fd fd fa fa fa 00 00 00[fa]fa fa
|
||||
0x0c067fff8230: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
0x0c067fff8270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
||||
Shadow byte legend (one shadow byte represents 8 application bytes):
|
||||
Addressable: 00
|
||||
Partially addressable: 01 02 03 04 05 06 07
|
||||
Heap left redzone: fa
|
||||
Freed heap region: fd
|
||||
Stack left redzone: f1
|
||||
Stack mid redzone: f2
|
||||
Stack right redzone: f3
|
||||
Stack after return: f5
|
||||
Stack use after scope: f8
|
||||
Global redzone: f9
|
||||
Global init order: f6
|
||||
Poisoned by user: f7
|
||||
Container overflow: fc
|
||||
Array cookie: ac
|
||||
Intra object redzone: bb
|
||||
ASan internal: fe
|
||||
Left alloca redzone: ca
|
||||
Right alloca redzone: cb
|
||||
==26009==ABORTING
|
||||
|
||||
Now the proper fix for this would be to convert both functions to return
|
||||
an `size_t` instead of an `int`. But given that this commit may be part
|
||||
of a security release, let's instead do the minimal viable fix and die
|
||||
in case we see an overflow.
|
||||
|
||||
Add a test that would have previously caused us to crash.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/937b71cc8b5b998963a7f9a33312ba3549d55510]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 8 ++++++++
|
||||
utf8.c | 12 +++++++++---
|
||||
2 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 261a6f0..de15007 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -843,4 +843,12 @@ test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit mes
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message does not cause allocation failure' '
|
||||
+ test_must_fail git log -1 --format="%<(1)%B" $huge_commit 2>error &&
|
||||
+ cat >expect <<-EOF &&
|
||||
+ fatal: number too large to represent as int on this platform: 2147483649
|
||||
+ EOF
|
||||
+ test_cmp expect error
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 6632bd2..03be475 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -208,11 +208,12 @@ int utf8_width(const char **start, size_t *remainder_p)
|
||||
*/
|
||||
int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
{
|
||||
- int width = 0;
|
||||
const char *orig = string;
|
||||
+ size_t width = 0;
|
||||
|
||||
while (string && string < orig + len) {
|
||||
- int glyph_width, skip;
|
||||
+ int glyph_width;
|
||||
+ size_t skip;
|
||||
|
||||
while (skip_ansi &&
|
||||
(skip = display_mode_esc_sequence_len(string)) != 0)
|
||||
@@ -222,7 +223,12 @@ int utf8_strnwidth(const char *string, size_t len, int skip_ansi)
|
||||
if (glyph_width > 0)
|
||||
width += glyph_width;
|
||||
}
|
||||
- return string ? width : len;
|
||||
+
|
||||
+ /*
|
||||
+ * TODO: fix the interface of this function and `utf8_strwidth()` to
|
||||
+ * return `size_t` instead of `int`.
|
||||
+ */
|
||||
+ return cast_size_t_to_int(string ? width : len);
|
||||
}
|
||||
|
||||
int utf8_strwidth(const char *string)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
99
meta/recipes-devtools/git/files/CVE-2022-41903-10.patch
Normal file
99
meta/recipes-devtools/git/files/CVE-2022-41903-10.patch
Normal file
@@ -0,0 +1,99 @@
|
||||
From 81c2d4c3a5ba0e6ab8c348708441fed170e63a82 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:10 +0100
|
||||
Subject: [PATCH 10/12] utf8: fix checking for glyph width in strbuf_utf8_replace()
|
||||
|
||||
In `strbuf_utf8_replace()`, we call `utf8_width()` to compute the width
|
||||
of the current glyph. If the glyph is a control character though it can
|
||||
be that `utf8_width()` returns `-1`, but because we assign this value to
|
||||
a `size_t` the conversion will cause us to underflow. This bug can
|
||||
easily be triggered with the following command:
|
||||
|
||||
$ git log --pretty='format:xxx%<|(1,trunc)%x10'
|
||||
|
||||
>From all I can see though this seems to be a benign underflow that has
|
||||
no security-related consequences.
|
||||
|
||||
Fix the bug by using an `int` instead. When we see a control character,
|
||||
we now copy it into the target buffer but don't advance the current
|
||||
width of the string.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/81c2d4c3a5ba0e6ab8c348708441fed170e63a82]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
t/t4205-log-pretty-formats.sh | 7 +++++++
|
||||
utf8.c | 19 ++++++++++++++-----
|
||||
2 files changed, 21 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index de15007..52c8bc8 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -826,6 +826,13 @@ test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
+test_expect_success 'log --pretty truncation with control chars' '
|
||||
+ test_commit "$(printf "\20\20\20\20xxxx")" file contents commit-with-control-chars &&
|
||||
+ printf "\20\20\20\20x.." >expect &&
|
||||
+ git log -1 --pretty="format:%<(3,trunc)%s" commit-with-control-chars >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'log --pretty with huge commit message' '
|
||||
# We only assert that this command does not crash. This needs to be
|
||||
# executed with the address sanitizer to demonstrate failure.
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index 03be475..ec03e69 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -377,6 +377,7 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
dst = sb_dst.buf;
|
||||
|
||||
while (src < end) {
|
||||
+ int glyph_width;
|
||||
char *old;
|
||||
size_t n;
|
||||
|
||||
@@ -390,21 +391,29 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
break;
|
||||
|
||||
old = src;
|
||||
- n = utf8_width((const char**)&src, NULL);
|
||||
- if (!src) /* broken utf-8, do nothing */
|
||||
+ glyph_width = utf8_width((const char**)&src, NULL);
|
||||
+ if (!src) /* broken utf-8, do nothing */
|
||||
goto out;
|
||||
- if (n && w >= pos && w < pos + width) {
|
||||
+
|
||||
+ /*
|
||||
+ * In case we see a control character we copy it into the
|
||||
+ * buffer, but don't add it to the width.
|
||||
+ */
|
||||
+ if (glyph_width < 0)
|
||||
+ glyph_width = 0;
|
||||
+
|
||||
+ if (glyph_width && w >= pos && w < pos + width) {
|
||||
if (subst) {
|
||||
memcpy(dst, subst, subst_len);
|
||||
dst += subst_len;
|
||||
subst = NULL;
|
||||
}
|
||||
- w += n;
|
||||
+ w += glyph_width;
|
||||
continue;
|
||||
}
|
||||
memcpy(dst, old, src - old);
|
||||
dst += src - old;
|
||||
- w += n;
|
||||
+ w += glyph_width;
|
||||
}
|
||||
strbuf_setlen(&sb_dst, dst - sb_dst.buf);
|
||||
strbuf_swap(sb_src, &sb_dst);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
90
meta/recipes-devtools/git/files/CVE-2022-41903-11.patch
Normal file
90
meta/recipes-devtools/git/files/CVE-2022-41903-11.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From f930a2394303b902e2973f4308f96529f736b8bc Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:15 +0100
|
||||
Subject: [PATCH 11/12] utf8: refactor strbuf_utf8_replace to not rely on preallocated buffer
|
||||
|
||||
In `strbuf_utf8_replace`, we preallocate the destination buffer and then
|
||||
use `memcpy` to copy bytes into it at computed offsets. This feels
|
||||
rather fragile and is hard to understand at times. Refactor the code to
|
||||
instead use `strbuf_add` and `strbuf_addstr` so that we can be sure that
|
||||
there is no possibility to perform an out-of-bounds write.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/f930a2394303b902e2973f4308f96529f736b8bc]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
utf8.c | 34 +++++++++++++---------------------
|
||||
1 file changed, 13 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/utf8.c b/utf8.c
|
||||
index ec03e69..a13f5e3 100644
|
||||
--- a/utf8.c
|
||||
+++ b/utf8.c
|
||||
@@ -365,26 +365,20 @@ void strbuf_add_wrapped_bytes(struct strbuf *buf, const char *data, int len,
|
||||
void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
const char *subst)
|
||||
{
|
||||
- struct strbuf sb_dst = STRBUF_INIT;
|
||||
- char *src = sb_src->buf;
|
||||
- char *end = src + sb_src->len;
|
||||
- char *dst;
|
||||
- int w = 0, subst_len = 0;
|
||||
+ const char *src = sb_src->buf, *end = sb_src->buf + sb_src->len;
|
||||
+ struct strbuf dst;
|
||||
+ int w = 0;
|
||||
|
||||
- if (subst)
|
||||
- subst_len = strlen(subst);
|
||||
- strbuf_grow(&sb_dst, sb_src->len + subst_len);
|
||||
- dst = sb_dst.buf;
|
||||
+ strbuf_init(&dst, sb_src->len);
|
||||
|
||||
while (src < end) {
|
||||
+ const char *old;
|
||||
int glyph_width;
|
||||
- char *old;
|
||||
size_t n;
|
||||
|
||||
while ((n = display_mode_esc_sequence_len(src))) {
|
||||
- memcpy(dst, src, n);
|
||||
+ strbuf_add(&dst, src, n);
|
||||
src += n;
|
||||
- dst += n;
|
||||
}
|
||||
|
||||
if (src >= end)
|
||||
@@ -404,21 +398,19 @@ void strbuf_utf8_replace(struct strbuf *sb_src, int pos, int width,
|
||||
|
||||
if (glyph_width && w >= pos && w < pos + width) {
|
||||
if (subst) {
|
||||
- memcpy(dst, subst, subst_len);
|
||||
- dst += subst_len;
|
||||
+ strbuf_addstr(&dst, subst);
|
||||
subst = NULL;
|
||||
}
|
||||
- w += glyph_width;
|
||||
- continue;
|
||||
+ } else {
|
||||
+ strbuf_add(&dst, old, src - old);
|
||||
}
|
||||
- memcpy(dst, old, src - old);
|
||||
- dst += src - old;
|
||||
+
|
||||
w += glyph_width;
|
||||
}
|
||||
- strbuf_setlen(&sb_dst, dst - sb_dst.buf);
|
||||
- strbuf_swap(sb_src, &sb_dst);
|
||||
+
|
||||
+ strbuf_swap(sb_src, &dst);
|
||||
out:
|
||||
- strbuf_release(&sb_dst);
|
||||
+ strbuf_release(&dst);
|
||||
}
|
||||
|
||||
/*
|
||||
--
|
||||
2.25.1
|
||||
|
||||
124
meta/recipes-devtools/git/files/CVE-2022-41903-12.patch
Normal file
124
meta/recipes-devtools/git/files/CVE-2022-41903-12.patch
Normal file
@@ -0,0 +1,124 @@
|
||||
From 304a50adff6480ede46b68f7545baab542cbfb46 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Steinhardt <ps@pks.im>
|
||||
Date: Thu, 1 Dec 2022 15:47:23 +0100
|
||||
Subject: [PATCH 12/12] pretty: restrict input lengths for padding and wrapping formats
|
||||
|
||||
Both the padding and wrapping formatting directives allow the caller to
|
||||
specify an integer that ultimately leads to us adding this many chars to
|
||||
the result buffer. As a consequence, it is trivial to e.g. allocate 2GB
|
||||
of RAM via a single formatting directive and cause resource exhaustion
|
||||
on the machine executing this logic. Furthermore, it is debatable
|
||||
whether there are any sane usecases that require the user to pad data to
|
||||
2GB boundaries or to indent wrapped data by 2GB.
|
||||
|
||||
Restrict the input sizes to 16 kilobytes at a maximum to limit the
|
||||
amount of bytes that can be requested by the user. This is not meant
|
||||
as a fix because there are ways to trivially amplify the amount of
|
||||
data we generate via formatting directives; the real protection is
|
||||
achieved by the changes in previous steps to catch and avoid integer
|
||||
wraparound that causes us to under-allocate and access beyond the
|
||||
end of allocated memory reagions. But having such a limit
|
||||
significantly helps fuzzing the pretty format, because the fuzzer is
|
||||
otherwise quite fast to run out-of-memory as it discovers these
|
||||
formatters.
|
||||
|
||||
Signed-off-by: Patrick Steinhardt <ps@pks.im>
|
||||
Signed-off-by: Junio C Hamano <gitster@pobox.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/304a50adff6480ede46b68f7545baab542cbfb46]
|
||||
CVE: CVE-2022-41903
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
pretty.c | 26 ++++++++++++++++++++++++++
|
||||
t/t4205-log-pretty-formats.sh | 24 +++++++++++++++---------
|
||||
2 files changed, 41 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/pretty.c b/pretty.c
|
||||
index c3c1443..e9687f0 100644
|
||||
--- a/pretty.c
|
||||
+++ b/pretty.c
|
||||
@@ -13,6 +13,13 @@
|
||||
#include "gpg-interface.h"
|
||||
#include "trailer.h"
|
||||
|
||||
+/*
|
||||
+ * The limit for formatting directives, which enable the caller to append
|
||||
+ * arbitrarily many bytes to the formatted buffer. This includes padding
|
||||
+ * and wrapping formatters.
|
||||
+ */
|
||||
+#define FORMATTING_LIMIT (16 * 1024)
|
||||
+
|
||||
static char *user_format;
|
||||
static struct cmt_fmt_map {
|
||||
const char *name;
|
||||
@@ -1029,6 +1036,15 @@ static size_t parse_padding_placeholder(const char *placeholder,
|
||||
if (!*end || end == start)
|
||||
return 0;
|
||||
width = strtol(start, &next, 10);
|
||||
+
|
||||
+ /*
|
||||
+ * We need to limit the amount of padding, or otherwise this
|
||||
+ * would allow the user to pad the buffer by arbitrarily many
|
||||
+ * bytes and thus cause resource exhaustion.
|
||||
+ */
|
||||
+ if (width < -FORMATTING_LIMIT || width > FORMATTING_LIMIT)
|
||||
+ return 0;
|
||||
+
|
||||
if (next == start || width == 0)
|
||||
return 0;
|
||||
if (width < 0) {
|
||||
@@ -1188,6 +1204,16 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
||||
if (*next != ')')
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * We need to limit the format here as it allows the
|
||||
+ * user to prepend arbitrarily many bytes to the buffer
|
||||
+ * when rewrapping.
|
||||
+ */
|
||||
+ if (width > FORMATTING_LIMIT ||
|
||||
+ indent1 > FORMATTING_LIMIT ||
|
||||
+ indent2 > FORMATTING_LIMIT)
|
||||
+ return 0;
|
||||
rewrap_message_tail(sb, c, width, indent1, indent2);
|
||||
return end - placeholder + 1;
|
||||
} else
|
||||
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
|
||||
index 52c8bc8..572d02f 100755
|
||||
--- a/t/t4205-log-pretty-formats.sh
|
||||
+++ b/t/t4205-log-pretty-formats.sh
|
||||
@@ -809,15 +809,21 @@ test_expect_success 'log --pretty with magical wrapping directives' '
|
||||
'
|
||||
|
||||
test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing wrapping directive' '
|
||||
- cat >expect <<-EOF &&
|
||||
- fatal: number too large to represent as int on this platform: 2147483649
|
||||
- EOF
|
||||
- test_must_fail git log -1 --pretty="format:%w(2147483649,1,1)%d" 2>error &&
|
||||
- test_cmp expect error &&
|
||||
- test_must_fail git log -1 --pretty="format:%w(1,2147483649,1)%d" 2>error &&
|
||||
- test_cmp expect error &&
|
||||
- test_must_fail git log -1 --pretty="format:%w(1,1,2147483649)%d" 2>error &&
|
||||
- test_cmp expect error
|
||||
+ printf "%%w(2147483649,1,1)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(2147483649,1,1)%x30" >actual &&
|
||||
+ test_cmp expect actual &&
|
||||
+ printf "%%w(1,2147483649,1)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1,2147483649,1)%x30" >actual &&
|
||||
+ test_cmp expect actual &&
|
||||
+ printf "%%w(1,1,2147483649)0" >expect &&
|
||||
+ git log -1 --pretty="format:%w(1,1,2147483649)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
+'
|
||||
+
|
||||
+test_expect_success SIZE_T_IS_64BIT 'log --pretty with overflowing padding directive' '
|
||||
+ printf "%%<(2147483649)0" >expect &&
|
||||
+ git log -1 --pretty="format:%<(2147483649)%x30" >actual &&
|
||||
+ test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'log --pretty with padding and preceding control chars' '
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -11,8 +11,20 @@ SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
|
||||
${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages \
|
||||
file://fixsort.patch \
|
||||
file://CVE-2021-40330.patch \
|
||||
file://CVE-2022-23521.patch \
|
||||
file://CVE-2022-41903-01.patch \
|
||||
file://CVE-2022-41903-02.patch \
|
||||
file://CVE-2022-41903-03.patch \
|
||||
file://CVE-2022-41903-04.patch \
|
||||
file://CVE-2022-41903-05.patch \
|
||||
file://CVE-2022-41903-06.patch \
|
||||
file://CVE-2022-41903-07.patch \
|
||||
file://CVE-2022-41903-08.patch \
|
||||
file://CVE-2022-41903-09.patch \
|
||||
file://CVE-2022-41903-10.patch \
|
||||
file://CVE-2022-41903-11.patch \
|
||||
file://CVE-2022-41903-12.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git-${PV}"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1"
|
||||
@@ -23,6 +35,8 @@ CVE_PRODUCT = "git-scm:git"
|
||||
# in mirrored git repos. Most OE users wouldn't build the docs and
|
||||
# we don't see this as a major issue for our general users/usecases.
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-24975"
|
||||
# This is specific to Git-for-Windows
|
||||
CVE_CHECK_WHITELIST += "CVE-2022-41953"
|
||||
|
||||
PACKAGECONFIG ??= ""
|
||||
PACKAGECONFIG[cvsserver] = ""
|
||||
|
||||
@@ -51,6 +51,7 @@ SRC_URI += "\
|
||||
file://CVE-2022-28327.patch \
|
||||
file://CVE-2022-41715.patch \
|
||||
file://CVE-2022-41717.patch \
|
||||
file://CVE-2022-1962.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
357
meta/recipes-devtools/go/go-1.14/CVE-2022-1962.patch
Normal file
357
meta/recipes-devtools/go/go-1.14/CVE-2022-1962.patch
Normal file
@@ -0,0 +1,357 @@
|
||||
From ba8788ebcead55e99e631c6a1157ad7b35535d11 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Wed, 15 Jun 2022 10:43:05 -0700
|
||||
Subject: [PATCH] [release-branch.go1.17] go/parser: limit recursion depth
|
||||
|
||||
Limit nested parsing to 100,000, which prevents stack exhaustion when
|
||||
parsing deeply nested statements, types, and expressions. Also limit
|
||||
the scope depth to 1,000 during object resolution.
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Fixes #53707
|
||||
Updates #53616
|
||||
Fixes CVE-2022-1962
|
||||
|
||||
Change-Id: I4d7b86c1d75d0bf3c7af1fdea91582aa74272c64
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1491025
|
||||
Reviewed-by: Russ Cox <rsc@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
(cherry picked from commit 6a856f08d58e4b6705c0c337d461c540c1235c83)
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/417070
|
||||
Reviewed-by: Heschi Kreinick <heschi@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Run-TryBot: Michael Knyszek <mknyszek@google.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/ba8788ebcead55e99e631c6a1157ad7b35535d11]
|
||||
CVE: CVE-2022-1962
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
src/go/parser/interface.go | 10 ++-
|
||||
src/go/parser/parser.go | 48 ++++++++--
|
||||
src/go/parser/parser_test.go | 169 +++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 220 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/go/parser/interface.go b/src/go/parser/interface.go
|
||||
index 54f9d7b..537b327 100644
|
||||
--- a/src/go/parser/interface.go
|
||||
+++ b/src/go/parser/interface.go
|
||||
@@ -92,8 +92,11 @@ func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode)
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
// resume same panic if it's not a bailout
|
||||
- if _, ok := e.(bailout); !ok {
|
||||
+ bail, ok := e.(bailout)
|
||||
+ if !ok {
|
||||
panic(e)
|
||||
+ } else if bail.msg != "" {
|
||||
+ p.errors.Add(p.file.Position(bail.pos), bail.msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,8 +191,11 @@ func ParseExprFrom(fset *token.FileSet, filename string, src interface{}, mode M
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
// resume same panic if it's not a bailout
|
||||
- if _, ok := e.(bailout); !ok {
|
||||
+ bail, ok := e.(bailout)
|
||||
+ if !ok {
|
||||
panic(e)
|
||||
+ } else if bail.msg != "" {
|
||||
+ p.errors.Add(p.file.Position(bail.pos), bail.msg)
|
||||
}
|
||||
}
|
||||
p.errors.Sort()
|
||||
diff --git a/src/go/parser/parser.go b/src/go/parser/parser.go
|
||||
index 31a7398..586fe90 100644
|
||||
--- a/src/go/parser/parser.go
|
||||
+++ b/src/go/parser/parser.go
|
||||
@@ -64,6 +64,10 @@ type parser struct {
|
||||
unresolved []*ast.Ident // unresolved identifiers
|
||||
imports []*ast.ImportSpec // list of imports
|
||||
|
||||
+ // nestLev is used to track and limit the recursion depth
|
||||
+ // during parsing.
|
||||
+ nestLev int
|
||||
+
|
||||
// Label scopes
|
||||
// (maintained by open/close LabelScope)
|
||||
labelScope *ast.Scope // label scope for current function
|
||||
@@ -236,6 +240,24 @@ func un(p *parser) {
|
||||
p.printTrace(")")
|
||||
}
|
||||
|
||||
+// maxNestLev is the deepest we're willing to recurse during parsing
|
||||
+const maxNestLev int = 1e5
|
||||
+
|
||||
+func incNestLev(p *parser) *parser {
|
||||
+ p.nestLev++
|
||||
+ if p.nestLev > maxNestLev {
|
||||
+ p.error(p.pos, "exceeded max nesting depth")
|
||||
+ panic(bailout{})
|
||||
+ }
|
||||
+ return p
|
||||
+}
|
||||
+
|
||||
+// decNestLev is used to track nesting depth during parsing to prevent stack exhaustion.
|
||||
+// It is used along with incNestLev in a similar fashion to how un and trace are used.
|
||||
+func decNestLev(p *parser) {
|
||||
+ p.nestLev--
|
||||
+}
|
||||
+
|
||||
// Advance to the next token.
|
||||
func (p *parser) next0() {
|
||||
// Because of one-token look-ahead, print the previous token
|
||||
@@ -348,8 +370,12 @@ func (p *parser) next() {
|
||||
}
|
||||
}
|
||||
|
||||
-// A bailout panic is raised to indicate early termination.
|
||||
-type bailout struct{}
|
||||
+// A bailout panic is raised to indicate early termination. pos and msg are
|
||||
+// only populated when bailing out of object resolution.
|
||||
+type bailout struct {
|
||||
+ pos token.Pos
|
||||
+ msg string
|
||||
+}
|
||||
|
||||
func (p *parser) error(pos token.Pos, msg string) {
|
||||
epos := p.file.Position(pos)
|
||||
@@ -1030,6 +1056,8 @@ func (p *parser) parseChanType() *ast.ChanType {
|
||||
|
||||
// If the result is an identifier, it is not resolved.
|
||||
func (p *parser) tryIdentOrType() ast.Expr {
|
||||
+ defer decNestLev(incNestLev(p))
|
||||
+
|
||||
switch p.tok {
|
||||
case token.IDENT:
|
||||
return p.parseTypeName()
|
||||
@@ -1609,7 +1637,13 @@ func (p *parser) parseBinaryExpr(lhs bool, prec1 int) ast.Expr {
|
||||
}
|
||||
|
||||
x := p.parseUnaryExpr(lhs)
|
||||
- for {
|
||||
+ // We track the nesting here rather than at the entry for the function,
|
||||
+ // since it can iteratively produce a nested output, and we want to
|
||||
+ // limit how deep a structure we generate.
|
||||
+ var n int
|
||||
+ defer func() { p.nestLev -= n }()
|
||||
+ for n = 1; ; n++ {
|
||||
+ incNestLev(p)
|
||||
op, oprec := p.tokPrec()
|
||||
if oprec < prec1 {
|
||||
return x
|
||||
@@ -1628,7 +1662,7 @@ func (p *parser) parseBinaryExpr(lhs bool, prec1 int) ast.Expr {
|
||||
// The result may be a type or even a raw type ([...]int). Callers must
|
||||
// check the result (using checkExpr or checkExprOrType), depending on
|
||||
// context.
|
||||
-func (p *parser) parseExpr(lhs bool) ast.Expr {
|
||||
+func (p *parser) parseExpr(lhs bool) ast.Expr {
|
||||
if p.trace {
|
||||
defer un(trace(p, "Expression"))
|
||||
}
|
||||
@@ -1899,6 +1933,8 @@ func (p *parser) parseIfHeader() (init ast.Stmt, cond ast.Expr) {
|
||||
}
|
||||
|
||||
func (p *parser) parseIfStmt() *ast.IfStmt {
|
||||
+ defer decNestLev(incNestLev(p))
|
||||
+
|
||||
if p.trace {
|
||||
defer un(trace(p, "IfStmt"))
|
||||
}
|
||||
@@ -2214,6 +2250,8 @@ func (p *parser) parseForStmt() ast.Stmt {
|
||||
}
|
||||
|
||||
func (p *parser) parseStmt() (s ast.Stmt) {
|
||||
+ defer decNestLev(incNestLev(p))
|
||||
+
|
||||
if p.trace {
|
||||
defer un(trace(p, "Statement"))
|
||||
}
|
||||
diff --git a/src/go/parser/parser_test.go b/src/go/parser/parser_test.go
|
||||
index 25a374e..37a6a2b 100644
|
||||
--- a/src/go/parser/parser_test.go
|
||||
+++ b/src/go/parser/parser_test.go
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"go/ast"
|
||||
"go/token"
|
||||
"os"
|
||||
+ "runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -569,3 +570,171 @@ type x int // comment
|
||||
t.Errorf("got %q, want %q", comment, "// comment")
|
||||
}
|
||||
}
|
||||
+
|
||||
+var parseDepthTests = []struct {
|
||||
+ name string
|
||||
+ format string
|
||||
+ // multipler is used when a single statement may result in more than one
|
||||
+ // change in the depth level, for instance "1+(..." produces a BinaryExpr
|
||||
+ // followed by a UnaryExpr, which increments the depth twice. The test
|
||||
+ // case comment explains which nodes are triggering the multiple depth
|
||||
+ // changes.
|
||||
+ parseMultiplier int
|
||||
+ // scope is true if we should also test the statement for the resolver scope
|
||||
+ // depth limit.
|
||||
+ scope bool
|
||||
+ // scopeMultiplier does the same as parseMultiplier, but for the scope
|
||||
+ // depths.
|
||||
+ scopeMultiplier int
|
||||
+}{
|
||||
+ // The format expands the part inside « » many times.
|
||||
+ // A second set of brackets nested inside the first stops the repetition,
|
||||
+ // so that for example «(«1»)» expands to (((...((((1))))...))).
|
||||
+ {name: "array", format: "package main; var x «[1]»int"},
|
||||
+ {name: "slice", format: "package main; var x «[]»int"},
|
||||
+ {name: "struct", format: "package main; var x «struct { X «int» }»", scope: true},
|
||||
+ {name: "pointer", format: "package main; var x «*»int"},
|
||||
+ {name: "func", format: "package main; var x «func()»int", scope: true},
|
||||
+ {name: "chan", format: "package main; var x «chan »int"},
|
||||
+ {name: "chan2", format: "package main; var x «<-chan »int"},
|
||||
+ {name: "interface", format: "package main; var x «interface { M() «int» }»", scope: true, scopeMultiplier: 2}, // Scopes: InterfaceType, FuncType
|
||||
+ {name: "map", format: "package main; var x «map[int]»int"},
|
||||
+ {name: "slicelit", format: "package main; var x = «[]any{«»}»", parseMultiplier: 2}, // Parser nodes: UnaryExpr, CompositeLit
|
||||
+ {name: "arraylit", format: "package main; var x = «[1]any{«nil»}»", parseMultiplier: 2}, // Parser nodes: UnaryExpr, CompositeLit
|
||||
+ {name: "structlit", format: "package main; var x = «struct{x any}{«nil»}»", parseMultiplier: 2}, // Parser nodes: UnaryExpr, CompositeLit
|
||||
+ {name: "maplit", format: "package main; var x = «map[int]any{1:«nil»}»", parseMultiplier: 2}, // Parser nodes: CompositeLit, KeyValueExpr
|
||||
+ {name: "dot", format: "package main; var x = «x.»x"},
|
||||
+ {name: "index", format: "package main; var x = x«[1]»"},
|
||||
+ {name: "slice", format: "package main; var x = x«[1:2]»"},
|
||||
+ {name: "slice3", format: "package main; var x = x«[1:2:3]»"},
|
||||
+ {name: "dottype", format: "package main; var x = x«.(any)»"},
|
||||
+ {name: "callseq", format: "package main; var x = x«()»"},
|
||||
+ {name: "methseq", format: "package main; var x = x«.m()»", parseMultiplier: 2}, // Parser nodes: SelectorExpr, CallExpr
|
||||
+ {name: "binary", format: "package main; var x = «1+»1"},
|
||||
+ {name: "binaryparen", format: "package main; var x = «1+(«1»)»", parseMultiplier: 2}, // Parser nodes: BinaryExpr, ParenExpr
|
||||
+ {name: "unary", format: "package main; var x = «^»1"},
|
||||
+ {name: "addr", format: "package main; var x = «& »x"},
|
||||
+ {name: "star", format: "package main; var x = «*»x"},
|
||||
+ {name: "recv", format: "package main; var x = «<-»x"},
|
||||
+ {name: "call", format: "package main; var x = «f(«1»)»", parseMultiplier: 2}, // Parser nodes: Ident, CallExpr
|
||||
+ {name: "conv", format: "package main; var x = «(*T)(«1»)»", parseMultiplier: 2}, // Parser nodes: ParenExpr, CallExpr
|
||||
+ {name: "label", format: "package main; func main() { «Label:» }"},
|
||||
+ {name: "if", format: "package main; func main() { «if true { «» }»}", parseMultiplier: 2, scope: true, scopeMultiplier: 2}, // Parser nodes: IfStmt, BlockStmt. Scopes: IfStmt, BlockStmt
|
||||
+ {name: "ifelse", format: "package main; func main() { «if true {} else » {} }", scope: true},
|
||||
+ {name: "switch", format: "package main; func main() { «switch { default: «» }»}", scope: true, scopeMultiplier: 2}, // Scopes: TypeSwitchStmt, CaseClause
|
||||
+ {name: "typeswitch", format: "package main; func main() { «switch x.(type) { default: «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: TypeSwitchStmt, CaseClause
|
||||
+ {name: "for0", format: "package main; func main() { «for { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: ForStmt, BlockStmt
|
||||
+ {name: "for1", format: "package main; func main() { «for x { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: ForStmt, BlockStmt
|
||||
+ {name: "for3", format: "package main; func main() { «for f(); g(); h() { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: ForStmt, BlockStmt
|
||||
+ {name: "forrange0", format: "package main; func main() { «for range x { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: RangeStmt, BlockStmt
|
||||
+ {name: "forrange1", format: "package main; func main() { «for x = range z { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: RangeStmt, BlockStmt
|
||||
+ {name: "forrange2", format: "package main; func main() { «for x, y = range z { «» }» }", scope: true, scopeMultiplier: 2}, // Scopes: RangeStmt, BlockStmt
|
||||
+ {name: "go", format: "package main; func main() { «go func() { «» }()» }", parseMultiplier: 2, scope: true}, // Parser nodes: GoStmt, FuncLit
|
||||
+ {name: "defer", format: "package main; func main() { «defer func() { «» }()» }", parseMultiplier: 2, scope: true}, // Parser nodes: DeferStmt, FuncLit
|
||||
+ {name: "select", format: "package main; func main() { «select { default: «» }» }", scope: true},
|
||||
+}
|
||||
+
|
||||
+// split splits pre«mid»post into pre, mid, post.
|
||||
+// If the string does not have that form, split returns x, "", "".
|
||||
+func split(x string) (pre, mid, post string) {
|
||||
+ start, end := strings.Index(x, "«"), strings.LastIndex(x, "»")
|
||||
+ if start < 0 || end < 0 {
|
||||
+ return x, "", ""
|
||||
+ }
|
||||
+ return x[:start], x[start+len("«") : end], x[end+len("»"):]
|
||||
+}
|
||||
+
|
||||
+func TestParseDepthLimit(t *testing.T) {
|
||||
+ if runtime.GOARCH == "wasm" {
|
||||
+ t.Skip("causes call stack exhaustion on js/wasm")
|
||||
+ }
|
||||
+ for _, tt := range parseDepthTests {
|
||||
+ for _, size := range []string{"small", "big"} {
|
||||
+ t.Run(tt.name+"/"+size, func(t *testing.T) {
|
||||
+ n := maxNestLev + 1
|
||||
+ if tt.parseMultiplier > 0 {
|
||||
+ n /= tt.parseMultiplier
|
||||
+ }
|
||||
+ if size == "small" {
|
||||
+ // Decrease the number of statements by 10, in order to check
|
||||
+ // that we do not fail when under the limit. 10 is used to
|
||||
+ // provide some wiggle room for cases where the surrounding
|
||||
+ // scaffolding syntax adds some noise to the depth that changes
|
||||
+ // on a per testcase basis.
|
||||
+ n -= 10
|
||||
+ }
|
||||
+
|
||||
+ pre, mid, post := split(tt.format)
|
||||
+ if strings.Contains(mid, "«") {
|
||||
+ left, base, right := split(mid)
|
||||
+ mid = strings.Repeat(left, n) + base + strings.Repeat(right, n)
|
||||
+ } else {
|
||||
+ mid = strings.Repeat(mid, n)
|
||||
+ }
|
||||
+ input := pre + mid + post
|
||||
+
|
||||
+ fset := token.NewFileSet()
|
||||
+ _, err := ParseFile(fset, "", input, ParseComments|SkipObjectResolution)
|
||||
+ if size == "small" {
|
||||
+ if err != nil {
|
||||
+ t.Errorf("ParseFile(...): %v (want success)", err)
|
||||
+ }
|
||||
+ } else {
|
||||
+ expected := "exceeded max nesting depth"
|
||||
+ if err == nil || !strings.HasSuffix(err.Error(), expected) {
|
||||
+ t.Errorf("ParseFile(...) = _, %v, want %q", err, expected)
|
||||
+ }
|
||||
+ }
|
||||
+ })
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+func TestScopeDepthLimit(t *testing.T) {
|
||||
+ if runtime.GOARCH == "wasm" {
|
||||
+ t.Skip("causes call stack exhaustion on js/wasm")
|
||||
+ }
|
||||
+ for _, tt := range parseDepthTests {
|
||||
+ if !tt.scope {
|
||||
+ continue
|
||||
+ }
|
||||
+ for _, size := range []string{"small", "big"} {
|
||||
+ t.Run(tt.name+"/"+size, func(t *testing.T) {
|
||||
+ n := maxScopeDepth + 1
|
||||
+ if tt.scopeMultiplier > 0 {
|
||||
+ n /= tt.scopeMultiplier
|
||||
+ }
|
||||
+ if size == "small" {
|
||||
+ // Decrease the number of statements by 10, in order to check
|
||||
+ // that we do not fail when under the limit. 10 is used to
|
||||
+ // provide some wiggle room for cases where the surrounding
|
||||
+ // scaffolding syntax adds some noise to the depth that changes
|
||||
+ // on a per testcase basis.
|
||||
+ n -= 10
|
||||
+ }
|
||||
+
|
||||
+ pre, mid, post := split(tt.format)
|
||||
+ if strings.Contains(mid, "«") {
|
||||
+ left, base, right := split(mid)
|
||||
+ mid = strings.Repeat(left, n) + base + strings.Repeat(right, n)
|
||||
+ } else {
|
||||
+ mid = strings.Repeat(mid, n)
|
||||
+ }
|
||||
+ input := pre + mid + post
|
||||
+
|
||||
+ fset := token.NewFileSet()
|
||||
+ _, err := ParseFile(fset, "", input, DeclarationErrors)
|
||||
+ if size == "small" {
|
||||
+ if err != nil {
|
||||
+ t.Errorf("ParseFile(...): %v (want success)", err)
|
||||
+ }
|
||||
+ } else {
|
||||
+ expected := "exceeded max scope depth during object resolution"
|
||||
+ if err == nil || !strings.HasSuffix(err.Error(), expected) {
|
||||
+ t.Errorf("ParseFile(...) = _, %v, want %q", err, expected)
|
||||
+ }
|
||||
+ }
|
||||
+ })
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -7,8 +7,8 @@ export CGO_ENABLED_riscv64 = ""
|
||||
# windows/mips/riscv doesn't support -buildmode=pie, so skip the QA checking
|
||||
# for windows/mips/riscv and their variants.
|
||||
python() {
|
||||
if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True) or 'windows' in d.getVar('TARGET_GOOS', True):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel")
|
||||
if 'mips' in d.getVar('TARGET_ARCH') or 'riscv' in d.getVar('TARGET_ARCH') or 'windows' in d.getVar('TARGET_GOOS'):
|
||||
d.appendVar('INSANE_SKIP_%s' % d.getVar('PN'), " textrel")
|
||||
else:
|
||||
d.setVar('GOBUILDMODE', 'pie')
|
||||
}
|
||||
|
||||
@@ -531,7 +531,9 @@
|
||||
"rdepends": [
|
||||
"core"
|
||||
],
|
||||
"files": [],
|
||||
"files": [
|
||||
"${libdir}/python${PYTHON_MAJMIN}/distutils/command/wininst-*.exe"
|
||||
],
|
||||
"cached": []
|
||||
},
|
||||
"distutils": {
|
||||
|
||||
@@ -9,7 +9,7 @@ DEPENDS = "glib-2.0-native zlib-native pixman-native qemu-native bison-native"
|
||||
|
||||
EXTRA_OECONF_append = " --target-list=${@get_qemu_system_target_list(d)}"
|
||||
|
||||
PACKAGECONFIG ??= "fdt alsa kvm"
|
||||
PACKAGECONFIG ??= "fdt alsa kvm slirp"
|
||||
|
||||
# Handle distros such as CentOS 5 32-bit that do not have kvm support
|
||||
PACKAGECONFIG_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
|
||||
|
||||
@@ -115,6 +115,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://CVE-2021-3638.patch \
|
||||
file://CVE-2021-20196.patch \
|
||||
file://CVE-2021-3507.patch \
|
||||
file://CVE-2021-3929.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
@@ -279,6 +280,8 @@ PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone"
|
||||
PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
|
||||
PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi"
|
||||
PACKAGECONFIG[vde] = "--enable-vde,--disable-vde"
|
||||
# version 4.2.0 doesn't have an "internal" option for enable-slirp, so use "git" which uses the same configure code path
|
||||
PACKAGECONFIG[slirp] = "--enable-slirp=git,--disable-slirp"
|
||||
PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd"
|
||||
PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma"
|
||||
|
||||
|
||||
78
meta/recipes-devtools/qemu/qemu/CVE-2021-3929.patch
Normal file
78
meta/recipes-devtools/qemu/qemu/CVE-2021-3929.patch
Normal file
@@ -0,0 +1,78 @@
|
||||
From 736b01642d85be832385063f278fe7cd4ffb5221 Mon Sep 17 00:00:00 2001
|
||||
From: Klaus Jensen <k.jensen@samsung.com>
|
||||
Date: Fri, 17 Dec 2021 10:44:01 +0100
|
||||
Subject: [PATCH] hw/nvme: fix CVE-2021-3929
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This fixes CVE-2021-3929 "locally" by denying DMA to the iomem of the
|
||||
device itself. This still allows DMA to MMIO regions of other devices
|
||||
(e.g. doing P2P DMA to the controller memory buffer of another NVMe
|
||||
device).
|
||||
|
||||
Fixes: CVE-2021-3929
|
||||
Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com>
|
||||
Reviewed-by: Keith Busch <kbusch@kernel.org>
|
||||
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
|
||||
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/736b01642d85be832385]
|
||||
CVE: CVE-2021-3929
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
hw/block/nvme.c | 23 +++++++++++++++++++++++
|
||||
hw/block/nvme.h | 1 +
|
||||
2 files changed, 24 insertions(+)
|
||||
|
||||
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
|
||||
index 12d82542..e7d0750c 100644
|
||||
--- a/hw/block/nvme.c
|
||||
+++ b/hw/block/nvme.c
|
||||
@@ -52,8 +52,31 @@
|
||||
|
||||
static void nvme_process_sq(void *opaque);
|
||||
|
||||
+static inline bool nvme_addr_is_iomem(NvmeCtrl *n, hwaddr addr)
|
||||
+{
|
||||
+ hwaddr hi, lo;
|
||||
+
|
||||
+ /*
|
||||
+ * The purpose of this check is to guard against invalid "local" access to
|
||||
+ * the iomem (i.e. controller registers). Thus, we check against the range
|
||||
+ * covered by the 'bar0' MemoryRegion since that is currently composed of
|
||||
+ * two subregions (the NVMe "MBAR" and the MSI-X table/pba). Note, however,
|
||||
+ * that if the device model is ever changed to allow the CMB to be located
|
||||
+ * in BAR0 as well, then this must be changed.
|
||||
+ */
|
||||
+ lo = n->bar0.addr;
|
||||
+ hi = lo + int128_get64(n->bar0.size);
|
||||
+
|
||||
+ return addr >= lo && addr < hi;
|
||||
+}
|
||||
+
|
||||
static void nvme_addr_read(NvmeCtrl *n, hwaddr addr, void *buf, int size)
|
||||
{
|
||||
+
|
||||
+ if (nvme_addr_is_iomem(n, addr)) {
|
||||
+ return NVME_DATA_TRAS_ERROR;
|
||||
+ }
|
||||
+
|
||||
if (n->cmbsz && addr >= n->ctrl_mem.addr &&
|
||||
addr < (n->ctrl_mem.addr + int128_get64(n->ctrl_mem.size))) {
|
||||
memcpy(buf, (void *)&n->cmbuf[addr - n->ctrl_mem.addr], size);
|
||||
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
|
||||
index 557194ee..5a2b119c 100644
|
||||
--- a/hw/block/nvme.h
|
||||
+++ b/hw/block/nvme.h
|
||||
@@ -59,6 +59,7 @@ typedef struct NvmeNamespace {
|
||||
|
||||
typedef struct NvmeCtrl {
|
||||
PCIDevice parent_obj;
|
||||
+ MemoryRegion bar0;
|
||||
MemoryRegion iomem;
|
||||
MemoryRegion ctrl_mem;
|
||||
NvmeBar bar;
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@@ -24,8 +24,8 @@ do_install_append_class-nativesdk() {
|
||||
}
|
||||
|
||||
PACKAGECONFIG ??= " \
|
||||
fdt sdl kvm \
|
||||
fdt sdl kvm slirp \
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'alsa xen', d)} \
|
||||
${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)} \
|
||||
"
|
||||
PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
|
||||
PACKAGECONFIG:class-nativesdk ??= "fdt sdl kvm slirp"
|
||||
|
||||
@@ -12,6 +12,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
|
||||
file://Makefile \
|
||||
file://test.sh \
|
||||
file://0001-tests-Allow-different-output-from-mv.patch \
|
||||
file://faildiff-order.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-target = " file://gnu_patch_test_fix_target.patch"
|
||||
|
||||
41
meta/recipes-devtools/quilt/quilt/faildiff-order.patch
Normal file
41
meta/recipes-devtools/quilt/quilt/faildiff-order.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Ross Burton <ross.burton@arm.com>
|
||||
|
||||
From 4dfe7f9e702c85243a71e4de267a13e434b6d6c2 Mon Sep 17 00:00:00 2001
|
||||
From: Jean Delvare <jdelvare@suse.de>
|
||||
Date: Fri, 20 Jan 2023 12:56:08 +0100
|
||||
Subject: [PATCH] test: Fix a race condition
|
||||
|
||||
The test suite does not differentiate between stdout and stderr. When
|
||||
messages are printed to both, the order in which they will reach us
|
||||
is apparently not guaranteed. Ideally this would be deterministic, but
|
||||
until then, explicitly test stdout and stderr separately in the test
|
||||
case itself. Otherwise the test suite fails randomly, which is a pain
|
||||
for distribution package maintainers.
|
||||
|
||||
This fixes bug #63651 reported by Ross Burton:
|
||||
https://savannah.nongnu.org/bugs/index.php?63651
|
||||
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
test/faildiff.test | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/faildiff.test b/test/faildiff.test
|
||||
index 5afb8e3..0444c15 100644
|
||||
--- a/test/faildiff.test
|
||||
+++ b/test/faildiff.test
|
||||
@@ -27,8 +27,9 @@ What happens on binary files?
|
||||
> File test.bin added to patch %{P}test.diff
|
||||
|
||||
$ printf "\\003\\000\\001" > test.bin
|
||||
- $ quilt diff -pab --no-index
|
||||
+ $ quilt diff -pab --no-index 2>/dev/null
|
||||
>~ (Files|Binary files) a/test\.bin and b/test\.bin differ
|
||||
+ $ quilt diff -pab --no-index >/dev/null
|
||||
> Diff failed on file 'test.bin', aborting
|
||||
$ echo %{?}
|
||||
> 1
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -22,7 +22,7 @@ inherit autotools pkgconfig
|
||||
EXTRA_OECONF = "--disable-gssapi"
|
||||
|
||||
do_install_append() {
|
||||
chown root:root ${D}${sysconfdir}/netconfig
|
||||
test -e ${D}${sysconfdir}/netconfig && chown root:root ${D}${sysconfdir}/netconfig
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
@@ -9,3 +9,7 @@ BBCLASSEXTEND = "native nativesdk"
|
||||
# Severity is low and marked as closed and won't fix.
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=884658
|
||||
CVE_CHECK_WHITELIST += "CVE-2013-4235"
|
||||
|
||||
# This is an issue for a different shadow
|
||||
CVE_CHECK_WHITELIST += "CVE-2016-15024"
|
||||
|
||||
|
||||
113
meta/recipes-extended/sudo/files/CVE-2023-22809.patch
Normal file
113
meta/recipes-extended/sudo/files/CVE-2023-22809.patch
Normal file
@@ -0,0 +1,113 @@
|
||||
Backport of:
|
||||
|
||||
# HG changeset patch
|
||||
# Parent 7275148cad1f8cd3c350026460acc4d6ad349c3a
|
||||
sudoedit: do not permit editor arguments to include "--"
|
||||
We use "--" to separate the editor and arguments from the files to edit.
|
||||
If the editor arguments include "--", sudo can be tricked into allowing
|
||||
the user to edit a file not permitted by the security policy.
|
||||
Thanks to Matthieu Barjole and Victor Cutillas of Synacktiv
|
||||
(https://synacktiv.com) for finding this bug.
|
||||
|
||||
CVE: CVE-2023-22809
|
||||
Upstream-Staus: Backport [http://archive.ubuntu.com/ubuntu/pool/main/s/sudo/sudo_1.8.31-1ubuntu1.4.debian.tar.xz]
|
||||
Signed-off-by: Omkar Patil <omkar.patil@kpit.com>
|
||||
|
||||
--- a/plugins/sudoers/editor.c
|
||||
+++ b/plugins/sudoers/editor.c
|
||||
@@ -56,7 +56,7 @@ resolve_editor(const char *ed, size_t ed
|
||||
const char *cp, *ep, *tmp;
|
||||
const char *edend = ed + edlen;
|
||||
struct stat user_editor_sb;
|
||||
- int nargc;
|
||||
+ int nargc = 0;
|
||||
debug_decl(resolve_editor, SUDOERS_DEBUG_UTIL)
|
||||
|
||||
/*
|
||||
@@ -102,6 +102,21 @@ resolve_editor(const char *ed, size_t ed
|
||||
free(editor_path);
|
||||
while (nargc--)
|
||||
free(nargv[nargc]);
|
||||
+ free(nargv);
|
||||
+ debug_return_str(NULL);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * We use "--" to separate the editor and arguments from the files
|
||||
+ * to edit. The editor arguments themselves may not contain "--".
|
||||
+ */
|
||||
+ if (strcmp(nargv[nargc], "--") == 0) {
|
||||
+ sudo_warnx(U_("ignoring editor: %.*s"), (int)edlen, ed);
|
||||
+ sudo_warnx("%s", U_("editor arguments may not contain \"--\""));
|
||||
+ errno = EINVAL;
|
||||
+ free(editor_path);
|
||||
+ while (nargc--)
|
||||
+ free(nargv[nargc]);
|
||||
free(nargv);
|
||||
debug_return_str(NULL);
|
||||
}
|
||||
--- a/plugins/sudoers/sudoers.c
|
||||
+++ b/plugins/sudoers/sudoers.c
|
||||
@@ -616,20 +616,31 @@ sudoers_policy_main(int argc, char * con
|
||||
|
||||
/* Note: must call audit before uid change. */
|
||||
if (ISSET(sudo_mode, MODE_EDIT)) {
|
||||
+ const char *env_editor = NULL;
|
||||
int edit_argc;
|
||||
- const char *env_editor;
|
||||
|
||||
free(safe_cmnd);
|
||||
safe_cmnd = find_editor(NewArgc - 1, NewArgv + 1, &edit_argc,
|
||||
&edit_argv, NULL, &env_editor, false);
|
||||
if (safe_cmnd == NULL) {
|
||||
- if (errno != ENOENT)
|
||||
+ switch (errno) {
|
||||
+ case ENOENT:
|
||||
+ audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
+ env_editor ? env_editor : def_editor);
|
||||
+ sudo_warnx(U_("%s: command not found"),
|
||||
+ env_editor ? env_editor : def_editor);
|
||||
+ goto bad;
|
||||
+ case EINVAL:
|
||||
+ if (def_env_editor && env_editor != NULL) {
|
||||
+ /* User tried to do something funny with the editor. */
|
||||
+ log_warningx(SLOG_NO_STDERR|SLOG_SEND_MAIL,
|
||||
+ "invalid user-specified editor: %s", env_editor);
|
||||
+ goto bad;
|
||||
+ }
|
||||
+ /* FALLTHROUGH */
|
||||
+ default:
|
||||
goto done;
|
||||
- audit_failure(NewArgc, NewArgv, N_("%s: command not found"),
|
||||
- env_editor ? env_editor : def_editor);
|
||||
- sudo_warnx(U_("%s: command not found"),
|
||||
- env_editor ? env_editor : def_editor);
|
||||
- goto bad;
|
||||
+ }
|
||||
}
|
||||
if (audit_success(edit_argc, edit_argv) != 0 && !def_ignore_audit_errors)
|
||||
goto done;
|
||||
--- a/plugins/sudoers/visudo.c
|
||||
+++ b/plugins/sudoers/visudo.c
|
||||
@@ -308,7 +308,7 @@ static char *
|
||||
get_editor(int *editor_argc, char ***editor_argv)
|
||||
{
|
||||
char *editor_path = NULL, **whitelist = NULL;
|
||||
- const char *env_editor;
|
||||
+ const char *env_editor = NULL;
|
||||
static char *files[] = { "+1", "sudoers" };
|
||||
unsigned int whitelist_len = 0;
|
||||
debug_decl(get_editor, SUDOERS_DEBUG_UTIL)
|
||||
@@ -342,7 +342,11 @@ get_editor(int *editor_argc, char ***edi
|
||||
if (editor_path == NULL) {
|
||||
if (def_env_editor && env_editor != NULL) {
|
||||
/* We are honoring $EDITOR so this is a fatal error. */
|
||||
- sudo_fatalx(U_("specified editor (%s) doesn't exist"), env_editor);
|
||||
+ if (errno == ENOENT) {
|
||||
+ sudo_warnx(U_("specified editor (%s) doesn't exist"),
|
||||
+ env_editor);
|
||||
+ }
|
||||
+ exit(EXIT_FAILURE);
|
||||
}
|
||||
sudo_fatalx(U_("no editor found (editor path = %s)"), def_editor);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ SRC_URI = "https://www.sudo.ws/dist/sudo-${PV}.tar.gz \
|
||||
file://0001-Include-sys-types.h-for-id_t-definition.patch \
|
||||
file://0001-Fix-includes-when-building-with-musl.patch \
|
||||
file://CVE-2022-43995.patch \
|
||||
file://CVE-2023-22809.patch \
|
||||
"
|
||||
|
||||
PAM_SRC_URI = "file://sudo.pam"
|
||||
|
||||
43
meta/recipes-extended/tar/tar/CVE-2022-48303.patch
Normal file
43
meta/recipes-extended/tar/tar/CVE-2022-48303.patch
Normal file
@@ -0,0 +1,43 @@
|
||||
From 3da78400eafcccb97e2f2fd4b227ea40d794ede8 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org>
|
||||
Date: Sat, 11 Feb 2023 11:57:39 +0200
|
||||
Subject: Fix boundary checking in base-256 decoder
|
||||
|
||||
* src/list.c (from_header): Base-256 encoding is at least 2 bytes
|
||||
long.
|
||||
|
||||
Upstream-Status: Backport [see reference below]
|
||||
CVE: CVE-2022-48303
|
||||
|
||||
Reference to upstream patch:
|
||||
https://savannah.gnu.org/bugs/?62387
|
||||
https://git.savannah.gnu.org/cgit/tar.git/patch/src/list.c?id=3da78400eafcccb97e2f2fd4b227ea40d794ede8
|
||||
|
||||
Signed-off-by: Rodolfo Quesada Zumbado <rodolfo.zumbado@windriver.com>
|
||||
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||
---
|
||||
src/list.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)Signed-off-by: Rodolfo Quesada Zumbado <rodolfo.zumbado@windriver.com>
|
||||
|
||||
|
||||
(limited to 'src/list.c')
|
||||
|
||||
diff --git a/src/list.c b/src/list.c
|
||||
index 9fafc42..86bcfdd 100644
|
||||
--- a/src/list.c
|
||||
+++ b/src/list.c
|
||||
@@ -881,8 +881,9 @@ from_header (char const *where0, size_t digs, char const *type,
|
||||
where++;
|
||||
}
|
||||
}
|
||||
- else if (*where == '\200' /* positive base-256 */
|
||||
- || *where == '\377' /* negative base-256 */)
|
||||
+ else if (where <= lim - 2
|
||||
+ && (*where == '\200' /* positive base-256 */
|
||||
+ || *where == '\377' /* negative base-256 */))
|
||||
{
|
||||
/* Parse base-256 output. A nonnegative number N is
|
||||
represented as (256**DIGS)/2 + N; a negative number -N is
|
||||
--
|
||||
cgit v1.1
|
||||
|
||||
@@ -9,6 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
|
||||
SRC_URI = "${GNU_MIRROR}/tar/tar-${PV}.tar.bz2 \
|
||||
file://musl_dirent.patch \
|
||||
file://CVE-2021-20193.patch \
|
||||
file://CVE-2022-48303.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "17917356fff5cb4bd3cd5a6c3e727b05"
|
||||
|
||||
@@ -1,40 +1,20 @@
|
||||
There is an assertion in function _cairo_arc_in_direction().
|
||||
|
||||
CVE: CVE-2019-6461
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
|
||||
From ab2c5ee21e5f3d3ee4b3f67cfcd5811a4f99c3a0 Mon Sep 17 00:00:00 2001
|
||||
From: Heiko Lewin <hlewin@gmx.de>
|
||||
Date: Sun, 1 Aug 2021 11:16:03 +0000
|
||||
Subject: [PATCH] _arc_max_angle_for_tolerance_normalized: fix infinite loop
|
||||
|
||||
---
|
||||
src/cairo-arc.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
|
||||
diff --git a/src/cairo-arc.c b/src/cairo-arc.c
|
||||
index 390397bae..1c891d1a0 100644
|
||||
index 390397bae..1bde774a4 100644
|
||||
--- a/src/cairo-arc.c
|
||||
+++ b/src/cairo-arc.c
|
||||
@@ -90,16 +90,18 @@ _arc_max_angle_for_tolerance_normalized (double tolerance)
|
||||
{ M_PI / 11.0, 9.81410988043554039085e-09 },
|
||||
};
|
||||
int table_size = ARRAY_LENGTH (table);
|
||||
+ const int max_segments = 1000; /* this value is chosen arbitrarily. this gives an error of about 1.74909e-20 */
|
||||
@@ -186,7 +186,8 @@ _cairo_arc_in_direction (cairo_t *cr,
|
||||
if (cairo_status (cr))
|
||||
return;
|
||||
|
||||
for (i = 0; i < table_size; i++)
|
||||
if (table[i].error < tolerance)
|
||||
return table[i].angle;
|
||||
- assert (angle_max >= angle_min);
|
||||
+ if (angle_max < angle_min)
|
||||
+ return;
|
||||
|
||||
++i;
|
||||
+
|
||||
do {
|
||||
angle = M_PI / i++;
|
||||
error = _arc_error_normalized (angle);
|
||||
- } while (error > tolerance);
|
||||
+ } while (error > tolerance && i < max_segments);
|
||||
|
||||
return angle;
|
||||
}
|
||||
--
|
||||
2.38.1
|
||||
|
||||
if (angle_max - angle_min > 2 * M_PI * MAX_FULL_CIRCLES) {
|
||||
angle_max = fmod (angle_max - angle_min, 2 * M_PI);
|
||||
|
||||
@@ -1,20 +1,40 @@
|
||||
There is an assertion in function _cairo_arc_in_direction().
|
||||
|
||||
CVE: CVE-2019-6462
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Ross Burton <ross.burton@intel.com>
|
||||
Upstream-Status: Backport
|
||||
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
|
||||
|
||||
From ab2c5ee21e5f3d3ee4b3f67cfcd5811a4f99c3a0 Mon Sep 17 00:00:00 2001
|
||||
From: Heiko Lewin <hlewin@gmx.de>
|
||||
Date: Sun, 1 Aug 2021 11:16:03 +0000
|
||||
Subject: [PATCH] _arc_max_angle_for_tolerance_normalized: fix infinite loop
|
||||
|
||||
---
|
||||
src/cairo-arc.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cairo-arc.c b/src/cairo-arc.c
|
||||
index 390397bae..1bde774a4 100644
|
||||
index 390397bae..1c891d1a0 100644
|
||||
--- a/src/cairo-arc.c
|
||||
+++ b/src/cairo-arc.c
|
||||
@@ -186,7 +186,8 @@ _cairo_arc_in_direction (cairo_t *cr,
|
||||
if (cairo_status (cr))
|
||||
return;
|
||||
@@ -90,16 +90,18 @@ _arc_max_angle_for_tolerance_normalized (double tolerance)
|
||||
{ M_PI / 11.0, 9.81410988043554039085e-09 },
|
||||
};
|
||||
int table_size = ARRAY_LENGTH (table);
|
||||
+ const int max_segments = 1000; /* this value is chosen arbitrarily. this gives an error of about 1.74909e-20 */
|
||||
|
||||
- assert (angle_max >= angle_min);
|
||||
+ if (angle_max < angle_min)
|
||||
+ return;
|
||||
for (i = 0; i < table_size; i++)
|
||||
if (table[i].error < tolerance)
|
||||
return table[i].angle;
|
||||
|
||||
if (angle_max - angle_min > 2 * M_PI * MAX_FULL_CIRCLES) {
|
||||
angle_max = fmod (angle_max - angle_min, 2 * M_PI);
|
||||
++i;
|
||||
+
|
||||
do {
|
||||
angle = M_PI / i++;
|
||||
error = _arc_error_normalized (angle);
|
||||
- } while (error > tolerance);
|
||||
+ } while (error > tolerance && i < max_segments);
|
||||
|
||||
return angle;
|
||||
}
|
||||
--
|
||||
2.38.1
|
||||
|
||||
|
||||
@@ -0,0 +1,335 @@
|
||||
From 3122c2cdc45a964efedad8953a2df67205c3e3a8 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Sat, 4 Dec 2021 19:50:33 -0800
|
||||
Subject: [PATCH] [buffer] Add HB_GLYPH_FLAG_UNSAFE_TO_CONCAT
|
||||
|
||||
Fixes https://github.com/harfbuzz/harfbuzz/issues/1463
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/3122c2cdc45a964efedad8953a2df67205c3e3a8]
|
||||
Comment1: To backport the fix for CVE-2023-25193, add defination for HB_GLYPH_FLAG_UNSAFE_TO_CONCAT. This patch is needed along with CVE-2023-25193-pre1.patch for sucessfull porting.
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-buffer.cc | 10 ++---
|
||||
src/hb-buffer.h | 76 ++++++++++++++++++++++++++++++------
|
||||
src/hb-buffer.hh | 33 ++++++++++------
|
||||
src/hb-ot-layout-gsubgpos.hh | 39 +++++++++++++++---
|
||||
src/hb-ot-shape.cc | 8 +---
|
||||
5 files changed, 124 insertions(+), 42 deletions(-)
|
||||
|
||||
diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc
|
||||
index 6131c86..bba5eae 100644
|
||||
--- a/src/hb-buffer.cc
|
||||
+++ b/src/hb-buffer.cc
|
||||
@@ -610,14 +610,14 @@ done:
|
||||
}
|
||||
|
||||
void
|
||||
-hb_buffer_t::unsafe_to_break_impl (unsigned int start, unsigned int end)
|
||||
+hb_buffer_t::unsafe_to_break_impl (unsigned int start, unsigned int end, hb_mask_t mask)
|
||||
{
|
||||
unsigned int cluster = (unsigned int) -1;
|
||||
cluster = _unsafe_to_break_find_min_cluster (info, start, end, cluster);
|
||||
- _unsafe_to_break_set_mask (info, start, end, cluster);
|
||||
+ _unsafe_to_break_set_mask (info, start, end, cluster, mask);
|
||||
}
|
||||
void
|
||||
-hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end)
|
||||
+hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end, hb_mask_t mask)
|
||||
{
|
||||
if (!have_output)
|
||||
{
|
||||
@@ -631,8 +631,8 @@ hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int en
|
||||
unsigned int cluster = (unsigned int) -1;
|
||||
cluster = _unsafe_to_break_find_min_cluster (out_info, start, out_len, cluster);
|
||||
cluster = _unsafe_to_break_find_min_cluster (info, idx, end, cluster);
|
||||
- _unsafe_to_break_set_mask (out_info, start, out_len, cluster);
|
||||
- _unsafe_to_break_set_mask (info, idx, end, cluster);
|
||||
+ _unsafe_to_break_set_mask (out_info, start, out_len, cluster, mask);
|
||||
+ _unsafe_to_break_set_mask (info, idx, end, cluster, mask);
|
||||
}
|
||||
|
||||
void
|
||||
diff --git a/src/hb-buffer.h b/src/hb-buffer.h
|
||||
index d5cb746..42dc92a 100644
|
||||
--- a/src/hb-buffer.h
|
||||
+++ b/src/hb-buffer.h
|
||||
@@ -77,26 +77,76 @@ typedef struct hb_glyph_info_t
|
||||
* @HB_GLYPH_FLAG_UNSAFE_TO_BREAK: Indicates that if input text is broken at the
|
||||
* beginning of the cluster this glyph is part of,
|
||||
* then both sides need to be re-shaped, as the
|
||||
- * result might be different. On the flip side,
|
||||
- * it means that when this flag is not present,
|
||||
- * then it's safe to break the glyph-run at the
|
||||
- * beginning of this cluster, and the two sides
|
||||
- * represent the exact same result one would get
|
||||
- * if breaking input text at the beginning of
|
||||
- * this cluster and shaping the two sides
|
||||
- * separately. This can be used to optimize
|
||||
- * paragraph layout, by avoiding re-shaping
|
||||
- * of each line after line-breaking, or limiting
|
||||
- * the reshaping to a small piece around the
|
||||
- * breaking point only.
|
||||
+ * result might be different.
|
||||
+ *
|
||||
+ * On the flip side, it means that when this
|
||||
+ * flag is not present, then it is safe to break
|
||||
+ * the glyph-run at the beginning of this
|
||||
+ * cluster, and the two sides will represent the
|
||||
+ * exact same result one would get if breaking
|
||||
+ * input text at the beginning of this cluster
|
||||
+ * and shaping the two sides separately.
|
||||
+ *
|
||||
+ * This can be used to optimize paragraph
|
||||
+ * layout, by avoiding re-shaping of each line
|
||||
+ * after line-breaking.
|
||||
+ *
|
||||
+ * @HB_GLYPH_FLAG_UNSAFE_TO_CONCAT: Indicates that if input text is changed on one
|
||||
+ * side of the beginning of the cluster this glyph
|
||||
+ * is part of, then the shaping results for the
|
||||
+ * other side might change.
|
||||
+ *
|
||||
+ * Note that the absence of this flag will NOT by
|
||||
+ * itself mean that it IS safe to concat text.
|
||||
+ * Only two pieces of text both of which clear of
|
||||
+ * this flag can be concatenated safely.
|
||||
+ *
|
||||
+ * This can be used to optimize paragraph
|
||||
+ * layout, by avoiding re-shaping of each line
|
||||
+ * after line-breaking, by limiting the
|
||||
+ * reshaping to a small piece around the
|
||||
+ * breaking positin only, even if the breaking
|
||||
+ * position carries the
|
||||
+ * #HB_GLYPH_FLAG_UNSAFE_TO_BREAK or when
|
||||
+ * hyphenation or other text transformation
|
||||
+ * happens at line-break position, in the following
|
||||
+ * way:
|
||||
+ *
|
||||
+ * 1. Iterate back from the line-break position till
|
||||
+ * the the first cluster start position that is
|
||||
+ * NOT unsafe-to-concat, 2. shape the segment from
|
||||
+ * there till the end of line, 3. check whether the
|
||||
+ * resulting glyph-run also is clear of the
|
||||
+ * unsafe-to-concat at its start-of-text position;
|
||||
+ * if it is, just splice it into place and the line
|
||||
+ * is shaped; If not, move on to a position further
|
||||
+ * back that is clear of unsafe-to-concat and retry
|
||||
+ * from there, and repeat.
|
||||
+ *
|
||||
+ * At the start of next line a similar algorithm can
|
||||
+ * be implemented. A slight complication will arise,
|
||||
+ * because while our buffer API has a way to
|
||||
+ * return flags for position corresponding to
|
||||
+ * start-of-text, there is currently no position
|
||||
+ * corresponding to end-of-text. This limitation
|
||||
+ * can be alleviated by shaping more text than needed
|
||||
+ * and looking for unsafe-to-concat flag within text
|
||||
+ * clusters.
|
||||
+ *
|
||||
+ * The #HB_GLYPH_FLAG_UNSAFE_TO_BREAK flag will
|
||||
+ * always imply this flag.
|
||||
+ *
|
||||
+ * Since: REPLACEME
|
||||
+ *
|
||||
* @HB_GLYPH_FLAG_DEFINED: All the currently defined flags.
|
||||
*
|
||||
* Since: 1.5.0
|
||||
*/
|
||||
typedef enum { /*< flags >*/
|
||||
HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
|
||||
+ HB_GLYPH_FLAG_UNSAFE_TO_CONCAT = 0x00000002,
|
||||
|
||||
- HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */
|
||||
+ HB_GLYPH_FLAG_DEFINED = 0x00000003 /* OR of all defined flags */
|
||||
} hb_glyph_flags_t;
|
||||
|
||||
HB_EXTERN hb_glyph_flags_t
|
||||
diff --git a/src/hb-buffer.hh b/src/hb-buffer.hh
|
||||
index b5596d9..beac7b6 100644
|
||||
--- a/src/hb-buffer.hh
|
||||
+++ b/src/hb-buffer.hh
|
||||
@@ -67,8 +67,8 @@ enum hb_buffer_scratch_flags_t {
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES = 0x00000002u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u,
|
||||
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
|
||||
- HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u,
|
||||
- HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000020u,
|
||||
+ HB_BUFFER_SCRATCH_FLAG_HAS_CGJ = 0x00000010u,
|
||||
+ HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS = 0x00000020u,
|
||||
|
||||
/* Reserved for complex shapers' internal use. */
|
||||
HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u,
|
||||
@@ -324,8 +324,19 @@ struct hb_buffer_t
|
||||
return;
|
||||
unsafe_to_break_impl (start, end);
|
||||
}
|
||||
- HB_INTERNAL void unsafe_to_break_impl (unsigned int start, unsigned int end);
|
||||
- HB_INTERNAL void unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end);
|
||||
+ void unsafe_to_concat (unsigned int start,
|
||||
+ unsigned int end)
|
||||
+ {
|
||||
+ if (end - start < 2)
|
||||
+ return;
|
||||
+ unsafe_to_break_impl (start, end, HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ }
|
||||
+ HB_INTERNAL void unsafe_to_break_impl (unsigned int start, unsigned int end,
|
||||
+ hb_mask_t mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK | HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ HB_INTERNAL void unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end,
|
||||
+ hb_mask_t mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK | HB_GLYPH_FLAG_UNSAFE_TO_CONCAT);
|
||||
+ void unsafe_to_concat_from_outbuffer (unsigned int start, unsigned int end)
|
||||
+ { unsafe_to_break_from_outbuffer (start, end, HB_GLYPH_FLAG_UNSAFE_TO_CONCAT); }
|
||||
|
||||
|
||||
/* Internal methods */
|
||||
@@ -377,12 +388,7 @@ struct hb_buffer_t
|
||||
set_cluster (hb_glyph_info_t &inf, unsigned int cluster, unsigned int mask = 0)
|
||||
{
|
||||
if (inf.cluster != cluster)
|
||||
- {
|
||||
- if (mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
|
||||
- inf.mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- else
|
||||
- inf.mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- }
|
||||
+ inf.mask = (inf.mask & ~HB_GLYPH_FLAG_DEFINED) | (mask & HB_GLYPH_FLAG_DEFINED);
|
||||
inf.cluster = cluster;
|
||||
}
|
||||
|
||||
@@ -398,13 +404,14 @@ struct hb_buffer_t
|
||||
void
|
||||
_unsafe_to_break_set_mask (hb_glyph_info_t *infos,
|
||||
unsigned int start, unsigned int end,
|
||||
- unsigned int cluster)
|
||||
+ unsigned int cluster,
|
||||
+ hb_mask_t mask)
|
||||
{
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
if (cluster != infos[i].cluster)
|
||||
{
|
||||
- scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK;
|
||||
- infos[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
+ scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS;
|
||||
+ infos[i].mask |= mask;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index 579d178..a6ca456 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -369,7 +369,7 @@ struct hb_ot_apply_context_t :
|
||||
may_skip (const hb_glyph_info_t &info) const
|
||||
{ return matcher.may_skip (c, info); }
|
||||
|
||||
- bool next ()
|
||||
+ bool next (unsigned *unsafe_to = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx + num_items < end)
|
||||
@@ -392,11 +392,17 @@ struct hb_ot_apply_context_t :
|
||||
}
|
||||
|
||||
if (skip == matcher_t::SKIP_NO)
|
||||
+ {
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = idx + 1;
|
||||
return false;
|
||||
+ }
|
||||
}
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = end;
|
||||
return false;
|
||||
}
|
||||
- bool prev ()
|
||||
+ bool prev (unsigned *unsafe_from = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx > num_items - 1)
|
||||
@@ -419,8 +425,14 @@ struct hb_ot_apply_context_t :
|
||||
}
|
||||
|
||||
if (skip == matcher_t::SKIP_NO)
|
||||
+ {
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
return false;
|
||||
+ }
|
||||
}
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -834,7 +846,12 @@ static inline bool match_input (hb_ot_apply_context_t *c,
|
||||
match_positions[0] = buffer->idx;
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
{
|
||||
- if (!skippy_iter.next ()) return_trace (false);
|
||||
+ unsigned unsafe_to;
|
||||
+ if (!skippy_iter.next (&unsafe_to))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat (c->buffer->idx, unsafe_to);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
|
||||
match_positions[i] = skippy_iter.idx;
|
||||
|
||||
@@ -1022,8 +1039,14 @@ static inline bool match_backtrack (hb_ot_apply_context_t *c,
|
||||
skippy_iter.set_match_func (match_func, match_data, backtrack);
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
- if (!skippy_iter.prev ())
|
||||
+ {
|
||||
+ unsigned unsafe_from;
|
||||
+ if (!skippy_iter.prev (&unsafe_from))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat_from_outbuffer (unsafe_from, c->buffer->idx);
|
||||
return_trace (false);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
*match_start = skippy_iter.idx;
|
||||
|
||||
@@ -1045,8 +1068,14 @@ static inline bool match_lookahead (hb_ot_apply_context_t *c,
|
||||
skippy_iter.set_match_func (match_func, match_data, lookahead);
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
- if (!skippy_iter.next ())
|
||||
+ {
|
||||
+ unsigned unsafe_to;
|
||||
+ if (!skippy_iter.next (&unsafe_to))
|
||||
+ {
|
||||
+ c->buffer->unsafe_to_concat (c->buffer->idx + offset, unsafe_to);
|
||||
return_trace (false);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
*end_index = skippy_iter.idx + 1;
|
||||
|
||||
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
|
||||
index 5d9a70c..5d10b30 100644
|
||||
--- a/src/hb-ot-shape.cc
|
||||
+++ b/src/hb-ot-shape.cc
|
||||
@@ -1008,7 +1008,7 @@ hb_propagate_flags (hb_buffer_t *buffer)
|
||||
/* Propagate cluster-level glyph flags to be the same on all cluster glyphs.
|
||||
* Simplifies using them. */
|
||||
|
||||
- if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK))
|
||||
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS))
|
||||
return;
|
||||
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
@@ -1017,11 +1017,7 @@ hb_propagate_flags (hb_buffer_t *buffer)
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
- if (info[i].mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
|
||||
- {
|
||||
- mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
|
||||
- break;
|
||||
- }
|
||||
+ mask |= info[i].mask & HB_GLYPH_FLAG_DEFINED;
|
||||
if (mask)
|
||||
for (unsigned int i = start; i < end; i++)
|
||||
info[i].mask |= mask;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
From b29fbd16fa82b82bdf0dcb2f13a63f7dc23cf324 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Mon, 6 Feb 2023 13:08:52 -0700
|
||||
Subject: [PATCH] [gsubgpos] Refactor skippy_iter.match()
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/b29fbd16fa82b82bdf0dcb2f13a63f7dc23cf324]
|
||||
Comment1: To backport the fix for CVE-2023-25193, add defination for MATCH, NOT_MATCH and SKIP.
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-ot-layout-gsubgpos.hh | 94 +++++++++++++++++++++---------------
|
||||
1 file changed, 54 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index a6ca456..5a7e564 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -369,33 +369,52 @@ struct hb_ot_apply_context_t :
|
||||
may_skip (const hb_glyph_info_t &info) const
|
||||
{ return matcher.may_skip (c, info); }
|
||||
|
||||
+ enum match_t {
|
||||
+ MATCH,
|
||||
+ NOT_MATCH,
|
||||
+ SKIP
|
||||
+ };
|
||||
+
|
||||
+ match_t match (hb_glyph_info_t &info)
|
||||
+ {
|
||||
+ matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
+ if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
+ return SKIP;
|
||||
+
|
||||
+ matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
+ if (match == matcher_t::MATCH_YES ||
|
||||
+ (match == matcher_t::MATCH_MAYBE &&
|
||||
+ skip == matcher_t::SKIP_NO))
|
||||
+ return MATCH;
|
||||
+
|
||||
+ if (skip == matcher_t::SKIP_NO)
|
||||
+ return NOT_MATCH;
|
||||
+
|
||||
+ return SKIP;
|
||||
+ }
|
||||
+
|
||||
bool next (unsigned *unsafe_to = nullptr)
|
||||
{
|
||||
assert (num_items > 0);
|
||||
while (idx + num_items < end)
|
||||
{
|
||||
idx++;
|
||||
- const hb_glyph_info_t &info = c->buffer->info[idx];
|
||||
-
|
||||
- matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
- if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
- continue;
|
||||
-
|
||||
- matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
- if (match == matcher_t::MATCH_YES ||
|
||||
- (match == matcher_t::MATCH_MAYBE &&
|
||||
- skip == matcher_t::SKIP_NO))
|
||||
- {
|
||||
- num_items--;
|
||||
- if (match_glyph_data) match_glyph_data++;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- if (skip == matcher_t::SKIP_NO)
|
||||
+ switch (match (c->buffer->info[idx]))
|
||||
{
|
||||
- if (unsafe_to)
|
||||
- *unsafe_to = idx + 1;
|
||||
- return false;
|
||||
+ case MATCH:
|
||||
+ {
|
||||
+ num_items--;
|
||||
+ if (match_glyph_data) match_glyph_data++;
|
||||
+ return true;
|
||||
+ }
|
||||
+ case NOT_MATCH:
|
||||
+ {
|
||||
+ if (unsafe_to)
|
||||
+ *unsafe_to = idx + 1;
|
||||
+ return false;
|
||||
+ }
|
||||
+ case SKIP:
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
if (unsafe_to)
|
||||
@@ -408,27 +427,22 @@ struct hb_ot_apply_context_t :
|
||||
while (idx > num_items - 1)
|
||||
{
|
||||
idx--;
|
||||
- const hb_glyph_info_t &info = c->buffer->out_info[idx];
|
||||
-
|
||||
- matcher_t::may_skip_t skip = matcher.may_skip (c, info);
|
||||
- if (unlikely (skip == matcher_t::SKIP_YES))
|
||||
- continue;
|
||||
-
|
||||
- matcher_t::may_match_t match = matcher.may_match (info, match_glyph_data);
|
||||
- if (match == matcher_t::MATCH_YES ||
|
||||
- (match == matcher_t::MATCH_MAYBE &&
|
||||
- skip == matcher_t::SKIP_NO))
|
||||
+ switch (match (c->buffer->out_info[idx]))
|
||||
{
|
||||
- num_items--;
|
||||
- if (match_glyph_data) match_glyph_data++;
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- if (skip == matcher_t::SKIP_NO)
|
||||
- {
|
||||
- if (unsafe_from)
|
||||
- *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
- return false;
|
||||
+ case MATCH:
|
||||
+ {
|
||||
+ num_items--;
|
||||
+ if (match_glyph_data) match_glyph_data++;
|
||||
+ return true;
|
||||
+ }
|
||||
+ case NOT_MATCH:
|
||||
+ {
|
||||
+ if (unsafe_from)
|
||||
+ *unsafe_from = hb_max (1u, idx) - 1u;
|
||||
+ return false;
|
||||
+ }
|
||||
+ case SKIP:
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
if (unsafe_from)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
179
meta/recipes-graphics/harfbuzz/harfbuzz/CVE-2023-25193.patch
Normal file
179
meta/recipes-graphics/harfbuzz/harfbuzz/CVE-2023-25193.patch
Normal file
@@ -0,0 +1,179 @@
|
||||
From 8708b9e081192786c027bb7f5f23d76dbe5c19e8 Mon Sep 17 00:00:00 2001
|
||||
From: Behdad Esfahbod <behdad@behdad.org>
|
||||
Date: Mon, 6 Feb 2023 14:51:25 -0700
|
||||
Subject: [PATCH] [GPOS] Avoid O(n^2) behavior in mark-attachment
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/harfbuzz/harfbuzz/commit/8708b9e081192786c027bb7f5f23d76dbe5c19e8]
|
||||
Comment1: The Original Patch [https://github.com/harfbuzz/harfbuzz/commit/85be877925ddbf34f74a1229f3ca1716bb6170dc] causes regression and was reverted. This Patch completes the fix.
|
||||
Comment2: The Patch contained files MarkBasePosFormat1.hh and MarkLigPosFormat1.hh which were moved from hb-ot-layout-gpos-table.hh as per https://github.com/harfbuzz/harfbuzz/commit/197d9a5c994eb41c8c89b7b958b26b1eacfeeb00
|
||||
CVE: CVE-2023-25193
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
src/hb-ot-layout-gpos-table.hh | 101 ++++++++++++++++++++++++---------
|
||||
src/hb-ot-layout-gsubgpos.hh | 5 +-
|
||||
2 files changed, 77 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
|
||||
index 024312d..88df13d 100644
|
||||
--- a/src/hb-ot-layout-gpos-table.hh
|
||||
+++ b/src/hb-ot-layout-gpos-table.hh
|
||||
@@ -1458,6 +1458,25 @@ struct MarkBasePosFormat1
|
||||
|
||||
const Coverage &get_coverage () const { return this+markCoverage; }
|
||||
|
||||
+ static inline bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
+ {
|
||||
+ /* We only want to attach to the first of a MultipleSubst sequence.
|
||||
+ * https://github.com/harfbuzz/harfbuzz/issues/740
|
||||
+ * Reject others...
|
||||
+ * ...but stop if we find a mark in the MultipleSubst sequence:
|
||||
+ * https://github.com/harfbuzz/harfbuzz/issues/1020 */
|
||||
+ return !_hb_glyph_info_multiplied (&buffer->info[idx]) ||
|
||||
+ 0 == _hb_glyph_info_get_lig_comp (&buffer->info[idx]) ||
|
||||
+ (idx == 0 ||
|
||||
+ _hb_glyph_info_is_mark (&buffer->info[idx - 1]) ||
|
||||
+ !_hb_glyph_info_multiplied (&buffer->info[idx - 1]) ||
|
||||
+ _hb_glyph_info_get_lig_id (&buffer->info[idx]) !=
|
||||
+ _hb_glyph_info_get_lig_id (&buffer->info[idx - 1]) ||
|
||||
+ _hb_glyph_info_get_lig_comp (&buffer->info[idx]) !=
|
||||
+ _hb_glyph_info_get_lig_comp (&buffer->info[idx - 1]) + 1
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
bool apply (hb_ot_apply_context_t *c) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
@@ -1465,37 +1484,46 @@ struct MarkBasePosFormat1
|
||||
unsigned int mark_index = (this+markCoverage).get_coverage (buffer->cur().codepoint);
|
||||
if (likely (mark_index == NOT_COVERED)) return_trace (false);
|
||||
|
||||
- /* Now we search backwards for a non-mark glyph */
|
||||
+ /* Now we search backwards for a non-mark glyph.
|
||||
+ * We don't use skippy_iter.prev() to avoid O(n^2) behavior. */
|
||||
+
|
||||
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
|
||||
- skippy_iter.reset (buffer->idx, 1);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
- do {
|
||||
- if (!skippy_iter.prev ()) return_trace (false);
|
||||
- /* We only want to attach to the first of a MultipleSubst sequence.
|
||||
- * https://github.com/harfbuzz/harfbuzz/issues/740
|
||||
- * Reject others...
|
||||
- * ...but stop if we find a mark in the MultipleSubst sequence:
|
||||
- * https://github.com/harfbuzz/harfbuzz/issues/1020 */
|
||||
- if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
|
||||
- 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) ||
|
||||
- (skippy_iter.idx == 0 ||
|
||||
- _hb_glyph_info_is_mark (&buffer->info[skippy_iter.idx - 1]) ||
|
||||
- _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]) !=
|
||||
- _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx - 1]) ||
|
||||
- _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]) !=
|
||||
- _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx - 1]) + 1
|
||||
- ))
|
||||
- break;
|
||||
- skippy_iter.reject ();
|
||||
- } while (true);
|
||||
+ unsigned j;
|
||||
+ for (j = buffer->idx; j > c->last_base_until; j--)
|
||||
+ {
|
||||
+ auto match = skippy_iter.match (buffer->info[j - 1]);
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ if (!accept (buffer, j - 1))
|
||||
+ match = skippy_iter.SKIP;
|
||||
+ }
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ c->last_base = (signed) j - 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ c->last_base_until = buffer->idx;
|
||||
+ if (c->last_base == -1)
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (0, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
+
|
||||
+ unsigned idx = (unsigned) c->last_base;
|
||||
|
||||
/* Checking that matched glyph is actually a base glyph by GDEF is too strong; disabled */
|
||||
- //if (!_hb_glyph_info_is_base_glyph (&buffer->info[skippy_iter.idx])) { return_trace (false); }
|
||||
+ //if (!_hb_glyph_info_is_base_glyph (&buffer->info[idx])) { return_trace (false); }
|
||||
|
||||
- unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
|
||||
+ unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[idx].codepoint);
|
||||
if (base_index == NOT_COVERED) return_trace (false);
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (idx, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
|
||||
- return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx));
|
||||
+ return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, idx));
|
||||
}
|
||||
|
||||
bool subset (hb_subset_context_t *c) const
|
||||
@@ -1587,15 +1615,32 @@ struct MarkLigPosFormat1
|
||||
if (likely (mark_index == NOT_COVERED)) return_trace (false);
|
||||
|
||||
/* Now we search backwards for a non-mark glyph */
|
||||
+
|
||||
hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
|
||||
- skippy_iter.reset (buffer->idx, 1);
|
||||
skippy_iter.set_lookup_props (LookupFlag::IgnoreMarks);
|
||||
- if (!skippy_iter.prev ()) return_trace (false);
|
||||
+
|
||||
+ unsigned j;
|
||||
+ for (j = buffer->idx; j > c->last_base_until; j--)
|
||||
+ {
|
||||
+ auto match = skippy_iter.match (buffer->info[j - 1]);
|
||||
+ if (match == skippy_iter.MATCH)
|
||||
+ {
|
||||
+ c->last_base = (signed) j - 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ c->last_base_until = buffer->idx;
|
||||
+ if (c->last_base == -1)
|
||||
+ {
|
||||
+ buffer->unsafe_to_concat_from_outbuffer (0, buffer->idx + 1);
|
||||
+ return_trace (false);
|
||||
+ }
|
||||
+
|
||||
+ j = (unsigned) c->last_base;
|
||||
|
||||
/* Checking that matched glyph is actually a ligature by GDEF is too strong; disabled */
|
||||
- //if (!_hb_glyph_info_is_ligature (&buffer->info[skippy_iter.idx])) { return_trace (false); }
|
||||
+ //if (!_hb_glyph_info_is_ligature (&buffer->info[idx])) { return_trace (false); }
|
||||
|
||||
- unsigned int j = skippy_iter.idx;
|
||||
unsigned int lig_index = (this+ligatureCoverage).get_coverage (buffer->info[j].codepoint);
|
||||
if (lig_index == NOT_COVERED) return_trace (false);
|
||||
|
||||
diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh
|
||||
index 5a7e564..437123c 100644
|
||||
--- a/src/hb-ot-layout-gsubgpos.hh
|
||||
+++ b/src/hb-ot-layout-gsubgpos.hh
|
||||
@@ -503,6 +503,9 @@ struct hb_ot_apply_context_t :
|
||||
uint32_t random_state;
|
||||
|
||||
|
||||
+ signed last_base = -1; // GPOS uses
|
||||
+ unsigned last_base_until = 0; // GPOS uses
|
||||
+
|
||||
hb_ot_apply_context_t (unsigned int table_index_,
|
||||
hb_font_t *font_,
|
||||
hb_buffer_t *buffer_) :
|
||||
@@ -536,7 +539,7 @@ struct hb_ot_apply_context_t :
|
||||
iter_context.init (this, true);
|
||||
}
|
||||
|
||||
- void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; init_iters (); }
|
||||
+ void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; last_base = -1; last_base_until = 0; init_iters (); }
|
||||
void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); }
|
||||
void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); }
|
||||
void set_random (bool random_) { random = random_; }
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -7,7 +7,10 @@ LICENSE = "MIT"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=e11f5c3149cdec4bb309babb020b32b9 \
|
||||
file://src/hb-ucd.cc;beginline=1;endline=15;md5=29d4dcb6410429195df67efe3382d8bc"
|
||||
|
||||
SRC_URI = "http://www.freedesktop.org/software/harfbuzz/release/${BP}.tar.xz"
|
||||
SRC_URI = "http://www.freedesktop.org/software/harfbuzz/release/${BP}.tar.xz \
|
||||
file://CVE-2023-25193-pre0.patch \
|
||||
file://CVE-2023-25193-pre1.patch \
|
||||
file://CVE-2023-25193.patch"
|
||||
SRC_URI[md5sum] = "2b3a4dfdb3e5e50055f941978944da9f"
|
||||
SRC_URI[sha256sum] = "9413b8d96132d699687ef914ebb8c50440efc87b3f775d25856d7ec347c03c12"
|
||||
|
||||
|
||||
38
meta/recipes-graphics/libsdl2/libsdl2/CVE-2022-4743.patch
Normal file
38
meta/recipes-graphics/libsdl2/libsdl2/CVE-2022-4743.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 00b67f55727bc0944c3266e2b875440da132ce4b Mon Sep 17 00:00:00 2001
|
||||
From: zhailiangliang <zhailiangliang@loongson.cn>
|
||||
Date: Wed, 21 Sep 2022 10:30:38 +0800
|
||||
Subject: [PATCH] Fix potential memory leak in GLES_CreateTexture
|
||||
|
||||
|
||||
CVE: CVE-2022-4743
|
||||
Upstream-Status: Backport [https://github.com/libsdl-org/SDL/commit/00b67f55727bc0944c3266e2b875440da132ce4b.patch]
|
||||
Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
|
||||
|
||||
---
|
||||
src/render/opengles/SDL_render_gles.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
|
||||
index a5fbab309eda..ba08a46e2805 100644
|
||||
--- a/src/render/opengles/SDL_render_gles.c
|
||||
+++ b/src/render/opengles/SDL_render_gles.c
|
||||
@@ -359,6 +359,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
renderdata->glGenTextures(1, &data->texture);
|
||||
result = renderdata->glGetError();
|
||||
if (result != GL_NO_ERROR) {
|
||||
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
+ SDL_free(data->pixels);
|
||||
+ }
|
||||
SDL_free(data);
|
||||
return GLES_SetError("glGenTextures()", result);
|
||||
}
|
||||
@@ -387,6 +390,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
||||
|
||||
result = renderdata->glGetError();
|
||||
if (result != GL_NO_ERROR) {
|
||||
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
|
||||
+ SDL_free(data->pixels);
|
||||
+ }
|
||||
SDL_free(data);
|
||||
return GLES_SetError("glTexImage2D()", result);
|
||||
}
|
||||
@@ -22,6 +22,7 @@ SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \
|
||||
file://directfb-renderfillrect-fix.patch \
|
||||
file://CVE-2020-14409-14410.patch \
|
||||
file://CVE-2021-33657.patch \
|
||||
file://CVE-2022-4743.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/SDL2-${PV}"
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From ccdd431cd8f1cabae9d744f0514b6533c438908c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Mon, 5 Dec 2022 15:55:54 +1000
|
||||
Subject: [PATCH] xkb: reset the radio_groups pointer to NULL after freeing it
|
||||
|
||||
Unlike other elements of the keymap, this pointer was freed but not
|
||||
reset. On a subsequent XkbGetKbdByName request, the server may access
|
||||
already freed memory.
|
||||
|
||||
CVE-2022-4283, ZDI-CAN-19530
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/ccdd431cd8f1cabae9d744f0514b6533c438908c]
|
||||
CVE: CVE-2022-4283
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
xkb/xkbUtils.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
|
||||
index 8975ade..9bc51fc 100644
|
||||
--- a/xkb/xkbUtils.c
|
||||
+++ b/xkb/xkbUtils.c
|
||||
@@ -1327,6 +1327,7 @@ _XkbCopyNames(XkbDescPtr src, XkbDescPtr dst)
|
||||
}
|
||||
else {
|
||||
free(dst->names->radio_groups);
|
||||
+ dst->names->radio_groups = NULL;
|
||||
}
|
||||
dst->names->num_rg = src->names->num_rg;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
From b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Tue, 29 Nov 2022 12:55:45 +1000
|
||||
Subject: [PATCH] Xtest: disallow GenericEvents in XTestSwapFakeInput
|
||||
|
||||
XTestSwapFakeInput assumes all events in this request are
|
||||
sizeof(xEvent) and iterates through these in 32-byte increments.
|
||||
However, a GenericEvent may be of arbitrary length longer than 32 bytes,
|
||||
so any GenericEvent in this list would result in subsequent events to be
|
||||
misparsed.
|
||||
|
||||
Additional, the swapped event is written into a stack-allocated struct
|
||||
xEvent (size 32 bytes). For any GenericEvent longer than 32 bytes,
|
||||
swapping the event may thus smash the stack like an avocado on toast.
|
||||
|
||||
Catch this case early and return BadValue for any GenericEvent.
|
||||
Which is what would happen in unswapped setups anyway since XTest
|
||||
doesn't support GenericEvent.
|
||||
|
||||
CVE-2022-46340, ZDI-CAN 19265
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/b320ca0ffe4c0c872eeb3a93d9bde21f765c7c63]
|
||||
CVE: CVE-2022-46340
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
Xext/xtest.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Xext/xtest.c b/Xext/xtest.c
|
||||
index 38b8012..bf11789 100644
|
||||
--- a/Xext/xtest.c
|
||||
+++ b/Xext/xtest.c
|
||||
@@ -501,10 +501,11 @@ XTestSwapFakeInput(ClientPtr client, xReq * req)
|
||||
|
||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
|
||||
+ int evtype = ev->u.u.type & 0x177;
|
||||
/* Swap event */
|
||||
- proc = EventSwapVector[ev->u.u.type & 0177];
|
||||
+ proc = EventSwapVector[evtype];
|
||||
/* no swapping proc; invalid event type? */
|
||||
- if (!proc || proc == NotImplemented) {
|
||||
+ if (!proc || proc == NotImplemented || evtype == GenericEvent) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
From 51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Tue, 29 Nov 2022 13:55:32 +1000
|
||||
Subject: [PATCH] Xi: disallow passive grabs with a detail > 255
|
||||
|
||||
The XKB protocol effectively prevents us from ever using keycodes above
|
||||
255. For buttons it's theoretically possible but realistically too niche
|
||||
to worry about. For all other passive grabs, the detail must be zero
|
||||
anyway.
|
||||
|
||||
This fixes an OOB write:
|
||||
|
||||
ProcXIPassiveUngrabDevice() calls DeletePassiveGrabFromList with a
|
||||
temporary grab struct which contains tempGrab->detail.exact = stuff->detail.
|
||||
For matching existing grabs, DeleteDetailFromMask is called with the
|
||||
stuff->detail value. This function creates a new mask with the one bit
|
||||
representing stuff->detail cleared.
|
||||
|
||||
However, the array size for the new mask is 8 * sizeof(CARD32) bits,
|
||||
thus any detail above 255 results in an OOB array write.
|
||||
|
||||
CVE-2022-46341, ZDI-CAN 19381
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/51eb63b0ee1509c6c6b8922b0e4aa037faa6f78b]
|
||||
CVE: CVE-2022-46341
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
Xi/xipassivegrab.c | 22 ++++++++++++++--------
|
||||
1 file changed, 14 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
|
||||
index d30f51f..89a5910 100644
|
||||
--- a/Xi/xipassivegrab.c
|
||||
+++ b/Xi/xipassivegrab.c
|
||||
@@ -133,6 +133,12 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
+ /* XI2 allows 32-bit keycodes but thanks to XKB we can never
|
||||
+ * implement this. Just return an error for all keycodes that
|
||||
+ * cannot work anyway, same for buttons > 255. */
|
||||
+ if (stuff->detail > 255)
|
||||
+ return XIAlreadyGrabbed;
|
||||
+
|
||||
if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
|
||||
stuff->mask_len * 4) != Success)
|
||||
return BadValue;
|
||||
@@ -203,14 +209,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||
¶m, XI2, &mask);
|
||||
break;
|
||||
case XIGrabtypeKeycode:
|
||||
- /* XI2 allows 32-bit keycodes but thanks to XKB we can never
|
||||
- * implement this. Just return an error for all keycodes that
|
||||
- * cannot work anyway */
|
||||
- if (stuff->detail > 255)
|
||||
- status = XIAlreadyGrabbed;
|
||||
- else
|
||||
- status = GrabKey(client, dev, mod_dev, stuff->detail,
|
||||
- ¶m, XI2, &mask);
|
||||
+ status = GrabKey(client, dev, mod_dev, stuff->detail,
|
||||
+ ¶m, XI2, &mask);
|
||||
break;
|
||||
case XIGrabtypeEnter:
|
||||
case XIGrabtypeFocusIn:
|
||||
@@ -319,6 +319,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
+ /* We don't allow passive grabs for details > 255 anyway */
|
||||
+ if (stuff->detail > 255) {
|
||||
+ client->errorValue = stuff->detail;
|
||||
+ return BadValue;
|
||||
+ }
|
||||
+
|
||||
rc = dixLookupWindow(&win, stuff->grab_window, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
From b79f32b57cc0c1186b2899bce7cf89f7b325161b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Wed, 30 Nov 2022 11:20:40 +1000
|
||||
Subject: [PATCH] Xext: free the XvRTVideoNotify when turning off from the same
|
||||
client
|
||||
|
||||
This fixes a use-after-free bug:
|
||||
|
||||
When a client first calls XvdiSelectVideoNotify() on a drawable with a
|
||||
TRUE onoff argument, a struct XvVideoNotifyRec is allocated. This struct
|
||||
is added twice to the resources:
|
||||
- as the drawable's XvRTVideoNotifyList. This happens only once per
|
||||
drawable, subsequent calls append to this list.
|
||||
- as the client's XvRTVideoNotify. This happens for every client.
|
||||
|
||||
The struct keeps the ClientPtr around once it has been added for a
|
||||
client. The idea, presumably, is that if the client disconnects we can remove
|
||||
all structs from the drawable's list that match the client (by resetting
|
||||
the ClientPtr to NULL), but if the drawable is destroyed we can remove
|
||||
and free the whole list.
|
||||
|
||||
However, if the same client then calls XvdiSelectVideoNotify() on the
|
||||
same drawable with a FALSE onoff argument, only the ClientPtr on the
|
||||
existing struct was set to NULL. The struct itself remained in the
|
||||
client's resources.
|
||||
|
||||
If the drawable is now destroyed, the resource system invokes
|
||||
XvdiDestroyVideoNotifyList which frees the whole list for this drawable
|
||||
- including our struct. This function however does not free the resource
|
||||
for the client since our ClientPtr is NULL.
|
||||
|
||||
Later, when the client is destroyed and the resource system invokes
|
||||
XvdiDestroyVideoNotify, we unconditionally set the ClientPtr to NULL. On
|
||||
a struct that has been freed previously. This is generally frowned upon.
|
||||
|
||||
Fix this by calling FreeResource() on the second call instead of merely
|
||||
setting the ClientPtr to NULL. This removes the struct from the client
|
||||
resources (but not from the list), ensuring that it won't be accessed
|
||||
again when the client quits.
|
||||
|
||||
Note that the assignment tpn->client = NULL; is superfluous since the
|
||||
XvdiDestroyVideoNotify function will do this anyway. But it's left for
|
||||
clarity and to match a similar invocation in XvdiSelectPortNotify.
|
||||
|
||||
CVE-2022-46342, ZDI-CAN 19400
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/b79f32b57cc0c1186b2899bce7cf89f7b325161b]
|
||||
CVE: CVE-2022-46342
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
Xext/xvmain.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
|
||||
index c520c7d..5f4c174 100644
|
||||
--- a/Xext/xvmain.c
|
||||
+++ b/Xext/xvmain.c
|
||||
@@ -811,8 +811,10 @@ XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
||||
tpn = pn;
|
||||
while (tpn) {
|
||||
if (tpn->client == client) {
|
||||
- if (!onoff)
|
||||
+ if (!onoff) {
|
||||
tpn->client = NULL;
|
||||
+ FreeResource(tpn->id, XvRTVideoNotify);
|
||||
+ }
|
||||
return Success;
|
||||
}
|
||||
if (!tpn->client)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 842ca3ccef100ce010d1d8f5f6d6cc1915055900 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Tue, 29 Nov 2022 14:53:07 +1000
|
||||
Subject: [PATCH] Xext: free the screen saver resource when replacing it
|
||||
|
||||
This fixes a use-after-free bug:
|
||||
|
||||
When a client first calls ScreenSaverSetAttributes(), a struct
|
||||
ScreenSaverAttrRec is allocated and added to the client's
|
||||
resources.
|
||||
|
||||
When the same client calls ScreenSaverSetAttributes() again, a new
|
||||
struct ScreenSaverAttrRec is allocated, replacing the old struct. The
|
||||
old struct was freed but not removed from the clients resources.
|
||||
|
||||
Later, when the client is destroyed the resource system invokes
|
||||
ScreenSaverFreeAttr and attempts to clean up the already freed struct.
|
||||
|
||||
Fix this by letting the resource system free the old attrs instead.
|
||||
|
||||
CVE-2022-46343, ZDI-CAN 19404
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/842ca3ccef100ce010d1d8f5f6d6cc1915055900]
|
||||
CVE: CVE-2022-46343
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
Xext/saver.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Xext/saver.c b/Xext/saver.c
|
||||
index c23907d..05b9ca3 100644
|
||||
--- a/Xext/saver.c
|
||||
+++ b/Xext/saver.c
|
||||
@@ -1051,7 +1051,7 @@ ScreenSaverSetAttributes(ClientPtr client)
|
||||
pVlist++;
|
||||
}
|
||||
if (pPriv->attr)
|
||||
- FreeScreenAttr(pPriv->attr);
|
||||
+ FreeResource(pPriv->attr->resource, AttrType);
|
||||
pPriv->attr = pAttr;
|
||||
pAttr->resource = FakeClientID(client->index);
|
||||
if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
From 8f454b793e1f13c99872c15f0eed1d7f3b823fe8 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Tue, 29 Nov 2022 13:26:57 +1000
|
||||
Subject: [PATCH] Xi: avoid integer truncation in length check of
|
||||
ProcXIChangeProperty
|
||||
|
||||
This fixes an OOB read and the resulting information disclosure.
|
||||
|
||||
Length calculation for the request was clipped to a 32-bit integer. With
|
||||
the correct stuff->num_items value the expected request size was
|
||||
truncated, passing the REQUEST_FIXED_SIZE check.
|
||||
|
||||
The server then proceeded with reading at least stuff->num_items bytes
|
||||
(depending on stuff->format) from the request and stuffing whatever it
|
||||
finds into the property. In the process it would also allocate at least
|
||||
stuff->num_items bytes, i.e. 4GB.
|
||||
|
||||
The same bug exists in ProcChangeProperty and ProcXChangeDeviceProperty,
|
||||
so let's fix that too.
|
||||
|
||||
CVE-2022-46344, ZDI-CAN 19405
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Acked-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/8f454b793e1f13c99872c15f0eed1d7f3b823fe8]
|
||||
CVE: CVE-2022-46344
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
Xi/xiproperty.c | 4 ++--
|
||||
dix/property.c | 3 ++-
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
|
||||
index 6ec419e..0cfa6e3 100644
|
||||
--- a/Xi/xiproperty.c
|
||||
+++ b/Xi/xiproperty.c
|
||||
@@ -890,7 +890,7 @@ ProcXChangeDeviceProperty(ClientPtr client)
|
||||
REQUEST(xChangeDevicePropertyReq);
|
||||
DeviceIntPtr dev;
|
||||
unsigned long len;
|
||||
- int totalSize;
|
||||
+ uint64_t totalSize;
|
||||
int rc;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
|
||||
@@ -1128,7 +1128,7 @@ ProcXIChangeProperty(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
DeviceIntPtr dev;
|
||||
- int totalSize;
|
||||
+ uint64_t totalSize;
|
||||
unsigned long len;
|
||||
|
||||
REQUEST(xXIChangePropertyReq);
|
||||
diff --git a/dix/property.c b/dix/property.c
|
||||
index ff1d669..6fdb74a 100644
|
||||
--- a/dix/property.c
|
||||
+++ b/dix/property.c
|
||||
@@ -205,7 +205,8 @@ ProcChangeProperty(ClientPtr client)
|
||||
WindowPtr pWin;
|
||||
char format, mode;
|
||||
unsigned long len;
|
||||
- int sizeInBytes, totalSize, err;
|
||||
+ int sizeInBytes, err;
|
||||
+ uint64_t totalSize;
|
||||
|
||||
REQUEST(xChangePropertyReq);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -8,7 +8,13 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
|
||||
file://CVE-2022-3550.patch \
|
||||
file://CVE-2022-3551.patch \
|
||||
file://CVE-2022-3553.patch \
|
||||
"
|
||||
file://CVE-2022-4283.patch \
|
||||
file://CVE-2022-46340.patch \
|
||||
file://CVE-2022-46341.patch \
|
||||
file://CVE-2022-46342.patch \
|
||||
file://CVE-2022-46343.patch \
|
||||
file://CVE-2022-46344.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "453fc86aac8c629b3a5b77e8dcca30bf"
|
||||
SRC_URI[sha256sum] = "54b199c9280ff8bf0f73a54a759645bd0eeeda7255d1c99310d5b7595f3ac066"
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ LICENSE = "\
|
||||
& Firmware-phanfw \
|
||||
& Firmware-qat \
|
||||
& Firmware-qcom \
|
||||
& Firmware-qcom-yamato \
|
||||
& Firmware-qla1280 \
|
||||
& Firmware-qla2xxx \
|
||||
& Firmware-qualcommAthos_ar3k \
|
||||
@@ -70,7 +71,7 @@ LICENSE = "\
|
||||
LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.adsp_sst;md5=615c45b91a5a4a9fe046d6ab9a2df728 \
|
||||
file://LICENCE.agere;md5=af0133de6b4a9b2522defd5f188afd31 \
|
||||
file://LICENSE.amdgpu;md5=44c1166d052226cb2d6c8d7400090203 \
|
||||
file://LICENSE.amdgpu;md5=a2589a05ea5b6bd2b7f4f623c7e7a649 \
|
||||
file://LICENSE.amd-ucode;md5=6ca90c57f7b248de1e25c7f68ffc4698 \
|
||||
file://LICENSE.amlogic_vdec;md5=dc44f59bf64a81643e500ad3f39a468a \
|
||||
file://LICENCE.atheros_firmware;md5=30a14c7823beedac9fa39c64fdd01a13 \
|
||||
@@ -109,6 +110,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \
|
||||
file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \
|
||||
file://LICENSE.qcom;md5=164e3362a538eb11d3ac51e8e134294b \
|
||||
file://LICENSE.qcom_yamato;md5=d0de0eeccaf1843a850bf7a6777eec5c \
|
||||
file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \
|
||||
file://LICENCE.qla2xxx;md5=505855e921b75f1be4a437ad9b79dff0 \
|
||||
file://LICENSE.QualcommAtheros_ar3k;md5=b5fe244fb2b532311de1472a3bc06da5 \
|
||||
@@ -132,7 +134,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
"
|
||||
# WHENCE checksum is defined separately to ease overriding it if
|
||||
# class-devupstream is selected.
|
||||
WHENCE_CHKSUM = "ab4ba608dc4b757716871f9be033f0f1"
|
||||
WHENCE_CHKSUM = "aadb3cccbde1e53fc244a409e9bd5a22"
|
||||
|
||||
# These are not common licenses, set NO_GENERIC_LICENSE for them
|
||||
# so that the license files will be copied from fetched source
|
||||
@@ -177,6 +179,7 @@ NO_GENERIC_LICENSE[Firmware-ath9k-htc] = "LICENCE.open-ath9k-htc-firmware"
|
||||
NO_GENERIC_LICENSE[Firmware-phanfw] = "LICENCE.phanfw"
|
||||
NO_GENERIC_LICENSE[Firmware-qat] = "LICENCE.qat_firmware"
|
||||
NO_GENERIC_LICENSE[Firmware-qcom] = "LICENSE.qcom"
|
||||
NO_GENERIC_LICENSE[Firmware-qcom-yamato] = "LICENSE.qcom_yamato"
|
||||
NO_GENERIC_LICENSE[Firmware-qla1280] = "LICENCE.qla1280"
|
||||
NO_GENERIC_LICENSE[Firmware-qla2xxx] = "LICENCE.qla2xxx"
|
||||
NO_GENERIC_LICENSE[Firmware-qualcommAthos_ar3k] = "LICENSE.QualcommAtheros_ar3k"
|
||||
@@ -209,7 +212,7 @@ SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmw
|
||||
# Pin this to the 20220509 release, override this in local.conf
|
||||
SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae"
|
||||
|
||||
SRC_URI[sha256sum] = "c0ddffbbcf30f2e015bddd5c6d3ce1f13976b906aceabda4a57e3c41a3190701"
|
||||
SRC_URI[sha256sum] = "6e3d9e8d52cffc4ec0dbe8533a8445328e0524a20f159a5b61c2706f983ce38a"
|
||||
|
||||
inherit allarch
|
||||
|
||||
@@ -305,7 +308,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
|
||||
${PN}-nvidia-gpu \
|
||||
${PN}-netronome-license ${PN}-netronome \
|
||||
${PN}-qat ${PN}-qat-license \
|
||||
${PN}-qcom-license \
|
||||
${PN}-qcom-license ${PN}-qcom-yamato-license \
|
||||
${PN}-qcom-venus-1.8 ${PN}-qcom-venus-4.2 ${PN}-qcom-venus-5.2 ${PN}-qcom-venus-5.4 \
|
||||
${PN}-qcom-vpu-1.0 ${PN}-qcom-vpu-2.0 \
|
||||
${PN}-qcom-adreno-a2xx ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a4xx ${PN}-qcom-adreno-a530 \
|
||||
@@ -961,14 +964,41 @@ RDEPENDS_${PN}-qat = "${PN}-qat-license"
|
||||
|
||||
# For QCOM VPU/GPU and SDM845
|
||||
LICENSE_${PN}-qcom-license = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-yamato-license = "Firmware-qcom-yamato"
|
||||
LICENSE_${PN}-qcom-venus-1.8 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-4.2 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-5.2 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-venus-5.4 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-vpu-1.0 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-vpu-2.0 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a2xx = "Firmware-qcom Firmware-qcom-yamato"
|
||||
LICENSE_${PN}-qcom-adreno-a3xx = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a4xx = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a530 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a630 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a650 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-adreno-a660 = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-apq8096-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-apq8096-modem = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-compute = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-compute = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sdm845-modem = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sm8250-audio = "Firmware-qcom"
|
||||
LICENSE_${PN}-qcom-sm8250-compute = "Firmware-qcom"
|
||||
|
||||
FILES_${PN}-qcom-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom ${nonarch_base_libdir}/firmware/qcom/NOTICE.txt"
|
||||
FILES_${PN}-qcom-yamato-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom_yamato"
|
||||
FILES_${PN}-qcom-venus-1.8 = "${nonarch_base_libdir}/firmware/qcom/venus-1.8/*"
|
||||
FILES_${PN}-qcom-venus-4.2 = "${nonarch_base_libdir}/firmware/qcom/venus-4.2/*"
|
||||
FILES_${PN}-qcom-venus-5.2 = "${nonarch_base_libdir}/firmware/qcom/venus-5.2/*"
|
||||
FILES_${PN}-qcom-venus-5.4 = "${nonarch_base_libdir}/firmware/qcom/venus-5.4/*"
|
||||
FILES_${PN}-qcom-vpu-1.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-1.0/*"
|
||||
FILES_${PN}-qcom-vpu-2.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-2.0/*"
|
||||
FILES_${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw ${nonarch_base_libdir}/firmware/qcom/yamato_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a3xx = "${nonarch_base_libdir}/firmware/qcom/a3*_*.fw ${nonarch_base_libdir}/firmware/a300_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a4xx = "${nonarch_base_libdir}/firmware/qcom/a4*_*.fw"
|
||||
FILES_${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.*"
|
||||
@@ -994,7 +1024,7 @@ RDEPENDS_${PN}-qcom-venus-5.4 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-vpu-1.0 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-vpu-2.0 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a2xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a3xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a2xx = "${PN}-qcom-license ${PN}-qcom-yamato-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a4xx = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a530 = "${PN}-qcom-license"
|
||||
RDEPENDS_${PN}-qcom-adreno-a630 = "${PN}-qcom-license"
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
inherit kernel
|
||||
require recipes-kernel/linux/linux-yocto.inc
|
||||
# for ncurses tests
|
||||
inherit pkgconfig
|
||||
|
||||
# provide this .inc to set specific revisions
|
||||
include recipes-kernel/linux/linux-yocto-dev-revisions.inc
|
||||
|
||||
@@ -11,13 +11,13 @@ python () {
|
||||
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
|
||||
}
|
||||
|
||||
SRCREV_machine ?= "acaf6e01f6ecd6d80ac02f552344c6c0de1c7fe1"
|
||||
SRCREV_meta ?= "b00c12ce7affe7e5da43fa4285998866a51e6e79"
|
||||
SRCREV_machine ?= "053238af99b52ce5ffb19755cdfeb10f206463da"
|
||||
SRCREV_meta ?= "9c5bb858a6f5a9b1cc2e585e74e8517387863fd7"
|
||||
|
||||
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.228"
|
||||
LINUX_VERSION ?= "5.4.230"
|
||||
|
||||
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.228"
|
||||
LINUX_VERSION ?= "5.4.230"
|
||||
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 ?= "575c3de9d720c998b5b4ab0253893a4132b4423f"
|
||||
SRCREV_machine ?= "b72387f2b7f2babf1b0ca6e4ced3b22538162474"
|
||||
SRCREV_meta ?= "b00c12ce7affe7e5da43fa4285998866a51e6e79"
|
||||
SRCREV_machine_qemuarm ?= "8517d03dcde5d19a2fd9493433275b3790450ae5"
|
||||
SRCREV_machine ?= "d05044bfcb54db9a3dfb9cccd3a39c2c07d844b1"
|
||||
SRCREV_meta ?= "9c5bb858a6f5a9b1cc2e585e74e8517387863fd7"
|
||||
|
||||
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 ?= "32654a547b05ba63c604503fc865d7052ae96992"
|
||||
SRCREV_machine_qemuarm64 ?= "2bd8ca7c0973870753b103107513689a598383d7"
|
||||
SRCREV_machine_qemumips ?= "84a8ba0ada556ba3307c33e2b5a0ca8f9e3df1dd"
|
||||
SRCREV_machine_qemuppc ?= "20db90d7935c8760bfc68c0de4f7d7085cba7c14"
|
||||
SRCREV_machine_qemuriscv64 ?= "921d9e22542506ba26c2e5e2f25ec00ff9bffa63"
|
||||
SRCREV_machine_qemux86 ?= "921d9e22542506ba26c2e5e2f25ec00ff9bffa63"
|
||||
SRCREV_machine_qemux86-64 ?= "921d9e22542506ba26c2e5e2f25ec00ff9bffa63"
|
||||
SRCREV_machine_qemumips64 ?= "929fde255b362923e9bba63250005b09c3a50f45"
|
||||
SRCREV_machine ?= "921d9e22542506ba26c2e5e2f25ec00ff9bffa63"
|
||||
SRCREV_meta ?= "b00c12ce7affe7e5da43fa4285998866a51e6e79"
|
||||
SRCREV_machine_qemuarm ?= "c3e35e461a4f880bfe3d007c763fe4ff1670621f"
|
||||
SRCREV_machine_qemuarm64 ?= "5604d6b87d39cd4eb427762610f505d5659ce73f"
|
||||
SRCREV_machine_qemumips ?= "d0ef5b5eea98083cbb30d42bb191b280d2637a02"
|
||||
SRCREV_machine_qemuppc ?= "79202d38795f70dd5c7601cbc8d1c54ecb831ad9"
|
||||
SRCREV_machine_qemuriscv64 ?= "c32d5a645da049cf72f9e6b819c32609c7effcec"
|
||||
SRCREV_machine_qemux86 ?= "c32d5a645da049cf72f9e6b819c32609c7effcec"
|
||||
SRCREV_machine_qemux86-64 ?= "c32d5a645da049cf72f9e6b819c32609c7effcec"
|
||||
SRCREV_machine_qemumips64 ?= "eafe1aabab778a089d20f0c686902a7a7215b57e"
|
||||
SRCREV_machine ?= "c32d5a645da049cf72f9e6b819c32609c7effcec"
|
||||
SRCREV_meta ?= "9c5bb858a6f5a9b1cc2e585e74e8517387863fd7"
|
||||
|
||||
# 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.228"
|
||||
LINUX_VERSION ?= "5.4.230"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
From cb78974394a9af865e1d2d606e838dbec0de80e8 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 5 Oct 2020 15:31:42 -0400
|
||||
Subject: [PATCH 01/16] fix: strncpy equals destination size warning
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Some versions of GCC when called with -Wstringop-truncation will warn
|
||||
when doing a copy of the same size as the destination buffer with
|
||||
strncpy :
|
||||
|
||||
‘strncpy’ specified bound 256 equals destination size [-Werror=stringop-truncation]
|
||||
|
||||
Since we unconditionally write '\0' in the last byte, reduce the copy
|
||||
size by one.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Change-Id: Idb907c9550817a06fc0dffc489740f63d440e7d4
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
---
|
||||
lttng-syscalls.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lttng-syscalls.c b/lttng-syscalls.c
|
||||
index 49c0d81b..b43dd570 100644
|
||||
--- a/lttng-syscalls.c
|
||||
+++ b/lttng-syscalls.c
|
||||
@@ -719,7 +719,7 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
|
||||
ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
|
||||
break;
|
||||
}
|
||||
- strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
|
||||
+ strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN - 1);
|
||||
ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
|
||||
ev.instrumentation = LTTNG_KERNEL_SYSCALL;
|
||||
chan_table[i] = _lttng_event_create(chan, &ev, filter,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
From 8e4e8641961df32bfe519fd18d899250951acd1a Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 13:41:02 -0400
|
||||
Subject: [PATCH 02/16] fix: objtool: Rename frame.h -> objtool.h (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit 00089c048eb4a8250325efb32a2724fd0da68cce
|
||||
Author: Julien Thierry <jthierry@redhat.com>
|
||||
Date: Fri Sep 4 16:30:25 2020 +0100
|
||||
|
||||
objtool: Rename frame.h -> objtool.h
|
||||
|
||||
Header frame.h is getting more code annotations to help objtool analyze
|
||||
object files.
|
||||
|
||||
Rename the file to objtool.h.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: Ic2283161bebcbf1e33b72805eb4d2628f4ae3e89
|
||||
---
|
||||
lttng-filter-interpreter.c | 2 +-
|
||||
wrapper/{frame.h => objtool.h} | 19 ++++++++++++-------
|
||||
2 files changed, 13 insertions(+), 8 deletions(-)
|
||||
rename wrapper/{frame.h => objtool.h} (50%)
|
||||
|
||||
diff --git a/lttng-filter-interpreter.c b/lttng-filter-interpreter.c
|
||||
index 21169f01..5d572437 100644
|
||||
--- a/lttng-filter-interpreter.c
|
||||
+++ b/lttng-filter-interpreter.c
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <wrapper/uaccess.h>
|
||||
-#include <wrapper/frame.h>
|
||||
+#include <wrapper/objtool.h>
|
||||
#include <wrapper/types.h>
|
||||
#include <linux/swab.h>
|
||||
|
||||
diff --git a/wrapper/frame.h b/wrapper/objtool.h
|
||||
similarity index 50%
|
||||
rename from wrapper/frame.h
|
||||
rename to wrapper/objtool.h
|
||||
index 6e6dc811..3b997cae 100644
|
||||
--- a/wrapper/frame.h
|
||||
+++ b/wrapper/objtool.h
|
||||
@@ -1,18 +1,23 @@
|
||||
-/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
|
||||
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
|
||||
*
|
||||
- * wrapper/frame.h
|
||||
+ * wrapper/objtool.h
|
||||
*
|
||||
* Copyright (C) 2016 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
*/
|
||||
|
||||
-#ifndef _LTTNG_WRAPPER_FRAME_H
|
||||
-#define _LTTNG_WRAPPER_FRAME_H
|
||||
+#ifndef _LTTNG_WRAPPER_OBJTOOL_H
|
||||
+#define _LTTNG_WRAPPER_OBJTOOL_H
|
||||
|
||||
#include <linux/version.h>
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
|
||||
-
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+#include <linux/objtool.h>
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
|
||||
#include <linux/frame.h>
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0))
|
||||
|
||||
#define LTTNG_STACK_FRAME_NON_STANDARD(func) \
|
||||
STACK_FRAME_NON_STANDARD(func)
|
||||
@@ -23,4 +28,4 @@
|
||||
|
||||
#endif
|
||||
|
||||
-#endif /* _LTTNG_WRAPPER_FRAME_H */
|
||||
+#endif /* _LTTNG_WRAPPER_OBJTOOL_H */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,316 +0,0 @@
|
||||
From 5a3b76a81fd3df52405700d369223d64c7a04dc8 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Tue, 27 Oct 2020 11:42:23 -0400
|
||||
Subject: [PATCH 03/16] fix: btrfs: tracepoints: output proper root owner for
|
||||
trace_find_free_extent() (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit 437490fed3b0c9ae21af8f70e0f338d34560842b
|
||||
Author: Qu Wenruo <wqu@suse.com>
|
||||
Date: Tue Jul 28 09:42:49 2020 +0800
|
||||
|
||||
btrfs: tracepoints: output proper root owner for trace_find_free_extent()
|
||||
|
||||
The current trace event always output result like this:
|
||||
|
||||
find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=4(METADATA)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=8192 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=4096 empty_size=0 flags=1(DATA)
|
||||
|
||||
T's saying we're allocating data extent for EXTENT tree, which is not
|
||||
even possible.
|
||||
|
||||
It's because we always use EXTENT tree as the owner for
|
||||
trace_find_free_extent() without using the @root from
|
||||
btrfs_reserve_extent().
|
||||
|
||||
This patch will change the parameter to use proper @root for
|
||||
trace_find_free_extent():
|
||||
|
||||
Now it looks much better:
|
||||
|
||||
find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
|
||||
find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=5(FS_TREE) len=4096 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=5(FS_TREE) len=8192 empty_size=0 flags=1(DATA)
|
||||
find_free_extent: root=5(FS_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
|
||||
find_free_extent: root=7(CSUM_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
|
||||
find_free_extent: root=2(EXTENT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
|
||||
find_free_extent: root=1(ROOT_TREE) len=16384 empty_size=0 flags=36(METADATA|DUP)
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: I1d674064d29b31417e2acffdeb735f5052a87032
|
||||
---
|
||||
instrumentation/events/lttng-module/btrfs.h | 206 ++++++++++++--------
|
||||
1 file changed, 122 insertions(+), 84 deletions(-)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h
|
||||
index 7b290085..52fcfd0d 100644
|
||||
--- a/instrumentation/events/lttng-module/btrfs.h
|
||||
+++ b/instrumentation/events/lttng-module/btrfs.h
|
||||
@@ -1856,7 +1856,29 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserved_extent, btrfs_reserved_extent_f
|
||||
|
||||
#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)) */
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0) || \
|
||||
+ LTTNG_KERNEL_RANGE(5,9,6, 5,10,0) || \
|
||||
+ LTTNG_KERNEL_RANGE(5,4,78, 5,5,0))
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(root, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_array(u8, fsid, root->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
+ ctf_integer(u64, root_objectid, root->root_key.objectid)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
|
||||
+
|
||||
LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
|
||||
btrfs_find_free_extent,
|
||||
@@ -1874,6 +1896,105 @@ LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
)
|
||||
)
|
||||
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+#elif (LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(root, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(u64, root_objectid, root->root_key.objectid)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
+
|
||||
+ btrfs_find_free_extent,
|
||||
+
|
||||
+ TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
|
||||
+ u64 data),
|
||||
+
|
||||
+ TP_ARGS(root, num_bytes, empty_size, data),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(u64, root_objectid, root->root_key.objectid)
|
||||
+ ctf_integer(u64, num_bytes, num_bytes)
|
||||
+ ctf_integer(u64, empty_size, empty_size)
|
||||
+ ctf_integer(u64, data, data)
|
||||
+ )
|
||||
+)
|
||||
+#endif
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,5,0))
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
TP_PROTO(const struct btrfs_block_group *block_group, u64 start,
|
||||
@@ -1907,22 +2028,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
|
||||
)
|
||||
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0))
|
||||
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
-
|
||||
- btrfs_find_free_extent,
|
||||
-
|
||||
- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
- u64 data),
|
||||
-
|
||||
- TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
-
|
||||
- TP_FIELDS(
|
||||
- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
- ctf_integer(u64, num_bytes, num_bytes)
|
||||
- ctf_integer(u64, empty_size, empty_size)
|
||||
- ctf_integer(u64, data, data)
|
||||
- )
|
||||
-)
|
||||
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
@@ -1957,22 +2062,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
|
||||
)
|
||||
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
|
||||
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
-
|
||||
- btrfs_find_free_extent,
|
||||
-
|
||||
- TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
- u64 data),
|
||||
-
|
||||
- TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
-
|
||||
- TP_FIELDS(
|
||||
- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
- ctf_integer(u64, num_bytes, num_bytes)
|
||||
- ctf_integer(u64, empty_size, empty_size)
|
||||
- ctf_integer(u64, data, data)
|
||||
- )
|
||||
-)
|
||||
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
@@ -2011,23 +2100,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
|
||||
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
|
||||
|
||||
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
-
|
||||
- btrfs_find_free_extent,
|
||||
-
|
||||
- TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size,
|
||||
- u64 data),
|
||||
-
|
||||
- TP_ARGS(fs_info, num_bytes, empty_size, data),
|
||||
-
|
||||
- TP_FIELDS(
|
||||
- ctf_array(u8, fsid, lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
- ctf_integer(u64, num_bytes, num_bytes)
|
||||
- ctf_integer(u64, empty_size, empty_size)
|
||||
- ctf_integer(u64, data, data)
|
||||
- )
|
||||
-)
|
||||
-
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
TP_PROTO(struct btrfs_fs_info *fs_info,
|
||||
@@ -2066,23 +2138,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
|
||||
LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
|
||||
LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
|
||||
|
||||
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
-
|
||||
- btrfs_find_free_extent,
|
||||
-
|
||||
- TP_PROTO(const struct btrfs_root *root, u64 num_bytes, u64 empty_size,
|
||||
- u64 data),
|
||||
-
|
||||
- TP_ARGS(root, num_bytes, empty_size, data),
|
||||
-
|
||||
- TP_FIELDS(
|
||||
- ctf_integer(u64, root_objectid, root->root_key.objectid)
|
||||
- ctf_integer(u64, num_bytes, num_bytes)
|
||||
- ctf_integer(u64, empty_size, empty_size)
|
||||
- ctf_integer(u64, data, data)
|
||||
- )
|
||||
-)
|
||||
-
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
TP_PROTO(const struct btrfs_root *root,
|
||||
@@ -2120,23 +2175,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__reserve_extent, btrfs_reserve_extent_clus
|
||||
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
|
||||
|
||||
-LTTNG_TRACEPOINT_EVENT_MAP(find_free_extent,
|
||||
-
|
||||
- btrfs_find_free_extent,
|
||||
-
|
||||
- TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size,
|
||||
- u64 data),
|
||||
-
|
||||
- TP_ARGS(root, num_bytes, empty_size, data),
|
||||
-
|
||||
- TP_FIELDS(
|
||||
- ctf_integer(u64, root_objectid, root->root_key.objectid)
|
||||
- ctf_integer(u64, num_bytes, num_bytes)
|
||||
- ctf_integer(u64, empty_size, empty_size)
|
||||
- ctf_integer(u64, data, data)
|
||||
- )
|
||||
-)
|
||||
-
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__reserve_extent,
|
||||
|
||||
TP_PROTO(struct btrfs_root *root,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
From d51a3332909ff034c8ec16ead0090bd6a4e2bc38 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Tue, 27 Oct 2020 12:10:05 -0400
|
||||
Subject: [PATCH 04/16] fix: btrfs: make ordered extent tracepoint take
|
||||
btrfs_inode (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit acbf1dd0fcbd10c67826a19958f55a053b32f532
|
||||
Author: Nikolay Borisov <nborisov@suse.com>
|
||||
Date: Mon Aug 31 14:42:40 2020 +0300
|
||||
|
||||
btrfs: make ordered extent tracepoint take btrfs_inode
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: I096d0801ffe0ad826cfe414cdd1c0857cbd2b624
|
||||
---
|
||||
instrumentation/events/lttng-module/btrfs.h | 120 +++++++++++++++-----
|
||||
1 file changed, 90 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/btrfs.h b/instrumentation/events/lttng-module/btrfs.h
|
||||
index 52fcfd0d..d47f3280 100644
|
||||
--- a/instrumentation/events/lttng-module/btrfs.h
|
||||
+++ b/instrumentation/events/lttng-module/btrfs.h
|
||||
@@ -346,7 +346,29 @@ LTTNG_TRACEPOINT_EVENT(btrfs_handle_em_exist,
|
||||
)
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_inode *inode,
|
||||
+ const struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_array(u8, fsid, inode->root->lttng_fs_info_fsid, BTRFS_UUID_SIZE)
|
||||
+ ctf_integer(ino_t, ino, btrfs_ino(inode))
|
||||
+ ctf_integer(u64, file_offset, ordered->file_offset)
|
||||
+ ctf_integer(u64, start, ordered->disk_bytenr)
|
||||
+ ctf_integer(u64, len, ordered->num_bytes)
|
||||
+ ctf_integer(u64, disk_len, ordered->disk_num_bytes)
|
||||
+ ctf_integer(u64, bytes_left, ordered->bytes_left)
|
||||
+ ctf_integer(unsigned long, flags, ordered->flags)
|
||||
+ ctf_integer(int, compress_type, ordered->compress_type)
|
||||
+ ctf_integer(int, refs, refcount_read(&ordered->refs))
|
||||
+ ctf_integer(u64, root_objectid, inode->root->root_key.objectid)
|
||||
+ )
|
||||
+)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
|
||||
|
||||
TP_PROTO(const struct inode *inode,
|
||||
@@ -458,7 +480,39 @@ LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__ordered_extent,
|
||||
)
|
||||
#endif
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_inode *inode,
|
||||
+ const struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_inode *inode,
|
||||
+ const struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_inode *inode,
|
||||
+ const struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
|
||||
+
|
||||
+ TP_PROTO(const struct btrfs_inode *inode,
|
||||
+ const struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
|
||||
LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
|
||||
LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
|
||||
LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
|
||||
@@ -494,7 +548,41 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
|
||||
|
||||
TP_ARGS(inode, ordered)
|
||||
)
|
||||
+#else
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
|
||||
+
|
||||
+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
|
||||
+
|
||||
+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
|
||||
+
|
||||
+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
|
||||
+LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
|
||||
+
|
||||
+ TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
+
|
||||
+ TP_ARGS(inode, ordered)
|
||||
+)
|
||||
+#endif
|
||||
+
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,73,5,0,0, 4,4,73,6,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,82,6,0,0, 4,4,82,7,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,92,6,0,0, 4,4,92,7,0,0) || \
|
||||
+ LTTNG_SLE_KERNEL_RANGE(4,4,103,6,0,0, 4,5,0,0,0,0))
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
|
||||
|
||||
TP_PROTO(const struct page *page, const struct inode *inode,
|
||||
@@ -563,34 +651,6 @@ LTTNG_TRACEPOINT_EVENT(btrfs_sync_file,
|
||||
)
|
||||
)
|
||||
#else
|
||||
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_add,
|
||||
-
|
||||
- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
-
|
||||
- TP_ARGS(inode, ordered)
|
||||
-)
|
||||
-
|
||||
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_remove,
|
||||
-
|
||||
- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
-
|
||||
- TP_ARGS(inode, ordered)
|
||||
-)
|
||||
-
|
||||
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_start,
|
||||
-
|
||||
- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
-
|
||||
- TP_ARGS(inode, ordered)
|
||||
-)
|
||||
-
|
||||
-LTTNG_TRACEPOINT_EVENT_INSTANCE(btrfs__ordered_extent, btrfs_ordered_extent_put,
|
||||
-
|
||||
- TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered),
|
||||
-
|
||||
- TP_ARGS(inode, ordered)
|
||||
-)
|
||||
-
|
||||
LTTNG_TRACEPOINT_EVENT_CLASS(btrfs__writepage,
|
||||
|
||||
TP_PROTO(struct page *page, struct inode *inode,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
From b96f5364ba4d5a8b9e8159fe0b9e20d598a1c0f5 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 17:03:23 -0400
|
||||
Subject: [PATCH 05/16] fix: ext4: fast commit recovery path (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit 8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2
|
||||
Author: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
|
||||
Date: Thu Oct 15 13:37:59 2020 -0700
|
||||
|
||||
ext4: fast commit recovery path
|
||||
|
||||
This patch adds fast commit recovery path support for Ext4 file
|
||||
system. We add several helper functions that are similar in spirit to
|
||||
e2fsprogs journal recovery path handlers. Example of such functions
|
||||
include - a simple block allocator, idempotent block bitmap update
|
||||
function etc. Using these routines and the fast commit log in the fast
|
||||
commit area, the recovery path (ext4_fc_replay()) performs fast commit
|
||||
log recovery.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: Ia65cf44e108f2df0b458f0d335f33a8f18f50baa
|
||||
---
|
||||
instrumentation/events/lttng-module/ext4.h | 40 ++++++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
|
||||
index f9a55e29..5fddccad 100644
|
||||
--- a/instrumentation/events/lttng-module/ext4.h
|
||||
+++ b/instrumentation/events/lttng-module/ext4.h
|
||||
@@ -1423,6 +1423,18 @@ LTTNG_TRACEPOINT_EVENT(ext4_ext_load_extent,
|
||||
)
|
||||
)
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
|
||||
+ TP_PROTO(struct super_block *sb, unsigned long ino),
|
||||
+
|
||||
+ TP_ARGS(sb, ino),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(dev_t, dev, sb->s_dev)
|
||||
+ ctf_integer(ino_t, ino, ino)
|
||||
+ )
|
||||
+)
|
||||
+#else
|
||||
LTTNG_TRACEPOINT_EVENT(ext4_load_inode,
|
||||
TP_PROTO(struct inode *inode),
|
||||
|
||||
@@ -2045,6 +2057,34 @@ LTTNG_TRACEPOINT_EVENT(ext4_es_shrink_exit,
|
||||
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT(ext4_fc_replay_scan,
|
||||
+ TP_PROTO(struct super_block *sb, int error, int off),
|
||||
+
|
||||
+ TP_ARGS(sb, error, off),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(dev_t, dev, sb->s_dev)
|
||||
+ ctf_integer(int, error, error)
|
||||
+ ctf_integer(int, off, off)
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT(ext4_fc_replay,
|
||||
+ TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2),
|
||||
+
|
||||
+ TP_ARGS(sb, tag, ino, priv1, priv2),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(dev_t, dev, sb->s_dev)
|
||||
+ ctf_integer(int, tag, tag)
|
||||
+ ctf_integer(int, ino, ino)
|
||||
+ ctf_integer(int, priv1, priv1)
|
||||
+ ctf_integer(int, priv2, priv2)
|
||||
+ )
|
||||
+)
|
||||
+#endif
|
||||
+
|
||||
#endif /* LTTNG_TRACE_EXT4_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
From a6334775b763c187d84914e89a0b835a793ae0fd Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 14:11:17 -0400
|
||||
Subject: [PATCH 06/16] fix: KVM: x86: Add intr/vectoring info and error code
|
||||
to kvm_exit tracepoint (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit 235ba74f008d2e0936b29f77f68d4e2f73ffd24a
|
||||
Author: Sean Christopherson <sean.j.christopherson@intel.com>
|
||||
Date: Wed Sep 23 13:13:46 2020 -0700
|
||||
|
||||
KVM: x86: Add intr/vectoring info and error code to kvm_exit tracepoint
|
||||
|
||||
Extend the kvm_exit tracepoint to align it with kvm_nested_vmexit in
|
||||
terms of what information is captured. On SVM, add interrupt info and
|
||||
error code, while on VMX it add IDT vectoring and error code. This
|
||||
sets the stage for macrofying the kvm_exit tracepoint definition so that
|
||||
it can be reused for kvm_nested_vmexit without loss of information.
|
||||
|
||||
Opportunistically stuff a zero for VM_EXIT_INTR_INFO if the VM-Enter
|
||||
failed, as the field is guaranteed to be invalid. Note, it'd be
|
||||
possible to further filter the interrupt/exception fields based on the
|
||||
VM-Exit reason, but the helper is intended only for tracepoints, i.e.
|
||||
an extra VMREAD or two is a non-issue, the failed VM-Enter case is just
|
||||
low hanging fruit.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: I638fa29ef7d8bb432de42a33f9ae4db43259b915
|
||||
---
|
||||
.../events/lttng-module/arch/x86/kvm/trace.h | 55 ++++++++++++++++++-
|
||||
1 file changed, 53 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
|
||||
index 4416ae02..0917b51f 100644
|
||||
--- a/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
|
||||
+++ b/instrumentation/events/lttng-module/arch/x86/kvm/trace.h
|
||||
@@ -115,6 +115,37 @@ LTTNG_TRACEPOINT_EVENT_MAP(kvm_apic, kvm_x86_apic,
|
||||
/*
|
||||
* Tracepoint for kvm guest exit:
|
||||
*/
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
|
||||
+ TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
|
||||
+ TP_ARGS(exit_reason, vcpu, isa),
|
||||
+
|
||||
+ TP_locvar(
|
||||
+ u64 info1, info2;
|
||||
+ u32 intr_info, error_code;
|
||||
+ ),
|
||||
+
|
||||
+ TP_code_pre(
|
||||
+ kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1,
|
||||
+ &tp_locvar->info2,
|
||||
+ &tp_locvar->intr_info,
|
||||
+ &tp_locvar->error_code);
|
||||
+ ),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(unsigned int, exit_reason, exit_reason)
|
||||
+ ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu))
|
||||
+ ctf_integer(u32, isa, isa)
|
||||
+ ctf_integer(u64, info1, tp_locvar->info1)
|
||||
+ ctf_integer(u64, info2, tp_locvar->info2)
|
||||
+ ctf_integer(u32, intr_info, tp_locvar->intr_info)
|
||||
+ ctf_integer(u32, error_code, tp_locvar->error_code)
|
||||
+ ctf_integer(unsigned int, vcpu_id, vcpu->vcpu_id)
|
||||
+ ),
|
||||
+
|
||||
+ TP_code_post()
|
||||
+)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
|
||||
LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
|
||||
TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
|
||||
TP_ARGS(exit_reason, vcpu, isa),
|
||||
@@ -124,13 +155,32 @@ LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
|
||||
),
|
||||
|
||||
TP_code_pre(
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0))
|
||||
kvm_x86_ops.get_exit_info(vcpu, &tp_locvar->info1,
|
||||
&tp_locvar->info2);
|
||||
+ ),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(unsigned int, exit_reason, exit_reason)
|
||||
+ ctf_integer(unsigned long, guest_rip, kvm_rip_read(vcpu))
|
||||
+ ctf_integer(u32, isa, isa)
|
||||
+ ctf_integer(u64, info1, tp_locvar->info1)
|
||||
+ ctf_integer(u64, info2, tp_locvar->info2)
|
||||
+ ),
|
||||
+
|
||||
+ TP_code_post()
|
||||
+)
|
||||
#else
|
||||
+LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
|
||||
+ TP_PROTO(unsigned int exit_reason, struct kvm_vcpu *vcpu, u32 isa),
|
||||
+ TP_ARGS(exit_reason, vcpu, isa),
|
||||
+
|
||||
+ TP_locvar(
|
||||
+ u64 info1, info2;
|
||||
+ ),
|
||||
+
|
||||
+ TP_code_pre(
|
||||
kvm_x86_ops->get_exit_info(vcpu, &tp_locvar->info1,
|
||||
&tp_locvar->info2);
|
||||
-#endif
|
||||
),
|
||||
|
||||
TP_FIELDS(
|
||||
@@ -143,6 +193,7 @@ LTTNG_TRACEPOINT_EVENT_CODE_MAP(kvm_exit, kvm_x86_exit,
|
||||
|
||||
TP_code_post()
|
||||
)
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Tracepoint for kvm interrupt injection:
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 2f421c43c60b2c9d3ed63c1a363320e98a536a35 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 14:28:35 -0400
|
||||
Subject: [PATCH 07/16] fix: kvm: x86/mmu: Add TDP MMU PF handler (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit bb18842e21111a979e2e0e1c5d85c09646f18d51
|
||||
Author: Ben Gardon <bgardon@google.com>
|
||||
Date: Wed Oct 14 11:26:50 2020 -0700
|
||||
|
||||
kvm: x86/mmu: Add TDP MMU PF handler
|
||||
|
||||
Add functions to handle page faults in the TDP MMU. These page faults
|
||||
are currently handled in much the same way as the x86 shadow paging
|
||||
based MMU, however the ordering of some operations is slightly
|
||||
different. Future patches will add eager NX splitting, a fast page fault
|
||||
handler, and parallel page faults.
|
||||
|
||||
Tested by running kvm-unit-tests and KVM selftests on an Intel Haswell
|
||||
machine. This series introduced no new failures.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: Ie56959cb6c77913d2f1188b0ca15da9114623a4e
|
||||
---
|
||||
.../lttng-module/arch/x86/kvm/mmutrace.h | 20 ++++++++++++++++++-
|
||||
probes/lttng-probe-kvm-x86-mmu.c | 5 +++++
|
||||
2 files changed, 24 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
index e5470400..86717835 100644
|
||||
--- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
+++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
@@ -163,7 +163,25 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
|
||||
TP_ARGS(sp)
|
||||
)
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(
|
||||
+ mark_mmio_spte,
|
||||
+
|
||||
+ kvm_mmu_mark_mmio_spte,
|
||||
+
|
||||
+ TP_PROTO(u64 *sptep, gfn_t gfn, u64 spte),
|
||||
+ TP_ARGS(sptep, gfn, spte),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer_hex(void *, sptep, sptep)
|
||||
+ ctf_integer(gfn_t, gfn, gfn)
|
||||
+ ctf_integer(unsigned, access, spte & ACC_ALL)
|
||||
+ ctf_integer(unsigned int, gen, get_mmio_spte_generation(spte))
|
||||
+ )
|
||||
+)
|
||||
+
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0))
|
||||
|
||||
LTTNG_TRACEPOINT_EVENT_MAP(
|
||||
mark_mmio_spte,
|
||||
diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
|
||||
index 8f981865..5043c776 100644
|
||||
--- a/probes/lttng-probe-kvm-x86-mmu.c
|
||||
+++ b/probes/lttng-probe-kvm-x86-mmu.c
|
||||
@@ -31,6 +31,11 @@
|
||||
#include <../../arch/x86/kvm/mmutrace.h>
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+#include <../arch/x86/kvm/mmu.h>
|
||||
+#include <../arch/x86/kvm/mmu/spte.h>
|
||||
+#endif
|
||||
+
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
From 14bbccffa579f4d66e2900843d6afae1294ce7c8 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 17:07:13 -0400
|
||||
Subject: [PATCH 08/16] fix: KVM: x86/mmu: Return unique RET_PF_* values if the
|
||||
fault was fixed (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit c4371c2a682e0da1ed2cd7e3c5496f055d873554
|
||||
Author: Sean Christopherson <sean.j.christopherson@intel.com>
|
||||
Date: Wed Sep 23 15:04:24 2020 -0700
|
||||
|
||||
KVM: x86/mmu: Return unique RET_PF_* values if the fault was fixed
|
||||
|
||||
Introduce RET_PF_FIXED and RET_PF_SPURIOUS to provide unique return
|
||||
values instead of overloading RET_PF_RETRY. In the short term, the
|
||||
unique values add clarity to the code and RET_PF_SPURIOUS will be used
|
||||
by set_spte() to avoid unnecessary work for spurious faults.
|
||||
|
||||
In the long term, TDX will use RET_PF_FIXED to deterministically map
|
||||
memory during pre-boot. The page fault flow may bail early for benign
|
||||
reasons, e.g. if the mmu_notifier fires for an unrelated address. With
|
||||
only RET_PF_RETRY, it's impossible for the caller to distinguish between
|
||||
"cool, page is mapped" and "darn, need to try again", and thus cannot
|
||||
handle benign cases like the mmu_notifier retry.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
Change-Id: Ie0855c78852b45f588e131fe2463e15aae1bc023
|
||||
---
|
||||
.../lttng-module/arch/x86/kvm/mmutrace.h | 22 ++++++++++++++++++-
|
||||
1 file changed, 21 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
index 86717835..cdf0609f 100644
|
||||
--- a/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
+++ b/instrumentation/events/lttng-module/arch/x86/kvm/mmutrace.h
|
||||
@@ -233,7 +233,27 @@ LTTNG_TRACEPOINT_EVENT_MAP(
|
||||
)
|
||||
)
|
||||
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) || \
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+LTTNG_TRACEPOINT_EVENT_MAP(
|
||||
+ fast_page_fault,
|
||||
+
|
||||
+ kvm_mmu_fast_page_fault,
|
||||
+
|
||||
+ TP_PROTO(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u32 error_code,
|
||||
+ u64 *sptep, u64 old_spte, int ret),
|
||||
+ TP_ARGS(vcpu, cr2_or_gpa, error_code, sptep, old_spte, ret),
|
||||
+
|
||||
+ TP_FIELDS(
|
||||
+ ctf_integer(int, vcpu_id, vcpu->vcpu_id)
|
||||
+ ctf_integer(gpa_t, cr2_or_gpa, cr2_or_gpa)
|
||||
+ ctf_integer(u32, error_code, error_code)
|
||||
+ ctf_integer_hex(u64 *, sptep, sptep)
|
||||
+ ctf_integer(u64, old_spte, old_spte)
|
||||
+ ctf_integer(u64, new_spte, *sptep)
|
||||
+ ctf_integer(int, ret, ret)
|
||||
+ )
|
||||
+)
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) || \
|
||||
LTTNG_KERNEL_RANGE(4,19,103, 4,20,0) || \
|
||||
LTTNG_KERNEL_RANGE(5,4,19, 5,5,0) || \
|
||||
LTTNG_KERNEL_RANGE(5,5,3, 5,6,0) || \
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
From c6b31b349fe901a8f586a66064f9e9b15449ac1c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Mon, 26 Oct 2020 17:09:05 -0400
|
||||
Subject: [PATCH 09/16] fix: tracepoint: Optimize using static_call() (v5.10)
|
||||
|
||||
See upstream commit :
|
||||
|
||||
commit d25e37d89dd2f41d7acae0429039d2f0ae8b4a07
|
||||
Author: Steven Rostedt (VMware) <rostedt@goodmis.org>
|
||||
Date: Tue Aug 18 15:57:52 2020 +0200
|
||||
|
||||
tracepoint: Optimize using static_call()
|
||||
|
||||
Currently the tracepoint site will iterate a vector and issue indirect
|
||||
calls to however many handlers are registered (ie. the vector is
|
||||
long).
|
||||
|
||||
Using static_call() it is possible to optimize this for the common
|
||||
case of only having a single handler registered. In this case the
|
||||
static_call() can directly call this handler. Otherwise, if the vector
|
||||
is longer than 1, call a function that iterates the whole vector like
|
||||
the current code.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Change-Id: I739dd84d62cc1a821b8bd8acff74fa29aa25d22f
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
---
|
||||
lttng-statedump-impl.c | 44 ++++++++++++++++++++++++++++++++-------
|
||||
probes/lttng.c | 7 +++++--
|
||||
tests/probes/lttng-test.c | 7 ++++++-
|
||||
wrapper/tracepoint.h | 8 +++++++
|
||||
4 files changed, 56 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c
|
||||
index 54a309d1..e0b19b42 100644
|
||||
--- a/lttng-statedump-impl.c
|
||||
+++ b/lttng-statedump-impl.c
|
||||
@@ -55,13 +55,43 @@
|
||||
#define LTTNG_INSTRUMENTATION
|
||||
#include <instrumentation/events/lttng-module/lttng-statedump.h>
|
||||
|
||||
-DEFINE_TRACE(lttng_statedump_block_device);
|
||||
-DEFINE_TRACE(lttng_statedump_end);
|
||||
-DEFINE_TRACE(lttng_statedump_interrupt);
|
||||
-DEFINE_TRACE(lttng_statedump_file_descriptor);
|
||||
-DEFINE_TRACE(lttng_statedump_start);
|
||||
-DEFINE_TRACE(lttng_statedump_process_state);
|
||||
-DEFINE_TRACE(lttng_statedump_network_interface);
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_block_device,
|
||||
+ TP_PROTO(struct lttng_session *session,
|
||||
+ dev_t dev, const char *diskname),
|
||||
+ TP_ARGS(session, dev, diskname));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_end,
|
||||
+ TP_PROTO(struct lttng_session *session),
|
||||
+ TP_ARGS(session));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_interrupt,
|
||||
+ TP_PROTO(struct lttng_session *session,
|
||||
+ unsigned int irq, const char *chip_name,
|
||||
+ struct irqaction *action),
|
||||
+ TP_ARGS(session, irq, chip_name, action));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_file_descriptor,
|
||||
+ TP_PROTO(struct lttng_session *session,
|
||||
+ struct files_struct *files,
|
||||
+ int fd, const char *filename,
|
||||
+ unsigned int flags, fmode_t fmode),
|
||||
+ TP_ARGS(session, files, fd, filename, flags, fmode));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_start,
|
||||
+ TP_PROTO(struct lttng_session *session),
|
||||
+ TP_ARGS(session));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_process_state,
|
||||
+ TP_PROTO(struct lttng_session *session,
|
||||
+ struct task_struct *p,
|
||||
+ int type, int mode, int submode, int status,
|
||||
+ struct files_struct *files),
|
||||
+ TP_ARGS(session, p, type, mode, submode, status, files));
|
||||
+
|
||||
+LTTNG_DEFINE_TRACE(lttng_statedump_network_interface,
|
||||
+ TP_PROTO(struct lttng_session *session,
|
||||
+ struct net_device *dev, struct in_ifaddr *ifa),
|
||||
+ TP_ARGS(session, dev, ifa));
|
||||
|
||||
struct lttng_fd_ctx {
|
||||
char *page;
|
||||
diff --git a/probes/lttng.c b/probes/lttng.c
|
||||
index 05bc1388..7ddaa69f 100644
|
||||
--- a/probes/lttng.c
|
||||
+++ b/probes/lttng.c
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
-#include <linux/tracepoint.h>
|
||||
+#include <wrapper/tracepoint.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/fs.h>
|
||||
@@ -32,7 +32,10 @@
|
||||
#define LTTNG_LOGGER_COUNT_MAX 1024
|
||||
#define LTTNG_LOGGER_FILE "lttng-logger"
|
||||
|
||||
-DEFINE_TRACE(lttng_logger);
|
||||
+LTTNG_DEFINE_TRACE(lttng_logger,
|
||||
+ PARAMS(const char __user *text, size_t len),
|
||||
+ PARAMS(text, len)
|
||||
+);
|
||||
|
||||
static struct proc_dir_entry *lttng_logger_dentry;
|
||||
|
||||
diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c
|
||||
index c728bed5..8f2d3feb 100644
|
||||
--- a/tests/probes/lttng-test.c
|
||||
+++ b/tests/probes/lttng-test.c
|
||||
@@ -26,7 +26,12 @@
|
||||
#define LTTNG_INSTRUMENTATION
|
||||
#include <instrumentation/events/lttng-module/lttng-test.h>
|
||||
|
||||
-DEFINE_TRACE(lttng_test_filter_event);
|
||||
+LTTNG_DEFINE_TRACE(lttng_test_filter_event,
|
||||
+ PARAMS(int anint, int netint, long *values,
|
||||
+ char *text, size_t textlen,
|
||||
+ char *etext, uint32_t * net_values),
|
||||
+ PARAMS(anint, netint, values, text, textlen, etext, net_values)
|
||||
+);
|
||||
|
||||
#define LTTNG_TEST_FILTER_EVENT_FILE "lttng-test-filter-event"
|
||||
|
||||
diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h
|
||||
index 3883e11a..758038b6 100644
|
||||
--- a/wrapper/tracepoint.h
|
||||
+++ b/wrapper/tracepoint.h
|
||||
@@ -20,6 +20,14 @@
|
||||
|
||||
#endif
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,0))
|
||||
+#define LTTNG_DEFINE_TRACE(name, proto, args) \
|
||||
+ DEFINE_TRACE(name, PARAMS(proto), PARAMS(args))
|
||||
+#else
|
||||
+#define LTTNG_DEFINE_TRACE(name, proto, args) \
|
||||
+ DEFINE_TRACE(name)
|
||||
+#endif
|
||||
+
|
||||
#ifndef HAVE_KABI_2635_TRACEPOINT
|
||||
|
||||
#define kabi_2635_tracepoint_probe_register tracepoint_probe_register
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
From 2ce89d35c9477d8c17c00489c72e1548e16af9b9 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Jeanson <mjeanson@efficios.com>
|
||||
Date: Fri, 20 Nov 2020 11:42:30 -0500
|
||||
Subject: [PATCH 10/16] fix: include order for older kernels
|
||||
|
||||
Fixes a build failure on v3.0 and v3.1.
|
||||
|
||||
Upstream-Status: Backport
|
||||
|
||||
Change-Id: Ic48512d2aa5ee46678e67d147b92dba6d0959615
|
||||
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
|
||||
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
|
||||
---
|
||||
lttng-events.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/lttng-events.h b/lttng-events.h
|
||||
index 099fd78b..f5cc57c6 100644
|
||||
--- a/lttng-events.h
|
||||
+++ b/lttng-events.h
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/kref.h>
|
||||
#include <lttng-cpuhotplug.h>
|
||||
#include <linux/uuid.h>
|
||||
+#include <linux/irq_work.h>
|
||||
#include <wrapper/uprobes.h>
|
||||
#include <lttng-tracer.h>
|
||||
#include <lttng-abi.h>
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user