mirror of
https://git.yoctoproject.org/poky
synced 2026-02-21 17:09:42 +01:00
Compare commits
142 Commits
kirkstone-
...
yocto-4.0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc697fe874 | ||
|
|
5ded548a1e | ||
|
|
18469232f6 | ||
|
|
a81330c455 | ||
|
|
49b2b70749 | ||
|
|
da8512f9b0 | ||
|
|
62257379ea | ||
|
|
aa12c43757 | ||
|
|
756c144ee1 | ||
|
|
d3153b2847 | ||
|
|
55724a7c45 | ||
|
|
ab6c16cb55 | ||
|
|
17760d65dd | ||
|
|
5e0dd7be76 | ||
|
|
8bc1f7e015 | ||
|
|
7f8a4aa6cf | ||
|
|
7412714f7d | ||
|
|
c71fb0017d | ||
|
|
7d75bf2e97 | ||
|
|
351dca5a44 | ||
|
|
263d5df539 | ||
|
|
8a6e38dd24 | ||
|
|
1e8fd09f78 | ||
|
|
c4c9531c9b | ||
|
|
075d712b28 | ||
|
|
1a63c9703f | ||
|
|
b4a7ec6e0e | ||
|
|
ab62b82a81 | ||
|
|
0498db775a | ||
|
|
a3983ed726 | ||
|
|
0e22295713 | ||
|
|
43b94d2b84 | ||
|
|
aab6fc20de | ||
|
|
51d6afc92f | ||
|
|
933033e54e | ||
|
|
20c192f0ec | ||
|
|
916105b352 | ||
|
|
fb53a9ec2b | ||
|
|
875400f96f | ||
|
|
f83291a946 | ||
|
|
15f7694793 | ||
|
|
3c6eb39773 | ||
|
|
1e6f147c68 | ||
|
|
ae34dbb410 | ||
|
|
b32d7da361 | ||
|
|
ab21fd0ec1 | ||
|
|
08252caaee | ||
|
|
ce8b35569a | ||
|
|
fdc1438438 | ||
|
|
5f26c81523 | ||
|
|
7cfdccfa4a | ||
|
|
b6c3cba355 | ||
|
|
011b8b4758 | ||
|
|
d68f782872 | ||
|
|
8f3b0b8e9b | ||
|
|
2afcf3e39f | ||
|
|
17955962d7 | ||
|
|
1184ea6f5e | ||
|
|
7350eae0c4 | ||
|
|
075e7e6d8c | ||
|
|
75b7d31614 | ||
|
|
722ace0444 | ||
|
|
950f4c74a6 | ||
|
|
9827c47368 | ||
|
|
ef68c9166b | ||
|
|
2118c5b7f8 | ||
|
|
1ba75c259c | ||
|
|
c6d6808e72 | ||
|
|
c94d5b8771 | ||
|
|
ed2a92b55d | ||
|
|
d81118899d | ||
|
|
9a514e19fa | ||
|
|
a23ae80a37 | ||
|
|
80bf4d4f9a | ||
|
|
65a57df04c | ||
|
|
645fd39e4b | ||
|
|
971da34872 | ||
|
|
b7f72b6d88 | ||
|
|
c84f68642e | ||
|
|
8af917d572 | ||
|
|
f72863d66e | ||
|
|
f53ab3a2ff | ||
|
|
133d542a70 | ||
|
|
53e8446fe7 | ||
|
|
115d07b2d4 | ||
|
|
2aa20e8400 | ||
|
|
9c9bfe0692 | ||
|
|
26a7a415eb | ||
|
|
77feabea24 | ||
|
|
5f19045917 | ||
|
|
cb7fea11fc | ||
|
|
0dcf471954 | ||
|
|
2f06076f97 | ||
|
|
11e2400b24 | ||
|
|
9b2a6b3f3f | ||
|
|
a30cde8c0c | ||
|
|
6d618c1b8b | ||
|
|
04316b4f47 | ||
|
|
a8216f8f7c | ||
|
|
a0602dc6b5 | ||
|
|
2337b81140 | ||
|
|
1367249c99 | ||
|
|
5ffa1afb93 | ||
|
|
8876f53021 | ||
|
|
2396bda079 | ||
|
|
2d215bee87 | ||
|
|
614a9a6f9f | ||
|
|
7535036adb | ||
|
|
f6b797d05d | ||
|
|
f90eb43a15 | ||
|
|
7aac01a2a7 | ||
|
|
813d4715e4 | ||
|
|
75239ddd8d | ||
|
|
e2ab82659d | ||
|
|
c98c4d74dc | ||
|
|
ca44c2d0dc | ||
|
|
6bfa8de856 | ||
|
|
73a0bba157 | ||
|
|
3ea761ed88 | ||
|
|
944251c78b | ||
|
|
f821e134f8 | ||
|
|
bfe251d727 | ||
|
|
9971a61f08 | ||
|
|
20e0e5ebfb | ||
|
|
6cff3875fe | ||
|
|
4cc0e9438b | ||
|
|
c34e0e1e0f | ||
|
|
d19f7ddf5a | ||
|
|
7eb99a6fe9 | ||
|
|
e8eab42415 | ||
|
|
82be2c179a | ||
|
|
d8ff3c3fb3 | ||
|
|
4fa1c52c9e | ||
|
|
be5ebd6b3f | ||
|
|
ee5ff08d87 | ||
|
|
fa856e0dac | ||
|
|
29f64c072c | ||
|
|
217a47bdb4 | ||
|
|
25aa5dfcae | ||
|
|
762c35a049 | ||
|
|
7fdc49e7ae | ||
|
|
dea0c1e1f5 |
@@ -25,8 +25,7 @@ except RuntimeError as exc:
|
||||
from bb import cookerdata
|
||||
from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException
|
||||
|
||||
if sys.getfilesystemencoding() != "utf-8":
|
||||
sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.")
|
||||
bb.utils.check_system_locale()
|
||||
|
||||
__version__ = "2.0.0"
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@ warnings.simplefilter("default")
|
||||
import logging
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
|
||||
|
||||
if sys.getfilesystemencoding() != "utf-8":
|
||||
sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.")
|
||||
import bb
|
||||
|
||||
bb.utils.check_system_locale()
|
||||
|
||||
# Users shouldn't be running this code directly
|
||||
if len(sys.argv) != 10 or not sys.argv[1].startswith("decafbad"):
|
||||
|
||||
@@ -24,8 +24,7 @@ import subprocess
|
||||
from multiprocessing import Lock
|
||||
from threading import Thread
|
||||
|
||||
if sys.getfilesystemencoding() != "utf-8":
|
||||
sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.")
|
||||
bb.utils.check_system_locale()
|
||||
|
||||
# Users shouldn't be running this code directly
|
||||
if len(sys.argv) != 2 or not sys.argv[1].startswith("decafbad"):
|
||||
|
||||
@@ -13,6 +13,7 @@ import errno
|
||||
import logging
|
||||
import bb
|
||||
import bb.msg
|
||||
import locale
|
||||
import multiprocessing
|
||||
import fcntl
|
||||
import importlib
|
||||
@@ -606,6 +607,21 @@ def preserved_envvars():
|
||||
]
|
||||
return v + preserved_envvars_exported()
|
||||
|
||||
def check_system_locale():
|
||||
"""Make sure the required system locale are available and configured"""
|
||||
default_locale = locale.getlocale(locale.LC_CTYPE)
|
||||
|
||||
try:
|
||||
locale.setlocale(locale.LC_CTYPE, ("en_US", "UTF-8"))
|
||||
except:
|
||||
sys.exit("Please make sure locale 'en_US.UTF-8' is available on your system")
|
||||
else:
|
||||
locale.setlocale(locale.LC_CTYPE, default_locale)
|
||||
|
||||
if sys.getfilesystemencoding() != "utf-8":
|
||||
sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\n"
|
||||
"Python can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.")
|
||||
|
||||
def filter_environment(good_vars):
|
||||
"""
|
||||
Create a pristine environment for bitbake. This will remove variables that
|
||||
|
||||
@@ -90,7 +90,8 @@ rst_prolog = """
|
||||
|
||||
# external links and substitutions
|
||||
extlinks = {
|
||||
'cve': ('https://nvd.nist.gov/vuln/detail/CVE-%s', 'CVE-'),
|
||||
'cve': ('https://nvd.nist.gov/vuln/detail/CVE-%s', 'CVE-%s'),
|
||||
'cve_mitre': ('https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-%s', 'CVE-%s'),
|
||||
'yocto_home': ('https://www.yoctoproject.org%s', None),
|
||||
'yocto_wiki': ('https://wiki.yoctoproject.org/wiki%s', None),
|
||||
'yocto_dl': ('https://downloads.yoctoproject.org%s', None),
|
||||
|
||||
@@ -15,3 +15,5 @@ Release 4.0 (kirkstone)
|
||||
release-notes-4.0.6
|
||||
release-notes-4.0.7
|
||||
release-notes-4.0.8
|
||||
release-notes-4.0.9
|
||||
release-notes-4.0.10
|
||||
|
||||
180
documentation/migration-guides/release-notes-4.0.10.rst
Normal file
180
documentation/migration-guides/release-notes-4.0.10.rst
Normal file
@@ -0,0 +1,180 @@
|
||||
.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
|
||||
|
||||
Release notes for Yocto-4.0.10 (Kirkstone)
|
||||
------------------------------------------
|
||||
|
||||
Security Fixes in Yocto-4.0.10
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- binutils: Fix :cve:`2023-1579`, :cve:`2023-1972`, :cve_mitre:`2023-25584`, :cve_mitre:`2023-25585` and :cve_mitre:`2023-25588`
|
||||
- cargo : Ignore :cve:`2022-46176`
|
||||
- connman: Fix :cve:`2023-28488`
|
||||
- curl: Fix :cve:`2023-27533`, :cve:`2023-27534`, :cve:`2023-27535`, :cve:`2023-27536` and :cve:`2023-27538`
|
||||
- ffmpeg: Fix :cve:`2022-48434`
|
||||
- freetype: Fix :cve:`2023-2004`
|
||||
- ghostscript: Fix :cve_mitre:`2023-29979`
|
||||
- git: Fix :cve:`2023-25652` and :cve:`2023-29007`
|
||||
- go: Fix :cve:`2022-41722`, :cve:`2022-41724`, :cve:`2022-41725`, :cve:`2023-24534`, :cve:`2023-24537` and :cve:`2023-24538`
|
||||
- go: Ignore :cve:`2022-41716`
|
||||
- libxml2: Fix :cve:`2023-28484` and :cve:`2023-29469`
|
||||
- libxpm: Fix :cve:`2022-44617`, :cve:`2022-46285` and :cve:`2022-4883`
|
||||
- linux-yocto: Ignore :cve:`2021-3759`, :cve:`2021-4135`, :cve:`2021-4155`, :cve:`2022-0168`, :cve:`2022-0171`, :cve:`2022-1016`, :cve:`2022-1184`, :cve:`2022-1198`, :cve:`2022-1199`, :cve:`2022-1462`, :cve:`2022-1734`, :cve:`2022-1852`, :cve:`2022-1882`, :cve:`2022-1998`, :cve:`2022-2078`, :cve:`2022-2196`, :cve:`2022-2318`, :cve:`2022-2380`, :cve:`2022-2503`, :cve:`2022-26365`, :cve:`2022-2663`, :cve:`2022-2873`, :cve:`2022-2905`, :cve:`2022-2959`, :cve:`2022-3028`, :cve:`2022-3078`, :cve:`2022-3104`, :cve:`2022-3105`, :cve:`2022-3106`, :cve:`2022-3107`, :cve:`2022-3111`, :cve:`2022-3112`, :cve:`2022-3113`, :cve:`2022-3115`, :cve:`2022-3202`, :cve:`2022-32250`, :cve:`2022-32296`, :cve:`2022-32981`, :cve:`2022-3303`, :cve:`2022-33740`, :cve:`2022-33741`, :cve:`2022-33742`, :cve:`2022-33743`, :cve:`2022-33744`, :cve:`2022-33981`, :cve:`2022-3424`, :cve:`2022-3435`, :cve:`2022-34918`, :cve:`2022-3521`, :cve:`2022-3545`, :cve:`2022-3564`, :cve:`2022-3586`, :cve:`2022-3594`, :cve:`2022-36123`, :cve:`2022-3621`, :cve:`2022-3623`, :cve:`2022-3629`, :cve:`2022-3633`, :cve:`2022-3635`, :cve:`2022-3646`, :cve:`2022-3649`, :cve:`2022-36879`, :cve:`2022-36946`, :cve:`2022-3707`, :cve:`2022-39188`, :cve:`2022-39190`, :cve:`2022-39842`, :cve:`2022-40307`, :cve:`2022-40768`, :cve:`2022-4095`, :cve:`2022-41218`, :cve:`2022-4139`, :cve:`2022-41849`, :cve:`2022-41850`, :cve:`2022-41858`, :cve:`2022-42328`, :cve:`2022-42329`, :cve:`2022-42703`, :cve:`2022-42721`, :cve:`2022-42722`, :cve:`2022-42895`, :cve:`2022-4382`, :cve:`2022-4662`, :cve:`2022-47518`, :cve:`2022-47519`, :cve:`2022-47520`, :cve:`2022-47929`, :cve:`2023-0179`, :cve:`2023-0394`, :cve:`2023-0461`, :cve:`2023-0590`, :cve:`2023-1073`, :cve:`2023-1074`, :cve:`2023-1077`, :cve:`2023-1078`, :cve:`2023-1079`, :cve:`2023-1095`, :cve:`2023-1118`, :cve:`2023-1249`, :cve:`2023-1252`, :cve:`2023-1281`, :cve:`2023-1382`, :cve:`2023-1513`, :cve:`2023-1829`, :cve:`2023-1838`, :cve:`2023-1998`, :cve:`2023-2006`, :cve:`2023-2008`, :cve:`2023-2162`, :cve:`2023-2166`, :cve:`2023-2177`, :cve:`2023-22999`, :cve:`2023-23002`, :cve:`2023-23004`, :cve:`2023-23454`, :cve:`2023-23455`, :cve:`2023-23559`, :cve:`2023-25012`, :cve:`2023-26545`, :cve:`2023-28327` and :cve:`2023-28328`
|
||||
- nasm: Fix :cve:`2022-44370`
|
||||
- python3-cryptography: Fix :cve:`2023-23931`
|
||||
- qemu: Ignore :cve:`2023-0664`
|
||||
- ruby: Fix :cve:`2023-28755` and :cve:`2023-28756`
|
||||
- screen: Fix :cve:`2023-24626`
|
||||
- shadow: Fix :cve:`2023-29383`
|
||||
- tiff: Fix :cve:`2022-4645`
|
||||
- webkitgtk: Fix :cve:`2022-32888` and :cve:`2022-32923`
|
||||
- xserver-xorg: Fix :cve:`2023-1393`
|
||||
|
||||
|
||||
Fixes in Yocto-4.0.10
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- bitbake: bin/utils: Ensure locale en_US.UTF-8 is available on the system
|
||||
- build-appliance-image: Update to kirkstone head revision
|
||||
- cmake: add CMAKE_SYSROOT to generated toolchain file
|
||||
- glibc: stable 2.35 branch updates.
|
||||
- kernel-devsrc: depend on python3-core instead of python3
|
||||
- kernel: improve initramfs bundle processing time
|
||||
- libarchive: Enable acls, xattr for native as well as target
|
||||
- libbsd: Add correct license for all packages
|
||||
- libpam: Fix the xtests/tst-pam_motd[1|3] failures
|
||||
- libxpm: upgrade to 3.5.15
|
||||
- linux-firmware: upgrade to 20230404
|
||||
- linux-yocto/5.15: upgrade to v5.15.108
|
||||
- migration-guides: add release-notes for 4.0.9
|
||||
- oeqa/utils/metadata.py: Fix running oe-selftest running with no distro set
|
||||
- openssl: Move microblaze to linux-latomic config
|
||||
- package.bbclass: correct check for /build in copydebugsources()
|
||||
- poky.conf: bump version for 4.0.10
|
||||
- populate_sdk_base: add zip options
|
||||
- populate_sdk_ext.bbclass: set :term:`METADATA_REVISION` with an :term:`DISTRO` override
|
||||
- run-postinsts: Set dependency for ldconfig to avoid boot issues
|
||||
- update-alternatives.bbclass: fix old override syntax
|
||||
- wic/bootimg-efi: if fixed-size is set then use that for mkdosfs
|
||||
- wpebackend-fdo: upgrade to 1.14.2
|
||||
- xorg-lib-common: Add variable to set tarball type
|
||||
- xserver-xorg: upgrade to 21.1.8
|
||||
|
||||
|
||||
Known Issues in Yocto-4.0.10
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- N/A
|
||||
|
||||
|
||||
Contributors to Yocto-4.0.10
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Archana Polampalli
|
||||
- Arturo Buzarra
|
||||
- Bruce Ashfield
|
||||
- Christoph Lauer
|
||||
- Deepthi Hemraj
|
||||
- Dmitry Baryshkov
|
||||
- Frank de Brabander
|
||||
- Hitendra Prajapati
|
||||
- Joe Slater
|
||||
- Kai Kang
|
||||
- Kyle Russell
|
||||
- Lee Chee Yang
|
||||
- Mark Hatle
|
||||
- Martin Jansa
|
||||
- Mingli Yu
|
||||
- Narpat Mali
|
||||
- Pascal Bach
|
||||
- Pawan Badganchi
|
||||
- Peter Bergin
|
||||
- Peter Marko
|
||||
- Piotr Łobacz
|
||||
- Randolph Sapp
|
||||
- Ranjitsinh Rathod
|
||||
- Ross Burton
|
||||
- Shubham Kulkarni
|
||||
- Siddharth Doshi
|
||||
- Steve Sakoman
|
||||
- Sundeep KOKKONDA
|
||||
- Thomas Roos
|
||||
- Virendra Thakur
|
||||
- Vivek Kumbhar
|
||||
- Wang Mingyu
|
||||
- Xiangyu Chen
|
||||
- Yash Shinde
|
||||
- Yoann Congal
|
||||
- Yogita Urade
|
||||
- Zhixiong Chi
|
||||
|
||||
|
||||
Repositories / Downloads for Yocto-4.0.10
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
poky
|
||||
|
||||
- Repository Location: :yocto_git:`/poky`
|
||||
- Branch: :yocto_git:`kirkstone </poky/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.10 </poky/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :yocto_git:`f53ab3a2ff206a130cdc843839dd0ea5ec4ad02f </poky/commit/?id=f53ab3a2ff206a130cdc843839dd0ea5ec4ad02f>`
|
||||
- Release Artefact: poky-f53ab3a2ff206a130cdc843839dd0ea5ec4ad02f
|
||||
- sha: 8820aeac857ce6bbd1c7ef26cadbb86eca02be93deded253b4a5f07ddd69255d
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.10/poky-f53ab3a2ff206a130cdc843839dd0ea5ec4ad02f.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.10/poky-f53ab3a2ff206a130cdc843839dd0ea5ec4ad02f.tar.bz2
|
||||
|
||||
openembedded-core
|
||||
|
||||
- Repository Location: :oe_git:`/openembedded-core`
|
||||
- Branch: :oe_git:`kirkstone </openembedded-core/log/?h=kirkstone>`
|
||||
- Tag: :oe_git:`yocto-4.0.10 </openembedded-core/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :oe_git:`d2713785f9cd2d58731df877bc8b7bcc71b6c8e6 </openembedded-core/commit/?id=d2713785f9cd2d58731df877bc8b7bcc71b6c8e6>`
|
||||
- Release Artefact: oecore-d2713785f9cd2d58731df877bc8b7bcc71b6c8e6
|
||||
- sha: 78e084a1aceaaa6ec022702f29f80eaffade3159e9c42b6b8985c1b7ddd2fbab
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.10/oecore-d2713785f9cd2d58731df877bc8b7bcc71b6c8e6.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.10/oecore-d2713785f9cd2d58731df877bc8b7bcc71b6c8e6.tar.bz2
|
||||
|
||||
meta-mingw
|
||||
|
||||
- Repository Location: :yocto_git:`/meta-mingw`
|
||||
- Branch: :yocto_git:`kirkstone </meta-mingw/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.10 </meta-mingw/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :yocto_git:`a90614a6498c3345704e9611f2842eb933dc51c1 </meta-mingw/commit/?id=a90614a6498c3345704e9611f2842eb933dc51c1>`
|
||||
- Release Artefact: meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1
|
||||
- sha: 49f9900bfbbc1c68136f8115b314e95d0b7f6be75edf36a75d9bcd1cca7c6302
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.10/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.10/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
|
||||
|
||||
meta-gplv2
|
||||
|
||||
- Repository Location: :yocto_git:`/meta-gplv2`
|
||||
- Branch: :yocto_git:`kirkstone </meta-gplv2/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.10 </meta-gplv2/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :yocto_git:`d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a </meta-gplv2/commit/?id=d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a>`
|
||||
- Release Artefact: meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a
|
||||
- sha: c386f59f8a672747dc3d0be1d4234b6039273d0e57933eb87caa20f56b9cca6d
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.10/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.10/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
|
||||
|
||||
bitbake
|
||||
|
||||
- Repository Location: :oe_git:`/bitbake`
|
||||
- Branch: :oe_git:`2.0 </bitbake/log/?h=2.0>`
|
||||
- Tag: :oe_git:`yocto-4.0.10 </bitbake/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :oe_git:`0c6f86b60cfba67c20733516957c0a654eb2b44c </bitbake/commit/?id=0c6f86b60cfba67c20733516957c0a654eb2b44c>`
|
||||
- Release Artefact: bitbake-0c6f86b60cfba67c20733516957c0a654eb2b44c
|
||||
- sha: 4caa94ee4d644017b0cc51b702e330191677f7d179018cbcec8b1793949ebc74
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.10/bitbake-0c6f86b60cfba67c20733516957c0a654eb2b44c.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.10/bitbake-0c6f86b60cfba67c20733516957c0a654eb2b44c.tar.bz2
|
||||
|
||||
yocto-docs
|
||||
|
||||
- Repository Location: :yocto_git:`/yocto-docs`
|
||||
- Branch: :yocto_git:`kirkstone </yocto-docs/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.10 </yocto-docs/log/?h=yocto-4.0.10>`
|
||||
- Git Revision: :yocto_git:`8388be749806bd0bf4fccf1005dae8f643aa4ef4 </yocto-docs/commit/?id=8388be749806bd0bf4fccf1005dae8f643aa4ef4>`
|
||||
|
||||
@@ -7,7 +7,7 @@ Security Fixes in Yocto-4.0.7
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- binutils: Fix :cve:`2022-4285`
|
||||
- curl: Fix :cve:`2022-43551` and `CVE-2022-43552 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-43552>`__
|
||||
- curl: Fix :cve:`2022-43551` and :cve_mitre:`2022-43552`
|
||||
- ffmpeg: Fix :cve:`2022-3109` and :cve:`2022-3341`
|
||||
- go: Fix :cve:`2022-41715` and :cve:`2022-41717`
|
||||
- libX11: Fix :cve:`2022-3554` and :cve:`2022-3555`
|
||||
@@ -24,7 +24,7 @@ Security Fixes in Yocto-4.0.7
|
||||
- sqlite: Fix :cve:`2022-46908`
|
||||
- systemd: Fix :cve:`2022-45873`
|
||||
- vim: Fix :cve:`2023-0049`, :cve:`2023-0051`, :cve:`2023-0054` and :cve:`2023-0088`
|
||||
- webkitgtk: Fix :cve:`2022-32886`, `CVE-2022-32891 <https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-32891>`__ and :cve:`2022-32912`
|
||||
- webkitgtk: Fix :cve:`2022-32886`, :cve_mitre:`2022-32891`
|
||||
|
||||
|
||||
Fixes in Yocto-4.0.7
|
||||
|
||||
247
documentation/migration-guides/release-notes-4.0.9.rst
Normal file
247
documentation/migration-guides/release-notes-4.0.9.rst
Normal file
@@ -0,0 +1,247 @@
|
||||
Release notes for Yocto-4.0.9 (Kirkstone)
|
||||
-----------------------------------------
|
||||
|
||||
Security Fixes in Yocto-4.0.9
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- binutils: Fix :cve:`2023-22608`
|
||||
- curl: Fix :cve:`2023-23914`, :cve:`2023-23915` and :cve:`2023-23916`
|
||||
- epiphany: Fix :cve:`2023-26081`
|
||||
- git: Ignore :cve:`2023-22743`
|
||||
- glibc: Fix :cve:`2023-0687`
|
||||
- gnutls: Fix :cve:`2023-0361`
|
||||
- go: Fix :cve:`2022-2879`, :cve:`2022-41720` and :cve:`2022-41723`
|
||||
- harfbuzz: Fix :cve:`2023-25193`
|
||||
- less: Fix :cve:`2022-46663`
|
||||
- libmicrohttpd: Fix :cve:`2023-27371`
|
||||
- libsdl2: Fix :cve:`2022-4743`
|
||||
- openssl: Fix :cve:`2022-3996`, :cve:`2023-0464`, :cve:`2023-0465` and :cve:`2023-0466`
|
||||
- pkgconf: Fix :cve:`2023-24056`
|
||||
- python3: Fix :cve:`2023-24329`
|
||||
- shadow: Ignore :cve:`2016-15024`
|
||||
- systemd: Fix :cve:`2022-4415`
|
||||
- tiff: Fix :cve:`2023-0800`, :cve:`2023-0801`, :cve:`2023-0802`, :cve:`2023-0803` and :cve:`2023-0804`
|
||||
- vim: Fix :cve:`2023-0433`, :cve:`2023-0512`, :cve:`2023-1127`, :cve:`2023-1170`, :cve:`2023-1175`, :cve:`2023-1264` and :cve:`2023-1355`
|
||||
- xserver-xorg: Fix :cve:`2023-0494`
|
||||
- xwayland: Fix :cve:`2023-0494`
|
||||
|
||||
|
||||
Fixes in Yocto-4.0.9
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- base-files: Drop localhost.localdomain from hosts file
|
||||
- binutils: Fix nativesdk ld.so search
|
||||
- bitbake: cookerdata: Drop dubious exception handling code
|
||||
- bitbake: cookerdata: Improve early exception handling
|
||||
- bitbake: cookerdata: Remove incorrect SystemExit usage
|
||||
- bitbake: fetch/git: Fix local clone url to make it work with repo
|
||||
- bitbake: utils: Allow to_boolean to support int values
|
||||
- bmap-tools: switch to main branch
|
||||
- buildtools-tarball: Handle spaces within user $PATH
|
||||
- busybox: Fix depmod patch
|
||||
- cracklib: update github branch to 'main'
|
||||
- cups: add/fix web interface packaging
|
||||
- cups: check PACKAGECONFIG for pam feature
|
||||
- cups: use BUILDROOT instead of DESTDIR
|
||||
- curl: fix dependencies when building with ldap/ldaps
|
||||
- cve-check: Fix false negative version issue
|
||||
- dbus: upgrade to 1.14.6
|
||||
- devtool/upgrade: do not delete the workspace/recipes directory
|
||||
- dhcpcd: Fix install conflict when enable multilib.
|
||||
- dhcpcd: fix dhcpcd start failure on qemuppc64
|
||||
- gcc-shared-source: do not use ${S}/.. in deploy_source_date_epoch
|
||||
- glibc: Add missing binutils dependency
|
||||
- image_types: fix multiubi var init
|
||||
- iso-codes: upgrade to 4.13.0
|
||||
- json-c: Add ptest for json-c
|
||||
- kernel-yocto: fix kernel-meta data detection
|
||||
- lib/buildstats: handle tasks that never finished
|
||||
- lib/resulttool: fix typo breaking resulttool log --ptest
|
||||
- libjpeg-turbo: upgrade to 2.1.5.1
|
||||
- libmicrohttpd: upgrade to 0.9.76
|
||||
- libseccomp: fix for the ptest result format
|
||||
- libssh2: Clean up ptest patch/coverage
|
||||
- linux-firmware: add yamato fw files to qcom-adreno-a2xx package
|
||||
- linux-firmware: properly set license for all Qualcomm firmware
|
||||
- linux-firmware: upgrade to 20230210
|
||||
- linux-yocto-rt/5.15: update to -rt59
|
||||
- linux-yocto/5.10: upgrade to v5.10.175
|
||||
- linux-yocto/5.15: upgrade to v5.15.103
|
||||
- linux: inherit pkgconfig in kernel.bbclass
|
||||
- lttng-modules: fix for kernel 6.2+
|
||||
- lttng-modules: upgrade to v2.13.9
|
||||
- lua: Fix install conflict when enable multilib.
|
||||
- mdadm: Fix raid0, 06wrmostly and 02lineargrow tests
|
||||
- meson: Fix wrapper handling of implicit setup command
|
||||
- migration-guides: add 4.0.8 release notes
|
||||
- nghttp2: never build python bindings
|
||||
- oeqa rtc.py: skip if read-only-rootfs
|
||||
- oeqa ssh.py: fix hangs in run()
|
||||
- oeqa/sdk: Improve Meson test
|
||||
- oeqa/selftest/prservice: Improve debug output for failure
|
||||
- oeqa/selftest/resulttooltests: fix minor typo
|
||||
- openssl: upgrade to 3.0.8
|
||||
- package.bbclase: Add check for /build in copydebugsources()
|
||||
- patchelf: replace a rejected patch with an equivalent uninative.bbclass tweak
|
||||
- poky.conf: bump version for 4.0.9
|
||||
- populate_sdk_ext: Handle spaces within user $PATH
|
||||
- pybootchartui: Fix python syntax issue
|
||||
- python3-git: fix indent error
|
||||
- python3-setuptools-rust-native: Add direct dependency of native python3 modules
|
||||
- qemu: Revert "fix :cve:`2021-3507`" as not applicable for qemu 6.2
|
||||
- rsync: Add missing prototypes to function declarations
|
||||
- rsync: Turn on -pedantic-errors at the end of 'configure'
|
||||
- runqemu: kill qemu if it hangs
|
||||
- scripts/lib/buildstats: handle top-level build_stats not being complete
|
||||
- selftest/recipetool: Stop test corrupting tinfoil class
|
||||
- selftest/runtime_test/virgl: Disable for all Rocky Linux
|
||||
- selftest: devtool: set BB_HASHSERVE_UPSTREAM when setting SSTATE_MIRROR
|
||||
- sstatesig: Improve output hash calculation
|
||||
- staging/multilib: Fix manifest corruption
|
||||
- staging: Separate out different multiconfig manifests
|
||||
- sudo: update 1.9.12p2 -> 1.9.13p3
|
||||
- systemd.bbclass: Add /usr/lib/systemd to searchpaths as well
|
||||
- systemd: add group sgx to udev package
|
||||
- systemd: fix wrong nobody-group assignment
|
||||
- timezone: use 'tz' subdir instead of ${WORKDIR} directly
|
||||
- toolchain-scripts: Handle spaces within user $PATH
|
||||
- tzcode-native: fix build with gcc-13 on host
|
||||
- tzdata: use separate B instead of WORKDIR for zic output
|
||||
- uninative: upgrade to 3.9 to include libgcc and glibc 2.37
|
||||
- vala: Fix install conflict when enable multilib.
|
||||
- vim: add missing pkgconfig inherit
|
||||
- vim: set modified-by to the recipe MAINTAINER
|
||||
- vim: upgrade to 9.0.1429
|
||||
- wic: Fix usage of fstype=none in wic
|
||||
- wireless-regdb: upgrade to 2023.02.13
|
||||
- xserver-xorg: upgrade to 21.1.7
|
||||
- xwayland: upgrade to 22.1.8
|
||||
|
||||
|
||||
Known Issues in Yocto-4.0.9
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- N/A
|
||||
|
||||
|
||||
Contributors to Yocto-4.0.9
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Alexander Kanavin
|
||||
- Alexis Lothoré
|
||||
- Bruce Ashfield
|
||||
- Changqing Li
|
||||
- Chee Yang Lee
|
||||
- Dmitry Baryshkov
|
||||
- Federico Pellegrin
|
||||
- Geoffrey GIRY
|
||||
- Hitendra Prajapati
|
||||
- Hongxu Jia
|
||||
- Joe Slater
|
||||
- Kai Kang
|
||||
- Kenfe-Mickael Laventure
|
||||
- Khem Raj
|
||||
- Martin Jansa
|
||||
- Mateusz Marciniec
|
||||
- Michael Halstead
|
||||
- Michael Opdenacker
|
||||
- Mikko Rapeli
|
||||
- Ming Liu
|
||||
- Mingli Yu
|
||||
- Narpat Mali
|
||||
- Pavel Zhukov
|
||||
- Pawan Badganchi
|
||||
- Peter Marko
|
||||
- Piotr Łobacz
|
||||
- Poonam Jadhav
|
||||
- Randy MacLeod
|
||||
- Richard Purdie
|
||||
- Robert Yang
|
||||
- Romuald Jeanne
|
||||
- Ross Burton
|
||||
- Sakib Sajal
|
||||
- Saul Wold
|
||||
- Shubham Kulkarni
|
||||
- Siddharth Doshi
|
||||
- Simone Weiss
|
||||
- Steve Sakoman
|
||||
- Tim Orling
|
||||
- Tom Hochstein
|
||||
- Trevor Woerner
|
||||
- Ulrich Ölmann
|
||||
- Vivek Kumbhar
|
||||
- Wang Mingyu
|
||||
- Xiangyu Chen
|
||||
- Yash Shinde
|
||||
|
||||
|
||||
Repositories / Downloads for Yocto-4.0.9
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
poky
|
||||
|
||||
- Repository Location: :yocto_git:`/poky`
|
||||
- Branch: :yocto_git:`kirkstone </poky/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.9 </poky/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :yocto_git:`09def309f91929f47c6cce386016ccb777bd2cfc </poky/commit/?id=09def309f91929f47c6cce386016ccb777bd2cfc>`
|
||||
- Release Artefact: poky-09def309f91929f47c6cce386016ccb777bd2cfc
|
||||
- sha: 5c7ce209c8a6b37ec2898e5ca21858234d91999c11fa862880ba98e8bde62f63
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.9/poky-09def309f91929f47c6cce386016ccb777bd2cfc.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.9/poky-09def309f91929f47c6cce386016ccb777bd2cfc.tar.bz2
|
||||
|
||||
openembedded-core
|
||||
|
||||
- Repository Location: :oe_git:`/openembedded-core`
|
||||
- Branch: :oe_git:`kirkstone </openembedded-core/log/?h=kirkstone>`
|
||||
- Tag: :oe_git:`yocto-4.0.9 </openembedded-core/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :oe_git:`ff4b57ffff903a93b710284c7c7f916ddd74712f </openembedded-core/commit/?id=ff4b57ffff903a93b710284c7c7f916ddd74712f>`
|
||||
- Release Artefact: oecore-ff4b57ffff903a93b710284c7c7f916ddd74712f
|
||||
- sha: 726778ffc291136db1704316b196de979f68df9f96476b785e1791957fbb66b3
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.9/oecore-ff4b57ffff903a93b710284c7c7f916ddd74712f.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.9/oecore-ff4b57ffff903a93b710284c7c7f916ddd74712f.tar.bz2
|
||||
|
||||
meta-mingw
|
||||
|
||||
- Repository Location: :yocto_git:`/meta-mingw`
|
||||
- Branch: :yocto_git:`kirkstone </meta-mingw/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.9 </meta-mingw/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :yocto_git:`a90614a6498c3345704e9611f2842eb933dc51c1 </meta-mingw/commit/?id=a90614a6498c3345704e9611f2842eb933dc51c1>`
|
||||
- Release Artefact: meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1
|
||||
- sha: 49f9900bfbbc1c68136f8115b314e95d0b7f6be75edf36a75d9bcd1cca7c6302
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.9/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.9/meta-mingw-a90614a6498c3345704e9611f2842eb933dc51c1.tar.bz2
|
||||
|
||||
meta-gplv2
|
||||
|
||||
- Repository Location: :yocto_git:`/meta-gplv2`
|
||||
- Branch: :yocto_git:`kirkstone </meta-gplv2/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.9 </meta-gplv2/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :yocto_git:`d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a </meta-gplv2/commit/?id=d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a>`
|
||||
- Release Artefact: meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a
|
||||
- sha: c386f59f8a672747dc3d0be1d4234b6039273d0e57933eb87caa20f56b9cca6d
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.9/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.9/meta-gplv2-d2f8b5cdb285b72a4ed93450f6703ca27aa42e8a.tar.bz2
|
||||
|
||||
bitbake
|
||||
|
||||
- Repository Location: :oe_git:`/bitbake`
|
||||
- Branch: :oe_git:`2.0 </bitbake/log/?h=2.0>`
|
||||
- Tag: :oe_git:`yocto-4.0.9 </bitbake/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :oe_git:`2802adb572eb73a3eb2725a74a9bbdaafc543fa7 </bitbake/commit/?id=2802adb572eb73a3eb2725a74a9bbdaafc543fa7>`
|
||||
- Release Artefact: bitbake-2802adb572eb73a3eb2725a74a9bbdaafc543fa7
|
||||
- sha: 5c6e713b5e26b3835c0773095c7a1bc1f8affa28316b33597220ed86f1f1b643
|
||||
- Download Locations:
|
||||
http://downloads.yoctoproject.org/releases/yocto/yocto-4.0.9/bitbake-2802adb572eb73a3eb2725a74a9bbdaafc543fa7.tar.bz2
|
||||
http://mirrors.kernel.org/yocto/yocto/yocto-4.0.9/bitbake-2802adb572eb73a3eb2725a74a9bbdaafc543fa7.tar.bz2
|
||||
|
||||
yocto-docs
|
||||
|
||||
- Repository Location: :yocto_git:`/yocto-docs`
|
||||
- Branch: :yocto_git:`kirkstone </yocto-docs/log/?h=kirkstone>`
|
||||
- Tag: :yocto_git:`yocto-4.0.9 </yocto-docs/log/?h=yocto-4.0.9>`
|
||||
- Git Revision: :yocto_git:`86d0b38a97941ad52b1af220c7b801a399d50e93 </yocto-docs/commit/?id=86d0b38a97941ad52b1af220c7b801a399d50e93>`
|
||||
|
||||
@@ -1982,7 +1982,7 @@ Thanks to this, the depending tasks will keep a previously recorded
|
||||
task hash, and BitBake will be able to retrieve their output from
|
||||
the Shared State cache, instead of re-executing them. Similarly, the
|
||||
output of further downstream tasks can also be retrieved from Shared
|
||||
Shate.
|
||||
State.
|
||||
|
||||
If the output hash is unknown, a new entry will be created on the Hash
|
||||
Equivalence server, matching the task hash to that output.
|
||||
|
||||
@@ -2401,20 +2401,21 @@ tracer writes to, blktrace provides a way to trace without perturbing
|
||||
the traced device at all by providing native support for sending all
|
||||
trace data over the network.
|
||||
|
||||
To have blktrace operate in this mode, start blktrace on the target
|
||||
system being traced with the -l option, along with the device to trace::
|
||||
To have blktrace operate in this mode, start blktrace in server mode on the
|
||||
host system, which is going to store the captured data::
|
||||
|
||||
root@crownbay:~# blktrace -l /dev/sdc
|
||||
$ blktrace -l
|
||||
server: waiting for connections...
|
||||
|
||||
On the host system, use the -h option to connect to the target system,
|
||||
also passing it the device to trace::
|
||||
On the target system that is going to be traced, start blktrace in client
|
||||
mode with the -h option to connect to the host system, also passing it the
|
||||
device to trace::
|
||||
|
||||
$ blktrace -d /dev/sdc -h 192.168.1.43
|
||||
root@crownbay:~# blktrace -d /dev/sdc -h 192.168.1.43
|
||||
blktrace: connecting to 192.168.1.43
|
||||
blktrace: connected!
|
||||
|
||||
On the target system, you should see this::
|
||||
On the host system, you should see this::
|
||||
|
||||
server: connection from 192.168.1.43
|
||||
|
||||
@@ -2424,7 +2425,7 @@ In another shell, execute a workload you want to trace. ::
|
||||
Connecting to downloads.yoctoproject.org (140.211.169.59:80)
|
||||
linux-2.6.19.2.tar.b 100% \|*******************************\| 41727k 0:00:00 ETA
|
||||
|
||||
When it's done, do a Ctrl-C on the host system to stop the
|
||||
When it's done, do a Ctrl-C on the target system to stop the
|
||||
trace::
|
||||
|
||||
^C=== sdc ===
|
||||
@@ -2432,7 +2433,7 @@ trace::
|
||||
CPU 1: 4109 events, 193 KiB data
|
||||
Total: 11800 events (dropped 0), 554 KiB data
|
||||
|
||||
On the target system, you should also see a trace summary for the trace
|
||||
On the host system, you should also see a trace summary for the trace
|
||||
just ended::
|
||||
|
||||
server: end of run for 192.168.1.43:sdc
|
||||
|
||||
@@ -7298,7 +7298,7 @@ system and gives an overview of their function and contents.
|
||||
that if you want to build a fixed revision and you want to avoid
|
||||
performing a query on the remote repository every time BitBake parses
|
||||
your recipe, you should specify a :term:`SRCREV` that is a full revision
|
||||
identifier and not just a tag.
|
||||
identifier (e.g. the full SHA hash in git) and not just a tag.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
DISTRO = "poky"
|
||||
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
|
||||
#DISTRO_VERSION = "3.4+snapshot-${METADATA_REVISION}"
|
||||
DISTRO_VERSION = "4.0.9"
|
||||
DISTRO_VERSION = "4.0.11"
|
||||
DISTRO_CODENAME = "kirkstone"
|
||||
SDK_VENDOR = "-pokysdk"
|
||||
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${METADATA_REVISION}', 'snapshot')}"
|
||||
|
||||
@@ -85,9 +85,12 @@ def map_host_arch_to_uname_arch(host_arch):
|
||||
return "ppc64"
|
||||
return host_arch
|
||||
|
||||
|
||||
cmake_do_generate_toolchain_file() {
|
||||
if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
|
||||
cmake_crosscompiling="set( CMAKE_CROSSCOMPILING FALSE )"
|
||||
else
|
||||
cmake_sysroot="set( CMAKE_SYSROOT \"${RECIPE_SYSROOT}\" )"
|
||||
fi
|
||||
cat > ${WORKDIR}/toolchain.cmake <<EOF
|
||||
# CMake system name must be something like "Linux".
|
||||
@@ -120,6 +123,8 @@ set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
|
||||
set( CMAKE_PROGRAM_PATH "/" )
|
||||
|
||||
$cmake_sysroot
|
||||
|
||||
# Use qt.conf settings
|
||||
set( ENV{QT_CONF_PATH} ${WORKDIR}/qt.conf )
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -155,7 +155,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 () {
|
||||
|
||||
@@ -122,7 +122,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
|
||||
|
||||
@@ -6,7 +6,12 @@ python () {
|
||||
d.appendVar("PACKAGES", " ${KERNEL_PACKAGE_NAME}-image-zimage-bundle")
|
||||
}
|
||||
|
||||
FILES:${KERNEL_PACKAGE_NAME}-devicetree = "/${KERNEL_IMAGEDEST}/*.dtb /${KERNEL_IMAGEDEST}/*.dtbo"
|
||||
# recursivly search for devicetree files
|
||||
FILES:${KERNEL_PACKAGE_NAME}-devicetree = " \
|
||||
/${KERNEL_DTBDEST}/**/*.dtb \
|
||||
/${KERNEL_DTBDEST}/**/*.dtbo \
|
||||
"
|
||||
|
||||
FILES:${KERNEL_PACKAGE_NAME}-image-zimage-bundle = "/${KERNEL_IMAGEDEST}/zImage-*.dtb.bin"
|
||||
|
||||
# Generate kernel+devicetree bundle
|
||||
@@ -67,12 +72,16 @@ do_compile:append() {
|
||||
}
|
||||
|
||||
do_install:append() {
|
||||
install -d ${D}/${KERNEL_DTBDEST}
|
||||
for dtbf in ${KERNEL_DEVICETREE}; do
|
||||
dtb=`normalize_dtb "$dtbf"`
|
||||
dtb_ext=${dtb##*.}
|
||||
dtb_base_name=`basename $dtb .$dtb_ext`
|
||||
dtb_path=`get_real_dtb_path_in_kernel "$dtb"`
|
||||
install -m 0644 $dtb_path ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext
|
||||
if "${@'false' if oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
|
||||
dtb_ext=${dtb##*.}
|
||||
dtb_base_name=`basename $dtb .$dtb_ext`
|
||||
dtb=$dtb_base_name.$dtb_ext
|
||||
fi
|
||||
install -Dm 0644 $dtb_path ${D}/${KERNEL_DTBDEST}/$dtb
|
||||
done
|
||||
}
|
||||
|
||||
@@ -82,7 +91,10 @@ do_deploy:append() {
|
||||
dtb_ext=${dtb##*.}
|
||||
dtb_base_name=`basename $dtb .$dtb_ext`
|
||||
install -d $deployDir
|
||||
install -m 0644 ${D}/${KERNEL_IMAGEDEST}/$dtb_base_name.$dtb_ext $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
|
||||
if "${@'false' if oe.types.boolean(d.getVar('KERNEL_DTBVENDORED')) else 'true'}"; then
|
||||
dtb=$dtb_base_name.$dtb_ext
|
||||
fi
|
||||
install -m 0644 ${D}/${KERNEL_DTBDEST}/$dtb $deployDir/$dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext
|
||||
if [ "${KERNEL_IMAGETYPE_SYMLINK}" = "1" ] ; then
|
||||
ln -sf $dtb_base_name-${KERNEL_DTB_NAME}.$dtb_ext $deployDir/$dtb_base_name.$dtb_ext
|
||||
fi
|
||||
|
||||
@@ -210,6 +210,8 @@ KERNEL_RELEASE ?= "${KERNEL_VERSION}"
|
||||
# The directory where built kernel lies in the kernel tree
|
||||
KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
|
||||
KERNEL_IMAGEDEST ?= "boot"
|
||||
KERNEL_DTBDEST ?= "${KERNEL_IMAGEDEST}"
|
||||
KERNEL_DTBVENDORED ?= "0"
|
||||
|
||||
#
|
||||
# configuration
|
||||
@@ -230,7 +232,7 @@ KERNEL_EXTRA_ARGS ?= ""
|
||||
|
||||
EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}"'
|
||||
EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"'
|
||||
EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}" PAHOLE=false'
|
||||
EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"'
|
||||
|
||||
KERNEL_ALT_IMAGETYPE ??= ""
|
||||
|
||||
@@ -377,7 +379,7 @@ kernel_do_compile() {
|
||||
use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE_NAME}.cpio
|
||||
fi
|
||||
for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
|
||||
oe_runmake ${typeformake} ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
|
||||
oe_runmake ${PARALLEL_MAKE} ${typeformake} ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ def find_license_files(d):
|
||||
bb.fatal('%s: %s' % (d.getVar('PF'), exc))
|
||||
except SyntaxError:
|
||||
oe.qa.handle_error("license-syntax",
|
||||
"%s: Failed to parse it's LICENSE field." % (d.getVar('PF')), d)
|
||||
"%s: Failed to parse LICENSE: %s" % (d.getVar('PF'), d.getVar('LICENSE')), d)
|
||||
# Add files from LIC_FILES_CHKSUM to list of license files
|
||||
lic_chksum_paths = defaultdict(OrderedDict)
|
||||
for path, data in sorted(lic_chksums.items()):
|
||||
|
||||
@@ -262,7 +262,7 @@ def files_from_filevars(filevars):
|
||||
f = '.' + f
|
||||
if not f.startswith("./"):
|
||||
f = './' + f
|
||||
globbed = glob.glob(f)
|
||||
globbed = glob.glob(f, recursive=True)
|
||||
if globbed:
|
||||
if [ f ] != globbed:
|
||||
files += globbed
|
||||
@@ -638,7 +638,7 @@ def copydebugsources(debugsrcdir, sources, d):
|
||||
if os.path.exists(dvar + debugsrcdir + sdir):
|
||||
# Special case for /build since we need to move into
|
||||
# /usr/src/debug/build so rename sdir to build.build
|
||||
if sdir.find("/build") == 0:
|
||||
if sdir == "/build" or sdir.find("/build/") == 0:
|
||||
cmd = "mv %s%s%s %s%s%s" % (dvar, debugsrcdir, "/build", dvar, debugsrcdir, "/build.build")
|
||||
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
||||
sdir = sdir.replace("/build", "/build.build", 1)
|
||||
|
||||
@@ -53,6 +53,8 @@ TOOLCHAIN_OUTPUTNAME ?= "${SDK_NAME}-toolchain-${SDK_VERSION}"
|
||||
SDK_ARCHIVE_TYPE ?= "tar.xz"
|
||||
SDK_XZ_COMPRESSION_LEVEL ?= "-9"
|
||||
SDK_XZ_OPTIONS ?= "${XZ_DEFAULTS} ${SDK_XZ_COMPRESSION_LEVEL}"
|
||||
SDK_ZIP_OPTIONS ?= "-y"
|
||||
|
||||
|
||||
# To support different sdk type according to SDK_ARCHIVE_TYPE, now support zip and tar.xz
|
||||
python () {
|
||||
@@ -60,7 +62,7 @@ python () {
|
||||
d.setVar('SDK_ARCHIVE_DEPENDS', 'zip-native')
|
||||
# SDK_ARCHIVE_CMD used to generate archived sdk ${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} from input dir ${SDK_OUTPUT}/${SDKPATH} to output dir ${SDKDEPLOYDIR}
|
||||
# recommand to cd into input dir first to avoid archive with buildpath
|
||||
d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r -y ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
|
||||
d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; zip -r ${SDK_ZIP_OPTIONS} ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE} .')
|
||||
else:
|
||||
d.setVar('SDK_ARCHIVE_DEPENDS', 'xz-native')
|
||||
d.setVar('SDK_ARCHIVE_CMD', 'cd ${SDK_OUTPUT}/${SDKPATH}; tar ${SDKTAROPTS} -cf - . | xz ${SDK_XZ_OPTIONS} > ${SDKDEPLOYDIR}/${TOOLCHAIN_OUTPUTNAME}.${SDK_ARCHIVE_TYPE}')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -648,7 +648,7 @@ python staging_taskhandler() {
|
||||
bbtasks = e.tasklist
|
||||
for task in bbtasks:
|
||||
deps = d.getVarFlag(task, "depends")
|
||||
if task == "do_configure" or (deps and "populate_sysroot" in deps):
|
||||
if task != 'do_prepare_recipe_sysroot' and (task == "do_configure" or (deps and "populate_sysroot" in deps)):
|
||||
d.prependVarFlag(task, "prefuncs", "extend_recipe_sysroot ")
|
||||
}
|
||||
staging_taskhandler[eventmask] = "bb.event.RecipeTaskPreProcess"
|
||||
|
||||
@@ -80,10 +80,10 @@ def gen_updatealternativesvardeps(d):
|
||||
|
||||
for p in pkgs:
|
||||
for v in vars:
|
||||
for flag in sorted((d.getVarFlags("%s_%s" % (v,p)) or {}).keys()):
|
||||
for flag in sorted((d.getVarFlags("%s:%s" % (v,p)) or {}).keys()):
|
||||
if flag == "doc" or flag == "vardeps" or flag == "vardepsexp":
|
||||
continue
|
||||
d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s_%s' % (v,p), flag, False)))
|
||||
d.appendVar('%s_VARDEPS_%s' % (v,p), ' %s:%s' % (flag, d.getVarFlag('%s:%s' % (v,p), flag, False)))
|
||||
|
||||
def ua_extend_depends(d):
|
||||
if not 'virtual/update-alternatives' in d.getVar('PROVIDES'):
|
||||
|
||||
@@ -948,7 +948,7 @@ BB_HASHCONFIG_IGNORE_VARS ?= "${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 vardepsexclude vardeps vardepvalue vardepvalueexclude \
|
||||
file-checksums python task nostamp \
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
# the aim of sharing that work and ensuring we don't duplicate it.
|
||||
#
|
||||
|
||||
#cargo https://nvd.nist.gov/vuln/detail/CVE-2022-46176
|
||||
#cargo security advisor https://blog.rust-lang.org/2023/01/10/cve-2022-46176.html
|
||||
#This CVE is a security issue when using cargo ssh. In kirkstone, rust 1.59.0 is used and the rust on-target is not supported, so the target images are not vulnerable to the cve.
|
||||
#The bitbake using the 'wget' (which uses 'https') for fetching the sources instead of ssh. So, the cargo-native are also not vulnerable to this cve and so added to excluded list.
|
||||
CVE_CHECK_IGNORE += "CVE-2022-46176"
|
||||
|
||||
# strace https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2000-0006
|
||||
# CVE is more than 20 years old with no resolution evident
|
||||
|
||||
@@ -280,7 +280,7 @@ RECIPE_MAINTAINER:pn-intltool = "Alexander Kanavin <alex.kanavin@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-iproute2 = "Changhyeok Bae <changhyeok.bae@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-iptables = "Changhyeok Bae <changhyeok.bae@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-iputils = "Changhyeok Bae <changhyeok.bae@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-iso-codes = "Wang Mingyu <wangmy@cn.ujitsu.com>"
|
||||
RECIPE_MAINTAINER:pn-iso-codes = "Wang Mingyu <wangmy@cn.fujitsu.com>"
|
||||
RECIPE_MAINTAINER:pn-itstool = "Andreas Müller <schnitzeltony@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-iw = "Changhyeok Bae <changhyeok.bae@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-libjpeg-turbo = "Anuj Mittal <anuj.mittal@intel.com>"
|
||||
@@ -700,7 +700,7 @@ RECIPE_MAINTAINER:pn-quilt-native = "Robert Yang <liezhi.yang@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-quota = "Anuj Mittal <anuj.mittal@intel.com>"
|
||||
RECIPE_MAINTAINER:pn-re2c = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-readline = "Hongxu Jia <hongxu.jia@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-repo = "Jasper Orschulko <Jasper.Orschulko@iris-sensing.com>"
|
||||
RECIPE_MAINTAINER:pn-repo = "Unassigned <unassigned@yoctoproject.org>"
|
||||
RECIPE_MAINTAINER:pn-resolvconf = "Chen Qi <Qi.Chen@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rgb = "Unassigned <unassigned@yoctoproject.org>"
|
||||
RECIPE_MAINTAINER:pn-rpcbind = "Hongxu Jia <hongxu.jia@windriver.com>"
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#
|
||||
|
||||
UNINATIVE_MAXGLIBCVERSION = "2.37"
|
||||
UNINATIVE_VERSION = "3.9"
|
||||
UNINATIVE_VERSION = "4.0"
|
||||
|
||||
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "de35708c95c34573af140da910132c3291ba4fd26ebf7b74b755ada432cdf07b"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "adac07b08adb88eb26fc7fd87fee0cec9d5be167bf7c5ffd3a549a2a6699c29c"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "3dd82c3fbdb59e87bf091c3eef555a05fae528eeda3083828f76cd4deaceca8b"
|
||||
UNINATIVE_CHECKSUM[aarch64] ?= "7baa8418a302df52e00916193b0a04f318356d9d2670c9a2bce3e966efefd738"
|
||||
UNINATIVE_CHECKSUM[i686] ?= "83114d36883d43a521e280742b9849bf85d039b2f83d8e21d480659babe75ee8"
|
||||
UNINATIVE_CHECKSUM[x86_64] ?= "fd75b2a1a67a10f6b7d65afb7d0f3e71a63b0038e428f34dfe420bb37716558a"
|
||||
|
||||
@@ -245,7 +245,7 @@ class OpkgPM(OpkgDpkgPM):
|
||||
"""
|
||||
if (self.d.getVar('FEED_DEPLOYDIR_BASE_URI') or "") != "":
|
||||
for arch in self.pkg_archs.split():
|
||||
cfg_file_name = os.path.join(self.target_rootfs,
|
||||
cfg_file_name = oe.path.join(self.target_rootfs,
|
||||
self.d.getVar("sysconfdir"),
|
||||
"opkg",
|
||||
"local-%s-feed.conf" % arch)
|
||||
|
||||
@@ -62,7 +62,7 @@ class PkgManifest(Manifest):
|
||||
if len(pkgs_to_install) == 0:
|
||||
return
|
||||
|
||||
output = pm.dummy_install(pkgs_to_install).decode('utf-8')
|
||||
output = pm.dummy_install(pkgs_to_install)
|
||||
|
||||
with open(self.full_manifest, 'w+') as manifest:
|
||||
pkg_re = re.compile('^Installing ([^ ]+) [^ ].*')
|
||||
|
||||
@@ -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}'
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import shutil
|
||||
import tempfile
|
||||
import glob
|
||||
import fnmatch
|
||||
import unittest
|
||||
|
||||
from oeqa.selftest.case import OESelftestTestCase
|
||||
from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
|
||||
@@ -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))
|
||||
|
||||
@@ -149,7 +149,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])
|
||||
@@ -223,7 +223,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'))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -83,7 +83,6 @@ RRECOMMENDS:${PN}:append:libc-glibc = " libnss-mdns"
|
||||
do_install() {
|
||||
autotools_do_install
|
||||
rm -rf ${D}/run
|
||||
rm -rf ${D}${datadir}/dbus-1/interfaces
|
||||
test -d ${D}${datadir}/dbus-1 && rmdir --ignore-fail-on-non-empty ${D}${datadir}/dbus-1
|
||||
rm -rf ${D}${libdir}/avahi
|
||||
|
||||
@@ -135,7 +134,7 @@ FILES:avahi-daemon = "${sbindir}/avahi-daemon \
|
||||
${sysconfdir}/avahi/services \
|
||||
${sysconfdir}/dbus-1 \
|
||||
${sysconfdir}/init.d/avahi-daemon \
|
||||
${datadir}/avahi/introspection/*.introspect \
|
||||
${datadir}/dbus-1/interfaces \
|
||||
${datadir}/avahi/avahi-service.dtd \
|
||||
${datadir}/avahi/service-types \
|
||||
${datadir}/dbus-1/system-services"
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
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
|
||||
|
||||
Avoid overwriting the read packet length after the initial test. Thus
|
||||
move all the length checks which depends on the total length first
|
||||
and do not use the total lenght from the IP packet afterwards.
|
||||
|
||||
Reported by Polina Smirnova <moe.hwr@gmail.com>
|
||||
|
||||
CVE: CVE-2023-28488
|
||||
Upstream-Status: Backport [https://git.kernel.org/pub/scm/network/connman/connman.git/commit/?id=99e2c16ea1cced34a5dc450d76287a1c3e762138]
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
gdhcp/client.c | 16 +++++++++-------
|
||||
1 file changed, 9 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/gdhcp/client.c b/gdhcp/client.c
|
||||
index 3016dfc..28fa606 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;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -8,6 +8,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/network/${BPN}/${BP}.tar.xz \
|
||||
file://CVE-2022-32293_p1.patch \
|
||||
file://CVE-2022-32293_p2.patch \
|
||||
file://CVE-2022-32292.patch \
|
||||
file://CVE-2023-28488.patch \
|
||||
"
|
||||
|
||||
SRC_URI:append:libc-musl = " file://0002-resolve-musl-does-not-implement-res_ninit.patch"
|
||||
|
||||
@@ -9,9 +9,7 @@ HOMEPAGE = "http://roy.marples.name/projects/dhcpcd/"
|
||||
LICENSE = "BSD-2-Clause"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=d148485768fe85b9f1072b186a7e9b4d"
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://roy.marples.name/downloads/dhcpcd/"
|
||||
|
||||
SRC_URI = "https://roy.marples.name/downloads/${BPN}/${BPN}-${PV}.tar.xz \
|
||||
SRC_URI = "git://github.com/NetworkConfiguration/dhcpcd;protocol=https;branch=dhcpcd-9 \
|
||||
file://0001-remove-INCLUDEDIR-to-prevent-build-issues.patch \
|
||||
file://0001-20-resolv.conf-improve-the-sitation-of-working-with-.patch \
|
||||
file://0001-privsep-Allow-getrandom-sysctl-for-newer-glibc.patch \
|
||||
@@ -22,7 +20,8 @@ SRC_URI = "https://roy.marples.name/downloads/${BPN}/${BPN}-${PV}.tar.xz \
|
||||
file://0001-dhcpcd.8-Fix-conflict-error-when-enable-multilib.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "819357634efed1ea5cf44ec01b24d3d3f8852fec8b4249925dcc5667c54e376c"
|
||||
SRCREV = "3c458fc7fa4146029a1e4f9e98cd7e7adf03081a"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit pkgconfig autotools-brokensep systemd useradd
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
From 91889b5a3e7554af474a21ce8e1ffd3eb1542f06 Mon Sep 17 00:00:00 2001
|
||||
From: "djm@openbsd.org" <djm@openbsd.org>
|
||||
Date: Thu, 9 Mar 2023 06:58:26 +0000
|
||||
Subject: [PATCH] upstream: include destination constraints for smartcard keys
|
||||
too.
|
||||
|
||||
Spotted by Luci Stanescu; ok deraadt@ markus@
|
||||
|
||||
OpenBSD-Commit-ID: add879fac6903a1cb1d1e42c4309e5359c3d870f
|
||||
|
||||
CVE: CVE-2023-28531
|
||||
|
||||
Upstream-Status: Backport [54ac4ab2b53ce9fcb66b8250dee91c070e4167ed]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
---
|
||||
authfd.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/authfd.c b/authfd.c
|
||||
index 76e48aab..dca8e55b 100644
|
||||
--- a/authfd.c
|
||||
+++ b/authfd.c
|
||||
@@ -665,7 +665,7 @@ ssh_update_card(int sock, int add, const char *reader_id, const char *pin,
|
||||
struct dest_constraint **dest_constraints, size_t ndest_constraints)
|
||||
{
|
||||
struct sshbuf *msg;
|
||||
- int r, constrained = (life || confirm);
|
||||
+ int r, constrained = (life || confirm || dest_constraints);
|
||||
u_char type;
|
||||
|
||||
if (add) {
|
||||
--
|
||||
2.37.1
|
||||
|
||||
@@ -0,0 +1,984 @@
|
||||
From 7280401bdd77ca54be6867a154cc01e0d72612e0 Mon Sep 17 00:00:00 2001
|
||||
From: Damien Miller <djm@mindrot.org>
|
||||
Date: Fri, 24 Mar 2023 13:56:25 +1100
|
||||
Subject: [PATCH] remove support for old libcrypto
|
||||
|
||||
OpenSSH now requires LibreSSL 3.1.0 or greater or
|
||||
OpenSSL 1.1.1 or greater
|
||||
|
||||
with/ok dtucker@
|
||||
|
||||
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/7280401bdd77ca54be6867a154cc01e0d72612e0]
|
||||
Comment: Hunk are refreshed, removed couple of hunks from configure.ac as hunk code is not prasent
|
||||
and backported to the existing code.
|
||||
Signed-off-by: Riyaz Khan <Riyaz.Khan@kpit.com>
|
||||
|
||||
---
|
||||
.github/workflows/c-cpp.yml | 7 -
|
||||
INSTALL | 8 +-
|
||||
cipher-aes.c | 2 +-
|
||||
configure.ac | 96 ++---
|
||||
openbsd-compat/libressl-api-compat.c | 556 +--------------------------
|
||||
openbsd-compat/openssl-compat.h | 151 +-------
|
||||
6 files changed, 40 insertions(+), 780 deletions(-)
|
||||
|
||||
diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml
|
||||
index 3d9aa22dba5..d299a32468d 100644
|
||||
--- a/.github/workflows/c-cpp.yml
|
||||
+++ b/.github/workflows/c-cpp.yml
|
||||
@@ -40,18 +40,11 @@
|
||||
- { os: ubuntu-20.04, configs: tcmalloc }
|
||||
- { os: ubuntu-20.04, configs: musl }
|
||||
- { os: ubuntu-latest, configs: libressl-master }
|
||||
- - { os: ubuntu-latest, configs: libressl-2.2.9 }
|
||||
- - { os: ubuntu-latest, configs: libressl-2.8.3 }
|
||||
- - { os: ubuntu-latest, configs: libressl-3.0.2 }
|
||||
- { os: ubuntu-latest, configs: libressl-3.2.6 }
|
||||
- { os: ubuntu-latest, configs: libressl-3.3.4 }
|
||||
- { os: ubuntu-latest, configs: libressl-3.4.1 }
|
||||
- { os: ubuntu-latest, configs: openssl-master }
|
||||
- { os: ubuntu-latest, configs: openssl-noec }
|
||||
- - { os: ubuntu-latest, configs: openssl-1.0.1 }
|
||||
- - { os: ubuntu-latest, configs: openssl-1.0.1u }
|
||||
- - { os: ubuntu-latest, configs: openssl-1.0.2u }
|
||||
- - { os: ubuntu-latest, configs: openssl-1.1.0h }
|
||||
- { os: ubuntu-latest, configs: openssl-1.1.1 }
|
||||
- { os: ubuntu-latest, configs: openssl-1.1.1k }
|
||||
- { os: ubuntu-latest, configs: openssl-3.0.0 }
|
||||
diff --git a/INSTALL b/INSTALL
|
||||
index 68b15e13190..f99d1e2a809 100644
|
||||
--- a/INSTALL
|
||||
+++ b/INSTALL
|
||||
@@ -21,12 +21,8 @@ https://zlib.net/
|
||||
|
||||
libcrypto from either of LibreSSL or OpenSSL. Building without libcrypto
|
||||
is supported but severely restricts the available ciphers and algorithms.
|
||||
- - LibreSSL (https://www.libressl.org/)
|
||||
- - OpenSSL (https://www.openssl.org) with any of the following versions:
|
||||
- - 1.0.x >= 1.0.1 or 1.1.0 >= 1.1.0g or any 1.1.1
|
||||
-
|
||||
-Note that due to a bug in EVP_CipherInit OpenSSL 1.1 versions prior to
|
||||
-1.1.0g can't be used.
|
||||
+ - LibreSSL (https://www.libressl.org/) 3.1.0 or greater
|
||||
+ - OpenSSL (https://www.openssl.org) 1.1.1 or greater
|
||||
|
||||
LibreSSL/OpenSSL should be compiled as a position-independent library
|
||||
(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC"
|
||||
diff --git a/cipher-aes.c b/cipher-aes.c
|
||||
index 8b101727284..87c763353d8 100644
|
||||
--- a/cipher-aes.c
|
||||
+++ b/cipher-aes.c
|
||||
@@ -69,7 +69,7 @@ ssh_rijndael_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv,
|
||||
|
||||
static int
|
||||
ssh_rijndael_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src,
|
||||
- LIBCRYPTO_EVP_INL_TYPE len)
|
||||
+ size_t len)
|
||||
{
|
||||
struct ssh_rijndael_ctx *c;
|
||||
u_char buf[RIJNDAEL_BLOCKSIZE];
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 22fee70f604..1c0ccdf19c5 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -2744,42 +2744,40 @@
|
||||
#include <openssl/crypto.h>
|
||||
#define DATA "conftest.ssllibver"
|
||||
]], [[
|
||||
- FILE *fd;
|
||||
- int rc;
|
||||
+ FILE *f;
|
||||
|
||||
- fd = fopen(DATA,"w");
|
||||
- if(fd == NULL)
|
||||
+ if ((f = fopen(DATA, "w")) == NULL)
|
||||
exit(1);
|
||||
-#ifndef OPENSSL_VERSION
|
||||
-# define OPENSSL_VERSION SSLEAY_VERSION
|
||||
-#endif
|
||||
-#ifndef HAVE_OPENSSL_VERSION
|
||||
-# define OpenSSL_version SSLeay_version
|
||||
-#endif
|
||||
-#ifndef HAVE_OPENSSL_VERSION_NUM
|
||||
-# define OpenSSL_version_num SSLeay
|
||||
-#endif
|
||||
- if ((rc = fprintf(fd, "%08lx (%s)\n",
|
||||
+ if (fprintf(f, "%08lx (%s)",
|
||||
(unsigned long)OpenSSL_version_num(),
|
||||
- OpenSSL_version(OPENSSL_VERSION))) < 0)
|
||||
+ OpenSSL_version(OPENSSL_VERSION)) < 0)
|
||||
+ exit(1);
|
||||
+#ifdef LIBRESSL_VERSION_NUMBER
|
||||
+ if (fprintf(f, " libressl-%08lx", LIBRESSL_VERSION_NUMBER) < 0)
|
||||
+ exit(1);
|
||||
+#endif
|
||||
+ if (fputc('\n', f) == EOF || fclose(f) == EOF)
|
||||
exit(1);
|
||||
-
|
||||
exit(0);
|
||||
]])],
|
||||
[
|
||||
- ssl_library_ver=`cat conftest.ssllibver`
|
||||
+ sslver=`cat conftest.ssllibver`
|
||||
+ ssl_showver=`echo "$sslver" | sed 's/ libressl-.*//'`
|
||||
# Check version is supported.
|
||||
- case "$ssl_library_ver" in
|
||||
- 10000*|0*)
|
||||
- AC_MSG_ERROR([OpenSSL >= 1.0.1 required (have "$ssl_library_ver")])
|
||||
- ;;
|
||||
- 100*) ;; # 1.0.x
|
||||
- 101000[[0123456]]*)
|
||||
- # https://github.com/openssl/openssl/pull/4613
|
||||
- AC_MSG_ERROR([OpenSSL 1.1.x versions prior to 1.1.0g have a bug that breaks their use with OpenSSH (have "$ssl_library_ver")])
|
||||
+ case "$sslver" in
|
||||
+ 100*|10100*) # 1.0.x, 1.1.0x
|
||||
+ AC_MSG_ERROR([OpenSSL >= 1.1.1 required (have "$ssl_showver")])
|
||||
;;
|
||||
101*) ;; # 1.1.x
|
||||
- 200*) ;; # LibreSSL
|
||||
+ 200*) # LibreSSL
|
||||
+ lver=`echo "$sslver" | sed 's/.*libressl-//'`
|
||||
+ case "$lver" in
|
||||
+ 2*|300*) # 2.x, 3.0.0
|
||||
+ AC_MSG_ERROR([LibreSSL >= 3.1.0 required (have "$ssl_showver")])
|
||||
+ ;;
|
||||
+ *) ;; # Assume all other versions are good.
|
||||
+ esac
|
||||
+ ;;
|
||||
300*) ;; # OpenSSL 3
|
||||
301*) ;; # OpenSSL development branch.
|
||||
*)
|
||||
@@ -2781,10 +2781,10 @@
|
||||
300*) ;; # OpenSSL 3
|
||||
301*) ;; # OpenSSL development branch.
|
||||
*)
|
||||
- AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_library_ver")])
|
||||
+ AC_MSG_ERROR([Unknown/unsupported OpenSSL version ("$ssl_showver")])
|
||||
;;
|
||||
esac
|
||||
- AC_MSG_RESULT([$ssl_library_ver])
|
||||
+ AC_MSG_RESULT([$ssl_showver])
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([not found])
|
||||
@@ -2804,9 +2804,6 @@
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
]], [[
|
||||
-#ifndef HAVE_OPENSSL_VERSION_NUM
|
||||
-# define OpenSSL_version_num SSLeay
|
||||
-#endif
|
||||
exit(OpenSSL_version_num() == OPENSSL_VERSION_NUMBER ? 0 : 1);
|
||||
]])],
|
||||
[
|
||||
@@ -2881,44 +2878,13 @@
|
||||
)
|
||||
)
|
||||
|
||||
- # LibreSSL/OpenSSL 1.1x API
|
||||
+ # LibreSSL/OpenSSL API differences
|
||||
AC_CHECK_FUNCS([ \
|
||||
- OPENSSL_init_crypto \
|
||||
- DH_get0_key \
|
||||
- DH_get0_pqg \
|
||||
- DH_set0_key \
|
||||
- DH_set_length \
|
||||
- DH_set0_pqg \
|
||||
- DSA_get0_key \
|
||||
- DSA_get0_pqg \
|
||||
- DSA_set0_key \
|
||||
- DSA_set0_pqg \
|
||||
- DSA_SIG_get0 \
|
||||
- DSA_SIG_set0 \
|
||||
- ECDSA_SIG_get0 \
|
||||
- ECDSA_SIG_set0 \
|
||||
EVP_CIPHER_CTX_iv \
|
||||
EVP_CIPHER_CTX_iv_noconst \
|
||||
EVP_CIPHER_CTX_get_iv \
|
||||
EVP_CIPHER_CTX_get_updated_iv \
|
||||
EVP_CIPHER_CTX_set_iv \
|
||||
- RSA_get0_crt_params \
|
||||
- RSA_get0_factors \
|
||||
- RSA_get0_key \
|
||||
- RSA_set0_crt_params \
|
||||
- RSA_set0_factors \
|
||||
- RSA_set0_key \
|
||||
- RSA_meth_free \
|
||||
- RSA_meth_dup \
|
||||
- RSA_meth_set1_name \
|
||||
- RSA_meth_get_finish \
|
||||
- RSA_meth_set_priv_enc \
|
||||
- RSA_meth_set_priv_dec \
|
||||
- RSA_meth_set_finish \
|
||||
- EVP_PKEY_get0_RSA \
|
||||
- EVP_MD_CTX_new \
|
||||
- EVP_MD_CTX_free \
|
||||
- EVP_chacha20 \
|
||||
])
|
||||
|
||||
if test "x$openssl_engine" = "xyes" ; then
|
||||
@@ -3040,8 +3006,8 @@
|
||||
fi
|
||||
AC_CHECK_FUNCS([crypt DES_crypt])
|
||||
|
||||
- # Check for SHA256, SHA384 and SHA512 support in OpenSSL
|
||||
- AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512])
|
||||
+ # Check for various EVP support in OpenSSL
|
||||
+ AC_CHECK_FUNCS([EVP_sha256 EVP_sha384 EVP_sha512 EVP_chacha20])
|
||||
|
||||
# Check complete ECC support in OpenSSL
|
||||
AC_MSG_CHECKING([whether OpenSSL has NID_X9_62_prime256v1])
|
||||
diff --git a/openbsd-compat/libressl-api-compat.c b/openbsd-compat/libressl-api-compat.c
|
||||
index 498180dc894..59be17397c5 100644
|
||||
--- a/openbsd-compat/libressl-api-compat.c
|
||||
+++ b/openbsd-compat/libressl-api-compat.c
|
||||
@@ -1,129 +1,5 @@
|
||||
-/* $OpenBSD: dsa_lib.c,v 1.29 2018/04/14 07:09:21 tb Exp $ */
|
||||
-/* $OpenBSD: rsa_lib.c,v 1.37 2018/04/14 07:09:21 tb Exp $ */
|
||||
-/* $OpenBSD: evp_lib.c,v 1.17 2018/09/12 06:35:38 djm Exp $ */
|
||||
-/* $OpenBSD: dh_lib.c,v 1.32 2018/05/02 15:48:38 tb Exp $ */
|
||||
-/* $OpenBSD: p_lib.c,v 1.24 2018/05/30 15:40:50 tb Exp $ */
|
||||
-/* $OpenBSD: digest.c,v 1.30 2018/04/14 07:09:21 tb Exp $ */
|
||||
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
- * All rights reserved.
|
||||
- *
|
||||
- * This package is an SSL implementation written
|
||||
- * by Eric Young (eay@cryptsoft.com).
|
||||
- * The implementation was written so as to conform with Netscapes SSL.
|
||||
- *
|
||||
- * This library is free for commercial and non-commercial use as long as
|
||||
- * the following conditions are aheared to. The following conditions
|
||||
- * apply to all code found in this distribution, be it the RC4, RSA,
|
||||
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
- * included with this distribution is covered by the same copyright terms
|
||||
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
- *
|
||||
- * Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
- * the code are not to be removed.
|
||||
- * If this package is used in a product, Eric Young should be given attribution
|
||||
- * as the author of the parts of the library used.
|
||||
- * This can be in the form of a textual message at program startup or
|
||||
- * in documentation (online or textual) provided with the package.
|
||||
- *
|
||||
- * Redistribution and use in source and binary forms, with or without
|
||||
- * modification, are permitted provided that the following conditions
|
||||
- * are met:
|
||||
- * 1. Redistributions of source code must retain the copyright
|
||||
- * notice, this list of conditions and the following disclaimer.
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer in the
|
||||
- * documentation and/or other materials provided with the distribution.
|
||||
- * 3. All advertising materials mentioning features or use of this software
|
||||
- * must display the following acknowledgement:
|
||||
- * "This product includes cryptographic software written by
|
||||
- * Eric Young (eay@cryptsoft.com)"
|
||||
- * The word 'cryptographic' can be left out if the rouines from the library
|
||||
- * being used are not cryptographic related :-).
|
||||
- * 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
- * the apps directory (application code) you must include an acknowledgement:
|
||||
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
- * SUCH DAMAGE.
|
||||
- *
|
||||
- * The licence and distribution terms for any publically available version or
|
||||
- * derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
- * copied and put under another distribution licence
|
||||
- * [including the GNU Public Licence.]
|
||||
- */
|
||||
-
|
||||
-/* $OpenBSD: dsa_asn1.c,v 1.22 2018/06/14 17:03:19 jsing Exp $ */
|
||||
-/* $OpenBSD: ecs_asn1.c,v 1.9 2018/03/17 15:24:44 tb Exp $ */
|
||||
-/* $OpenBSD: digest.c,v 1.30 2018/04/14 07:09:21 tb Exp $ */
|
||||
-/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
- * project 2000.
|
||||
- */
|
||||
-/* ====================================================================
|
||||
- * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved.
|
||||
- *
|
||||
- * Redistribution and use in source and binary forms, with or without
|
||||
- * modification, are permitted provided that the following conditions
|
||||
- * are met:
|
||||
- *
|
||||
- * 1. Redistributions of source code must retain the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer.
|
||||
- *
|
||||
- * 2. Redistributions in binary form must reproduce the above copyright
|
||||
- * notice, this list of conditions and the following disclaimer in
|
||||
- * the documentation and/or other materials provided with the
|
||||
- * distribution.
|
||||
- *
|
||||
- * 3. All advertising materials mentioning features or use of this
|
||||
- * software must display the following acknowledgment:
|
||||
- * "This product includes software developed by the OpenSSL Project
|
||||
- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
- *
|
||||
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
- * endorse or promote products derived from this software without
|
||||
- * prior written permission. For written permission, please contact
|
||||
- * licensing@OpenSSL.org.
|
||||
- *
|
||||
- * 5. Products derived from this software may not be called "OpenSSL"
|
||||
- * nor may "OpenSSL" appear in their names without prior written
|
||||
- * permission of the OpenSSL Project.
|
||||
- *
|
||||
- * 6. Redistributions of any form whatsoever must retain the following
|
||||
- * acknowledgment:
|
||||
- * "This product includes software developed by the OpenSSL Project
|
||||
- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
- *
|
||||
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
- * OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
- * ====================================================================
|
||||
- *
|
||||
- * This product includes cryptographic software written by Eric Young
|
||||
- * (eay@cryptsoft.com). This product includes software written by Tim
|
||||
- * Hudson (tjh@cryptsoft.com).
|
||||
- *
|
||||
- */
|
||||
-
|
||||
-/* $OpenBSD: rsa_meth.c,v 1.2 2018/09/12 06:35:38 djm Exp $ */
|
||||
/*
|
||||
- * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
|
||||
+ * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -147,192 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
-#include <openssl/err.h>
|
||||
-#include <openssl/bn.h>
|
||||
-#include <openssl/dsa.h>
|
||||
-#include <openssl/rsa.h>
|
||||
#include <openssl/evp.h>
|
||||
-#ifdef OPENSSL_HAS_ECC
|
||||
-#include <openssl/ecdsa.h>
|
||||
-#endif
|
||||
-#include <openssl/dh.h>
|
||||
-
|
||||
-#ifndef HAVE_DSA_GET0_PQG
|
||||
-void
|
||||
-DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
|
||||
-{
|
||||
- if (p != NULL)
|
||||
- *p = d->p;
|
||||
- if (q != NULL)
|
||||
- *q = d->q;
|
||||
- if (g != NULL)
|
||||
- *g = d->g;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_GET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DSA_SET0_PQG
|
||||
-int
|
||||
-DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g)
|
||||
-{
|
||||
- if ((d->p == NULL && p == NULL) || (d->q == NULL && q == NULL) ||
|
||||
- (d->g == NULL && g == NULL))
|
||||
- return 0;
|
||||
-
|
||||
- if (p != NULL) {
|
||||
- BN_free(d->p);
|
||||
- d->p = p;
|
||||
- }
|
||||
- if (q != NULL) {
|
||||
- BN_free(d->q);
|
||||
- d->q = q;
|
||||
- }
|
||||
- if (g != NULL) {
|
||||
- BN_free(d->g);
|
||||
- d->g = g;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_SET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DSA_GET0_KEY
|
||||
-void
|
||||
-DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key)
|
||||
-{
|
||||
- if (pub_key != NULL)
|
||||
- *pub_key = d->pub_key;
|
||||
- if (priv_key != NULL)
|
||||
- *priv_key = d->priv_key;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DSA_SET0_KEY
|
||||
-int
|
||||
-DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
|
||||
-{
|
||||
- if (d->pub_key == NULL && pub_key == NULL)
|
||||
- return 0;
|
||||
-
|
||||
- if (pub_key != NULL) {
|
||||
- BN_free(d->pub_key);
|
||||
- d->pub_key = pub_key;
|
||||
- }
|
||||
- if (priv_key != NULL) {
|
||||
- BN_free(d->priv_key);
|
||||
- d->priv_key = priv_key;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_SET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_RSA_GET0_KEY
|
||||
-void
|
||||
-RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
|
||||
-{
|
||||
- if (n != NULL)
|
||||
- *n = r->n;
|
||||
- if (e != NULL)
|
||||
- *e = r->e;
|
||||
- if (d != NULL)
|
||||
- *d = r->d;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_KEY
|
||||
-int
|
||||
-RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
|
||||
-{
|
||||
- if ((r->n == NULL && n == NULL) || (r->e == NULL && e == NULL))
|
||||
- return 0;
|
||||
-
|
||||
- if (n != NULL) {
|
||||
- BN_free(r->n);
|
||||
- r->n = n;
|
||||
- }
|
||||
- if (e != NULL) {
|
||||
- BN_free(r->e);
|
||||
- r->e = e;
|
||||
- }
|
||||
- if (d != NULL) {
|
||||
- BN_free(r->d);
|
||||
- r->d = d;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_SET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_RSA_GET0_CRT_PARAMS
|
||||
-void
|
||||
-RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
|
||||
- const BIGNUM **iqmp)
|
||||
-{
|
||||
- if (dmp1 != NULL)
|
||||
- *dmp1 = r->dmp1;
|
||||
- if (dmq1 != NULL)
|
||||
- *dmq1 = r->dmq1;
|
||||
- if (iqmp != NULL)
|
||||
- *iqmp = r->iqmp;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_GET0_CRT_PARAMS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_CRT_PARAMS
|
||||
-int
|
||||
-RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
|
||||
-{
|
||||
- if ((r->dmp1 == NULL && dmp1 == NULL) ||
|
||||
- (r->dmq1 == NULL && dmq1 == NULL) ||
|
||||
- (r->iqmp == NULL && iqmp == NULL))
|
||||
- return 0;
|
||||
-
|
||||
- if (dmp1 != NULL) {
|
||||
- BN_free(r->dmp1);
|
||||
- r->dmp1 = dmp1;
|
||||
- }
|
||||
- if (dmq1 != NULL) {
|
||||
- BN_free(r->dmq1);
|
||||
- r->dmq1 = dmq1;
|
||||
- }
|
||||
- if (iqmp != NULL) {
|
||||
- BN_free(r->iqmp);
|
||||
- r->iqmp = iqmp;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_SET0_CRT_PARAMS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_GET0_FACTORS
|
||||
-void
|
||||
-RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
|
||||
-{
|
||||
- if (p != NULL)
|
||||
- *p = r->p;
|
||||
- if (q != NULL)
|
||||
- *q = r->q;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_GET0_FACTORS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_FACTORS
|
||||
-int
|
||||
-RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
|
||||
-{
|
||||
- if ((r->p == NULL && p == NULL) || (r->q == NULL && q == NULL))
|
||||
- return 0;
|
||||
-
|
||||
- if (p != NULL) {
|
||||
- BN_free(r->p);
|
||||
- r->p = p;
|
||||
- }
|
||||
- if (q != NULL) {
|
||||
- BN_free(r->q);
|
||||
- r->q = q;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_SET0_FACTORS */
|
||||
|
||||
#ifndef HAVE_EVP_CIPHER_CTX_GET_IV
|
||||
int
|
||||
@@ -392,249 +83,4 @@ EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx, const unsigned char *iv, size_t len)
|
||||
}
|
||||
#endif /* HAVE_EVP_CIPHER_CTX_SET_IV */
|
||||
|
||||
-#ifndef HAVE_DSA_SIG_GET0
|
||||
-void
|
||||
-DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
|
||||
-{
|
||||
- if (pr != NULL)
|
||||
- *pr = sig->r;
|
||||
- if (ps != NULL)
|
||||
- *ps = sig->s;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_SIG_GET0 */
|
||||
-
|
||||
-#ifndef HAVE_DSA_SIG_SET0
|
||||
-int
|
||||
-DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
|
||||
-{
|
||||
- if (r == NULL || s == NULL)
|
||||
- return 0;
|
||||
-
|
||||
- BN_clear_free(sig->r);
|
||||
- sig->r = r;
|
||||
- BN_clear_free(sig->s);
|
||||
- sig->s = s;
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DSA_SIG_SET0 */
|
||||
-
|
||||
-#ifdef OPENSSL_HAS_ECC
|
||||
-#ifndef HAVE_ECDSA_SIG_GET0
|
||||
-void
|
||||
-ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
|
||||
-{
|
||||
- if (pr != NULL)
|
||||
- *pr = sig->r;
|
||||
- if (ps != NULL)
|
||||
- *ps = sig->s;
|
||||
-}
|
||||
-#endif /* HAVE_ECDSA_SIG_GET0 */
|
||||
-
|
||||
-#ifndef HAVE_ECDSA_SIG_SET0
|
||||
-int
|
||||
-ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
|
||||
-{
|
||||
- if (r == NULL || s == NULL)
|
||||
- return 0;
|
||||
-
|
||||
- BN_clear_free(sig->r);
|
||||
- BN_clear_free(sig->s);
|
||||
- sig->r = r;
|
||||
- sig->s = s;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_ECDSA_SIG_SET0 */
|
||||
-#endif /* OPENSSL_HAS_ECC */
|
||||
-
|
||||
-#ifndef HAVE_DH_GET0_PQG
|
||||
-void
|
||||
-DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
|
||||
-{
|
||||
- if (p != NULL)
|
||||
- *p = dh->p;
|
||||
- if (q != NULL)
|
||||
- *q = dh->q;
|
||||
- if (g != NULL)
|
||||
- *g = dh->g;
|
||||
-}
|
||||
-#endif /* HAVE_DH_GET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET0_PQG
|
||||
-int
|
||||
-DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
|
||||
-{
|
||||
- if ((dh->p == NULL && p == NULL) || (dh->g == NULL && g == NULL))
|
||||
- return 0;
|
||||
-
|
||||
- if (p != NULL) {
|
||||
- BN_free(dh->p);
|
||||
- dh->p = p;
|
||||
- }
|
||||
- if (q != NULL) {
|
||||
- BN_free(dh->q);
|
||||
- dh->q = q;
|
||||
- }
|
||||
- if (g != NULL) {
|
||||
- BN_free(dh->g);
|
||||
- dh->g = g;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DH_SET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DH_GET0_KEY
|
||||
-void
|
||||
-DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
|
||||
-{
|
||||
- if (pub_key != NULL)
|
||||
- *pub_key = dh->pub_key;
|
||||
- if (priv_key != NULL)
|
||||
- *priv_key = dh->priv_key;
|
||||
-}
|
||||
-#endif /* HAVE_DH_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET0_KEY
|
||||
-int
|
||||
-DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key)
|
||||
-{
|
||||
- if (pub_key != NULL) {
|
||||
- BN_free(dh->pub_key);
|
||||
- dh->pub_key = pub_key;
|
||||
- }
|
||||
- if (priv_key != NULL) {
|
||||
- BN_free(dh->priv_key);
|
||||
- dh->priv_key = priv_key;
|
||||
- }
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DH_SET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET_LENGTH
|
||||
-int
|
||||
-DH_set_length(DH *dh, long length)
|
||||
-{
|
||||
- if (length < 0 || length > INT_MAX)
|
||||
- return 0;
|
||||
-
|
||||
- dh->length = length;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_DH_SET_LENGTH */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_FREE
|
||||
-void
|
||||
-RSA_meth_free(RSA_METHOD *meth)
|
||||
-{
|
||||
- if (meth != NULL) {
|
||||
- free((char *)meth->name);
|
||||
- free(meth);
|
||||
- }
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_FREE */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_DUP
|
||||
-RSA_METHOD *
|
||||
-RSA_meth_dup(const RSA_METHOD *meth)
|
||||
-{
|
||||
- RSA_METHOD *copy;
|
||||
-
|
||||
- if ((copy = calloc(1, sizeof(*copy))) == NULL)
|
||||
- return NULL;
|
||||
- memcpy(copy, meth, sizeof(*copy));
|
||||
- if ((copy->name = strdup(meth->name)) == NULL) {
|
||||
- free(copy);
|
||||
- return NULL;
|
||||
- }
|
||||
-
|
||||
- return copy;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_DUP */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET1_NAME
|
||||
-int
|
||||
-RSA_meth_set1_name(RSA_METHOD *meth, const char *name)
|
||||
-{
|
||||
- char *copy;
|
||||
-
|
||||
- if ((copy = strdup(name)) == NULL)
|
||||
- return 0;
|
||||
- free((char *)meth->name);
|
||||
- meth->name = copy;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_SET1_NAME */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_GET_FINISH
|
||||
-int
|
||||
-(*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa)
|
||||
-{
|
||||
- return meth->finish;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_GET_FINISH */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_PRIV_ENC
|
||||
-int
|
||||
-RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc)(int flen,
|
||||
- const unsigned char *from, unsigned char *to, RSA *rsa, int padding))
|
||||
-{
|
||||
- meth->rsa_priv_enc = priv_enc;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_SET_PRIV_ENC */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_PRIV_DEC
|
||||
-int
|
||||
-RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen,
|
||||
- const unsigned char *from, unsigned char *to, RSA *rsa, int padding))
|
||||
-{
|
||||
- meth->rsa_priv_dec = priv_dec;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_SET_PRIV_DEC */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_FINISH
|
||||
-int
|
||||
-RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa))
|
||||
-{
|
||||
- meth->finish = finish;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif /* HAVE_RSA_METH_SET_FINISH */
|
||||
-
|
||||
-#ifndef HAVE_EVP_PKEY_GET0_RSA
|
||||
-RSA *
|
||||
-EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
|
||||
-{
|
||||
- if (pkey->type != EVP_PKEY_RSA) {
|
||||
- /* EVPerror(EVP_R_EXPECTING_AN_RSA_KEY); */
|
||||
- return NULL;
|
||||
- }
|
||||
- return pkey->pkey.rsa;
|
||||
-}
|
||||
-#endif /* HAVE_EVP_PKEY_GET0_RSA */
|
||||
-
|
||||
-#ifndef HAVE_EVP_MD_CTX_NEW
|
||||
-EVP_MD_CTX *
|
||||
-EVP_MD_CTX_new(void)
|
||||
-{
|
||||
- return calloc(1, sizeof(EVP_MD_CTX));
|
||||
-}
|
||||
-#endif /* HAVE_EVP_MD_CTX_NEW */
|
||||
-
|
||||
-#ifndef HAVE_EVP_MD_CTX_FREE
|
||||
-void
|
||||
-EVP_MD_CTX_free(EVP_MD_CTX *ctx)
|
||||
-{
|
||||
- if (ctx == NULL)
|
||||
- return;
|
||||
-
|
||||
- EVP_MD_CTX_cleanup(ctx);
|
||||
-
|
||||
- free(ctx);
|
||||
-}
|
||||
-#endif /* HAVE_EVP_MD_CTX_FREE */
|
||||
-
|
||||
#endif /* WITH_OPENSSL */
|
||||
diff --git a/openbsd-compat/openssl-compat.h b/openbsd-compat/openssl-compat.h
|
||||
index 61a69dd56eb..d0dd2c3450d 100644
|
||||
--- a/openbsd-compat/openssl-compat.h
|
||||
+++ b/openbsd-compat/openssl-compat.h
|
||||
@@ -33,26 +33,13 @@
|
||||
int ssh_compatible_openssl(long, long);
|
||||
void ssh_libcrypto_init(void);
|
||||
|
||||
-#if (OPENSSL_VERSION_NUMBER < 0x1000100fL)
|
||||
-# error OpenSSL 1.0.1 or greater is required
|
||||
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
|
||||
+# error OpenSSL 1.1.0 or greater is required
|
||||
#endif
|
||||
-
|
||||
-#ifndef OPENSSL_VERSION
|
||||
-# define OPENSSL_VERSION SSLEAY_VERSION
|
||||
-#endif
|
||||
-
|
||||
-#ifndef HAVE_OPENSSL_VERSION
|
||||
-# define OpenSSL_version(x) SSLeay_version(x)
|
||||
-#endif
|
||||
-
|
||||
-#ifndef HAVE_OPENSSL_VERSION_NUM
|
||||
-# define OpenSSL_version_num SSLeay
|
||||
-#endif
|
||||
-
|
||||
-#if OPENSSL_VERSION_NUMBER < 0x10000001L
|
||||
-# define LIBCRYPTO_EVP_INL_TYPE unsigned int
|
||||
-#else
|
||||
-# define LIBCRYPTO_EVP_INL_TYPE size_t
|
||||
+#ifdef LIBRESSL_VERSION_NUMBER
|
||||
+# if LIBRESSL_VERSION_NUMBER < 0x3010000fL
|
||||
+# error LibreSSL 3.1.0 or greater is required
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_RSA_MAX_MODULUS_BITS
|
||||
@@ -68,25 +55,6 @@ void ssh_libcrypto_init(void);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
-/* LibreSSL/OpenSSL 1.1x API compat */
|
||||
-#ifndef HAVE_DSA_GET0_PQG
|
||||
-void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q,
|
||||
- const BIGNUM **g);
|
||||
-#endif /* HAVE_DSA_GET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DSA_SET0_PQG
|
||||
-int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
-#endif /* HAVE_DSA_SET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DSA_GET0_KEY
|
||||
-void DSA_get0_key(const DSA *d, const BIGNUM **pub_key,
|
||||
- const BIGNUM **priv_key);
|
||||
-#endif /* HAVE_DSA_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DSA_SET0_KEY
|
||||
-int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
-#endif /* HAVE_DSA_SET0_KEY */
|
||||
-
|
||||
#ifndef HAVE_EVP_CIPHER_CTX_GET_IV
|
||||
# ifdef HAVE_EVP_CIPHER_CTX_GET_UPDATED_IV
|
||||
# define EVP_CIPHER_CTX_get_iv EVP_CIPHER_CTX_get_updated_iv
|
||||
@@ -101,112 +69,5 @@ int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx,
|
||||
const unsigned char *iv, size_t len);
|
||||
#endif /* HAVE_EVP_CIPHER_CTX_SET_IV */
|
||||
|
||||
-#ifndef HAVE_RSA_GET0_KEY
|
||||
-void RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e,
|
||||
- const BIGNUM **d);
|
||||
-#endif /* HAVE_RSA_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_KEY
|
||||
-int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
|
||||
-#endif /* HAVE_RSA_SET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_RSA_GET0_CRT_PARAMS
|
||||
-void RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
|
||||
- const BIGNUM **iqmp);
|
||||
-#endif /* HAVE_RSA_GET0_CRT_PARAMS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_CRT_PARAMS
|
||||
-int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
|
||||
-#endif /* HAVE_RSA_SET0_CRT_PARAMS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_GET0_FACTORS
|
||||
-void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
|
||||
-#endif /* HAVE_RSA_GET0_FACTORS */
|
||||
-
|
||||
-#ifndef HAVE_RSA_SET0_FACTORS
|
||||
-int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
|
||||
-#endif /* HAVE_RSA_SET0_FACTORS */
|
||||
-
|
||||
-#ifndef DSA_SIG_GET0
|
||||
-void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||
-#endif /* DSA_SIG_GET0 */
|
||||
-
|
||||
-#ifndef DSA_SIG_SET0
|
||||
-int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||
-#endif /* DSA_SIG_SET0 */
|
||||
-
|
||||
-#ifdef OPENSSL_HAS_ECC
|
||||
-#ifndef HAVE_ECDSA_SIG_GET0
|
||||
-void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||
-#endif /* HAVE_ECDSA_SIG_GET0 */
|
||||
-
|
||||
-#ifndef HAVE_ECDSA_SIG_SET0
|
||||
-int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||
-#endif /* HAVE_ECDSA_SIG_SET0 */
|
||||
-#endif /* OPENSSL_HAS_ECC */
|
||||
-
|
||||
-#ifndef HAVE_DH_GET0_PQG
|
||||
-void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q,
|
||||
- const BIGNUM **g);
|
||||
-#endif /* HAVE_DH_GET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET0_PQG
|
||||
-int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
-#endif /* HAVE_DH_SET0_PQG */
|
||||
-
|
||||
-#ifndef HAVE_DH_GET0_KEY
|
||||
-void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
-#endif /* HAVE_DH_GET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET0_KEY
|
||||
-int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
-#endif /* HAVE_DH_SET0_KEY */
|
||||
-
|
||||
-#ifndef HAVE_DH_SET_LENGTH
|
||||
-int DH_set_length(DH *dh, long length);
|
||||
-#endif /* HAVE_DH_SET_LENGTH */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_FREE
|
||||
-void RSA_meth_free(RSA_METHOD *meth);
|
||||
-#endif /* HAVE_RSA_METH_FREE */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_DUP
|
||||
-RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth);
|
||||
-#endif /* HAVE_RSA_METH_DUP */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET1_NAME
|
||||
-int RSA_meth_set1_name(RSA_METHOD *meth, const char *name);
|
||||
-#endif /* HAVE_RSA_METH_SET1_NAME */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_GET_FINISH
|
||||
-int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa);
|
||||
-#endif /* HAVE_RSA_METH_GET_FINISH */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_PRIV_ENC
|
||||
-int RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc)(int flen,
|
||||
- const unsigned char *from, unsigned char *to, RSA *rsa, int padding));
|
||||
-#endif /* HAVE_RSA_METH_SET_PRIV_ENC */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_PRIV_DEC
|
||||
-int RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen,
|
||||
- const unsigned char *from, unsigned char *to, RSA *rsa, int padding));
|
||||
-#endif /* HAVE_RSA_METH_SET_PRIV_DEC */
|
||||
-
|
||||
-#ifndef HAVE_RSA_METH_SET_FINISH
|
||||
-int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa));
|
||||
-#endif /* HAVE_RSA_METH_SET_FINISH */
|
||||
-
|
||||
-#ifndef HAVE_EVP_PKEY_GET0_RSA
|
||||
-RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
|
||||
-#endif /* HAVE_EVP_PKEY_GET0_RSA */
|
||||
-
|
||||
-#ifndef HAVE_EVP_MD_CTX_new
|
||||
-EVP_MD_CTX *EVP_MD_CTX_new(void);
|
||||
-#endif /* HAVE_EVP_MD_CTX_new */
|
||||
-
|
||||
-#ifndef HAVE_EVP_MD_CTX_free
|
||||
-void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
|
||||
-#endif /* HAVE_EVP_MD_CTX_free */
|
||||
-
|
||||
#endif /* WITH_OPENSSL */
|
||||
#endif /* _OPENSSL_COMPAT_H */
|
||||
@@ -26,6 +26,8 @@ SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar
|
||||
file://add-test-support-for-busybox.patch \
|
||||
file://f107467179428a0e3ea9e4aa9738ac12ff02822d.patch \
|
||||
file://0001-Default-to-not-using-sandbox-when-cross-compiling.patch \
|
||||
file://7280401bdd77ca54be6867a154cc01e0d72612e0.patch \
|
||||
file://0001-upstream-include-destination-constraints-for-smartca.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "fd497654b7ab1686dac672fb83dfb4ba4096e8b5ffcdaccd262380ae58bec5e7"
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Index: openssl-3.0.4/Configure
|
||||
}
|
||||
|
||||
-if ($target =~ /linux.*-mips/ && !$disabled{asm}
|
||||
- && !grep { $_ !~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
|
||||
- && !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
|
||||
- # minimally required architecture flags for assembly modules
|
||||
- my $value;
|
||||
- $value = '-mips2' if ($target =~ /mips32/);
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
From 959c59c7a0164117e7f8366466a32bb1f8d77ff1 Mon Sep 17 00:00:00 2001
|
||||
From: Pauli <pauli@openssl.org>
|
||||
Date: Wed, 8 Mar 2023 15:28:20 +1100
|
||||
Subject: [PATCH] x509: excessive resource use verifying policy constraints
|
||||
|
||||
A security vulnerability has been identified in all supported versions
|
||||
of OpenSSL related to the verification of X.509 certificate chains
|
||||
that include policy constraints. Attackers may be able to exploit this
|
||||
vulnerability by creating a malicious certificate chain that triggers
|
||||
exponential use of computational resources, leading to a denial-of-service
|
||||
(DoS) attack on affected systems.
|
||||
|
||||
Fixes CVE-2023-0464
|
||||
|
||||
Reviewed-by: Tomas Mraz <tomas@openssl.org>
|
||||
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
|
||||
(Merged from https://github.com/openssl/openssl/pull/20568)
|
||||
|
||||
Upstream-Status: Backport from [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=959c59c7a0164117e7f8366466a32bb1f8d77ff1]
|
||||
CVE: CVE-2023-0464
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
crypto/x509/pcy_local.h | 8 +++++++-
|
||||
crypto/x509/pcy_node.c | 12 +++++++++---
|
||||
crypto/x509/pcy_tree.c | 36 ++++++++++++++++++++++++++----------
|
||||
3 files changed, 42 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/crypto/x509/pcy_local.h b/crypto/x509/pcy_local.h
|
||||
index 18b53cc..cba107c 100644
|
||||
--- a/crypto/x509/pcy_local.h
|
||||
+++ b/crypto/x509/pcy_local.h
|
||||
@@ -111,6 +111,11 @@ struct X509_POLICY_LEVEL_st {
|
||||
};
|
||||
|
||||
struct X509_POLICY_TREE_st {
|
||||
+ /* The number of nodes in the tree */
|
||||
+ size_t node_count;
|
||||
+ /* The maximum number of nodes in the tree */
|
||||
+ size_t node_maximum;
|
||||
+
|
||||
/* This is the tree 'level' data */
|
||||
X509_POLICY_LEVEL *levels;
|
||||
int nlevel;
|
||||
@@ -157,7 +162,8 @@ X509_POLICY_NODE *ossl_policy_tree_find_sk(STACK_OF(X509_POLICY_NODE) *sk,
|
||||
X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
X509_POLICY_DATA *data,
|
||||
X509_POLICY_NODE *parent,
|
||||
- X509_POLICY_TREE *tree);
|
||||
+ X509_POLICY_TREE *tree,
|
||||
+ int extra_data);
|
||||
void ossl_policy_node_free(X509_POLICY_NODE *node);
|
||||
int ossl_policy_node_match(const X509_POLICY_LEVEL *lvl,
|
||||
const X509_POLICY_NODE *node, const ASN1_OBJECT *oid);
|
||||
diff --git a/crypto/x509/pcy_node.c b/crypto/x509/pcy_node.c
|
||||
index 9d9a7ea..450f95a 100644
|
||||
--- a/crypto/x509/pcy_node.c
|
||||
+++ b/crypto/x509/pcy_node.c
|
||||
@@ -59,10 +59,15 @@ X509_POLICY_NODE *ossl_policy_level_find_node(const X509_POLICY_LEVEL *level,
|
||||
X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
X509_POLICY_DATA *data,
|
||||
X509_POLICY_NODE *parent,
|
||||
- X509_POLICY_TREE *tree)
|
||||
+ X509_POLICY_TREE *tree,
|
||||
+ int extra_data)
|
||||
{
|
||||
X509_POLICY_NODE *node;
|
||||
|
||||
+ /* Verify that the tree isn't too large. This mitigates CVE-2023-0464 */
|
||||
+ if (tree->node_maximum > 0 && tree->node_count >= tree->node_maximum)
|
||||
+ return NULL;
|
||||
+
|
||||
node = OPENSSL_zalloc(sizeof(*node));
|
||||
if (node == NULL) {
|
||||
ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
|
||||
@@ -70,7 +75,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
}
|
||||
node->data = data;
|
||||
node->parent = parent;
|
||||
- if (level) {
|
||||
+ if (level != NULL) {
|
||||
if (OBJ_obj2nid(data->valid_policy) == NID_any_policy) {
|
||||
if (level->anyPolicy)
|
||||
goto node_error;
|
||||
@@ -90,7 +95,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
}
|
||||
}
|
||||
|
||||
- if (tree) {
|
||||
+ if (extra_data) {
|
||||
if (tree->extra_data == NULL)
|
||||
tree->extra_data = sk_X509_POLICY_DATA_new_null();
|
||||
if (tree->extra_data == NULL){
|
||||
@@ -103,6 +108,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
|
||||
}
|
||||
}
|
||||
|
||||
+ tree->node_count++;
|
||||
if (parent)
|
||||
parent->nchild++;
|
||||
|
||||
diff --git a/crypto/x509/pcy_tree.c b/crypto/x509/pcy_tree.c
|
||||
index fa45da5..f953a05 100644
|
||||
--- a/crypto/x509/pcy_tree.c
|
||||
+++ b/crypto/x509/pcy_tree.c
|
||||
@@ -14,6 +14,17 @@
|
||||
|
||||
#include "pcy_local.h"
|
||||
|
||||
+/*
|
||||
+ * If the maximum number of nodes in the policy tree isn't defined, set it to
|
||||
+ * a generous default of 1000 nodes.
|
||||
+ *
|
||||
+ * Defining this to be zero means unlimited policy tree growth which opens the
|
||||
+ * door on CVE-2023-0464.
|
||||
+ */
|
||||
+#ifndef OPENSSL_POLICY_TREE_NODES_MAX
|
||||
+# define OPENSSL_POLICY_TREE_NODES_MAX 1000
|
||||
+#endif
|
||||
+
|
||||
static void expected_print(BIO *channel,
|
||||
X509_POLICY_LEVEL *lev, X509_POLICY_NODE *node,
|
||||
int indent)
|
||||
@@ -163,6 +174,9 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
|
||||
return X509_PCY_TREE_INTERNAL;
|
||||
}
|
||||
|
||||
+ /* Limit the growth of the tree to mitigate CVE-2023-0464 */
|
||||
+ tree->node_maximum = OPENSSL_POLICY_TREE_NODES_MAX;
|
||||
+
|
||||
/*
|
||||
* http://tools.ietf.org/html/rfc5280#section-6.1.2, figure 3.
|
||||
*
|
||||
@@ -180,7 +194,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
|
||||
if ((data = ossl_policy_data_new(NULL,
|
||||
OBJ_nid2obj(NID_any_policy), 0)) == NULL)
|
||||
goto bad_tree;
|
||||
- if (ossl_policy_level_add_node(level, data, NULL, tree) == NULL) {
|
||||
+ if (ossl_policy_level_add_node(level, data, NULL, tree, 1) == NULL) {
|
||||
ossl_policy_data_free(data);
|
||||
goto bad_tree;
|
||||
}
|
||||
@@ -239,7 +253,8 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
|
||||
* Return value: 1 on success, 0 otherwise
|
||||
*/
|
||||
static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
|
||||
- X509_POLICY_DATA *data)
|
||||
+ X509_POLICY_DATA *data,
|
||||
+ X509_POLICY_TREE *tree)
|
||||
{
|
||||
X509_POLICY_LEVEL *last = curr - 1;
|
||||
int i, matched = 0;
|
||||
@@ -249,13 +264,13 @@ static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
|
||||
X509_POLICY_NODE *node = sk_X509_POLICY_NODE_value(last->nodes, i);
|
||||
|
||||
if (ossl_policy_node_match(last, node, data->valid_policy)) {
|
||||
- if (ossl_policy_level_add_node(curr, data, node, NULL) == NULL)
|
||||
+ if (ossl_policy_level_add_node(curr, data, node, tree, 0) == NULL)
|
||||
return 0;
|
||||
matched = 1;
|
||||
}
|
||||
}
|
||||
if (!matched && last->anyPolicy) {
|
||||
- if (ossl_policy_level_add_node(curr, data, last->anyPolicy, NULL) == NULL)
|
||||
+ if (ossl_policy_level_add_node(curr, data, last->anyPolicy, tree, 0) == NULL)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -268,7 +283,8 @@ static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
|
||||
* Return value: 1 on success, 0 otherwise.
|
||||
*/
|
||||
static int tree_link_nodes(X509_POLICY_LEVEL *curr,
|
||||
- const X509_POLICY_CACHE *cache)
|
||||
+ const X509_POLICY_CACHE *cache,
|
||||
+ X509_POLICY_TREE *tree)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -276,7 +292,7 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr,
|
||||
X509_POLICY_DATA *data = sk_X509_POLICY_DATA_value(cache->data, i);
|
||||
|
||||
/* Look for matching nodes in previous level */
|
||||
- if (!tree_link_matching_nodes(curr, data))
|
||||
+ if (!tree_link_matching_nodes(curr, data, tree))
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -307,7 +323,7 @@ static int tree_add_unmatched(X509_POLICY_LEVEL *curr,
|
||||
/* Curr may not have anyPolicy */
|
||||
data->qualifier_set = cache->anyPolicy->qualifier_set;
|
||||
data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;
|
||||
- if (ossl_policy_level_add_node(curr, data, node, tree) == NULL) {
|
||||
+ if (ossl_policy_level_add_node(curr, data, node, tree, 1) == NULL) {
|
||||
ossl_policy_data_free(data);
|
||||
return 0;
|
||||
}
|
||||
@@ -370,7 +386,7 @@ static int tree_link_any(X509_POLICY_LEVEL *curr,
|
||||
/* Finally add link to anyPolicy */
|
||||
if (last->anyPolicy &&
|
||||
ossl_policy_level_add_node(curr, cache->anyPolicy,
|
||||
- last->anyPolicy, NULL) == NULL)
|
||||
+ last->anyPolicy, tree, 0) == NULL)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
@@ -553,7 +569,7 @@ static int tree_calculate_user_set(X509_POLICY_TREE *tree,
|
||||
extra->flags = POLICY_DATA_FLAG_SHARED_QUALIFIERS
|
||||
| POLICY_DATA_FLAG_EXTRA_NODE;
|
||||
node = ossl_policy_level_add_node(NULL, extra, anyPolicy->parent,
|
||||
- tree);
|
||||
+ tree, 1);
|
||||
}
|
||||
if (!tree->user_policies) {
|
||||
tree->user_policies = sk_X509_POLICY_NODE_new_null();
|
||||
@@ -580,7 +596,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree)
|
||||
|
||||
for (i = 1; i < tree->nlevel; i++, curr++) {
|
||||
cache = ossl_policy_cache_set(curr->cert);
|
||||
- if (!tree_link_nodes(curr, cache))
|
||||
+ if (!tree_link_nodes(curr, cache, tree))
|
||||
return X509_PCY_TREE_INTERNAL;
|
||||
|
||||
if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY)
|
||||
--
|
||||
2.35.7
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
From 1dd43e0709fece299b15208f36cc7c76209ba0bb Mon Sep 17 00:00:00 2001
|
||||
From: Matt Caswell <matt@openssl.org>
|
||||
Date: Tue, 7 Mar 2023 16:52:55 +0000
|
||||
Subject: [PATCH] Ensure that EXFLAG_INVALID_POLICY is checked even in leaf
|
||||
certs
|
||||
|
||||
Even though we check the leaf cert to confirm it is valid, we
|
||||
later ignored the invalid flag and did not notice that the leaf
|
||||
cert was bad.
|
||||
|
||||
Fixes: CVE-2023-0465
|
||||
|
||||
Reviewed-by: Hugo Landau <hlandau@openssl.org>
|
||||
Reviewed-by: Tomas Mraz <tomas@openssl.org>
|
||||
(Merged from https://github.com/openssl/openssl/pull/20587)
|
||||
|
||||
Upstream-Status: Backport from [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=1dd43e0709fece299b15208f36cc7c76209ba0bb]
|
||||
CVE: CVE-2023-0465
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
crypto/x509/x509_vfy.c | 12 ++++++++++--
|
||||
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
|
||||
index 9384f1d..a0282c3 100644
|
||||
--- a/crypto/x509/x509_vfy.c
|
||||
+++ b/crypto/x509/x509_vfy.c
|
||||
@@ -1654,15 +1654,23 @@ static int check_policy(X509_STORE_CTX *ctx)
|
||||
goto memerr;
|
||||
/* Invalid or inconsistent extensions */
|
||||
if (ret == X509_PCY_TREE_INVALID) {
|
||||
- int i;
|
||||
+ int i, cbcalled = 0;
|
||||
|
||||
/* Locate certificates with bad extensions and notify callback. */
|
||||
- for (i = 1; i < sk_X509_num(ctx->chain); i++) {
|
||||
+ for (i = 0; i < sk_X509_num(ctx->chain); i++) {
|
||||
X509 *x = sk_X509_value(ctx->chain, i);
|
||||
|
||||
+ if ((x->ex_flags & EXFLAG_INVALID_POLICY) != 0)
|
||||
+ cbcalled = 1;
|
||||
CB_FAIL_IF((x->ex_flags & EXFLAG_INVALID_POLICY) != 0,
|
||||
ctx, x, i, X509_V_ERR_INVALID_POLICY_EXTENSION);
|
||||
}
|
||||
+ if (!cbcalled) {
|
||||
+ /* Should not be able to get here */
|
||||
+ ERR_raise(ERR_LIB_X509, ERR_R_INTERNAL_ERROR);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /* The callback ignored the error so we return success */
|
||||
return 1;
|
||||
}
|
||||
if (ret == X509_PCY_TREE_FAILURE) {
|
||||
--
|
||||
2.35.7
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
From 51e8a84ce742db0f6c70510d0159dad8f7825908 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Mraz <tomas@openssl.org>
|
||||
Date: Tue, 21 Mar 2023 16:15:47 +0100
|
||||
Subject: [PATCH] Fix documentation of X509_VERIFY_PARAM_add0_policy()
|
||||
|
||||
The function was incorrectly documented as enabling policy checking.
|
||||
|
||||
Fixes: CVE-2023-0466
|
||||
|
||||
Reviewed-by: Matt Caswell <matt@openssl.org>
|
||||
Reviewed-by: Paul Dale <pauli@openssl.org>
|
||||
(Merged from https://github.com/openssl/openssl/pull/20563)
|
||||
|
||||
Upstream-Status: Backport from [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=51e8a84ce742db0f6c70510d0159dad8f7825908]
|
||||
CVE: CVE-2023-0466
|
||||
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
|
||||
---
|
||||
doc/man3/X509_VERIFY_PARAM_set_flags.pod | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/doc/man3/X509_VERIFY_PARAM_set_flags.pod b/doc/man3/X509_VERIFY_PARAM_set_flags.pod
|
||||
index 75a1677..43c1900 100644
|
||||
--- a/doc/man3/X509_VERIFY_PARAM_set_flags.pod
|
||||
+++ b/doc/man3/X509_VERIFY_PARAM_set_flags.pod
|
||||
@@ -98,8 +98,9 @@ B<trust>.
|
||||
X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to
|
||||
B<t>. Normally the current time is used.
|
||||
|
||||
-X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled
|
||||
-by default) and adds B<policy> to the acceptable policy set.
|
||||
+X509_VERIFY_PARAM_add0_policy() adds B<policy> to the acceptable policy set.
|
||||
+Contrary to preexisting documentation of this function it does not enable
|
||||
+policy checking.
|
||||
|
||||
X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled
|
||||
by default) and sets the acceptable policy set to B<policies>. Any existing
|
||||
@@ -400,6 +401,10 @@ The X509_VERIFY_PARAM_get_hostflags() function was added in OpenSSL 1.1.0i.
|
||||
The X509_VERIFY_PARAM_get0_host(), X509_VERIFY_PARAM_get0_email(),
|
||||
and X509_VERIFY_PARAM_get1_ip_asc() functions were added in OpenSSL 3.0.
|
||||
|
||||
+The function X509_VERIFY_PARAM_add0_policy() was historically documented as
|
||||
+enabling policy checking however the implementation has never done this.
|
||||
+The documentation was changed to align with the implementation.
|
||||
+
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2009-2023 The OpenSSL Project Authors. All Rights Reserved.
|
||||
--
|
||||
2.35.7
|
||||
|
||||
@@ -12,16 +12,13 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
|
||||
file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
|
||||
file://afalg.patch \
|
||||
file://0001-Configure-do-not-tweak-mips-cflags.patch \
|
||||
file://CVE-2023-0464.patch \
|
||||
file://CVE-2023-0465.patch \
|
||||
file://CVE-2023-0466.patch \
|
||||
"
|
||||
|
||||
SRC_URI:append:class-nativesdk = " \
|
||||
file://environment.d-openssl.sh \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e"
|
||||
SRC_URI[sha256sum] = "eb1ab04781474360f77c318ab89d8c5a03abc38e63d65a603cabbf1b00a1dc90"
|
||||
|
||||
inherit lib_package multilib_header multilib_script ptest perlnative
|
||||
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"
|
||||
@@ -80,7 +77,7 @@ do_configure () {
|
||||
esac
|
||||
target="$os-${HOST_ARCH}"
|
||||
case $target in
|
||||
linux-arc)
|
||||
linux-arc | linux-microblaze*)
|
||||
target=linux-latomic
|
||||
;;
|
||||
linux-arm*)
|
||||
@@ -108,7 +105,7 @@ do_configure () {
|
||||
linux-*-mips64 | linux-mips64 | linux-*-mips64el | linux-mips64el)
|
||||
target=linux64-mips64
|
||||
;;
|
||||
linux-microblaze* | linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
|
||||
linux-nios2* | linux-sh3 | linux-sh4 | linux-arc*)
|
||||
target=linux-generic32
|
||||
;;
|
||||
linux-powerpc)
|
||||
@@ -1,6 +1,6 @@
|
||||
SRCBRANCH ?= "release/2.35/master"
|
||||
PV = "2.35"
|
||||
SRCREV_glibc ?= "293211b6fddf60fc407d21fcba0326dd2148f76b"
|
||||
SRCREV_glibc ?= "cbceb903c4d770acc7e4ba5641036516830ed69b"
|
||||
SRCREV_localedef ?= "794da69788cbf9bf57b59a852f9f11307663fa87"
|
||||
|
||||
GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
From 952aff5c00ad7c6b83c3f310f2643939538827f8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?=
|
||||
=?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= <leo@yuriev.ru>
|
||||
Date: Sat, 4 Feb 2023 14:41:38 +0300
|
||||
Subject: [PATCH] gmon: Fix allocated buffer overflow (bug 29444)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `__monstartup()` allocates a buffer used to store all the data
|
||||
accumulated by the monitor.
|
||||
|
||||
The size of this buffer depends on the size of the internal structures
|
||||
used and the address range for which the monitor is activated, as well
|
||||
as on the maximum density of call instructions and/or callable functions
|
||||
that could be potentially on a segment of executable code.
|
||||
|
||||
In particular a hash table of arcs is placed at the end of this buffer.
|
||||
The size of this hash table is calculated in bytes as
|
||||
p->fromssize = p->textsize / HASHFRACTION;
|
||||
|
||||
but actually should be
|
||||
p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
|
||||
This results in writing beyond the end of the allocated buffer when an
|
||||
added arc corresponds to a call near from the end of the monitored
|
||||
address range, since `_mcount()` check the incoming caller address for
|
||||
monitored range but not the intermediate result hash-like index that
|
||||
uses to write into the table.
|
||||
|
||||
It should be noted that when the results are output to `gmon.out`, the
|
||||
table is read to the last element calculated from the allocated size in
|
||||
bytes, so the arcs stored outside the buffer boundary did not fall into
|
||||
`gprof` for analysis. Thus this "feature" help me to found this bug
|
||||
during working with https://sourceware.org/bugzilla/show_bug.cgi?id=29438
|
||||
|
||||
Just in case, I will explicitly note that the problem breaks the
|
||||
`make test t=gmon/tst-gmon-dso` added for Bug 29438.
|
||||
There, the arc of the `f3()` call disappears from the output, since in
|
||||
the DSO case, the call to `f3` is located close to the end of the
|
||||
monitored range.
|
||||
|
||||
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
|
||||
|
||||
Another minor error seems a related typo in the calculation of
|
||||
`kcountsize`, but since kcounts are smaller than froms, this is
|
||||
actually to align the p->froms data.
|
||||
|
||||
Co-authored-by: DJ Delorie <dj@redhat.com>
|
||||
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=801af9fafd4689337ebf27260aa115335a0cb2bc]
|
||||
CVE: CVE-2023-0687
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
gmon/gmon.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gmon/gmon.c b/gmon/gmon.c
|
||||
index dee6480..bf76358 100644
|
||||
--- a/gmon/gmon.c
|
||||
+++ b/gmon/gmon.c
|
||||
@@ -132,6 +132,8 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
p->lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
|
||||
p->textsize = p->highpc - p->lowpc;
|
||||
+ /* This looks like a typo, but it's here to align the p->froms
|
||||
+ section. */
|
||||
p->kcountsize = ROUNDUP(p->textsize / HISTFRACTION, sizeof(*p->froms));
|
||||
p->hashfraction = HASHFRACTION;
|
||||
p->log_hashfraction = -1;
|
||||
@@ -142,7 +144,7 @@ __monstartup (u_long lowpc, u_long highpc)
|
||||
instead of integer division. Precompute shift amount. */
|
||||
p->log_hashfraction = ffs(p->hashfraction * sizeof(*p->froms)) - 1;
|
||||
}
|
||||
- p->fromssize = p->textsize / HASHFRACTION;
|
||||
+ p->fromssize = ROUNDUP(p->textsize / HASHFRACTION, sizeof(*p->froms));
|
||||
p->tolimit = p->textsize * ARCDENSITY / 100;
|
||||
if (p->tolimit < MINARCS)
|
||||
p->tolimit = MINARCS;
|
||||
--
|
||||
2.7.4
|
||||
@@ -50,7 +50,6 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
|
||||
file://0024-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \
|
||||
\
|
||||
file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \
|
||||
file://CVE-2023-0687.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
B = "${WORKDIR}/build-${TARGET_SYS}"
|
||||
|
||||
@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk wic.vhd wic.vhdx"
|
||||
|
||||
inherit core-image setuptools3
|
||||
|
||||
SRCREV ?= "c3038cddbce42b7e4268c1f0b45e9fba85caa231"
|
||||
SRCREV ?= "5ded548a1e70d000f6c91f18082bbe996189db57"
|
||||
SRC_URI = "git://git.yoctoproject.org/poky;branch=kirkstone \
|
||||
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
|
||||
@@ -433,7 +433,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
|
||||
|
||||
@@ -25,6 +25,8 @@ SRC_URI += "http://www.w3.org/XML/Test/xmlts20080827.tar;subdir=${BP};name=testt
|
||||
file://0001-Port-gentest.py-to-Python-3.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] = "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
|
||||
|
||||
334
meta/recipes-core/meta/cve-update-nvd2-native.bb
Normal file
334
meta/recipes-core/meta/cve-update-nvd2-native.bb
Normal file
@@ -0,0 +1,334 @@
|
||||
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"
|
||||
|
||||
# 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
|
||||
|
||||
headers = {}
|
||||
if api_key:
|
||||
headers['apiKey'] = api_key
|
||||
|
||||
data = urllib.parse.urlencode(args)
|
||||
|
||||
full_request = url + '?' + data
|
||||
|
||||
for attempt in range(3):
|
||||
try:
|
||||
r = urllib.request.urlopen(full_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 UnicodeDecodeError:
|
||||
# Received garbage, retry
|
||||
bb.debug(2, "CVE database: received malformed data, retrying (request: %s)" %(full_request))
|
||||
pass
|
||||
except http.client.IncompleteRead:
|
||||
# Read incomplete, let's try again
|
||||
bb.debug(2, "CVE database: received incomplete data, retrying (request: %s)" %(full_request))
|
||||
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.combine(datetime.date.fromtimestamp(database_time), datetime.time())
|
||||
today_date = datetime.datetime.combine(datetime.date.today(), datetime.time())
|
||||
delta = today_date - database_date
|
||||
if delta.days < 120:
|
||||
bb.debug(2, "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.debug(2, "Updating entries")
|
||||
index = 0
|
||||
url = d.getVar("NVDCVE_URL")
|
||||
while True:
|
||||
req_args['startIndex'] = index
|
||||
raw_data = nvd_request_next(url, None, 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"]
|
||||
|
||||
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
|
||||
try:
|
||||
accessVector = accessVector or elt['impact']['baseMetricV3']['cvssV3']['attackVector']
|
||||
cvssv3 = elt['impact']['baseMetricV3']['cvssV3']['baseScore']
|
||||
except KeyError:
|
||||
accessVector = accessVector or "UNKNOWN"
|
||||
cvssv3 = 0.0
|
||||
|
||||
conn.execute("insert or replace into NVD values (?, ?, ?, ?, ?, ?)",
|
||||
[cveId, cveDesc, cvssv2, cvssv3, date, accessVector]).close()
|
||||
|
||||
try:
|
||||
configurations = elt['cve']['configurations'][0]['nodes']
|
||||
for config in configurations:
|
||||
parse_node_and_insert(conn, config, cveId)
|
||||
except KeyError:
|
||||
bb.debug(2, "Entry without a configuration")
|
||||
|
||||
do_fetch[nostamp] = "1"
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
@@ -184,12 +184,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)
|
||||
|
||||
@@ -229,8 +231,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'):
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
From 31b25c7d360a2ef2da1717aa39f190de5222d11a Mon Sep 17 00:00:00 2001
|
||||
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
||||
Date: Mon, 31 Jan 2022 19:08:27 +0900
|
||||
Subject: [PATCH] network: remove only managed configs on reconfigure or
|
||||
carrier lost
|
||||
|
||||
Otherwise, if the carrir of the non-managed interface is lost, the
|
||||
configs such as addresses or routes on the interface will be removed by
|
||||
networkd.
|
||||
|
||||
Upstream-Status: Backport [systemd v251 a0e99a377a2f22c0ba460d3e7228214008714c14]
|
||||
Signed-off-by: C. Andy Martin <cam@myfastmail.com>
|
||||
---
|
||||
src/network/networkd-address.c | 13 +++++--------
|
||||
src/network/networkd-address.h | 2 +-
|
||||
src/network/networkd-link.c | 18 ++++++++++--------
|
||||
src/network/networkd-neighbor.c | 6 +++++-
|
||||
src/network/networkd-neighbor.h | 2 +-
|
||||
src/network/networkd-nexthop.c | 16 ++++++++++------
|
||||
src/network/networkd-nexthop.h | 2 +-
|
||||
src/network/networkd-route.c | 16 ++++++++++------
|
||||
src/network/networkd-route.h | 2 +-
|
||||
src/network/networkd-routing-policy-rule.c | 4 ++--
|
||||
src/network/networkd-routing-policy-rule.h | 2 +-
|
||||
test/test-network/systemd-networkd-tests.py | 2 +-
|
||||
12 files changed, 48 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
|
||||
index 7df743efb5..01c1d88dec 100644
|
||||
--- a/src/network/networkd-address.c
|
||||
+++ b/src/network/networkd-address.c
|
||||
@@ -891,22 +891,19 @@ int link_drop_foreign_addresses(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
-int link_drop_addresses(Link *link) {
|
||||
+int link_drop_managed_addresses(Link *link) {
|
||||
Address *address;
|
||||
int k, r = 0;
|
||||
|
||||
assert(link);
|
||||
|
||||
SET_FOREACH(address, link->addresses) {
|
||||
- /* Ignore addresses not assigned yet or already removing. */
|
||||
- if (!address_exists(address))
|
||||
+ /* Do not touch addresses managed by kernel or other tools. */
|
||||
+ if (address->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
continue;
|
||||
|
||||
- /* Do not drop IPv6LL addresses assigned by the kernel here. They will be dropped in
|
||||
- * link_drop_ipv6ll_addresses() if IPv6LL addressing is disabled. */
|
||||
- if (address->source == NETWORK_CONFIG_SOURCE_FOREIGN &&
|
||||
- address->family == AF_INET6 &&
|
||||
- in6_addr_is_link_local(&address->in_addr.in6))
|
||||
+ /* Ignore addresses not assigned yet or already removing. */
|
||||
+ if (!address_exists(address))
|
||||
continue;
|
||||
|
||||
k = address_remove(address);
|
||||
diff --git a/src/network/networkd-address.h b/src/network/networkd-address.h
|
||||
index 41c4ce6fa4..b2110d8d21 100644
|
||||
--- a/src/network/networkd-address.h
|
||||
+++ b/src/network/networkd-address.h
|
||||
@@ -74,7 +74,7 @@ void address_set_broadcast(Address *a);
|
||||
|
||||
DEFINE_NETWORK_SECTION_FUNCTIONS(Address, address_free);
|
||||
|
||||
-int link_drop_addresses(Link *link);
|
||||
+int link_drop_managed_addresses(Link *link);
|
||||
int link_drop_foreign_addresses(Link *link);
|
||||
int link_drop_ipv6ll_addresses(Link *link);
|
||||
void link_foreignize_addresses(Link *link);
|
||||
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
|
||||
index b62a154828..12c592b257 100644
|
||||
--- a/src/network/networkd-link.c
|
||||
+++ b/src/network/networkd-link.c
|
||||
@@ -1070,27 +1070,27 @@ static int link_drop_foreign_config(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
-static int link_drop_config(Link *link) {
|
||||
+static int link_drop_managed_config(Link *link) {
|
||||
int k, r;
|
||||
|
||||
assert(link);
|
||||
assert(link->manager);
|
||||
|
||||
- r = link_drop_routes(link);
|
||||
+ r = link_drop_managed_routes(link);
|
||||
|
||||
- k = link_drop_nexthops(link);
|
||||
+ k = link_drop_managed_nexthops(link);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
- k = link_drop_addresses(link);
|
||||
+ k = link_drop_managed_addresses(link);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
- k = link_drop_neighbors(link);
|
||||
+ k = link_drop_managed_neighbors(link);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
- k = link_drop_routing_policy_rules(link);
|
||||
+ k = link_drop_managed_routing_policy_rules(link);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
@@ -1318,7 +1318,9 @@ static int link_reconfigure_impl(Link *link, bool force) {
|
||||
* link_drop_foreign_config() in link_configure(). */
|
||||
link_foreignize_config(link);
|
||||
else {
|
||||
- r = link_drop_config(link);
|
||||
+ /* Remove all managed configs. Note, foreign configs are removed in later by
|
||||
+ * link_configure() -> link_drop_foreign_config() if the link is managed by us. */
|
||||
+ r = link_drop_managed_config(link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
@@ -1705,7 +1707,7 @@ static int link_carrier_lost_impl(Link *link) {
|
||||
if (r < 0)
|
||||
ret = r;
|
||||
|
||||
- r = link_drop_config(link);
|
||||
+ r = link_drop_managed_config(link);
|
||||
if (r < 0 && ret >= 0)
|
||||
ret = r;
|
||||
|
||||
diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c
|
||||
index 1766095e53..b58898a6dc 100644
|
||||
--- a/src/network/networkd-neighbor.c
|
||||
+++ b/src/network/networkd-neighbor.c
|
||||
@@ -406,13 +406,17 @@ int link_drop_foreign_neighbors(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
-int link_drop_neighbors(Link *link) {
|
||||
+int link_drop_managed_neighbors(Link *link) {
|
||||
Neighbor *neighbor;
|
||||
int k, r = 0;
|
||||
|
||||
assert(link);
|
||||
|
||||
SET_FOREACH(neighbor, link->neighbors) {
|
||||
+ /* Do not touch nexthops managed by kernel or other tools. */
|
||||
+ if (neighbor->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ continue;
|
||||
+
|
||||
/* Ignore neighbors not assigned yet or already removing. */
|
||||
if (!neighbor_exists(neighbor))
|
||||
continue;
|
||||
diff --git a/src/network/networkd-neighbor.h b/src/network/networkd-neighbor.h
|
||||
index e9e1854110..8e3c510cd5 100644
|
||||
--- a/src/network/networkd-neighbor.h
|
||||
+++ b/src/network/networkd-neighbor.h
|
||||
@@ -34,7 +34,7 @@ int neighbor_compare_func(const Neighbor *a, const Neighbor *b);
|
||||
|
||||
void network_drop_invalid_neighbors(Network *network);
|
||||
|
||||
-int link_drop_neighbors(Link *link);
|
||||
+int link_drop_managed_neighbors(Link *link);
|
||||
int link_drop_foreign_neighbors(Link *link);
|
||||
void link_foreignize_neighbors(Link *link);
|
||||
|
||||
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c
|
||||
index b829aaab90..42aa8c4c59 100644
|
||||
--- a/src/network/networkd-nexthop.c
|
||||
+++ b/src/network/networkd-nexthop.c
|
||||
@@ -613,8 +613,8 @@ static void manager_mark_nexthops(Manager *manager, bool foreign, const Link *ex
|
||||
if (nexthop->protocol == RTPROT_KERNEL)
|
||||
continue;
|
||||
|
||||
- /* When 'foreign' is true, do not remove nexthops we configured. */
|
||||
- if (foreign && nexthop->source != NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ /* When 'foreign' is true, mark only foreign nexthops, and vice versa. */
|
||||
+ if (foreign != (nexthop->source == NETWORK_CONFIG_SOURCE_FOREIGN))
|
||||
continue;
|
||||
|
||||
/* Ignore nexthops not assigned yet or already removed. */
|
||||
@@ -641,7 +641,7 @@ static void manager_mark_nexthops(Manager *manager, bool foreign, const Link *ex
|
||||
}
|
||||
}
|
||||
|
||||
-static int manager_drop_nexthops(Manager *manager) {
|
||||
+static int manager_drop_marked_nexthops(Manager *manager) {
|
||||
NextHop *nexthop;
|
||||
int k, r = 0;
|
||||
|
||||
@@ -704,14 +704,14 @@ int link_drop_foreign_nexthops(Link *link) {
|
||||
|
||||
manager_mark_nexthops(link->manager, /* foreign = */ true, NULL);
|
||||
|
||||
- k = manager_drop_nexthops(link->manager);
|
||||
+ k = manager_drop_marked_nexthops(link->manager);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
-int link_drop_nexthops(Link *link) {
|
||||
+int link_drop_managed_nexthops(Link *link) {
|
||||
NextHop *nexthop;
|
||||
int k, r = 0;
|
||||
|
||||
@@ -723,6 +723,10 @@ int link_drop_nexthops(Link *link) {
|
||||
if (nexthop->protocol == RTPROT_KERNEL)
|
||||
continue;
|
||||
|
||||
+ /* Do not touch addresses managed by kernel or other tools. */
|
||||
+ if (nexthop->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ continue;
|
||||
+
|
||||
/* Ignore nexthops not assigned yet or already removing. */
|
||||
if (!nexthop_exists(nexthop))
|
||||
continue;
|
||||
@@ -734,7 +738,7 @@ int link_drop_nexthops(Link *link) {
|
||||
|
||||
manager_mark_nexthops(link->manager, /* foreign = */ false, link);
|
||||
|
||||
- k = manager_drop_nexthops(link->manager);
|
||||
+ k = manager_drop_marked_nexthops(link->manager);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h
|
||||
index 7a8920238c..1e54e9f211 100644
|
||||
--- a/src/network/networkd-nexthop.h
|
||||
+++ b/src/network/networkd-nexthop.h
|
||||
@@ -44,7 +44,7 @@ int nexthop_compare_func(const NextHop *a, const NextHop *b);
|
||||
|
||||
void network_drop_invalid_nexthops(Network *network);
|
||||
|
||||
-int link_drop_nexthops(Link *link);
|
||||
+int link_drop_managed_nexthops(Link *link);
|
||||
int link_drop_foreign_nexthops(Link *link);
|
||||
void link_foreignize_nexthops(Link *link);
|
||||
|
||||
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
|
||||
index ee7a535075..7e6fe8bc11 100644
|
||||
--- a/src/network/networkd-route.c
|
||||
+++ b/src/network/networkd-route.c
|
||||
@@ -788,8 +788,8 @@ static void manager_mark_routes(Manager *manager, bool foreign, const Link *exce
|
||||
if (route->protocol == RTPROT_KERNEL)
|
||||
continue;
|
||||
|
||||
- /* When 'foreign' is true, do not remove routes we configured. */
|
||||
- if (foreign && route->source != NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ /* When 'foreign' is true, mark only foreign routes, and vice versa. */
|
||||
+ if (foreign != (route->source == NETWORK_CONFIG_SOURCE_FOREIGN))
|
||||
continue;
|
||||
|
||||
/* Do not touch dynamic routes. They will removed by dhcp_pd_prefix_lost() */
|
||||
@@ -834,7 +834,7 @@ static void manager_mark_routes(Manager *manager, bool foreign, const Link *exce
|
||||
}
|
||||
}
|
||||
|
||||
-static int manager_drop_routes(Manager *manager) {
|
||||
+static int manager_drop_marked_routes(Manager *manager) {
|
||||
Route *route;
|
||||
int k, r = 0;
|
||||
|
||||
@@ -955,14 +955,14 @@ int link_drop_foreign_routes(Link *link) {
|
||||
|
||||
manager_mark_routes(link->manager, /* foreign = */ true, NULL);
|
||||
|
||||
- k = manager_drop_routes(link->manager);
|
||||
+ k = manager_drop_marked_routes(link->manager);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
-int link_drop_routes(Link *link) {
|
||||
+int link_drop_managed_routes(Link *link) {
|
||||
Route *route;
|
||||
int k, r = 0;
|
||||
|
||||
@@ -973,6 +973,10 @@ int link_drop_routes(Link *link) {
|
||||
if (route_by_kernel(route))
|
||||
continue;
|
||||
|
||||
+ /* Do not touch routes managed by kernel or other tools. */
|
||||
+ if (route->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ continue;
|
||||
+
|
||||
if (!route_exists(route))
|
||||
continue;
|
||||
|
||||
@@ -983,7 +987,7 @@ int link_drop_routes(Link *link) {
|
||||
|
||||
manager_mark_routes(link->manager, /* foreign = */ false, link);
|
||||
|
||||
- k = manager_drop_routes(link->manager);
|
||||
+ k = manager_drop_marked_routes(link->manager);
|
||||
if (k < 0 && r >= 0)
|
||||
r = k;
|
||||
|
||||
diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h
|
||||
index e3e22a5985..2180a196fc 100644
|
||||
--- a/src/network/networkd-route.h
|
||||
+++ b/src/network/networkd-route.h
|
||||
@@ -82,7 +82,7 @@ int route_remove(Route *route);
|
||||
|
||||
int route_get(Manager *manager, Link *link, const Route *in, Route **ret);
|
||||
|
||||
-int link_drop_routes(Link *link);
|
||||
+int link_drop_managed_routes(Link *link);
|
||||
int link_drop_foreign_routes(Link *link);
|
||||
void link_foreignize_routes(Link *link);
|
||||
|
||||
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
|
||||
index 90086f35a7..d4363060d8 100644
|
||||
--- a/src/network/networkd-routing-policy-rule.c
|
||||
+++ b/src/network/networkd-routing-policy-rule.c
|
||||
@@ -653,8 +653,8 @@ static void manager_mark_routing_policy_rules(Manager *m, bool foreign, const Li
|
||||
if (rule->protocol == RTPROT_KERNEL)
|
||||
continue;
|
||||
|
||||
- /* When 'foreign' is true, do not remove rules we configured. */
|
||||
- if (foreign && rule->source != NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
+ /* When 'foreign' is true, mark only foreign rules, and vice versa. */
|
||||
+ if (foreign != (rule->source == NETWORK_CONFIG_SOURCE_FOREIGN))
|
||||
continue;
|
||||
|
||||
/* Ignore rules not assigned yet or already removing. */
|
||||
diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h
|
||||
index f52943bd2e..7cc6f55c8d 100644
|
||||
--- a/src/network/networkd-routing-policy-rule.h
|
||||
+++ b/src/network/networkd-routing-policy-rule.h
|
||||
@@ -71,7 +71,7 @@ int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const L
|
||||
static inline int manager_drop_foreign_routing_policy_rules(Manager *m) {
|
||||
return manager_drop_routing_policy_rules_internal(m, true, NULL);
|
||||
}
|
||||
-static inline int link_drop_routing_policy_rules(Link *link) {
|
||||
+static inline int link_drop_managed_routing_policy_rules(Link *link) {
|
||||
assert(link);
|
||||
return manager_drop_routing_policy_rules_internal(link->manager, false, link);
|
||||
}
|
||||
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
|
||||
index ac2c1ba034..ed4d4992b1 100755
|
||||
--- a/test/test-network/systemd-networkd-tests.py
|
||||
+++ b/test/test-network/systemd-networkd-tests.py
|
||||
@@ -3876,7 +3876,7 @@ class NetworkdBridgeTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, 'NO-CARRIER')
|
||||
self.assertNotRegex(output, '192.168.0.15/24')
|
||||
- self.assertNotRegex(output, '192.168.0.16/24')
|
||||
+ self.assertRegex(output, '192.168.0.16/24') # foreign address is kept
|
||||
|
||||
print('### ip -6 route list table all dev bridge99')
|
||||
output = check_output('ip -6 route list table all dev bridge99')
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -30,6 +30,7 @@ SRC_URI += "file://touchscreen.rules \
|
||||
file://0001-shared-json-allow-json_variant_dump-to-return-an-err.patch \
|
||||
file://CVE-2022-4415-1.patch \
|
||||
file://CVE-2022-4415-2.patch \
|
||||
file://0001-network-remove-only-managed-configs-on-reconfigure-o.patch \
|
||||
"
|
||||
|
||||
# patches needed by musl
|
||||
|
||||
@@ -46,5 +46,15 @@ SRC_URI = "\
|
||||
file://0020-CVE-2023-22608-1.patch \
|
||||
file://0020-CVE-2023-22608-2.patch \
|
||||
file://0020-CVE-2023-22608-3.patch \
|
||||
file://0021-CVE-2023-1579-1.patch \
|
||||
file://0021-CVE-2023-1579-2.patch \
|
||||
file://0021-CVE-2023-1579-3.patch \
|
||||
file://0021-CVE-2023-1579-4.patch \
|
||||
file://0022-CVE-2023-25584-1.patch \
|
||||
file://0022-CVE-2023-25584-2.patch \
|
||||
file://0022-CVE-2023-25584-3.patch \
|
||||
file://0023-CVE-2023-25585.patch \
|
||||
file://0026-CVE-2023-1972.patch \
|
||||
file://0025-CVE-2023-25588.patch \
|
||||
"
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
@@ -0,0 +1,459 @@
|
||||
From f67741e172bf342291fe3abd2b395899ce6433a0 Mon Sep 17 00:00:00 2001
|
||||
From: "Potharla, Rupesh" <Rupesh.Potharla@amd.com>
|
||||
Date: Tue, 24 May 2022 00:01:49 +0000
|
||||
Subject: [PATCH] bfd: Add Support for DW_FORM_strx* and DW_FORM_addrx*
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=f67741e172bf342291fe3abd2b395899ce6433a0]
|
||||
|
||||
CVE: CVE-2023-1579
|
||||
|
||||
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
|
||||
|
||||
---
|
||||
bfd/dwarf2.c | 282 ++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 268 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
index f6b0183720b..45e286754e4 100644
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -189,6 +189,18 @@ struct dwarf2_debug_file
|
||||
/* Length of the loaded .debug_str section. */
|
||||
bfd_size_type dwarf_str_size;
|
||||
|
||||
+ /* Pointer to the .debug_str_offsets section loaded into memory. */
|
||||
+ bfd_byte *dwarf_str_offsets_buffer;
|
||||
+
|
||||
+ /* Length of the loaded .debug_str_offsets section. */
|
||||
+ bfd_size_type dwarf_str_offsets_size;
|
||||
+
|
||||
+ /* Pointer to the .debug_addr section loaded into memory. */
|
||||
+ bfd_byte *dwarf_addr_buffer;
|
||||
+
|
||||
+ /* Length of the loaded .debug_addr section. */
|
||||
+ bfd_size_type dwarf_addr_size;
|
||||
+
|
||||
/* Pointer to the .debug_line_str section loaded into memory. */
|
||||
bfd_byte *dwarf_line_str_buffer;
|
||||
|
||||
@@ -382,6 +394,12 @@ struct comp_unit
|
||||
/* Used when iterating over trie leaves to know which units we have
|
||||
already seen in this iteration. */
|
||||
bool mark;
|
||||
+
|
||||
+ /* Base address of debug_addr section. */
|
||||
+ size_t dwarf_addr_offset;
|
||||
+
|
||||
+ /* Base address of string offset table. */
|
||||
+ size_t dwarf_str_offset;
|
||||
};
|
||||
|
||||
/* This data structure holds the information of an abbrev. */
|
||||
@@ -424,6 +442,8 @@ const struct dwarf_debug_section dwarf_debug_sections[] =
|
||||
{ ".debug_static_vars", ".zdebug_static_vars" },
|
||||
{ ".debug_str", ".zdebug_str", },
|
||||
{ ".debug_str", ".zdebug_str", },
|
||||
+ { ".debug_str_offsets", ".zdebug_str_offsets", },
|
||||
+ { ".debug_addr", ".zdebug_addr", },
|
||||
{ ".debug_line_str", ".zdebug_line_str", },
|
||||
{ ".debug_types", ".zdebug_types" },
|
||||
/* GNU DWARF 1 extensions */
|
||||
@@ -458,6 +478,8 @@ enum dwarf_debug_section_enum
|
||||
debug_static_vars,
|
||||
debug_str,
|
||||
debug_str_alt,
|
||||
+ debug_str_offsets,
|
||||
+ debug_addr,
|
||||
debug_line_str,
|
||||
debug_types,
|
||||
debug_sfnames,
|
||||
@@ -1307,12 +1329,92 @@ is_int_form (const struct attribute *attr)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Returns true if the form is strx[1-4]. */
|
||||
+
|
||||
+static inline bool
|
||||
+is_strx_form (enum dwarf_form form)
|
||||
+{
|
||||
+ return (form == DW_FORM_strx
|
||||
+ || form == DW_FORM_strx1
|
||||
+ || form == DW_FORM_strx2
|
||||
+ || form == DW_FORM_strx3
|
||||
+ || form == DW_FORM_strx4);
|
||||
+}
|
||||
+
|
||||
+/* Return true if the form is addrx[1-4]. */
|
||||
+
|
||||
+static inline bool
|
||||
+is_addrx_form (enum dwarf_form form)
|
||||
+{
|
||||
+ return (form == DW_FORM_addrx
|
||||
+ || form == DW_FORM_addrx1
|
||||
+ || form == DW_FORM_addrx2
|
||||
+ || form == DW_FORM_addrx3
|
||||
+ || form == DW_FORM_addrx4);
|
||||
+}
|
||||
+
|
||||
+/* Returns the address in .debug_addr section using DW_AT_addr_base.
|
||||
+ Used to implement DW_FORM_addrx*. */
|
||||
+static bfd_vma
|
||||
+read_indexed_address (bfd_uint64_t idx,
|
||||
+ struct comp_unit *unit)
|
||||
+{
|
||||
+ struct dwarf2_debug *stash = unit->stash;
|
||||
+ struct dwarf2_debug_file *file = unit->file;
|
||||
+ size_t addr_base = unit->dwarf_addr_offset;
|
||||
+ bfd_byte *info_ptr;
|
||||
+
|
||||
+ if (stash == NULL)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!read_section (unit->abfd, &stash->debug_sections[debug_addr],
|
||||
+ file->syms, 0,
|
||||
+ &file->dwarf_addr_buffer, &file->dwarf_addr_size))
|
||||
+ return 0;
|
||||
+
|
||||
+ info_ptr = file->dwarf_addr_buffer + addr_base + idx * unit->offset_size;
|
||||
+
|
||||
+ if (unit->offset_size == 4)
|
||||
+ return bfd_get_32 (unit->abfd, info_ptr);
|
||||
+ else
|
||||
+ return bfd_get_64 (unit->abfd, info_ptr);
|
||||
+}
|
||||
+
|
||||
+/* Returns the string using DW_AT_str_offsets_base.
|
||||
+ Used to implement DW_FORM_strx*. */
|
||||
static const char *
|
||||
-read_indexed_string (bfd_uint64_t idx ATTRIBUTE_UNUSED,
|
||||
- struct comp_unit * unit ATTRIBUTE_UNUSED)
|
||||
+read_indexed_string (bfd_uint64_t idx,
|
||||
+ struct comp_unit *unit)
|
||||
{
|
||||
- /* FIXME: Add support for indexed strings. */
|
||||
- return "<indexed strings not yet supported>";
|
||||
+ struct dwarf2_debug *stash = unit->stash;
|
||||
+ struct dwarf2_debug_file *file = unit->file;
|
||||
+ bfd_byte *info_ptr;
|
||||
+ unsigned long str_offset;
|
||||
+
|
||||
+ if (stash == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!read_section (unit->abfd, &stash->debug_sections[debug_str],
|
||||
+ file->syms, 0,
|
||||
+ &file->dwarf_str_buffer, &file->dwarf_str_size))
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (!read_section (unit->abfd, &stash->debug_sections[debug_str_offsets],
|
||||
+ file->syms, 0,
|
||||
+ &file->dwarf_str_offsets_buffer,
|
||||
+ &file->dwarf_str_offsets_size))
|
||||
+ return NULL;
|
||||
+
|
||||
+ info_ptr = (file->dwarf_str_offsets_buffer
|
||||
+ + unit->dwarf_str_offset
|
||||
+ + idx * unit->offset_size);
|
||||
+
|
||||
+ if (unit->offset_size == 4)
|
||||
+ str_offset = bfd_get_32 (unit->abfd, info_ptr);
|
||||
+ else
|
||||
+ str_offset = bfd_get_64 (unit->abfd, info_ptr);
|
||||
+
|
||||
+ return (const char *) file->dwarf_str_buffer + str_offset;
|
||||
}
|
||||
|
||||
/* Read and fill in the value of attribute ATTR as described by FORM.
|
||||
@@ -1381,21 +1483,37 @@ read_attribute_value (struct attribute * attr,
|
||||
case DW_FORM_ref1:
|
||||
case DW_FORM_flag:
|
||||
case DW_FORM_data1:
|
||||
+ attr->u.val = read_1_byte (abfd, &info_ptr, info_ptr_end);
|
||||
+ break;
|
||||
case DW_FORM_addrx1:
|
||||
attr->u.val = read_1_byte (abfd, &info_ptr, info_ptr_end);
|
||||
+ /* dwarf_addr_offset value 0 indicates the attribute DW_AT_addr_base
|
||||
+ is not yet read. */
|
||||
+ if (unit->dwarf_addr_offset != 0)
|
||||
+ attr->u.val = read_indexed_address (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_data2:
|
||||
- case DW_FORM_addrx2:
|
||||
case DW_FORM_ref2:
|
||||
attr->u.val = read_2_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
break;
|
||||
+ case DW_FORM_addrx2:
|
||||
+ attr->u.val = read_2_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
+ if (unit->dwarf_addr_offset != 0)
|
||||
+ attr->u.val = read_indexed_address (attr->u.val, unit);
|
||||
+ break;
|
||||
case DW_FORM_addrx3:
|
||||
attr->u.val = read_3_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
+ if (unit->dwarf_addr_offset != 0)
|
||||
+ attr->u.val = read_indexed_address(attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_ref4:
|
||||
case DW_FORM_data4:
|
||||
+ attr->u.val = read_4_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
+ break;
|
||||
case DW_FORM_addrx4:
|
||||
attr->u.val = read_4_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
+ if (unit->dwarf_addr_offset != 0)
|
||||
+ attr->u.val = read_indexed_address (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_data8:
|
||||
case DW_FORM_ref8:
|
||||
@@ -1416,24 +1534,31 @@ read_attribute_value (struct attribute * attr,
|
||||
break;
|
||||
case DW_FORM_strx1:
|
||||
attr->u.val = read_1_byte (abfd, &info_ptr, info_ptr_end);
|
||||
- attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ /* dwarf_str_offset value 0 indicates the attribute DW_AT_str_offsets_base
|
||||
+ is not yet read. */
|
||||
+ if (unit->dwarf_str_offset != 0)
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_strx2:
|
||||
attr->u.val = read_2_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
- attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ if (unit->dwarf_str_offset != 0)
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_strx3:
|
||||
attr->u.val = read_3_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
- attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ if (unit->dwarf_str_offset != 0)
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_strx4:
|
||||
attr->u.val = read_4_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
- attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ if (unit->dwarf_str_offset != 0)
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_strx:
|
||||
attr->u.val = _bfd_safe_read_leb128 (abfd, &info_ptr,
|
||||
false, info_ptr_end);
|
||||
- attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ if (unit->dwarf_str_offset != 0)
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_exprloc:
|
||||
case DW_FORM_block:
|
||||
@@ -1455,9 +1580,14 @@ read_attribute_value (struct attribute * attr,
|
||||
break;
|
||||
case DW_FORM_ref_udata:
|
||||
case DW_FORM_udata:
|
||||
+ attr->u.val = _bfd_safe_read_leb128 (abfd, &info_ptr,
|
||||
+ false, info_ptr_end);
|
||||
+ break;
|
||||
case DW_FORM_addrx:
|
||||
attr->u.val = _bfd_safe_read_leb128 (abfd, &info_ptr,
|
||||
false, info_ptr_end);
|
||||
+ if (unit->dwarf_addr_offset != 0)
|
||||
+ attr->u.val = read_indexed_address (attr->u.val, unit);
|
||||
break;
|
||||
case DW_FORM_indirect:
|
||||
form = _bfd_safe_read_leb128 (abfd, &info_ptr,
|
||||
@@ -2396,6 +2526,11 @@ read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
|
||||
{
|
||||
case DW_FORM_string:
|
||||
case DW_FORM_line_strp:
|
||||
+ case DW_FORM_strx:
|
||||
+ case DW_FORM_strx1:
|
||||
+ case DW_FORM_strx2:
|
||||
+ case DW_FORM_strx3:
|
||||
+ case DW_FORM_strx4:
|
||||
*stringp = attr.u.str;
|
||||
break;
|
||||
|
||||
@@ -4031,6 +4166,80 @@ scan_unit_for_symbols (struct comp_unit *unit)
|
||||
return false;
|
||||
}
|
||||
|
||||
+/* Read the attributes of the form strx and addrx. */
|
||||
+
|
||||
+static void
|
||||
+reread_attribute (struct comp_unit *unit,
|
||||
+ struct attribute *attr,
|
||||
+ bfd_vma *low_pc,
|
||||
+ bfd_vma *high_pc,
|
||||
+ bool *high_pc_relative,
|
||||
+ bool compunit)
|
||||
+{
|
||||
+ if (is_strx_form (attr->form))
|
||||
+ attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ if (is_addrx_form (attr->form))
|
||||
+ attr->u.val = read_indexed_address (attr->u.val, unit);
|
||||
+
|
||||
+ switch (attr->name)
|
||||
+ {
|
||||
+ case DW_AT_stmt_list:
|
||||
+ unit->stmtlist = 1;
|
||||
+ unit->line_offset = attr->u.val;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_name:
|
||||
+ if (is_str_form (attr))
|
||||
+ unit->name = attr->u.str;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_low_pc:
|
||||
+ *low_pc = attr->u.val;
|
||||
+ if (compunit)
|
||||
+ unit->base_address = *low_pc;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_high_pc:
|
||||
+ *high_pc = attr->u.val;
|
||||
+ *high_pc_relative = attr->form != DW_FORM_addr;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_ranges:
|
||||
+ if (!read_rangelist (unit, &unit->arange,
|
||||
+ &unit->file->trie_root, attr->u.val))
|
||||
+ return;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_comp_dir:
|
||||
+ {
|
||||
+ char *comp_dir = attr->u.str;
|
||||
+
|
||||
+ if (!is_str_form (attr))
|
||||
+ {
|
||||
+ _bfd_error_handler
|
||||
+ (_("DWARF error: DW_AT_comp_dir attribute encountered "
|
||||
+ "with a non-string form"));
|
||||
+ comp_dir = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (comp_dir)
|
||||
+ {
|
||||
+ char *cp = strchr (comp_dir, ':');
|
||||
+
|
||||
+ if (cp && cp != comp_dir && cp[-1] == '.' && cp[1] == '/')
|
||||
+ comp_dir = cp + 1;
|
||||
+ }
|
||||
+ unit->comp_dir = comp_dir;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case DW_AT_language:
|
||||
+ unit->lang = attr->u.val;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* Parse a DWARF2 compilation unit starting at INFO_PTR. UNIT_LENGTH
|
||||
includes the compilation unit header that proceeds the DIE's, but
|
||||
does not include the length field that precedes each compilation
|
||||
@@ -4064,6 +4273,10 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
||||
bfd *abfd = file->bfd_ptr;
|
||||
bool high_pc_relative = false;
|
||||
enum dwarf_unit_type unit_type;
|
||||
+ struct attribute *str_addrp = NULL;
|
||||
+ size_t str_count = 0;
|
||||
+ size_t str_alloc = 0;
|
||||
+ bool compunit_flag = false;
|
||||
|
||||
version = read_2_bytes (abfd, &info_ptr, end_ptr);
|
||||
if (version < 2 || version > 5)
|
||||
@@ -4168,11 +4381,33 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
||||
unit->file = file;
|
||||
unit->info_ptr_unit = info_ptr_unit;
|
||||
|
||||
+ if (abbrev->tag == DW_TAG_compile_unit)
|
||||
+ compunit_flag = true;
|
||||
+
|
||||
for (i = 0; i < abbrev->num_attrs; ++i)
|
||||
{
|
||||
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr, end_ptr);
|
||||
if (info_ptr == NULL)
|
||||
- return NULL;
|
||||
+ goto err_exit;
|
||||
+
|
||||
+ /* Identify attributes of the form strx* and addrx* which come before
|
||||
+ DW_AT_str_offsets_base and DW_AT_addr_base respectively in the CU.
|
||||
+ Store the attributes in an array and process them later. */
|
||||
+ if ((unit->dwarf_str_offset == 0 && is_strx_form (attr.form))
|
||||
+ || (unit->dwarf_addr_offset == 0 && is_addrx_form (attr.form)))
|
||||
+ {
|
||||
+ if (str_count <= str_alloc)
|
||||
+ {
|
||||
+ str_alloc = 2 * str_alloc + 200;
|
||||
+ str_addrp = bfd_realloc (str_addrp,
|
||||
+ str_alloc * sizeof (*str_addrp));
|
||||
+ if (str_addrp == NULL)
|
||||
+ goto err_exit;
|
||||
+ }
|
||||
+ str_addrp[str_count] = attr;
|
||||
+ str_count++;
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/* Store the data if it is of an attribute we want to keep in a
|
||||
partial symbol table. */
|
||||
@@ -4198,7 +4433,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
||||
/* If the compilation unit DIE has a DW_AT_low_pc attribute,
|
||||
this is the base address to use when reading location
|
||||
lists or range lists. */
|
||||
- if (abbrev->tag == DW_TAG_compile_unit)
|
||||
+ if (compunit_flag)
|
||||
unit->base_address = low_pc;
|
||||
}
|
||||
break;
|
||||
@@ -4215,7 +4450,7 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
||||
if (is_int_form (&attr)
|
||||
&& !read_rangelist (unit, &unit->arange,
|
||||
&unit->file->trie_root, attr.u.val))
|
||||
- return NULL;
|
||||
+ goto err_exit;
|
||||
break;
|
||||
|
||||
case DW_AT_comp_dir:
|
||||
@@ -4248,21 +4483,40 @@ parse_comp_unit (struct dwarf2_debug *stash,
|
||||
unit->lang = attr.u.val;
|
||||
break;
|
||||
|
||||
+ case DW_AT_addr_base:
|
||||
+ unit->dwarf_addr_offset = attr.u.val;
|
||||
+ break;
|
||||
+
|
||||
+ case DW_AT_str_offsets_base:
|
||||
+ unit->dwarf_str_offset = attr.u.val;
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ for (i = 0; i < str_count; ++i)
|
||||
+ reread_attribute (unit, &str_addrp[i], &low_pc, &high_pc,
|
||||
+ &high_pc_relative, compunit_flag);
|
||||
+
|
||||
if (high_pc_relative)
|
||||
high_pc += low_pc;
|
||||
if (high_pc != 0)
|
||||
{
|
||||
if (!arange_add (unit, &unit->arange, &unit->file->trie_root,
|
||||
low_pc, high_pc))
|
||||
- return NULL;
|
||||
+ goto err_exit;
|
||||
}
|
||||
|
||||
unit->first_child_die_ptr = info_ptr;
|
||||
+
|
||||
+ free (str_addrp);
|
||||
return unit;
|
||||
+
|
||||
+ err_exit:
|
||||
+ free (str_addrp);
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
/* Return TRUE if UNIT may contain the address given by ADDR. When
|
||||
--
|
||||
2.31.1
|
||||
|
||||
2127
meta/recipes-devtools/binutils/binutils/0021-CVE-2023-1579-2.patch
Normal file
2127
meta/recipes-devtools/binutils/binutils/0021-CVE-2023-1579-2.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,156 @@
|
||||
From 31d6c13defeba7716ebc9d5c8f81f2f35fe39980 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Tue, 14 Jun 2022 12:46:42 +0930
|
||||
Subject: [PATCH] PR29230, segv in lookup_symbol_in_variable_table
|
||||
|
||||
The PR23230 testcase uses indexed strings without specifying
|
||||
SW_AT_str_offsets_base. In this case we left u.str with garbage (from
|
||||
u.val) which then led to a segfault when attempting to access the
|
||||
string. Fix that by clearing u.str. The patch also adds missing
|
||||
sanity checks in the recently committed read_indexed_address and
|
||||
read_indexed_string functions.
|
||||
|
||||
PR 29230
|
||||
* dwarf2.c (read_indexed_address): Return uint64_t. Sanity check idx.
|
||||
(read_indexed_string): Use uint64_t for str_offset. Sanity check idx.
|
||||
(read_attribute_value): Clear u.str for indexed string forms when
|
||||
DW_AT_str_offsets_base is not yet read or missing.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=31d6c13defeba7716ebc9d5c8f81f2f35fe39980]
|
||||
|
||||
CVE: CVE-2023-1579
|
||||
|
||||
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
|
||||
|
||||
---
|
||||
bfd/dwarf2.c | 51 ++++++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 42 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
index 51018e1ab45..aaa2d84887f 100644
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -1353,13 +1353,13 @@ is_addrx_form (enum dwarf_form form)
|
||||
|
||||
/* Returns the address in .debug_addr section using DW_AT_addr_base.
|
||||
Used to implement DW_FORM_addrx*. */
|
||||
-static bfd_vma
|
||||
+static uint64_t
|
||||
read_indexed_address (uint64_t idx, struct comp_unit *unit)
|
||||
{
|
||||
struct dwarf2_debug *stash = unit->stash;
|
||||
struct dwarf2_debug_file *file = unit->file;
|
||||
- size_t addr_base = unit->dwarf_addr_offset;
|
||||
bfd_byte *info_ptr;
|
||||
+ size_t offset;
|
||||
|
||||
if (stash == NULL)
|
||||
return 0;
|
||||
@@ -1369,12 +1369,23 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
|
||||
&file->dwarf_addr_buffer, &file->dwarf_addr_size))
|
||||
return 0;
|
||||
|
||||
- info_ptr = file->dwarf_addr_buffer + addr_base + idx * unit->offset_size;
|
||||
+ if (_bfd_mul_overflow (idx, unit->offset_size, &offset))
|
||||
+ return 0;
|
||||
+
|
||||
+ offset += unit->dwarf_addr_offset;
|
||||
+ if (offset < unit->dwarf_addr_offset
|
||||
+ || offset > file->dwarf_addr_size
|
||||
+ || file->dwarf_addr_size - offset < unit->offset_size)
|
||||
+ return 0;
|
||||
+
|
||||
+ info_ptr = file->dwarf_addr_buffer + offset;
|
||||
|
||||
if (unit->offset_size == 4)
|
||||
return bfd_get_32 (unit->abfd, info_ptr);
|
||||
- else
|
||||
+ else if (unit->offset_size == 8)
|
||||
return bfd_get_64 (unit->abfd, info_ptr);
|
||||
+ else
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* Returns the string using DW_AT_str_offsets_base.
|
||||
@@ -1385,7 +1396,8 @@ read_indexed_string (uint64_t idx, struct comp_unit *unit)
|
||||
struct dwarf2_debug *stash = unit->stash;
|
||||
struct dwarf2_debug_file *file = unit->file;
|
||||
bfd_byte *info_ptr;
|
||||
- unsigned long str_offset;
|
||||
+ uint64_t str_offset;
|
||||
+ size_t offset;
|
||||
|
||||
if (stash == NULL)
|
||||
return NULL;
|
||||
@@ -1401,15 +1413,26 @@ read_indexed_string (uint64_t idx, struct comp_unit *unit)
|
||||
&file->dwarf_str_offsets_size))
|
||||
return NULL;
|
||||
|
||||
- info_ptr = (file->dwarf_str_offsets_buffer
|
||||
- + unit->dwarf_str_offset
|
||||
- + idx * unit->offset_size);
|
||||
+ if (_bfd_mul_overflow (idx, unit->offset_size, &offset))
|
||||
+ return NULL;
|
||||
+
|
||||
+ offset += unit->dwarf_str_offset;
|
||||
+ if (offset < unit->dwarf_str_offset
|
||||
+ || offset > file->dwarf_str_offsets_size
|
||||
+ || file->dwarf_str_offsets_size - offset < unit->offset_size)
|
||||
+ return NULL;
|
||||
+
|
||||
+ info_ptr = file->dwarf_str_offsets_buffer + offset;
|
||||
|
||||
if (unit->offset_size == 4)
|
||||
str_offset = bfd_get_32 (unit->abfd, info_ptr);
|
||||
- else
|
||||
+ else if (unit->offset_size == 8)
|
||||
str_offset = bfd_get_64 (unit->abfd, info_ptr);
|
||||
+ else
|
||||
+ return NULL;
|
||||
|
||||
+ if (str_offset >= file->dwarf_str_size)
|
||||
+ return NULL;
|
||||
return (const char *) file->dwarf_str_buffer + str_offset;
|
||||
}
|
||||
|
||||
@@ -1534,27 +1557,37 @@ read_attribute_value (struct attribute * attr,
|
||||
is not yet read. */
|
||||
if (unit->dwarf_str_offset != 0)
|
||||
attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ else
|
||||
+ attr->u.str = NULL;
|
||||
break;
|
||||
case DW_FORM_strx2:
|
||||
attr->u.val = read_2_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
if (unit->dwarf_str_offset != 0)
|
||||
attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ else
|
||||
+ attr->u.str = NULL;
|
||||
break;
|
||||
case DW_FORM_strx3:
|
||||
attr->u.val = read_3_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
if (unit->dwarf_str_offset != 0)
|
||||
attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ else
|
||||
+ attr->u.str = NULL;
|
||||
break;
|
||||
case DW_FORM_strx4:
|
||||
attr->u.val = read_4_bytes (abfd, &info_ptr, info_ptr_end);
|
||||
if (unit->dwarf_str_offset != 0)
|
||||
attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ else
|
||||
+ attr->u.str = NULL;
|
||||
break;
|
||||
case DW_FORM_strx:
|
||||
attr->u.val = _bfd_safe_read_leb128 (abfd, &info_ptr,
|
||||
false, info_ptr_end);
|
||||
if (unit->dwarf_str_offset != 0)
|
||||
attr->u.str = (char *) read_indexed_string (attr->u.val, unit);
|
||||
+ else
|
||||
+ attr->u.str = NULL;
|
||||
break;
|
||||
case DW_FORM_exprloc:
|
||||
case DW_FORM_block:
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
From 3e307d538c351aa9327cbad672c884059ecc20dd Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Wed, 11 Jan 2023 12:13:46 +0000
|
||||
Subject: [PATCH] Fix a potential illegal memory access in the BFD library when
|
||||
parsing a corrupt DWARF file.
|
||||
|
||||
PR 29988
|
||||
* dwarf2.c (read_indexed_address): Fix check for an out of range
|
||||
offset.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3e307d538c351aa9327cbad672c884059ecc20dd]
|
||||
|
||||
CVE: CVE-2023-1579
|
||||
|
||||
Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
|
||||
|
||||
---
|
||||
bfd/ChangeLog | 6 ++++++
|
||||
bfd/dwarf2.c | 2 +-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
|
||||
index 6eb6e04e6e5..4ec0053a111 100644
|
||||
--- a/bfd/dwarf2.c
|
||||
+++ b/bfd/dwarf2.c
|
||||
@@ -1412,7 +1412,7 @@ read_indexed_address (uint64_t idx, struct comp_unit *unit)
|
||||
offset += unit->dwarf_addr_offset;
|
||||
if (offset < unit->dwarf_addr_offset
|
||||
|| offset > file->dwarf_addr_size
|
||||
- || file->dwarf_addr_size - offset < unit->offset_size)
|
||||
+ || file->dwarf_addr_size - offset < unit->addr_size)
|
||||
return 0;
|
||||
|
||||
info_ptr = file->dwarf_addr_buffer + offset;
|
||||
--
|
||||
2.31.1
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Thu, 17 Mar 2022 09:35:39 +0000 (+1030)
|
||||
Subject: ubsan: Null dereference in parse_module
|
||||
X-Git-Tag: gdb-12.1-release~59
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=c9178f285acf19e066be8367185d52837161b0a2
|
||||
|
||||
ubsan: Null dereference in parse_module
|
||||
|
||||
* vms-alpha.c (parse_module): Sanity check that DST__K_RTNBEG
|
||||
has set module->func_table for DST__K_RTNEND. Check return
|
||||
of bfd_zalloc.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=c9178f285acf19e066be8367185d52837161b0a2]
|
||||
|
||||
CVE: CVE-2023-25584
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
|
||||
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
|
||||
index 4a92574c850..1129c98f0e2 100644
|
||||
--- a/bfd/vms-alpha.c
|
||||
+++ b/bfd/vms-alpha.c
|
||||
@@ -4352,9 +4352,13 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
|
||||
/* Initialize tables with zero element. */
|
||||
curr_srec = (struct srecinfo *) bfd_zalloc (abfd, sizeof (struct srecinfo));
|
||||
+ if (!curr_srec)
|
||||
+ return false;
|
||||
module->srec_table = curr_srec;
|
||||
|
||||
curr_line = (struct lineinfo *) bfd_zalloc (abfd, sizeof (struct lineinfo));
|
||||
+ if (!curr_line)
|
||||
+ return false;
|
||||
module->line_table = curr_line;
|
||||
|
||||
while (length == -1 || ptr < maxptr)
|
||||
@@ -4389,6 +4393,8 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
case DST__K_RTNBEG:
|
||||
funcinfo = (struct funcinfo *)
|
||||
bfd_zalloc (abfd, sizeof (struct funcinfo));
|
||||
+ if (!funcinfo)
|
||||
+ return false;
|
||||
funcinfo->name
|
||||
= _bfd_vms_save_counted_string (abfd, ptr + DST_S_B_RTNBEG_NAME,
|
||||
maxptr - (ptr + DST_S_B_RTNBEG_NAME));
|
||||
@@ -4401,6 +4407,8 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
break;
|
||||
|
||||
case DST__K_RTNEND:
|
||||
+ if (!module->func_table)
|
||||
+ return false;
|
||||
module->func_table->high = module->func_table->low
|
||||
+ bfd_getl32 (ptr + DST_S_L_RTNEND_SIZE) - 1;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
From da928f639002002dfc649ed9f50492d5d6cb4cee Mon Sep 17 00:00:00 2001
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Mon, 5 Dec 2022 11:11:44 +0000
|
||||
Subject: [PATCH] Fix an illegal memory access when parsing a corrupt VMS Alpha
|
||||
file.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fix an illegal memory access when parsing a corrupt VMS Alpha file.
|
||||
|
||||
PR 29848
|
||||
* vms-alpha.c (parse_module): Fix potential out of bounds memory
|
||||
access.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=942fa4fb32738ecbb447546d54f1e5f0312d2ed4]
|
||||
|
||||
CVE: CVE-2023-25584
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
bfd/vms-alpha.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
|
||||
index c548722c..53b3f1bf 100644
|
||||
--- a/bfd/vms-alpha.c
|
||||
+++ b/bfd/vms-alpha.c
|
||||
@@ -4361,7 +4361,7 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
return false;
|
||||
module->line_table = curr_line;
|
||||
|
||||
- while (length == -1 || ptr < maxptr)
|
||||
+ while (length == -1 || (ptr + 3) < maxptr)
|
||||
{
|
||||
/* The first byte is not counted in the recorded length. */
|
||||
int rec_length = bfd_getl16 (ptr) + 1;
|
||||
@@ -0,0 +1,534 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Mon, 12 Dec 2022 07:58:49 +0000 (+1030)
|
||||
Subject: Lack of bounds checking in vms-alpha.c parse_module
|
||||
X-Git-Tag: gdb-13-branchpoint~87
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=77c225bdeb410cf60da804879ad41622f5f1aa44
|
||||
|
||||
Lack of bounds checking in vms-alpha.c parse_module
|
||||
|
||||
PR 29873
|
||||
PR 29874
|
||||
PR 29875
|
||||
PR 29876
|
||||
PR 29877
|
||||
PR 29878
|
||||
PR 29879
|
||||
PR 29880
|
||||
PR 29881
|
||||
PR 29882
|
||||
PR 29883
|
||||
PR 29884
|
||||
PR 29885
|
||||
PR 29886
|
||||
PR 29887
|
||||
PR 29888
|
||||
PR 29889
|
||||
PR 29890
|
||||
PR 29891
|
||||
* vms-alpha.c (parse_module): Make length param bfd_size_type.
|
||||
Delete length == -1 checks. Sanity check record_length.
|
||||
Sanity check DST__K_MODBEG, DST__K_RTNBEG, DST__K_RTNEND lengths.
|
||||
Sanity check DST__K_SOURCE and DST__K_LINE_NUM elements
|
||||
before accessing.
|
||||
(build_module_list): Pass dst_section size to parse_module.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=77c225bdeb410cf60da804879ad41622f5f1aa44]
|
||||
|
||||
CVE: CVE-2023-25584
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
|
||||
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
|
||||
index c0eb5bc5a2a..3b63259cc81 100644
|
||||
--- a/bfd/vms-alpha.c
|
||||
+++ b/bfd/vms-alpha.c
|
||||
@@ -4340,7 +4340,7 @@ new_module (bfd *abfd)
|
||||
|
||||
static bool
|
||||
parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
- int length)
|
||||
+ bfd_size_type length)
|
||||
{
|
||||
unsigned char *maxptr = ptr + length;
|
||||
unsigned char *src_ptr, *pcl_ptr;
|
||||
@@ -4361,7 +4361,7 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
return false;
|
||||
module->line_table = curr_line;
|
||||
|
||||
- while (length == -1 || (ptr + 3) < maxptr)
|
||||
+ while (ptr + 3 < maxptr)
|
||||
{
|
||||
/* The first byte is not counted in the recorded length. */
|
||||
int rec_length = bfd_getl16 (ptr) + 1;
|
||||
@@ -4369,15 +4369,19 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
|
||||
vms_debug2 ((2, "DST record: leng %d, type %d\n", rec_length, rec_type));
|
||||
|
||||
- if (length == -1 && rec_type == DST__K_MODEND)
|
||||
+ if (rec_length > maxptr - ptr)
|
||||
+ break;
|
||||
+ if (rec_type == DST__K_MODEND)
|
||||
break;
|
||||
|
||||
switch (rec_type)
|
||||
{
|
||||
case DST__K_MODBEG:
|
||||
+ if (rec_length <= DST_S_B_MODBEG_NAME)
|
||||
+ break;
|
||||
module->name
|
||||
= _bfd_vms_save_counted_string (abfd, ptr + DST_S_B_MODBEG_NAME,
|
||||
- maxptr - (ptr + DST_S_B_MODBEG_NAME));
|
||||
+ rec_length - DST_S_B_MODBEG_NAME);
|
||||
|
||||
curr_pc = 0;
|
||||
prev_pc = 0;
|
||||
@@ -4391,13 +4395,15 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
break;
|
||||
|
||||
case DST__K_RTNBEG:
|
||||
+ if (rec_length <= DST_S_B_RTNBEG_NAME)
|
||||
+ break;
|
||||
funcinfo = (struct funcinfo *)
|
||||
bfd_zalloc (abfd, sizeof (struct funcinfo));
|
||||
if (!funcinfo)
|
||||
return false;
|
||||
funcinfo->name
|
||||
= _bfd_vms_save_counted_string (abfd, ptr + DST_S_B_RTNBEG_NAME,
|
||||
- maxptr - (ptr + DST_S_B_RTNBEG_NAME));
|
||||
+ rec_length - DST_S_B_RTNBEG_NAME);
|
||||
funcinfo->low = bfd_getl32 (ptr + DST_S_L_RTNBEG_ADDRESS);
|
||||
funcinfo->next = module->func_table;
|
||||
module->func_table = funcinfo;
|
||||
@@ -4407,6 +4413,8 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
break;
|
||||
|
||||
case DST__K_RTNEND:
|
||||
+ if (rec_length < DST_S_L_RTNEND_SIZE + 4)
|
||||
+ break;
|
||||
if (!module->func_table)
|
||||
return false;
|
||||
module->func_table->high = module->func_table->low
|
||||
@@ -4439,10 +4447,63 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
|
||||
vms_debug2 ((3, "source info\n"));
|
||||
|
||||
- while (src_ptr < ptr + rec_length)
|
||||
+ while (src_ptr - ptr < rec_length)
|
||||
{
|
||||
int cmd = src_ptr[0], cmd_length, data;
|
||||
|
||||
+ switch (cmd)
|
||||
+ {
|
||||
+ case DST__K_SRC_DECLFILE:
|
||||
+ if (src_ptr - ptr + DST_S_B_SRC_DF_LENGTH >= rec_length)
|
||||
+ cmd_length = 0x10000;
|
||||
+ else
|
||||
+ cmd_length = src_ptr[DST_S_B_SRC_DF_LENGTH] + 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_DEFLINES_B:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_DEFLINES_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_INCRLNUM_B:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_SETFILE:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_SETLNUM_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_SETLNUM_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_SETREC_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_SETREC_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SRC_FORMFEED:
|
||||
+ cmd_length = 1;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (src_ptr - ptr + cmd_length > rec_length)
|
||||
+ break;
|
||||
+
|
||||
switch (cmd)
|
||||
{
|
||||
case DST__K_SRC_DECLFILE:
|
||||
@@ -4467,7 +4528,6 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
|
||||
module->file_table [fileid].name = filename;
|
||||
module->file_table [fileid].srec = 1;
|
||||
- cmd_length = src_ptr[DST_S_B_SRC_DF_LENGTH] + 2;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_DECLFILE: %d, %s\n",
|
||||
fileid, module->file_table [fileid].name));
|
||||
}
|
||||
@@ -4484,7 +4544,6 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
srec->sfile = curr_srec->sfile;
|
||||
curr_srec->next = srec;
|
||||
curr_srec = srec;
|
||||
- cmd_length = 2;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_DEFLINES_B: %d\n", data));
|
||||
break;
|
||||
|
||||
@@ -4499,14 +4558,12 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
srec->sfile = curr_srec->sfile;
|
||||
curr_srec->next = srec;
|
||||
curr_srec = srec;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_DEFLINES_W: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SRC_INCRLNUM_B:
|
||||
data = src_ptr[DST_S_B_SRC_UNSBYTE];
|
||||
curr_srec->line += data;
|
||||
- cmd_length = 2;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_INCRLNUM_B: %d\n", data));
|
||||
break;
|
||||
|
||||
@@ -4514,21 +4571,18 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
data = bfd_getl16 (src_ptr + DST_S_W_SRC_UNSWORD);
|
||||
curr_srec->sfile = data;
|
||||
curr_srec->srec = module->file_table[data].srec;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_SETFILE: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SRC_SETLNUM_L:
|
||||
data = bfd_getl32 (src_ptr + DST_S_L_SRC_UNSLONG);
|
||||
curr_srec->line = data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_SETLNUM_L: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SRC_SETLNUM_W:
|
||||
data = bfd_getl16 (src_ptr + DST_S_W_SRC_UNSWORD);
|
||||
curr_srec->line = data;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_SETLNUM_W: %d\n", data));
|
||||
break;
|
||||
|
||||
@@ -4536,7 +4590,6 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
data = bfd_getl32 (src_ptr + DST_S_L_SRC_UNSLONG);
|
||||
curr_srec->srec = data;
|
||||
module->file_table[curr_srec->sfile].srec = data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_SETREC_L: %d\n", data));
|
||||
break;
|
||||
|
||||
@@ -4544,19 +4597,16 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
data = bfd_getl16 (src_ptr + DST_S_W_SRC_UNSWORD);
|
||||
curr_srec->srec = data;
|
||||
module->file_table[curr_srec->sfile].srec = data;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_SETREC_W: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SRC_FORMFEED:
|
||||
- cmd_length = 1;
|
||||
vms_debug2 ((4, "DST_S_C_SRC_FORMFEED\n"));
|
||||
break;
|
||||
|
||||
default:
|
||||
_bfd_error_handler (_("unknown source command %d"),
|
||||
cmd);
|
||||
- cmd_length = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4569,18 +4619,114 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
|
||||
vms_debug2 ((3, "line info\n"));
|
||||
|
||||
- while (pcl_ptr < ptr + rec_length)
|
||||
+ while (pcl_ptr - ptr < rec_length)
|
||||
{
|
||||
/* The command byte is signed so we must sign-extend it. */
|
||||
int cmd = ((signed char *)pcl_ptr)[0], cmd_length, data;
|
||||
|
||||
+ switch (cmd)
|
||||
+ {
|
||||
+ case DST__K_DELTA_PC_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_DELTA_PC_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_INCR_LINUM:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_INCR_LINUM_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_INCR_LINUM_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_LINUM_INCR:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_LINUM_INCR_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_RESET_LINUM_INCR:
|
||||
+ cmd_length = 1;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_BEG_STMT_MODE:
|
||||
+ cmd_length = 1;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_END_STMT_MODE:
|
||||
+ cmd_length = 1;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_LINUM_B:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_LINUM:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_LINUM_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_PC:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_PC_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_PC_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_STMTNUM:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_TERM:
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_TERM_W:
|
||||
+ cmd_length = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_TERM_L:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ case DST__K_SET_ABS_PC:
|
||||
+ cmd_length = 5;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ if (cmd <= 0)
|
||||
+ cmd_length = 1;
|
||||
+ else
|
||||
+ cmd_length = 2;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (pcl_ptr - ptr + cmd_length > rec_length)
|
||||
+ break;
|
||||
+
|
||||
switch (cmd)
|
||||
{
|
||||
case DST__K_DELTA_PC_W:
|
||||
data = bfd_getl16 (pcl_ptr + DST_S_W_PCLINE_UNSWORD);
|
||||
curr_pc += data;
|
||||
curr_linenum += 1;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST__K_DELTA_PC_W: %d\n", data));
|
||||
break;
|
||||
|
||||
@@ -4588,131 +4734,111 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
data = bfd_getl32 (pcl_ptr + DST_S_L_PCLINE_UNSLONG);
|
||||
curr_pc += data;
|
||||
curr_linenum += 1;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST__K_DELTA_PC_L: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_INCR_LINUM:
|
||||
data = pcl_ptr[DST_S_B_PCLINE_UNSBYTE];
|
||||
curr_linenum += data;
|
||||
- cmd_length = 2;
|
||||
vms_debug2 ((4, "DST__K_INCR_LINUM: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_INCR_LINUM_W:
|
||||
data = bfd_getl16 (pcl_ptr + DST_S_W_PCLINE_UNSWORD);
|
||||
curr_linenum += data;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST__K_INCR_LINUM_W: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_INCR_LINUM_L:
|
||||
data = bfd_getl32 (pcl_ptr + DST_S_L_PCLINE_UNSLONG);
|
||||
curr_linenum += data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST__K_INCR_LINUM_L: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SET_LINUM_INCR:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_LINUM_INCR");
|
||||
- cmd_length = 2;
|
||||
break;
|
||||
|
||||
case DST__K_SET_LINUM_INCR_W:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_LINUM_INCR_W");
|
||||
- cmd_length = 3;
|
||||
break;
|
||||
|
||||
case DST__K_RESET_LINUM_INCR:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_RESET_LINUM_INCR");
|
||||
- cmd_length = 1;
|
||||
break;
|
||||
|
||||
case DST__K_BEG_STMT_MODE:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_BEG_STMT_MODE");
|
||||
- cmd_length = 1;
|
||||
break;
|
||||
|
||||
case DST__K_END_STMT_MODE:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_END_STMT_MODE");
|
||||
- cmd_length = 1;
|
||||
break;
|
||||
|
||||
case DST__K_SET_LINUM_B:
|
||||
data = pcl_ptr[DST_S_B_PCLINE_UNSBYTE];
|
||||
curr_linenum = data;
|
||||
- cmd_length = 2;
|
||||
vms_debug2 ((4, "DST__K_SET_LINUM_B: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SET_LINUM:
|
||||
data = bfd_getl16 (pcl_ptr + DST_S_W_PCLINE_UNSWORD);
|
||||
curr_linenum = data;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST__K_SET_LINE_NUM: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SET_LINUM_L:
|
||||
data = bfd_getl32 (pcl_ptr + DST_S_L_PCLINE_UNSLONG);
|
||||
curr_linenum = data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST__K_SET_LINUM_L: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SET_PC:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_PC");
|
||||
- cmd_length = 2;
|
||||
break;
|
||||
|
||||
case DST__K_SET_PC_W:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_PC_W");
|
||||
- cmd_length = 3;
|
||||
break;
|
||||
|
||||
case DST__K_SET_PC_L:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_PC_L");
|
||||
- cmd_length = 5;
|
||||
break;
|
||||
|
||||
case DST__K_SET_STMTNUM:
|
||||
_bfd_error_handler
|
||||
(_("%s not implemented"), "DST__K_SET_STMTNUM");
|
||||
- cmd_length = 2;
|
||||
break;
|
||||
|
||||
case DST__K_TERM:
|
||||
data = pcl_ptr[DST_S_B_PCLINE_UNSBYTE];
|
||||
curr_pc += data;
|
||||
- cmd_length = 2;
|
||||
vms_debug2 ((4, "DST__K_TERM: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_TERM_W:
|
||||
data = bfd_getl16 (pcl_ptr + DST_S_W_PCLINE_UNSWORD);
|
||||
curr_pc += data;
|
||||
- cmd_length = 3;
|
||||
vms_debug2 ((4, "DST__K_TERM_W: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_TERM_L:
|
||||
data = bfd_getl32 (pcl_ptr + DST_S_L_PCLINE_UNSLONG);
|
||||
curr_pc += data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST__K_TERM_L: %d\n", data));
|
||||
break;
|
||||
|
||||
case DST__K_SET_ABS_PC:
|
||||
data = bfd_getl32 (pcl_ptr + DST_S_L_PCLINE_UNSLONG);
|
||||
curr_pc = data;
|
||||
- cmd_length = 5;
|
||||
vms_debug2 ((4, "DST__K_SET_ABS_PC: 0x%x\n", data));
|
||||
break;
|
||||
|
||||
@@ -4721,15 +4847,11 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
{
|
||||
curr_pc -= cmd;
|
||||
curr_linenum += 1;
|
||||
- cmd_length = 1;
|
||||
vms_debug2 ((4, "bump pc to 0x%lx and line to %d\n",
|
||||
(unsigned long)curr_pc, curr_linenum));
|
||||
}
|
||||
else
|
||||
- {
|
||||
- _bfd_error_handler (_("unknown line command %d"), cmd);
|
||||
- cmd_length = 2;
|
||||
- }
|
||||
+ _bfd_error_handler (_("unknown line command %d"), cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4859,7 +4981,8 @@ build_module_list (bfd *abfd)
|
||||
return NULL;
|
||||
|
||||
module = new_module (abfd);
|
||||
- if (!parse_module (abfd, module, PRIV (dst_section)->contents, -1))
|
||||
+ if (!parse_module (abfd, module, PRIV (dst_section)->contents,
|
||||
+ PRIV (dst_section)->size))
|
||||
return NULL;
|
||||
list = module;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Mon, 12 Dec 2022 08:31:08 +0000 (+1030)
|
||||
Subject: PR29892, Field file_table of struct module is uninitialized
|
||||
X-Git-Tag: gdb-13-branchpoint~86
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=65cf035b8dc1df5d8020e0b1449514a3c42933e7
|
||||
|
||||
PR29892, Field file_table of struct module is uninitialized
|
||||
|
||||
PR 29892
|
||||
* vms-alphs.c (new_module): Use bfd_zmalloc to alloc file_table.
|
||||
(parse_module): Rewrite file_table reallocation code and clear.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=65cf035b8dc1df5d8020e0b1449514a3c42933e7]
|
||||
|
||||
CVE: CVE-2023-25585
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
|
||||
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
|
||||
index 3b63259cc81..6ee7060b0b2 100644
|
||||
--- a/bfd/vms-alpha.c
|
||||
+++ b/bfd/vms-alpha.c
|
||||
@@ -4337,7 +4337,7 @@ new_module (bfd *abfd)
|
||||
= (struct module *) bfd_zalloc (abfd, sizeof (struct module));
|
||||
module->file_table_count = 16; /* Arbitrary. */
|
||||
module->file_table
|
||||
- = bfd_malloc (module->file_table_count * sizeof (struct fileinfo));
|
||||
+ = bfd_zmalloc (module->file_table_count * sizeof (struct fileinfo));
|
||||
return module;
|
||||
}
|
||||
|
||||
@@ -4520,15 +4520,18 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
|
||||
src_ptr + DST_S_B_SRC_DF_FILENAME,
|
||||
ptr + rec_length - (src_ptr + DST_S_B_SRC_DF_FILENAME));
|
||||
|
||||
- while (fileid >= module->file_table_count)
|
||||
+ if (fileid >= module->file_table_count)
|
||||
{
|
||||
- module->file_table_count *= 2;
|
||||
+ unsigned int old_count = module->file_table_count;
|
||||
+ module->file_table_count += fileid;
|
||||
module->file_table
|
||||
= bfd_realloc_or_free (module->file_table,
|
||||
module->file_table_count
|
||||
* sizeof (struct fileinfo));
|
||||
if (module->file_table == NULL)
|
||||
return false;
|
||||
+ memset (module->file_table + old_count, 0,
|
||||
+ fileid * sizeof (struct fileinfo));
|
||||
}
|
||||
|
||||
module->file_table [fileid].name = filename;
|
||||
@@ -0,0 +1,147 @@
|
||||
From: Alan Modra <amodra@gmail.com>
|
||||
Date: Fri, 14 Oct 2022 00:00:21 +0000 (+1030)
|
||||
Subject: PR29677, Field `the_bfd` of `asymbol` is uninitialised
|
||||
X-Git-Tag: gdb-13-branchpoint~871
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d12f8998d2d086f0a6606589e5aedb7147e6f2f1
|
||||
|
||||
PR29677, Field `the_bfd` of `asymbol` is uninitialised
|
||||
|
||||
Besides not initialising the_bfd of synthetic symbols, counting
|
||||
symbols when sizing didn't match symbols created if there were any
|
||||
dynsyms named "". We don't want synthetic symbols without names
|
||||
anyway, so get rid of them. Also, simplify and correct sanity checks.
|
||||
|
||||
PR 29677
|
||||
* mach-o.c (bfd_mach_o_get_synthetic_symtab): Rewrite.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=d12f8998d2d086f0a6606589e5aedb7147e6f2f1]
|
||||
|
||||
CVE: CVE-2023-25588
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
|
||||
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
|
||||
index acb35e7f0c6..5279343768c 100644
|
||||
--- a/bfd/mach-o.c
|
||||
+++ b/bfd/mach-o.c
|
||||
@@ -938,11 +938,9 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||
bfd_mach_o_symtab_command *symtab = mdata->symtab;
|
||||
asymbol *s;
|
||||
char * s_start;
|
||||
- char * s_end;
|
||||
unsigned long count, i, j, n;
|
||||
size_t size;
|
||||
char *names;
|
||||
- char *nul_name;
|
||||
const char stub [] = "$stub";
|
||||
|
||||
*ret = NULL;
|
||||
@@ -955,27 +953,27 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||
/* We need to allocate a bfd symbol for every indirect symbol and to
|
||||
allocate the memory for its name. */
|
||||
count = dysymtab->nindirectsyms;
|
||||
- size = count * sizeof (asymbol) + 1;
|
||||
-
|
||||
+ size = 0;
|
||||
for (j = 0; j < count; j++)
|
||||
{
|
||||
- const char * strng;
|
||||
unsigned int isym = dysymtab->indirect_syms[j];
|
||||
+ const char *str;
|
||||
|
||||
/* Some indirect symbols are anonymous. */
|
||||
- if (isym < symtab->nsyms && (strng = symtab->symbols[isym].symbol.name))
|
||||
- /* PR 17512: file: f5b8eeba. */
|
||||
- size += strnlen (strng, symtab->strsize - (strng - symtab->strtab)) + sizeof (stub);
|
||||
+ if (isym < symtab->nsyms
|
||||
+ && (str = symtab->symbols[isym].symbol.name) != NULL)
|
||||
+ {
|
||||
+ /* PR 17512: file: f5b8eeba. */
|
||||
+ size += strnlen (str, symtab->strsize - (str - symtab->strtab));
|
||||
+ size += sizeof (stub);
|
||||
+ }
|
||||
}
|
||||
|
||||
- s_start = bfd_malloc (size);
|
||||
+ s_start = bfd_malloc (size + count * sizeof (asymbol));
|
||||
s = *ret = (asymbol *) s_start;
|
||||
if (s == NULL)
|
||||
return -1;
|
||||
names = (char *) (s + count);
|
||||
- nul_name = names;
|
||||
- *names++ = 0;
|
||||
- s_end = s_start + size;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < mdata->nsects; i++)
|
||||
@@ -997,47 +995,39 @@ bfd_mach_o_get_synthetic_symtab (bfd *abfd,
|
||||
entry_size = bfd_mach_o_section_get_entry_size (abfd, sec);
|
||||
|
||||
/* PR 17512: file: 08e15eec. */
|
||||
- if (first >= count || last >= count || first > last)
|
||||
+ if (first >= count || last > count || first > last)
|
||||
goto fail;
|
||||
|
||||
for (j = first; j < last; j++)
|
||||
{
|
||||
unsigned int isym = dysymtab->indirect_syms[j];
|
||||
-
|
||||
- /* PR 17512: file: 04d64d9b. */
|
||||
- if (((char *) s) + sizeof (* s) > s_end)
|
||||
- goto fail;
|
||||
-
|
||||
- s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
|
||||
- s->section = sec->bfdsection;
|
||||
- s->value = addr - sec->addr;
|
||||
- s->udata.p = NULL;
|
||||
+ const char *str;
|
||||
+ size_t len;
|
||||
|
||||
if (isym < symtab->nsyms
|
||||
- && symtab->symbols[isym].symbol.name)
|
||||
+ && (str = symtab->symbols[isym].symbol.name) != NULL)
|
||||
{
|
||||
- const char *sym = symtab->symbols[isym].symbol.name;
|
||||
- size_t len;
|
||||
-
|
||||
- s->name = names;
|
||||
- len = strlen (sym);
|
||||
- /* PR 17512: file: 47dfd4d2. */
|
||||
- if (names + len >= s_end)
|
||||
+ /* PR 17512: file: 04d64d9b. */
|
||||
+ if (n >= count)
|
||||
goto fail;
|
||||
- memcpy (names, sym, len);
|
||||
- names += len;
|
||||
- /* PR 17512: file: 18f340a4. */
|
||||
- if (names + sizeof (stub) >= s_end)
|
||||
+ len = strnlen (str, symtab->strsize - (str - symtab->strtab));
|
||||
+ /* PR 17512: file: 47dfd4d2, 18f340a4. */
|
||||
+ if (size < len + sizeof (stub))
|
||||
goto fail;
|
||||
- memcpy (names, stub, sizeof (stub));
|
||||
- names += sizeof (stub);
|
||||
+ memcpy (names, str, len);
|
||||
+ memcpy (names + len, stub, sizeof (stub));
|
||||
+ s->name = names;
|
||||
+ names += len + sizeof (stub);
|
||||
+ size -= len + sizeof (stub);
|
||||
+ s->the_bfd = symtab->symbols[isym].symbol.the_bfd;
|
||||
+ s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
|
||||
+ s->section = sec->bfdsection;
|
||||
+ s->value = addr - sec->addr;
|
||||
+ s->udata.p = NULL;
|
||||
+ s++;
|
||||
+ n++;
|
||||
}
|
||||
- else
|
||||
- s->name = nul_name;
|
||||
-
|
||||
addr += entry_size;
|
||||
- s++;
|
||||
- n++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -0,0 +1,41 @@
|
||||
From: Nick Clifton <nickc@redhat.com>
|
||||
Date: Thu, 30 Mar 2023 09:10:09 +0000 (+0100)
|
||||
Subject: Fix an illegal memory access when an accessing a zer0-lengthverdef table.
|
||||
X-Git-Url: https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57
|
||||
|
||||
Fix an illegal memory access when an accessing a zer0-lengthverdef table.
|
||||
|
||||
PR 30285
|
||||
* elf.c (_bfd_elf_slurp_version_tables): Fail if no version definitions are allocated.
|
||||
|
||||
Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff_plain;h=c22d38baefc5a7a1e1f5cdc9dbb556b1f0ec5c57]
|
||||
|
||||
CVE: CVE-2023-1972
|
||||
|
||||
Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com>
|
||||
|
||||
---
|
||||
|
||||
diff --git a/bfd/elf.c b/bfd/elf.c
|
||||
index 027d0143735..185028cbd97 100644
|
||||
--- a/bfd/elf.c
|
||||
+++ b/bfd/elf.c
|
||||
@@ -9030,6 +9030,9 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
|
||||
bfd_set_error (bfd_error_file_too_big);
|
||||
goto error_return_verdef;
|
||||
}
|
||||
+
|
||||
+ if (amt == 0)
|
||||
+ goto error_return_verdef;
|
||||
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
|
||||
if (elf_tdata (abfd)->verdef == NULL)
|
||||
goto error_return_verdef;
|
||||
@@ -9133,6 +9136,8 @@ _bfd_elf_slurp_version_tables (bfd *abfd, bool default_imported_symver)
|
||||
bfd_set_error (bfd_error_file_too_big);
|
||||
goto error_return;
|
||||
}
|
||||
+ if (amt == 0)
|
||||
+ goto error_return;
|
||||
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt);
|
||||
if (elf_tdata (abfd)->verdef == NULL)
|
||||
goto error_return;
|
||||
@@ -8,3 +8,4 @@ rm -f *.tmp
|
||||
rm -f *.ok
|
||||
rm -f *.failed
|
||||
rm -f *.log
|
||||
cp ../data/test_data.tmp ./
|
||||
|
||||
@@ -141,4 +141,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/
|
||||
}
|
||||
|
||||
@@ -68,7 +68,8 @@ do_configure () {
|
||||
# libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure
|
||||
# tests. Create a dummy empty lib for the purposes of configure.
|
||||
mkdir -p ${WORKDIR}/dummylib
|
||||
${CC} -x c /dev/null -nostartfiles -shared -o ${WORKDIR}/dummylib/libstdc++.so
|
||||
${CC} -x c /dev/null -c -o ${WORKDIR}/dummylib/dummylib.o
|
||||
${AR} rcs ${WORKDIR}/dummylib/libstdc++.a ${WORKDIR}/dummylib/dummylib.o
|
||||
for d in libgcc ${RUNTIMETARGET}; do
|
||||
echo "Configuring $d"
|
||||
rm -rf ${B}/${TARGET_SYS}/$d/
|
||||
|
||||
94
meta/recipes-devtools/git/git/CVE-2023-25652.patch
Normal file
94
meta/recipes-devtools/git/git/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 Mar 9 16:02:54 2023 +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>
|
||||
|
||||
CVE: CVE-2023-25652
|
||||
Upstream-Status: Backport [https://github.com/git/git/commit/9db05711c98efc14f414d4c87135a34c13586e0b]
|
||||
|
||||
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.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 fc6f484..47f2686 100644
|
||||
--- a/apply.c
|
||||
+++ b/apply.c
|
||||
@@ -4584,7 +4584,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) {
|
||||
@@ -4624,7 +4624,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 65ac7df..e95e6d4 100755
|
||||
--- a/t/t4115-apply-symlink.sh
|
||||
+++ b/t/t4115-apply-symlink.sh
|
||||
@@ -126,4 +126,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.40.0
|
||||
162
meta/recipes-devtools/git/git/CVE-2023-29007.patch
Normal file
162
meta/recipes-devtools/git/git/CVE-2023-29007.patch
Normal file
@@ -0,0 +1,162 @@
|
||||
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
|
||||
CVE: CVE-2023-29007
|
||||
|
||||
Reference to upstream patch:
|
||||
https://github.com/git/git/commit/528290f8c61222433a8cf02fb7cfffa8438432b4
|
||||
|
||||
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.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 2bffa8d..6a01938 100644
|
||||
--- a/config.c
|
||||
+++ b/config.c
|
||||
@@ -3192,9 +3192,10 @@ void git_config_set_multivar(const char *key, const char *value,
|
||||
flags);
|
||||
}
|
||||
|
||||
-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++) {
|
||||
@@ -3247,6 +3248,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,
|
||||
@@ -3256,11 +3259,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));
|
||||
|
||||
@@ -3297,16 +3301,25 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
|
||||
goto out;
|
||||
}
|
||||
|
||||
- while (fgets(buf, sizeof(buf), config_file)) {
|
||||
- unsigned 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;
|
||||
|
||||
/*
|
||||
@@ -3323,7 +3336,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) {
|
||||
@@ -3398,6 +3411,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 78359f1..b07feb1 100755
|
||||
--- a/t/t1300-config.sh
|
||||
+++ b/t/t1300-config.sh
|
||||
@@ -617,6 +617,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.40.0
|
||||
@@ -10,6 +10,8 @@ PROVIDES:append:class-native = " git-replacement-native"
|
||||
SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
|
||||
file://fixsort.patch \
|
||||
file://0001-config.mak.uname-do-not-force-RHEL-7-specific-build-.patch \
|
||||
file://CVE-2023-29007.patch \
|
||||
file://CVE-2023-25652.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git-${PV}"
|
||||
@@ -35,6 +37,8 @@ CVE_CHECK_IGNORE += "CVE-2022-24975"
|
||||
CVE_CHECK_IGNORE += "CVE-2022-41953"
|
||||
# specific to Git for Windows
|
||||
CVE_CHECK_IGNORE += "CVE-2023-22743"
|
||||
# This is specific to Git-for-Windows
|
||||
CVE_CHECK_IGNORE += "CVE-2023-25815"
|
||||
|
||||
PACKAGECONFIG ??= "expat curl"
|
||||
PACKAGECONFIG[cvsserver] = ""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
require go-common.inc
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-1.18:"
|
||||
FILESEXTRAPATHS:prepend := "${FILE_DIRNAME}/go-1.19:${FILE_DIRNAME}/go-1.18:"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
|
||||
|
||||
@@ -23,6 +23,15 @@ SRC_URI += "\
|
||||
file://CVE-2022-2879.patch \
|
||||
file://CVE-2022-41720.patch \
|
||||
file://CVE-2022-41723.patch \
|
||||
file://cve-2022-41724.patch \
|
||||
file://add_godebug.patch \
|
||||
file://cve-2022-41725.patch \
|
||||
file://CVE-2022-41722.patch \
|
||||
file://CVE-2023-24537.patch \
|
||||
file://CVE-2023-24534.patch \
|
||||
file://CVE-2023-24538.patch \
|
||||
file://CVE-2023-24540.patch \
|
||||
file://CVE-2023-24539.patch \
|
||||
"
|
||||
SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd"
|
||||
|
||||
@@ -30,3 +39,6 @@ SRC_URI[main.sha256sum] = "a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784
|
||||
# fix in 1.17 onwards where we can drop this.
|
||||
# https://github.com/golang/go/issues/30999#issuecomment-910470358
|
||||
CVE_CHECK_IGNORE += "CVE-2021-29923"
|
||||
|
||||
# This is specific to Microsoft Windows
|
||||
CVE_CHECK_IGNORE += "CVE-2022-41716"
|
||||
|
||||
103
meta/recipes-devtools/go/go-1.18/CVE-2022-41722.patch
Normal file
103
meta/recipes-devtools/go/go-1.18/CVE-2022-41722.patch
Normal file
@@ -0,0 +1,103 @@
|
||||
From a826b19625caebed6dd0f3fbd9d0111f6c83737c Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Mon, 12 Dec 2022 16:43:37 -0800
|
||||
Subject: [PATCH] path/filepath: do not Clean("a/../c:/b") into c:\b on Windows
|
||||
|
||||
Do not permit Clean to convert a relative path into one starting
|
||||
with a drive reference. This change causes Clean to insert a .
|
||||
path element at the start of a path when the original path does not
|
||||
start with a volume name, and the first path element would contain
|
||||
a colon.
|
||||
|
||||
This may introduce a spurious but harmless . path element under
|
||||
some circumstances. For example, Clean("a/../b:/../c") becomes `.\c`.
|
||||
|
||||
This reverts CL 401595, since the change here supersedes the one
|
||||
in that CL.
|
||||
|
||||
Thanks to RyotaK (https://twitter.com/ryotkak) for reporting this issue.
|
||||
|
||||
Updates #57274
|
||||
Fixes #57276
|
||||
Fixes CVE-2022-41722
|
||||
|
||||
Change-Id: I837446285a03aa74c79d7642720e01f354c2ca17
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1675249
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
|
||||
(cherry picked from commit 8ca37f4813ef2f64600c92b83f17c9f3ca6c03a5)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1728944
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/468119
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
Run-TryBot: Michael Pratt <mpratt@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Auto-Submit: Michael Pratt <mpratt@google.com>
|
||||
|
||||
CVE: CVE-2022-41722
|
||||
Upstream-Status: Backport from https://github.com/golang/go/commit/bdf07c2e168baf736e4c057279ca12a4d674f18
|
||||
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
|
||||
---
|
||||
src/path/filepath/path.go | 27 ++++++++++++++-------------
|
||||
1 file changed, 14 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/path/filepath/path.go b/src/path/filepath/path.go
|
||||
index 8300a32..94621a0 100644
|
||||
--- a/src/path/filepath/path.go
|
||||
+++ b/src/path/filepath/path.go
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"errors"
|
||||
"io/fs"
|
||||
"os"
|
||||
+ "runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
@@ -117,21 +118,9 @@ func Clean(path string) string {
|
||||
case os.IsPathSeparator(path[r]):
|
||||
// empty path element
|
||||
r++
|
||||
- case path[r] == '.' && r+1 == n:
|
||||
+ case path[r] == '.' && (r+1 == n || os.IsPathSeparator(path[r+1])):
|
||||
// . element
|
||||
r++
|
||||
- case path[r] == '.' && os.IsPathSeparator(path[r+1]):
|
||||
- // ./ element
|
||||
- r++
|
||||
-
|
||||
- for r < len(path) && os.IsPathSeparator(path[r]) {
|
||||
- r++
|
||||
- }
|
||||
- if out.w == 0 && volumeNameLen(path[r:]) > 0 {
|
||||
- // When joining prefix "." and an absolute path on Windows,
|
||||
- // the prefix should not be removed.
|
||||
- out.append('.')
|
||||
- }
|
||||
case path[r] == '.' && path[r+1] == '.' && (r+2 == n || os.IsPathSeparator(path[r+2])):
|
||||
// .. element: remove to last separator
|
||||
r += 2
|
||||
@@ -157,6 +146,18 @@ func Clean(path string) string {
|
||||
if rooted && out.w != 1 || !rooted && out.w != 0 {
|
||||
out.append(Separator)
|
||||
}
|
||||
+ // If a ':' appears in the path element at the start of a Windows path,
|
||||
+ // insert a .\ at the beginning to avoid converting relative paths
|
||||
+ // like a/../c: into c:.
|
||||
+ if runtime.GOOS == "windows" && out.w == 0 && out.volLen == 0 && r != 0 {
|
||||
+ for i := r; i < n && !os.IsPathSeparator(path[i]); i++ {
|
||||
+ if path[i] == ':' {
|
||||
+ out.append('.')
|
||||
+ out.append(Separator)
|
||||
+ break
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
// copy element
|
||||
for ; r < n && !os.IsPathSeparator(path[r]); r++ {
|
||||
out.append(path[r])
|
||||
--
|
||||
2.7.4
|
||||
200
meta/recipes-devtools/go/go-1.18/CVE-2023-24534.patch
Normal file
200
meta/recipes-devtools/go/go-1.18/CVE-2023-24534.patch
Normal file
@@ -0,0 +1,200 @@
|
||||
From d6759e7a059f4208f07aa781402841d7ddaaef96 Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Fri, 10 Mar 2023 14:21:05 -0800
|
||||
Subject: [PATCH] [release-branch.go1.19] net/textproto: avoid overpredicting
|
||||
the number of MIME header keys
|
||||
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802452
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
(cherry picked from commit f739f080a72fd5b06d35c8e244165159645e2ed6)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802393
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Run-TryBot: Roland Shoemaker <bracewell@google.com>
|
||||
Change-Id: I675451438d619a9130360c56daf529559004903f
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/481982
|
||||
Run-TryBot: Michael Knyszek <mknyszek@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/d6759e7a059f4208f07aa781402841d7ddaaef96]
|
||||
CVE: CVE-2023-24534
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
|
||||
---
|
||||
src/bytes/bytes.go | 14 ++++++++
|
||||
src/net/textproto/reader.go | 30 ++++++++++------
|
||||
src/net/textproto/reader_test.go | 59 ++++++++++++++++++++++++++++++++
|
||||
3 files changed, 92 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
|
||||
index ce52649..95ff31c 100644
|
||||
--- a/src/bytes/bytes.go
|
||||
+++ b/src/bytes/bytes.go
|
||||
@@ -1174,3 +1174,17 @@ func Index(s, sep []byte) int {
|
||||
}
|
||||
return -1
|
||||
}
|
||||
+
|
||||
+// Cut slices s around the first instance of sep,
|
||||
+// returning the text before and after sep.
|
||||
+// The found result reports whether sep appears in s.
|
||||
+// If sep does not appear in s, cut returns s, nil, false.
|
||||
+//
|
||||
+// Cut returns slices of the original slice s, not copies.
|
||||
+func Cut(s, sep []byte) (before, after []byte, found bool) {
|
||||
+ if i := Index(s, sep); i >= 0 {
|
||||
+ return s[:i], s[i+len(sep):], true
|
||||
+ }
|
||||
+ return s, nil, false
|
||||
+}
|
||||
+
|
||||
diff --git a/src/net/textproto/reader.go b/src/net/textproto/reader.go
|
||||
index 6a680f4..fcbede8 100644
|
||||
--- a/src/net/textproto/reader.go
|
||||
+++ b/src/net/textproto/reader.go
|
||||
@@ -493,8 +493,11 @@ func readMIMEHeader(r *Reader, lim int64) (MIMEHeader, error) {
|
||||
// large one ahead of time which we'll cut up into smaller
|
||||
// slices. If this isn't big enough later, we allocate small ones.
|
||||
var strs []string
|
||||
- hint := r.upcomingHeaderNewlines()
|
||||
+ hint := r.upcomingHeaderKeys()
|
||||
if hint > 0 {
|
||||
+ if hint > 1000 {
|
||||
+ hint = 1000 // set a cap to avoid overallocation
|
||||
+ }
|
||||
strs = make([]string, hint)
|
||||
}
|
||||
|
||||
@@ -589,9 +592,11 @@ func mustHaveFieldNameColon(line []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
-// upcomingHeaderNewlines returns an approximation of the number of newlines
|
||||
+var nl = []byte("\n")
|
||||
+
|
||||
+// upcomingHeaderKeys returns an approximation of the number of keys
|
||||
// that will be in this header. If it gets confused, it returns 0.
|
||||
-func (r *Reader) upcomingHeaderNewlines() (n int) {
|
||||
+func (r *Reader) upcomingHeaderKeys() (n int) {
|
||||
// Try to determine the 'hint' size.
|
||||
r.R.Peek(1) // force a buffer load if empty
|
||||
s := r.R.Buffered()
|
||||
@@ -599,17 +604,20 @@ func (r *Reader) upcomingHeaderNewlines() (n int) {
|
||||
return
|
||||
}
|
||||
peek, _ := r.R.Peek(s)
|
||||
- for len(peek) > 0 {
|
||||
- i := bytes.IndexByte(peek, '\n')
|
||||
- if i < 3 {
|
||||
- // Not present (-1) or found within the next few bytes,
|
||||
- // implying we're at the end ("\r\n\r\n" or "\n\n")
|
||||
- return
|
||||
+ for len(peek) > 0 && n < 1000 {
|
||||
+ var line []byte
|
||||
+ line, peek, _ = bytes.Cut(peek, nl)
|
||||
+ if len(line) == 0 || (len(line) == 1 && line[0] == '\r') {
|
||||
+ // Blank line separating headers from the body.
|
||||
+ break
|
||||
+ }
|
||||
+ if line[0] == ' ' || line[0] == '\t' {
|
||||
+ // Folded continuation of the previous line.
|
||||
+ continue
|
||||
}
|
||||
n++
|
||||
- peek = peek[i+1:]
|
||||
}
|
||||
- return
|
||||
+ return n
|
||||
}
|
||||
|
||||
// CanonicalMIMEHeaderKey returns the canonical format of the
|
||||
diff --git a/src/net/textproto/reader_test.go b/src/net/textproto/reader_test.go
|
||||
index 3124d43..3ae0de1 100644
|
||||
--- a/src/net/textproto/reader_test.go
|
||||
+++ b/src/net/textproto/reader_test.go
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
"reflect"
|
||||
+ "runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
@@ -127,6 +128,42 @@ func TestReadMIMEHeaderSingle(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
+// TestReaderUpcomingHeaderKeys is testing an internal function, but it's very
|
||||
+// difficult to test well via the external API.
|
||||
+func TestReaderUpcomingHeaderKeys(t *testing.T) {
|
||||
+ for _, test := range []struct {
|
||||
+ input string
|
||||
+ want int
|
||||
+ }{{
|
||||
+ input: "",
|
||||
+ want: 0,
|
||||
+ }, {
|
||||
+ input: "A: v",
|
||||
+ want: 1,
|
||||
+ }, {
|
||||
+ input: "A: v\r\nB: v\r\n",
|
||||
+ want: 2,
|
||||
+ }, {
|
||||
+ input: "A: v\nB: v\n",
|
||||
+ want: 2,
|
||||
+ }, {
|
||||
+ input: "A: v\r\n continued\r\n still continued\r\nB: v\r\n\r\n",
|
||||
+ want: 2,
|
||||
+ }, {
|
||||
+ input: "A: v\r\n\r\nB: v\r\nC: v\r\n",
|
||||
+ want: 1,
|
||||
+ }, {
|
||||
+ input: "A: v" + strings.Repeat("\n", 1000),
|
||||
+ want: 1,
|
||||
+ }} {
|
||||
+ r := reader(test.input)
|
||||
+ got := r.upcomingHeaderKeys()
|
||||
+ if test.want != got {
|
||||
+ t.Fatalf("upcomingHeaderKeys(%q): %v; want %v", test.input, got, test.want)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
func TestReadMIMEHeaderNoKey(t *testing.T) {
|
||||
r := reader(": bar\ntest-1: 1\n\n")
|
||||
m, err := r.ReadMIMEHeader()
|
||||
@@ -223,6 +260,28 @@ func TestReadMIMEHeaderTrimContinued(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
+// Test that reading a header doesn't overallocate. Issue 58975.
|
||||
+func TestReadMIMEHeaderAllocations(t *testing.T) {
|
||||
+ var totalAlloc uint64
|
||||
+ const count = 200
|
||||
+ for i := 0; i < count; i++ {
|
||||
+ r := reader("A: b\r\n\r\n" + strings.Repeat("\n", 4096))
|
||||
+ var m1, m2 runtime.MemStats
|
||||
+ runtime.ReadMemStats(&m1)
|
||||
+ _, err := r.ReadMIMEHeader()
|
||||
+ if err != nil {
|
||||
+ t.Fatalf("ReadMIMEHeader: %v", err)
|
||||
+ }
|
||||
+ runtime.ReadMemStats(&m2)
|
||||
+ totalAlloc += m2.TotalAlloc - m1.TotalAlloc
|
||||
+ }
|
||||
+ // 32k is large and we actually allocate substantially less,
|
||||
+ // but prior to the fix for #58975 we allocated ~400k in this case.
|
||||
+ if got, want := totalAlloc/count, uint64(32768); got > want {
|
||||
+ t.Fatalf("ReadMIMEHeader allocated %v bytes, want < %v", got, want)
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
type readResponseTest struct {
|
||||
in string
|
||||
inCode int
|
||||
--
|
||||
2.25.1
|
||||
|
||||
75
meta/recipes-devtools/go/go-1.18/CVE-2023-24537.patch
Normal file
75
meta/recipes-devtools/go/go-1.18/CVE-2023-24537.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
From bf8c7c575c8a552d9d79deb29e80854dc88528d0 Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Mon, 20 Mar 2023 10:43:19 -0700
|
||||
Subject: [PATCH] [release-branch.go1.20] mime/multipart: limit parsed mime
|
||||
message sizes
|
||||
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802456
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1802611
|
||||
Reviewed-by: Damien Neil <dneil@google.com>
|
||||
Change-Id: Ifdfa192d54f722d781a4d8c5f35b5fb72d122168
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/481986
|
||||
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Run-TryBot: Michael Knyszek <mknyszek@google.com>
|
||||
Auto-Submit: Michael Knyszek <mknyszek@google.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/126a1d02da82f93ede7ce0bd8d3c51ef627f2104]
|
||||
CVE: CVE-2023-24537
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
|
||||
---
|
||||
src/go/parser/parser_test.go | 16 ++++++++++++++++
|
||||
src/go/scanner/scanner.go | 5 ++++-
|
||||
2 files changed, 20 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/go/parser/parser_test.go b/src/go/parser/parser_test.go
|
||||
index 1a46c87..993df63 100644
|
||||
--- a/src/go/parser/parser_test.go
|
||||
+++ b/src/go/parser/parser_test.go
|
||||
@@ -746,3 +746,19 @@ func TestScopeDepthLimit(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+// TestIssue59180 tests that line number overflow doesn't cause an infinite loop.
|
||||
+func TestIssue59180(t *testing.T) {
|
||||
+ testcases := []string{
|
||||
+ "package p\n//line :9223372036854775806\n\n//",
|
||||
+ "package p\n//line :1:9223372036854775806\n\n//",
|
||||
+ "package p\n//line file:9223372036854775806\n\n//",
|
||||
+ }
|
||||
+
|
||||
+ for _, src := range testcases {
|
||||
+ _, err := ParseFile(token.NewFileSet(), "", src, ParseComments)
|
||||
+ if err == nil {
|
||||
+ t.Errorf("ParseFile(%s) succeeded unexpectedly", src)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/go/scanner/scanner.go b/src/go/scanner/scanner.go
|
||||
index f08e28c..ff847b5 100644
|
||||
--- a/src/go/scanner/scanner.go
|
||||
+++ b/src/go/scanner/scanner.go
|
||||
@@ -251,13 +251,16 @@ func (s *Scanner) updateLineInfo(next, offs int, text []byte) {
|
||||
return
|
||||
}
|
||||
|
||||
+ // Put a cap on the maximum size of line and column numbers.
|
||||
+ // 30 bits allows for some additional space before wrapping an int32.
|
||||
+ const maxLineCol = 1<<30 - 1
|
||||
var line, col int
|
||||
i2, n2, ok2 := trailingDigits(text[:i-1])
|
||||
if ok2 {
|
||||
//line filename:line:col
|
||||
i, i2 = i2, i
|
||||
line, col = n2, n
|
||||
- if col == 0 {
|
||||
+ if col == 0 || col > maxLineCol {
|
||||
s.error(offs+i2, "invalid column number: "+string(text[i2:]))
|
||||
return
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
208
meta/recipes-devtools/go/go-1.18/CVE-2023-24538.patch
Normal file
208
meta/recipes-devtools/go/go-1.18/CVE-2023-24538.patch
Normal file
@@ -0,0 +1,208 @@
|
||||
From 07cc3b8711a8efbb5885f56dd90d854049ad2f7d Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Mon, 20 Mar 2023 11:01:13 -0700
|
||||
Subject: [PATCH] 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 8739735..ca078f4 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"
|
||||
@@ -205,6 +206,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
|
||||
53
meta/recipes-devtools/go/go-1.18/CVE-2023-24539.patch
Normal file
53
meta/recipes-devtools/go/go-1.18/CVE-2023-24539.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From e49282327b05192e46086bf25fd3ac691205fe80 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Thu, 13 Apr 2023 15:40:44 -0700
|
||||
Subject: [PATCH] [release-branch.go1.19] html/template: disallow angle
|
||||
brackets in CSS values
|
||||
|
||||
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://team-review.git.corp.google.com/c/golang/go-private/+/1851496
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Reviewed-on: https://go-review.googlesource.com/c/go/+/491335
|
||||
Run-TryBot: Carlos Amedee <carlos@golang.org>
|
||||
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/e49282327b05192e46086bf25fd3ac691205fe80]
|
||||
CVE: CVE-2023-24539
|
||||
Signed-off-by: Vivek Kumbhar <vkumbhar@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)
|
||||
93
meta/recipes-devtools/go/go-1.19/CVE-2023-24540.patch
Normal file
93
meta/recipes-devtools/go/go-1.19/CVE-2023-24540.patch
Normal file
@@ -0,0 +1,93 @@
|
||||
From 2305cdb2aa5ac8e9960bd64e548a119c7dd87530 Mon Sep 17 00:00:00 2001
|
||||
From: Roland Shoemaker <bracewell@google.com>
|
||||
Date: Tue, 11 Apr 2023 16:27:43 +0100
|
||||
Subject: [PATCH] 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>
|
||||
|
||||
CVE: CVE-2023-24540
|
||||
Upstream-Status: Backport [https://github.com/golang/go/commit/ce7bd33345416e6d8cac901792060591cafc2797]
|
||||
|
||||
Signed-off-by: Sakib Sajal <sakib.sajal@windriver.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 b888eaf..35994f0 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 d7ee47b..8f5d76d 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)
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
2.40.0
|
||||
|
||||
84
meta/recipes-devtools/go/go-1.19/add_godebug.patch
Normal file
84
meta/recipes-devtools/go/go-1.19/add_godebug.patch
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
Upstream-Status: Backport [see text]
|
||||
|
||||
https://github.com/golong/go.git as of commit 22c1d18a27...
|
||||
Copy src/internal/godebug from go 1.19 since it does not
|
||||
exist in 1.17.
|
||||
|
||||
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||
---
|
||||
|
||||
--- /dev/null
|
||||
+++ go/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 ""
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ go/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)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
2391
meta/recipes-devtools/go/go-1.19/cve-2022-41724.patch
Normal file
2391
meta/recipes-devtools/go/go-1.19/cve-2022-41724.patch
Normal file
File diff suppressed because it is too large
Load Diff
652
meta/recipes-devtools/go/go-1.19/cve-2022-41725.patch
Normal file
652
meta/recipes-devtools/go/go-1.19/cve-2022-41725.patch
Normal file
@@ -0,0 +1,652 @@
|
||||
From 5c55ac9bf1e5f779220294c843526536605f42ab Mon Sep 17 00:00:00 2001
|
||||
From: Damien Neil <dneil@google.com>
|
||||
Date: Wed, 25 Jan 2023 09:27:01 -0800
|
||||
Subject: [PATCH] [release-branch.go1.19] mime/multipart: limit memory/inode
|
||||
consumption of ReadForm
|
||||
|
||||
Reader.ReadForm is documented as storing "up to maxMemory bytes + 10MB"
|
||||
in memory. Parsed forms can consume substantially more memory than
|
||||
this limit, since ReadForm does not account for map entry overhead
|
||||
and MIME headers.
|
||||
|
||||
In addition, while the amount of disk memory consumed by ReadForm can
|
||||
be constrained by limiting the size of the parsed input, ReadForm will
|
||||
create one temporary file per form part stored on disk, potentially
|
||||
consuming a large number of inodes.
|
||||
|
||||
Update ReadForm's memory accounting to include part names,
|
||||
MIME headers, and map entry overhead.
|
||||
|
||||
Update ReadForm to store all on-disk file parts in a single
|
||||
temporary file.
|
||||
|
||||
Files returned by FileHeader.Open are documented as having a concrete
|
||||
type of *os.File when a file is stored on disk. The change to use a
|
||||
single temporary file for all parts means that this is no longer the
|
||||
case when a form contains more than a single file part stored on disk.
|
||||
|
||||
The previous behavior of storing each file part in a separate disk
|
||||
file may be reenabled with GODEBUG=multipartfiles=distinct.
|
||||
|
||||
Update Reader.NextPart and Reader.NextRawPart to set a 10MiB cap
|
||||
on the size of MIME headers.
|
||||
|
||||
Thanks to Jakob Ackermann (@das7pad) for reporting this issue.
|
||||
|
||||
Updates #58006
|
||||
Fixes #58362
|
||||
Fixes CVE-2022-41725
|
||||
|
||||
Change-Id: Ibd780a6c4c83ac8bcfd3cbe344f042e9940f2eab
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1714276
|
||||
Reviewed-by: Julie Qiu <julieqiu@google.com>
|
||||
TryBot-Result: Security TryBots <security-trybots@go-security-trybots.iam.gserviceaccount.com>
|
||||
Reviewed-by: Roland Shoemaker <bracewell@google.com>
|
||||
Run-TryBot: Damien Neil <dneil@google.com>
|
||||
(cherry picked from commit ed4664330edcd91b24914c9371c377c132dbce8c)
|
||||
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1728949
|
||||
Reviewed-by: Tatiana Bradley <tatianabradley@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/+/468116
|
||||
TryBot-Result: Gopher Robot <gobot@golang.org>
|
||||
Reviewed-by: Than McIntosh <thanm@google.com>
|
||||
Run-TryBot: Michael Pratt <mpratt@google.com>
|
||||
Auto-Submit: Michael Pratt <mpratt@google.com>
|
||||
---
|
||||
|
||||
CVE: CVE-2022-41725
|
||||
|
||||
Upstream-Status: Backport [see text]
|
||||
|
||||
https://github.com/golong/go.git commit 5c55ac9bf1e5...
|
||||
modified for reader.go
|
||||
|
||||
Signed-off-by: Joe Slater <joe.slater@windriver.com>
|
||||
|
||||
___
|
||||
src/mime/multipart/formdata.go | 132 ++++++++++++++++++++-----
|
||||
src/mime/multipart/formdata_test.go | 140 ++++++++++++++++++++++++++-
|
||||
src/mime/multipart/multipart.go | 25 +++--
|
||||
src/mime/multipart/readmimeheader.go | 14 +++
|
||||
src/net/http/request_test.go | 2 +-
|
||||
src/net/textproto/reader.go | 20 +++-
|
||||
6 files changed, 295 insertions(+), 38 deletions(-)
|
||||
create mode 100644 src/mime/multipart/readmimeheader.go
|
||||
|
||||
--- go.orig/src/mime/multipart/formdata.go
|
||||
+++ go/src/mime/multipart/formdata.go
|
||||
@@ -7,6 +7,7 @@ package multipart
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
+ "internal/godebug"
|
||||
"io"
|
||||
"math"
|
||||
"net/textproto"
|
||||
@@ -33,23 +34,58 @@ func (r *Reader) ReadForm(maxMemory int6
|
||||
|
||||
func (r *Reader) readForm(maxMemory int64) (_ *Form, err error) {
|
||||
form := &Form{make(map[string][]string), make(map[string][]*FileHeader)}
|
||||
+ var (
|
||||
+ file *os.File
|
||||
+ fileOff int64
|
||||
+ )
|
||||
+ numDiskFiles := 0
|
||||
+ multipartFiles := godebug.Get("multipartfiles")
|
||||
+ combineFiles := multipartFiles != "distinct"
|
||||
defer func() {
|
||||
+ if file != nil {
|
||||
+ if cerr := file.Close(); err == nil {
|
||||
+ err = cerr
|
||||
+ }
|
||||
+ }
|
||||
+ if combineFiles && numDiskFiles > 1 {
|
||||
+ for _, fhs := range form.File {
|
||||
+ for _, fh := range fhs {
|
||||
+ fh.tmpshared = true
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
if err != nil {
|
||||
form.RemoveAll()
|
||||
+ if file != nil {
|
||||
+ os.Remove(file.Name())
|
||||
+ }
|
||||
}
|
||||
}()
|
||||
|
||||
- // Reserve an additional 10 MB for non-file parts.
|
||||
- maxValueBytes := maxMemory + int64(10<<20)
|
||||
- if maxValueBytes <= 0 {
|
||||
+ // maxFileMemoryBytes is the maximum bytes of file data we will store in memory.
|
||||
+ // Data past this limit is written to disk.
|
||||
+ // This limit strictly applies to content, not metadata (filenames, MIME headers, etc.),
|
||||
+ // since metadata is always stored in memory, not disk.
|
||||
+ //
|
||||
+ // maxMemoryBytes is the maximum bytes we will store in memory, including file content,
|
||||
+ // non-file part values, metdata, and map entry overhead.
|
||||
+ //
|
||||
+ // We reserve an additional 10 MB in maxMemoryBytes for non-file data.
|
||||
+ //
|
||||
+ // The relationship between these parameters, as well as the overly-large and
|
||||
+ // unconfigurable 10 MB added on to maxMemory, is unfortunate but difficult to change
|
||||
+ // within the constraints of the API as documented.
|
||||
+ maxFileMemoryBytes := maxMemory
|
||||
+ maxMemoryBytes := maxMemory + int64(10<<20)
|
||||
+ if maxMemoryBytes <= 0 {
|
||||
if maxMemory < 0 {
|
||||
- maxValueBytes = 0
|
||||
+ maxMemoryBytes = 0
|
||||
} else {
|
||||
- maxValueBytes = math.MaxInt64
|
||||
+ maxMemoryBytes = math.MaxInt64
|
||||
}
|
||||
}
|
||||
for {
|
||||
- p, err := r.NextPart()
|
||||
+ p, err := r.nextPart(false, maxMemoryBytes)
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
@@ -63,16 +99,27 @@ func (r *Reader) readForm(maxMemory int6
|
||||
}
|
||||
filename := p.FileName()
|
||||
|
||||
+ // Multiple values for the same key (one map entry, longer slice) are cheaper
|
||||
+ // than the same number of values for different keys (many map entries), but
|
||||
+ // using a consistent per-value cost for overhead is simpler.
|
||||
+ maxMemoryBytes -= int64(len(name))
|
||||
+ maxMemoryBytes -= 100 // map overhead
|
||||
+ if maxMemoryBytes < 0 {
|
||||
+ // We can't actually take this path, since nextPart would already have
|
||||
+ // rejected the MIME headers for being too large. Check anyway.
|
||||
+ return nil, ErrMessageTooLarge
|
||||
+ }
|
||||
+
|
||||
var b bytes.Buffer
|
||||
|
||||
if filename == "" {
|
||||
// value, store as string in memory
|
||||
- n, err := io.CopyN(&b, p, maxValueBytes+1)
|
||||
+ n, err := io.CopyN(&b, p, maxMemoryBytes+1)
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, err
|
||||
}
|
||||
- maxValueBytes -= n
|
||||
- if maxValueBytes < 0 {
|
||||
+ maxMemoryBytes -= n
|
||||
+ if maxMemoryBytes < 0 {
|
||||
return nil, ErrMessageTooLarge
|
||||
}
|
||||
form.Value[name] = append(form.Value[name], b.String())
|
||||
@@ -80,35 +127,45 @@ func (r *Reader) readForm(maxMemory int6
|
||||
}
|
||||
|
||||
// file, store in memory or on disk
|
||||
+ maxMemoryBytes -= mimeHeaderSize(p.Header)
|
||||
+ if maxMemoryBytes < 0 {
|
||||
+ return nil, ErrMessageTooLarge
|
||||
+ }
|
||||
fh := &FileHeader{
|
||||
Filename: filename,
|
||||
Header: p.Header,
|
||||
}
|
||||
- n, err := io.CopyN(&b, p, maxMemory+1)
|
||||
+ n, err := io.CopyN(&b, p, maxFileMemoryBytes+1)
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, err
|
||||
}
|
||||
- if n > maxMemory {
|
||||
- // too big, write to disk and flush buffer
|
||||
- file, err := os.CreateTemp("", "multipart-")
|
||||
- if err != nil {
|
||||
- return nil, err
|
||||
+ if n > maxFileMemoryBytes {
|
||||
+ if file == nil {
|
||||
+ file, err = os.CreateTemp(r.tempDir, "multipart-")
|
||||
+ if err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
}
|
||||
+ numDiskFiles++
|
||||
size, err := io.Copy(file, io.MultiReader(&b, p))
|
||||
- if cerr := file.Close(); err == nil {
|
||||
- err = cerr
|
||||
- }
|
||||
if err != nil {
|
||||
- os.Remove(file.Name())
|
||||
return nil, err
|
||||
}
|
||||
fh.tmpfile = file.Name()
|
||||
fh.Size = size
|
||||
+ fh.tmpoff = fileOff
|
||||
+ fileOff += size
|
||||
+ if !combineFiles {
|
||||
+ if err := file.Close(); err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ file = nil
|
||||
+ }
|
||||
} else {
|
||||
fh.content = b.Bytes()
|
||||
fh.Size = int64(len(fh.content))
|
||||
- maxMemory -= n
|
||||
- maxValueBytes -= n
|
||||
+ maxFileMemoryBytes -= n
|
||||
+ maxMemoryBytes -= n
|
||||
}
|
||||
form.File[name] = append(form.File[name], fh)
|
||||
}
|
||||
@@ -116,6 +173,17 @@ func (r *Reader) readForm(maxMemory int6
|
||||
return form, nil
|
||||
}
|
||||
|
||||
+func mimeHeaderSize(h textproto.MIMEHeader) (size int64) {
|
||||
+ for k, vs := range h {
|
||||
+ size += int64(len(k))
|
||||
+ size += 100 // map entry overhead
|
||||
+ for _, v := range vs {
|
||||
+ size += int64(len(v))
|
||||
+ }
|
||||
+ }
|
||||
+ return size
|
||||
+}
|
||||
+
|
||||
// Form is a parsed multipart form.
|
||||
// Its File parts are stored either in memory or on disk,
|
||||
// and are accessible via the *FileHeader's Open method.
|
||||
@@ -133,7 +201,7 @@ func (f *Form) RemoveAll() error {
|
||||
for _, fh := range fhs {
|
||||
if fh.tmpfile != "" {
|
||||
e := os.Remove(fh.tmpfile)
|
||||
- if e != nil && err == nil {
|
||||
+ if e != nil && !errors.Is(e, os.ErrNotExist) && err == nil {
|
||||
err = e
|
||||
}
|
||||
}
|
||||
@@ -148,15 +216,25 @@ type FileHeader struct {
|
||||
Header textproto.MIMEHeader
|
||||
Size int64
|
||||
|
||||
- content []byte
|
||||
- tmpfile string
|
||||
+ content []byte
|
||||
+ tmpfile string
|
||||
+ tmpoff int64
|
||||
+ tmpshared bool
|
||||
}
|
||||
|
||||
// Open opens and returns the FileHeader's associated File.
|
||||
func (fh *FileHeader) Open() (File, error) {
|
||||
if b := fh.content; b != nil {
|
||||
r := io.NewSectionReader(bytes.NewReader(b), 0, int64(len(b)))
|
||||
- return sectionReadCloser{r}, nil
|
||||
+ return sectionReadCloser{r, nil}, nil
|
||||
+ }
|
||||
+ if fh.tmpshared {
|
||||
+ f, err := os.Open(fh.tmpfile)
|
||||
+ if err != nil {
|
||||
+ return nil, err
|
||||
+ }
|
||||
+ r := io.NewSectionReader(f, fh.tmpoff, fh.Size)
|
||||
+ return sectionReadCloser{r, f}, nil
|
||||
}
|
||||
return os.Open(fh.tmpfile)
|
||||
}
|
||||
@@ -175,8 +253,12 @@ type File interface {
|
||||
|
||||
type sectionReadCloser struct {
|
||||
*io.SectionReader
|
||||
+ io.Closer
|
||||
}
|
||||
|
||||
func (rc sectionReadCloser) Close() error {
|
||||
+ if rc.Closer != nil {
|
||||
+ return rc.Closer.Close()
|
||||
+ }
|
||||
return nil
|
||||
}
|
||||
--- go.orig/src/mime/multipart/formdata_test.go
|
||||
+++ go/src/mime/multipart/formdata_test.go
|
||||
@@ -6,8 +6,10 @@ package multipart
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
+ "fmt"
|
||||
"io"
|
||||
"math"
|
||||
+ "net/textproto"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -208,8 +210,8 @@ Content-Disposition: form-data; name="la
|
||||
maxMemory int64
|
||||
err error
|
||||
}{
|
||||
- {"smaller", 50, nil},
|
||||
- {"exact-fit", 25, nil},
|
||||
+ {"smaller", 50 + int64(len("largetext")) + 100, nil},
|
||||
+ {"exact-fit", 25 + int64(len("largetext")) + 100, nil},
|
||||
{"too-large", 0, ErrMessageTooLarge},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
@@ -224,7 +226,7 @@ Content-Disposition: form-data; name="la
|
||||
defer f.RemoveAll()
|
||||
}
|
||||
if tc.err != err {
|
||||
- t.Fatalf("ReadForm error - got: %v; expected: %v", tc.err, err)
|
||||
+ t.Fatalf("ReadForm error - got: %v; expected: %v", err, tc.err)
|
||||
}
|
||||
if err == nil {
|
||||
if g := f.Value["largetext"][0]; g != largeTextValue {
|
||||
@@ -234,3 +236,135 @@ Content-Disposition: form-data; name="la
|
||||
})
|
||||
}
|
||||
}
|
||||
+
|
||||
+// TestReadForm_MetadataTooLarge verifies that we account for the size of field names,
|
||||
+// MIME headers, and map entry overhead while limiting the memory consumption of parsed forms.
|
||||
+func TestReadForm_MetadataTooLarge(t *testing.T) {
|
||||
+ for _, test := range []struct {
|
||||
+ name string
|
||||
+ f func(*Writer)
|
||||
+ }{{
|
||||
+ name: "large name",
|
||||
+ f: func(fw *Writer) {
|
||||
+ name := strings.Repeat("a", 10<<20)
|
||||
+ w, _ := fw.CreateFormField(name)
|
||||
+ w.Write([]byte("value"))
|
||||
+ },
|
||||
+ }, {
|
||||
+ name: "large MIME header",
|
||||
+ f: func(fw *Writer) {
|
||||
+ h := make(textproto.MIMEHeader)
|
||||
+ h.Set("Content-Disposition", `form-data; name="a"`)
|
||||
+ h.Set("X-Foo", strings.Repeat("a", 10<<20))
|
||||
+ w, _ := fw.CreatePart(h)
|
||||
+ w.Write([]byte("value"))
|
||||
+ },
|
||||
+ }, {
|
||||
+ name: "many parts",
|
||||
+ f: func(fw *Writer) {
|
||||
+ for i := 0; i < 110000; i++ {
|
||||
+ w, _ := fw.CreateFormField("f")
|
||||
+ w.Write([]byte("v"))
|
||||
+ }
|
||||
+ },
|
||||
+ }} {
|
||||
+ t.Run(test.name, func(t *testing.T) {
|
||||
+ var buf bytes.Buffer
|
||||
+ fw := NewWriter(&buf)
|
||||
+ test.f(fw)
|
||||
+ if err := fw.Close(); err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ fr := NewReader(&buf, fw.Boundary())
|
||||
+ _, err := fr.ReadForm(0)
|
||||
+ if err != ErrMessageTooLarge {
|
||||
+ t.Errorf("fr.ReadForm() = %v, want ErrMessageTooLarge", err)
|
||||
+ }
|
||||
+ })
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+// TestReadForm_ManyFiles_Combined tests that a multipart form containing many files only
|
||||
+// results in a single on-disk file.
|
||||
+func TestReadForm_ManyFiles_Combined(t *testing.T) {
|
||||
+ const distinct = false
|
||||
+ testReadFormManyFiles(t, distinct)
|
||||
+}
|
||||
+
|
||||
+// TestReadForm_ManyFiles_Distinct tests that setting GODEBUG=multipartfiles=distinct
|
||||
+// results in every file in a multipart form being placed in a distinct on-disk file.
|
||||
+func TestReadForm_ManyFiles_Distinct(t *testing.T) {
|
||||
+ t.Setenv("GODEBUG", "multipartfiles=distinct")
|
||||
+ const distinct = true
|
||||
+ testReadFormManyFiles(t, distinct)
|
||||
+}
|
||||
+
|
||||
+func testReadFormManyFiles(t *testing.T, distinct bool) {
|
||||
+ var buf bytes.Buffer
|
||||
+ fw := NewWriter(&buf)
|
||||
+ const numFiles = 10
|
||||
+ for i := 0; i < numFiles; i++ {
|
||||
+ name := fmt.Sprint(i)
|
||||
+ w, err := fw.CreateFormFile(name, name)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ w.Write([]byte(name))
|
||||
+ }
|
||||
+ if err := fw.Close(); err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ fr := NewReader(&buf, fw.Boundary())
|
||||
+ fr.tempDir = t.TempDir()
|
||||
+ form, err := fr.ReadForm(0)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ for i := 0; i < numFiles; i++ {
|
||||
+ name := fmt.Sprint(i)
|
||||
+ if got := len(form.File[name]); got != 1 {
|
||||
+ t.Fatalf("form.File[%q] has %v entries, want 1", name, got)
|
||||
+ }
|
||||
+ fh := form.File[name][0]
|
||||
+ file, err := fh.Open()
|
||||
+ if err != nil {
|
||||
+ t.Fatalf("form.File[%q].Open() = %v", name, err)
|
||||
+ }
|
||||
+ if distinct {
|
||||
+ if _, ok := file.(*os.File); !ok {
|
||||
+ t.Fatalf("form.File[%q].Open: %T, want *os.File", name, file)
|
||||
+ }
|
||||
+ }
|
||||
+ got, err := io.ReadAll(file)
|
||||
+ file.Close()
|
||||
+ if string(got) != name || err != nil {
|
||||
+ t.Fatalf("read form.File[%q]: %q, %v; want %q, nil", name, string(got), err, name)
|
||||
+ }
|
||||
+ }
|
||||
+ dir, err := os.Open(fr.tempDir)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ defer dir.Close()
|
||||
+ names, err := dir.Readdirnames(0)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ wantNames := 1
|
||||
+ if distinct {
|
||||
+ wantNames = numFiles
|
||||
+ }
|
||||
+ if len(names) != wantNames {
|
||||
+ t.Fatalf("temp dir contains %v files; want 1", len(names))
|
||||
+ }
|
||||
+ if err := form.RemoveAll(); err != nil {
|
||||
+ t.Fatalf("form.RemoveAll() = %v", err)
|
||||
+ }
|
||||
+ names, err = dir.Readdirnames(0)
|
||||
+ if err != nil {
|
||||
+ t.Fatal(err)
|
||||
+ }
|
||||
+ if len(names) != 0 {
|
||||
+ t.Fatalf("temp dir contains %v files; want 0", len(names))
|
||||
+ }
|
||||
+}
|
||||
--- go.orig/src/mime/multipart/multipart.go
|
||||
+++ go/src/mime/multipart/multipart.go
|
||||
@@ -128,12 +128,12 @@ func (r *stickyErrorReader) Read(p []byt
|
||||
return n, r.err
|
||||
}
|
||||
|
||||
-func newPart(mr *Reader, rawPart bool) (*Part, error) {
|
||||
+func newPart(mr *Reader, rawPart bool, maxMIMEHeaderSize int64) (*Part, error) {
|
||||
bp := &Part{
|
||||
Header: make(map[string][]string),
|
||||
mr: mr,
|
||||
}
|
||||
- if err := bp.populateHeaders(); err != nil {
|
||||
+ if err := bp.populateHeaders(maxMIMEHeaderSize); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bp.r = partReader{bp}
|
||||
@@ -149,12 +149,16 @@ func newPart(mr *Reader, rawPart bool) (
|
||||
return bp, nil
|
||||
}
|
||||
|
||||
-func (bp *Part) populateHeaders() error {
|
||||
+func (bp *Part) populateHeaders(maxMIMEHeaderSize int64) error {
|
||||
r := textproto.NewReader(bp.mr.bufReader)
|
||||
- header, err := r.ReadMIMEHeader()
|
||||
+ header, err := readMIMEHeader(r, maxMIMEHeaderSize)
|
||||
if err == nil {
|
||||
bp.Header = header
|
||||
}
|
||||
+ // TODO: Add a distinguishable error to net/textproto.
|
||||
+ if err != nil && err.Error() == "message too large" {
|
||||
+ err = ErrMessageTooLarge
|
||||
+ }
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -294,6 +298,7 @@ func (p *Part) Close() error {
|
||||
// isn't supported.
|
||||
type Reader struct {
|
||||
bufReader *bufio.Reader
|
||||
+ tempDir string // used in tests
|
||||
|
||||
currentPart *Part
|
||||
partsRead int
|
||||
@@ -304,6 +309,10 @@ type Reader struct {
|
||||
dashBoundary []byte // "--boundary"
|
||||
}
|
||||
|
||||
+// maxMIMEHeaderSize is the maximum size of a MIME header we will parse,
|
||||
+// including header keys, values, and map overhead.
|
||||
+const maxMIMEHeaderSize = 10 << 20
|
||||
+
|
||||
// NextPart returns the next part in the multipart or an error.
|
||||
// When there are no more parts, the error io.EOF is returned.
|
||||
//
|
||||
@@ -311,7 +320,7 @@ type Reader struct {
|
||||
// has a value of "quoted-printable", that header is instead
|
||||
// hidden and the body is transparently decoded during Read calls.
|
||||
func (r *Reader) NextPart() (*Part, error) {
|
||||
- return r.nextPart(false)
|
||||
+ return r.nextPart(false, maxMIMEHeaderSize)
|
||||
}
|
||||
|
||||
// NextRawPart returns the next part in the multipart or an error.
|
||||
@@ -320,10 +329,10 @@ func (r *Reader) NextPart() (*Part, erro
|
||||
// Unlike NextPart, it does not have special handling for
|
||||
// "Content-Transfer-Encoding: quoted-printable".
|
||||
func (r *Reader) NextRawPart() (*Part, error) {
|
||||
- return r.nextPart(true)
|
||||
+ return r.nextPart(true, maxMIMEHeaderSize)
|
||||
}
|
||||
|
||||
-func (r *Reader) nextPart(rawPart bool) (*Part, error) {
|
||||
+func (r *Reader) nextPart(rawPart bool, maxMIMEHeaderSize int64) (*Part, error) {
|
||||
if r.currentPart != nil {
|
||||
r.currentPart.Close()
|
||||
}
|
||||
@@ -348,7 +357,7 @@ func (r *Reader) nextPart(rawPart bool)
|
||||
|
||||
if r.isBoundaryDelimiterLine(line) {
|
||||
r.partsRead++
|
||||
- bp, err := newPart(r, rawPart)
|
||||
+ bp, err := newPart(r, rawPart, maxMIMEHeaderSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
--- /dev/null
|
||||
+++ go/src/mime/multipart/readmimeheader.go
|
||||
@@ -0,0 +1,14 @@
|
||||
+// Copyright 2023 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 multipart
|
||||
+
|
||||
+import (
|
||||
+ "net/textproto"
|
||||
+ _ "unsafe" // for go:linkname
|
||||
+)
|
||||
+
|
||||
+// readMIMEHeader is defined in package net/textproto.
|
||||
+//
|
||||
+//go:linkname readMIMEHeader net/textproto.readMIMEHeader
|
||||
+func readMIMEHeader(r *textproto.Reader, lim int64) (textproto.MIMEHeader, error)
|
||||
--- go.orig/src/net/http/request_test.go
|
||||
+++ go/src/net/http/request_test.go
|
||||
@@ -1110,7 +1110,7 @@ func testMissingFile(t *testing.T, req *
|
||||
t.Errorf("FormFile file = %v, want nil", f)
|
||||
}
|
||||
if fh != nil {
|
||||
- t.Errorf("FormFile file header = %q, want nil", fh)
|
||||
+ t.Errorf("FormFile file header = %v, want nil", fh)
|
||||
}
|
||||
if err != ErrMissingFile {
|
||||
t.Errorf("FormFile err = %q, want ErrMissingFile", err)
|
||||
--- go.orig/src/net/textproto/reader.go
|
||||
+++ go/src/net/textproto/reader.go
|
||||
@@ -7,8 +7,10 @@ package textproto
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
+ "errors"
|
||||
"fmt"
|
||||
"io"
|
||||
+ "math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -481,6 +483,12 @@ func (r *Reader) ReadDotLines() ([]strin
|
||||
// }
|
||||
//
|
||||
func (r *Reader) ReadMIMEHeader() (MIMEHeader, error) {
|
||||
+ return readMIMEHeader(r, math.MaxInt64)
|
||||
+}
|
||||
+
|
||||
+// readMIMEHeader is a version of ReadMIMEHeader which takes a limit on the header size.
|
||||
+// It is called by the mime/multipart package.
|
||||
+func readMIMEHeader(r *Reader, lim int64) (MIMEHeader, error) {
|
||||
// Avoid lots of small slice allocations later by allocating one
|
||||
// large one ahead of time which we'll cut up into smaller
|
||||
// slices. If this isn't big enough later, we allocate small ones.
|
||||
@@ -521,6 +529,16 @@ func (r *Reader) ReadMIMEHeader() (MIMEH
|
||||
continue
|
||||
}
|
||||
|
||||
+ // backport 5c55ac9bf1e5f779220294c843526536605f42ab
|
||||
+ //
|
||||
+ // value is computed as
|
||||
+ //
|
||||
+ // value := string(bytes.TrimLeft(v, " \t"))
|
||||
+ //
|
||||
+ // in the original patch from 1.19. This relies on
|
||||
+ // 'v' which does not exist in 1.17. We leave the
|
||||
+ // 1.17 method unchanged.
|
||||
+
|
||||
// Skip initial spaces in value.
|
||||
i++ // skip colon
|
||||
for i < len(kv) && (kv[i] == ' ' || kv[i] == '\t') {
|
||||
@@ -529,6 +547,16 @@ func (r *Reader) ReadMIMEHeader() (MIMEH
|
||||
value := string(kv[i:])
|
||||
|
||||
vv := m[key]
|
||||
+ if vv == nil {
|
||||
+ lim -= int64(len(key))
|
||||
+ lim -= 100 // map entry overhead
|
||||
+ }
|
||||
+ lim -= int64(len(value))
|
||||
+ if lim < 0 {
|
||||
+ // TODO: This should be a distinguishable error (ErrMessageTooLarge)
|
||||
+ // to allow mime/multipart to detect it.
|
||||
+ return m, errors.New("message too large")
|
||||
+ }
|
||||
if vv == nil && len(strs) > 0 {
|
||||
// More than likely this will be a single-element key.
|
||||
// Most headers aren't multi-valued.
|
||||
@@ -0,0 +1,31 @@
|
||||
From a94bf34221fc4519bd8ec72560c2d363ffe2de4c Mon Sep 17 00:00:00 2001
|
||||
From: Sergei Trofimovich <slyich@gmail.com>
|
||||
Date: Mon, 23 May 2022 08:03:23 +0100
|
||||
Subject: [PATCH] [Support] Add missing <cstdint> header to Signals.h
|
||||
|
||||
Without the change llvm build fails on this week's gcc-13 snapshot as:
|
||||
|
||||
[ 0%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o
|
||||
In file included from llvm/lib/Support/Signals.cpp:14:
|
||||
llvm/include/llvm/Support/Signals.h:119:8: error: variable or field 'CleanupOnSignal' declared void
|
||||
119 | void CleanupOnSignal(uintptr_t Context);
|
||||
| ^~~~~~~~~~~~~~~
|
||||
|
||||
Upstream-Status: Backport [llvmorg-15.0.0 ff1681ddb303223973653f7f5f3f3435b48a1983]
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
---
|
||||
llvm/include/llvm/Support/Signals.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/llvm/include/llvm/Support/Signals.h b/llvm/include/llvm/Support/Signals.h
|
||||
index 44f5a750ff5c..937e0572d4a7 100644
|
||||
--- a/llvm/include/llvm/Support/Signals.h
|
||||
+++ b/llvm/include/llvm/Support/Signals.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#ifndef LLVM_SUPPORT_SIGNALS_H
|
||||
#define LLVM_SUPPORT_SIGNALS_H
|
||||
|
||||
+#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
@@ -32,6 +32,7 @@ SRC_URI = "git://github.com/llvm/llvm-project.git;branch=${BRANCH};protocol=http
|
||||
file://0006-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch;striplevel=2 \
|
||||
file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
|
||||
file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \
|
||||
file://0001-Support-Add-missing-cstdint-header-to-Signals.h.patch;striplevel=2 \
|
||||
"
|
||||
|
||||
UPSTREAM_CHECK_GITTAGREGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)"
|
||||
|
||||
104
meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch
Normal file
104
meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch
Normal file
@@ -0,0 +1,104 @@
|
||||
From b37677f7e40276bd8f504584bcba2c092f1146a8 Mon Sep 17 00:00:00 2001
|
||||
From: "H. Peter Anvin" <hpa@zytor.com>
|
||||
Date: Mon, 7 Nov 2022 10:26:03 -0800
|
||||
Subject: [PATCH] quote_for_pmake: fix counter underrun resulting in segfault
|
||||
|
||||
while (nbs--) { ... } ends with nbs == -1. Rather than a minimal fix,
|
||||
introduce mempset() to make these kinds of errors less likely in the
|
||||
future.
|
||||
|
||||
Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392815
|
||||
Reported-by: <13579and24680@gmail.com>
|
||||
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
||||
|
||||
Upstream-Status: Backport
|
||||
CVE: CVE-2022-4437
|
||||
|
||||
Reference to upstream patch:
|
||||
[https://github.com/netwide-assembler/nasm/commit/2d4e6952417ec6f08b6f135d2b5d0e19b7dae30d]
|
||||
|
||||
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
|
||||
---
|
||||
asm/nasm.c | 12 +++++-------
|
||||
configure.ac | 1 +
|
||||
include/compiler.h | 7 +++++++
|
||||
3 files changed, 13 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/asm/nasm.c b/asm/nasm.c
|
||||
index 7a7f8b4..675cff4 100644
|
||||
--- a/asm/nasm.c
|
||||
+++ b/asm/nasm.c
|
||||
@@ -1,6 +1,6 @@
|
||||
/* ----------------------------------------------------------------------- *
|
||||
*
|
||||
- * Copyright 1996-2020 The NASM Authors - All Rights Reserved
|
||||
+ * Copyright 1996-2022 The NASM Authors - All Rights Reserved
|
||||
* See the file AUTHORS included with the NASM distribution for
|
||||
* the specific copyright holders.
|
||||
*
|
||||
@@ -814,8 +814,7 @@ static char *quote_for_pmake(const char *str)
|
||||
}
|
||||
|
||||
/* Convert N backslashes at the end of filename to 2N backslashes */
|
||||
- if (nbs)
|
||||
- n += nbs;
|
||||
+ n += nbs;
|
||||
|
||||
os = q = nasm_malloc(n);
|
||||
|
||||
@@ -824,10 +823,10 @@ static char *quote_for_pmake(const char *str)
|
||||
switch (*p) {
|
||||
case ' ':
|
||||
case '\t':
|
||||
- while (nbs--)
|
||||
- *q++ = '\\';
|
||||
+ q = mempset(q, '\\', nbs);
|
||||
*q++ = '\\';
|
||||
*q++ = *p;
|
||||
+ nbs = 0;
|
||||
break;
|
||||
case '$':
|
||||
*q++ = *p;
|
||||
@@ -849,9 +848,8 @@ static char *quote_for_pmake(const char *str)
|
||||
break;
|
||||
}
|
||||
}
|
||||
- while (nbs--)
|
||||
- *q++ = '\\';
|
||||
|
||||
+ q = mempset(q, '\\', nbs);
|
||||
*q = '\0';
|
||||
|
||||
return os;
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 39680b1..940ebe2 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -199,6 +199,7 @@ AC_CHECK_FUNCS(strrchrnul)
|
||||
AC_CHECK_FUNCS(iscntrl)
|
||||
AC_CHECK_FUNCS(isascii)
|
||||
AC_CHECK_FUNCS(mempcpy)
|
||||
+AC_CHECK_FUNCS(mempset)
|
||||
|
||||
AC_CHECK_FUNCS(getuid)
|
||||
AC_CHECK_FUNCS(getgid)
|
||||
diff --git a/include/compiler.h b/include/compiler.h
|
||||
index db3d6d6..b64da6a 100644
|
||||
--- a/include/compiler.h
|
||||
+++ b/include/compiler.h
|
||||
@@ -256,6 +256,13 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifndef HAVE_MEMPSET
|
||||
+static inline void *mempset(void *dst, int c, size_t n)
|
||||
+{
|
||||
+ return (char *)memset(dst, c, n) + n;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Hack to support external-linkage inline functions
|
||||
*/
|
||||
--
|
||||
2.40.0
|
||||
50
meta/recipes-devtools/nasm/nasm/CVE-2022-46457.patch
Normal file
50
meta/recipes-devtools/nasm/nasm/CVE-2022-46457.patch
Normal file
@@ -0,0 +1,50 @@
|
||||
From c8af73112027fad0ecbb277e9cba257678c405af Mon Sep 17 00:00:00 2001
|
||||
From: "H. Peter Anvin" <hpa@zytor.com>
|
||||
Date: Wed, 7 Dec 2022 10:23:46 -0800
|
||||
Subject: [PATCH] outieee: fix segfault on empty input
|
||||
|
||||
Fix the IEEE backend crashing if the input file is empty.
|
||||
|
||||
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
|
||||
|
||||
Upstream-Status: Backport [https://github.com/netwide-assembler/nasm/commit/c8af73112027fad0ecbb277e9cba257678c405af]
|
||||
CVE: CVE-2022-46457
|
||||
|
||||
Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
|
||||
---
|
||||
output/outieee.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/output/outieee.c b/output/outieee.c
|
||||
index cdb8333..8bc5eaa 100644
|
||||
--- a/output/outieee.c
|
||||
+++ b/output/outieee.c
|
||||
@@ -919,7 +919,7 @@ static void ieee_write_file(void)
|
||||
* Write the section headers
|
||||
*/
|
||||
seg = seghead;
|
||||
- if (!debuginfo && !strcmp(seg->name, "??LINE"))
|
||||
+ if (!debuginfo && seg && !strcmp(seg->name, "??LINE"))
|
||||
seg = seg->next;
|
||||
while (seg) {
|
||||
char buf[256];
|
||||
@@ -954,7 +954,7 @@ static void ieee_write_file(void)
|
||||
/*
|
||||
* write the start address if there is one
|
||||
*/
|
||||
- if (ieee_entry_seg) {
|
||||
+ if (ieee_entry_seg && seghead) {
|
||||
for (seg = seghead; seg; seg = seg->next)
|
||||
if (seg->index == ieee_entry_seg)
|
||||
break;
|
||||
@@ -1067,7 +1067,7 @@ static void ieee_write_file(void)
|
||||
* put out section data;
|
||||
*/
|
||||
seg = seghead;
|
||||
- if (!debuginfo && !strcmp(seg->name, "??LINE"))
|
||||
+ if (!debuginfo && seg && !strcmp(seg->name, "??LINE"))
|
||||
seg = seg->next;
|
||||
while (seg) {
|
||||
if (seg->currentpos) {
|
||||
--
|
||||
2.40.0
|
||||
@@ -8,6 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=90904486f8fbf1861cf42752e1a39efe"
|
||||
SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \
|
||||
file://0001-stdlib-Add-strlcat.patch \
|
||||
file://0002-Add-debug-prefix-map-option.patch \
|
||||
file://CVE-2022-44370.patch \
|
||||
file://CVE-2022-46457.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "3c4b8339e5ab54b1bcb2316101f8985a5da50a3f9e504d43fa6f35668bee2fd0"
|
||||
|
||||
29
meta/recipes-devtools/perl/files/CVE-2023-31484.patch
Normal file
29
meta/recipes-devtools/perl/files/CVE-2023-31484.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
From a625ec2cc3a0b6116c1f8b831d3480deb621c245 Mon Sep 17 00:00:00 2001
|
||||
From: Stig Palmquist <git@stig.io>
|
||||
Date: Tue, 28 Feb 2023 11:54:06 +0100
|
||||
Subject: [PATCH] Add verify_SSL=>1 to HTTP::Tiny to verify https server
|
||||
identity
|
||||
|
||||
Upstream-Status: Backport [https://github.com/andk/cpanpm/commit/9c98370287f4e709924aee7c58ef21c85289a7f0]
|
||||
|
||||
CVE: CVE-2023-31484
|
||||
|
||||
Signed-off-by: Soumya <soumya.sambu@windriver.com>
|
||||
---
|
||||
cpan/CPAN/lib/CPAN/HTTP/Client.pm | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/cpan/CPAN/lib/CPAN/HTTP/Client.pm b/cpan/CPAN/lib/CPAN/HTTP/Client.pm
|
||||
index 4fc792c..a616fee 100644
|
||||
--- a/cpan/CPAN/lib/CPAN/HTTP/Client.pm
|
||||
+++ b/cpan/CPAN/lib/CPAN/HTTP/Client.pm
|
||||
@@ -32,6 +32,7 @@ sub mirror {
|
||||
|
||||
my $want_proxy = $self->_want_proxy($uri);
|
||||
my $http = HTTP::Tiny->new(
|
||||
+ verify_SSL => 1,
|
||||
$want_proxy ? (proxy => $self->{proxy}) : ()
|
||||
);
|
||||
|
||||
--
|
||||
2.40.0
|
||||
@@ -18,6 +18,7 @@ SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
|
||||
file://determinism.patch \
|
||||
file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \
|
||||
file://0001-Fix-build-with-gcc-12.patch \
|
||||
file://CVE-2023-31484.patch \
|
||||
"
|
||||
SRC_URI:append:class-native = " \
|
||||
file://perl-configpm-switch.patch \
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
From 9fbf84efc861668755ab645530ec7be9cf3c6696 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Gaynor <alex.gaynor@gmail.com>
|
||||
Date: Tue, 7 Feb 2023 11:34:18 -0500
|
||||
Subject: [PATCH] Don't allow update_into to mutate immutable objects (#8230)
|
||||
|
||||
CVE: CVE-2023-23931
|
||||
|
||||
Upstream-Status: Backport [https://github.com/pyca/cryptography/commit/9fbf84efc861668755ab645530ec7be9cf3c6696]
|
||||
|
||||
Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
|
||||
---
|
||||
src/cryptography/hazmat/backends/openssl/ciphers.py | 2 +-
|
||||
tests/hazmat/primitives/test_ciphers.py | 8 ++++++++
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cryptography/hazmat/backends/openssl/ciphers.py b/src/cryptography/hazmat/backends/openssl/ciphers.py
|
||||
index 286583f93..075d68fb9 100644
|
||||
--- a/src/cryptography/hazmat/backends/openssl/ciphers.py
|
||||
+++ b/src/cryptography/hazmat/backends/openssl/ciphers.py
|
||||
@@ -156,7 +156,7 @@ class _CipherContext:
|
||||
data_processed = 0
|
||||
total_out = 0
|
||||
outlen = self._backend._ffi.new("int *")
|
||||
- baseoutbuf = self._backend._ffi.from_buffer(buf)
|
||||
+ baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True)
|
||||
baseinbuf = self._backend._ffi.from_buffer(data)
|
||||
|
||||
while data_processed != total_data_len:
|
||||
diff --git a/tests/hazmat/primitives/test_ciphers.py b/tests/hazmat/primitives/test_ciphers.py
|
||||
index 02127dd9c..bf3b047de 100644
|
||||
--- a/tests/hazmat/primitives/test_ciphers.py
|
||||
+++ b/tests/hazmat/primitives/test_ciphers.py
|
||||
@@ -318,6 +318,14 @@ class TestCipherUpdateInto:
|
||||
with pytest.raises(ValueError):
|
||||
encryptor.update_into(b"testing", buf)
|
||||
|
||||
+ def test_update_into_immutable(self, backend):
|
||||
+ key = b"\x00" * 16
|
||||
+ c = ciphers.Cipher(AES(key), modes.ECB(), backend)
|
||||
+ encryptor = c.encryptor()
|
||||
+ buf = b"\x00" * 32
|
||||
+ with pytest.raises((TypeError, BufferError)):
|
||||
+ encryptor.update_into(b"testing", buf)
|
||||
+
|
||||
@pytest.mark.supported(
|
||||
only_if=lambda backend: backend.cipher_supported(
|
||||
AES(b"\x00" * 16), modes.GCM(b"\x00" * 12)
|
||||
--
|
||||
2.40.0
|
||||
@@ -17,6 +17,7 @@ SRC_URI += " \
|
||||
file://0001-Cargo.toml-specify-pem-version.patch \
|
||||
file://0002-Cargo.toml-edition-2018-2021.patch \
|
||||
file://fix-leak-metric.patch \
|
||||
file://CVE-2023-23931.patch \
|
||||
"
|
||||
|
||||
inherit pypi python_setuptools3_rust
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
From cd0128c0becd8729d0f8733bf42fbd333d51f833 Mon Sep 17 00:00:00 2001
|
||||
From: Nate Prewitt <nate.prewitt@gmail.com>
|
||||
Date: Mon, 5 Jun 2023 09:31:36 +0000
|
||||
Subject: [PATCH] Merge pull request from GHSA-j8r2-6x86-q33q
|
||||
|
||||
CVE: CVE-2023-32681
|
||||
|
||||
Upstream-Status: Backport [https://github.com/psf/requests/commit/74ea7cf7a6a27a4eeb2ae24e162bcc942a6706d5]
|
||||
|
||||
Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
|
||||
---
|
||||
requests/sessions.py | 4 +++-
|
||||
tests/test_requests.py | 20 ++++++++++++++++++++
|
||||
2 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/requests/sessions.py b/requests/sessions.py
|
||||
index 3f59cab..648cffa 100644
|
||||
--- a/requests/sessions.py
|
||||
+++ b/requests/sessions.py
|
||||
@@ -293,7 +293,9 @@ class SessionRedirectMixin(object):
|
||||
except KeyError:
|
||||
username, password = None, None
|
||||
|
||||
- if username and password:
|
||||
+ # urllib3 handles proxy authorization for us in the standard adapter.
|
||||
+ # Avoid appending this to TLS tunneled requests where it may be leaked.
|
||||
+ if not scheme.startswith('https') and username and password:
|
||||
headers['Proxy-Authorization'] = _basic_auth_str(username, password)
|
||||
|
||||
return new_proxies
|
||||
diff --git a/tests/test_requests.py b/tests/test_requests.py
|
||||
index 29b3aca..6a37777 100644
|
||||
--- a/tests/test_requests.py
|
||||
+++ b/tests/test_requests.py
|
||||
@@ -601,6 +601,26 @@ class TestRequests:
|
||||
|
||||
assert sent_headers.get("Proxy-Authorization") == proxy_auth_value
|
||||
|
||||
+
|
||||
+ @pytest.mark.parametrize(
|
||||
+ "url,has_proxy_auth",
|
||||
+ (
|
||||
+ ('http://example.com', True),
|
||||
+ ('https://example.com', False),
|
||||
+ ),
|
||||
+ )
|
||||
+ def test_proxy_authorization_not_appended_to_https_request(self, url, has_proxy_auth):
|
||||
+ session = requests.Session()
|
||||
+ proxies = {
|
||||
+ 'http': 'http://test:pass@localhost:8080',
|
||||
+ 'https': 'http://test:pass@localhost:8090',
|
||||
+ }
|
||||
+ req = requests.Request('GET', url)
|
||||
+ prep = req.prepare()
|
||||
+ session.rebuild_proxies(prep, proxies)
|
||||
+
|
||||
+ assert ('Proxy-Authorization' in prep.headers) is has_proxy_auth
|
||||
+
|
||||
def test_basicauth_with_netrc(self, httpbin):
|
||||
auth = ('user', 'pass')
|
||||
wrong_auth = ('wronguser', 'wrongpass')
|
||||
--
|
||||
2.40.0
|
||||
@@ -3,6 +3,8 @@ HOMEPAGE = "http://python-requests.org"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=34400b68072d710fecd0a2940a0d1658"
|
||||
|
||||
SRC_URI += "file://CVE-2023-32681.patch"
|
||||
|
||||
SRC_URI[sha256sum] = "68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61"
|
||||
|
||||
inherit pypi setuptools3
|
||||
|
||||
@@ -112,6 +112,11 @@ CVE_CHECK_IGNORE += "CVE-2007-0998"
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
|
||||
CVE_CHECK_IGNORE += "CVE-2018-18438"
|
||||
|
||||
# As per https://nvd.nist.gov/vuln/detail/CVE-2023-0664
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=2167423
|
||||
# this bug related to windows specific.
|
||||
CVE_CHECK_IGNORE += "CVE-2023-0664"
|
||||
|
||||
COMPATIBLE_HOST:mipsarchn32 = "null"
|
||||
COMPATIBLE_HOST:mipsarchn64 = "null"
|
||||
COMPATIBLE_HOST:riscv32 = "null"
|
||||
|
||||
@@ -14,6 +14,7 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quilt/quilt-${PV}.tar.gz \
|
||||
file://0001-tests-Allow-different-output-from-mv.patch \
|
||||
file://fix-grep-3.8.patch \
|
||||
file://faildiff-order.patch \
|
||||
file://0001-test-Fix-a-race-condition-in-merge.test.patch \
|
||||
"
|
||||
|
||||
SRC_URI:append:class-target = " file://gnu_patch_test_fix_target.patch"
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
From c1ce964f3e9312100a60f03c1e1fdd601e1911f2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
|
||||
<congdanhqx@gmail.com>
|
||||
Date: Tue, 28 Feb 2023 18:45:15 +0100
|
||||
Subject: [PATCH] test: Fix a race condition in merge.test
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Just like commit 4dfe7f9, (test: Fix a race condition, 2023-01-20),
|
||||
this fix a test race when stdout and stderr in any order.
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/quilt.git/commit/?id=c1ce964f3e9312100a60f03c1e1fdd601e1911f2]
|
||||
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
Signed-off-by: Jean Delvare <jdelvare@suse.de>
|
||||
---
|
||||
test/merge.test | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/merge.test b/test/merge.test
|
||||
index c64b33d..2e67d4f 100644
|
||||
--- a/test/merge.test
|
||||
+++ b/test/merge.test
|
||||
@@ -39,8 +39,9 @@ Test the patch merging functionality of `quilt diff'.
|
||||
> Applying patch %{P}c.diff
|
||||
> Now at patch %{P}c.diff
|
||||
|
||||
- $ quilt diff -P b.diff | grep -v "^\\(---\\|+++\\)"
|
||||
+ $ quilt diff -P b.diff >/dev/null
|
||||
> Warning: more recent patches modify files in patch %{P}b.diff
|
||||
+ $ quilt diff -P b.diff 2>/dev/null | grep -v "^\\(---\\|+++\\)"
|
||||
>~ Index: [^/]+/abc\.txt
|
||||
> ===================================================================
|
||||
> @@ -1,3 +1,3 @@
|
||||
@@ -49,8 +50,9 @@ Test the patch merging functionality of `quilt diff'.
|
||||
> +b+
|
||||
> c
|
||||
|
||||
- $ quilt diff --combine a.diff -P b.diff | grep -v "^\\(---\\|+++\\)"
|
||||
+ $ quilt diff --combine a.diff -P b.diff >/dev/null
|
||||
> Warning: more recent patches modify files in patch %{P}b.diff
|
||||
+ $ quilt diff --combine a.diff -P b.diff 2>/dev/null | grep -v "^\\(---\\|+++\\)"
|
||||
>~ Index: [^/]+/abc\.txt
|
||||
> ===================================================================
|
||||
> @@ -1,3 +1,3 @@
|
||||
--
|
||||
2.40.0
|
||||
|
||||
68
meta/recipes-devtools/ruby/ruby/CVE-2023-28755.patch
Normal file
68
meta/recipes-devtools/ruby/ruby/CVE-2023-28755.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From db4bb57d4af6d097a0c29490536793d95f1d8983 Mon Sep 17 00:00:00 2001
|
||||
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
|
||||
Date: Mon, 24 Apr 2023 08:27:24 +0000
|
||||
Subject: [PATCH] Merge URI-0.12.1
|
||||
|
||||
CVE: CVE-2023-28755
|
||||
|
||||
Upstream-Status: Backport [https://github.com/ruby/ruby/commit/8ce4ab146498879b65e22f1be951b25eebb79300]
|
||||
|
||||
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
|
||||
---
|
||||
lib/uri/rfc3986_parser.rb | 4 ++--
|
||||
lib/uri/version.rb | 2 +-
|
||||
test/uri/test_common.rb | 11 +++++++++++
|
||||
3 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb
|
||||
index 3e07de4..3c89311 100644
|
||||
--- a/lib/uri/rfc3986_parser.rb
|
||||
+++ b/lib/uri/rfc3986_parser.rb
|
||||
@@ -3,8 +3,8 @@ module URI
|
||||
class RFC3986_Parser # :nodoc:
|
||||
# URI defined in RFC3986
|
||||
# this regexp is modified not to host is not empty string
|
||||
- RFC3986_URI = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
- RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*)@)?(?<host>(?<IP-literal>\[(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h+\.[!$&-.0-;=A-Z_a-z~]+)\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])+))?(?::(?<port>\d*))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*))*)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])+)(?:\/\g<segment>)*)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])+)(?:\/\g<segment>)*)|(?<path-empty>))(?:\?(?<query>[^#]*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
|
||||
+ RFC3986_URI = /\A(?<URI>(?<scheme>[A-Za-z][+\-.0-9A-Za-z]*+):(?<hier-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*+)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:)?\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h++\.[!$&-.0-;=A-Z_a-z~]++))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])*+))(?::(?<port>\d*+))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*+))*+)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])++)(?:\/\g<segment>)*+)?)|(?<path-rootless>\g<segment-nz>(?:\/\g<segment>)*+)|(?<path-empty>))(?:\?(?<query>[^#]*+))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*+))?)\z/
|
||||
+ RFC3986_relative_ref = /\A(?<relative-ref>(?<relative-part>\/\/(?<authority>(?:(?<userinfo>(?:%\h\h|[!$&-.0-;=A-Z_a-z~])*+)@)?(?<host>(?<IP-literal>\[(?:(?<IPv6address>(?:\h{1,4}:){6}(?<ls32>\h{1,4}:\h{1,4}|(?<IPv4address>(?<dec-octet>[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]|\d)\.\g<dec-octet>\.\g<dec-octet>\.\g<dec-octet>))|::(?:\h{1,4}:){5}\g<ls32>|\h{1,4}?::(?:\h{1,4}:){4}\g<ls32>|(?:(?:\h{1,4}:){,1}\h{1,4})?::(?:\h{1,4}:){3}\g<ls32>|(?:(?:\h{1,4}:){,2}\h{1,4})?::(?:\h{1,4}:){2}\g<ls32>|(?:(?:\h{1,4}:){,3}\h{1,4})?::\h{1,4}:\g<ls32>|(?:(?:\h{1,4}:){,4}\h{1,4})?::\g<ls32>|(?:(?:\h{1,4}:){,5}\h{1,4})?::\h{1,4}|(?:(?:\h{1,4}:){,6}\h{1,4})?::)|(?<IPvFuture>v\h++\.[!$&-.0-;=A-Z_a-z~]++))\])|\g<IPv4address>|(?<reg-name>(?:%\h\h|[!$&-.0-9;=A-Z_a-z~])++))?(?::(?<port>\d*+))?)(?<path-abempty>(?:\/(?<segment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])*+))*+)|(?<path-absolute>\/(?:(?<segment-nz>(?:%\h\h|[!$&-.0-;=@-Z_a-z~])++)(?:\/\g<segment>)*+)?)|(?<path-noscheme>(?<segment-nz-nc>(?:%\h\h|[!$&-.0-9;=@-Z_a-z~])++)(?:\/\g<segment>)*+)|(?<path-empty>))(?:\?(?<query>[^#]*+))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*+))?)\z/
|
||||
attr_reader :regexp
|
||||
|
||||
def initialize
|
||||
diff --git a/lib/uri/version.rb b/lib/uri/version.rb
|
||||
index 82188e2..7497a7d 100644
|
||||
--- a/lib/uri/version.rb
|
||||
+++ b/lib/uri/version.rb
|
||||
@@ -1,6 +1,6 @@
|
||||
module URI
|
||||
# :stopdoc:
|
||||
- VERSION_CODE = '001100'.freeze
|
||||
+ VERSION_CODE = '001201'.freeze
|
||||
VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
|
||||
# :startdoc:
|
||||
end
|
||||
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb
|
||||
index 5e30cda..1d34783 100644
|
||||
--- a/test/uri/test_common.rb
|
||||
+++ b/test/uri/test_common.rb
|
||||
@@ -78,6 +78,17 @@ class TestCommon < Test::Unit::TestCase
|
||||
assert_raise(NoMethodError) { Object.new.URI("http://www.ruby-lang.org/") }
|
||||
end
|
||||
|
||||
+ def test_parse_timeout
|
||||
+ pre = ->(n) {
|
||||
+ 'https://example.com/dir/' + 'a' * (n * 100) + '/##.jpg'
|
||||
+ }
|
||||
+ assert_linear_performance((1..10).map {|i| i * 100}, rehearsal: 1000, pre: pre) do |uri|
|
||||
+ assert_raise(URI::InvalidURIError) do
|
||||
+ URI.parse(uri)
|
||||
+ end
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
def test_encode_www_form_component
|
||||
assert_equal("%00+%21%22%23%24%25%26%27%28%29*%2B%2C-.%2F09%3A%3B%3C%3D%3E%3F%40" \
|
||||
"AZ%5B%5C%5D%5E_%60az%7B%7C%7D%7E",
|
||||
--
|
||||
2.35.5
|
||||
|
||||
73
meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch
Normal file
73
meta/recipes-devtools/ruby/ruby/CVE-2023-28756.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 957bb7cb81995f26c671afce0ee50a5c660e540e Mon Sep 17 00:00:00 2001
|
||||
From: Hiroshi SHIBATA <hsbt@ruby-lang.org>
|
||||
Date: Wed, 29 Mar 2023 13:28:25 +0900
|
||||
Subject: [PATCH] CVE-2023-28756
|
||||
|
||||
CVE: CVE-2023-28756
|
||||
Upstream-Status: Backport [https://github.com/ruby/ruby/commit/957bb7cb81995f26c671afce0ee50a5c660e540e]
|
||||
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
|
||||
---
|
||||
lib/time.gemspec | 2 +-
|
||||
lib/time.rb | 6 +++---
|
||||
test/test_time.rb | 9 +++++++++
|
||||
3 files changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/lib/time.gemspec b/lib/time.gemspec
|
||||
index 72fba34..bada91a 100644
|
||||
--- a/lib/time.gemspec
|
||||
+++ b/lib/time.gemspec
|
||||
@@ -1,6 +1,6 @@
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "time"
|
||||
- spec.version = "0.2.0"
|
||||
+ spec.version = "0.2.2"
|
||||
spec.authors = ["Tanaka Akira"]
|
||||
spec.email = ["akr@fsij.org"]
|
||||
|
||||
diff --git a/lib/time.rb b/lib/time.rb
|
||||
index bd20a1a..6a13212 100644
|
||||
--- a/lib/time.rb
|
||||
+++ b/lib/time.rb
|
||||
@@ -509,8 +509,8 @@ class Time
|
||||
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+
|
||||
(\d{2,})\s+
|
||||
(\d{2})\s*
|
||||
- :\s*(\d{2})\s*
|
||||
- (?::\s*(\d{2}))?\s+
|
||||
+ :\s*(\d{2})
|
||||
+ (?:\s*:\s*(\d\d))?\s+
|
||||
([+-]\d{4}|
|
||||
UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Z])/ix =~ date
|
||||
# Since RFC 2822 permit comments, the regexp has no right anchor.
|
||||
@@ -701,7 +701,7 @@ class Time
|
||||
#
|
||||
# If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
|
||||
#
|
||||
- # +fractional_digits+ specifies a number of digits to use for fractional
|
||||
+ # +fraction_digits+ specifies a number of digits to use for fractional
|
||||
# seconds. Its default value is 0.
|
||||
#
|
||||
# require 'time'
|
||||
diff --git a/test/test_time.rb b/test/test_time.rb
|
||||
index b50d841..23e8e10 100644
|
||||
--- a/test/test_time.rb
|
||||
+++ b/test/test_time.rb
|
||||
@@ -62,6 +62,15 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
|
||||
assert_equal(true, t.utc?)
|
||||
end
|
||||
|
||||
+ def test_rfc2822_nonlinear
|
||||
+ pre = ->(n) {"0 Feb 00 00 :00" + " " * n}
|
||||
+ assert_linear_performance([100, 500, 5000, 50_000], pre: pre) do |s|
|
||||
+ assert_raise(ArgumentError) do
|
||||
+ Time.rfc2822(s)
|
||||
+ end
|
||||
+ end
|
||||
+ end
|
||||
+
|
||||
if defined?(Ractor)
|
||||
def test_rfc2822_ractor
|
||||
assert_ractor(<<~RUBY, require: 'time')
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user