mirror of
https://git.yoctoproject.org/poky
synced 2026-02-22 17:39:39 +01:00
Compare commits
105 Commits
dunfell-23
...
yocto-3.1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32da5ee951 | ||
|
|
88bec50206 | ||
|
|
aa5a1adb60 | ||
|
|
df86cc15d0 | ||
|
|
9c828566b2 | ||
|
|
d7ef6fd67c | ||
|
|
6e42635ae0 | ||
|
|
f8a370159b | ||
|
|
7ac47c90cc | ||
|
|
5de95d9c29 | ||
|
|
a022b1abef | ||
|
|
228d031f73 | ||
|
|
a04b507d39 | ||
|
|
0bf993da8b | ||
|
|
5b0daa0061 | ||
|
|
fcb0381657 | ||
|
|
1adc1600f2 | ||
|
|
218ca73cab | ||
|
|
ed4a2d3d41 | ||
|
|
8b1211f81f | ||
|
|
87f16e1f3b | ||
|
|
579797adab | ||
|
|
9faca1f692 | ||
|
|
6c5b006a10 | ||
|
|
5e9e50e544 | ||
|
|
60cd2c29ea | ||
|
|
122c106794 | ||
|
|
65c2f76dca | ||
|
|
a16a21af9a | ||
|
|
84ef58ae39 | ||
|
|
e146653c21 | ||
|
|
b30e81df2b | ||
|
|
0a24a5bb3b | ||
|
|
f506b0c057 | ||
|
|
4cfb4fc8ed | ||
|
|
e211a16fb5 | ||
|
|
82fd9eb08f | ||
|
|
f3a78fecc2 | ||
|
|
8c4bad844f | ||
|
|
2ae4aff0a6 | ||
|
|
55750ffd78 | ||
|
|
70d75e8996 | ||
|
|
b994c2d4f5 | ||
|
|
eb7bb5b589 | ||
|
|
bc3497092e | ||
|
|
642040373e | ||
|
|
a6f3173407 | ||
|
|
00277476e3 | ||
|
|
8f837940fd | ||
|
|
74b8f9ee39 | ||
|
|
7256436957 | ||
|
|
f25b363233 | ||
|
|
2474c30274 | ||
|
|
5ca4b2a548 | ||
|
|
a84a25acc5 | ||
|
|
c8f5ff0ffe | ||
|
|
822d364542 | ||
|
|
b01dd27a8d | ||
|
|
42a4f98ab5 | ||
|
|
756bae9bf9 | ||
|
|
ec29356556 | ||
|
|
f6f1b85384 | ||
|
|
6dcf266eb4 | ||
|
|
5ea3190383 | ||
|
|
5127d99785 | ||
|
|
ff22728dd5 | ||
|
|
af419f2429 | ||
|
|
04003b36bf | ||
|
|
800b69b78b | ||
|
|
bab87089ad | ||
|
|
d91c3c1242 | ||
|
|
a7ed388d44 | ||
|
|
b93817cc62 | ||
|
|
33e9349a4a | ||
|
|
036558afb0 | ||
|
|
7ae33b3e6f | ||
|
|
733d919af4 | ||
|
|
f42e2c212f | ||
|
|
19054d7f1b | ||
|
|
6b21362c83 | ||
|
|
aa9597253b | ||
|
|
c8d13f159e | ||
|
|
311a1d5935 | ||
|
|
7a5aa92590 | ||
|
|
09a8d85815 | ||
|
|
34d7cb536a | ||
|
|
f51b7f407d | ||
|
|
cd4656d9b2 | ||
|
|
602a3ebec7 | ||
|
|
7edbc14f1a | ||
|
|
b2cec0246c | ||
|
|
2aeb276dd5 | ||
|
|
37a03beb6d | ||
|
|
f8902083fd | ||
|
|
6828c2c8db | ||
|
|
ed5cd048ae | ||
|
|
1824a583fa | ||
|
|
967c2d4145 | ||
|
|
a540df3791 | ||
|
|
eda8a27490 | ||
|
|
397d3430bf | ||
|
|
f5051dae9f | ||
|
|
97ffdc1519 | ||
|
|
f668b3ab56 | ||
|
|
79dcce4413 |
@@ -1975,11 +1975,19 @@ class RunQueueExecute:
|
||||
self.setbuildable(revdep)
|
||||
logger.debug(1, "Marking task %s as buildable", revdep)
|
||||
|
||||
for t in self.sq_deferred.copy():
|
||||
found = None
|
||||
for t in sorted(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)
|
||||
# Allow the next deferred task to run. Any other deferred tasks should be deferred after that task.
|
||||
# We shouldn't allow all to run at once as it is prone to races.
|
||||
if not found:
|
||||
bb.note("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)
|
||||
found = t
|
||||
else:
|
||||
bb.note("Deferring %s after %s" % (t, found))
|
||||
self.sq_deferred[t] = found
|
||||
|
||||
def task_complete(self, task):
|
||||
self.stats.taskCompleted()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
DISTRO : "3.1.25"
|
||||
DISTRO : "3.1.27"
|
||||
DISTRO_NAME_NO_CAP : "dunfell"
|
||||
DISTRO_NAME : "Dunfell"
|
||||
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
|
||||
YOCTO_DOC_VERSION : "3.1.25"
|
||||
YOCTO_DOC_VERSION : "3.1.27"
|
||||
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
|
||||
DISTRO_REL_TAG : "yocto-3.1.25"
|
||||
DOCCONF_VERSION : "3.1.25"
|
||||
DISTRO_REL_TAG : "yocto-3.1.27"
|
||||
DOCCONF_VERSION : "3.1.27"
|
||||
BITBAKE_SERIES : "1.46"
|
||||
POKYVERSION : "23.0.25"
|
||||
POKYVERSION : "23.0.27"
|
||||
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
|
||||
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
|
||||
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"
|
||||
|
||||
@@ -14,16 +14,17 @@ image you want.
|
||||
Building an image without GNU General Public License Version 3
|
||||
(GPLv3), GNU Lesser General Public License Version 3 (LGPLv3), and
|
||||
the GNU Affero General Public License Version 3 (AGPL-3.0) components
|
||||
is only supported for minimal and base images. Furthermore, if you
|
||||
are going to build an image using non-GPLv3 and similarly licensed
|
||||
components, you must make the following changes in the ``local.conf``
|
||||
file before using the BitBake command to build the minimal or base
|
||||
image:
|
||||
::
|
||||
is only tested for core-image-minimal image. Furthermore, if you would like to
|
||||
build an image and verify that it does not include GPLv3 and similarly licensed
|
||||
components, you must make the following changes in the image recipe
|
||||
file before using the BitBake command to build the image:
|
||||
|
||||
1. Comment out the EXTRA_IMAGE_FEATURES line
|
||||
2. Set INCOMPATIBLE_LICENSE = "GPL-3.0 LGPL-3.0 AGPL-3.0"
|
||||
INCOMPATIBLE_LICENSE = "GPL-3.0* LGPL-3.0*"
|
||||
|
||||
Alternatively, you can adjust ``local.conf`` file, repeating and adjusting the line
|
||||
for all images where the license restriction must apply:
|
||||
|
||||
INCOMPATIBLE_LICENSE_pn-your-image-name = "GPL-3.0* LGPL-3.0*"
|
||||
|
||||
From within the ``poky`` Git repository, you can use the following
|
||||
command to display the list of directories within the :term:`Source Directory`
|
||||
|
||||
@@ -3337,9 +3337,18 @@ system and gives an overview of their function and contents.
|
||||
:term:`INCOMPATIBLE_LICENSE`
|
||||
Specifies a space-separated list of license names (as they would
|
||||
appear in :term:`LICENSE`) that should be excluded
|
||||
from the build. Recipes that provide no alternatives to listed
|
||||
from the build (if set globally), or from an image (if set locally
|
||||
in an image recipe).
|
||||
|
||||
When the variable is set globally, recipes that provide no alternatives to listed
|
||||
incompatible licenses are not built. Packages that are individually
|
||||
licensed with the specified incompatible licenses will be deleted.
|
||||
Most of the time this does not allow a feasible build (because it becomes impossible
|
||||
to satisfy build time dependencies), so the recommended way to
|
||||
implement license restrictions is to set the variable in specific
|
||||
image recipes where the restrictions must apply. That way there
|
||||
are no build time restrictions, but the license check is still
|
||||
performed when the image's filesystem is assembled from packages.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
DISTRO_VERSION = "3.1.25"
|
||||
DISTRO_VERSION = "3.1.27"
|
||||
DISTRO_CODENAME = "dunfell"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
|
||||
|
||||
@@ -26,7 +26,7 @@ CVE_PRODUCT ??= "${BPN}"
|
||||
CVE_VERSION ??= "${PV}"
|
||||
|
||||
CVE_CHECK_DB_DIR ?= "${DL_DIR}/CVE_CHECK"
|
||||
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_1.1.db"
|
||||
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_2.db"
|
||||
CVE_CHECK_DB_FILE_LOCK ?= "${CVE_CHECK_DB_FILE}.lock"
|
||||
|
||||
CVE_CHECK_LOG ?= "${T}/cve.log"
|
||||
@@ -154,7 +154,7 @@ python do_cve_check () {
|
||||
}
|
||||
|
||||
addtask cve_check before do_build
|
||||
do_cve_check[depends] = "cve-update-db-native:do_fetch"
|
||||
do_cve_check[depends] = "cve-update-nvd2-native:do_fetch"
|
||||
do_cve_check[nostamp] = "1"
|
||||
|
||||
python cve_check_cleanup () {
|
||||
|
||||
@@ -118,7 +118,7 @@ go_do_install() {
|
||||
tar -C ${B} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' pkg | \
|
||||
tar -C ${D}${libdir}/go --no-same-owner -xf -
|
||||
|
||||
if [ -n "`ls ${B}/${GO_BUILD_BINDIR}/`" ]; then
|
||||
if ls ${B}/${GO_BUILD_BINDIR}/* >/dev/null 2>/dev/null ; then
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${B}/${GO_BUILD_BINDIR}/* ${D}${bindir}/
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
inherit kernel-uboot kernel-artifact-names uboot-sign
|
||||
|
||||
KERNEL_IMAGETYPE_REPLACEMENT = ""
|
||||
|
||||
python __anonymous () {
|
||||
kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""
|
||||
if 'fitImage' in kerneltypes.split():
|
||||
@@ -21,6 +23,8 @@ python __anonymous () {
|
||||
else:
|
||||
replacementtype = "zImage"
|
||||
|
||||
d.setVar("KERNEL_IMAGETYPE_REPLACEMENT", replacementtype)
|
||||
|
||||
# Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
|
||||
# to kernel.bbclass . We have to override it, since we pack zImage
|
||||
# (at least for now) into the fitImage .
|
||||
@@ -45,6 +49,8 @@ python __anonymous () {
|
||||
if d.getVar('UBOOT_SIGN_ENABLE') == "1" and d.getVar('UBOOT_DTB_BINARY'):
|
||||
uboot_pn = d.getVar('PREFERRED_PROVIDER_u-boot') or 'u-boot'
|
||||
d.appendVarFlag('do_assemble_fitimage', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
|
||||
if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
|
||||
d.appendVarFlag('do_assemble_fitimage_initramfs', 'depends', ' %s:do_populate_sysroot' % uboot_pn)
|
||||
}
|
||||
|
||||
# Options for the device tree compiler passed to mkimage '-D' feature:
|
||||
@@ -180,6 +186,43 @@ fitimage_emit_section_dtb() {
|
||||
EOF
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS u-boot script section
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to boot script image
|
||||
fitimage_emit_section_boot_script() {
|
||||
|
||||
bootscr_csum="${FIT_HASH_ALG}"
|
||||
bootscr_sign_algo="${FIT_SIGN_ALG}"
|
||||
bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
|
||||
|
||||
cat << EOF >> $1
|
||||
bootscr-$2 {
|
||||
description = "U-boot script";
|
||||
data = /incbin/("$3");
|
||||
type = "script";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
compression = "none";
|
||||
hash-1 {
|
||||
algo = "$bootscr_csum";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
|
||||
sed -i '$ d' $1
|
||||
cat << EOF >> $1
|
||||
signature-1 {
|
||||
algo = "$bootscr_csum,$bootscr_sign_algo";
|
||||
key-name-hint = "$bootscr_sign_keyname";
|
||||
};
|
||||
};
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Emit the fitImage ITS setup section
|
||||
#
|
||||
@@ -250,8 +293,9 @@ EOF
|
||||
# $2 ... Linux kernel ID
|
||||
# $3 ... DTB image name
|
||||
# $4 ... ramdisk ID
|
||||
# $5 ... config ID
|
||||
# $6 ... default flag
|
||||
# $5 ... u-boot script ID
|
||||
# $6 ... config ID
|
||||
# $7 ... default flag
|
||||
fitimage_emit_section_config() {
|
||||
|
||||
conf_csum="${FIT_HASH_ALG}"
|
||||
@@ -267,6 +311,7 @@ fitimage_emit_section_config() {
|
||||
kernel_line=""
|
||||
fdt_line=""
|
||||
ramdisk_line=""
|
||||
bootscr_line=""
|
||||
setup_line=""
|
||||
default_line=""
|
||||
|
||||
@@ -289,21 +334,28 @@ fitimage_emit_section_config() {
|
||||
fi
|
||||
|
||||
if [ -n "${5}" ]; then
|
||||
conf_desc="${conf_desc}${sep}setup"
|
||||
setup_line="setup = \"setup-${5}\";"
|
||||
conf_desc="${conf_desc}${sep}u-boot script"
|
||||
sep=", "
|
||||
bootscr_line="bootscr = \"bootscr-${5}\";"
|
||||
fi
|
||||
|
||||
if [ "${6}" = "1" ]; then
|
||||
if [ -n "${6}" ]; then
|
||||
conf_desc="${conf_desc}${sep}setup"
|
||||
setup_line="setup = \"setup-${6}\";"
|
||||
fi
|
||||
|
||||
if [ "${7}" = "1" ]; then
|
||||
default_line="default = \"conf-${3}\";"
|
||||
fi
|
||||
|
||||
cat << EOF >> ${1}
|
||||
${default_line}
|
||||
conf-${3} {
|
||||
description = "${6} ${conf_desc}";
|
||||
description = "${7} ${conf_desc}";
|
||||
${kernel_line}
|
||||
${fdt_line}
|
||||
${ramdisk_line}
|
||||
${bootscr_line}
|
||||
${setup_line}
|
||||
hash-1 {
|
||||
algo = "${conf_csum}";
|
||||
@@ -331,6 +383,11 @@ EOF
|
||||
fi
|
||||
|
||||
if [ -n "${5}" ]; then
|
||||
sign_line="${sign_line}${sep}\"bootscr\""
|
||||
sep=", "
|
||||
fi
|
||||
|
||||
if [ -n "${6}" ]; then
|
||||
sign_line="${sign_line}${sep}\"setup\""
|
||||
fi
|
||||
|
||||
@@ -363,6 +420,7 @@ fitimage_assemble() {
|
||||
DTBS=""
|
||||
ramdiskcount=${3}
|
||||
setupcount=""
|
||||
bootscr_id=""
|
||||
rm -f ${1} arch/${ARCH}/boot/${2}
|
||||
|
||||
fitimage_emit_fit_header ${1}
|
||||
@@ -373,7 +431,7 @@ fitimage_assemble() {
|
||||
fitimage_emit_section_maint ${1} imagestart
|
||||
|
||||
uboot_prep_kimage
|
||||
fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"
|
||||
fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
|
||||
|
||||
#
|
||||
# Step 2: Prepare a DTB image section
|
||||
@@ -407,7 +465,21 @@ fitimage_assemble() {
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 3: Prepare a setup section. (For x86)
|
||||
# Step 3: Prepare a u-boot script section
|
||||
#
|
||||
|
||||
if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
|
||||
if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
|
||||
cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
|
||||
bootscr_id="${UBOOT_ENV_BINARY}"
|
||||
fitimage_emit_section_boot_script ${1} "${bootscr_id}" ${UBOOT_ENV_BINARY}
|
||||
else
|
||||
bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 4: Prepare a setup section. (For x86)
|
||||
#
|
||||
if [ -e arch/${ARCH}/boot/setup.bin ]; then
|
||||
setupcount=1
|
||||
@@ -415,9 +487,9 @@ fitimage_assemble() {
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 4: Prepare a ramdisk section.
|
||||
# Step 5: Prepare a ramdisk section.
|
||||
#
|
||||
if [ "x${ramdiskcount}" = "x1" ] ; then
|
||||
if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
|
||||
# Find and use the first initramfs image archive type we find
|
||||
for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do
|
||||
initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
|
||||
@@ -438,7 +510,7 @@ fitimage_assemble() {
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 5: Prepare a configurations section
|
||||
# Step 6: Prepare a configurations section
|
||||
#
|
||||
fitimage_emit_section_maint ${1} confstart
|
||||
|
||||
@@ -447,9 +519,9 @@ fitimage_assemble() {
|
||||
for DTB in ${DTBS}; do
|
||||
dtb_ext=${DTB##*.}
|
||||
if [ "${dtb_ext}" = "dtbo" ]; then
|
||||
fitimage_emit_section_config ${1} "" "${DTB}" "" "" "`expr ${i} = ${dtbcount}`"
|
||||
fitimage_emit_section_config ${1} "" "${DTB}" "" "${bootscr_id}" "" "`expr ${i} = ${dtbcount}`"
|
||||
else
|
||||
fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
|
||||
fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${bootscr_id}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
|
||||
fi
|
||||
i=`expr ${i} + 1`
|
||||
done
|
||||
@@ -460,7 +532,7 @@ fitimage_assemble() {
|
||||
fitimage_emit_section_maint ${1} fitend
|
||||
|
||||
#
|
||||
# Step 6: Assemble the image
|
||||
# Step 7: Assemble the image
|
||||
#
|
||||
uboot-mkimage \
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
@@ -468,7 +540,7 @@ fitimage_assemble() {
|
||||
arch/${ARCH}/boot/${2}
|
||||
|
||||
#
|
||||
# Step 7: Sign the image and add public key to U-Boot dtb
|
||||
# Step 8: Sign the image and add public key to U-Boot dtb
|
||||
#
|
||||
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
|
||||
add_key_to_u_boot=""
|
||||
@@ -500,7 +572,11 @@ do_assemble_fitimage_initramfs() {
|
||||
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage" && \
|
||||
test -n "${INITRAMFS_IMAGE}" ; then
|
||||
cd ${B}
|
||||
fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
|
||||
if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
|
||||
fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage ""
|
||||
else
|
||||
fitimage_assemble fit-image-${INITRAMFS_IMAGE}.its fitImage-${INITRAMFS_IMAGE} 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -511,22 +587,32 @@ kernel_do_deploy[vardepsexclude] = "DATETIME"
|
||||
kernel_do_deploy_append() {
|
||||
# Update deploy directory
|
||||
if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
|
||||
echo "Copying fit-image.its source file..."
|
||||
install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
|
||||
ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
|
||||
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
|
||||
echo "Copying fit-image.its source file..."
|
||||
install -m 0644 ${B}/fit-image.its "$deployDir/fitImage-its-${KERNEL_FIT_NAME}.its"
|
||||
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
|
||||
ln -snf fitImage-its-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${KERNEL_FIT_LINK_NAME}"
|
||||
fi
|
||||
|
||||
echo "Copying linux.bin file..."
|
||||
install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin
|
||||
ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
|
||||
echo "Copying linux.bin file..."
|
||||
install -m 0644 ${B}/linux.bin $deployDir/fitImage-linux.bin-${KERNEL_FIT_NAME}.bin
|
||||
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
|
||||
ln -snf fitImage-linux.bin-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-linux.bin-${KERNEL_FIT_LINK_NAME}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${INITRAMFS_IMAGE}" ]; then
|
||||
echo "Copying fit-image-${INITRAMFS_IMAGE}.its source file..."
|
||||
install -m 0644 ${B}/fit-image-${INITRAMFS_IMAGE}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its"
|
||||
ln -snf fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.its "$deployDir/fitImage-its-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
|
||||
|
||||
echo "Copying fitImage-${INITRAMFS_IMAGE} file..."
|
||||
install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin"
|
||||
ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
|
||||
if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
|
||||
echo "Copying fitImage-${INITRAMFS_IMAGE} file..."
|
||||
install -m 0644 ${B}/arch/${ARCH}/boot/fitImage-${INITRAMFS_IMAGE} "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin"
|
||||
if [ -n "${KERNEL_FIT_LINK_NAME}" ] ; then
|
||||
ln -snf fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_NAME}.bin "$deployDir/fitImage-${INITRAMFS_IMAGE_NAME}-${KERNEL_FIT_LINK_NAME}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ "${UBOOT_SIGN_ENABLE}" = "1" -a -n "${UBOOT_DTB_BINARY}" ] ; then
|
||||
# UBOOT_DTB_IMAGE is a realfile, but we can't use
|
||||
@@ -536,3 +622,13 @@ kernel_do_deploy_append() {
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# The function below performs the following in case of initramfs bundles:
|
||||
# - Removes do_assemble_fitimage. FIT generation is done through
|
||||
# do_assemble_fitimage_initramfs. do_assemble_fitimage is not needed
|
||||
# and should not be part of the tasks to be executed.
|
||||
python () {
|
||||
d.appendVarFlag('do_compile', 'vardeps', ' INITRAMFS_IMAGE_BUNDLE')
|
||||
if d.getVar('INITRAMFS_IMAGE_BUNDLE') == "1":
|
||||
bb.build.deltask('do_assemble_fitimage', d)
|
||||
}
|
||||
|
||||
@@ -363,7 +363,8 @@ python copy_buildsystem () {
|
||||
f.write('BUILDCFG_HEADER = ""\n\n')
|
||||
|
||||
# Write METADATA_REVISION
|
||||
f.write('METADATA_REVISION = "%s"\n\n' % d.getVar('METADATA_REVISION'))
|
||||
# Needs distro override so it can override the value set in the bbclass code (later than local.conf)
|
||||
f.write('METADATA_REVISION:%s = "%s"\n\n' % (d.getVar('DISTRO'), d.getVar('METADATA_REVISION')))
|
||||
|
||||
f.write('# Provide a flag to indicate we are in the EXT_SDK Context\n')
|
||||
f.write('WITHIN_EXT_SDK = "1"\n\n')
|
||||
|
||||
@@ -24,3 +24,5 @@ S = "${WORKDIR}/${PYPI_PACKAGE}-${PV}"
|
||||
|
||||
UPSTREAM_CHECK_URI ?= "https://pypi.org/project/${PYPI_PACKAGE}/"
|
||||
UPSTREAM_CHECK_REGEX ?= "/${PYPI_PACKAGE}/(?P<pver>(\d+[\.\-_]*)+)/"
|
||||
|
||||
CVE_PRODUCT ?= "python:${PYPI_PACKAGE}"
|
||||
|
||||
@@ -34,6 +34,8 @@ python uninative_event_fetchloader() {
|
||||
with open(loaderchksum, "r") as f:
|
||||
readchksum = f.read().strip()
|
||||
if readchksum == chksum:
|
||||
if "uninative" not in d.getVar("SSTATEPOSTUNPACKFUNCS"):
|
||||
enable_uninative(d)
|
||||
return
|
||||
|
||||
import subprocess
|
||||
@@ -167,5 +169,7 @@ python uninative_changeinterp () {
|
||||
if not elf.isDynamic():
|
||||
continue
|
||||
|
||||
os.chmod(f, s[stat.ST_MODE] | stat.S_IWUSR)
|
||||
subprocess.check_output(("patchelf-uninative", "--set-interpreter", d.getVar("UNINATIVE_LOADER"), f), stderr=subprocess.STDOUT)
|
||||
os.chmod(f, s[stat.ST_MODE])
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ def update_useradd_static_config(d):
|
||||
def handle_missing_id(id, type, pkg, files, var, value):
|
||||
# For backwards compatibility we accept "1" in addition to "error"
|
||||
error_dynamic = d.getVar('USERADD_ERROR_DYNAMIC')
|
||||
msg = "%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id)
|
||||
msg = 'Recipe %s, package %s: %sname "%s" does not have a static ID defined.' % (d.getVar('PN'), pkg, type, id)
|
||||
if files:
|
||||
msg += " Add %s to one of these files: %s" % (id, files)
|
||||
else:
|
||||
|
||||
@@ -897,7 +897,7 @@ BB_HASHCONFIG_WHITELIST ?= "${BB_HASHEXCLUDE_COMMON} DATE TIME SSH_AGENT_PID \
|
||||
PARALLEL_MAKE BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF BBINCLUDED \
|
||||
GIT_PROXY_COMMAND ALL_PROXY all_proxy NO_PROXY no_proxy FTP_PROXY ftp_proxy \
|
||||
HTTP_PROXY http_proxy HTTPS_PROXY https_proxy SOCKS5_USER SOCKS5_PASSWD \
|
||||
BB_SETSCENE_ENFORCE BB_CMDLINE BB_SERVER_TIMEOUT"
|
||||
BB_SETSCENE_ENFORCE BB_CMDLINE BB_SERVER_TIMEOUT BB_NICE_LEVEL"
|
||||
BB_SIGNATURE_EXCLUDE_FLAGS ?= "doc deps depends \
|
||||
lockfiles type vardepsexclude vardeps vardepvalue vardepvalueexclude \
|
||||
file-checksums python func task export unexport noexec nostamp dirs cleandirs \
|
||||
|
||||
@@ -26,6 +26,7 @@ PTESTS_FAST = "\
|
||||
liberror-perl-ptest \
|
||||
libmodule-build-perl-ptest \
|
||||
libpcre-ptest \
|
||||
libpng-ptest \
|
||||
libtimedate-perl-ptest \
|
||||
libtest-needs-perl-ptest \
|
||||
liburi-perl-ptest \
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
# to the distro running on the build machine.
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.36"
|
||||
UNINATIVE_VERSION = "3.7"
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.37"
|
||||
UNINATIVE_VERSION = "4.0"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "6a29bcae4b5b716d2d520e18800b33943b65f8a835eac1ff8793fc5ee65b4be6"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "3f6d52e64996570c716108d49f8108baccf499a283bbefae438c7266b7a93305"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "b110bf2e10fe420f5ca2f3ec55f048ee5f0a54c7e34856a3594e51eb2aea0570"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "7baa8418a302df52e00916193b0a04f318356d9d2670c9a2bce3e966efefd738"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "83114d36883d43a521e280742b9849bf85d039b2f83d8e21d480659babe75ee8"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "fd75b2a1a67a10f6b7d65afb7d0f3e71a63b0038e428f34dfe420bb37716558a"
|
||||
|
||||
@@ -102,6 +102,10 @@ class Rxvt(XTerminal):
|
||||
command = 'rxvt -T "{title}" -e {command}'
|
||||
priority = 1
|
||||
|
||||
class URxvt(XTerminal):
|
||||
command = 'urxvt -T "{title}" -e {command}'
|
||||
priority = 1
|
||||
|
||||
class Screen(Terminal):
|
||||
command = 'screen -D -m -t "{title}" -S devshell {command}'
|
||||
|
||||
|
||||
@@ -185,6 +185,10 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
|
||||
self.assertTrue(find, "No version returned for searched recipe. bitbake output: %s" % result.output)
|
||||
|
||||
def test_prefile(self):
|
||||
# Test when the prefile does not exist
|
||||
result = runCmd('bitbake -r conf/prefile.conf', ignore_status=True)
|
||||
self.assertEqual(1, result.status, "bitbake didn't error and should have when a specified prefile didn't exist: %s" % result.output)
|
||||
# Test when the prefile exists
|
||||
preconf = os.path.join(self.builddir, 'conf/prefile.conf')
|
||||
self.track_for_cleanup(preconf)
|
||||
ftools.write_file(preconf ,"TEST_PREFILE=\"prefile\"")
|
||||
@@ -195,6 +199,10 @@ SSTATE_DIR = \"${TOPDIR}/download-selftest\"
|
||||
self.assertIn('localconf', result.output)
|
||||
|
||||
def test_postfile(self):
|
||||
# Test when the postfile does not exist
|
||||
result = runCmd('bitbake -R conf/postfile.conf', ignore_status=True)
|
||||
self.assertEqual(1, result.status, "bitbake didn't error and should have when a specified postfile didn't exist: %s" % result.output)
|
||||
# Test when the postfile exists
|
||||
postconf = os.path.join(self.builddir, 'conf/postfile.conf')
|
||||
self.track_for_cleanup(postconf)
|
||||
ftools.write_file(postconf , "TEST_POSTFILE=\"postfile\"")
|
||||
|
||||
@@ -8,6 +8,7 @@ import shutil
|
||||
import tempfile
|
||||
import glob
|
||||
import fnmatch
|
||||
import unittest
|
||||
|
||||
import oeqa.utils.ftools as ftools
|
||||
from oeqa.selftest.case import OESelftestTestCase
|
||||
@@ -38,6 +39,13 @@ def setUpModule():
|
||||
canonical_layerpath = os.path.realpath(canonical_layerpath) + '/'
|
||||
edited_layers.append(layerpath)
|
||||
oldmetapath = os.path.realpath(layerpath)
|
||||
|
||||
# when downloading poky from tar.gz some tests will be skipped (BUG 12389)
|
||||
try:
|
||||
runCmd('git rev-parse --is-inside-work-tree', cwd=canonical_layerpath)
|
||||
except:
|
||||
raise unittest.SkipTest("devtool tests require folder to be a git repo")
|
||||
|
||||
result = runCmd('git rev-parse --show-toplevel', cwd=canonical_layerpath)
|
||||
oldreporoot = result.output.rstrip()
|
||||
newmetapath = os.path.join(corecopydir, os.path.relpath(oldmetapath, oldreporoot))
|
||||
|
||||
@@ -188,7 +188,7 @@ class ReproducibleTests(OESelftestTestCase):
|
||||
|
||||
def setUpLocal(self):
|
||||
super().setUpLocal()
|
||||
needed_vars = ['TOPDIR', 'TARGET_PREFIX', 'BB_NUMBER_THREADS']
|
||||
needed_vars = ['TOPDIR', 'TARGET_PREFIX', 'BB_NUMBER_THREADS', 'BB_HASHSERVE']
|
||||
bb_vars = get_bb_vars(needed_vars)
|
||||
for v in needed_vars:
|
||||
setattr(self, v.lower(), bb_vars[v])
|
||||
@@ -259,7 +259,7 @@ class ReproducibleTests(OESelftestTestCase):
|
||||
# mirror, forcing a complete build from scratch
|
||||
config += textwrap.dedent('''\
|
||||
SSTATE_DIR = "${TMPDIR}/sstate"
|
||||
SSTATE_MIRRORS = ""
|
||||
SSTATE_MIRRORS = "file://.*/.*-native.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH file://.*/.*-cross.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
|
||||
''')
|
||||
|
||||
self.logger.info("Building %s (sstate%s allowed)..." % (name, '' if use_sstate else ' NOT'))
|
||||
|
||||
@@ -177,6 +177,8 @@ class TestImage(OESelftestTestCase):
|
||||
distro = oe.lsb.distro_identifier()
|
||||
if distro and distro.startswith('almalinux'):
|
||||
self.skipTest('virgl isn\'t working with Alma Linux')
|
||||
if distro and distro.startswith('rocky'):
|
||||
self.skipTest('virgl isn\'t working with Rocky Linux')
|
||||
if distro and distro == 'debian-8':
|
||||
self.skipTest('virgl isn\'t working with Debian 8')
|
||||
if distro and distro == 'centos-7':
|
||||
@@ -189,10 +191,14 @@ class TestImage(OESelftestTestCase):
|
||||
self.skipTest('virgl isn\'t working with Fedora 35')
|
||||
if distro and distro == 'fedora-36':
|
||||
self.skipTest('virgl isn\'t working with Fedora 36')
|
||||
if distro and distro == 'fedora-37':
|
||||
self.skipTest('virgl isn\'t working with Fedora 37')
|
||||
if distro and distro == 'opensuseleap-15.0':
|
||||
self.skipTest('virgl isn\'t working with Opensuse 15.0')
|
||||
if distro and distro == 'ubuntu-22.04':
|
||||
self.skipTest('virgl isn\'t working with Ubuntu 22.04')
|
||||
if distro and distro == 'ubuntu-22.10':
|
||||
self.skipTest('virgl isn\'t working with Ubuntu 22.10')
|
||||
|
||||
qemu_packageconfig = get_bb_var('PACKAGECONFIG', 'qemu-system-native')
|
||||
sdl_packageconfig = get_bb_var('PACKAGECONFIG', 'libsdl2-native')
|
||||
|
||||
@@ -27,9 +27,9 @@ def metadata_from_bb():
|
||||
data_dict = get_bb_vars()
|
||||
|
||||
# Distro information
|
||||
info_dict['distro'] = {'id': data_dict['DISTRO'],
|
||||
'version_id': data_dict['DISTRO_VERSION'],
|
||||
'pretty_name': '%s %s' % (data_dict['DISTRO'], data_dict['DISTRO_VERSION'])}
|
||||
info_dict['distro'] = {'id': data_dict.get('DISTRO', 'NODISTRO'),
|
||||
'version_id': data_dict.get('DISTRO_VERSION', 'NO_DISTRO_VERSION'),
|
||||
'pretty_name': '%s %s' % (data_dict.get('DISTRO', 'NODISTRO'), data_dict.get('DISTRO_VERSION', 'NO_DISTRO_VERSION'))}
|
||||
|
||||
# Host distro information
|
||||
os_release = get_os_release()
|
||||
|
||||
609
meta/recipes-bsp/grub/files/CVE-2020-27749.patch
Normal file
609
meta/recipes-bsp/grub/files/CVE-2020-27749.patch
Normal file
@@ -0,0 +1,609 @@
|
||||
From 4ea7bae51f97e49c84dc67ea30b466ca8633b9f6 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Thu, 7 Jan 2021 19:21:03 +0000
|
||||
Subject: kern/parser: Fix a stack buffer overflow
|
||||
|
||||
grub_parser_split_cmdline() expands variable names present in the supplied
|
||||
command line in to their corresponding variable contents and uses a 1 kiB
|
||||
stack buffer for temporary storage without sufficient bounds checking. If
|
||||
the function is called with a command line that references a variable with
|
||||
a sufficiently large payload, it is possible to overflow the stack
|
||||
buffer via tab completion, corrupt the stack frame and potentially
|
||||
control execution.
|
||||
|
||||
Fixes: CVE-2020-27749
|
||||
|
||||
Reported-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=c6c426e5ab6ea715153b72584de6bd8c82f698ec && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=b1c9e9e889e4273fb15712051c887e6078511448 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=3d157bbd06506b170fde5ec23980c4bf9f7660e2 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=8bc817014ce3d7a498db44eae33c8b90e2430926 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=030fb6c4fa354cdbd6a8d6903dfed5d36eaf3cb2 && https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=4ea7bae51f97e49c84dc67ea30b466ca8633b9f6]
|
||||
CVE: CVE-2020-27749
|
||||
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
grub-core/Makefile.core.def | 1 +
|
||||
grub-core/kern/buffer.c | 117 +++++++++++++++++++++
|
||||
grub-core/kern/parser.c | 204 +++++++++++++++++++++++-------------
|
||||
include/grub/buffer.h | 144 +++++++++++++++++++++++++
|
||||
4 files changed, 395 insertions(+), 71 deletions(-)
|
||||
create mode 100644 grub-core/kern/buffer.c
|
||||
create mode 100644 include/grub/buffer.h
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 651ea2a..823cd57 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -123,6 +123,7 @@ kernel = {
|
||||
riscv32_efi_startup = kern/riscv/efi/startup.S;
|
||||
riscv64_efi_startup = kern/riscv/efi/startup.S;
|
||||
|
||||
+ common = kern/buffer.c;
|
||||
common = kern/command.c;
|
||||
common = kern/corecmd.c;
|
||||
common = kern/device.c;
|
||||
diff --git a/grub-core/kern/buffer.c b/grub-core/kern/buffer.c
|
||||
new file mode 100644
|
||||
index 0000000..9f5f8b8
|
||||
--- /dev/null
|
||||
+++ b/grub-core/kern/buffer.c
|
||||
@@ -0,0 +1,117 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/buffer.h>
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/safemath.h>
|
||||
+#include <grub/types.h>
|
||||
+
|
||||
+grub_buffer_t
|
||||
+grub_buffer_new (grub_size_t sz)
|
||||
+{
|
||||
+ struct grub_buffer *ret;
|
||||
+
|
||||
+ ret = (struct grub_buffer *) grub_malloc (sizeof (*ret));
|
||||
+ if (ret == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ ret->data = (grub_uint8_t *) grub_malloc (sz);
|
||||
+ if (ret->data == NULL)
|
||||
+ {
|
||||
+ grub_free (ret);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ ret->sz = sz;
|
||||
+ ret->pos = 0;
|
||||
+ ret->used = 0;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+grub_buffer_free (grub_buffer_t buf)
|
||||
+{
|
||||
+ grub_free (buf->data);
|
||||
+ grub_free (buf);
|
||||
+}
|
||||
+
|
||||
+grub_err_t
|
||||
+grub_buffer_ensure_space (grub_buffer_t buf, grub_size_t req)
|
||||
+{
|
||||
+ grub_uint8_t *d;
|
||||
+ grub_size_t newsz = 1;
|
||||
+
|
||||
+ /* Is the current buffer size adequate? */
|
||||
+ if (buf->sz >= req)
|
||||
+ return GRUB_ERR_NONE;
|
||||
+
|
||||
+ /* Find the smallest power-of-2 size that satisfies the request. */
|
||||
+ while (newsz < req)
|
||||
+ {
|
||||
+ if (newsz == 0)
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ N_("requested buffer size is too large"));
|
||||
+ newsz <<= 1;
|
||||
+ }
|
||||
+
|
||||
+ d = (grub_uint8_t *) grub_realloc (buf->data, newsz);
|
||||
+ if (d == NULL)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ buf->data = d;
|
||||
+ buf->sz = newsz;
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+void *
|
||||
+grub_buffer_take_data (grub_buffer_t buf)
|
||||
+{
|
||||
+ void *data = buf->data;
|
||||
+
|
||||
+ buf->data = NULL;
|
||||
+ buf->sz = buf->pos = buf->used = 0;
|
||||
+
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+grub_buffer_reset (grub_buffer_t buf)
|
||||
+{
|
||||
+ buf->pos = buf->used = 0;
|
||||
+}
|
||||
+
|
||||
+grub_err_t
|
||||
+grub_buffer_advance_read_pos (grub_buffer_t buf, grub_size_t n)
|
||||
+{
|
||||
+ grub_size_t newpos;
|
||||
+
|
||||
+ if (grub_add (buf->pos, n, &newpos))
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+
|
||||
+ if (newpos > buf->used)
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ N_("new read is position beyond the end of the written data"));
|
||||
+
|
||||
+ buf->pos = newpos;
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
diff --git a/grub-core/kern/parser.c b/grub-core/kern/parser.c
|
||||
index d1cf061..6ab7aa4 100644
|
||||
--- a/grub-core/kern/parser.c
|
||||
+++ b/grub-core/kern/parser.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/* parser.c - the part of the parser that can return partial tokens */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
- * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
|
||||
+ * Copyright (C) 2005,2007,2009,2021 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <grub/parser.h>
|
||||
+#include <grub/buffer.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
@@ -107,8 +108,8 @@ check_varstate (grub_parser_state_t s)
|
||||
}
|
||||
|
||||
|
||||
-static void
|
||||
-add_var (char *varname, char **bp, char **vp,
|
||||
+static grub_err_t
|
||||
+add_var (grub_buffer_t varname, grub_buffer_t buf,
|
||||
grub_parser_state_t state, grub_parser_state_t newstate)
|
||||
{
|
||||
const char *val;
|
||||
@@ -116,17 +117,74 @@ add_var (char *varname, char **bp, char **vp,
|
||||
/* Check if a variable was being read in and the end of the name
|
||||
was reached. */
|
||||
if (!(check_varstate (state) && !check_varstate (newstate)))
|
||||
- return;
|
||||
+ return GRUB_ERR_NONE;
|
||||
+
|
||||
+ if (grub_buffer_append_char (varname, '\0') != GRUB_ERR_NONE)
|
||||
+ return grub_errno;
|
||||
|
||||
- *((*vp)++) = '\0';
|
||||
- val = grub_env_get (varname);
|
||||
- *vp = varname;
|
||||
+ val = grub_env_get ((const char *) grub_buffer_peek_data (varname));
|
||||
+ grub_buffer_reset (varname);
|
||||
if (!val)
|
||||
- return;
|
||||
+ return GRUB_ERR_NONE;
|
||||
|
||||
/* Insert the contents of the variable in the buffer. */
|
||||
- for (; *val; val++)
|
||||
- *((*bp)++) = *val;
|
||||
+ return grub_buffer_append_data (buf, val, grub_strlen (val));
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+terminate_arg (grub_buffer_t buffer, int *argc)
|
||||
+{
|
||||
+ grub_size_t unread = grub_buffer_get_unread_bytes (buffer);
|
||||
+
|
||||
+ if (unread == 0)
|
||||
+ return GRUB_ERR_NONE;
|
||||
+
|
||||
+ if (*(const char *) grub_buffer_peek_data_at (buffer, unread - 1) == '\0')
|
||||
+ return GRUB_ERR_NONE;
|
||||
+
|
||||
+ if (grub_buffer_append_char (buffer, '\0') != GRUB_ERR_NONE)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ (*argc)++;
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+process_char (char c, grub_buffer_t buffer, grub_buffer_t varname,
|
||||
+ grub_parser_state_t state, int *argc,
|
||||
+ grub_parser_state_t *newstate)
|
||||
+{
|
||||
+ char use;
|
||||
+
|
||||
+ *newstate = grub_parser_cmdline_state (state, c, &use);
|
||||
+
|
||||
+ /*
|
||||
+ * If a variable was being processed and this character does
|
||||
+ * not describe the variable anymore, write the variable to
|
||||
+ * the buffer.
|
||||
+ */
|
||||
+ if (add_var (varname, buffer, state, *newstate) != GRUB_ERR_NONE)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ if (check_varstate (*newstate))
|
||||
+ {
|
||||
+ if (use)
|
||||
+ return grub_buffer_append_char (varname, use);
|
||||
+ }
|
||||
+ else if (*newstate == GRUB_PARSER_STATE_TEXT &&
|
||||
+ state != GRUB_PARSER_STATE_ESC && grub_isspace (use))
|
||||
+ {
|
||||
+ /*
|
||||
+ * Don't add more than one argument if multiple
|
||||
+ * spaces are used.
|
||||
+ */
|
||||
+ return terminate_arg (buffer, argc);
|
||||
+ }
|
||||
+ else if (use)
|
||||
+ return grub_buffer_append_char (buffer, use);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
@@ -135,24 +193,36 @@ grub_parser_split_cmdline (const char *cmdline,
|
||||
int *argc, char ***argv)
|
||||
{
|
||||
grub_parser_state_t state = GRUB_PARSER_STATE_TEXT;
|
||||
- /* XXX: Fixed size buffer, perhaps this buffer should be dynamically
|
||||
- allocated. */
|
||||
- char buffer[1024];
|
||||
- char *bp = buffer;
|
||||
+ grub_buffer_t buffer, varname;
|
||||
char *rd = (char *) cmdline;
|
||||
- char varname[200];
|
||||
- char *vp = varname;
|
||||
- char *args;
|
||||
+ char *rp = rd;
|
||||
int i;
|
||||
|
||||
*argc = 0;
|
||||
*argv = NULL;
|
||||
+
|
||||
+ buffer = grub_buffer_new (1024);
|
||||
+ if (buffer == NULL)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ varname = grub_buffer_new (200);
|
||||
+ if (varname == NULL)
|
||||
+ goto fail;
|
||||
+
|
||||
do
|
||||
{
|
||||
- if (!rd || !*rd)
|
||||
+ if (rp == NULL || *rp == '\0')
|
||||
{
|
||||
+ if (rd != cmdline)
|
||||
+ {
|
||||
+ grub_free (rd);
|
||||
+ rd = rp = NULL;
|
||||
+ }
|
||||
if (getline)
|
||||
- getline (&rd, 1, getline_data);
|
||||
+ {
|
||||
+ getline (&rd, 1, getline_data);
|
||||
+ rp = rd;
|
||||
+ }
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -160,39 +230,14 @@ grub_parser_split_cmdline (const char *cmdline,
|
||||
if (!rd)
|
||||
break;
|
||||
|
||||
- for (; *rd; rd++)
|
||||
+ for (; *rp != '\0'; rp++)
|
||||
{
|
||||
grub_parser_state_t newstate;
|
||||
- char use;
|
||||
|
||||
- newstate = grub_parser_cmdline_state (state, *rd, &use);
|
||||
+ if (process_char (*rp, buffer, varname, state, argc,
|
||||
+ &newstate) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
|
||||
- /* If a variable was being processed and this character does
|
||||
- not describe the variable anymore, write the variable to
|
||||
- the buffer. */
|
||||
- add_var (varname, &bp, &vp, state, newstate);
|
||||
-
|
||||
- if (check_varstate (newstate))
|
||||
- {
|
||||
- if (use)
|
||||
- *(vp++) = use;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- if (newstate == GRUB_PARSER_STATE_TEXT
|
||||
- && state != GRUB_PARSER_STATE_ESC && grub_isspace (use))
|
||||
- {
|
||||
- /* Don't add more than one argument if multiple
|
||||
- spaces are used. */
|
||||
- if (bp != buffer && *(bp - 1))
|
||||
- {
|
||||
- *(bp++) = '\0';
|
||||
- (*argc)++;
|
||||
- }
|
||||
- }
|
||||
- else if (use)
|
||||
- *(bp++) = use;
|
||||
- }
|
||||
state = newstate;
|
||||
}
|
||||
}
|
||||
@@ -200,43 +245,60 @@ grub_parser_split_cmdline (const char *cmdline,
|
||||
|
||||
/* A special case for when the last character was part of a
|
||||
variable. */
|
||||
- add_var (varname, &bp, &vp, state, GRUB_PARSER_STATE_TEXT);
|
||||
+ if (add_var (varname, buffer, state, GRUB_PARSER_STATE_TEXT) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
|
||||
- if (bp != buffer && *(bp - 1))
|
||||
- {
|
||||
- *(bp++) = '\0';
|
||||
- (*argc)++;
|
||||
- }
|
||||
+ /* Ensure that the last argument is terminated. */
|
||||
+ if (terminate_arg (buffer, argc) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
|
||||
/* If there are no args, then we're done. */
|
||||
if (!*argc)
|
||||
- return 0;
|
||||
-
|
||||
- /* Reserve memory for the return values. */
|
||||
- args = grub_malloc (bp - buffer);
|
||||
- if (!args)
|
||||
- return grub_errno;
|
||||
- grub_memcpy (args, buffer, bp - buffer);
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
*argv = grub_calloc (*argc + 1, sizeof (char *));
|
||||
if (!*argv)
|
||||
- {
|
||||
- grub_free (args);
|
||||
- return grub_errno;
|
||||
- }
|
||||
+ goto fail;
|
||||
|
||||
/* The arguments are separated with 0's, setup argv so it points to
|
||||
the right values. */
|
||||
- bp = args;
|
||||
for (i = 0; i < *argc; i++)
|
||||
{
|
||||
- (*argv)[i] = bp;
|
||||
- while (*bp)
|
||||
- bp++;
|
||||
- bp++;
|
||||
+ char *arg;
|
||||
+
|
||||
+ if (i > 0)
|
||||
+ {
|
||||
+ if (grub_buffer_advance_read_pos (buffer, 1) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ arg = (char *) grub_buffer_peek_data (buffer);
|
||||
+ if (arg == NULL ||
|
||||
+ grub_buffer_advance_read_pos (buffer, grub_strlen (arg)) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
+
|
||||
+ (*argv)[i] = arg;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ /* Keep memory for the return values. */
|
||||
+ grub_buffer_take_data (buffer);
|
||||
+
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+
|
||||
+ out:
|
||||
+ if (rd != cmdline)
|
||||
+ grub_free (rd);
|
||||
+ grub_buffer_free (buffer);
|
||||
+ grub_buffer_free (varname);
|
||||
+
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ fail:
|
||||
+ grub_free (*argv);
|
||||
+ goto out;
|
||||
}
|
||||
|
||||
/* Helper for grub_parser_execute. */
|
||||
diff --git a/include/grub/buffer.h b/include/grub/buffer.h
|
||||
new file mode 100644
|
||||
index 0000000..f4b10cf
|
||||
--- /dev/null
|
||||
+++ b/include/grub/buffer.h
|
||||
@@ -0,0 +1,144 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef GRUB_BUFFER_H
|
||||
+#define GRUB_BUFFER_H 1
|
||||
+
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/safemath.h>
|
||||
+#include <grub/types.h>
|
||||
+
|
||||
+struct grub_buffer
|
||||
+{
|
||||
+ grub_uint8_t *data;
|
||||
+ grub_size_t sz;
|
||||
+ grub_size_t pos;
|
||||
+ grub_size_t used;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * grub_buffer_t represents a simple variable sized byte buffer with
|
||||
+ * read and write cursors. It currently only implements
|
||||
+ * functionality required by the only user in GRUB (append byte[s],
|
||||
+ * peeking data at a specified position and updating the read cursor.
|
||||
+ * Some things that this doesn't do yet are:
|
||||
+ * - Reading a portion of the buffer by copying data from the current
|
||||
+ * read position in to a caller supplied destination buffer and then
|
||||
+ * automatically updating the read cursor.
|
||||
+ * - Dropping the read part at the start of the buffer when an append
|
||||
+ * requires more space.
|
||||
+ */
|
||||
+typedef struct grub_buffer *grub_buffer_t;
|
||||
+
|
||||
+/* Allocate a new buffer with the specified initial size. */
|
||||
+extern grub_buffer_t grub_buffer_new (grub_size_t sz);
|
||||
+
|
||||
+/* Free the buffer and its resources. */
|
||||
+extern void grub_buffer_free (grub_buffer_t buf);
|
||||
+
|
||||
+/* Return the number of unread bytes in this buffer. */
|
||||
+static inline grub_size_t
|
||||
+grub_buffer_get_unread_bytes (grub_buffer_t buf)
|
||||
+{
|
||||
+ return buf->used - buf->pos;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Ensure that the buffer size is at least the requested
|
||||
+ * number of bytes.
|
||||
+ */
|
||||
+extern grub_err_t grub_buffer_ensure_space (grub_buffer_t buf, grub_size_t req);
|
||||
+
|
||||
+/*
|
||||
+ * Append the specified number of bytes from the supplied
|
||||
+ * data to the buffer.
|
||||
+ */
|
||||
+static inline grub_err_t
|
||||
+grub_buffer_append_data (grub_buffer_t buf, const void *data, grub_size_t len)
|
||||
+{
|
||||
+ grub_size_t req;
|
||||
+
|
||||
+ if (grub_add (buf->used, len, &req))
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+
|
||||
+ if (grub_buffer_ensure_space (buf, req) != GRUB_ERR_NONE)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ grub_memcpy (&buf->data[buf->used], data, len);
|
||||
+ buf->used = req;
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+/* Append the supplied character to the buffer. */
|
||||
+static inline grub_err_t
|
||||
+grub_buffer_append_char (grub_buffer_t buf, char c)
|
||||
+{
|
||||
+ return grub_buffer_append_data (buf, &c, 1);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Forget and return the underlying data buffer. The caller
|
||||
+ * becomes the owner of this buffer, and must free it when it
|
||||
+ * is no longer required.
|
||||
+ */
|
||||
+extern void *grub_buffer_take_data (grub_buffer_t buf);
|
||||
+
|
||||
+/* Reset this buffer. Note that this does not deallocate any resources. */
|
||||
+void grub_buffer_reset (grub_buffer_t buf);
|
||||
+
|
||||
+/*
|
||||
+ * Return a pointer to the underlying data buffer at the specified
|
||||
+ * offset from the current read position. Note that this pointer may
|
||||
+ * become invalid if the buffer is mutated further.
|
||||
+ */
|
||||
+static inline void *
|
||||
+grub_buffer_peek_data_at (grub_buffer_t buf, grub_size_t off)
|
||||
+{
|
||||
+ if (grub_add (buf->pos, off, &off))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected."));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (off >= buf->used)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("peek out of range"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return &buf->data[off];
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Return a pointer to the underlying data buffer at the current
|
||||
+ * read position. Note that this pointer may become invalid if the
|
||||
+ * buffer is mutated further.
|
||||
+ */
|
||||
+static inline void *
|
||||
+grub_buffer_peek_data (grub_buffer_t buf)
|
||||
+{
|
||||
+ return grub_buffer_peek_data_at (buf, 0);
|
||||
+}
|
||||
+
|
||||
+/* Advance the read position by the specified number of bytes. */
|
||||
+extern grub_err_t grub_buffer_advance_read_pos (grub_buffer_t buf, grub_size_t n);
|
||||
+
|
||||
+#endif /* GRUB_BUFFER_H */
|
||||
--
|
||||
2.25.1
|
||||
|
||||
58
meta/recipes-bsp/grub/files/CVE-2021-20225.patch
Normal file
58
meta/recipes-bsp/grub/files/CVE-2021-20225.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 2a330dba93ff11bc00eda76e9419bc52b0c7ead6 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 22 Jan 2021 16:07:29 +1100
|
||||
Subject: lib/arg: Block repeated short options that require an argument
|
||||
|
||||
Fuzzing found the following crash:
|
||||
|
||||
search -hhhhhhhhhhhhhf
|
||||
|
||||
We didn't allocate enough option space for 13 hints because the
|
||||
allocation code counts the number of discrete arguments (i.e. argc).
|
||||
However, the shortopt parsing code will happily keep processing
|
||||
a combination of short options without checking if those short
|
||||
options require an argument. This means you can easily end writing
|
||||
past the allocated option space.
|
||||
|
||||
This fixes a OOB write which can cause heap corruption.
|
||||
|
||||
Fixes: CVE-2021-20225
|
||||
|
||||
Reported-by: Daniel Axtens <dja@axtens.net>
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=2a330dba93ff11bc00eda76e9419bc52b0c7ead6]
|
||||
CVE: CVE-2021-20225
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
grub-core/lib/arg.c | 13 +++++++++++++
|
||||
1 file changed, 13 insertions(+)
|
||||
|
||||
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
|
||||
index 3288609..537c5e9 100644
|
||||
--- a/grub-core/lib/arg.c
|
||||
+++ b/grub-core/lib/arg.c
|
||||
@@ -299,6 +299,19 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
||||
it can have an argument value. */
|
||||
if (*curshort)
|
||||
{
|
||||
+ /*
|
||||
+ * Only permit further short opts if this one doesn't
|
||||
+ * require a value.
|
||||
+ */
|
||||
+ if (opt->type != ARG_TYPE_NONE &&
|
||||
+ !(opt->flags & GRUB_ARG_OPTION_OPTIONAL))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
+ N_("missing mandatory option for `%s'"),
|
||||
+ opt->longarg);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
if (parse_option (cmd, opt, 0, usr) || grub_errno)
|
||||
goto fail;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
50
meta/recipes-bsp/grub/files/CVE-2021-20233.patch
Normal file
50
meta/recipes-bsp/grub/files/CVE-2021-20233.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From 2f533a89a8dfcacbf2c9dbc77d910f111f24bf33 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Axtens <dja@axtens.net>
|
||||
Date: Fri, 22 Jan 2021 17:10:48 +1100
|
||||
Subject: commands/menuentry: Fix quoting in setparams_prefix()
|
||||
|
||||
Commit 9acdcbf32542 (use single quotes in menuentry setparams command)
|
||||
says that expressing a quoted single quote will require 3 characters. It
|
||||
actually requires (and always did require!) 4 characters:
|
||||
|
||||
str: a'b => a'\''b
|
||||
len: 3 => 6 (2 for the letters + 4 for the quote)
|
||||
|
||||
This leads to not allocating enough memory and thus out of bounds writes
|
||||
that have been observed to cause heap corruption.
|
||||
|
||||
Allocate 4 bytes for each single quote.
|
||||
|
||||
Commit 22e7dbb2bb81 (Fix quoting in legacy parser.) does the same
|
||||
quoting, but it adds 3 as extra overhead on top of the single byte that
|
||||
the quote already needs. So it's correct.
|
||||
|
||||
Fixes: 9acdcbf32542 (use single quotes in menuentry setparams command)
|
||||
Fixes: CVE-2021-20233
|
||||
|
||||
Reported-by: Daniel Axtens <dja@axtens.net>
|
||||
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?h=grub-2.06&id=2f533a89a8dfcacbf2c9dbc77d910f111f24bf33]
|
||||
CVE: CVE-2021-20233
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
grub-core/commands/menuentry.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c
|
||||
index 9164df7..720e6d8 100644
|
||||
--- a/grub-core/commands/menuentry.c
|
||||
+++ b/grub-core/commands/menuentry.c
|
||||
@@ -230,7 +230,7 @@ setparams_prefix (int argc, char **args)
|
||||
len += 3; /* 3 = 1 space + 2 quotes */
|
||||
p = args[i];
|
||||
while (*p)
|
||||
- len += (*p++ == '\'' ? 3 : 1);
|
||||
+ len += (*p++ == '\'' ? 4 : 1);
|
||||
}
|
||||
|
||||
result = grub_malloc (len + 2);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -11,7 +11,7 @@ missing sorting of the list used to generate it. Add such a sort.
|
||||
Also ensure the generated unidata.c file is deterministic by sorting the
|
||||
keys of the dict.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/grub-devel/2023-06/index.html]
|
||||
Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
|
||||
Index: grub-2.04/grub-core/genmoddep.awk
|
||||
|
||||
@@ -106,6 +106,9 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
|
||||
file://font-Fix-size-overflow-in-grub_font_get_glyph_intern.patch \
|
||||
file://CVE-2022-2601.patch \
|
||||
file://CVE-2022-3775.patch \
|
||||
file://CVE-2020-27749.patch \
|
||||
file://CVE-2021-20225.patch \
|
||||
file://CVE-2021-20233.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
|
||||
SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
|
||||
|
||||
@@ -19,9 +19,12 @@ PACKAGECONFIG[manpages] = "--enable-doc, --disable-doc, libxslt-native xmlto-nat
|
||||
|
||||
RDEPENDS_${PN} = "grep bash"
|
||||
|
||||
EXTRA_OECONF = "--libdir=${nonarch_libdir}"
|
||||
|
||||
do_configure_prepend () {
|
||||
( cd ${S}; autoreconf -f -i -s )
|
||||
}
|
||||
|
||||
FILES_${PN} += "${libdir}/${BPN}/*"
|
||||
FILES_${PN} += "${nonarch_libdir}/${BPN}/*"
|
||||
FILES_${PN}-dbg += "${datadir}/doc/pm-utils/README.debugging"
|
||||
FILES_${PN}-dev += "${nonarch_libdir}/pkgconfig/pm-utils.pc"
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From 99e2c16ea1cced34a5dc450d76287a1c3e762138 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Wagner <wagi@monom.org>
|
||||
Date: Tue, 11 Apr 2023 08:12:56 +0200
|
||||
Subject: gdhcp: Verify and sanitize packet length first
|
||||
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/patch/?id=99e2c16ea1cced34a5dc450d76287a1c3e762138]
|
||||
CVE: CVE-2023-28488
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
gdhcp/client.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/gdhcp/client.c b/gdhcp/client.c
|
||||
index 7efa7e45..82017692 100644
|
||||
--- a/gdhcp/client.c
|
||||
+++ b/gdhcp/client.c
|
||||
@@ -1319,9 +1319,9 @@ static bool sanity_check(struct ip_udp_dhcp_packet *packet, int bytes)
|
||||
static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd,
|
||||
struct sockaddr_in *dst_addr)
|
||||
{
|
||||
- int bytes;
|
||||
struct ip_udp_dhcp_packet packet;
|
||||
uint16_t check;
|
||||
+ int bytes, tot_len;
|
||||
|
||||
memset(&packet, 0, sizeof(packet));
|
||||
|
||||
@@ -1329,15 +1329,17 @@ static int dhcp_recv_l2_packet(struct dhcp_packet *dhcp_pkt, int fd,
|
||||
if (bytes < 0)
|
||||
return -1;
|
||||
|
||||
- if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp)))
|
||||
- return -1;
|
||||
-
|
||||
- if (bytes < ntohs(packet.ip.tot_len))
|
||||
+ tot_len = ntohs(packet.ip.tot_len);
|
||||
+ if (bytes > tot_len) {
|
||||
+ /* ignore any extra garbage bytes */
|
||||
+ bytes = tot_len;
|
||||
+ } else if (bytes < tot_len) {
|
||||
/* packet is bigger than sizeof(packet), we did partial read */
|
||||
return -1;
|
||||
+ }
|
||||
|
||||
- /* ignore any extra garbage bytes */
|
||||
- bytes = ntohs(packet.ip.tot_len);
|
||||
+ if (bytes < (int) (sizeof(packet.ip) + sizeof(packet.udp)))
|
||||
+ return -1;
|
||||
|
||||
if (!sanity_check(&packet, bytes))
|
||||
return -1;
|
||||
--
|
||||
cgit
|
||||
|
||||
@@ -14,6 +14,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
|
||||
file://CVE-2022-23098.patch \
|
||||
file://CVE-2022-32292.patch \
|
||||
file://CVE-2022-32293.patch \
|
||||
file://CVE-2023-28488.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
|
||||
|
||||
@@ -5,8 +5,8 @@ SECTION = "network"
|
||||
LICENSE = "PD"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=87964579b2a8ece4bc6744d2dc9a8b04"
|
||||
|
||||
SRCREV = "22a5de3ef637990ce03141f786fbdb327e9c5a3f"
|
||||
PV = "20221107"
|
||||
SRCREV = "aae7c68671d225e6d35224613d5b98192b9b2ffe"
|
||||
PV = "20230416"
|
||||
PE = "1"
|
||||
|
||||
SRC_URI = "git://gitlab.gnome.org/GNOME/mobile-broadband-provider-info.git;protocol=https;branch=main"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[Unit]
|
||||
Conflicts=sshd.service
|
||||
Wants=sshdgenkeys.service
|
||||
|
||||
[Socket]
|
||||
ExecStartPre=@BASE_BINDIR@/mkdir -p /var/run/sshd
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
[Unit]
|
||||
Description=OpenSSH Per-Connection Daemon
|
||||
Wants=sshdgenkeys.service
|
||||
After=sshdgenkeys.service
|
||||
|
||||
[Service]
|
||||
Environment="SSHD_OPTS="
|
||||
EnvironmentFile=-/etc/default/ssh
|
||||
ExecStart=-@SBINDIR@/sshd -i $SSHD_OPTS
|
||||
ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
|
||||
StandardInput=socket
|
||||
StandardError=syslog
|
||||
KillMode=process
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 679ae2f72ef8cf37609cb0eff5de3b98aa85e395 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Sakoman <steve@sakoman.com>
|
||||
Date: Thu, 20 Jul 2023 04:14:42 -1000
|
||||
Subject: [PATCH] Configure: add 2 missing key sorts in generation of unified_info
|
||||
|
||||
Otherwise generation of this section in configdata.pm is not reproducible
|
||||
|
||||
Signed-off-by: Steve Sakoman <steve@sakoman.com>
|
||||
Upstream-Status: Backport [adapted from 3.x commit https://github.com/openssl/openssl/commit/764cf5b26306a8712e8b3d41599c44dc5ed07a25]
|
||||
---
|
||||
Configure | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Configure b/Configure
|
||||
index 2a01746..8fc5a2c 100755
|
||||
--- a/Configure
|
||||
+++ b/Configure
|
||||
@@ -2326,7 +2326,7 @@ EOF
|
||||
"dso" => [ @{$unified_info{engines}} ],
|
||||
"bin" => [ @{$unified_info{programs}} ],
|
||||
"script" => [ @{$unified_info{scripts}} ] );
|
||||
- foreach my $type (keys %loopinfo) {
|
||||
+ foreach my $type (sort keys %loopinfo) {
|
||||
foreach my $product (@{$loopinfo{$type}}) {
|
||||
my %dirs = ();
|
||||
my $pd = dirname($product);
|
||||
@@ -2347,7 +2347,7 @@ EOF
|
||||
push @{$unified_info{dirinfo}->{$d}->{deps}}, $_
|
||||
if $d ne $pd;
|
||||
}
|
||||
- foreach (keys %dirs) {
|
||||
+ foreach (sort keys %dirs) {
|
||||
push @{$unified_info{dirinfo}->{$_}->{products}->{$type}},
|
||||
$product;
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
122
meta/recipes-connectivity/openssl/openssl/CVE-2023-2650.patch
Normal file
122
meta/recipes-connectivity/openssl/openssl/CVE-2023-2650.patch
Normal file
@@ -0,0 +1,122 @@
|
||||
From 9e209944b35cf82368071f160a744b6178f9b098 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Levitte <levitte@openssl.org>
|
||||
Date: Fri, 12 May 2023 10:00:13 +0200
|
||||
Subject: [PATCH] Restrict the size of OBJECT IDENTIFIERs that OBJ_obj2txt will
|
||||
translate
|
||||
|
||||
OBJ_obj2txt() would translate any size OBJECT IDENTIFIER to canonical
|
||||
numeric text form. For gigantic sub-identifiers, this would take a very
|
||||
long time, the time complexity being O(n^2) where n is the size of that
|
||||
sub-identifier.
|
||||
|
||||
To mitigate this, a restriction on the size that OBJ_obj2txt() will
|
||||
translate to canonical numeric text form is added, based on RFC 2578
|
||||
(STD 58), which says this:
|
||||
|
||||
> 3.5. OBJECT IDENTIFIER values
|
||||
>
|
||||
> An OBJECT IDENTIFIER value is an ordered list of non-negative numbers.
|
||||
> For the SMIv2, each number in the list is referred to as a sub-identifier,
|
||||
> there are at most 128 sub-identifiers in a value, and each sub-identifier
|
||||
> has a maximum value of 2^32-1 (4294967295 decimal).
|
||||
|
||||
Fixes otc/security#96
|
||||
Fixes CVE-2023-2650
|
||||
|
||||
Reviewed-by: Matt Caswell <matt@openssl.org>
|
||||
Reviewed-by: Tomas Mraz <tomas@openssl.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/openssl/openssl/commit/9e209944b35cf82368071f160a744b6178f9b098]
|
||||
CVE: CVE-2023-2650
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
CHANGES | 28 +++++++++++++++++++++++++++-
|
||||
NEWS | 2 ++
|
||||
crypto/objects/obj_dat.c | 19 +++++++++++++++++++
|
||||
3 files changed, 48 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CHANGES b/CHANGES
|
||||
index 1eaaf4e..f2cf38f 100644
|
||||
--- a/CHANGES
|
||||
+++ b/CHANGES
|
||||
@@ -7,7 +7,33 @@
|
||||
https://github.com/openssl/openssl/commits/ and pick the appropriate
|
||||
release branch.
|
||||
|
||||
- Changes between 1.1.1s and 1.1.1t [7 Feb 2023]
|
||||
+ Changes between 1.1.1t and 1.1.1u [xx XXX xxxx]
|
||||
+
|
||||
+ *) Mitigate for the time it takes for `OBJ_obj2txt` to translate gigantic
|
||||
+ OBJECT IDENTIFIER sub-identifiers to canonical numeric text form.
|
||||
+
|
||||
+ OBJ_obj2txt() would translate any size OBJECT IDENTIFIER to canonical
|
||||
+ numeric text form. For gigantic sub-identifiers, this would take a very
|
||||
+ long time, the time complexity being O(n^2) where n is the size of that
|
||||
+ sub-identifier. (CVE-2023-2650)
|
||||
+
|
||||
+ To mitigitate this, `OBJ_obj2txt()` will only translate an OBJECT
|
||||
+ IDENTIFIER to canonical numeric text form if the size of that OBJECT
|
||||
+ IDENTIFIER is 586 bytes or less, and fail otherwise.
|
||||
+
|
||||
+ The basis for this restriction is RFC 2578 (STD 58), section 3.5. OBJECT
|
||||
+ IDENTIFIER values, which stipulates that OBJECT IDENTIFIERS may have at
|
||||
+ most 128 sub-identifiers, and that the maximum value that each sub-
|
||||
+ identifier may have is 2^32-1 (4294967295 decimal).
|
||||
+
|
||||
+ For each byte of every sub-identifier, only the 7 lower bits are part of
|
||||
+ the value, so the maximum amount of bytes that an OBJECT IDENTIFIER with
|
||||
+ these restrictions may occupy is 32 * 128 / 7, which is approximately 586
|
||||
+ bytes.
|
||||
+
|
||||
+ Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
|
||||
+
|
||||
+Changes between 1.1.1s and 1.1.1t [7 Feb 2023]
|
||||
|
||||
*) Corrected documentation of X509_VERIFY_PARAM_add0_policy() to mention
|
||||
that it does not enable policy checking. Thanks to
|
||||
diff --git a/NEWS b/NEWS
|
||||
index a86220a..41922c4 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
Major changes between OpenSSL 1.1.1s and OpenSSL 1.1.1t [7 Feb 2023]
|
||||
|
||||
+ o Mitigate for very slow `OBJ_obj2txt()` performance with gigantic
|
||||
+ OBJECT IDENTIFIER sub-identities. (CVE-2023-2650)
|
||||
o Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466)
|
||||
o Fixed X.400 address type confusion in X.509 GeneralName (CVE-2023-0286)
|
||||
o Fixed Use-after-free following BIO_new_NDEF (CVE-2023-0215)
|
||||
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
|
||||
index 7e8de72..d699915 100644
|
||||
--- a/crypto/objects/obj_dat.c
|
||||
+++ b/crypto/objects/obj_dat.c
|
||||
@@ -428,6 +428,25 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
|
||||
first = 1;
|
||||
bl = NULL;
|
||||
|
||||
+ /*
|
||||
+ * RFC 2578 (STD 58) says this about OBJECT IDENTIFIERs:
|
||||
+ *
|
||||
+ * > 3.5. OBJECT IDENTIFIER values
|
||||
+ * >
|
||||
+ * > An OBJECT IDENTIFIER value is an ordered list of non-negative
|
||||
+ * > numbers. For the SMIv2, each number in the list is referred to as a
|
||||
+ * > sub-identifier, there are at most 128 sub-identifiers in a value,
|
||||
+ * > and each sub-identifier has a maximum value of 2^32-1 (4294967295
|
||||
+ * > decimal).
|
||||
+ *
|
||||
+ * So a legitimate OID according to this RFC is at most (32 * 128 / 7),
|
||||
+ * i.e. 586 bytes long.
|
||||
+ *
|
||||
+ * Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
|
||||
+ */
|
||||
+ if (len > 586)
|
||||
+ goto err;
|
||||
+
|
||||
while (len > 0) {
|
||||
l = 0;
|
||||
use_bn = 0;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -18,9 +18,11 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
|
||||
file://afalg.patch \
|
||||
file://reproducible.patch \
|
||||
file://reproducibility.patch \
|
||||
file://0001-Configure-add-2-missing-key-sorts.patch \
|
||||
file://CVE-2023-0464.patch \
|
||||
file://CVE-2023-0465.patch \
|
||||
file://CVE-2023-0466.patch \
|
||||
file://CVE-2023-2650.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-nativesdk = " \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SRCBRANCH ?= "release/2.31/master"
|
||||
PV = "2.31+git${SRCPV}"
|
||||
SRCREV_glibc ?= "d4b75594574ab8a9c2c41209cd8c62aac76b5a04"
|
||||
SRCREV_glibc ?= "2d4f26e5cfda682f9ce61444b81533b83f6381af"
|
||||
SRCREV_localedef ?= "cd9f958c4c94a638fa7b2b4e21627364f1a1a655"
|
||||
|
||||
GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "ee461b42358db458f39e558b8667fbcffb6d8044"
|
||||
SRCREV ?= "88bec50206d02fef3cdc3eaabb638963144eb63b"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
|
||||
file://Yocto_Build_Appliance.vmx \
|
||||
file://Yocto_Build_Appliance.vmxf \
|
||||
|
||||
79
meta/recipes-core/libxml/libxml2/CVE-2023-28484.patch
Normal file
79
meta/recipes-core/libxml/libxml2/CVE-2023-28484.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
From e4f85f1bd2eb34d9b49da9154a4cc3a1bc284f68 Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Fri, 7 Apr 2023 11:46:35 +0200
|
||||
Subject: [PATCH] [CVE-2023-28484] Fix null deref in xmlSchemaFixupComplexType
|
||||
|
||||
Fix a null pointer dereference when parsing (invalid) XML schemas.
|
||||
|
||||
Thanks to Robby Simpson for the report!
|
||||
|
||||
Fixes #491.
|
||||
|
||||
CVE: CVE-2023-28484
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/e4f85f1bd2eb34d9b49da9154a4cc3a1bc284f68]
|
||||
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
result/schemas/issue491_0_0.err | 1 +
|
||||
test/schemas/issue491_0.xml | 1 +
|
||||
test/schemas/issue491_0.xsd | 18 ++++++++++++++++++
|
||||
xmlschemas.c | 2 +-
|
||||
4 files changed, 21 insertions(+), 1 deletion(-)
|
||||
create mode 100644 result/schemas/issue491_0_0.err
|
||||
create mode 100644 test/schemas/issue491_0.xml
|
||||
create mode 100644 test/schemas/issue491_0.xsd
|
||||
|
||||
diff --git a/result/schemas/issue491_0_0.err b/result/schemas/issue491_0_0.err
|
||||
new file mode 100644
|
||||
index 00000000..9b2bb969
|
||||
--- /dev/null
|
||||
+++ b/result/schemas/issue491_0_0.err
|
||||
@@ -0,0 +1 @@
|
||||
+./test/schemas/issue491_0.xsd:8: element complexType: Schemas parser error : complex type 'ChildType': The content type of both, the type and its base type, must either 'mixed' or 'element-only'.
|
||||
diff --git a/test/schemas/issue491_0.xml b/test/schemas/issue491_0.xml
|
||||
new file mode 100644
|
||||
index 00000000..e2b2fc2e
|
||||
--- /dev/null
|
||||
+++ b/test/schemas/issue491_0.xml
|
||||
@@ -0,0 +1 @@
|
||||
+<Child xmlns="http://www.test.com">5</Child>
|
||||
diff --git a/test/schemas/issue491_0.xsd b/test/schemas/issue491_0.xsd
|
||||
new file mode 100644
|
||||
index 00000000..81702649
|
||||
--- /dev/null
|
||||
+++ b/test/schemas/issue491_0.xsd
|
||||
@@ -0,0 +1,18 @@
|
||||
+<?xml version='1.0' encoding='UTF-8'?>
|
||||
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com" targetNamespace="http://www.test.com" elementFormDefault="qualified" attributeFormDefault="unqualified">
|
||||
+ <xs:complexType name="BaseType">
|
||||
+ <xs:simpleContent>
|
||||
+ <xs:extension base="xs:int" />
|
||||
+ </xs:simpleContent>
|
||||
+ </xs:complexType>
|
||||
+ <xs:complexType name="ChildType">
|
||||
+ <xs:complexContent>
|
||||
+ <xs:extension base="BaseType">
|
||||
+ <xs:sequence>
|
||||
+ <xs:element name="bad" type="xs:int" minOccurs="0" maxOccurs="1"/>
|
||||
+ </xs:sequence>
|
||||
+ </xs:extension>
|
||||
+ </xs:complexContent>
|
||||
+ </xs:complexType>
|
||||
+ <xs:element name="Child" type="ChildType" />
|
||||
+</xs:schema>
|
||||
diff --git a/xmlschemas.c b/xmlschemas.c
|
||||
index 6a353858..a4eaf591 100644
|
||||
--- a/xmlschemas.c
|
||||
+++ b/xmlschemas.c
|
||||
@@ -18632,7 +18632,7 @@ xmlSchemaFixupComplexType(xmlSchemaParserCtxtPtr pctxt,
|
||||
"allowed to appear inside other model groups",
|
||||
NULL, NULL);
|
||||
|
||||
- } else if (! dummySequence) {
|
||||
+ } else if ((!dummySequence) && (baseType->subtypes != NULL)) {
|
||||
xmlSchemaTreeItemPtr effectiveContent =
|
||||
(xmlSchemaTreeItemPtr) type->subtypes;
|
||||
/*
|
||||
--
|
||||
GitLab
|
||||
|
||||
42
meta/recipes-core/libxml/libxml2/CVE-2023-29469.patch
Normal file
42
meta/recipes-core/libxml/libxml2/CVE-2023-29469.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 547edbf1cbdccd46b2e8ff322a456eaa5931c5df Mon Sep 17 00:00:00 2001
|
||||
From: Nick Wellnhofer <wellnhofer@aevum.de>
|
||||
Date: Fri, 7 Apr 2023 11:49:27 +0200
|
||||
Subject: [PATCH] [CVE-2023-29469] Hashing of empty dict strings isn't
|
||||
deterministic
|
||||
|
||||
When hashing empty strings which aren't null-terminated,
|
||||
xmlDictComputeFastKey could produce inconsistent results. This could
|
||||
lead to various logic or memory errors, including double frees.
|
||||
|
||||
For consistency the seed is also taken into account, but this shouldn't
|
||||
have an impact on security.
|
||||
|
||||
Found by OSS-Fuzz.
|
||||
|
||||
Fixes #510.
|
||||
|
||||
CVE: CVE-2023-29469
|
||||
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/547edbf1cbdccd46b2e8ff322a456eaa5931c5df]
|
||||
|
||||
Signed-off-by: Peter Marko <peter.marko@siemens.com>
|
||||
---
|
||||
dict.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dict.c b/dict.c
|
||||
index 86c3f6d7..d7fd1a06 100644
|
||||
--- a/dict.c
|
||||
+++ b/dict.c
|
||||
@@ -451,7 +451,8 @@ static unsigned long
|
||||
xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
|
||||
unsigned long value = seed;
|
||||
|
||||
- if (name == NULL) return(0);
|
||||
+ if ((name == NULL) || (namelen <= 0))
|
||||
+ return(value);
|
||||
value = *name;
|
||||
value <<= 5;
|
||||
if (namelen > 10) {
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -36,6 +36,8 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar.gz;subdir=${BP};name=te
|
||||
file://CVE-2016-3709.patch \
|
||||
file://CVE-2022-40303.patch \
|
||||
file://CVE-2022-40304.patch \
|
||||
file://CVE-2023-28484.patch \
|
||||
file://CVE-2023-29469.patch \
|
||||
"
|
||||
|
||||
SRC_URI[archive.sha256sum] = "593b7b751dd18c2d6abcd0c4bcb29efc203d0b4373a6df98e3a455ea74ae2813"
|
||||
|
||||
342
meta/recipes-core/meta/cve-update-nvd2-native.bb
Normal file
342
meta/recipes-core/meta/cve-update-nvd2-native.bb
Normal file
@@ -0,0 +1,342 @@
|
||||
SUMMARY = "Updates the NVD CVE database"
|
||||
LICENSE = "MIT"
|
||||
|
||||
# Important note:
|
||||
# This product uses the NVD API but is not endorsed or certified by the NVD.
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
|
||||
inherit native
|
||||
|
||||
deltask do_unpack
|
||||
deltask do_patch
|
||||
deltask do_configure
|
||||
deltask do_compile
|
||||
deltask do_install
|
||||
deltask do_populate_sysroot
|
||||
|
||||
NVDCVE_URL ?= "https://services.nvd.nist.gov/rest/json/cves/2.0"
|
||||
|
||||
# If you have a NVD API key (https://nvd.nist.gov/developers/request-an-api-key)
|
||||
# then setting this to get higher rate limits.
|
||||
NVDCVE_API_KEY ?= ""
|
||||
|
||||
# CVE database update interval, in seconds. By default: once a day (24*60*60).
|
||||
# Use 0 to force the update
|
||||
# Use a negative value to skip the update
|
||||
CVE_DB_UPDATE_INTERVAL ?= "86400"
|
||||
|
||||
# Timeout for blocking socket operations, such as the connection attempt.
|
||||
CVE_SOCKET_TIMEOUT ?= "60"
|
||||
|
||||
CVE_DB_TEMP_FILE ?= "${CVE_CHECK_DB_DIR}/temp_nvdcve_2.db"
|
||||
|
||||
CVE_CHECK_DB_FILE ?= "${CVE_CHECK_DB_DIR}/nvdcve_2.db"
|
||||
|
||||
python () {
|
||||
if not bb.data.inherits_class("cve-check", d):
|
||||
raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.")
|
||||
}
|
||||
|
||||
python do_fetch() {
|
||||
"""
|
||||
Update NVD database with API 2.0
|
||||
"""
|
||||
import bb.utils
|
||||
import bb.progress
|
||||
import shutil
|
||||
|
||||
bb.utils.export_proxies(d)
|
||||
|
||||
db_file = d.getVar("CVE_CHECK_DB_FILE")
|
||||
db_dir = os.path.dirname(db_file)
|
||||
db_tmp_file = d.getVar("CVE_DB_TEMP_FILE")
|
||||
|
||||
cleanup_db_download(db_file, db_tmp_file)
|
||||
# By default let's update the whole database (since time 0)
|
||||
database_time = 0
|
||||
|
||||
# The NVD database changes once a day, so no need to update more frequently
|
||||
# Allow the user to force-update
|
||||
try:
|
||||
import time
|
||||
update_interval = int(d.getVar("CVE_DB_UPDATE_INTERVAL"))
|
||||
if update_interval < 0:
|
||||
bb.note("CVE database update skipped")
|
||||
return
|
||||
if time.time() - os.path.getmtime(db_file) < update_interval:
|
||||
bb.note("CVE database recently updated, skipping")
|
||||
return
|
||||
database_time = os.path.getmtime(db_file)
|
||||
|
||||
except OSError:
|
||||
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, database_time) == True:
|
||||
# Update downloaded correctly, can swap files
|
||||
shutil.move(db_tmp_file, db_file)
|
||||
else:
|
||||
# Update failed, do not modify the database
|
||||
bb.warn("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 nvd_request_next(url, api_key, args):
|
||||
"""
|
||||
Request next part of the NVD dabase
|
||||
"""
|
||||
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import gzip
|
||||
import http
|
||||
import time
|
||||
|
||||
request = urllib.request.Request(url + "?" + urllib.parse.urlencode(args))
|
||||
if api_key:
|
||||
request.add_header("apiKey", api_key)
|
||||
bb.note("Requesting %s" % request.full_url)
|
||||
|
||||
for attempt in range(5):
|
||||
try:
|
||||
r = urllib.request.urlopen(request)
|
||||
|
||||
if (r.headers['content-encoding'] == 'gzip'):
|
||||
buf = r.read()
|
||||
raw_data = gzip.decompress(buf)
|
||||
else:
|
||||
raw_data = r.read().decode("utf-8")
|
||||
|
||||
r.close()
|
||||
|
||||
except Exception as e:
|
||||
bb.note("CVE database: received error (%s), retrying" % (e))
|
||||
time.sleep(6)
|
||||
pass
|
||||
else:
|
||||
return raw_data
|
||||
else:
|
||||
# We failed at all attempts
|
||||
return None
|
||||
|
||||
def update_db_file(db_tmp_file, d, database_time):
|
||||
"""
|
||||
Update the given database file
|
||||
"""
|
||||
import bb.utils, bb.progress
|
||||
import datetime
|
||||
import sqlite3
|
||||
import json
|
||||
|
||||
# Connect to database
|
||||
conn = sqlite3.connect(db_tmp_file)
|
||||
initialize_db(conn)
|
||||
|
||||
req_args = {'startIndex' : 0}
|
||||
|
||||
# The maximum range for time is 120 days
|
||||
# Force a complete update if our range is longer
|
||||
if (database_time != 0):
|
||||
database_date = datetime.datetime.fromtimestamp(database_time, tz=datetime.timezone.utc)
|
||||
today_date = datetime.datetime.now(tz=datetime.timezone.utc)
|
||||
delta = today_date - database_date
|
||||
if delta.days < 120:
|
||||
bb.note("CVE database: performing partial update")
|
||||
req_args['lastModStartDate'] = database_date.isoformat()
|
||||
req_args['lastModEndDate'] = today_date.isoformat()
|
||||
else:
|
||||
bb.note("CVE database: file too old, forcing a full update")
|
||||
|
||||
with bb.progress.ProgressHandler(d) as ph, open(os.path.join(d.getVar("TMPDIR"), 'cve_check'), 'a') as cve_f:
|
||||
|
||||
bb.note("Updating entries")
|
||||
index = 0
|
||||
url = d.getVar("NVDCVE_URL")
|
||||
api_key = d.getVar("NVDCVE_API_KEY") or None
|
||||
|
||||
while True:
|
||||
req_args['startIndex'] = index
|
||||
raw_data = nvd_request_next(url, api_key, req_args)
|
||||
if raw_data is None:
|
||||
# We haven't managed to download data
|
||||
return False
|
||||
|
||||
data = json.loads(raw_data)
|
||||
|
||||
index = data["startIndex"]
|
||||
total = data["totalResults"]
|
||||
per_page = data["resultsPerPage"]
|
||||
bb.note("Got %d entries" % per_page)
|
||||
for cve in data["vulnerabilities"]:
|
||||
update_db(conn, cve)
|
||||
|
||||
index += per_page
|
||||
ph.update((float(index) / (total+1)) * 100)
|
||||
if index >= total:
|
||||
break
|
||||
|
||||
# Recommended by NVD
|
||||
time.sleep(6)
|
||||
|
||||
# Update success, set the date to cve_check file.
|
||||
cve_f.write('CVE database update : %s\n\n' % datetime.date.today())
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
return True
|
||||
|
||||
def initialize_db(conn):
|
||||
with conn:
|
||||
c = conn.cursor()
|
||||
|
||||
c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
|
||||
|
||||
c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \
|
||||
SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)")
|
||||
|
||||
c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \
|
||||
VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \
|
||||
VERSION_END TEXT, OPERATOR_END TEXT)")
|
||||
c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);")
|
||||
|
||||
c.close()
|
||||
|
||||
def parse_node_and_insert(conn, node, cveId):
|
||||
|
||||
def cpe_generator():
|
||||
for cpe in node.get('cpeMatch', ()):
|
||||
if not cpe['vulnerable']:
|
||||
return
|
||||
cpe23 = cpe.get('criteria')
|
||||
if not cpe23:
|
||||
return
|
||||
cpe23 = cpe23.split(':')
|
||||
if len(cpe23) < 6:
|
||||
return
|
||||
vendor = cpe23[3]
|
||||
product = cpe23[4]
|
||||
version = cpe23[5]
|
||||
|
||||
if cpe23[6] == '*' or cpe23[6] == '-':
|
||||
version_suffix = ""
|
||||
else:
|
||||
version_suffix = "_" + cpe23[6]
|
||||
|
||||
if version != '*' and version != '-':
|
||||
# Version is defined, this is a '=' match
|
||||
yield [cveId, vendor, product, version + version_suffix, '=', '', '']
|
||||
elif version == '-':
|
||||
# no version information is available
|
||||
yield [cveId, vendor, product, version, '', '', '']
|
||||
else:
|
||||
# Parse start version, end version and operators
|
||||
op_start = ''
|
||||
op_end = ''
|
||||
v_start = ''
|
||||
v_end = ''
|
||||
|
||||
if 'versionStartIncluding' in cpe:
|
||||
op_start = '>='
|
||||
v_start = cpe['versionStartIncluding']
|
||||
|
||||
if 'versionStartExcluding' in cpe:
|
||||
op_start = '>'
|
||||
v_start = cpe['versionStartExcluding']
|
||||
|
||||
if 'versionEndIncluding' in cpe:
|
||||
op_end = '<='
|
||||
v_end = cpe['versionEndIncluding']
|
||||
|
||||
if 'versionEndExcluding' in cpe:
|
||||
op_end = '<'
|
||||
v_end = cpe['versionEndExcluding']
|
||||
|
||||
if op_start or op_end or v_start or v_end:
|
||||
yield [cveId, vendor, product, v_start, op_start, v_end, op_end]
|
||||
else:
|
||||
# This is no version information, expressed differently.
|
||||
# Save processing by representing as -.
|
||||
yield [cveId, vendor, product, '-', '', '', '']
|
||||
|
||||
conn.executemany("insert into PRODUCTS values (?, ?, ?, ?, ?, ?, ?)", cpe_generator()).close()
|
||||
|
||||
def update_db(conn, elt):
|
||||
"""
|
||||
Update a single entry in the on-disk database
|
||||
"""
|
||||
|
||||
accessVector = None
|
||||
cveId = elt['cve']['id']
|
||||
if elt['cve']['vulnStatus'] == "Rejected":
|
||||
return
|
||||
cveDesc = ""
|
||||
for desc in elt['cve']['descriptions']:
|
||||
if desc['lang'] == 'en':
|
||||
cveDesc = desc['value']
|
||||
date = elt['cve']['lastModified']
|
||||
try:
|
||||
accessVector = elt['cve']['metrics']['cvssMetricV2'][0]['cvssData']['accessVector']
|
||||
cvssv2 = elt['cve']['metrics']['cvssMetricV2'][0]['cvssData']['baseScore']
|
||||
except KeyError:
|
||||
cvssv2 = 0.0
|
||||
cvssv3 = None
|
||||
try:
|
||||
accessVector = accessVector or elt['cve']['metrics']['cvssMetricV30'][0]['cvssData']['attackVector']
|
||||
cvssv3 = elt['cve']['metrics']['cvssMetricV30'][0]['cvssData']['baseScore']
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
accessVector = accessVector or elt['cve']['metrics']['cvssMetricV31'][0]['cvssData']['attackVector']
|
||||
cvssv3 = cvssv3 or elt['cve']['metrics']['cvssMetricV31'][0]['cvssData']['baseScore']
|
||||
except KeyError:
|
||||
pass
|
||||
accessVector = accessVector or "UNKNOWN"
|
||||
cvssv3 = cvssv3 or 0.0
|
||||
|
||||
conn.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
|
||||
[cveId, cveDesc, cvssv2, cvssv3, date, accessVector]).close()
|
||||
|
||||
try:
|
||||
for config in elt['cve']['configurations']:
|
||||
# This is suboptimal as it doesn't handle AND/OR and negate, but is better than nothing
|
||||
for node in config["nodes"]:
|
||||
parse_node_and_insert(conn, node, cveId)
|
||||
except KeyError:
|
||||
bb.note("CVE %s has no configurations" % cveId)
|
||||
|
||||
do_fetch[nostamp] = "1"
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
@@ -182,12 +182,14 @@ class SystemdUnit():
|
||||
|
||||
raise SystemdUnitNotFoundError(self.root, unit)
|
||||
|
||||
def _process_deps(self, config, service, location, prop, dirstem):
|
||||
def _process_deps(self, config, service, location, prop, dirstem, instance):
|
||||
systemdir = self.root / SYSCONFDIR / "systemd" / "system"
|
||||
|
||||
target = ROOT / location.relative_to(self.root)
|
||||
try:
|
||||
for dependent in config.get('Install', prop):
|
||||
# expand any %i to instance (ignoring escape sequence %%)
|
||||
dependent = re.sub("([^%](%%)*)%i", "\\1{}".format(instance), dependent)
|
||||
wants = systemdir / "{}.{}".format(dependent, dirstem) / service
|
||||
add_link(wants, target)
|
||||
|
||||
@@ -227,8 +229,8 @@ class SystemdUnit():
|
||||
else:
|
||||
service = self.unit
|
||||
|
||||
self._process_deps(config, service, path, 'WantedBy', 'wants')
|
||||
self._process_deps(config, service, path, 'RequiredBy', 'requires')
|
||||
self._process_deps(config, service, path, 'WantedBy', 'wants', instance)
|
||||
self._process_deps(config, service, path, 'RequiredBy', 'requires', instance)
|
||||
|
||||
try:
|
||||
for also in config.get('Install', 'Also'):
|
||||
|
||||
@@ -12,10 +12,7 @@ set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}")
|
||||
|
||||
# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os).
|
||||
if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+")
|
||||
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
set( CMAKE_SYSTEM_PROCESSOR $ENV{OECORE_TARGET_ARCH} )
|
||||
|
||||
# Include the toolchain configuration subscripts
|
||||
file( GLOB toolchain_config_files "${CMAKE_TOOLCHAIN_FILE}.d/*.cmake" )
|
||||
|
||||
@@ -8,3 +8,4 @@ rm -f *.tmp
|
||||
rm -f *.ok
|
||||
rm -f *.failed
|
||||
rm -f *.log
|
||||
cp ../data/test_data.tmp ./
|
||||
|
||||
@@ -144,4 +144,7 @@ do_install_ptest() {
|
||||
|
||||
install -d ${D}${PTEST_PATH}/lib
|
||||
install -m 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/
|
||||
|
||||
install -d ${D}${PTEST_PATH}/data
|
||||
install -m 0644 ${B}/tests/test_data.tmp ${D}${PTEST_PATH}/data/
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/gcc-${PV}"
|
||||
SRC_URI[sha256sum] = "27769f64ef1d4cd5e2be8682c0c93f9887983e6cfd1a927ce5a0a2915a95cf8f"
|
||||
# For dev release snapshotting
|
||||
#S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/official-gcc-${RELEASE}"
|
||||
#B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
|
||||
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
|
||||
|
||||
# Language Overrides
|
||||
FORTRAN = ""
|
||||
|
||||
94
meta/recipes-devtools/git/files/CVE-2023-25652.patch
Normal file
94
meta/recipes-devtools/git/files/CVE-2023-25652.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
From 9db05711c98efc14f414d4c87135a34c13586e0b Mon Sep 17 00:00:00 2001
|
||||
From: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
Date: Thu, 9 Mar 2023 16:02:54 +0100
|
||||
Subject: [PATCH] apply --reject: overwrite existing `.rej` symlink if it
|
||||
exists
|
||||
|
||||
The `git apply --reject` is expected to write out `.rej` files in case
|
||||
one or more hunks fail to apply cleanly. Historically, the command
|
||||
overwrites any existing `.rej` files. The idea being that
|
||||
apply/reject/edit cycles are relatively common, and the generated `.rej`
|
||||
files are not considered precious.
|
||||
|
||||
But the command does not overwrite existing `.rej` symbolic links, and
|
||||
instead follows them. This is unsafe because the same patch could
|
||||
potentially create such a symbolic link and point at arbitrary paths
|
||||
outside the current worktree, and `git apply` would write the contents
|
||||
of the `.rej` file into that location.
|
||||
|
||||
Therefore, let's make sure that any existing `.rej` file or symbolic
|
||||
link is removed before writing it.
|
||||
|
||||
Reported-by: RyotaK <ryotak.mail@gmail.com>
|
||||
Helped-by: Taylor Blau <me@ttaylorr.com>
|
||||
Helped-by: Junio C Hamano <gitster@pobox.com>
|
||||
Helped-by: Linus Torvalds <torvalds@linuxfoundation.org>
|
||||
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/9db05711c98efc14f414d4c87135a34c13586e0b]
|
||||
CVE: CVE-2023-25652
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
apply.c | 14 ++++++++++++--
|
||||
t/t4115-apply-symlink.sh | 15 +++++++++++++++
|
||||
2 files changed, 27 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/apply.c b/apply.c
|
||||
index 4f303bf..aa7111d 100644
|
||||
--- a/apply.c
|
||||
+++ b/apply.c
|
||||
@@ -4531,7 +4531,7 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch)
|
||||
FILE *rej;
|
||||
char namebuf[PATH_MAX];
|
||||
struct fragment *frag;
|
||||
- int cnt = 0;
|
||||
+ int fd, cnt = 0;
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
for (cnt = 0, frag = patch->fragments; frag; frag = frag->next) {
|
||||
@@ -4571,7 +4571,17 @@ static int write_out_one_reject(struct apply_state *state, struct patch *patch)
|
||||
memcpy(namebuf, patch->new_name, cnt);
|
||||
memcpy(namebuf + cnt, ".rej", 5);
|
||||
|
||||
- rej = fopen(namebuf, "w");
|
||||
+ fd = open(namebuf, O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||
+ if (fd < 0) {
|
||||
+ if (errno != EEXIST)
|
||||
+ return error_errno(_("cannot open %s"), namebuf);
|
||||
+ if (unlink(namebuf))
|
||||
+ return error_errno(_("cannot unlink '%s'"), namebuf);
|
||||
+ fd = open(namebuf, O_CREAT | O_EXCL | O_WRONLY, 0666);
|
||||
+ if (fd < 0)
|
||||
+ return error_errno(_("cannot open %s"), namebuf);
|
||||
+ }
|
||||
+ rej = fdopen(fd, "w");
|
||||
if (!rej)
|
||||
return error_errno(_("cannot open %s"), namebuf);
|
||||
|
||||
diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh
|
||||
index 1acb7b2..2b034ff 100755
|
||||
--- a/t/t4115-apply-symlink.sh
|
||||
+++ b/t/t4115-apply-symlink.sh
|
||||
@@ -125,4 +125,19 @@ test_expect_success SYMLINKS 'symlink escape when deleting file' '
|
||||
test_path_is_file .git/delete-me
|
||||
'
|
||||
|
||||
+test_expect_success SYMLINKS '--reject removes .rej symlink if it exists' '
|
||||
+ test_when_finished "git reset --hard && git clean -dfx" &&
|
||||
+
|
||||
+ test_commit file &&
|
||||
+ echo modified >file.t &&
|
||||
+ git diff -- file.t >patch &&
|
||||
+ echo modified-again >file.t &&
|
||||
+
|
||||
+ ln -s foo file.t.rej &&
|
||||
+ test_must_fail git apply patch --reject 2>err &&
|
||||
+ test_i18ngrep "Rejected hunk" err &&
|
||||
+ test_path_is_missing foo &&
|
||||
+ test_path_is_file file.t.rej
|
||||
+'
|
||||
+
|
||||
test_done
|
||||
--
|
||||
2.25.1
|
||||
|
||||
159
meta/recipes-devtools/git/files/CVE-2023-29007.patch
Normal file
159
meta/recipes-devtools/git/files/CVE-2023-29007.patch
Normal file
@@ -0,0 +1,159 @@
|
||||
From 057c07a7b1fae22fdeef26c243f4cfbe3afc90ce Mon Sep 17 00:00:00 2001
|
||||
From: Taylor Blau <me@ttaylorr.com>
|
||||
Date: Fri, 14 Apr 2023 11:46:59 -0400
|
||||
Subject: [PATCH] Merge branch 'tb/config-copy-or-rename-in-file-injection'
|
||||
|
||||
Avoids issues with renaming or deleting sections with long lines, where
|
||||
configuration values may be interpreted as sections, leading to
|
||||
configuration injection. Addresses CVE-2023-29007.
|
||||
|
||||
* tb/config-copy-or-rename-in-file-injection:
|
||||
config.c: disallow overly-long lines in `copy_or_rename_section_in_file()`
|
||||
config.c: avoid integer truncation in `copy_or_rename_section_in_file()`
|
||||
config: avoid fixed-sized buffer when renaming/deleting a section
|
||||
t1300: demonstrate failure when renaming sections with long lines
|
||||
|
||||
Signed-off-by: Taylor Blau <me@ttaylorr.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/528290f8c61222433a8cf02fb7cfffa8438432b4]
|
||||
CVE: CVE-2023-29007
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
config.c | 36 +++++++++++++++++++++++++-----------
|
||||
t/t1300-config.sh | 30 ++++++++++++++++++++++++++++++
|
||||
2 files changed, 55 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/config.c b/config.c
|
||||
index e7052b3..676b687 100644
|
||||
--- a/config.c
|
||||
+++ b/config.c
|
||||
@@ -2987,9 +2987,10 @@ void git_config_set_multivar(const char *key, const char *value,
|
||||
multi_replace);
|
||||
}
|
||||
|
||||
-static int section_name_match (const char *buf, const char *name)
|
||||
+static size_t section_name_match (const char *buf, const char *name)
|
||||
{
|
||||
- int i = 0, j = 0, dot = 0;
|
||||
+ size_t i = 0, j = 0;
|
||||
+ int dot = 0;
|
||||
if (buf[i] != '[')
|
||||
return 0;
|
||||
for (i = 1; buf[i] && buf[i] != ']'; i++) {
|
||||
@@ -3042,6 +3043,8 @@ static int section_name_is_ok(const char *name)
|
||||
return 1;
|
||||
}
|
||||
|
||||
+#define GIT_CONFIG_MAX_LINE_LEN (512 * 1024)
|
||||
+
|
||||
/* if new_name == NULL, the section is removed instead */
|
||||
static int git_config_copy_or_rename_section_in_file(const char *config_filename,
|
||||
const char *old_name,
|
||||
@@ -3051,11 +3054,12 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
|
||||
char *filename_buf = NULL;
|
||||
struct lock_file lock = LOCK_INIT;
|
||||
int out_fd;
|
||||
- char buf[1024];
|
||||
+ struct strbuf buf = STRBUF_INIT;
|
||||
FILE *config_file = NULL;
|
||||
struct stat st;
|
||||
struct strbuf copystr = STRBUF_INIT;
|
||||
struct config_store_data store;
|
||||
+ uint32_t line_nr = 0;
|
||||
|
||||
memset(&store, 0, sizeof(store));
|
||||
|
||||
@@ -3092,16 +3096,25 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
|
||||
goto out;
|
||||
}
|
||||
|
||||
- while (fgets(buf, sizeof(buf), config_file)) {
|
||||
- int i;
|
||||
- int length;
|
||||
+ while (!strbuf_getwholeline(&buf, config_file, '\n')) {
|
||||
+ size_t i, length;
|
||||
int is_section = 0;
|
||||
- char *output = buf;
|
||||
- for (i = 0; buf[i] && isspace(buf[i]); i++)
|
||||
+ char *output = buf.buf;
|
||||
+
|
||||
+ line_nr++;
|
||||
+
|
||||
+ if (buf.len >= GIT_CONFIG_MAX_LINE_LEN) {
|
||||
+ ret = error(_("refusing to work with overly long line "
|
||||
+ "in '%s' on line %"PRIuMAX),
|
||||
+ config_filename, (uintmax_t)line_nr);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; buf.buf[i] && isspace(buf.buf[i]); i++)
|
||||
; /* do nothing */
|
||||
- if (buf[i] == '[') {
|
||||
+ if (buf.buf[i] == '[') {
|
||||
/* it's a section */
|
||||
- int offset;
|
||||
+ size_t offset;
|
||||
is_section = 1;
|
||||
|
||||
/*
|
||||
@@ -3118,7 +3131,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
|
||||
strbuf_reset(©str);
|
||||
}
|
||||
|
||||
- offset = section_name_match(&buf[i], old_name);
|
||||
+ offset = section_name_match(&buf.buf[i], old_name);
|
||||
if (offset > 0) {
|
||||
ret++;
|
||||
if (new_name == NULL) {
|
||||
@@ -3193,6 +3206,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
|
||||
out_no_rollback:
|
||||
free(filename_buf);
|
||||
config_store_data_clear(&store);
|
||||
+ strbuf_release(&buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
|
||||
index 983a0a1..9b67f6b 100755
|
||||
--- a/t/t1300-config.sh
|
||||
+++ b/t/t1300-config.sh
|
||||
@@ -616,6 +616,36 @@ test_expect_success 'renaming to bogus section is rejected' '
|
||||
test_must_fail git config --rename-section branch.zwei "bogus name"
|
||||
'
|
||||
|
||||
+test_expect_success 'renaming a section with a long line' '
|
||||
+ {
|
||||
+ printf "[b]\\n" &&
|
||||
+ printf " c = d %1024s [a] e = f\\n" " " &&
|
||||
+ printf "[a] g = h\\n"
|
||||
+ } >y &&
|
||||
+ git config -f y --rename-section a xyz &&
|
||||
+ test_must_fail git config -f y b.e
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'renaming an embedded section with a long line' '
|
||||
+ {
|
||||
+ printf "[b]\\n" &&
|
||||
+ printf " c = d %1024s [a] [foo] e = f\\n" " " &&
|
||||
+ printf "[a] g = h\\n"
|
||||
+ } >y &&
|
||||
+ git config -f y --rename-section a xyz &&
|
||||
+ test_must_fail git config -f y foo.e
|
||||
+'
|
||||
+
|
||||
+test_expect_success 'renaming a section with an overly-long line' '
|
||||
+ {
|
||||
+ printf "[b]\\n" &&
|
||||
+ printf " c = d %525000s e" " " &&
|
||||
+ printf "[a] g = h\\n"
|
||||
+ } >y &&
|
||||
+ test_must_fail git config -f y --rename-section a xyz 2>err &&
|
||||
+ test_i18ngrep "refusing to work with overly long line in .y. on line 2" err
|
||||
+'
|
||||
+
|
||||
cat >> .git/config << EOF
|
||||
[branch "zwei"] a = 1 [branch "vier"]
|
||||
EOF
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -28,6 +28,8 @@ SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
|
||||
file://CVE-2023-22490-2.patch \
|
||||
file://CVE-2023-22490-3.patch \
|
||||
file://CVE-2023-23946.patch \
|
||||
file://CVE-2023-29007.patch \
|
||||
file://CVE-2023-25652.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git-${PV}"
|
||||
|
||||
|
||||
@@ -58,6 +58,16 @@ SRC_URI += "\
|
||||
file://CVE-2020-29510.patch \
|
||||
file://CVE-2023-24537.patch \
|
||||
file://CVE-2023-24534.patch \
|
||||
file://CVE-2023-24538-1.patch \
|
||||
file://CVE-2023-24538-2.patch \
|
||||
file://CVE-2023-24538-3.patch \
|
||||
file://CVE-2023-24539.patch \
|
||||
file://CVE-2023-24540.patch \
|
||||
file://CVE-2023-29405-1.patch \
|
||||
file://CVE-2023-29405-2.patch \
|
||||
file://CVE-2023-29402.patch \
|
||||
file://CVE-2023-29404.patch \
|
||||
file://CVE-2023-29400.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"
|
||||
|
||||
125
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
Normal file
125
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-1.patch
Normal file
@@ -0,0 +1,125 @@
|
||||
From 8acd01094d9ee17f6e763a61e49a8a808b3a9ddb Mon Sep 17 00:00:00 2001
|
||||
From: Brad Fitzpatrick <bradfitz@golang.org>
|
||||
Date: Mon, 2 Aug 2021 14:55:51 -0700
|
||||
Subject: [PATCH 1/3] net/netip: add new IP address package
|
||||
|
||||
Co-authored-by: Alex Willmer <alex@moreati.org.uk> (GitHub @moreati)
|
||||
Co-authored-by: Alexander Yastrebov <yastrebov.alex@gmail.com>
|
||||
Co-authored-by: David Anderson <dave@natulte.net> (Tailscale CLA)
|
||||
Co-authored-by: David Crawshaw <crawshaw@tailscale.com> (Tailscale CLA)
|
||||
Co-authored-by: Dmytro Shynkevych <dmytro@tailscale.com> (Tailscale CLA)
|
||||
Co-authored-by: Elias Naur <mail@eliasnaur.com>
|
||||
Co-authored-by: Joe Tsai <joetsai@digital-static.net> (Tailscale CLA)
|
||||
Co-authored-by: Jonathan Yu <jawnsy@cpan.org> (GitHub @jawnsy)
|
||||
Co-authored-by: Josh Bleecher Snyder <josharian@gmail.com> (Tailscale CLA)
|
||||
Co-authored-by: Maisem Ali <maisem@tailscale.com> (Tailscale CLA)
|
||||
Co-authored-by: Manuel Mendez (Go AUTHORS mmendez534@...)
|
||||
Co-authored-by: Matt Layher <mdlayher@gmail.com>
|
||||
Co-authored-by: Noah Treuhaft <noah.treuhaft@gmail.com> (GitHub @nwt)
|
||||
Co-authored-by: Stefan Majer <stefan.majer@gmail.com>
|
||||
Co-authored-by: Terin Stock <terinjokes@gmail.com> (Cloudflare CLA)
|
||||
Co-authored-by: Tobias Klauser <tklauser@distanz.ch>
|
||||
|
||||
Fixes #46518
|
||||
|
||||
Change-Id: I0041f9e1115d61fa6e95fcf32b01d9faee708712
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/339309
|
||||
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
|
||||
TryBot-Result: Go Bot <gobot@golang.org>
|
||||
Reviewed-by: Russ Cox <rsc@golang.org>
|
||||
Trust: Brad Fitzpatrick <bradfitz@golang.org>
|
||||
|
||||
Dependency Patch #1
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/a59e33224e42d60a97fa720a45e1b74eb6aaa3d0]
|
||||
CVE: CVE-2023-24538
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/internal/godebug/godebug.go | 34 ++++++++++++++++++++++++++++++++++
|
||||
src/internal/godebug/godebug_test.go | 34 ++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 68 insertions(+)
|
||||
create mode 100644 src/internal/godebug/godebug.go
|
||||
create mode 100644 src/internal/godebug/godebug_test.go
|
||||
|
||||
diff --git a/src/internal/godebug/godebug.go b/src/internal/godebug/godebug.go
|
||||
new file mode 100644
|
||||
index 0000000..ac434e5
|
||||
--- /dev/null
|
||||
+++ b/src/internal/godebug/godebug.go
|
||||
@@ -0,0 +1,34 @@
|
||||
+// Copyright 2021 The Go Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style
|
||||
+// license that can be found in the LICENSE file.
|
||||
+
|
||||
+// Package godebug parses the GODEBUG environment variable.
|
||||
+package godebug
|
||||
+
|
||||
+import "os"
|
||||
+
|
||||
+// Get returns the value for the provided GODEBUG key.
|
||||
+func Get(key string) string {
|
||||
+ return get(os.Getenv("GODEBUG"), key)
|
||||
+}
|
||||
+
|
||||
+// get returns the value part of key=value in s (a GODEBUG value).
|
||||
+func get(s, key string) string {
|
||||
+ for i := 0; i < len(s)-len(key)-1; i++ {
|
||||
+ if i > 0 && s[i-1] != ',' {
|
||||
+ continue
|
||||
+ }
|
||||
+ afterKey := s[i+len(key):]
|
||||
+ if afterKey[0] != '=' || s[i:i+len(key)] != key {
|
||||
+ continue
|
||||
+ }
|
||||
+ val := afterKey[1:]
|
||||
+ for i, b := range val {
|
||||
+ if b == ',' {
|
||||
+ return val[:i]
|
||||
+ }
|
||||
+ }
|
||||
+ return val
|
||||
+ }
|
||||
+ return ""
|
||||
+}
|
||||
diff --git a/src/internal/godebug/godebug_test.go b/src/internal/godebug/godebug_test.go
|
||||
new file mode 100644
|
||||
index 0000000..41b9117
|
||||
--- /dev/null
|
||||
+++ b/src/internal/godebug/godebug_test.go
|
||||
@@ -0,0 +1,34 @@
|
||||
+// Copyright 2021 The Go Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style
|
||||
+// license that can be found in the LICENSE file.
|
||||
+
|
||||
+package godebug
|
||||
+
|
||||
+import "testing"
|
||||
+
|
||||
+func TestGet(t *testing.T) {
|
||||
+ tests := []struct {
|
||||
+ godebug string
|
||||
+ key string
|
||||
+ want string
|
||||
+ }{
|
||||
+ {"", "", ""},
|
||||
+ {"", "foo", ""},
|
||||
+ {"foo=bar", "foo", "bar"},
|
||||
+ {"foo=bar,after=x", "foo", "bar"},
|
||||
+ {"before=x,foo=bar,after=x", "foo", "bar"},
|
||||
+ {"before=x,foo=bar", "foo", "bar"},
|
||||
+ {",,,foo=bar,,,", "foo", "bar"},
|
||||
+ {"foodecoy=wrong,foo=bar", "foo", "bar"},
|
||||
+ {"foo=", "foo", ""},
|
||||
+ {"foo", "foo", ""},
|
||||
+ {",foo", "foo", ""},
|
||||
+ {"foo=bar,baz", "loooooooong", ""},
|
||||
+ }
|
||||
+ for _, tt := range tests {
|
||||
+ got := get(tt.godebug, tt.key)
|
||||
+ if got != tt.want {
|
||||
+ t.Errorf("get(%q, %q) = %q; want %q", tt.godebug, tt.key, got, tt.want)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
2.7.4
|
||||
196
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
Normal file
196
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-2.patch
Normal file
@@ -0,0 +1,196 @@
|
||||
From 6fc21505614f36178df0dad7034b6b8e3f7588d5 Mon Sep 17 00:00:00 2001
|
||||
From: empijei <robclap8@gmail.com>
|
||||
Date: Fri, 27 Mar 2020 19:27:55 +0100
|
||||
Subject: [PATCH 2/3] html/template,text/template: switch to Unicode escapes
|
||||
for JSON compatibility
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The existing implementation is not compatible with JSON
|
||||
escape as it uses hex escaping.
|
||||
Unicode escape, instead, is valid for both JSON and JS.
|
||||
This fix avoids creating a separate escaping context for
|
||||
scripts of type "application/ld+json" and it is more
|
||||
future-proof in case more JSON+JS contexts get added
|
||||
to the platform (e.g. import maps).
|
||||
|
||||
Fixes #33671
|
||||
Fixes #37634
|
||||
|
||||
Change-Id: Id6f6524b4abc52e81d9d744d46bbe5bf2e081543
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/226097
|
||||
Reviewed-by: Carl Johnson <me@carlmjohnson.net>
|
||||
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
|
||||
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
|
||||
TryBot-Result: Gobot Gobot <gobot@golang.org>
|
||||
|
||||
Dependency Patch #2
|
||||
|
||||
Upstream-Status: Backport from https://github.com/golang/go/commit/d4d298040d072ddacea0e0d6b55fb148fff18070
|
||||
CVE: CVE-2023-24538
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/html/template/js.go | 70 +++++++++++++++++++++++++++-------------------
|
||||
src/text/template/funcs.go | 8 +++---
|
||||
2 files changed, 46 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/src/html/template/js.go b/src/html/template/js.go
|
||||
index 0e91458..ea9c183 100644
|
||||
--- a/src/html/template/js.go
|
||||
+++ b/src/html/template/js.go
|
||||
@@ -163,7 +163,6 @@ func jsValEscaper(args ...interface{}) string {
|
||||
}
|
||||
// TODO: detect cycles before calling Marshal which loops infinitely on
|
||||
// cyclic data. This may be an unacceptable DoS risk.
|
||||
-
|
||||
b, err := json.Marshal(a)
|
||||
if err != nil {
|
||||
// Put a space before comment so that if it is flush against
|
||||
@@ -178,8 +177,8 @@ func jsValEscaper(args ...interface{}) string {
|
||||
// TODO: maybe post-process output to prevent it from containing
|
||||
// "<!--", "-->", "<![CDATA[", "]]>", or "</script"
|
||||
// in case custom marshalers produce output containing those.
|
||||
-
|
||||
- // TODO: Maybe abbreviate \u00ab to \xab to produce more compact output.
|
||||
+ // Note: Do not use \x escaping to save bytes because it is not JSON compatible and this escaper
|
||||
+ // supports ld+json content-type.
|
||||
if len(b) == 0 {
|
||||
// In, `x=y/{{.}}*z` a json.Marshaler that produces "" should
|
||||
// not cause the output `x=y/*z`.
|
||||
@@ -260,6 +259,8 @@ func replace(s string, replacementTable []string) string {
|
||||
r, w = utf8.DecodeRuneInString(s[i:])
|
||||
var repl string
|
||||
switch {
|
||||
+ case int(r) < len(lowUnicodeReplacementTable):
|
||||
+ repl = lowUnicodeReplacementTable[r]
|
||||
case int(r) < len(replacementTable) && replacementTable[r] != "":
|
||||
repl = replacementTable[r]
|
||||
case r == '\u2028':
|
||||
@@ -283,67 +284,80 @@ func replace(s string, replacementTable []string) string {
|
||||
return b.String()
|
||||
}
|
||||
|
||||
+var lowUnicodeReplacementTable = []string{
|
||||
+ 0: `\u0000`, 1: `\u0001`, 2: `\u0002`, 3: `\u0003`, 4: `\u0004`, 5: `\u0005`, 6: `\u0006`,
|
||||
+ '\a': `\u0007`,
|
||||
+ '\b': `\u0008`,
|
||||
+ '\t': `\t`,
|
||||
+ '\n': `\n`,
|
||||
+ '\v': `\u000b`, // "\v" == "v" on IE 6.
|
||||
+ '\f': `\f`,
|
||||
+ '\r': `\r`,
|
||||
+ 0xe: `\u000e`, 0xf: `\u000f`, 0x10: `\u0010`, 0x11: `\u0011`, 0x12: `\u0012`, 0x13: `\u0013`,
|
||||
+ 0x14: `\u0014`, 0x15: `\u0015`, 0x16: `\u0016`, 0x17: `\u0017`, 0x18: `\u0018`, 0x19: `\u0019`,
|
||||
+ 0x1a: `\u001a`, 0x1b: `\u001b`, 0x1c: `\u001c`, 0x1d: `\u001d`, 0x1e: `\u001e`, 0x1f: `\u001f`,
|
||||
+}
|
||||
+
|
||||
var jsStrReplacementTable = []string{
|
||||
- 0: `\0`,
|
||||
+ 0: `\u0000`,
|
||||
'\t': `\t`,
|
||||
'\n': `\n`,
|
||||
- '\v': `\x0b`, // "\v" == "v" on IE 6.
|
||||
+ '\v': `\u000b`, // "\v" == "v" on IE 6.
|
||||
'\f': `\f`,
|
||||
'\r': `\r`,
|
||||
// Encode HTML specials as hex so the output can be embedded
|
||||
// in HTML attributes without further encoding.
|
||||
- '"': `\x22`,
|
||||
- '&': `\x26`,
|
||||
- '\'': `\x27`,
|
||||
- '+': `\x2b`,
|
||||
+ '"': `\u0022`,
|
||||
+ '&': `\u0026`,
|
||||
+ '\'': `\u0027`,
|
||||
+ '+': `\u002b`,
|
||||
'/': `\/`,
|
||||
- '<': `\x3c`,
|
||||
- '>': `\x3e`,
|
||||
+ '<': `\u003c`,
|
||||
+ '>': `\u003e`,
|
||||
'\\': `\\`,
|
||||
}
|
||||
|
||||
// jsStrNormReplacementTable is like jsStrReplacementTable but does not
|
||||
// overencode existing escapes since this table has no entry for `\`.
|
||||
var jsStrNormReplacementTable = []string{
|
||||
- 0: `\0`,
|
||||
+ 0: `\u0000`,
|
||||
'\t': `\t`,
|
||||
'\n': `\n`,
|
||||
- '\v': `\x0b`, // "\v" == "v" on IE 6.
|
||||
+ '\v': `\u000b`, // "\v" == "v" on IE 6.
|
||||
'\f': `\f`,
|
||||
'\r': `\r`,
|
||||
// Encode HTML specials as hex so the output can be embedded
|
||||
// in HTML attributes without further encoding.
|
||||
- '"': `\x22`,
|
||||
- '&': `\x26`,
|
||||
- '\'': `\x27`,
|
||||
- '+': `\x2b`,
|
||||
+ '"': `\u0022`,
|
||||
+ '&': `\u0026`,
|
||||
+ '\'': `\u0027`,
|
||||
+ '+': `\u002b`,
|
||||
'/': `\/`,
|
||||
- '<': `\x3c`,
|
||||
- '>': `\x3e`,
|
||||
+ '<': `\u003c`,
|
||||
+ '>': `\u003e`,
|
||||
}
|
||||
-
|
||||
var jsRegexpReplacementTable = []string{
|
||||
- 0: `\0`,
|
||||
+ 0: `\u0000`,
|
||||
'\t': `\t`,
|
||||
'\n': `\n`,
|
||||
- '\v': `\x0b`, // "\v" == "v" on IE 6.
|
||||
+ '\v': `\u000b`, // "\v" == "v" on IE 6.
|
||||
'\f': `\f`,
|
||||
'\r': `\r`,
|
||||
// Encode HTML specials as hex so the output can be embedded
|
||||
// in HTML attributes without further encoding.
|
||||
- '"': `\x22`,
|
||||
+ '"': `\u0022`,
|
||||
'$': `\$`,
|
||||
- '&': `\x26`,
|
||||
- '\'': `\x27`,
|
||||
+ '&': `\u0026`,
|
||||
+ '\'': `\u0027`,
|
||||
'(': `\(`,
|
||||
')': `\)`,
|
||||
'*': `\*`,
|
||||
- '+': `\x2b`,
|
||||
+ '+': `\u002b`,
|
||||
'-': `\-`,
|
||||
'.': `\.`,
|
||||
'/': `\/`,
|
||||
- '<': `\x3c`,
|
||||
- '>': `\x3e`,
|
||||
+ '<': `\u003c`,
|
||||
+ '>': `\u003e`,
|
||||
'?': `\?`,
|
||||
'[': `\[`,
|
||||
'\\': `\\`,
|
||||
diff --git a/src/text/template/funcs.go b/src/text/template/funcs.go
|
||||
index 46125bc..f3de9fb 100644
|
||||
--- a/src/text/template/funcs.go
|
||||
+++ b/src/text/template/funcs.go
|
||||
@@ -640,10 +640,10 @@ var (
|
||||
jsBackslash = []byte(`\\`)
|
||||
jsApos = []byte(`\'`)
|
||||
jsQuot = []byte(`\"`)
|
||||
- jsLt = []byte(`\x3C`)
|
||||
- jsGt = []byte(`\x3E`)
|
||||
- jsAmp = []byte(`\x26`)
|
||||
- jsEq = []byte(`\x3D`)
|
||||
+ jsLt = []byte(`\u003C`)
|
||||
+ jsGt = []byte(`\u003E`)
|
||||
+ jsAmp = []byte(`\u0026`)
|
||||
+ jsEq = []byte(`\u003D`)
|
||||
)
|
||||
|
||||
// JSEscape writes to w the escaped JavaScript equivalent of the plain text data b.
|
||||
--
|
||||
2.7.4
|
||||
208
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch
Normal file
208
meta/recipes-devtools/go/go-1.14/CVE-2023-24538-3.patch
Normal file
@@ -0,0 +1,208 @@
|
||||
From 16f4882984569f179d73967c9eee679bb9b098c5 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Mon, 20 Mar 2023 11:01:13 -0700
|
||||
Subject: [PATCH 3/3] html/template: disallow actions in JS template literals
|
||||
|
||||
ECMAScript 6 introduced template literals[0][1] which are delimited with
|
||||
backticks. These need to be escaped in a similar fashion to the
|
||||
delimiters for other string literals. Additionally template literals can
|
||||
contain special syntax for string interpolation.
|
||||
|
||||
There is no clear way to allow safe insertion of actions within JS
|
||||
template literals, as handling (JS) string interpolation inside of these
|
||||
literals is rather complex. As such we've chosen to simply disallow
|
||||
template actions within these template literals.
|
||||
|
||||
A new error code is added for this parsing failure case, errJsTmplLit,
|
||||
but it is unexported as it is not backwards compatible with other minor
|
||||
release versions to introduce an API change in a minor release. We will
|
||||
export this code in the next major release.
|
||||
|
||||
The previous behavior (with the cavet that backticks are now escaped
|
||||
properly) can be re-enabled with GODEBUG=jstmpllitinterp=1.
|
||||
|
||||
This change subsumes CL471455.
|
||||
|
||||
Thanks to Sohom Datta, Manipal Institute of Technology, for reporting
|
||||
this issue.
|
||||
|
||||
Fixes CVE-2023-24538
|
||||
For #59234
|
||||
Fixes #59271
|
||||
|
||||
[0] https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#sec-template-literals
|
||||
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
|
||||
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802457
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802612
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Change-Id: Ic7f10595615f2b2740d9c85ad7ef40dc0e78c04c
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/481987
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Run-TryBot: Michael Knyszek <mknyszek@google.com>
|
||||
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
||||
|
||||
Upstream-Status: Backport from https://github.com/golang/go/commit/b1e3ecfa06b67014429a197ec5e134ce4303ad9b
|
||||
CVE: CVE-2023-24538
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/html/template/context.go | 2 ++
|
||||
src/html/template/error.go | 13 +++++++++++++
|
||||
src/html/template/escape.go | 11 +++++++++++
|
||||
src/html/template/js.go | 2 ++
|
||||
src/html/template/jsctx_string.go | 9 +++++++++
|
||||
src/html/template/transition.go | 7 ++++++-
|
||||
6 files changed, 43 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/html/template/context.go b/src/html/template/context.go
|
||||
index f7d4849..0b65313 100644
|
||||
--- a/src/html/template/context.go
|
||||
+++ b/src/html/template/context.go
|
||||
@@ -116,6 +116,8 @@ const (
|
||||
stateJSDqStr
|
||||
// stateJSSqStr occurs inside a JavaScript single quoted string.
|
||||
stateJSSqStr
|
||||
+ // stateJSBqStr occurs inside a JavaScript back quoted string.
|
||||
+ stateJSBqStr
|
||||
// stateJSRegexp occurs inside a JavaScript regexp literal.
|
||||
stateJSRegexp
|
||||
// stateJSBlockCmt occurs inside a JavaScript /* block comment */.
|
||||
diff --git a/src/html/template/error.go b/src/html/template/error.go
|
||||
index 0e52706..fd26b64 100644
|
||||
--- a/src/html/template/error.go
|
||||
+++ b/src/html/template/error.go
|
||||
@@ -211,6 +211,19 @@ const (
|
||||
// pipeline occurs in an unquoted attribute value context, "html" is
|
||||
// disallowed. Avoid using "html" and "urlquery" entirely in new templates.
|
||||
ErrPredefinedEscaper
|
||||
+
|
||||
+ // errJSTmplLit: "... appears in a JS template literal"
|
||||
+ // Example:
|
||||
+ // <script>var tmpl = `{{.Interp}`</script>
|
||||
+ // Discussion:
|
||||
+ // Package html/template does not support actions inside of JS template
|
||||
+ // literals.
|
||||
+ //
|
||||
+ // TODO(rolandshoemaker): we cannot add this as an exported error in a minor
|
||||
+ // release, since it is backwards incompatible with the other minor
|
||||
+ // releases. As such we need to leave it unexported, and then we'll add it
|
||||
+ // in the next major release.
|
||||
+ errJSTmplLit
|
||||
)
|
||||
|
||||
func (e *Error) Error() string {
|
||||
diff --git a/src/html/template/escape.go b/src/html/template/escape.go
|
||||
index f12dafa..29ca5b3 100644
|
||||
--- a/src/html/template/escape.go
|
||||
+++ b/src/html/template/escape.go
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html"
|
||||
+ "internal/godebug"
|
||||
"io"
|
||||
"text/template"
|
||||
"text/template/parse"
|
||||
@@ -203,6 +204,16 @@ func (e *escaper) escapeAction(c context, n *parse.ActionNode) context {
|
||||
c.jsCtx = jsCtxDivOp
|
||||
case stateJSDqStr, stateJSSqStr:
|
||||
s = append(s, "_html_template_jsstrescaper")
|
||||
+ case stateJSBqStr:
|
||||
+ debugAllowActionJSTmpl := godebug.Get("jstmpllitinterp")
|
||||
+ if debugAllowActionJSTmpl == "1" {
|
||||
+ s = append(s, "_html_template_jsstrescaper")
|
||||
+ } else {
|
||||
+ return context{
|
||||
+ state: stateError,
|
||||
+ err: errorf(errJSTmplLit, n, n.Line, "%s appears in a JS template literal", n),
|
||||
+ }
|
||||
+ }
|
||||
case stateJSRegexp:
|
||||
s = append(s, "_html_template_jsregexpescaper")
|
||||
case stateCSS:
|
||||
diff --git a/src/html/template/js.go b/src/html/template/js.go
|
||||
index ea9c183..b888eaf 100644
|
||||
--- a/src/html/template/js.go
|
||||
+++ b/src/html/template/js.go
|
||||
@@ -308,6 +308,7 @@ var jsStrReplacementTable = []string{
|
||||
// Encode HTML specials as hex so the output can be embedded
|
||||
// in HTML attributes without further encoding.
|
||||
'"': `\u0022`,
|
||||
+ '`': `\u0060`,
|
||||
'&': `\u0026`,
|
||||
'\'': `\u0027`,
|
||||
'+': `\u002b`,
|
||||
@@ -331,6 +332,7 @@ var jsStrNormReplacementTable = []string{
|
||||
'"': `\u0022`,
|
||||
'&': `\u0026`,
|
||||
'\'': `\u0027`,
|
||||
+ '`': `\u0060`,
|
||||
'+': `\u002b`,
|
||||
'/': `\/`,
|
||||
'<': `\u003c`,
|
||||
diff --git a/src/html/template/jsctx_string.go b/src/html/template/jsctx_string.go
|
||||
index dd1d87e..2394893 100644
|
||||
--- a/src/html/template/jsctx_string.go
|
||||
+++ b/src/html/template/jsctx_string.go
|
||||
@@ -4,6 +4,15 @@ package template
|
||||
|
||||
import "strconv"
|
||||
|
||||
+func _() {
|
||||
+ // An "invalid array index" compiler error signifies that the constant values have changed.
|
||||
+ // Re-run the stringer command to generate them again.
|
||||
+ var x [1]struct{}
|
||||
+ _ = x[jsCtxRegexp-0]
|
||||
+ _ = x[jsCtxDivOp-1]
|
||||
+ _ = x[jsCtxUnknown-2]
|
||||
+}
|
||||
+
|
||||
const _jsCtx_name = "jsCtxRegexpjsCtxDivOpjsCtxUnknown"
|
||||
|
||||
var _jsCtx_index = [...]uint8{0, 11, 21, 33}
|
||||
diff --git a/src/html/template/transition.go b/src/html/template/transition.go
|
||||
index 06df679..92eb351 100644
|
||||
--- a/src/html/template/transition.go
|
||||
+++ b/src/html/template/transition.go
|
||||
@@ -27,6 +27,7 @@ var transitionFunc = [...]func(context, []byte) (context, int){
|
||||
stateJS: tJS,
|
||||
stateJSDqStr: tJSDelimited,
|
||||
stateJSSqStr: tJSDelimited,
|
||||
+ stateJSBqStr: tJSDelimited,
|
||||
stateJSRegexp: tJSDelimited,
|
||||
stateJSBlockCmt: tBlockCmt,
|
||||
stateJSLineCmt: tLineCmt,
|
||||
@@ -262,7 +263,7 @@ func tURL(c context, s []byte) (context, int) {
|
||||
|
||||
// tJS is the context transition function for the JS state.
|
||||
func tJS(c context, s []byte) (context, int) {
|
||||
- i := bytes.IndexAny(s, `"'/`)
|
||||
+ i := bytes.IndexAny(s, "\"`'/")
|
||||
if i == -1 {
|
||||
// Entire input is non string, comment, regexp tokens.
|
||||
c.jsCtx = nextJSCtx(s, c.jsCtx)
|
||||
@@ -274,6 +275,8 @@ func tJS(c context, s []byte) (context, int) {
|
||||
c.state, c.jsCtx = stateJSDqStr, jsCtxRegexp
|
||||
case '\'':
|
||||
c.state, c.jsCtx = stateJSSqStr, jsCtxRegexp
|
||||
+ case '`':
|
||||
+ c.state, c.jsCtx = stateJSBqStr, jsCtxRegexp
|
||||
case '/':
|
||||
switch {
|
||||
case i+1 < len(s) && s[i+1] == '/':
|
||||
@@ -303,6 +306,8 @@ func tJSDelimited(c context, s []byte) (context, int) {
|
||||
switch c.state {
|
||||
case stateJSSqStr:
|
||||
specials = `\'`
|
||||
+ case stateJSBqStr:
|
||||
+ specials = "`\\"
|
||||
case stateJSRegexp:
|
||||
specials = `\/[]`
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
60
meta/recipes-devtools/go/go-1.14/CVE-2023-24539.patch
Normal file
60
meta/recipes-devtools/go/go-1.14/CVE-2023-24539.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
From 8673ca81e5340b87709db2d9749c92a3bf925df1 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Thu, 13 Apr 2023 15:40:44 -0700
|
||||
Subject: [PATCH] html/template: disallow angle brackets in CSS values
|
||||
|
||||
Angle brackets should not appear in CSS contexts, as they may affect
|
||||
token boundaries (such as closing a <style> tag, resulting in
|
||||
injection). Instead emit filterFailsafe, matching the behavior for other
|
||||
dangerous characters.
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Fixes #59720
|
||||
Fixes CVE-2023-24539
|
||||
|
||||
Change-Id: Iccc659c9a18415992b0c05c178792228e3a7bae4
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1826636
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/491615
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
Run-TryBot: Carlos Amedee <carlos@golang.org>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/golang/go/commit/8673ca81e5340b87709db2d9749c92a3bf925df1]
|
||||
CVE: CVE-2023-24539
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
---
|
||||
src/html/template/css.go | 2 +-
|
||||
src/html/template/css_test.go | 2 ++
|
||||
2 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/html/template/css.go b/src/html/template/css.go
|
||||
index 890a0c6b227fe..f650d8b3e843a 100644
|
||||
--- a/src/html/template/css.go
|
||||
+++ b/src/html/template/css.go
|
||||
@@ -238,7 +238,7 @@ func cssValueFilter(args ...any) string {
|
||||
// inside a string that might embed JavaScript source.
|
||||
for i, c := range b {
|
||||
switch c {
|
||||
- case 0, '"', '\'', '(', ')', '/', ';', '@', '[', '\\', ']', '`', '{', '}':
|
||||
+ case 0, '"', '\'', '(', ')', '/', ';', '@', '[', '\\', ']', '`', '{', '}', '<', '>':
|
||||
return filterFailsafe
|
||||
case '-':
|
||||
// Disallow <!-- or -->.
|
||||
diff --git a/src/html/template/css_test.go b/src/html/template/css_test.go
|
||||
index a735638b0314f..2b76256a766e9 100644
|
||||
--- a/src/html/template/css_test.go
|
||||
+++ b/src/html/template/css_test.go
|
||||
@@ -231,6 +231,8 @@ func TestCSSValueFilter(t *testing.T) {
|
||||
{`-exp\000052 ession(alert(1337))`, "ZgotmplZ"},
|
||||
{`-expre\0000073sion`, "-expre\x073sion"},
|
||||
{`@import url evil.css`, "ZgotmplZ"},
|
||||
+ {"<", "ZgotmplZ"},
|
||||
+ {">", "ZgotmplZ"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
got := cssValueFilter(test.css)
|
||||
90
meta/recipes-devtools/go/go-1.14/CVE-2023-24540.patch
Normal file
90
meta/recipes-devtools/go/go-1.14/CVE-2023-24540.patch
Normal file
@@ -0,0 +1,90 @@
|
||||
From ce7bd33345416e6d8cac901792060591cafc2797 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Tue, 11 Apr 2023 16:27:43 +0100
|
||||
Subject: [PATCH] [release-branch.go1.19] html/template: handle all JS
|
||||
whitespace characters
|
||||
|
||||
Rather than just a small set. Character class as defined by \s [0].
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this.
|
||||
|
||||
For #59721
|
||||
Fixes #59813
|
||||
Fixes CVE-2023-24540
|
||||
|
||||
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes
|
||||
|
||||
Change-Id: I56d4fa1ef08125b417106ee7dbfb5b0923b901ba
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1821459
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1851497
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/491355
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
Reviewed-by: Carlos Amedee <carlos@golang.org>
|
||||
TryBot-Bypass: Carlos Amedee <carlos@golang.org>
|
||||
Run-TryBot: Carlos Amedee <carlos@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/ce7bd33345416e6d8cac901792060591cafc2797]
|
||||
CVE: CVE-2023-24540
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
src/html/template/js.go | 8 +++++++-
|
||||
src/html/template/js_test.go | 11 +++++++----
|
||||
2 files changed, 14 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/html/template/js.go b/src/html/template/js.go
|
||||
index fe7054efe5cd8..4e05c1455723f 100644
|
||||
--- a/src/html/template/js.go
|
||||
+++ b/src/html/template/js.go
|
||||
@@ -13,6 +13,11 @@ import (
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
+// jsWhitespace contains all of the JS whitespace characters, as defined
|
||||
+// by the \s character class.
|
||||
+// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes.
|
||||
+const jsWhitespace = "\f\n\r\t\v\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff"
|
||||
+
|
||||
// nextJSCtx returns the context that determines whether a slash after the
|
||||
// given run of tokens starts a regular expression instead of a division
|
||||
// operator: / or /=.
|
||||
@@ -26,7 +31,8 @@ import (
|
||||
// JavaScript 2.0 lexical grammar and requires one token of lookbehind:
|
||||
// https://www.mozilla.org/js/language/js20-2000-07/rationale/syntax.html
|
||||
func nextJSCtx(s []byte, preceding jsCtx) jsCtx {
|
||||
- s = bytes.TrimRight(s, "\t\n\f\r \u2028\u2029")
|
||||
+ // Trim all JS whitespace characters
|
||||
+ s = bytes.TrimRight(s, jsWhitespace)
|
||||
if len(s) == 0 {
|
||||
return preceding
|
||||
}
|
||||
diff --git a/src/html/template/js_test.go b/src/html/template/js_test.go
|
||||
index e07c695f7a77d..e52180cc113b5 100644
|
||||
--- a/src/html/template/js_test.go
|
||||
+++ b/src/html/template/js_test.go
|
||||
@@ -81,14 +81,17 @@ func TestNextJsCtx(t *testing.T) {
|
||||
{jsCtxDivOp, "0"},
|
||||
// Dots that are part of a number are div preceders.
|
||||
{jsCtxDivOp, "0."},
|
||||
+ // Some JS interpreters treat NBSP as a normal space, so
|
||||
+ // we must too in order to properly escape things.
|
||||
+ {jsCtxRegexp, "=\u00A0"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
- if nextJSCtx([]byte(test.s), jsCtxRegexp) != test.jsCtx {
|
||||
- t.Errorf("want %s got %q", test.jsCtx, test.s)
|
||||
+ if ctx := nextJSCtx([]byte(test.s), jsCtxRegexp); ctx != test.jsCtx {
|
||||
+ t.Errorf("%q: want %s got %s", test.s, test.jsCtx, ctx)
|
||||
}
|
||||
- if nextJSCtx([]byte(test.s), jsCtxDivOp) != test.jsCtx {
|
||||
- t.Errorf("want %s got %q", test.jsCtx, test.s)
|
||||
+ if ctx := nextJSCtx([]byte(test.s), jsCtxDivOp); ctx != test.jsCtx {
|
||||
+ t.Errorf("%q: want %s got %s", test.s, test.jsCtx, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
94
meta/recipes-devtools/go/go-1.14/CVE-2023-29400.patch
Normal file
94
meta/recipes-devtools/go/go-1.14/CVE-2023-29400.patch
Normal file
@@ -0,0 +1,94 @@
|
||||
From 0d347544cbca0f42b160424f6bc2458ebcc7b3fc Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Thu, 13 Apr 2023 14:01:50 -0700
|
||||
Subject: [PATCH] html/template: emit filterFailsafe for empty unquoted attr
|
||||
value
|
||||
|
||||
An unquoted action used as an attribute value can result in unsafe
|
||||
behavior if it is empty, as HTML normalization will result in unexpected
|
||||
attributes, and may allow attribute injection. If executing a template
|
||||
results in a empty unquoted attribute value, emit filterFailsafe
|
||||
instead.
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Fixes #59722
|
||||
Fixes CVE-2023-29400
|
||||
|
||||
Change-Id: Ia38d1b536ae2b4af5323a6c6d861e3c057c2570a
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1826631
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/491617
|
||||
Run-TryBot: Carlos Amedee <carlos@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport from [https://github.com/golang/go/commit/0d347544cbca0f42b160424f6bc2458ebcc7b3fc]
|
||||
CVE: CVE-2023-29400
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
---
|
||||
src/html/template/escape.go | 5 ++---
|
||||
src/html/template/escape_test.go | 15 +++++++++++++++
|
||||
src/html/template/html.go | 3 +++
|
||||
3 files changed, 20 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/html/template/escape.go b/src/html/template/escape.go
|
||||
index 4ba1d6b31897e..a62ef159f0dcd 100644
|
||||
--- a/src/html/template/escape.go
|
||||
+++ b/src/html/template/escape.go
|
||||
@@ -382,9 +382,8 @@ func normalizeEscFn(e string) string {
|
||||
// for all x.
|
||||
var redundantFuncs = map[string]map[string]bool{
|
||||
"_html_template_commentescaper": {
|
||||
- "_html_template_attrescaper": true,
|
||||
- "_html_template_nospaceescaper": true,
|
||||
- "_html_template_htmlescaper": true,
|
||||
+ "_html_template_attrescaper": true,
|
||||
+ "_html_template_htmlescaper": true,
|
||||
},
|
||||
"_html_template_cssescaper": {
|
||||
"_html_template_attrescaper": true,
|
||||
diff --git a/src/html/template/escape_test.go b/src/html/template/escape_test.go
|
||||
index 3dd212bac9406..f8b2b448f2dfa 100644
|
||||
--- a/src/html/template/escape_test.go
|
||||
+++ b/src/html/template/escape_test.go
|
||||
@@ -678,6 +678,21 @@ func TestEscape(t *testing.T) {
|
||||
`<img srcset={{",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"}}>`,
|
||||
`<img srcset=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,>`,
|
||||
},
|
||||
+ {
|
||||
+ "unquoted empty attribute value (plaintext)",
|
||||
+ "<p name={{.U}}>",
|
||||
+ "<p name=ZgotmplZ>",
|
||||
+ },
|
||||
+ {
|
||||
+ "unquoted empty attribute value (url)",
|
||||
+ "<p href={{.U}}>",
|
||||
+ "<p href=ZgotmplZ>",
|
||||
+ },
|
||||
+ {
|
||||
+ "quoted empty attribute value",
|
||||
+ "<p name=\"{{.U}}\">",
|
||||
+ "<p name=\"\">",
|
||||
+ },
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
diff --git a/src/html/template/html.go b/src/html/template/html.go
|
||||
index bcca0b51a0ef9..a181699a5bda8 100644
|
||||
--- a/src/html/template/html.go
|
||||
+++ b/src/html/template/html.go
|
||||
@@ -14,6 +14,9 @@ import (
|
||||
// htmlNospaceEscaper escapes for inclusion in unquoted attribute values.
|
||||
func htmlNospaceEscaper(args ...interface{}) string {
|
||||
s, t := stringify(args...)
|
||||
+ if s == "" {
|
||||
+ return filterFailsafe
|
||||
+ }
|
||||
if t == contentTypeHTML {
|
||||
return htmlReplacer(stripTags(s), htmlNospaceNormReplacementTable, false)
|
||||
}
|
||||
|
||||
201
meta/recipes-devtools/go/go-1.14/CVE-2023-29402.patch
Normal file
201
meta/recipes-devtools/go/go-1.14/CVE-2023-29402.patch
Normal file
@@ -0,0 +1,201 @@
|
||||
rom c160b49b6d328c86bd76ca2fff9009a71347333f Mon Sep 17 00:00:00 2001
|
||||
From: "Bryan C. Mills" <bcmills@google.com>
|
||||
Date: Fri, 12 May 2023 14:15:16 -0400
|
||||
Subject: [PATCH] [release-branch.go1.19] cmd/go: disallow package directories
|
||||
containing newlines
|
||||
|
||||
Directory or file paths containing newlines may cause tools (such as
|
||||
cmd/cgo) that emit "//line" or "#line" -directives to write part of
|
||||
the path into non-comment lines in generated source code. If those
|
||||
lines contain valid Go code, it may be injected into the resulting
|
||||
binary.
|
||||
|
||||
(Note that Go import paths and file paths within module zip files
|
||||
already could not contain newlines.)
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Updates #60167.
|
||||
Fixes #60515.
|
||||
Fixes CVE-2023-29402.
|
||||
|
||||
Change-Id: If55d0400c02beb7a5da5eceac60f1abeac99f064
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1882606
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Russ Cox <rsc@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
(cherry picked from commit 41f9046495564fc728d6f98384ab7276450ac7e2)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1902229
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1904343
|
||||
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
||||
Reviewed-by: Bryan Mills <bcmills@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/501218
|
||||
Run-TryBot: David Chase <drchase@google.com>
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/c160b49b6d328c86bd76ca2fff9009a71347333f]
|
||||
CVE: CVE-2023-29402
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/cmd/go/internal/load/pkg.go | 4 +
|
||||
src/cmd/go/internal/work/exec.go | 6 ++
|
||||
src/cmd/go/script_test.go | 1 +
|
||||
.../go/testdata/script/build_cwd_newline.txt | 100 ++++++++++++++++++
|
||||
4 files changed, 111 insertions(+)
|
||||
create mode 100644 src/cmd/go/testdata/script/build_cwd_newline.txt
|
||||
|
||||
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
|
||||
index 369a79b..d2b63b0 100644
|
||||
--- a/src/cmd/go/internal/load/pkg.go
|
||||
+++ b/src/cmd/go/internal/load/pkg.go
|
||||
@@ -1697,6 +1697,10 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) {
|
||||
setError(ImportErrorf(p.ImportPath, "invalid import path %q", p.ImportPath))
|
||||
return
|
||||
}
|
||||
+ if strings.ContainsAny(p.Dir, "\r\n") {
|
||||
+ setError(fmt.Errorf("invalid package directory %q", p.Dir))
|
||||
+ return
|
||||
+ }
|
||||
|
||||
// Build list of imported packages and full dependency list.
|
||||
imports := make([]*Package, 0, len(p.Imports))
|
||||
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
|
||||
index 9a9650b..050b785 100644
|
||||
--- a/src/cmd/go/internal/work/exec.go
|
||||
+++ b/src/cmd/go/internal/work/exec.go
|
||||
@@ -458,6 +458,12 @@ func (b *Builder) build(a *Action) (err error) {
|
||||
b.Print(a.Package.ImportPath + "\n")
|
||||
}
|
||||
|
||||
+ if p.Error != nil {
|
||||
+ // Don't try to build anything for packages with errors. There may be a
|
||||
+ // problem with the inputs that makes the package unsafe to build.
|
||||
+ return p.Error
|
||||
+ }
|
||||
+
|
||||
if a.Package.BinaryOnly {
|
||||
p.Stale = true
|
||||
p.StaleReason = "binary-only packages are no longer supported"
|
||||
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
|
||||
index ec498bb..a1398ad 100644
|
||||
--- a/src/cmd/go/script_test.go
|
||||
+++ b/src/cmd/go/script_test.go
|
||||
@@ -123,6 +123,7 @@ func (ts *testScript) setup() {
|
||||
"devnull=" + os.DevNull,
|
||||
"goversion=" + goVersion(ts),
|
||||
":=" + string(os.PathListSeparator),
|
||||
+ "newline=\n",
|
||||
}
|
||||
|
||||
if runtime.GOOS == "plan9" {
|
||||
diff --git a/src/cmd/go/testdata/script/build_cwd_newline.txt b/src/cmd/go/testdata/script/build_cwd_newline.txt
|
||||
new file mode 100644
|
||||
index 0000000..61c6966
|
||||
--- /dev/null
|
||||
+++ b/src/cmd/go/testdata/script/build_cwd_newline.txt
|
||||
@@ -0,0 +1,100 @@
|
||||
+[windows] skip 'filesystem normalizes / to \'
|
||||
+[plan9] skip 'filesystem disallows \n in paths'
|
||||
+
|
||||
+# If the directory path containing a package to be built includes a newline,
|
||||
+# the go command should refuse to even try to build the package.
|
||||
+
|
||||
+env DIR=$WORK${/}${newline}'package main'${newline}'func main() { panic("uh-oh")'${newline}'/*'
|
||||
+
|
||||
+mkdir $DIR
|
||||
+cd $DIR
|
||||
+exec pwd
|
||||
+cp $WORK/go.mod ./go.mod
|
||||
+cp $WORK/main.go ./main.go
|
||||
+cp $WORK/main_test.go ./main_test.go
|
||||
+
|
||||
+! go build -o $devnull .
|
||||
+stderr 'package example: invalid package directory .*uh-oh'
|
||||
+
|
||||
+! go build -o $devnull main.go
|
||||
+stderr 'package command-line-arguments: invalid package directory .*uh-oh'
|
||||
+
|
||||
+! go run .
|
||||
+stderr 'package example: invalid package directory .*uh-oh'
|
||||
+
|
||||
+! go run main.go
|
||||
+stderr 'package command-line-arguments: invalid package directory .*uh-oh'
|
||||
+
|
||||
+! go test .
|
||||
+stderr 'package example: invalid package directory .*uh-oh'
|
||||
+
|
||||
+! go test -v main.go main_test.go
|
||||
+stderr 'package command-line-arguments: invalid package directory .*uh-oh'
|
||||
+
|
||||
+
|
||||
+# Since we do preserve $PWD (or set it appropriately) for commands, and we do
|
||||
+# not resolve symlinks unnecessarily, referring to the contents of the unsafe
|
||||
+# directory via a safe symlink should be ok, and should not inject the data from
|
||||
+# the symlink target path.
|
||||
+
|
||||
+[!symlink] stop 'remainder of test checks symlink behavior'
|
||||
+[short] stop 'links and runs binaries'
|
||||
+
|
||||
+symlink $WORK${/}link -> $DIR
|
||||
+
|
||||
+go run $WORK${/}link${/}main.go
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stderr '^ok$'
|
||||
+
|
||||
+go test -v $WORK${/}link${/}main.go $WORK${/}link${/}main_test.go
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stdout '^ok$' # 'go test' combines the test's stdout into stderr
|
||||
+
|
||||
+cd $WORK/link
|
||||
+
|
||||
+! go run $DIR${/}main.go
|
||||
+stderr 'package command-line-arguments: invalid package directory .*uh-oh'
|
||||
+
|
||||
+go run .
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stderr '^ok$'
|
||||
+
|
||||
+go run main.go
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stderr '^ok$'
|
||||
+
|
||||
+go test -v
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stdout '^ok$' # 'go test' combines the test's stdout into stderr
|
||||
+
|
||||
+go test -v .
|
||||
+! stdout panic
|
||||
+! stderr panic
|
||||
+stdout '^ok$' # 'go test' combines the test's stdout into stderr
|
||||
+
|
||||
+
|
||||
+-- $WORK/go.mod --
|
||||
+module example
|
||||
+go 1.19
|
||||
+-- $WORK/main.go --
|
||||
+package main
|
||||
+
|
||||
+import "C"
|
||||
+
|
||||
+func main() {
|
||||
+ /* nothing here */
|
||||
+ println("ok")
|
||||
+}
|
||||
+-- $WORK/main_test.go --
|
||||
+package main
|
||||
+
|
||||
+import "testing"
|
||||
+
|
||||
+func TestMain(*testing.M) {
|
||||
+ main()
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
84
meta/recipes-devtools/go/go-1.14/CVE-2023-29404.patch
Normal file
84
meta/recipes-devtools/go/go-1.14/CVE-2023-29404.patch
Normal file
@@ -0,0 +1,84 @@
|
||||
From bf3c8ce03e175e870763901a3850bca01381a828 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Fri, 5 May 2023 13:10:34 -0700
|
||||
Subject: [PATCH] [release-branch.go1.19] cmd/go: enforce flags with
|
||||
non-optional arguments
|
||||
|
||||
Enforce that linker flags which expect arguments get them, otherwise it
|
||||
may be possible to smuggle unexpected flags through as the linker can
|
||||
consume what looks like a flag as an argument to a preceding flag (i.e.
|
||||
"-Wl,-O -Wl,-R,-bad-flag" is interpreted as "-O=-R -bad-flag"). Also be
|
||||
somewhat more restrictive in the general format of some flags.
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Updates #60305
|
||||
Fixes #60511
|
||||
Fixes CVE-2023-29404
|
||||
|
||||
Change-Id: Icdffef2c0f644da50261cace6f43742783931cff
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1876275
|
||||
Reviewed-by: Ian Lance Taylor <iant@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
(cherry picked from commit 896779503cf754cbdac24b61d4cc953b50fe2dde)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1902225
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1904342
|
||||
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/501217
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
Run-TryBot: David Chase <drchase@google.com>
|
||||
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/bf3c8ce03e175e870763901a3850bca01381a828]
|
||||
CVE: CVE-2023-29404
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
src/cmd/go/internal/work/security.go | 6 +++---
|
||||
src/cmd/go/internal/work/security_test.go | 5 +++++
|
||||
2 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/cmd/go/internal/work/security.go b/src/cmd/go/internal/work/security.go
|
||||
index a823b20..8acb6dc 100644
|
||||
--- a/src/cmd/go/internal/work/security.go
|
||||
+++ b/src/cmd/go/internal/work/security.go
|
||||
@@ -177,17 +177,17 @@ var validLinkerFlags = []*lazyregexp.Regexp{
|
||||
re(`-Wl,-Bdynamic`),
|
||||
re(`-Wl,-berok`),
|
||||
re(`-Wl,-Bstatic`),
|
||||
- re(`-WL,-O([^@,\-][^,]*)?`),
|
||||
+ re(`-Wl,-O[0-9]+`),
|
||||
re(`-Wl,-d[ny]`),
|
||||
re(`-Wl,--disable-new-dtags`),
|
||||
- re(`-Wl,-e[=,][a-zA-Z0-9]*`),
|
||||
+ re(`-Wl,-e[=,][a-zA-Z0-9]+`),
|
||||
re(`-Wl,--enable-new-dtags`),
|
||||
re(`-Wl,--end-group`),
|
||||
re(`-Wl,--(no-)?export-dynamic`),
|
||||
re(`-Wl,-framework,[^,@\-][^,]+`),
|
||||
re(`-Wl,-headerpad_max_install_names`),
|
||||
re(`-Wl,--no-undefined`),
|
||||
- re(`-Wl,-R([^@\-][^,@]*$)`),
|
||||
+ re(`-Wl,-R,?([^@\-,][^,@]*$)`),
|
||||
re(`-Wl,--just-symbols[=,]([^,@\-][^,@]+)`),
|
||||
re(`-Wl,-rpath(-link)?[=,]([^,@\-][^,]+)`),
|
||||
re(`-Wl,-s`),
|
||||
diff --git a/src/cmd/go/internal/work/security_test.go b/src/cmd/go/internal/work/security_test.go
|
||||
index bd707ff..7b0b7d3 100644
|
||||
--- a/src/cmd/go/internal/work/security_test.go
|
||||
+++ b/src/cmd/go/internal/work/security_test.go
|
||||
@@ -220,6 +220,11 @@ var badLinkerFlags = [][]string{
|
||||
{"-Wl,-R,@foo"},
|
||||
{"-Wl,--just-symbols,@foo"},
|
||||
{"../x.o"},
|
||||
+ {"-Wl,-R,"},
|
||||
+ {"-Wl,-O"},
|
||||
+ {"-Wl,-e="},
|
||||
+ {"-Wl,-e,"},
|
||||
+ {"-Wl,-R,-flag"},
|
||||
}
|
||||
|
||||
func TestCheckLinkerFlags(t *testing.T) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
112
meta/recipes-devtools/go/go-1.14/CVE-2023-29405-1.patch
Normal file
112
meta/recipes-devtools/go/go-1.14/CVE-2023-29405-1.patch
Normal file
@@ -0,0 +1,112 @@
|
||||
From fa60c381ed06c12f9c27a7b50ca44c5f84f7f0f4 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Thu, 4 May 2023 14:06:39 -0700
|
||||
Subject: [PATCH] [release-branch.go1.20] cmd/go,cmd/cgo: in _cgo_flags use one
|
||||
line per flag
|
||||
|
||||
The flags that we recorded in _cgo_flags did not use any quoting,
|
||||
so a flag containing embedded spaces was mishandled.
|
||||
Change the _cgo_flags format to put each flag on a separate line.
|
||||
That is a simple format that does not require any quoting.
|
||||
|
||||
As far as I can tell only cmd/go uses _cgo_flags, and it is only
|
||||
used for gccgo. If this patch doesn't cause any trouble, then
|
||||
in the next release we can change to only using _cgo_flags for gccgo.
|
||||
|
||||
Thanks to Juho Nurminen of Mattermost for reporting this issue.
|
||||
|
||||
Updates #60306
|
||||
Fixes #60514
|
||||
Fixes CVE-2023-29405
|
||||
|
||||
Change-Id: I36b6e188a44c80d7b9573efa577c386770bd2ba3
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1875094
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
(cherry picked from commit bcdfcadd5612212089d958bc352a6f6c90742dcc)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1902228
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1904345
|
||||
Reviewed-by: Michael Knyszek <mknyszek@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/501220
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Run-TryBot: David Chase <drchase@google.com>
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
---
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/fa60c381ed06c12f9c27a7b50ca44c5f84f7f0f4]
|
||||
CVE: CVE-2023-29405
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
src/cmd/cgo/out.go | 4 +++-
|
||||
src/cmd/go/internal/work/gccgo.go | 14 ++++++-------
|
||||
.../go/testdata/script/gccgo_link_ldflags.txt | 20 +++++++++++++++++++
|
||||
3 files changed, 29 insertions(+), 9 deletions(-)
|
||||
create mode 100644 src/cmd/go/testdata/script/gccgo_link_ldflags.txt
|
||||
|
||||
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
|
||||
index d26f9e76a374a..d0c6fe3d4c2c2 100644
|
||||
--- a/src/cmd/cgo/out.go
|
||||
+++ b/src/cmd/cgo/out.go
|
||||
@@ -47,7 +47,9 @@ func (p *Package) writeDefs() {
|
||||
|
||||
fflg := creat(*objDir + "_cgo_flags")
|
||||
for k, v := range p.CgoFlags {
|
||||
- fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " "))
|
||||
+ for _, arg := range v {
|
||||
+ fmt.Fprintf(fflg, "_CGO_%s=%s\n", arg)
|
||||
+ }
|
||||
if k == "LDFLAGS" && !*gccgo {
|
||||
for _, arg := range v {
|
||||
fmt.Fprintf(fgo2, "//go:cgo_ldflag %q\n", arg)
|
||||
diff --git a/src/cmd/go/internal/work/gccgo.go b/src/cmd/go/internal/work/gccgo.go
|
||||
index 08a4c2d8166c7..a048b7f4eecef 100644
|
||||
--- a/src/cmd/go/internal/work/gccgo.go
|
||||
+++ b/src/cmd/go/internal/work/gccgo.go
|
||||
@@ -280,14 +280,12 @@ func (tools gccgoToolchain) link(b *Builder, root *Action, out, importcfg string
|
||||
const ldflagsPrefix = "_CGO_LDFLAGS="
|
||||
for _, line := range strings.Split(string(flags), "\n") {
|
||||
if strings.HasPrefix(line, ldflagsPrefix) {
|
||||
- newFlags := strings.Fields(line[len(ldflagsPrefix):])
|
||||
- for _, flag := range newFlags {
|
||||
- // Every _cgo_flags file has -g and -O2 in _CGO_LDFLAGS
|
||||
- // but they don't mean anything to the linker so filter
|
||||
- // them out.
|
||||
- if flag != "-g" && !strings.HasPrefix(flag, "-O") {
|
||||
- cgoldflags = append(cgoldflags, flag)
|
||||
- }
|
||||
+ flag := line[len(ldflagsPrefix):]
|
||||
+ // Every _cgo_flags file has -g and -O2 in _CGO_LDFLAGS
|
||||
+ // but they don't mean anything to the linker so filter
|
||||
+ // them out.
|
||||
+ if flag != "-g" && !strings.HasPrefix(flag, "-O") {
|
||||
+ cgoldflags = append(cgoldflags, flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/cmd/go/testdata/script/gccgo_link_ldflags.txt b/src/cmd/go/testdata/script/gccgo_link_ldflags.txt
|
||||
new file mode 100644
|
||||
index 0000000000000..4e91ae56505b6
|
||||
--- /dev/null
|
||||
+++ b/src/cmd/go/testdata/script/gccgo_link_ldflags.txt
|
||||
@@ -0,0 +1,20 @@
|
||||
+# Test that #cgo LDFLAGS are properly quoted.
|
||||
+# The #cgo LDFLAGS below should pass a string with spaces to -L,
|
||||
+# as though searching a directory with a space in its name.
|
||||
+# It should not pass --nosuchoption to the external linker.
|
||||
+
|
||||
+[!cgo] skip
|
||||
+
|
||||
+go build
|
||||
+
|
||||
+[!exec:gccgo] skip
|
||||
+
|
||||
+go build -compiler gccgo
|
||||
+
|
||||
+-- go.mod --
|
||||
+module m
|
||||
+-- cgo.go --
|
||||
+package main
|
||||
+// #cgo LDFLAGS: -L "./ -Wl,--nosuchoption"
|
||||
+import "C"
|
||||
+func main() {}
|
||||
38
meta/recipes-devtools/go/go-1.14/CVE-2023-29405-2.patch
Normal file
38
meta/recipes-devtools/go/go-1.14/CVE-2023-29405-2.patch
Normal file
@@ -0,0 +1,38 @@
|
||||
From 1008486a9ff979dbd21c7466eeb6abf378f9c637 Mon Sep 17 00:00:00 2001
|
||||
From: Ian Lance Taylor <iant@golang.org>
|
||||
Date: Tue, 6 Jun 2023 12:51:17 -0700
|
||||
Subject: [PATCH] [release-branch.go1.20] cmd/cgo: correct _cgo_flags output
|
||||
|
||||
For #60306
|
||||
For #60514
|
||||
|
||||
Change-Id: I3f5d14aee7d7195030e8872e42b1d97aa11d3582
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/501298
|
||||
Run-TryBot: Ian Lance Taylor <iant@golang.org>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
Reviewed-by: David Chase <drchase@google.com>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
|
||||
---
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/1008486a9ff979dbd21c7466eeb6abf378f9c637]
|
||||
CVE: CVE-2023-29405
|
||||
Signed-off-by: Ashish Sharma <asharma@mvista.com>
|
||||
|
||||
|
||||
src/cmd/cgo/out.go | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
|
||||
index d0c6fe3d4c2c2..a48f52105628a 100644
|
||||
--- a/src/cmd/cgo/out.go
|
||||
+++ b/src/cmd/cgo/out.go
|
||||
@@ -48,7 +48,7 @@ func (p *Package) writeDefs() {
|
||||
fflg := creat(*objDir + "_cgo_flags")
|
||||
for k, v := range p.CgoFlags {
|
||||
for _, arg := range v {
|
||||
- fmt.Fprintf(fflg, "_CGO_%s=%s\n", arg)
|
||||
+ fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, arg)
|
||||
}
|
||||
if k == "LDFLAGS" && !*gccgo {
|
||||
for _, arg := range v {
|
||||
@@ -29,3 +29,6 @@ do_install() {
|
||||
}
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
# This is a different Ninja
|
||||
CVE_CHECK_WHITELIST += "CVE-2021-4336"
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
From 064ec20bf7a181ba5fa961aaa12973812aa6ca5d Mon Sep 17 00:00:00 2001
|
||||
From: "Miss Islington (bot)"
|
||||
<31488909+miss-islington@users.noreply.github.com>
|
||||
Date: Mon, 7 Nov 2022 18:57:10 -0800
|
||||
Subject: [PATCH] [3.11] gh-98433: Fix quadratic time idna decoding. (GH-99092)
|
||||
(GH-99222)
|
||||
|
||||
There was an unnecessary quadratic loop in idna decoding. This restores
|
||||
the behavior to linear.
|
||||
|
||||
(cherry picked from commit d315722564927c7202dd6e111dc79eaf14240b0d)
|
||||
|
||||
(cherry picked from commit a6f6c3a3d6f2b580f2d87885c9b8a9350ad7bf15)
|
||||
|
||||
Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
|
||||
Co-authored-by: Gregory P. Smith <greg@krypto.org>
|
||||
|
||||
CVE: CVE-2022-45061
|
||||
Upstream-Status: Backport [https://github.com/python/cpython/pull/99231/commits/064ec20bf7a181ba5fa961aaa12973812aa6ca5d]
|
||||
Signed-off-by: Omkar Patil <Omkar.Patil@kpit.com>
|
||||
|
||||
---
|
||||
Lib/encodings/idna.py | 32 +++++++++----------
|
||||
Lib/test/test_codecs.py | 6 ++++
|
||||
...2-11-04-09-29-36.gh-issue-98433.l76c5G.rst | 6 ++++
|
||||
3 files changed, 27 insertions(+), 17 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst
|
||||
|
||||
diff --git a/Lib/encodings/idna.py b/Lib/encodings/idna.py
|
||||
index ea4058512fe3..bf98f513366b 100644
|
||||
--- a/Lib/encodings/idna.py
|
||||
+++ b/Lib/encodings/idna.py
|
||||
@@ -39,23 +39,21 @@ def nameprep(label):
|
||||
|
||||
# Check bidi
|
||||
RandAL = [stringprep.in_table_d1(x) for x in label]
|
||||
- for c in RandAL:
|
||||
- if c:
|
||||
- # There is a RandAL char in the string. Must perform further
|
||||
- # tests:
|
||||
- # 1) The characters in section 5.8 MUST be prohibited.
|
||||
- # This is table C.8, which was already checked
|
||||
- # 2) If a string contains any RandALCat character, the string
|
||||
- # MUST NOT contain any LCat character.
|
||||
- if any(stringprep.in_table_d2(x) for x in label):
|
||||
- raise UnicodeError("Violation of BIDI requirement 2")
|
||||
-
|
||||
- # 3) If a string contains any RandALCat character, a
|
||||
- # RandALCat character MUST be the first character of the
|
||||
- # string, and a RandALCat character MUST be the last
|
||||
- # character of the string.
|
||||
- if not RandAL[0] or not RandAL[-1]:
|
||||
- raise UnicodeError("Violation of BIDI requirement 3")
|
||||
+ if any(RandAL):
|
||||
+ # There is a RandAL char in the string. Must perform further
|
||||
+ # tests:
|
||||
+ # 1) The characters in section 5.8 MUST be prohibited.
|
||||
+ # This is table C.8, which was already checked
|
||||
+ # 2) If a string contains any RandALCat character, the string
|
||||
+ # MUST NOT contain any LCat character.
|
||||
+ if any(stringprep.in_table_d2(x) for x in label):
|
||||
+ raise UnicodeError("Violation of BIDI requirement 2")
|
||||
+ # 3) If a string contains any RandALCat character, a
|
||||
+ # RandALCat character MUST be the first character of the
|
||||
+ # string, and a RandALCat character MUST be the last
|
||||
+ # character of the string.
|
||||
+ if not RandAL[0] or not RandAL[-1]:
|
||||
+ raise UnicodeError("Violation of BIDI requirement 3")
|
||||
|
||||
return label
|
||||
|
||||
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
|
||||
index d1faf0126c1e..37ade7d80d02 100644
|
||||
--- a/Lib/test/test_codecs.py
|
||||
+++ b/Lib/test/test_codecs.py
|
||||
@@ -1532,6 +1532,12 @@ def test_builtin_encode(self):
|
||||
self.assertEqual("pyth\xf6n.org".encode("idna"), b"xn--pythn-mua.org")
|
||||
self.assertEqual("pyth\xf6n.org.".encode("idna"), b"xn--pythn-mua.org.")
|
||||
|
||||
+ def test_builtin_decode_length_limit(self):
|
||||
+ with self.assertRaisesRegex(UnicodeError, "too long"):
|
||||
+ (b"xn--016c"+b"a"*1100).decode("idna")
|
||||
+ with self.assertRaisesRegex(UnicodeError, "too long"):
|
||||
+ (b"xn--016c"+b"a"*70).decode("idna")
|
||||
+
|
||||
def test_stream(self):
|
||||
r = codecs.getreader("idna")(io.BytesIO(b"abc"))
|
||||
r.read(3)
|
||||
diff --git a/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst b/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst
|
||||
new file mode 100644
|
||||
index 000000000000..5185fac2e29d
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst
|
||||
@@ -0,0 +1,6 @@
|
||||
+The IDNA codec decoder used on DNS hostnames by :mod:`socket` or :mod:`asyncio`
|
||||
+related name resolution functions no longer involves a quadratic algorithm.
|
||||
+This prevents a potential CPU denial of service if an out-of-spec excessive
|
||||
+length hostname involving bidirectional characters were decoded. Some protocols
|
||||
+such as :mod:`urllib` http ``3xx`` redirects potentially allow for an attacker
|
||||
+to supply such a name.
|
||||
@@ -1,105 +0,0 @@
|
||||
From 948c6794711458fd148a3fa62296cadeeb2ed631 Mon Sep 17 00:00:00 2001
|
||||
From: "Miss Islington (bot)"
|
||||
<31488909+miss-islington@users.noreply.github.com>
|
||||
Date: Fri, 28 Oct 2022 03:07:50 -0700
|
||||
Subject: [PATCH] [3.8] gh-98517: Fix buffer overflows in _sha3 module
|
||||
(GH-98519) (#98527)
|
||||
|
||||
This is a port of the applicable part of XKCP's fix [1] for
|
||||
CVE-2022-37454 and avoids the segmentation fault and the infinite
|
||||
loop in the test cases published in [2].
|
||||
|
||||
[1]: https://github.com/XKCP/XKCP/commit/fdc6fef075f4e81d6b1bc38364248975e08e340a
|
||||
[2]: https://mouha.be/sha-3-buffer-overflow/
|
||||
|
||||
Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
|
||||
(cherry picked from commit 0e4e058602d93b88256ff90bbef501ba20be9dd3)
|
||||
|
||||
Co-authored-by: Theo Buehler <botovq@users.noreply.github.com>
|
||||
|
||||
CVE: CVE-2022-37454
|
||||
Upstream-Status: Backport [https://github.com/python/cpython/commit/948c6794711458fd148a3fa62296cadeeb2ed631]
|
||||
Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
|
||||
---
|
||||
Lib/test/test_hashlib.py | 9 +++++++++
|
||||
.../2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst | 1 +
|
||||
Modules/_sha3/kcp/KeccakSponge.inc | 15 ++++++++-------
|
||||
3 files changed, 18 insertions(+), 7 deletions(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
|
||||
|
||||
diff --git a/Lib/test/test_hashlib.py b/Lib/test/test_hashlib.py
|
||||
index 8b53d23ef525..e6cec4e306e5 100644
|
||||
--- a/Lib/test/test_hashlib.py
|
||||
+++ b/Lib/test/test_hashlib.py
|
||||
@@ -434,6 +434,15 @@ def test_case_md5_huge(self, size):
|
||||
def test_case_md5_uintmax(self, size):
|
||||
self.check('md5', b'A'*size, '28138d306ff1b8281f1a9067e1a1a2b3')
|
||||
|
||||
+ @unittest.skipIf(sys.maxsize < _4G - 1, 'test cannot run on 32-bit systems')
|
||||
+ @bigmemtest(size=_4G - 1, memuse=1, dry_run=False)
|
||||
+ def test_sha3_update_overflow(self, size):
|
||||
+ """Regression test for gh-98517 CVE-2022-37454."""
|
||||
+ h = hashlib.sha3_224()
|
||||
+ h.update(b'\x01')
|
||||
+ h.update(b'\x01'*0xffff_ffff)
|
||||
+ self.assertEqual(h.hexdigest(), '80762e8ce6700f114fec0f621fd97c4b9c00147fa052215294cceeed')
|
||||
+
|
||||
# use the three examples from Federal Information Processing Standards
|
||||
# Publication 180-1, Secure Hash Standard, 1995 April 17
|
||||
# http://www.itl.nist.gov/div897/pubs/fip180-1.htm
|
||||
diff --git a/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst b/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
|
||||
new file mode 100644
|
||||
index 000000000000..2d23a6ad93c7
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Security/2022-10-21-13-31-47.gh-issue-98517.SXXGfV.rst
|
||||
@@ -0,0 +1 @@
|
||||
+Port XKCP's fix for the buffer overflows in SHA-3 (CVE-2022-37454).
|
||||
diff --git a/Modules/_sha3/kcp/KeccakSponge.inc b/Modules/_sha3/kcp/KeccakSponge.inc
|
||||
index e10739deafa8..cf92e4db4d36 100644
|
||||
--- a/Modules/_sha3/kcp/KeccakSponge.inc
|
||||
+++ b/Modules/_sha3/kcp/KeccakSponge.inc
|
||||
@@ -171,7 +171,7 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
|
||||
i = 0;
|
||||
curData = data;
|
||||
while(i < dataByteLen) {
|
||||
- if ((instance->byteIOIndex == 0) && (dataByteLen >= (i + rateInBytes))) {
|
||||
+ if ((instance->byteIOIndex == 0) && (dataByteLen-i >= rateInBytes)) {
|
||||
#ifdef SnP_FastLoop_Absorb
|
||||
/* processing full blocks first */
|
||||
|
||||
@@ -199,10 +199,10 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
|
||||
}
|
||||
else {
|
||||
/* normal lane: using the message queue */
|
||||
-
|
||||
- partialBlock = (unsigned int)(dataByteLen - i);
|
||||
- if (partialBlock+instance->byteIOIndex > rateInBytes)
|
||||
+ if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
|
||||
partialBlock = rateInBytes-instance->byteIOIndex;
|
||||
+ else
|
||||
+ partialBlock = (unsigned int)(dataByteLen - i);
|
||||
#ifdef KeccakReference
|
||||
displayBytes(1, "Block to be absorbed (part)", curData, partialBlock);
|
||||
#endif
|
||||
@@ -281,7 +281,7 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
|
||||
i = 0;
|
||||
curData = data;
|
||||
while(i < dataByteLen) {
|
||||
- if ((instance->byteIOIndex == rateInBytes) && (dataByteLen >= (i + rateInBytes))) {
|
||||
+ if ((instance->byteIOIndex == rateInBytes) && (dataByteLen-i >= rateInBytes)) {
|
||||
for(j=dataByteLen-i; j>=rateInBytes; j-=rateInBytes) {
|
||||
SnP_Permute(instance->state);
|
||||
SnP_ExtractBytes(instance->state, curData, 0, rateInBytes);
|
||||
@@ -299,9 +299,10 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
|
||||
SnP_Permute(instance->state);
|
||||
instance->byteIOIndex = 0;
|
||||
}
|
||||
- partialBlock = (unsigned int)(dataByteLen - i);
|
||||
- if (partialBlock+instance->byteIOIndex > rateInBytes)
|
||||
+ if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
|
||||
partialBlock = rateInBytes-instance->byteIOIndex;
|
||||
+ else
|
||||
+ partialBlock = (unsigned int)(dataByteLen - i);
|
||||
i += partialBlock;
|
||||
|
||||
SnP_ExtractBytes(instance->state, curData, instance->byteIOIndex, partialBlock);
|
||||
80
meta/recipes-devtools/python/python3/CVE-2023-24329.patch
Normal file
80
meta/recipes-devtools/python/python3/CVE-2023-24329.patch
Normal file
@@ -0,0 +1,80 @@
|
||||
From 72d356e3584ebfb8e813a8e9f2cd3dccf233c0d9 Mon Sep 17 00:00:00 2001
|
||||
From: "Miss Islington (bot)"
|
||||
<31488909+miss-islington@users.noreply.github.com>
|
||||
Date: Sun, 13 Nov 2022 11:00:25 -0800
|
||||
Subject: [PATCH] gh-99418: Make urllib.parse.urlparse enforce that a scheme
|
||||
must begin with an alphabetical ASCII character. (GH-99421)
|
||||
|
||||
Prevent urllib.parse.urlparse from accepting schemes that don't begin with an alphabetical ASCII character.
|
||||
|
||||
RFC 3986 defines a scheme like this: `scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )`
|
||||
RFC 2234 defines an ALPHA like this: `ALPHA = %x41-5A / %x61-7A`
|
||||
|
||||
The WHATWG URL spec defines a scheme like this:
|
||||
`"A URL-scheme string must be one ASCII alpha, followed by zero or more of ASCII alphanumeric, U+002B (+), U+002D (-), and U+002E (.)."`
|
||||
(cherry picked from commit 439b9cfaf43080e91c4ad69f312f21fa098befc7)
|
||||
|
||||
Co-authored-by: Ben Kallus <49924171+kenballus@users.noreply.github.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/python/cpython/commit/72d356e3584ebfb8e813a8e9f2cd3dccf233c0d9]
|
||||
CVE: CVE-2023-24329
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
Lib/test/test_urlparse.py | 18 ++++++++++++++++++
|
||||
Lib/urllib/parse.py | 2 +-
|
||||
...22-11-12-15-45-51.gh-issue-99418.FxfAXS.rst | 2 ++
|
||||
3 files changed, 21 insertions(+), 1 deletion(-)
|
||||
create mode 100644 Misc/NEWS.d/next/Library/2022-11-12-15-45-51.gh-issue-99418.FxfAXS.rst
|
||||
|
||||
diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py
|
||||
index 0ad3bf1..e1aa913 100644
|
||||
--- a/Lib/test/test_urlparse.py
|
||||
+++ b/Lib/test/test_urlparse.py
|
||||
@@ -735,6 +735,24 @@ class UrlParseTestCase(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
p.port
|
||||
|
||||
+ def test_attributes_bad_scheme(self):
|
||||
+ """Check handling of invalid schemes."""
|
||||
+ for bytes in (False, True):
|
||||
+ for parse in (urllib.parse.urlsplit, urllib.parse.urlparse):
|
||||
+ for scheme in (".", "+", "-", "0", "http&", "६http"):
|
||||
+ with self.subTest(bytes=bytes, parse=parse, scheme=scheme):
|
||||
+ url = scheme + "://www.example.net"
|
||||
+ if bytes:
|
||||
+ if url.isascii():
|
||||
+ url = url.encode("ascii")
|
||||
+ else:
|
||||
+ continue
|
||||
+ p = parse(url)
|
||||
+ if bytes:
|
||||
+ self.assertEqual(p.scheme, b"")
|
||||
+ else:
|
||||
+ self.assertEqual(p.scheme, "")
|
||||
+
|
||||
def test_attributes_without_netloc(self):
|
||||
# This example is straight from RFC 3261. It looks like it
|
||||
# should allow the username, hostname, and port to be filled
|
||||
diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
|
||||
index 979e6d2..2e7a3e2 100644
|
||||
--- a/Lib/urllib/parse.py
|
||||
+++ b/Lib/urllib/parse.py
|
||||
@@ -452,7 +452,7 @@ def urlsplit(url, scheme='', allow_fragments=True):
|
||||
clear_cache()
|
||||
netloc = query = fragment = ''
|
||||
i = url.find(':')
|
||||
- if i > 0:
|
||||
+ if i > 0 and url[0].isascii() and url[0].isalpha():
|
||||
if url[:i] == 'http': # optimize the common case
|
||||
url = url[i+1:]
|
||||
if url[:2] == '//':
|
||||
diff --git a/Misc/NEWS.d/next/Library/2022-11-12-15-45-51.gh-issue-99418.FxfAXS.rst b/Misc/NEWS.d/next/Library/2022-11-12-15-45-51.gh-issue-99418.FxfAXS.rst
|
||||
new file mode 100644
|
||||
index 0000000..0a06e7c
|
||||
--- /dev/null
|
||||
+++ b/Misc/NEWS.d/next/Library/2022-11-12-15-45-51.gh-issue-99418.FxfAXS.rst
|
||||
@@ -0,0 +1,2 @@
|
||||
+Fix bug in :func:`urllib.parse.urlparse` that causes URL schemes that begin
|
||||
+with a digit, a plus sign, or a minus sign to be parsed incorrectly.
|
||||
--
|
||||
2.25.1
|
||||
@@ -4,7 +4,7 @@ DESCRIPTION = "Python is a programming language that lets you work more quickly
|
||||
LICENSE = "PSF-2.0 & BSD-0-Clause"
|
||||
SECTION = "devel/python"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=c84eccf626bb6fde43e6ea5e28d8feb5"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=07fc4b9a9c0c0e48050ed38a5e72552b"
|
||||
|
||||
SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
|
||||
file://run-ptest \
|
||||
@@ -34,8 +34,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
|
||||
file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \
|
||||
file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
|
||||
file://makerace.patch \
|
||||
file://CVE-2022-45061.patch \
|
||||
file://CVE-2022-37454.patch \
|
||||
file://CVE-2023-24329.patch \
|
||||
"
|
||||
|
||||
SRC_URI_append_class-native = " \
|
||||
@@ -44,8 +43,8 @@ SRC_URI_append_class-native = " \
|
||||
file://0001-Don-t-search-system-for-headers-libraries.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "78710eed185b71f4198d354502ff62c9"
|
||||
SRC_URI[sha256sum] = "5d77e278271ba803e9909a41a4f3baca006181c93ada682a5e5fe8dc4a24c5f3"
|
||||
SRC_URI[md5sum] = "70223497e664524303ca2364208647e1"
|
||||
SRC_URI[sha256sum] = "2e54b0c68191f16552f6de2e97a2396540572a219f6bbb28591a137cecc490a9"
|
||||
|
||||
# exclude pre-releases for both python 2.x and 3.x
|
||||
UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
|
||||
@@ -137,6 +137,7 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
|
||||
file://CVE-2021-3409-4.patch \
|
||||
file://CVE-2021-3409-5.patch \
|
||||
file://hw-display-qxl-Pass-requested-buffer-size-to-qxl_phy.patch \
|
||||
file://CVE-2023-0330.patch \
|
||||
"
|
||||
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
|
||||
|
||||
|
||||
77
meta/recipes-devtools/qemu/qemu/CVE-2023-0330.patch
Normal file
77
meta/recipes-devtools/qemu/qemu/CVE-2023-0330.patch
Normal file
@@ -0,0 +1,77 @@
|
||||
[Ubuntu note: remove fuzz-lsi53c895a-test.c changes since the file does not
|
||||
exist for this release]
|
||||
From b987718bbb1d0eabf95499b976212dd5f0120d75 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Huth <thuth@redhat.com>
|
||||
Date: Mon, 22 May 2023 11:10:11 +0200
|
||||
Subject: [PATCH] hw/scsi/lsi53c895a: Fix reentrancy issues in the LSI
|
||||
controller (CVE-2023-0330)
|
||||
|
||||
We cannot use the generic reentrancy guard in the LSI code, so
|
||||
we have to manually prevent endless reentrancy here. The problematic
|
||||
lsi_execute_script() function has already a way to detect whether
|
||||
too many instructions have been executed - we just have to slightly
|
||||
change the logic here that it also takes into account if the function
|
||||
has been called too often in a reentrant way.
|
||||
|
||||
The code in fuzz-lsi53c895a-test.c has been taken from an earlier
|
||||
patch by Mauro Matteo Cascella.
|
||||
|
||||
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1563
|
||||
Message-Id: <20230522091011.1082574-1-thuth@redhat.com>
|
||||
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
|
||||
Reference: https://launchpad.net/ubuntu/+source/qemu/1:4.2-3ubuntu6.27
|
||||
|
||||
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/qemu/tree/debian/patches/CVE-2023-0330.patch?h=ubuntu/focal-security
|
||||
Upstream commit https://gitlab.com/qemu-project/qemu/-/commit/b987718bbb1d0eabf95499b976212dd5f0120d75]
|
||||
CVE: CVE-2023-0330
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
hw/scsi/lsi53c895a.c | 23 +++++++++++++++------
|
||||
tests/qtest/fuzz-lsi53c895a-test.c | 33 ++++++++++++++++++++++++++++++
|
||||
2 files changed, 50 insertions(+), 6 deletions(-)
|
||||
|
||||
--- qemu-4.2.orig/hw/scsi/lsi53c895a.c
|
||||
+++ qemu-4.2/hw/scsi/lsi53c895a.c
|
||||
@@ -1135,15 +1135,24 @@ static void lsi_execute_script(LSIState
|
||||
uint32_t addr, addr_high;
|
||||
int opcode;
|
||||
int insn_processed = 0;
|
||||
+ static int reentrancy_level;
|
||||
+
|
||||
+ reentrancy_level++;
|
||||
|
||||
s->istat1 |= LSI_ISTAT1_SRUN;
|
||||
again:
|
||||
- if (++insn_processed > LSI_MAX_INSN) {
|
||||
- /* Some windows drivers make the device spin waiting for a memory
|
||||
- location to change. If we have been executed a lot of code then
|
||||
- assume this is the case and force an unexpected device disconnect.
|
||||
- This is apparently sufficient to beat the drivers into submission.
|
||||
- */
|
||||
+ /*
|
||||
+ * Some windows drivers make the device spin waiting for a memory location
|
||||
+ * to change. If we have executed more than LSI_MAX_INSN instructions then
|
||||
+ * assume this is the case and force an unexpected device disconnect. This
|
||||
+ * is apparently sufficient to beat the drivers into submission.
|
||||
+ *
|
||||
+ * Another issue (CVE-2023-0330) can occur if the script is programmed to
|
||||
+ * trigger itself again and again. Avoid this problem by stopping after
|
||||
+ * being called multiple times in a reentrant way (8 is an arbitrary value
|
||||
+ * which should be enough for all valid use cases).
|
||||
+ */
|
||||
+ if (++insn_processed > LSI_MAX_INSN || reentrancy_level > 8) {
|
||||
if (!(s->sien0 & LSI_SIST0_UDC)) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"lsi_scsi: inf. loop with UDC masked");
|
||||
@@ -1597,6 +1606,8 @@ again:
|
||||
}
|
||||
}
|
||||
trace_lsi_execute_script_stop();
|
||||
+
|
||||
+ reentrancy_level--;
|
||||
}
|
||||
|
||||
static uint8_t lsi_reg_readb(LSIState *s, int offset)
|
||||
@@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=Run pending postinsts
|
||||
DefaultDependencies=no
|
||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount
|
||||
After=systemd-remount-fs.service systemd-tmpfiles-setup.service tmp.mount ldconfig.service
|
||||
Before=sysinit.target
|
||||
|
||||
[Service]
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
From 77ff5f1be394eb2c786df561ff37dde7f982ec76 Mon Sep 17 00:00:00 2001
|
||||
From: Stefano Babic <sbabic@denx.de>
|
||||
Date: Fri, 28 Jul 2017 13:20:52 +0200
|
||||
Subject: [PATCH] Wrong CRC with ASCII CRC for large files
|
||||
|
||||
Due to signedness, the checksum is not computed when filesize is bigger
|
||||
a 2GB.
|
||||
|
||||
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bug-cpio/2017-07/msg00004.html]
|
||||
Signed-off-by: Stefano Babic <sbabic@denx.de>
|
||||
---
|
||||
src/copyout.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/copyout.c b/src/copyout.c
|
||||
index 1f0987a..727aeca 100644
|
||||
--- a/src/copyout.c
|
||||
+++ b/src/copyout.c
|
||||
@@ -34,13 +34,13 @@
|
||||
compute and return a checksum for them. */
|
||||
|
||||
static uint32_t
|
||||
-read_for_checksum (int in_file_des, int file_size, char *file_name)
|
||||
+read_for_checksum (int in_file_des, unsigned int file_size, char *file_name)
|
||||
{
|
||||
uint32_t crc;
|
||||
char buf[BUFSIZ];
|
||||
- int bytes_left;
|
||||
- int bytes_read;
|
||||
- int i;
|
||||
+ unsigned int bytes_left;
|
||||
+ unsigned int bytes_read;
|
||||
+ unsigned int i;
|
||||
|
||||
crc = 0;
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@@ -10,6 +10,7 @@ SRC_URI = "${GNU_MIRROR}/cpio/cpio-${PV}.tar.gz \
|
||||
file://0001-Unset-need_charset_alias-when-building-for-musl.patch \
|
||||
file://0002-src-global.c-Remove-superfluous-declaration-of-progr.patch \
|
||||
file://CVE-2021-38185.patch \
|
||||
file://0001-Wrong-CRC-with-ASCII-CRC-for-large-files.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "389c5452d667c23b5eceb206f5000810"
|
||||
|
||||
@@ -14,6 +14,8 @@ SRC_URI = "https://github.com/apple/cups/releases/download/v${PV}/${BP}-source.t
|
||||
file://0003-cups_1.4.6.bb-Fix-build-on-ppc64.patch \
|
||||
file://0004-cups-fix-multilib-install-file-conflicts.patch\
|
||||
file://CVE-2022-26691.patch \
|
||||
file://CVE-2023-32324.patch \
|
||||
file://CVE-2023-34241.patch \
|
||||
"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://github.com/apple/cups/releases"
|
||||
|
||||
36
meta/recipes-extended/cups/cups/CVE-2023-32324.patch
Normal file
36
meta/recipes-extended/cups/cups/CVE-2023-32324.patch
Normal file
@@ -0,0 +1,36 @@
|
||||
From 07cbffd11107eed3aaf1c64e35552aec20f792da Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Dohnal <zdohnal@redhat.com>
|
||||
Date: Thu, 1 Jun 2023 12:04:00 +0200
|
||||
Subject: [PATCH] cups/string.c: Return if `size` is 0 (fixes CVE-2023-32324)
|
||||
|
||||
CVE: CVE-2023-32324
|
||||
Upstream-Status: Backport [https://github.com/OpenPrinting/cups/commit/fd8bc2d32589]
|
||||
|
||||
(cherry picked from commit fd8bc2d32589d1fd91fe1c0521be2a7c0462109e)
|
||||
Signed-off-by: Sanjay Chitroda <schitrod@cisco.com>
|
||||
---
|
||||
cups/string.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/cups/string.c b/cups/string.c
|
||||
index 93cdad19..6ef58515 100644
|
||||
--- a/cups/string.c
|
||||
+++ b/cups/string.c
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* String functions for CUPS.
|
||||
*
|
||||
+ * Copyright © 2023 by OpenPrinting.
|
||||
* Copyright © 2007-2019 by Apple Inc.
|
||||
* Copyright © 1997-2007 by Easy Software Products.
|
||||
*
|
||||
@@ -730,6 +731,9 @@ _cups_strlcpy(char *dst, /* O - Destination string */
|
||||
size_t srclen; /* Length of source string */
|
||||
|
||||
|
||||
+ if (size == 0)
|
||||
+ return (0);
|
||||
+
|
||||
/*
|
||||
* Figure out how much room is needed...
|
||||
*/
|
||||
65
meta/recipes-extended/cups/cups/CVE-2023-34241.patch
Normal file
65
meta/recipes-extended/cups/cups/CVE-2023-34241.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From ffd290b4ab247f82722927ba9b21358daa16dbf1 Mon Sep 17 00:00:00 2001
|
||||
From: Rose <83477269+AtariDreams@users.noreply.github.com>
|
||||
Date: Thu, 1 Jun 2023 11:33:39 -0400
|
||||
Subject: [PATCH] Log result of httpGetHostname BEFORE closing the connection
|
||||
|
||||
httpClose frees the memory of con->http. This is problematic because httpGetHostname then tries to access the memory it points to.
|
||||
|
||||
We have to log the hostname first.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/OpenPrinting/cups/commit/9809947a959e18409dcf562a3466ef246cb90cb2]
|
||||
CVE: CVE-2023-34241
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
scheduler/client.c | 16 +++++++---------
|
||||
1 file changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/scheduler/client.c b/scheduler/client.c
|
||||
index 91e441188c..327473a4d1 100644
|
||||
--- a/scheduler/client.c
|
||||
+++ b/scheduler/client.c
|
||||
@@ -193,13 +193,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
|
||||
/*
|
||||
* Can't have an unresolved IP address with double-lookups enabled...
|
||||
*/
|
||||
-
|
||||
- httpClose(con->http);
|
||||
-
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN,
|
||||
- "Name lookup failed - connection from %s closed!",
|
||||
+ "Name lookup failed - closing connection from %s!",
|
||||
httpGetHostname(con->http, NULL, 0));
|
||||
|
||||
+ httpClose(con->http);
|
||||
free(con);
|
||||
return;
|
||||
}
|
||||
@@ -235,11 +233,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
|
||||
* with double-lookups enabled...
|
||||
*/
|
||||
|
||||
- httpClose(con->http);
|
||||
-
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN,
|
||||
- "IP lookup failed - connection from %s closed!",
|
||||
+ "IP lookup failed - closing connection from %s!",
|
||||
httpGetHostname(con->http, NULL, 0));
|
||||
+
|
||||
+ httpClose(con->http);
|
||||
free(con);
|
||||
return;
|
||||
}
|
||||
@@ -256,11 +254,11 @@ cupsdAcceptClient(cupsd_listener_t *lis)/* I - Listener socket */
|
||||
|
||||
if (!hosts_access(&wrap_req))
|
||||
{
|
||||
- httpClose(con->http);
|
||||
-
|
||||
cupsdLogClient(con, CUPSD_LOG_WARN,
|
||||
"Connection from %s refused by /etc/hosts.allow and "
|
||||
"/etc/hosts.deny rules.", httpGetHostname(con->http, NULL, 0));
|
||||
+
|
||||
+ httpClose(con->http);
|
||||
free(con);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
From 37ed5022cecd584de868933b5b60da2e995b3179 Mon Sep 17 00:00:00 2001
|
||||
From: Ken Sharp <ken.sharp@artifex.com>
|
||||
Date: Fri, 24 Mar 2023 13:19:57 +0000
|
||||
Subject: [PATCH] Graphics library - prevent buffer overrun in (T)BCP encoding
|
||||
|
||||
Bug #706494 "Buffer Overflow in s_xBCPE_process"
|
||||
|
||||
As described in detail in the bug report, if the write buffer is filled
|
||||
to one byte less than full, and we then try to write an escaped
|
||||
character, we overrun the buffer because we don't check before
|
||||
writing two bytes to it.
|
||||
|
||||
This just checks if we have two bytes before starting to write an
|
||||
escaped character and exits if we don't (replacing the consumed byte
|
||||
of the input).
|
||||
|
||||
Up for further discussion; why do we even permit a BCP encoding filter
|
||||
anyway ? I think we should remove this, at least when SAFER is true.
|
||||
|
||||
Upstream-Status: Backport [https://git.ghostscript.com/?p=ghostpdl.git;h=37ed5022cecd584de868933b5b60da2e995b3179]
|
||||
CVE: CVE-2023-28879
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
base/sbcp.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/base/sbcp.c b/base/sbcp.c
|
||||
index 6b0383c..90784b5 100644
|
||||
--- a/base/sbcp.c
|
||||
+++ b/base/sbcp.c
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
|
||||
+/* Copyright (C) 2001-2023 Artifex Software, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
This software is provided AS-IS with no warranty, either express or
|
||||
@@ -50,6 +50,14 @@ s_xBCPE_process(stream_state * st, stream_cursor_read * pr,
|
||||
byte ch = *++p;
|
||||
|
||||
if (ch <= 31 && escaped[ch]) {
|
||||
+ /* Make sure we have space to store two characters in the write buffer,
|
||||
+ * if we don't then exit without consuming the input character, we'll process
|
||||
+ * that on the next time round.
|
||||
+ */
|
||||
+ if (pw->limit - q < 2) {
|
||||
+ p--;
|
||||
+ break;
|
||||
+ }
|
||||
if (p == rlimit) {
|
||||
p--;
|
||||
break;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -39,6 +39,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d
|
||||
file://CVE-2021-3781_1.patch \
|
||||
file://CVE-2021-3781_2.patch \
|
||||
file://CVE-2021-3781_3.patch \
|
||||
file://CVE-2023-28879.patch \
|
||||
"
|
||||
|
||||
SRC_URI = "${SRC_URI_BASE} \
|
||||
|
||||
46
meta/recipes-extended/sysstat/sysstat/CVE-2023-33204.patch
Normal file
46
meta/recipes-extended/sysstat/sysstat/CVE-2023-33204.patch
Normal file
@@ -0,0 +1,46 @@
|
||||
Origin: https://github.com/opencontainers/runc/commit/6f8dc568e6ab072bb8205b732f04e685bf9237c0
|
||||
Reviewed-by: Sylvain Beucler <beuc@debian.org>
|
||||
Last-Update: 2023-02-18
|
||||
|
||||
From 954ff2e2673cef48f0ed44668c466eab041db387 Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Kopylov <pkopylov@cloudlinux.com>
|
||||
Date: Wed, 17 May 2023 11:33:45 +0200
|
||||
Subject: [PATCH] Fix an overflow which is still possible for some values.
|
||||
|
||||
CVE: CVE-2023-33204
|
||||
Upstream-Status: Backport [ upstream: https://github.com/sysstat/sysstat/commit/6f8dc568e6ab072bb8205b732f04e685bf9237c0
|
||||
debian: http://security.debian.org/debian-security/pool/updates/main/s/sysstat/sysstat_12.0.3-2+deb10u2.debian.tar.xz ]
|
||||
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
|
||||
|
||||
---
|
||||
common.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: sysstat-12.0.3/common.c
|
||||
===================================================================
|
||||
--- sysstat-12.0.3.orig/common.c
|
||||
+++ sysstat-12.0.3/common.c
|
||||
@@ -1449,15 +1449,16 @@ int parse_values(char *strargv, unsigned
|
||||
*/
|
||||
void check_overflow(size_t val1, size_t val2, size_t val3)
|
||||
{
|
||||
- if ((unsigned long long) val1 *
|
||||
- (unsigned long long) val2 *
|
||||
- (unsigned long long) val3 > UINT_MAX) {
|
||||
+ if ((val1 != 0) && (val2 != 0) && (val3 != 0) &&
|
||||
+ (((unsigned long long) UINT_MAX / (unsigned long long) val1 <
|
||||
+ (unsigned long long) val2) ||
|
||||
+ ((unsigned long long) UINT_MAX / ((unsigned long long) val1 * (unsigned long long) val2) <
|
||||
+ (unsigned long long) val3))) {
|
||||
#ifdef DEBUG
|
||||
- fprintf(stderr, "%s: Overflow detected (%llu). Aborting...\n",
|
||||
- __FUNCTION__,
|
||||
- (unsigned long long) val1 * (unsigned long long) val2 * (unsigned long long) val3);
|
||||
+ fprintf(stderr, "%s: Overflow detected (%u,%u,%u). Aborting...\n",
|
||||
+ __FUNCTION__, val1, val2, val3);
|
||||
#endif
|
||||
- exit(4);
|
||||
+ exit(4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a23a74b3f4caf9616230789d94217acb"
|
||||
|
||||
SRC_URI += "file://0001-configure.in-remove-check-for-chkconfig.patch \
|
||||
file://CVE-2022-39377.patch \
|
||||
file://CVE-2023-33204.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "9dfff5fac24e35bd92fb7896debf2ffb"
|
||||
|
||||
@@ -6,7 +6,7 @@ SECTION = "base"
|
||||
LICENSE = "PD & BSD-3-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=c679c9d6b02bc2757b3eaf8f53c43fba"
|
||||
|
||||
PV = "2022g"
|
||||
PV = "2023c"
|
||||
|
||||
SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz;name=tzcode \
|
||||
http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata \
|
||||
@@ -14,5 +14,5 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz
|
||||
|
||||
UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones"
|
||||
|
||||
SRC_URI[tzcode.sha256sum] = "9610bb0b9656ff404c361a41f3286da53064b5469d84f00c9cb2314c8614da74"
|
||||
SRC_URI[tzdata.sha256sum] = "4491db8281ae94a84d939e427bdd83dc389f26764d27d9a5c52d782c16764478"
|
||||
SRC_URI[tzcode.sha256sum] = "46d17f2bb19ad73290f03a203006152e0fa0d7b11e5b71467c4a823811b214e7"
|
||||
SRC_URI[tzdata.sha256sum] = "3f510b5d1b4ae9bb38e485aa302a776b317fb3637bdb6404c4adf7b6cadd965c"
|
||||
|
||||
40
meta/recipes-graphics/freetype/freetype/CVE-2023-2004.patch
Normal file
40
meta/recipes-graphics/freetype/freetype/CVE-2023-2004.patch
Normal file
@@ -0,0 +1,40 @@
|
||||
From e6fda039ad638866b7a6a5d046f03278ba1b7611 Mon Sep 17 00:00:00 2001
|
||||
From: Werner Lemberg <wl@gnu.org>
|
||||
Date: Mon, 14 Nov 2022 19:18:19 +0100
|
||||
Subject: [PATCH] * src/truetype/ttgxvar.c (tt_hvadvance_adjust): Integer
|
||||
overflow.
|
||||
|
||||
Reported as
|
||||
|
||||
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50462
|
||||
|
||||
Upstream-Status: Backport [https://github.com/freetype/freetype/commit/e6fda039ad638866b7a6a5d046f03278ba1b7611]
|
||||
CVE: CVE-2023-2004
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
src/truetype/ttgxvar.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
|
||||
index 78d87dc..258d701 100644
|
||||
--- a/src/truetype/ttgxvar.c
|
||||
+++ b/src/truetype/ttgxvar.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include FT_INTERNAL_DEBUG_H
|
||||
#include FT_CONFIG_CONFIG_H
|
||||
#include FT_INTERNAL_STREAM_H
|
||||
+#include <freetype/internal/ftcalc.h>
|
||||
#include FT_INTERNAL_SFNT_H
|
||||
#include FT_TRUETYPE_TAGS_H
|
||||
#include FT_TRUETYPE_IDS_H
|
||||
@@ -1065,7 +1066,7 @@
|
||||
delta == 1 ? "" : "s",
|
||||
vertical ? "VVAR" : "HVAR" ));
|
||||
|
||||
- *avalue += delta;
|
||||
+ *avalue = ADD_INT( *avalue, delta );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
--
|
||||
2.17.1
|
||||
@@ -18,6 +18,7 @@ SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/${BPN}/${BP}.tar.xz \
|
||||
file://CVE-2022-27404.patch \
|
||||
file://CVE-2022-27405.patch \
|
||||
file://CVE-2022-27406.patch \
|
||||
file://CVE-2023-2004.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "bd42e75127f8431923679480efb5ba8f"
|
||||
SRC_URI[sha256sum] = "16dbfa488a21fe827dc27eaf708f42f7aa3bb997d745d31a19781628c36ba26f"
|
||||
|
||||
457
meta/recipes-graphics/jpeg/files/CVE-2020-35538-1.patch
Normal file
457
meta/recipes-graphics/jpeg/files/CVE-2020-35538-1.patch
Normal file
@@ -0,0 +1,457 @@
|
||||
From 9120a247436e84c0b4eea828cb11e8f665fcde30 Mon Sep 17 00:00:00 2001
|
||||
From: DRC <information@libjpeg-turbo.org>
|
||||
Date: Thu, 23 Jul 2020 21:24:38 -0500
|
||||
Subject: [PATCH] Fix jpeg_skip_scanlines() segfault w/merged upsamp
|
||||
|
||||
The additional segfault mentioned in #244 was due to the fact that
|
||||
the merged upsamplers use a different private structure than the
|
||||
non-merged upsamplers. jpeg_skip_scanlines() was assuming the latter, so
|
||||
when merged upsampling was enabled, jpeg_skip_scanlines() clobbered one
|
||||
of the IDCT method pointers in the merged upsampler's private structure.
|
||||
|
||||
For reasons unknown, the test image in #441 did not encounter this
|
||||
segfault (too small?), but it encountered an issue similar to the one
|
||||
fixed in 5bc43c7821df982f65aa1c738f67fbf7cba8bd69, whereby it was
|
||||
necessary to set up a dummy postprocessing function in
|
||||
read_and_discard_scanlines() when merged upsampling was enabled.
|
||||
Failing to do so caused either a segfault in merged_2v_upsample() (due
|
||||
to a NULL pointer being passed to jcopy_sample_rows()) or an error
|
||||
("Corrupt JPEG data: premature end of data segment"), depending on the
|
||||
number of scanlines skipped and whether the first scanline skipped was
|
||||
an odd- or even-numbered row.
|
||||
|
||||
Fixes #441
|
||||
Fixes #244 (for real this time)
|
||||
|
||||
Upstream-Status: Backport [https://github.com/libjpeg-turbo/libjpeg-turbo/commit/9120a247436e84c0b4eea828cb11e8f665fcde30]
|
||||
CVE: CVE-2020-35538
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
ChangeLog.md | 7 +++++
|
||||
jdapistd.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
jdmerge.c | 46 +++++++--------------------------
|
||||
jdmerge.h | 47 ++++++++++++++++++++++++++++++++++
|
||||
jdmrg565.c | 10 ++++----
|
||||
jdmrgext.c | 6 ++---
|
||||
6 files changed, 135 insertions(+), 53 deletions(-)
|
||||
create mode 100644 jdmerge.h
|
||||
|
||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
||||
index 2ebfe71..19d18fa 100644
|
||||
--- a/ChangeLog.md
|
||||
+++ b/ChangeLog.md
|
||||
@@ -54,6 +54,13 @@ a 16-bit binary PGM file into an RGB image buffer.
|
||||
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
|
||||
file into an extended RGB image buffer.
|
||||
|
||||
+2. Fixed segfaults or "Corrupt JPEG data: premature end of data segment" errors
|
||||
+in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or 4:2:0 JPEG
|
||||
+images using the merged (non-fancy) upsampling algorithms (that is, when
|
||||
+setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a similar fix,
|
||||
+but it did not cover all cases.
|
||||
+
|
||||
+
|
||||
2.0.3
|
||||
=====
|
||||
|
||||
diff --git a/jdapistd.c b/jdapistd.c
|
||||
index 2c808fa..91da642 100644
|
||||
--- a/jdapistd.c
|
||||
+++ b/jdapistd.c
|
||||
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
- * Copyright (C) 2010, 2015-2018, D. R. Commander.
|
||||
+ * Copyright (C) 2010, 2015-2018, 2020, D. R. Commander.
|
||||
* Copyright (C) 2015, Google, Inc.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "jinclude.h"
|
||||
#include "jdmainct.h"
|
||||
#include "jdcoefct.h"
|
||||
+#include "jdmaster.h"
|
||||
+#include "jdmerge.h"
|
||||
#include "jdsample.h"
|
||||
#include "jmemsys.h"
|
||||
|
||||
@@ -304,6 +306,16 @@ noop_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
}
|
||||
|
||||
|
||||
+/* Dummy postprocessing function used by jpeg_skip_scanlines() */
|
||||
+LOCAL(void)
|
||||
+noop_post_process (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
+ JDIMENSION *in_row_group_ctr,
|
||||
+ JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
|
||||
+ JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+
|
||||
/*
|
||||
* In some cases, it is best to call jpeg_read_scanlines() and discard the
|
||||
* output, rather than skipping the scanlines, because this allows us to
|
||||
@@ -316,11 +328,17 @@ LOCAL(void)
|
||||
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
JDIMENSION n;
|
||||
+ my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION input_row, JSAMPARRAY output_buf,
|
||||
int num_rows) = NULL;
|
||||
void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
JSAMPARRAY output_buf, int num_rows) = NULL;
|
||||
+ void (*post_process_data) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
+ JDIMENSION *in_row_group_ctr,
|
||||
+ JDIMENSION in_row_groups_avail,
|
||||
+ JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
+ JDIMENSION out_rows_avail) = NULL;
|
||||
|
||||
if (cinfo->cconvert && cinfo->cconvert->color_convert) {
|
||||
color_convert = cinfo->cconvert->color_convert;
|
||||
@@ -332,6 +350,12 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->cquantize->color_quantize = noop_quantize;
|
||||
}
|
||||
|
||||
+ if (master->using_merged_upsample && cinfo->post &&
|
||||
+ cinfo->post->post_process_data) {
|
||||
+ post_process_data = cinfo->post->post_process_data;
|
||||
+ cinfo->post->post_process_data = noop_post_process;
|
||||
+ }
|
||||
+
|
||||
for (n = 0; n < num_lines; n++)
|
||||
jpeg_read_scanlines(cinfo, NULL, 1);
|
||||
|
||||
@@ -340,6 +364,9 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
|
||||
if (color_quantize)
|
||||
cinfo->cquantize->color_quantize = color_quantize;
|
||||
+
|
||||
+ if (post_process_data)
|
||||
+ cinfo->post->post_process_data = post_process_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -382,7 +409,7 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
JDIMENSION i, x;
|
||||
int y;
|
||||
JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
|
||||
@@ -445,8 +472,16 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
- upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ if (master->using_merged_upsample) {
|
||||
+ my_merged_upsample_ptr upsample =
|
||||
+ (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->spare_full = FALSE;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ } else {
|
||||
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Skipping is much simpler when context rows are not required. */
|
||||
@@ -458,8 +493,16 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_scanline += lines_left_in_iMCU_row;
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
- upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ if (master->using_merged_upsample) {
|
||||
+ my_merged_upsample_ptr upsample =
|
||||
+ (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->spare_full = FALSE;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ } else {
|
||||
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,7 +537,14 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
|
||||
increment_simple_rowgroup_ctr(cinfo, lines_to_read);
|
||||
}
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ if (master->using_merged_upsample) {
|
||||
+ my_merged_upsample_ptr upsample =
|
||||
+ (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ } else {
|
||||
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ }
|
||||
return num_lines;
|
||||
}
|
||||
|
||||
@@ -535,7 +585,13 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
* bit odd, since "rows_to_go" seems to be redundantly keeping track of
|
||||
* output_scanline.
|
||||
*/
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ if (master->using_merged_upsample) {
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ } else {
|
||||
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
+ }
|
||||
|
||||
/* Always skip the requested number of lines. */
|
||||
return num_lines;
|
||||
diff --git a/jdmerge.c b/jdmerge.c
|
||||
index dff5a35..833ad67 100644
|
||||
--- a/jdmerge.c
|
||||
+++ b/jdmerge.c
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
- * Copyright (C) 2009, 2011, 2014-2015, D. R. Commander.
|
||||
+ * Copyright (C) 2009, 2011, 2014-2015, 2020, D. R. Commander.
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
@@ -40,41 +40,13 @@
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
+#include "jdmerge.h"
|
||||
#include "jsimd.h"
|
||||
#include "jconfigint.h"
|
||||
|
||||
#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
|
||||
|
||||
-/* Private subobject */
|
||||
-
|
||||
-typedef struct {
|
||||
- struct jpeg_upsampler pub; /* public fields */
|
||||
-
|
||||
- /* Pointer to routine to do actual upsampling/conversion of one row group */
|
||||
- void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
- JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
|
||||
-
|
||||
- /* Private state for YCC->RGB conversion */
|
||||
- int *Cr_r_tab; /* => table for Cr to R conversion */
|
||||
- int *Cb_b_tab; /* => table for Cb to B conversion */
|
||||
- JLONG *Cr_g_tab; /* => table for Cr to G conversion */
|
||||
- JLONG *Cb_g_tab; /* => table for Cb to G conversion */
|
||||
-
|
||||
- /* For 2:1 vertical sampling, we produce two output rows at a time.
|
||||
- * We need a "spare" row buffer to hold the second output row if the
|
||||
- * application provides just a one-row buffer; we also use the spare
|
||||
- * to discard the dummy last row if the image height is odd.
|
||||
- */
|
||||
- JSAMPROW spare_row;
|
||||
- boolean spare_full; /* T if spare buffer is occupied */
|
||||
-
|
||||
- JDIMENSION out_row_width; /* samples per output row */
|
||||
- JDIMENSION rows_to_go; /* counts rows remaining in image */
|
||||
-} my_upsampler;
|
||||
-
|
||||
-typedef my_upsampler *my_upsample_ptr;
|
||||
-
|
||||
#define SCALEBITS 16 /* speediest right-shift on some machines */
|
||||
#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
|
||||
#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
|
||||
@@ -189,7 +161,7 @@ typedef my_upsampler *my_upsample_ptr;
|
||||
LOCAL(void)
|
||||
build_ycc_rgb_table(j_decompress_ptr cinfo)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
int i;
|
||||
JLONG x;
|
||||
SHIFT_TEMPS
|
||||
@@ -232,7 +204,7 @@ build_ycc_rgb_table(j_decompress_ptr cinfo)
|
||||
METHODDEF(void)
|
||||
start_pass_merged_upsample(j_decompress_ptr cinfo)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
|
||||
/* Mark the spare buffer empty */
|
||||
upsample->spare_full = FALSE;
|
||||
@@ -254,7 +226,7 @@ merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
/* 2:1 vertical sampling case: may need a spare row. */
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
JSAMPROW work_ptrs[2];
|
||||
JDIMENSION num_rows; /* number of rows returned to caller */
|
||||
|
||||
@@ -305,7 +277,7 @@ merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
/* 1:1 vertical sampling case: much easier, never need a spare row. */
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
|
||||
/* Just do the upsampling. */
|
||||
(*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
|
||||
@@ -566,11 +538,11 @@ h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
GLOBAL(void)
|
||||
jinit_merged_upsampler(j_decompress_ptr cinfo)
|
||||
{
|
||||
- my_upsample_ptr upsample;
|
||||
+ my_merged_upsample_ptr upsample;
|
||||
|
||||
- upsample = (my_upsample_ptr)
|
||||
+ upsample = (my_merged_upsample_ptr)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
|
||||
- sizeof(my_upsampler));
|
||||
+ sizeof(my_merged_upsampler));
|
||||
cinfo->upsample = (struct jpeg_upsampler *)upsample;
|
||||
upsample->pub.start_pass = start_pass_merged_upsample;
|
||||
upsample->pub.need_context_rows = FALSE;
|
||||
diff --git a/jdmerge.h b/jdmerge.h
|
||||
new file mode 100644
|
||||
index 0000000..b583396
|
||||
--- /dev/null
|
||||
+++ b/jdmerge.h
|
||||
@@ -0,0 +1,47 @@
|
||||
+/*
|
||||
+ * jdmerge.h
|
||||
+ *
|
||||
+ * This file was part of the Independent JPEG Group's software:
|
||||
+ * Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
+ * libjpeg-turbo Modifications:
|
||||
+ * Copyright (C) 2020, D. R. Commander.
|
||||
+ * For conditions of distribution and use, see the accompanying README.ijg
|
||||
+ * file.
|
||||
+ */
|
||||
+
|
||||
+#define JPEG_INTERNALS
|
||||
+#include "jpeglib.h"
|
||||
+
|
||||
+#ifdef UPSAMPLE_MERGING_SUPPORTED
|
||||
+
|
||||
+
|
||||
+/* Private subobject */
|
||||
+
|
||||
+typedef struct {
|
||||
+ struct jpeg_upsampler pub; /* public fields */
|
||||
+
|
||||
+ /* Pointer to routine to do actual upsampling/conversion of one row group */
|
||||
+ void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
+ JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
|
||||
+
|
||||
+ /* Private state for YCC->RGB conversion */
|
||||
+ int *Cr_r_tab; /* => table for Cr to R conversion */
|
||||
+ int *Cb_b_tab; /* => table for Cb to B conversion */
|
||||
+ JLONG *Cr_g_tab; /* => table for Cr to G conversion */
|
||||
+ JLONG *Cb_g_tab; /* => table for Cb to G conversion */
|
||||
+
|
||||
+ /* For 2:1 vertical sampling, we produce two output rows at a time.
|
||||
+ * We need a "spare" row buffer to hold the second output row if the
|
||||
+ * application provides just a one-row buffer; we also use the spare
|
||||
+ * to discard the dummy last row if the image height is odd.
|
||||
+ */
|
||||
+ JSAMPROW spare_row;
|
||||
+ boolean spare_full; /* T if spare buffer is occupied */
|
||||
+
|
||||
+ JDIMENSION out_row_width; /* samples per output row */
|
||||
+ JDIMENSION rows_to_go; /* counts rows remaining in image */
|
||||
+} my_merged_upsampler;
|
||||
+
|
||||
+typedef my_merged_upsampler *my_merged_upsample_ptr;
|
||||
+
|
||||
+#endif /* UPSAMPLE_MERGING_SUPPORTED */
|
||||
diff --git a/jdmrg565.c b/jdmrg565.c
|
||||
index 1b87e37..53f1e16 100644
|
||||
--- a/jdmrg565.c
|
||||
+++ b/jdmrg565.c
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
* Copyright (C) 2013, Linaro Limited.
|
||||
- * Copyright (C) 2014-2015, 2018, D. R. Commander.
|
||||
+ * Copyright (C) 2014-2015, 2018, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -19,7 +19,7 @@ h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -90,7 +90,7 @@ h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -163,7 +163,7 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
@@ -259,7 +259,7 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
diff --git a/jdmrgext.c b/jdmrgext.c
|
||||
index b1c27df..c9a44d8 100644
|
||||
--- a/jdmrgext.c
|
||||
+++ b/jdmrgext.c
|
||||
@@ -4,7 +4,7 @@
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* libjpeg-turbo Modifications:
|
||||
- * Copyright (C) 2011, 2015, D. R. Commander.
|
||||
+ * Copyright (C) 2011, 2015, 2020, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README.ijg
|
||||
* file.
|
||||
*
|
||||
@@ -25,7 +25,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr;
|
||||
@@ -97,7 +97,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION in_row_group_ctr,
|
||||
JSAMPARRAY output_buf)
|
||||
{
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
register int y, cred, cgreen, cblue;
|
||||
int cb, cr;
|
||||
register JSAMPROW outptr0, outptr1;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
400
meta/recipes-graphics/jpeg/files/CVE-2020-35538-2.patch
Normal file
400
meta/recipes-graphics/jpeg/files/CVE-2020-35538-2.patch
Normal file
@@ -0,0 +1,400 @@
|
||||
From a46c111d9f3642f0ef3819e7298846ccc61869e0 Mon Sep 17 00:00:00 2001
|
||||
From: DRC <information@libjpeg-turbo.org>
|
||||
Date: Mon, 27 Jul 2020 14:21:23 -0500
|
||||
Subject: [PATCH] Further jpeg_skip_scanlines() fixes
|
||||
|
||||
- Introduce a partial image decompression regression test script that
|
||||
validates the correctness of jpeg_skip_scanlines() and
|
||||
jpeg_crop_scanlines() for a variety of cropping regions and libjpeg
|
||||
settings.
|
||||
|
||||
This regression test catches the following issues:
|
||||
#182, fixed in 5bc43c7
|
||||
#237, fixed in 6e95c08
|
||||
#244, fixed in 398c1e9
|
||||
#441, fully fixed in this commit
|
||||
|
||||
It does not catch the following issues:
|
||||
#194, fixed in 773040f
|
||||
#244 (additional segfault), fixed in
|
||||
9120a24
|
||||
|
||||
- Modify the libjpeg-turbo regression test suite (make test) so that it
|
||||
checks for the issue reported in #441 (segfault in
|
||||
jpeg_skip_scanlines() when used with 4:2:0 merged upsampling/color
|
||||
conversion.)
|
||||
|
||||
- Fix issues in jpeg_skip_scanlines() that caused incorrect output with
|
||||
h2v2 (4:2:0) merged upsampling/color conversion. The previous commit
|
||||
fixed the segfault reported in #441, but that was a symptom of a
|
||||
larger problem. Because merged 4:2:0 upsampling uses a "spare row"
|
||||
buffer, it is necessary to allow the upsampler to run when skipping
|
||||
rows (fancy 4:2:0 upsampling, which uses context rows, also requires
|
||||
this.) Otherwise, if skipping starts at an odd-numbered row, the
|
||||
output image will be incorrect.
|
||||
|
||||
- Throw an error if jpeg_skip_scanlines() is called with two-pass color
|
||||
quantization enabled. With two-pass color quantization, the first
|
||||
pass occurs within jpeg_start_decompress(), so subsequent calls to
|
||||
jpeg_skip_scanlines() interfere with the multipass state and prevent
|
||||
the second pass from occurring during subsequent calls to
|
||||
jpeg_read_scanlines().
|
||||
|
||||
Upstream-Status: Backport [https://github.com/libjpeg-turbo/libjpeg-turbo/commit/a46c111d9f3642f0ef3819e7298846ccc61869e0]
|
||||
CVE: CVE-2020-35538
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
CMakeLists.txt | 9 +++--
|
||||
ChangeLog.md | 15 +++++---
|
||||
croptest.in | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
jdapistd.c | 70 +++++++++++--------------------------
|
||||
libjpeg.txt | 6 ++--
|
||||
5 files changed, 136 insertions(+), 59 deletions(-)
|
||||
create mode 100755 croptest.in
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index aee74c9..de451f4 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -753,7 +753,7 @@ else()
|
||||
set(MD5_PPM_3x2_IFAST fd283664b3b49127984af0a7f118fccd)
|
||||
set(MD5_JPEG_420_ISLOW_ARI e986fb0a637a8d833d96e8a6d6d84ea1)
|
||||
set(MD5_JPEG_444_ISLOW_PROGARI 0a8f1c8f66e113c3cf635df0a475a617)
|
||||
- set(MD5_PPM_420M_IFAST_ARI 72b59a99bcf1de24c5b27d151bde2437)
|
||||
+ set(MD5_PPM_420M_IFAST_ARI 57251da28a35b46eecb7177d82d10e0e)
|
||||
set(MD5_JPEG_420_ISLOW 9a68f56bc76e466aa7e52f415d0f4a5f)
|
||||
set(MD5_PPM_420M_ISLOW_2_1 9f9de8c0612f8d06869b960b05abf9c9)
|
||||
set(MD5_PPM_420M_ISLOW_15_8 b6875bc070720b899566cc06459b63b7)
|
||||
@@ -1131,7 +1131,7 @@ foreach(libtype ${TEST_LIBTYPES})
|
||||
|
||||
if(WITH_ARITH_DEC)
|
||||
# CC: RGB->YCC SAMP: h2v2 merged IDCT: ifast ENT: arith
|
||||
- add_bittest(djpeg 420m-ifast-ari "-fast;-ppm"
|
||||
+ add_bittest(djpeg 420m-ifast-ari "-fast;-skip;1,20;-ppm"
|
||||
testout_420m_ifast_ari.ppm ${TESTIMAGES}/testimgari.jpg
|
||||
${MD5_PPM_420M_IFAST_ARI})
|
||||
|
||||
@@ -1266,6 +1266,11 @@ endforeach()
|
||||
add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmakescripts/testclean.cmake)
|
||||
|
||||
+configure_file(croptest.in croptest @ONLY)
|
||||
+add_custom_target(croptest
|
||||
+ COMMAND echo croptest
|
||||
+ COMMAND ${BASH} ${CMAKE_CURRENT_BINARY_DIR}/croptest)
|
||||
+
|
||||
if(WITH_TURBOJPEG)
|
||||
configure_file(tjbenchtest.in tjbenchtest @ONLY)
|
||||
configure_file(tjexampletest.in tjexampletest @ONLY)
|
||||
diff --git a/ChangeLog.md b/ChangeLog.md
|
||||
index 19d18fa..4562eff 100644
|
||||
--- a/ChangeLog.md
|
||||
+++ b/ChangeLog.md
|
||||
@@ -54,11 +54,16 @@ a 16-bit binary PGM file into an RGB image buffer.
|
||||
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
|
||||
file into an extended RGB image buffer.
|
||||
|
||||
-2. Fixed segfaults or "Corrupt JPEG data: premature end of data segment" errors
|
||||
-in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or 4:2:0 JPEG
|
||||
-images using the merged (non-fancy) upsampling algorithms (that is, when
|
||||
-setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a similar fix,
|
||||
-but it did not cover all cases.
|
||||
+2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`:
|
||||
+
|
||||
+ - Fixed segfaults or "Corrupt JPEG data: premature end of data segment"
|
||||
+errors in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or
|
||||
+4:2:0 JPEG images using merged (non-fancy) upsampling/color conversion (that
|
||||
+is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a
|
||||
+similar fix, but it did not cover all cases.
|
||||
+ - `jpeg_skip_scanlines()` now throws an error if two-pass color
|
||||
+quantization is enabled. Two-pass color quantization never worked properly
|
||||
+with `jpeg_skip_scanlines()`, and the issues could not readily be fixed.
|
||||
|
||||
|
||||
2.0.3
|
||||
diff --git a/croptest.in b/croptest.in
|
||||
new file mode 100755
|
||||
index 0000000..7e3c293
|
||||
--- /dev/null
|
||||
+++ b/croptest.in
|
||||
@@ -0,0 +1,95 @@
|
||||
+#!/bin/bash
|
||||
+
|
||||
+set -u
|
||||
+set -e
|
||||
+trap onexit INT
|
||||
+trap onexit TERM
|
||||
+trap onexit EXIT
|
||||
+
|
||||
+onexit()
|
||||
+{
|
||||
+ if [ -d $OUTDIR ]; then
|
||||
+ rm -rf $OUTDIR
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+runme()
|
||||
+{
|
||||
+ echo \*\*\* $*
|
||||
+ $*
|
||||
+}
|
||||
+
|
||||
+IMAGE=vgl_6548_0026a.bmp
|
||||
+WIDTH=128
|
||||
+HEIGHT=95
|
||||
+IMGDIR=@CMAKE_CURRENT_SOURCE_DIR@/testimages
|
||||
+OUTDIR=`mktemp -d /tmp/__croptest_output.XXXXXX`
|
||||
+EXEDIR=@CMAKE_CURRENT_BINARY_DIR@
|
||||
+
|
||||
+if [ -d $OUTDIR ]; then
|
||||
+ rm -rf $OUTDIR
|
||||
+fi
|
||||
+mkdir -p $OUTDIR
|
||||
+
|
||||
+exec >$EXEDIR/croptest.log
|
||||
+
|
||||
+echo "============================================================"
|
||||
+echo "$IMAGE ($WIDTH x $HEIGHT)"
|
||||
+echo "============================================================"
|
||||
+echo
|
||||
+
|
||||
+for PROGARG in "" -progressive; do
|
||||
+
|
||||
+ cp $IMGDIR/$IMAGE $OUTDIR
|
||||
+ basename=`basename $IMAGE .bmp`
|
||||
+ echo "------------------------------------------------------------"
|
||||
+ echo "Generating test images"
|
||||
+ echo "------------------------------------------------------------"
|
||||
+ echo
|
||||
+ runme $EXEDIR/cjpeg $PROGARG -grayscale -outfile $OUTDIR/${basename}_GRAY.jpg $IMGDIR/${basename}.bmp
|
||||
+ runme $EXEDIR/cjpeg $PROGARG -sample 2x2 -outfile $OUTDIR/${basename}_420.jpg $IMGDIR/${basename}.bmp
|
||||
+ runme $EXEDIR/cjpeg $PROGARG -sample 2x1 -outfile $OUTDIR/${basename}_422.jpg $IMGDIR/${basename}.bmp
|
||||
+ runme $EXEDIR/cjpeg $PROGARG -sample 1x2 -outfile $OUTDIR/${basename}_440.jpg $IMGDIR/${basename}.bmp
|
||||
+ runme $EXEDIR/cjpeg $PROGARG -sample 1x1 -outfile $OUTDIR/${basename}_444.jpg $IMGDIR/${basename}.bmp
|
||||
+ echo
|
||||
+
|
||||
+ for NSARG in "" -nosmooth; do
|
||||
+
|
||||
+ for COLORSARG in "" "-colors 256 -dither none -onepass"; do
|
||||
+
|
||||
+ for Y in {0..16}; do
|
||||
+
|
||||
+ for H in {1..16}; do
|
||||
+
|
||||
+ X=$(( (Y*16)%128 ))
|
||||
+ W=$(( WIDTH-X-7 ))
|
||||
+ if [ $Y -le 15 ]; then
|
||||
+ CROPSPEC="${W}x${H}+${X}+${Y}"
|
||||
+ else
|
||||
+ Y2=$(( HEIGHT-H ));
|
||||
+ CROPSPEC="${W}x${H}+${X}+${Y2}"
|
||||
+ fi
|
||||
+
|
||||
+ echo "------------------------------------------------------------"
|
||||
+ echo $PROGARG $NSARG $COLORSARG -crop $CROPSPEC
|
||||
+ echo "------------------------------------------------------------"
|
||||
+ echo
|
||||
+ for samp in GRAY 420 422 440 444; do
|
||||
+ $EXEDIR/djpeg $NSARG $COLORSARG -rgb -outfile $OUTDIR/${basename}_${samp}_full.ppm $OUTDIR/${basename}_${samp}.jpg
|
||||
+ convert -crop $CROPSPEC $OUTDIR/${basename}_${samp}_full.ppm $OUTDIR/${basename}_${samp}_ref.ppm
|
||||
+ runme $EXEDIR/djpeg $NSARG $COLORSARG -crop $CROPSPEC -rgb -outfile $OUTDIR/${basename}_${samp}.ppm $OUTDIR/${basename}_${samp}.jpg
|
||||
+ runme cmp $OUTDIR/${basename}_${samp}.ppm $OUTDIR/${basename}_${samp}_ref.ppm
|
||||
+ done
|
||||
+ echo
|
||||
+
|
||||
+ done
|
||||
+
|
||||
+ done
|
||||
+
|
||||
+ done
|
||||
+
|
||||
+ done
|
||||
+
|
||||
+done
|
||||
+
|
||||
+echo SUCCESS!
|
||||
diff --git a/jdapistd.c b/jdapistd.c
|
||||
index 91da642..c502909 100644
|
||||
--- a/jdapistd.c
|
||||
+++ b/jdapistd.c
|
||||
@@ -306,16 +306,6 @@ noop_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
}
|
||||
|
||||
|
||||
-/* Dummy postprocessing function used by jpeg_skip_scanlines() */
|
||||
-LOCAL(void)
|
||||
-noop_post_process (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
- JDIMENSION *in_row_group_ctr,
|
||||
- JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf,
|
||||
- JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
|
||||
-{
|
||||
-}
|
||||
-
|
||||
-
|
||||
/*
|
||||
* In some cases, it is best to call jpeg_read_scanlines() and discard the
|
||||
* output, rather than skipping the scanlines, because this allows us to
|
||||
@@ -329,16 +319,12 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
{
|
||||
JDIMENSION n;
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
+ JSAMPARRAY scanlines = NULL;
|
||||
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
JDIMENSION input_row, JSAMPARRAY output_buf,
|
||||
int num_rows) = NULL;
|
||||
void (*color_quantize) (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
|
||||
JSAMPARRAY output_buf, int num_rows) = NULL;
|
||||
- void (*post_process_data) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
|
||||
- JDIMENSION *in_row_group_ctr,
|
||||
- JDIMENSION in_row_groups_avail,
|
||||
- JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
|
||||
- JDIMENSION out_rows_avail) = NULL;
|
||||
|
||||
if (cinfo->cconvert && cinfo->cconvert->color_convert) {
|
||||
color_convert = cinfo->cconvert->color_convert;
|
||||
@@ -350,23 +336,19 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->cquantize->color_quantize = noop_quantize;
|
||||
}
|
||||
|
||||
- if (master->using_merged_upsample && cinfo->post &&
|
||||
- cinfo->post->post_process_data) {
|
||||
- post_process_data = cinfo->post->post_process_data;
|
||||
- cinfo->post->post_process_data = noop_post_process;
|
||||
+ if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
+ my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ scanlines = &upsample->spare_row;
|
||||
}
|
||||
|
||||
for (n = 0; n < num_lines; n++)
|
||||
- jpeg_read_scanlines(cinfo, NULL, 1);
|
||||
+ jpeg_read_scanlines(cinfo, scanlines, 1);
|
||||
|
||||
if (color_convert)
|
||||
cinfo->cconvert->color_convert = color_convert;
|
||||
|
||||
if (color_quantize)
|
||||
cinfo->cquantize->color_quantize = color_quantize;
|
||||
-
|
||||
- if (post_process_data)
|
||||
- cinfo->post->post_process_data = post_process_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -380,6 +362,12 @@ increment_simple_rowgroup_ctr(j_decompress_ptr cinfo, JDIMENSION rows)
|
||||
{
|
||||
JDIMENSION rows_left;
|
||||
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||
+ my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
+
|
||||
+ if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
|
||||
+ read_and_discard_scanlines(cinfo, rows);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
/* Increment the counter to the next row group after the skipped rows. */
|
||||
main_ptr->rowgroup_ctr += rows / cinfo->max_v_samp_factor;
|
||||
@@ -410,11 +398,16 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
|
||||
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
|
||||
my_master_ptr master = (my_master_ptr)cinfo->master;
|
||||
+ my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
JDIMENSION i, x;
|
||||
int y;
|
||||
JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
|
||||
JDIMENSION lines_to_skip, lines_to_read;
|
||||
|
||||
+ /* Two-pass color quantization is not supported. */
|
||||
+ if (cinfo->quantize_colors && cinfo->two_pass_quantize)
|
||||
+ ERREXIT(cinfo, JERR_NOTIMPL);
|
||||
+
|
||||
if (cinfo->global_state != DSTATE_SCANNING)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
@@ -472,13 +465,7 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
|
||||
- if (master->using_merged_upsample) {
|
||||
- my_merged_upsample_ptr upsample =
|
||||
- (my_merged_upsample_ptr)cinfo->upsample;
|
||||
- upsample->spare_full = FALSE;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- } else {
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ if (!master->using_merged_upsample) {
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
}
|
||||
@@ -493,13 +480,7 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_scanline += lines_left_in_iMCU_row;
|
||||
main_ptr->buffer_full = FALSE;
|
||||
main_ptr->rowgroup_ctr = 0;
|
||||
- if (master->using_merged_upsample) {
|
||||
- my_merged_upsample_ptr upsample =
|
||||
- (my_merged_upsample_ptr)cinfo->upsample;
|
||||
- upsample->spare_full = FALSE;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- } else {
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ if (!master->using_merged_upsample) {
|
||||
upsample->next_row_out = cinfo->max_v_samp_factor;
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
}
|
||||
@@ -537,14 +518,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
|
||||
increment_simple_rowgroup_ctr(cinfo, lines_to_read);
|
||||
}
|
||||
- if (master->using_merged_upsample) {
|
||||
- my_merged_upsample_ptr upsample =
|
||||
- (my_merged_upsample_ptr)cinfo->upsample;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- } else {
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
+ if (!master->using_merged_upsample)
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- }
|
||||
return num_lines;
|
||||
}
|
||||
|
||||
@@ -585,13 +560,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
|
||||
* bit odd, since "rows_to_go" seems to be redundantly keeping track of
|
||||
* output_scanline.
|
||||
*/
|
||||
- if (master->using_merged_upsample) {
|
||||
- my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
|
||||
+ if (!master->using_merged_upsample)
|
||||
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- } else {
|
||||
- my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
|
||||
- upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
|
||||
- }
|
||||
|
||||
/* Always skip the requested number of lines. */
|
||||
return num_lines;
|
||||
diff --git a/libjpeg.txt b/libjpeg.txt
|
||||
index c50cf90..c233ecb 100644
|
||||
--- a/libjpeg.txt
|
||||
+++ b/libjpeg.txt
|
||||
@@ -3,7 +3,7 @@ USING THE IJG JPEG LIBRARY
|
||||
This file was part of the Independent JPEG Group's software:
|
||||
Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding.
|
||||
libjpeg-turbo Modifications:
|
||||
-Copyright (C) 2010, 2014-2018, D. R. Commander.
|
||||
+Copyright (C) 2010, 2014-2018, 2020, D. R. Commander.
|
||||
Copyright (C) 2015, Google, Inc.
|
||||
For conditions of distribution and use, see the accompanying README.ijg file.
|
||||
|
||||
@@ -750,7 +750,9 @@ multiple rows in the JPEG image.
|
||||
|
||||
Suspending data sources are not supported by this function. Calling
|
||||
jpeg_skip_scanlines() with a suspending data source will result in undefined
|
||||
-behavior.
|
||||
+behavior. Two-pass color quantization is also not supported by this function.
|
||||
+Calling jpeg_skip_scanlines() with two-pass color quantization enabled will
|
||||
+result in an error.
|
||||
|
||||
jpeg_skip_scanlines() will not allow skipping past the bottom of the image. If
|
||||
the value of num_lines is large enough to skip past the bottom of the image,
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -14,6 +14,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
|
||||
file://0001-libjpeg-turbo-fix-package_qa-error.patch \
|
||||
file://CVE-2020-13790.patch \
|
||||
file://CVE-2021-46822.patch \
|
||||
file://CVE-2020-35538-1.patch \
|
||||
file://CVE-2020-35538-2.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "d01d9e0c28c27bc0de9f4e2e8ff49855"
|
||||
|
||||
111
meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch
Normal file
111
meta/recipes-graphics/xorg-lib/libx11/CVE-2023-3138.patch
Normal file
@@ -0,0 +1,111 @@
|
||||
From 304a654a0d57bf0f00d8998185f0360332cfa36c Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Sat, 10 Jun 2023 16:30:07 -0700
|
||||
Subject: [PATCH] InitExt.c: Add bounds checks for extension request, event, &
|
||||
error codes
|
||||
|
||||
Fixes CVE-2023-3138: X servers could return values from XQueryExtension
|
||||
that would cause Xlib to write entries out-of-bounds of the arrays to
|
||||
store them, though this would only overwrite other parts of the Display
|
||||
struct, not outside the bounds allocated for that structure.
|
||||
|
||||
Reported-by: Gregory James DUCK <gjduck@gmail.com>
|
||||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
|
||||
CVE: CVE-2023-3138
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/lib/libx11/-/commit/304a654a0d57bf0f00d8998185f0360332cfa36c.patch]
|
||||
Signed-off-by: Poonam Jadhav <poonam.jadhav@kpit.com>
|
||||
---
|
||||
src/InitExt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 42 insertions(+)
|
||||
|
||||
diff --git a/src/InitExt.c b/src/InitExt.c
|
||||
index 4de46f15..afc00a6b 100644
|
||||
--- a/src/InitExt.c
|
||||
+++ b/src/InitExt.c
|
||||
@@ -33,6 +33,18 @@ from The Open Group.
|
||||
#include <X11/Xos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
+/* The X11 protocol spec reserves events 64 through 127 for extensions */
|
||||
+#ifndef LastExtensionEvent
|
||||
+#define LastExtensionEvent 127
|
||||
+#endif
|
||||
+
|
||||
+/* The X11 protocol spec reserves requests 128 through 255 for extensions */
|
||||
+#ifndef LastExtensionRequest
|
||||
+#define FirstExtensionRequest 128
|
||||
+#define LastExtensionRequest 255
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
/*
|
||||
* This routine is used to link a extension in so it will be called
|
||||
* at appropriate times.
|
||||
@@ -242,6 +254,12 @@ WireToEventType XESetWireToEvent(
|
||||
WireToEventType proc) /* routine to call when converting event */
|
||||
{
|
||||
register WireToEventType oldproc;
|
||||
+ if (event_number < 0 ||
|
||||
+ event_number > LastExtensionEvent) {
|
||||
+ fprintf(stderr, "Xlib: ignoring invalid extension event %d\n",
|
||||
+ event_number);
|
||||
+ return (WireToEventType)_XUnknownWireEvent;
|
||||
+ }
|
||||
if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent;
|
||||
LockDisplay (dpy);
|
||||
oldproc = dpy->event_vec[event_number];
|
||||
@@ -263,6 +281,12 @@ WireToEventCookieType XESetWireToEventCookie(
|
||||
)
|
||||
{
|
||||
WireToEventCookieType oldproc;
|
||||
+ if (extension < FirstExtensionRequest ||
|
||||
+ extension > LastExtensionRequest) {
|
||||
+ fprintf(stderr, "Xlib: ignoring invalid extension opcode %d\n",
|
||||
+ extension);
|
||||
+ return (WireToEventCookieType)_XUnknownWireEventCookie;
|
||||
+ }
|
||||
if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie;
|
||||
LockDisplay (dpy);
|
||||
oldproc = dpy->generic_event_vec[extension & 0x7F];
|
||||
@@ -284,6 +308,12 @@ CopyEventCookieType XESetCopyEventCookie(
|
||||
)
|
||||
{
|
||||
CopyEventCookieType oldproc;
|
||||
+ if (extension < FirstExtensionRequest ||
|
||||
+ extension > LastExtensionRequest) {
|
||||
+ fprintf(stderr, "Xlib: ignoring invalid extension opcode %d\n",
|
||||
+ extension);
|
||||
+ return (CopyEventCookieType)_XUnknownCopyEventCookie;
|
||||
+ }
|
||||
if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie;
|
||||
LockDisplay (dpy);
|
||||
oldproc = dpy->generic_event_copy_vec[extension & 0x7F];
|
||||
@@ -305,6 +335,12 @@ EventToWireType XESetEventToWire(
|
||||
EventToWireType proc) /* routine to call when converting event */
|
||||
{
|
||||
register EventToWireType oldproc;
|
||||
+ if (event_number < 0 ||
|
||||
+ event_number > LastExtensionEvent) {
|
||||
+ fprintf(stderr, "Xlib: ignoring invalid extension event %d\n",
|
||||
+ event_number);
|
||||
+ return (EventToWireType)_XUnknownNativeEvent;
|
||||
+ }
|
||||
if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent;
|
||||
LockDisplay (dpy);
|
||||
oldproc = dpy->wire_vec[event_number];
|
||||
@@ -325,6 +361,12 @@ WireToErrorType XESetWireToError(
|
||||
WireToErrorType proc) /* routine to call when converting error */
|
||||
{
|
||||
register WireToErrorType oldproc = NULL;
|
||||
+ if (error_number < 0 ||
|
||||
+ error_number > LastExtensionError) {
|
||||
+ fprintf(stderr, "Xlib: ignoring invalid extension error %d\n",
|
||||
+ error_number);
|
||||
+ return (WireToErrorType)_XDefaultWireError;
|
||||
+ }
|
||||
if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError;
|
||||
LockDisplay (dpy);
|
||||
if (!dpy->error_vec) {
|
||||
--
|
||||
GitLab
|
||||
@@ -18,6 +18,7 @@ SRC_URI += "file://Fix-hanging-issue-in-_XReply.patch \
|
||||
file://CVE-2021-31535.patch \
|
||||
file://CVE-2022-3554.patch \
|
||||
file://CVE-2022-3555.patch \
|
||||
file://CVE-2023-3138.patch \
|
||||
"
|
||||
|
||||
SRC_URI[md5sum] = "55adbfb6d4370ecac5e70598c4e7eed2"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From 0ba6d8c37071131a49790243cdac55392ecf71ec Mon Sep 17 00:00:00 2001
|
||||
From: Peter Hutterer <peter.hutterer@who-t.net>
|
||||
Date: Wed, 25 Jan 2023 11:41:40 +1000
|
||||
Subject: [PATCH] Xi: fix potential use-after-free in DeepCopyPointerClasses
|
||||
|
||||
CVE-2023-0494, ZDI-CAN-19596
|
||||
|
||||
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>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/0ba6d8c37071131a49790243cdac55392ecf71ec]
|
||||
CVE: CVE-2023-0494
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
Xi/exevents.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Xi/exevents.c b/Xi/exevents.c
|
||||
index 217baa9561..dcd4efb3bc 100644
|
||||
--- a/Xi/exevents.c
|
||||
+++ b/Xi/exevents.c
|
||||
@@ -619,8 +619,10 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
|
||||
memcpy(to->button->xkb_acts, from->button->xkb_acts,
|
||||
sizeof(XkbAction));
|
||||
}
|
||||
- else
|
||||
+ else {
|
||||
free(to->button->xkb_acts);
|
||||
+ to->button->xkb_acts = NULL;
|
||||
+ }
|
||||
|
||||
memcpy(to->button->labels, from->button->labels,
|
||||
from->button->numButtons * sizeof(Atom));
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
From 26ef545b3502f61ca722a7a3373507e88ef64110 Mon Sep 17 00:00:00 2001
|
||||
From: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Date: Mon, 13 Mar 2023 11:08:47 +0100
|
||||
Subject: [PATCH] composite: Fix use-after-free of the COW
|
||||
|
||||
ZDI-CAN-19866/CVE-2023-1393
|
||||
|
||||
If a client explicitly destroys the compositor overlay window (aka COW),
|
||||
we would leave a dangling pointer to that window in the CompScreen
|
||||
structure, which will trigger a use-after-free later.
|
||||
|
||||
Make sure to clear the CompScreen pointer to the COW when the latter gets
|
||||
destroyed explicitly by the client.
|
||||
|
||||
This vulnerability was discovered by:
|
||||
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
|
||||
|
||||
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
||||
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/xserver/-/commit/26ef545b3502f61ca722a7a3373507e88ef64110]
|
||||
CVE: CVE-2023-1393
|
||||
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
|
||||
---
|
||||
composite/compwindow.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/composite/compwindow.c b/composite/compwindow.c
|
||||
index 4e2494b86b..b30da589e9 100644
|
||||
--- a/composite/compwindow.c
|
||||
+++ b/composite/compwindow.c
|
||||
@@ -620,6 +620,11 @@ compDestroyWindow(WindowPtr pWin)
|
||||
ret = (*pScreen->DestroyWindow) (pWin);
|
||||
cs->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = compDestroyWindow;
|
||||
+
|
||||
+ /* Did we just destroy the overlay window? */
|
||||
+ if (pWin == cs->pOverlayWin)
|
||||
+ cs->pOverlayWin = NULL;
|
||||
+
|
||||
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
GitLab
|
||||
|
||||
@@ -14,6 +14,8 @@ SRC_URI += "file://0001-xf86pciBus.c-use-Intel-ddx-only-for-pre-gen4-hardwar.pat
|
||||
file://CVE-2022-46342.patch \
|
||||
file://CVE-2022-46343.patch \
|
||||
file://CVE-2022-46344.patch \
|
||||
file://CVE-2023-0494.patch \
|
||||
file://CVE-2023-1393.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "453fc86aac8c629b3a5b77e8dcca30bf"
|
||||
SRC_URI[sha256sum] = "54b199c9280ff8bf0f73a54a759645bd0eeeda7255d1c99310d5b7595f3ac066"
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
Add 'install-ptest' rule.
|
||||
|
||||
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
|
||||
Upstream-Status: Pending
|
||||
|
||||
diff -ruN a/Makefile.am b/Makefile.am
|
||||
--- a/Makefile.am 2013-07-12 17:11:05.278331557 +0200
|
||||
+++ b/Makefile.am 2013-07-12 17:14:27.033788016 +0200
|
||||
@@ -204,6 +204,16 @@
|
||||
|
||||
distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
|
||||
|
||||
+install-ptest:
|
||||
+ @$(MKDIR_P) $(DESTDIR)/testsuite
|
||||
+ @for file in $(TESTSUITE); do \
|
||||
+ install $$file $(DESTDIR)/testsuite; \
|
||||
+ done;
|
||||
+ @sed -e 's/^Makefile/_Makefile/' < Makefile > $(DESTDIR)/Makefile
|
||||
+ @$(MKDIR_P) $(DESTDIR)/tools
|
||||
+ @cp $(noinst_SCRIPTS) $(noinst_PROGRAMS) $(DESTDIR)/tools
|
||||
+ @cp -r testsuite/rootfs testsuite/.libs $(DESTDIR)/testsuite
|
||||
+
|
||||
# ------------------------------------------------------------------------------
|
||||
# custom release helpers
|
||||
# ------------------------------------------------------------------------------
|
||||
@@ -108,7 +108,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
|
||||
file://LICENCE.OLPC;md5=5b917f9d8c061991be4f6f5f108719cd \
|
||||
file://LICENCE.open-ath9k-htc-firmware;md5=1b33c9f4d17bc4d457bdb23727046837 \
|
||||
file://LICENCE.phanfw;md5=954dcec0e051f9409812b561ea743bfa \
|
||||
file://LICENCE.qat_firmware;md5=9e7d8bea77612d7cc7d9e9b54b623062 \
|
||||
file://LICENCE.qat_firmware;md5=72de83dfd9b87be7685ed099a39fbea4 \
|
||||
file://LICENSE.qcom;md5=164e3362a538eb11d3ac51e8e134294b \
|
||||
file://LICENSE.qcom_yamato;md5=d0de0eeccaf1843a850bf7a6777eec5c \
|
||||
file://LICENCE.qla1280;md5=d6895732e622d950609093223a2c4f5d \
|
||||
@@ -134,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 = "aadb3cccbde1e53fc244a409e9bd5a22"
|
||||
WHENCE_CHKSUM = "a0997fc7a9af4e46d96529d6ef13b58a"
|
||||
|
||||
# These are not common licenses, set NO_GENERIC_LICENSE for them
|
||||
# so that the license files will be copied from fetched source
|
||||
@@ -212,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] = "6e3d9e8d52cffc4ec0dbe8533a8445328e0524a20f159a5b61c2706f983ce38a"
|
||||
SRC_URI[sha256sum] = "8b1acfa16f1ee94732a6acb50d9d6c835cf53af11068bd89ed207bbe04a1e951"
|
||||
|
||||
inherit allarch
|
||||
|
||||
1840
meta/recipes-kernel/linux/cve-exclusion.inc
Normal file
1840
meta/recipes-kernel/linux/cve-exclusion.inc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -11,13 +11,13 @@ python () {
|
||||
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
|
||||
}
|
||||
|
||||
SRCREV_machine ?= "f064f6017b7ce09ade0f365e1b7d776dc9e2e168"
|
||||
SRCREV_meta ?= "c7e2e528893abbebd14447510d38ded1ef98dcd2"
|
||||
SRCREV_machine ?= "8d8179549a233e7517523ac12887016451da2e20"
|
||||
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
|
||||
|
||||
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.237"
|
||||
LINUX_VERSION ?= "5.4.248"
|
||||
|
||||
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.237"
|
||||
LINUX_VERSION ?= "5.4.248"
|
||||
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 ?= "00c3a33c0f772ff1fa8902e8fe8856131c27a9b5"
|
||||
SRCREV_machine ?= "0693cbc007cf6a7b335edb5f78542d77b048d5dd"
|
||||
SRCREV_meta ?= "c7e2e528893abbebd14447510d38ded1ef98dcd2"
|
||||
SRCREV_machine_qemuarm ?= "ca5368c73bab4eb276a8e721df28c02ceb8f3eeb"
|
||||
SRCREV_machine ?= "abb579170926348d1518bc1a2de8cb1cdf403808"
|
||||
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
|
||||
|
||||
PV = "${LINUX_VERSION}+git${SRCPV}"
|
||||
|
||||
|
||||
@@ -56,3 +56,6 @@ do_install_append(){
|
||||
|
||||
# enable kernel-sample for oeqa/runtime/cases's ksample.py test
|
||||
KERNEL_FEATURES_append_qemuall=" features/kernel-sample/kernel-sample.scc"
|
||||
|
||||
# CVE exclusion
|
||||
include recipes-kernel/linux/cve-exclusion.inc
|
||||
|
||||
@@ -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 ?= "981be716d817e38d2d67269aab3caaa095bd2bdd"
|
||||
SRCREV_machine_qemuarm64 ?= "32083245f7eb993b85a33a8d30bd9f41128b6147"
|
||||
SRCREV_machine_qemumips ?= "4d002b5ac3b434b21ae58ac15cd73be3ae5ef5a8"
|
||||
SRCREV_machine_qemuppc ?= "82b4b51143a6beeb49efa548494bdb5c01f336b2"
|
||||
SRCREV_machine_qemuriscv64 ?= "936721bc390034d774b28393bf61808de8899718"
|
||||
SRCREV_machine_qemux86 ?= "936721bc390034d774b28393bf61808de8899718"
|
||||
SRCREV_machine_qemux86-64 ?= "936721bc390034d774b28393bf61808de8899718"
|
||||
SRCREV_machine_qemumips64 ?= "d662d749c441de5a09bfd8870cd10e41b1e27b6b"
|
||||
SRCREV_machine ?= "936721bc390034d774b28393bf61808de8899718"
|
||||
SRCREV_meta ?= "c7e2e528893abbebd14447510d38ded1ef98dcd2"
|
||||
SRCREV_machine_qemuarm ?= "68775a8671944b96c6a1ee795809f81149951f2d"
|
||||
SRCREV_machine_qemuarm64 ?= "54bc3d459501d8df9baf093a34d8bb676c207a07"
|
||||
SRCREV_machine_qemumips ?= "ba2d346cc66307fa6332b9fb86eb8ca66f30ebcd"
|
||||
SRCREV_machine_qemuppc ?= "6703d4c7c75fab78e0c72227a98aba8071d5b1c3"
|
||||
SRCREV_machine_qemuriscv64 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
|
||||
SRCREV_machine_qemux86 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
|
||||
SRCREV_machine_qemux86-64 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
|
||||
SRCREV_machine_qemumips64 ?= "66cac7d41a43594760f6ac48e848d73315cc5dd3"
|
||||
SRCREV_machine ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
|
||||
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
|
||||
|
||||
# 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.237"
|
||||
LINUX_VERSION ?= "5.4.248"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
|
||||
DEPENDS += "openssl-native util-linux-native"
|
||||
|
||||
@@ -13,7 +13,7 @@ PR = "r9"
|
||||
|
||||
PACKAGECONFIG ??= "scripting tui libunwind"
|
||||
PACKAGECONFIG[dwarf] = ",NO_DWARF=1"
|
||||
PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3"
|
||||
PACKAGECONFIG[scripting] = ",NO_LIBPERL=1 NO_LIBPYTHON=1,perl python3 python3-setuptools-native"
|
||||
# gui support was added with kernel 3.6.35
|
||||
# since 3.10 libnewt was replaced by slang
|
||||
# to cover a wide range of kernel we add both dependencies
|
||||
|
||||
@@ -5,7 +5,7 @@ LICENSE = "ISC"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=07c4f6dea3845b02a18dc00c8c87699c"
|
||||
|
||||
SRC_URI = "https://www.kernel.org/pub/software/network/${BPN}/${BP}.tar.xz"
|
||||
SRC_URI[sha256sum] = "fe81e8a8694dc4753a45087a1c4c7e1b48dee5a59f5f796ce374ea550f0b2e73"
|
||||
SRC_URI[sha256sum] = "f254d08ab3765aeae2b856222e11a95d44aef519a6663877c71ef68fae4c8c12"
|
||||
|
||||
inherit bin_package allarch
|
||||
|
||||
136
meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2022-48434.patch
Normal file
136
meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2022-48434.patch
Normal file
@@ -0,0 +1,136 @@
|
||||
From d4b7b3c03ee2baf0166ce49dff17ec9beff684db Mon Sep 17 00:00:00 2001
|
||||
From: Anton Khirnov <anton@khirnov.net>
|
||||
Date: Fri, 2 Sep 2022 22:21:27 +0200
|
||||
Subject: [PATCH] lavc/pthread_frame: avoid leaving stale hwaccel state in
|
||||
worker threads
|
||||
|
||||
This state is not refcounted, so make sure it always has a well-defined
|
||||
owner.
|
||||
|
||||
Remove the block added in 091341f2ab5bd35ca1a2aae90503adc74f8d3523, as
|
||||
this commit also solves that issue in a more general way.
|
||||
|
||||
(cherry picked from commit cc867f2c09d2b69cee8a0eccd62aff002cbbfe11)
|
||||
Signed-off-by: Anton Khirnov <anton@khirnov.net>
|
||||
(cherry picked from commit 35aa7e70e7ec350319e7634a30d8d8aa1e6ecdda)
|
||||
Signed-off-by: Anton Khirnov <anton@khirnov.net>
|
||||
(cherry picked from commit 3bc28e9d1ab33627cea3c632dd6b0c33e22e93ba)
|
||||
Signed-off-by: Anton Khirnov <anton@khirnov.net>
|
||||
|
||||
CVE: CVE-2022-48434
|
||||
Upstream-Status: Backport [https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/d4b7b3c03ee2baf0166ce49dff17ec9beff684db]
|
||||
Signed-off-by: Ranjitsinh Rathod ranjitsinh.rathod@kpit.com
|
||||
Comment: Hunk#6 refreshed to backport changes and other to remove patch-fuzz warnings
|
||||
---
|
||||
libavcodec/pthread_frame.c | 46 +++++++++++++++++++++++++++++---------
|
||||
1 file changed, 35 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
|
||||
index 36ac0ac..bbc5ba6 100644
|
||||
--- a/libavcodec/pthread_frame.c
|
||||
+++ b/libavcodec/pthread_frame.c
|
||||
@@ -135,6 +135,12 @@ typedef struct FrameThreadContext {
|
||||
* Set for the first N packets, where N is the number of threads.
|
||||
* While it is set, ff_thread_en/decode_frame won't return any results.
|
||||
*/
|
||||
+
|
||||
+ /* hwaccel state is temporarily stored here in order to transfer its ownership
|
||||
+ * to the next decoding thread without the need for extra synchronization */
|
||||
+ const AVHWAccel *stash_hwaccel;
|
||||
+ void *stash_hwaccel_context;
|
||||
+ void *stash_hwaccel_priv;
|
||||
} FrameThreadContext;
|
||||
|
||||
#define THREAD_SAFE_CALLBACKS(avctx) \
|
||||
@@ -211,9 +217,17 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
|
||||
ff_thread_finish_setup(avctx);
|
||||
|
||||
if (p->hwaccel_serializing) {
|
||||
+ /* wipe hwaccel state to avoid stale pointers lying around;
|
||||
+ * the state was transferred to FrameThreadContext in
|
||||
+ * ff_thread_finish_setup(), so nothing is leaked */
|
||||
+ avctx->hwaccel = NULL;
|
||||
+ avctx->hwaccel_context = NULL;
|
||||
+ avctx->internal->hwaccel_priv_data = NULL;
|
||||
+
|
||||
p->hwaccel_serializing = 0;
|
||||
pthread_mutex_unlock(&p->parent->hwaccel_mutex);
|
||||
}
|
||||
+ av_assert0(!avctx->hwaccel);
|
||||
|
||||
if (p->async_serializing) {
|
||||
p->async_serializing = 0;
|
||||
@@ -275,14 +289,10 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
|
||||
dst->color_range = src->color_range;
|
||||
dst->chroma_sample_location = src->chroma_sample_location;
|
||||
|
||||
- dst->hwaccel = src->hwaccel;
|
||||
- dst->hwaccel_context = src->hwaccel_context;
|
||||
-
|
||||
dst->channels = src->channels;
|
||||
dst->sample_rate = src->sample_rate;
|
||||
dst->sample_fmt = src->sample_fmt;
|
||||
dst->channel_layout = src->channel_layout;
|
||||
- dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
|
||||
|
||||
if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
|
||||
(dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) {
|
||||
@@ -415,6 +425,12 @@ static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
|
||||
pthread_mutex_unlock(&p->mutex);
|
||||
return err;
|
||||
}
|
||||
+
|
||||
+ /* transfer hwaccel state stashed from previous thread, if any */
|
||||
+ av_assert0(!p->avctx->hwaccel);
|
||||
+ FFSWAP(const AVHWAccel*, p->avctx->hwaccel, fctx->stash_hwaccel);
|
||||
+ FFSWAP(void*, p->avctx->hwaccel_context, fctx->stash_hwaccel_context);
|
||||
+ FFSWAP(void*, p->avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv);
|
||||
}
|
||||
|
||||
av_packet_unref(&p->avpkt);
|
||||
@@ -616,6 +632,14 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
|
||||
async_lock(p->parent);
|
||||
}
|
||||
|
||||
+ /* save hwaccel state for passing to the next thread;
|
||||
+ * this is done here so that this worker thread can wipe its own hwaccel
|
||||
+ * state after decoding, without requiring synchronization */
|
||||
+ av_assert0(!p->parent->stash_hwaccel);
|
||||
+ p->parent->stash_hwaccel = avctx->hwaccel;
|
||||
+ p->parent->stash_hwaccel_context = avctx->hwaccel_context;
|
||||
+ p->parent->stash_hwaccel_priv = avctx->internal->hwaccel_priv_data;
|
||||
+
|
||||
pthread_mutex_lock(&p->progress_mutex);
|
||||
if(atomic_load(&p->state) == STATE_SETUP_FINISHED){
|
||||
av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
|
||||
@@ -657,13 +681,6 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
|
||||
park_frame_worker_threads(fctx, thread_count);
|
||||
|
||||
- if (fctx->prev_thread && fctx->prev_thread != fctx->threads)
|
||||
- if (update_context_from_thread(fctx->threads->avctx, fctx->prev_thread->avctx, 0) < 0) {
|
||||
- av_log(avctx, AV_LOG_ERROR, "Final thread update failed\n");
|
||||
- fctx->prev_thread->avctx->internal->is_copy = fctx->threads->avctx->internal->is_copy;
|
||||
- fctx->threads->avctx->internal->is_copy = 1;
|
||||
- }
|
||||
-
|
||||
for (i = 0; i < thread_count; i++) {
|
||||
PerThreadContext *p = &fctx->threads[i];
|
||||
|
||||
@@ -713,6 +730,13 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
|
||||
pthread_mutex_destroy(&fctx->async_mutex);
|
||||
pthread_cond_destroy(&fctx->async_cond);
|
||||
|
||||
+ /* if we have stashed hwaccel state, move it to the user-facing context,
|
||||
+ * so it will be freed in avcodec_close() */
|
||||
+ av_assert0(!avctx->hwaccel);
|
||||
+ FFSWAP(const AVHWAccel*, avctx->hwaccel, fctx->stash_hwaccel);
|
||||
+ FFSWAP(void*, avctx->hwaccel_context, fctx->stash_hwaccel_context);
|
||||
+ FFSWAP(void*, avctx->internal->hwaccel_priv_data, fctx->stash_hwaccel_priv);
|
||||
+
|
||||
av_freep(&avctx->internal->thread_ctx);
|
||||
|
||||
if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -32,6 +32,7 @@ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \
|
||||
file://CVE-2022-1475.patch \
|
||||
file://CVE-2022-3109.patch \
|
||||
file://CVE-2022-3341.patch \
|
||||
file://CVE-2022-48434.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "348956fc2faa57a2f79bbb84ded9fbc3"
|
||||
SRC_URI[sha256sum] = "cb754255ab0ee2ea5f66f8850e1bd6ad5cac1cd855d0a2f4990fb8c668b0d29c"
|
||||
|
||||
29
meta/recipes-multimedia/libpng/files/run-ptest
Normal file
29
meta/recipes-multimedia/libpng/files/run-ptest
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
./pngfix pngtest.png &> log.txt 2>&1
|
||||
|
||||
if grep -i "OK" log.txt 2>&1 ; then
|
||||
echo "PASS: pngfix passed"
|
||||
else
|
||||
echo "FAIL: pngfix failed"
|
||||
fi
|
||||
rm -f log.txt
|
||||
|
||||
./pngtest pngtest.png &> log.txt 2>&1
|
||||
|
||||
if grep -i "PASS" log.txt 2>&1 ; then
|
||||
echo "PASS: pngtest passed"
|
||||
else
|
||||
echo "FAIL: pngtest failed"
|
||||
fi
|
||||
rm -f log.txt
|
||||
|
||||
for i in pngstest timepng; do
|
||||
if "./${i}" pngtest.png 2>&1; then
|
||||
echo "PASS: $i"
|
||||
else
|
||||
echo "FAIL: $i"
|
||||
fi
|
||||
done
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user