Compare commits

...

61 Commits

Author SHA1 Message Date
Steve Sakoman
926eb08fe3 build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 8b91c463fb3546836789e1890b3c68acf69c162a)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-16 11:20:06 -10:00
Steve Sakoman
6d6d43248e poky.conf: bump version for 3.1.28
(From meta-yocto rev: fb227b9ff08a2cf5304348a57f574a6751741bce)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-16 11:16:08 -10:00
Ross Burton
b222a20f8f gawk: remove load-sensitive tests
The time and timeout tests are sensitive to system load, and as we run
these on build machines they fail randomly.

[ YOCTO #14371 ]

(From OE-Core rev: d2b62913a5771169265171129fe972c8e252fe04)

(From OE-Core rev: 309f1c6166f8535fa61fd1d01924df3c7fe9fbba)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a84b8d683b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-16 11:16:07 -10:00
Steve Sakoman
55b09cdc1c build-appliance-image: Update to dunfell head revision
(From OE-Core rev: a6dde75a3cbd99cb346a8ab8183e96752d005a6b)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:50:18 -10:00
Steve Sakoman
87f18a42d4 documentation: update for 3.1.28
(From yocto-docs rev: 628be0aa38ea9fe03cd4843278c201a0c4f6aa44)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Michael Opdenacker
3978003135 ref-manual: ref-system-requirements: update supported distros
- Update according to changes in SANITY_TESTED_DISTROS
  (meta-poky/conf/distro/poky.conf)

- No longer declare as "Supported" the distributions versions
  which are End of Life for their vendors, as some of them
  (Ubuntu for example) ship updates to subscribers only,
  which the Yocto Project has no access to.

- List distribution versions which were previously tested
  for the branch of the Yocto Project being considered.

(From yocto-docs rev: ed345f43ed1e5fcceeff5ab77aaa43763f08f598)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Richard Purdie
7fc94c93bf oeqa/runtime/ltp: Increase ltp test output timeout
On our slower arm server, the tests currently timeout leading to inconsistent test
results. Increase the timeout to avoid this and aim to make the test results
consistent.

(From OE-Core rev: 76b065b3e802fc7dfa9a370e273b8a4187072623)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 9a8b49208f3c99e184eab426360b137bc773aa31)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Richard Purdie
02356ecdca oeqa/target/ssh: Ensure EAGAIN doesn't truncate output
We have a suspicion that the read() call may return EAGAIN on the non-blocking
fd and this may truncate test output leading to some of our intermittent failures.
Tweak the code to avoid this potential issue.

(From OE-Core rev: 605d832e86f249100adaf3761b4e1701401d0b76)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a8920c105725431e989cceb616bd04eaa52127ec)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Anuj Mittal
0cbec779f5 selftest/cases/glibc.py: switch to using NFS over TCP
This provides a more reliable test execution when running tests that
write a large buffer/file and significantly reduces the localedata test
failures.

(From OE-Core rev: 1f35336edf13496432fb68e7e048a5c137fc3e47)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 97a7612e3959bc9c75116a4e696f47cc31aea75d)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Anuj Mittal
a1886b3532 oeqa/utils/nfs: allow requesting non-udp ports
Allows setting up NFS over TCP as well.

(From OE-Core rev: 148e009374dcbd2101223cf33f2ff69c75895b71)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e1ff9b9a3b7f7924aea67d2024581bea2e916036)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Anuj Mittal
9e2099f2a8 selftest/cases/glibc.py: increase the memory for testing
Some of the tests trigger OOM and fail. Increase the amount of memory
available so we dont run into these issues.

(From OE-Core rev: 50b07b4c0c814f2832816cf83863687155429b21)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4d22dba482cb19ffcff5abee73f24526ea9d1c2a)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Anuj Mittal
c3d7af5d16 glibc/check-test-wrapper: don't emit warnings from ssh
Dont fill up the test log with ssh warning about having added the host
to list of known hosts.

Also helps fix a test case failure where stderr log was being compared
to a known value.

(From OE-Core rev: 781c52bb8f9ffe6aeb456fb0c0d628917641fb22)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 63b31ff7e54a171c4c02fca2e6b07aec64a410af)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Staffan Rydén
a0615a08c5 kernel: Fix path comparison in kernel staging dir symlinking
Due to an oversight in the do_symlink_kernsrc function, the path
comparison between "S" and "STAGING_KERNEL_DIR" is broken. The code
obtains both variables, but modifies the local copy of "S" before
comparing them, causing the comparison to always return false.

This can cause the build to fail when the EXTERNALSRC flag is enabled,
since the code will try to create a symlink even if one already exists.

This patch resolves the issue by comparing the variables before they are
modified.

(From OE-Core rev: 27a982807caa7ffbdf2d4ef02bc0b037150b1b3b)

Signed-off-by: Staffan Rydén <staffan.ryden@axis.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit afd2038ef8a66a5e6433be31a14e1eb0d9f9a1d3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Michael Halstead
b347ccc7ce resulttool/resultutils: allow index generation despite corrupt json
non-release indexes will continue to generate when test output is
corrupted.

(From OE-Core rev: 31b996c01c72749fc62821a3c9d1da70540bfad6)

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1a9157684a6bff8406c9bb470cb2e16ee006bbe9)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Michael Halstead
c58cd65c96 yocto-uninative: Update to 4.3
Add in stable updates to glibc 2.38 to fix malloc bugs

(From OE-Core rev: 2850119bce7aa9788ab8b163311d42ea273ca1df)

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 39f987fcb20ad7c0e45425b9f508d463c50ce0c1)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Priyal Doshi
ea56bba866 rootfs-post: remove traling blanks from tasks
remove the traling blanks before the ;-delimiter, so one could use
"_remove" to avoid running tasks like 'rootfs_update_timestamp',
which are currently hardcoded and not bound to any
configurable feature flag

(From OE-Core rev: 18246f0bfedb5c729a0fc5b515f25a1ed0cde191)

Signed-off-by: Priyal Doshi <pdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Vijay Anusuri
1b52dc0663 qemu: Backport fix for CVE-2023-0330
A DMA-MMIO reentrancy problem may lead to memory corruption bugs
like stack overflow or use-after-free.

Summary of the problem from Peter Maydell:
https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com

Reference:
https://gitlab.com/qemu-project/qemu/-/issues/556

qemu.git$ git log --no-merges --oneline   --grep CVE-2023-0330
b987718bbb hw/scsi/lsi53c895a: Fix reentrancy issues in the LSI controller (CVE-2023-0330)
a2e1753b80 memory: prevent dma-reentracy issues

Included second commit as well as commit log of a2e1753b80 says it
resolves CVE-2023-0330

(From OE-Core rev: 45ce9885351a2344737170e6e810dc67ab3e7ea9)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Ashish Sharma
b48424988a qemu: Backport fix CVE-2023-3180
Upstream-Status: Backport from [9d38a84347]
CVE: CVE-2023-3180
(From OE-Core rev: edbc17315927a711aa9fae7c6cfba61cbf8ab5ad)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Shubham Kulkarni
0485ee7a6b openssh: Securiry fix for CVE-2023-38408
The PKCS#11 feature in ssh-agent in OpenSSH before 9.3p2 has an
insufficiently trustworthy search path, leading to remote code
execution if an agent is forwarded to an attacker-controlled system.
(Code in /usr/lib is not necessarily safe for loading into ssh-agent.)
NOTE: this issue exists because of an incomplete fix for CVE-2016-10009.

References:
https://nvd.nist.gov/vuln/detail/CVE-2023-38408

Upstream patches:
https://github.com/openssh/openssh-portable/commit/dee22129, https://github.com/openssh/openssh-portable/commit/099cdf59,
https://github.com/openssh/openssh-portable/commit/29ef8a04, https://github.com/openssh/openssh-portable/commit/892506b1,
https://github.com/openssh/openssh-portable/commit/0c111eb8, https://github.com/openssh/openssh-portable/commit/52a03e9f,
https://github.com/openssh/openssh-portable/commit/1fe16fd6, https://github.com/openssh/openssh-portable/commit/e0e8bee8,
https://github.com/openssh/openssh-portable/commit/8afaa7d7, https://github.com/openssh/openssh-portable/commit/1a4b9275,
https://github.com/openssh/openssh-portable/commit/4c1e3ce8, https://github.com/openssh/openssh-portable/commit/1f2731f5.

(From OE-Core rev: 9242b8218858d2bebb3235929fea7e7235cd40f3)

Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Vijay Anusuri
90175073f6 bind: Backport fix for CVE-2023-2828
Upstream Patch: https://downloads.isc.org/isc/bind9/9.16.42/patches/0001-CVE-2023-2828.patch

LINK: https://security-tracker.debian.org/tracker/CVE-2023-2828

(From OE-Core rev: 1b9d661a82211d6ffdd56e366cfbc3f3c247fd1c)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-15 03:47:11 -10:00
Ross Burton
0121cb4bd1 linux/cve-exclusion: remove obsolete manual entries
The generated file covers all but two of these CVEs (which will be fixed
when [1] and [2] are resolved) so remove the redundant entries.

[1] https://github.com/nluedtke/linux_kernel_cves/issues/344
[2] https://github.com/nluedtke/linux_kernel_cves/issues/345

(From OE-Core rev: c953ccba6c2a334cc58a97eee073bdb51a68f1d3)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-07 04:57:26 -10:00
Ross Burton
2f978be9e2 linux/cve-exclusion: add generated CVE_CHECK_WHITELISTs
Run generate-cve-exclusions.py to generate the ignore lists.  This file
is maintained separately from the existing manual whitelist entries.

(From OE-Core rev: b63743410e758ba116adb74a483b7c2d2aedf3b3)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-07 04:57:26 -10:00
Ross Burton
471e51b18a linux-yocto: add script to generate kernel CVE_CHECK_WHITELIST entries
Instead of manually looking up new CVEs and determining what point
releases the fixes are incorporated into, add a script to generate the
CVE_CHECK_WHITELIST data automatically.

First, note that this is very much an interim solution until the
cve-check class fetches data from www.linuxkernelcves.com directly.

The script should be passed the path to a local clone of the
linuxkernelcves repository[1] and the kernel version number. It will
then write to standard output the CVE_STATUS entries for every known
kernel CVE.

The script should be periodically reran as CVEs are backported and
kernels upgraded frequently.

[1] https://github.com/nluedtke/linux_kernel_cves

Note: for the Dunfell backport this is not a cherry-pick of the commit
in master as the variable names are different. This incorporates the
following commits:

linux/generate-cve-exclusions: add version check warning
linux/generate-cve-exclusions.py: fix comparison
linux-yocto: add script to generate kernel CVE_STATUS entries

(From OE-Core rev: 496c0b8fab5dd87102c3a63656debdb3aa214ae7)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-07 04:57:25 -10:00
Vijay Anusuri
1a6ed0befd go: Backport fix for CVE-2023-29409
Upstream-commit: 2300f7ef07

(From OE-Core rev: 37212694b9a610b1086ef574673dd24095585f4a)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-07 04:57:25 -10:00
Vijay Anusuri
3fdec9fd90 inetutils: Backport fix for CVE-2023-40303
Upstream-commit: https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=e4e65c03f4c11292a3e40ef72ca3f194c8bffdd6
& https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=9122999252c7e21eb7774de11d539748e7bdf46d

(From OE-Core rev: 57f6d8548e778712eb11507e889f3eadf3732041)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-07 04:57:25 -10:00
Kai Kang
b1fdc92450 grub2.inc: remove '-O2' from CFLAGS
It fails to boot grub after upgrade grub to 2.06. According to
description in

https://bugzilla.yoctoproject.org/show_bug.cgi?id=14367

it is introduced by a commit to fix CVE. So remove option '-O2' from
CFLAGS rather than revert the commit to avoid the failure.

[YOCTO #14367]

CC: Tony Battersby <tonyb@cybernetics.com>
(From OE-Core rev: 3575290c4cc937ae2f2c5604a5619ac6de9aa071)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 69805629b8f47fd46a37b7c5cc435982e2ac3d1d)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:46 -10:00
Ross Burton
02cfe361d6 oeqa/runtime/cases/rpm: fix wait_for_no_process_for_user failure case
str.format() doesn't use % notation, update the formatting to work.

assertTrue() is a member of self not a global, and assertTrue(True) will
always pass. Change this to just self.fail() as this is the failure case.

(From OE-Core rev: 2be0f2c62fb893f093091cbb30967f32f9d3165b)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 017f3a0b1265c1a3b69c20bdb56bbf446111977e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:46 -10:00
Yoann Congal
8ae48ddf5e recipetool: Fix inherit in created -native* recipes
native and nativesdk classes are special and must be inherited last :
put them at the end of the gathered classes to inherit.

(From OE-Core rev: cdc671271327ca61e5321b8890921d08ecd8799d)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a6614fd800cbe791264aeb102d379ba79bd145c2)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Michael Halstead
9fa49f817d yocto-uninative: Update to 4.2 for glibc 2.38
Uninative 4.2 adds glibc 2.38.

(From OE-Core rev: 35baf2ceb02ca14520a18a1dcd5014c5f7937e30)

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c6654fab00a1b4e4bb05eec8b77c8c60e1f8a709)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Michael Halstead
84c0692d57 yocto-uninative: Update hashes for uninative 4.1
This version includes fixes to patchelf.

(From OE-Core rev: 600ef23e30c27b4ec0f54c9b03d6386bccd5390f)

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1c5c8ff97ba0a7f9adc592d702b865b3d166a24b)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Dmitry Baryshkov
b1f23e404c linux-firmware: split platform-specific Adreno shaders to separate packages
For newest Qualcomm platforms the firmware for the Adreno GPU consists
of two parts: platform-independent SQE/GMU/GPMU/PFP/PM4 and
platform-specific ZAP shader, which is used during the boot process. As
the platform-independent parts can be shared between different
platforms, split the platform-specific part to the separate package.

(From OE-Core rev: 3ae53403b019b699f59c3ab9ba7b822041773dc7)

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit bf00a042d2fa2eb4b20d8c5982926758821bf990)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
BELOUARGA Mohamed
b4da5c4df4 linux-firmware : Add firmware of RTL8822 serie
RTL8822 is a serie of wireless modules that need firmwares to function correctly.
The linux firmware recipe does not have a package of these firmwares, and this commit add them.

(From OE-Core rev: f1a4db02831e70782a896b699cc2fa427cbd8e62)

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 6459959beeb91c0b694f5f17b6587a12c6dcb087)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Dmitry Baryshkov
c06bf61270 linux-firmware: package firmare for Dragonboard 410c
Latest linux-firmware archive inclues firmware for the Dragonboard 410c
device (Qualcomm apq8016 SBC). Follow the rest of linux-firmware-qcom-*
packages as a template and create packages for the new firmware files.

(From OE-Core rev: 0f4582034a41f4abc746bffe5892a8d393a5a8f7)

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 380216e8d3b63d563ebfb10445fc6eb5e77eb9f2)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Trevor Gamblin
827548d7f7 linux-firmware: upgrade 20230515 -> 20230625
WHENCE checksum changed because of updated version lists and removal of
information for the RTL8188EU driver.

(From OE-Core rev: ecfb64079c7426606263780e04799b811c51fe91)

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 986f8ca9d4c2c22d368f69e65b2ab76d661edca0)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Wang Mingyu
c314fe22fd libnss-nis: upgrade 3.1 -> 3.2
Changelog:
* Do not call malloc_usable_size

(From OE-Core rev: 143389388bf3a1d9e1407fe5c42fb6bd341a81b8)

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 5cd967503c0574f45b814572da9503182556b431)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Chee Yang Lee
6351d145ba tiff: CVE-2022-3599.patch also fix CVE-2022-4645 CVE-2023-30774
The same patch also fix CVE-2022-4645 CVE-2023-30774
CVE-2022-4645 - https://gitlab.com/libtiff/libtiff/-/issues/277
CVE-2023-30774 - https://gitlab.com/libtiff/libtiff/-/issues/463

(From OE-Core rev: 8a4f312ef3751ecf8b3fe2ac719477c7d9c967d2)

Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Vijay Anusuri
268614c13d elfutils: Backport fix for CVE-2021-33294
Upstream-Status: Backport from https://sourceware.org/git/?p=elfutils.git;a=commit;h=480b6fa3662ba8ffeee274bf0d37423413c01e55

Reference
https://nvd.nist.gov/vuln/detail/CVE-2021-33294
https://sourceware.org/bugzilla/show_bug.cgi?id=27501

(From OE-Core rev: 9cd6fea32edf8e4da0c33547e1df6d1ec81b350d)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Ashish Sharma
d148690f1d curl: Backport fix CVE-2023-32001
(From OE-Core rev: 71ed22673545fc2bca5ac599416ecb42eb2781f8)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-27 10:54:45 -10:00
Michael Opdenacker
bce2280258 poky.conf: update SANITY_TESTED_DISTROS to match autobuilder
From the intersection of the list of allowed workers
on https://git.yoctoproject.org/yocto-autobuilder2/tree/config.py
and the active workers on
https://autobuilder.yoctoproject.org/typhoon/#/workers

(From meta-yocto rev: eed6f8cd486d9dee764f20d967f07902288e7c65)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Abdellatif El Khlifi
995f3a6243 kernel: skip installing fitImage when using Initramfs bundles
When including an initramfs bundle inside a FIT image, the fitImage is created
after the install task by do_assemble_fitimage_initramfs.

This happens after the generation of the initramfs bundle
(done by do_bundle_initramfs).

So, at the level of the install task we should not try to install the fitImage.
The fitImage is still not generated yet.

After the generation of the fitImage, the deploy task copies the fitImage from
the build directory to the deploy folder.

Change-Id: I3eaa6bba1412f388f710fa0f389f66631c1c4826
(From OE-Core rev: b70a8333a7467162b9d148b99f5970c0af2a531f)

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1b67fd9ac74935fa41e960478c54e45422339138)
Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Yuta Hayama
98d8fdd7ea systemd-systemctl: fix errors in instance name expansion
If the instance name indicated by %i begins with a number, the meaning of the
replacement string "\\1{}".format(instance) is ambiguous.

To indicate group number 1 regardless of the instance name, use "\g<1>".

(From OE-Core rev: d18b939fb08b37380ce95934da38e6522392621c)

(From OE-Core rev: 682e094e6af67e67873f7f08dd8d52b40fcdbded)

Signed-off-by: Yuta Hayama <hayama@lineo.co.jp>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Marek Vasut
6b17a4af6a linux-firmware: Fix mediatek mt7601u firmware path
The following linux-firmware commit moved the mt7601u firmware blob
into a mediatek/ subdirectory, update the path accordingly.
8451c2b1 ("mt76xx: Move the old Mediatek WiFi firmware to mediatek")

(From OE-Core rev: 6fa5c4967a7e70192e9233c92534f27ec3e394c8)

Fixes: 64603f602d ("linux-firmware: upgrade 20230404 -> 20230515")
(From OE-Core rev: 2d56adfd53b0ea3b938c60bf57fd40f3d48b5c68)

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Peter Marko
5e47346311 openssl: Upgrade 1.1.1t -> 1.1.1v
https://www.openssl.org/news/openssl-1.1.1-notes.html
Major changes between OpenSSL 1.1.1u and OpenSSL 1.1.1v [1 Aug 2023]
* Fix excessive time spent checking DH q parameter value (CVE-2023-3817)
* Fix DH_check() excessive time with over sized modulus (CVE-2023-3446)
Major changes between OpenSSL 1.1.1t and OpenSSL 1.1.1u [30 May 2023]
* Mitigate for very slow `OBJ_obj2txt()` performance with gigantic OBJECT IDENTIFIER sub-identities. (CVE-2023-2650)
* Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466)
* Fixed handling of invalid certificate policies in leaf certificates (CVE-2023-0465)
* Limited the number of nodes created in a policy tree ([CVE-2023-0464])

All CVEs for upgrade to 1.1.1u were already patched, so effectively
this will apply patches for CVE-2023-3446 and CVE-2023-3817 plus
several non-CVE fixes.

Because of mips build changes were backported to openssl 1.1.1 branch,
backport of a patch from kirkstone is necessary.

(From OE-Core rev: be5d49d86553769deaf4754969d2cf6931d6ac34)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Bruce Ashfield
d76406934a linux-yocto/5.4: update to v5.4.251
Updating  to the latest korg -stable release that comprises
the following commits:

    887433e4bc93 Linux 5.4.251
    1e02fbe4f0ed tracing/histograms: Return an error if we fail to add histogram to hist_vars list
    b1062596556e tcp: annotate data-races around fastopenq.max_qlen
    21c325d01ecc tcp: annotate data-races around tp->notsent_lowat
    7175277b4d0b tcp: annotate data-races around rskq_defer_accept
    3121d649e4c6 tcp: annotate data-races around tp->linger2
    b1cd5655fc13 net: Replace the limit of TCP_LINGER2 with TCP_FIN_TIMEOUT_MAX
    8ce44cf35ef6 tcp: annotate data-races around tp->tcp_tx_delay
    c822536b3e41 netfilter: nf_tables: can't schedule in nft_chain_validate
    caa228792fb5 netfilter: nf_tables: fix spurious set element insertion failure
    b8944e53ee70 llc: Don't drop packet from non-root netns.
    b07e31824df6 fbdev: au1200fb: Fix missing IRQ check in au1200fb_drv_probe
    6d39e9fc5934 Revert "tcp: avoid the lookup process failing to get sk in ehash table"
    0c0bd9789a8d net:ipv6: check return value of pskb_trim()
    17046107ca15 iavf: Fix use-after-free in free_netdev
    765e1eaf42de net: ethernet: ti: cpsw_ale: Fix cpsw_ale_get_field()/cpsw_ale_set_field()
    3b6f56021af6 pinctrl: amd: Use amd_pinconf_set() for all config options
    951f4e9730f1 fbdev: imxfb: warn about invalid left/right margin
    3e03319ab97d spi: bcm63xx: fix max prepend length
    c9f56f3c7bc9 igb: Fix igb_down hung on surprise removal
    7d80e834625c wifi: iwlwifi: mvm: avoid baid size integer overflow
    41d149376078 wifi: wext-core: Fix -Wstringop-overflow warning in ioctl_standard_iw_point()
    970c7035f4b0 devlink: report devlink_port_type_warn source device
    e09a285ea1e8 bpf: Address KCSAN report on bpf_lru_list
    cec1857b1ea5 sched/fair: Don't balance task to its current running CPU
    9d8d3df71516 arm64: mm: fix VA-range sanity check
    8ad6679a5bb9 posix-timers: Ensure timer ID search-loop limit is valid
    d0345f7c7dbc md/raid10: prevent soft lockup while flush writes
    09539f9e2076 md: fix data corruption for raid456 when reshape restart while grow up
    4181c30a2c55 nbd: Add the maximum limit of allocated index in nbd_dev_add
    d4f1cd9b9d66 debugobjects: Recheck debug_objects_enabled before reporting
    0afcebcec057 ext4: correct inline offset when handling xattrs in inode body
    5d580017bdb9 drm/client: Fix memory leak in drm_client_modeset_probe
    52daf6ba2e0d drm/client: Fix memory leak in drm_client_target_cloned
    9533dbfac0ff can: bcm: Fix UAF in bcm_proc_show()
    5dd838be69e4 selftests: tc: set timeout to 15 minutes
    7f83199862c2 fuse: revalidate: don't invalidate if interrupted
    ae91ab710d8e btrfs: fix warning when putting transaction with qgroups enabled after abort
    e217a3d19e10 perf probe: Add test for regression introduced by switch to die_get_decl_file()
    380c7ceabdde drm/atomic: Fix potential use-after-free in nonblocking commits
    b7084ebf4f54 scsi: qla2xxx: Remove unused nvme_ls_waitq wait queue
    3f22f9ddbb29 scsi: qla2xxx: Pointer may be dereferenced
    a1c5149a82de scsi: qla2xxx: Correct the index of array
    1b7e5bdf2be2 scsi: qla2xxx: Check valid rport returned by fc_bsg_to_rport()
    4f90a8b04816 scsi: qla2xxx: Fix potential NULL pointer dereference
    d25fded78d88 scsi: qla2xxx: Wait for io return on terminate rport
    056fd1820724 tracing/probes: Fix not to count error code to total length
    93114cbc7cb1 tracing: Fix null pointer dereference in tracing_err_log_open()
    597eb52583d4 xtensa: ISS: fix call to split_if_spec
    e84829522fc7 ring-buffer: Fix deadloop issue on reading trace_pipe
    481535905608 tracing/histograms: Add histograms to hist_vars if they have referenced variables
    46574e5a0a2a tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() when iterating clk
    30962268fa1a tty: serial: samsung_tty: Fix a memory leak in s3c24xx_serial_getclk() in case of error
    0697a1a592c7 Revert "8250: add support for ASIX devices with a FIFO bug"
    45e55e9cac13 meson saradc: fix clock divider mask length
    2cdced57bc00 ceph: don't let check_caps skip sending responses for revoke msgs
    1883a484c87e hwrng: imx-rngc - fix the timeout for init and self check
    e3373e6b6c79 firmware: stratix10-svc: Fix a potential resource leak in svc_create_memory_pool()
    826c7bfe5c49 serial: atmel: don't enable IRQs prematurely
    15d4bd0f0a6b drm/rockchip: vop: Leave vblank enabled in self-refresh
    6bc6ec8b0a0b drm/atomic: Allow vblank-enabled + self-refresh "disable"
    f86942709b0e fs: dlm: return positive pid value for F_GETLK
    ecfd1f82c4f5 md/raid0: add discard support for the 'original' layout
    dac4afa3efae misc: pci_endpoint_test: Re-init completion for every test
    dd2210379205 misc: pci_endpoint_test: Free IRQs before removing the device
    9cfa4ef25de5 PCI: rockchip: Set address alignment for endpoint mode
    35aec6bc0c04 PCI: rockchip: Use u32 variable to access 32-bit registers
    13b93891308c PCI: rockchip: Fix legacy IRQ generation for RK3399 PCIe endpoint core
    c049b20655f6 PCI: rockchip: Add poll and timeout to wait for PHY PLLs to be locked
    a1f311d430f2 PCI: rockchip: Write PCI Device ID to correct register
    592795119f2b PCI: rockchip: Assert PCI Configuration Enable bit after probe
    35c95eda7b6d PCI: qcom: Disable write access to read only registers for IP v2.3.3
    b0aac7792525 PCI: Add function 1 DMA alias quirk for Marvell 88SE9235
    f450388d8b6d PCI/PM: Avoid putting EloPOS E2/S2/H2 PCIe Ports in D3cold
    a4855aeb13e4 jfs: jfs_dmap: Validate db_l2nbperpage while mounting
    ee2fd448608e ext4: only update i_reserved_data_blocks on successful block allocation
    02543d1ddd77 ext4: fix wrong unit use in ext4_mb_clear_bb
    96a85becb811 erofs: fix compact 4B support for 16k block size
    42725e5c1b18 SUNRPC: Fix UAF in svc_tcp_listen_data_ready()
    29a560437f67 misc: fastrpc: Create fastrpc scalar with correct buffer count
    b157987242bd powerpc: Fail build if using recordmcount with binutils v2.37
    2b59740ebc86 net: bcmgenet: Ensure MDIO unregistration has clocks enabled
    1fe96568e78b mtd: rawnand: meson: fix unaligned DMA buffers handling
    86b9820395f2 tpm: tpm_vtpm_proxy: fix a race condition in /dev/vtpmx creation
    96a16069a81d pinctrl: amd: Only use special debounce behavior for GPIO 0
    6dcb493fc478 pinctrl: amd: Detect internal GPIO0 debounce handling
    a1a443651569 pinctrl: amd: Fix mistake in handling clearing pins at startup
    cf57a0853ba5 net/sched: make psched_mtu() RTNL-less safe
    96391959a99e net/sched: flower: Ensure both minimum and maximum ports are specified
    166fa538e0dd cls_flower: Add extack support for src and dst port range options
    aadca5f08aef wifi: airo: avoid uninitialized warning in airo_get_rate()
    cc2c06ca7fbf erofs: avoid infinite loop in z_erofs_do_read_page() when reading beyond EOF
    b55c38fe2441 platform/x86: wmi: Break possible infinite loop when parsing GUID
    cb8a256202b9 platform/x86: wmi: move variables
    669c488cb25a platform/x86: wmi: use guid_t and guid_equal()
    fd8049d6553f platform/x86: wmi: remove unnecessary argument
    4c8e26fc3302 platform/x86: wmi: Fix indentation in some cases
    8717326e4362 platform/x86: wmi: Replace UUID redefinitions by their originals
    c7eeba470585 ipv6/addrconf: fix a potential refcount underflow for idev
    7a06554214fe NTB: ntb_tool: Add check for devm_kcalloc
    88e243618e4c NTB: ntb_transport: fix possible memory leak while device_register() fails
    b5b9e041eb04 ntb: intel: Fix error handling in intel_ntb_pci_driver_init()
    0ae4fac8fe33 NTB: amd: Fix error handling in amd_ntb_pci_driver_init()
    bb17520c0383 ntb: idt: Fix error handling in idt_pci_driver_init()
    4e64ef41c6cf udp6: fix udp6_ehashfn() typo
    61b4c4659746 icmp6: Fix null-ptr-deref of ip6_null_entry->rt6i_idev in icmp6_dev().
    4c7276a6daf7 ionic: remove WARN_ON to prevent panic_on_warn
    3e77647acdcf ionic: ionic_intr_free parameter change
    f0dc38bdef52 ionic: move irq request to qcq alloc
    7cf21fba1bf8 ionic: clean irq affinity on queue deinit
    ef7fc26b6a19 ionic: improve irq numa locality
    808211a8d427 net/sched: cls_fw: Fix improper refcount update leads to use-after-free
    d98ac5bce2d5 net: mvneta: fix txq_map in case of txq_number==1
    58cd168825b4 scsi: qla2xxx: Fix error code in qla2x00_start_sp()
    b49b55a7d578 igc: set TP bit in 'supported' and 'advertising' fields of ethtool_link_ksettings
    a45afb07121c igc: Remove delay during TX ring configuration
    59c190082a01 drm/panel: simple: Add connector_type for innolux_at043tn24
    64b76abfe32d drm/panel: Add and fill drm_panel type field
    362940f8e40f drm/panel: Initialise panel dev and funcs through drm_panel_init()
    6d5172a3ab8f workqueue: clean up WORK_* constant types, clarify masking
    003d33924911 net: lan743x: Don't sleep in atomic context
    373b9475ea8c block/partition: fix signedness issue for Amiga partitions
    22df19fee7b9 tty: serial: fsl_lpuart: add earlycon for imx8ulp platform
    b7d636c924eb netfilter: nf_tables: prevent OOB access in nft_byteorder_eval
    61c7a5256543 netfilter: conntrack: Avoid nf_ct_helper_hash uses after free
    565bdccdded3 netfilter: nf_tables: fix scheduling-while-atomic splat
    7c4610ac3b41 netfilter: nf_tables: unbind non-anonymous set if rule construction fails
    90d54ee329d2 netfilter: nf_tables: reject unbound anonymous set before commit phase
    1df28fde1270 netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain
    1adb5c272b20 netfilter: nf_tables: incorrect error path handling with NFT_MSG_NEWRULE
    077ef851f0a3 netfilter: nf_tables: add rescheduling points during loop detection walks
    11352851944c netfilter: nf_tables: use net_generic infra for transaction data
    d59ed9dc0058 netfilter: add helper function to set up the nfnetlink header and use it
    fa498dead9ee netfilter: nftables: add helper function to set the base sequence number
    ef35dd70a340 netfilter: nf_tables: fix nat hook table deletion
    d1b7fe307c75 block: add overflow checks for Amiga partition support
    2b71cbf7ab48 fanotify: disallow mount/sb marks on kernel internal pseudo fs
    9a6ce27a5d61 fs: no need to check source
    c1c41cda0ab1 ARM: orion5x: fix d2net gpio initialization
    679c34821ab7 btrfs: fix race when deleting quota root from the dirty cow roots list
    f0fbbd405a94 fs: Lock moved directories
    b97ac51f8492 fs: Establish locking order for unrelated directories
    d95dc41ad181 Revert "f2fs: fix potential corruption when moving a directory"
    a9a926423a63 ext4: Remove ext4 locking of moved directory
    eefebf8877d3 fs: avoid empty option when generating legacy mount string
    e9a3310bc2fc jffs2: reduce stack usage in jffs2_build_xattr_subsystem()
    a249a61ac528 integrity: Fix possible multiple allocation in integrity_inode_get()
    0729029e6472 bcache: Remove unnecessary NULL point check in node allocations
    4be68f1c7076 mmc: sdhci: fix DMA configure compatibility issue when 64bit DMA mode is used.
    2f6c76994646 mmc: core: disable TRIM on Micron MTFC4GACAJCN-1M
    c491e27151c1 mmc: core: disable TRIM on Kingston EMMC04G-M627
    ce7278dedab7 NFSD: add encoding of op_recall flag for write delegation
    5016511287dc ALSA: jack: Fix mutex call in snd_jack_report()
    c64fda48a3ad i2c: xiic: Don't try to handle more interrupt events after error
    696e470e910e i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in xiic_process()
    498962715773 sh: dma: Fix DMA channel offset calculation
    58b1b3c54e16 net: dsa: tag_sja1105: fix MAC DA patching from meta frames
    67a67e258407 net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX
    ab0085bd7902 xsk: Honor SO_BINDTODEVICE on bind
    9347e432297e xsk: Improve documentation for AF_XDP
    e63dc31b9452 tcp: annotate data races in __tcp_oow_rate_limited()
    e9c2687988b7 net: bridge: keep ports without IFF_UNICAST_FLT in BR_PROMISC mode
    fffa51e786ce powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y
    45b34500f3ef f2fs: fix error path handling in truncate_dnode()
    860d9b717f65 mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0
    398e6a015877 spi: bcm-qspi: return error if neither hif_mspi nor mspi is available
    18d50fb44109 Add MODULE_FIRMWARE() for FIRMWARE_TG357766.
    4d8fc6137749 sctp: fix potential deadlock on &net->sctp.addr_wq_lock
    999ff7fe492b rtc: st-lpc: Release some resources in st_rtc_probe() in case of error
    d5c39cca4d03 pwm: sysfs: Do not apply state to already disabled PWMs
    5375c024f8ae pwm: imx-tpm: force 'real_period' to be zero in suspend
    d252c74b8b7a mfd: stmpe: Only disable the regulators if they are enabled
    d9db18addf42 KVM: s390: vsie: fix the length of APCB bitmap
    baec796723b7 mfd: stmfx: Fix error path in stmfx_chip_init
    5d26f134efa8 serial: 8250_omap: Use force_suspend and resume for system suspend
    337073cacad4 mfd: intel-lpss: Add missing check for platform_get_resource
    0a6afc83b028 usb: dwc3: qcom: Release the correct resources in dwc3_qcom_remove()
    becd09685d44 KVM: s390: fix KVM_S390_GET_CMMA_BITS for GFNs in memslot holes
    151b0dd6d1a0 mfd: rt5033: Drop rt5033-battery sub-device
    8e8dae8eb230 usb: hide unused usbfs_notify_suspend/resume functions
    fe9cdc198619 usb: phy: phy-tahvo: fix memory leak in tahvo_usb_probe()
    1531ba3fab51 extcon: Fix kernel doc of property capability fields to avoid warnings
    257daec29dcd extcon: Fix kernel doc of property fields to avoid warnings
    648a163cff21 usb: dwc3: qcom: Fix potential memory leak
    d485150c9a52 media: usb: siano: Fix warning due to null work_func_t function pointer
    619e6f9a564a media: videodev2.h: Fix struct v4l2_input tuner index comment
    e9586c49bdd4 media: usb: Check az6007_read() return value
    fd869bdb5f12 sh: j2: Use ioremap() to translate device tree address into kernel memory
    85f4c53849e4 w1: fix loop in w1_fini()
    dc88382c1d44 block: change all __u32 annotations to __be32 in affs_hardblocks.h
    fa8548d1a0a4 block: fix signed int overflow in Amiga partition support
    bec218258cbd usb: dwc3: gadget: Propagate core init errors to UDC during pullup
    f55127df9918 USB: serial: option: add LARA-R6 01B PIDs
    bac502cd472a hwrng: st - keep clock enabled while hwrng is registered
    071560202a52 hwrng: st - Fix W=1 unused variable warning
    18fa56ca4cb8 NFSv4.1: freeze the session table upon receiving NFS4ERR_BADSESSION
    c182d87c67e2 ARC: define ASM_NL and __ALIGN(_STR) outside #ifdef __ASSEMBLY__ guard
    02dc8e8bdbe4 modpost: fix off by one in is_executable_section()
    1030c0c30968 crypto: marvell/cesa - Fix type mismatch warning
    ad3c4ecff00b modpost: fix section mismatch message for R_ARM_{PC24,CALL,JUMP24}
    084bf580019c modpost: fix section mismatch message for R_ARM_ABS32
    c893658d9ce6 crypto: nx - fix build warnings when DEBUG_FS is not enabled
    a43bcb0b661c hwrng: virtio - Fix race on data_avail and actual data
    b70315e44f03 hwrng: virtio - always add a pending request
    102a354d52ca hwrng: virtio - don't waste entropy
    f2a7dfd35f0c hwrng: virtio - don't wait on cleanup
    6fe732764a58 hwrng: virtio - add an internal buffer
    2cbfb51d2c7e powerpc/mm/dax: Fix the condition when checking if altmap vmemap can cross-boundary
    aa3932eb0739 pinctrl: at91-pio4: check return value of devm_kasprintf()
    e297350c33f6 perf dwarf-aux: Fix off-by-one in die_get_varname()
    7f822c8036fe pinctrl: cherryview: Return correct value if pin in push-pull mode
    1768e362f20f PCI: Add pci_clear_master() stub for non-CONFIG_PCI
    5d3955bc32d4 PCI: ftpci100: Release the clock resources
    331dce61c0d4 PCI: pciehp: Cancel bringup sequence if card is not present
    f58c8563686b scsi: 3w-xxxx: Add error handling for initialization failure in tw_probe()
    666e7f9d60ce PCI/ASPM: Disable ASPM on MFD function removal to avoid use-after-free
    961c8370c5f7 scsi: qedf: Fix NULL dereference in error handling
    6f64558b43cf ASoC: imx-audmix: check return value of devm_kasprintf()
    35455616110b clk: keystone: sci-clk: check return value of kasprintf()
    ffe6ad17cf14 clk: cdce925: check return value of kasprintf()
    5f13d67027fa ALSA: ac97: Fix possible NULL dereference in snd_ac97_mixer
    801c8341f7af clk: tegra: tegra124-emc: Fix potential memory leak
    262db3ff58e2 drm/radeon: fix possible division-by-zero errors
    cacc0506e571 drm/amdkfd: Fix potential deallocation of previously deallocated memory.
    9e3858f82e3c fbdev: omapfb: lcd_mipid: Fix an error handling path in mipid_spi_probe()
    5541d1856c87 arm64: dts: renesas: ulcb-kf: Remove flow control for SCIF1
    40ac5cb6cbb0 IB/hfi1: Fix sdma.h tx->num_descs off-by-one errors
    68e0033dee72 soc/fsl/qe: fix usb.c build errors
    b756eb5eb9b0 ASoC: es8316: Do not set rate constraints for unsupported MCLKs
    d1c1ca27cac0 ASoC: es8316: Increment max value for ALC Capture Target Volume control
    b54bac970b54 memory: brcmstb_dpfe: fix testing array offset after use
    f54142ed16b5 ARM: ep93xx: fix missing-prototype warnings
    c2324c5aa247 drm/panel: simple: fix active size for Ampire AM-480272H3TMQW-T01H
    4a23954279fc arm64: dts: qcom: msm8916: correct camss unit address
    97dcb8dfefaa ARM: dts: gta04: Move model property out of pinctrl node
    25bbd1c7bef8 RDMA/bnxt_re: Fix to remove an unnecessary log
    ed039ad88ab0 drm: sun4i_tcon: use devm_clk_get_enabled in `sun4i_tcon_init_clocks`
    87ccaf56097a Input: adxl34x - do not hardcode interrupt trigger type
    c7a8cc9140cf ARM: dts: BCM5301X: Drop "clock-names" from the SPI node
    c516c00847f5 Input: drv260x - sleep between polling GO bit
    3e789aee218b radeon: avoid double free in ci_dpm_init()
    bc5b57a23087 netlink: Add __sock_i_ino() for __netlink_diag_dump().
    1c405b3d3769 ipvlan: Fix return value of ipvlan_queue_xmit()
    1d2ab3d4383e netfilter: nf_conntrack_sip: fix the ct_sip_parse_numerical_param() return value.
    337fdce45063 netfilter: conntrack: dccp: copy entire header to stack buffer, not just basic one
    32deadf89430 lib/ts_bm: reset initial match offset for every block of text
    dd6ff3f38627 net: nfc: Fix use-after-free caused by nfc_llcp_find_local
    edc5d8776a32 nfc: llcp: simplify llcp_sock_connect() error paths
    9c9662e2512b gtp: Fix use-after-free in __gtp_encap_destroy().
    08d8ff1bc688 selftests: rtnetlink: remove netdevsim device after ipsec offload test
    bd1de6107f10 netlink: do not hard code device address lenth in fdb dumps
    8f6652ed2ad9 netlink: fix potential deadlock in netlink_set_err()
    88d89b4a3102 wifi: ath9k: convert msecs to jiffies where needed
    76d5bda2c3af wifi: cfg80211: rewrite merging of inherited elements
    e4c33144fc75 wifi: iwlwifi: pull from TXQs with softirqs disabled
    2ba902da9090 rtnetlink: extend RTEXT_FILTER_SKIP_STATS to IFLA_VF_INFO
    786e264b37d2 wifi: ath9k: Fix possible stall on ath9k_txq_list_has_key()
    68305a19bada memstick r592: make memstick_debug_get_tpc_name() static
    6f4454ccbea9 kexec: fix a memory leak in crash_shrink_memory()
    4503261ab97b watchdog/perf: more properly prevent false positives with turbo modes
    d5fa3918dfce watchdog/perf: define dummy watchdog_update_hrtimer_threshold() on correct config
    7874fb3bef8b wifi: rsi: Do not set MMC_PM_KEEP_POWER in shutdown
    4dc3560561a0 wifi: ath9k: don't allow to overwrite ENDPOINT0 attributes
    f432198058a6 wifi: ray_cs: Fix an error handling path in ray_probe()
    8fe51dce8bdc wifi: ray_cs: Drop useless status variable in parse_addr()
    0dec0ad304d4 wifi: ray_cs: Utilize strnlen() in parse_addr()
    ee73ad566a29 wifi: wl3501_cs: Fix an error handling path in wl3501_probe()
    b7df4e0cb4ed wl3501_cs: use eth_hw_addr_set()
    24f34f67be24 net: create netdev->dev_addr assignment helpers
    dd5dca10d806 wl3501_cs: Fix misspelling and provide missing documentation
    051d70773b9c wl3501_cs: Remove unnecessary NULL check
    91c3c9eaf1ed wl3501_cs: Fix a bunch of formatting issues related to function docs
    add539f7d16b wifi: atmel: Fix an error handling path in atmel_probe()
    5b06f702805d wifi: orinoco: Fix an error handling path in orinoco_cs_probe()
    ca4a2955d866 wifi: orinoco: Fix an error handling path in spectrum_cs_probe()
    91c3325da240 regulator: core: Streamline debugfs operations
    1bb38ef697e4 regulator: core: Fix more error checking for debugfs_create_dir()
    6ca0c94f2b02 nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()
    66a1be74230b nfc: constify several pointers to u8, char and sk_buff
    fea2104e752a wifi: mwifiex: Fix the size of a memory allocation in mwifiex_ret_802_11_scan()
    bc5099512057 spi: spi-geni-qcom: Correct CS_TOGGLE bit in SPI_TRANS_CFG
    f394d204d640 samples/bpf: Fix buffer overflow in tcp_basertt
    90e3c1017757 wifi: ath9k: avoid referencing uninit memory in ath9k_wmi_ctrl_rx
    be3989d93be3 wifi: ath9k: fix AR9003 mac hardware hang check register offset calculation
    717e4277ddf7 ima: Fix build warnings
    8430a8e8e854 pstore/ram: Add check for kstrdup
    540cdd720772 evm: Complete description of evm_inode_setattr()
    568b73406d93 ARM: 9303/1: kprobes: avoid missing-declaration warnings
    ba6da16eefb1 powercap: RAPL: Fix CONFIG_IOSF_MBI dependency
    c97460ce1f7c PM: domains: fix integer overflow issues in genpd_parse_state()
    54cc10a0f4b0 clocksource/drivers/cadence-ttc: Fix memory leak in ttc_timer_probe
    38ca169d66c3 clocksource/drivers/cadence-ttc: Use ttc driver as platform driver
    8af3b8d770da tracing/timer: Add missing hrtimer modes to decode_hrtimer_mode().
    7b0c664541cd irqchip/jcore-aic: Fix missing allocation of IRQ descriptors
    d244927e350e irqchip/jcore-aic: Kill use of irq_create_strict_mappings()
    be481881753b md/raid10: fix io loss while replacement replace rdev
    45fa023b3334 md/raid10: fix null-ptr-deref of mreplace in raid10_sync_request
    31c805a44b75 md/raid10: fix wrong setting of max_corr_read_errors
    283f4a63fee3 md/raid10: fix overflow of md/safe_mode_delay
    b0b971fe7d61 md/raid10: check slab-out-of-bounds in md_bitmap_get_counter
    484104918305 x86/resctrl: Only show tasks' pid in current pid namespace
    7206eca1ac44 x86/resctrl: Use is_closid_match() in more places
    6f2bb37da468 bgmac: fix *initial* chip reset to support BCM5358
    794bfb6fd992 drm/amdgpu: Validate VM ioctl flags.
    2a4cfd5b0354 scripts/tags.sh: Resolve gtags empty index generation
    fff826d665f9 drm/i915: Initialise outparam for error return from wait_for_register
    99036f1aed7e HID: wacom: Use ktime_t rather than int when dealing with timestamps
    815c95d82b79 fbdev: imsttfb: Fix use after free bug in imsttfb_probe
    a7c8d2f3753d video: imsttfb: check for ioremap() failures
    f042d80a631f x86/smp: Use dedicated cache-line for mwait_play_dead()
    23f98fe887ce gfs2: Don't deref jdesc in evict

(From OE-Core rev: 9d509daf5fdae6b5dd8a81490ee40ea119a42024)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Bruce Ashfield
9ffd5243e9 linux-yocto/5.4: update to v5.4.250
Updating  to the latest korg -stable release that comprises
the following commits:

    27745d94abe1 Linux 5.4.250
    00363ef30797 x86/cpu/amd: Add a Zenbleed fix
    92b292bed627 x86/cpu/amd: Move the errata checking functionality up
    4d4112e2845c x86/microcode/AMD: Load late on both threads too

(From OE-Core rev: 55f3f04896f1c301bbc7e18360ac05ff583b7a1d)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Bruce Ashfield
e33ce6f1af linux-yocto/5.4: update to v5.4.249
Updating  to the latest korg -stable release that comprises
the following commits:

    b30db4f7e45f Linux 5.4.249
    c87439055174 xfs: verify buffer contents when we skip log replay
    72ab3d39b443 mm: make wait_on_page_writeback() wait for multiple pending writebacks
    9ea42ba3e695 mm: fix VM_BUG_ON(PageTail) and BUG_ON(PageWriteback)
    dffd25725e99 i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle
    f89bcf03e90c x86/apic: Fix kernel panic when booting with intremap=off and x2apic_phys
    a43c763f9cbe drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl
    45f574d8dfc1 drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl
    c81a542e45a0 drm/exynos: vidi: fix a wrong error return
    948b8b5fd0f3 ARM: dts: Fix erroneous ADS touchscreen polarities
    8d6f9f5f3bfc ASoC: nau8824: Add quirk to active-high jack-detect
    d6fd1b3f7648 s390/cio: unregister device when the only path is gone
    0de32d3dd39d usb: gadget: udc: fix NULL dereference in remove()
    823dd7de8213 nfcsim.c: Fix error checking for debugfs_create_dir
    c32b39d0707b media: cec: core: don't set last_initiator if tx in progress
    a69a15a1e789 arm64: Add missing Set/Way CMO encodings
    99de9a18e646 HID: wacom: Add error check to wacom_parse_and_register()
    2af8d9637270 scsi: target: iscsi: Prevent login threads from racing between each other
    321a81d26c8d sch_netem: acquire qdisc lock in netem_change()
    91274bbe78a2 Revert "net: phy: dp83867: perform soft reset and retain established link"
    25c8d38c7560 netfilter: nfnetlink_osf: fix module autoload
    476c617e4dd4 netfilter: nf_tables: disallow element updates of bound anonymous sets
    d3b110395fea be2net: Extend xmit workaround to BE3 chip
    789d5286060f net: dsa: mt7530: fix trapping frames on non-MT7621 SoC MT7530 switch
    35373d602bd4 ipvs: align inner_mac_header for encapsulation
    ee155675bda8 mmc: usdhi60rol0: fix deferred probing
    0bd483fb95ce mmc: sh_mmcif: fix deferred probing
    6160d37db171 mmc: sdhci-acpi: fix deferred probing
    b25875cf5e3b mmc: omap_hsmmc: fix deferred probing
    cbb0118f8aa0 mmc: omap: fix deferred probing
    e0d505356973 mmc: mvsdio: fix deferred probing
    c2e675509ff8 mmc: mvsdio: convert to devm_platform_ioremap_resource
    3ef787d61972 mmc: mtk-sd: fix deferred probing
    3c01d64996be net: qca_spi: Avoid high load if QCA7000 is not available
    bf7a4fd33669 xfrm: Linearize the skb after offloading if needed.
    d0fe8a733fa7 ieee802154: hwsim: Fix possible memory leaks
    dfcac203a36a rcu: Upgrade rcu_swap_protected() to rcu_replace_pointer()
    94199d4727f6 x86/mm: Avoid using set_pgd() outside of real PGD pages
    be178a5eae0f cifs: Fix potential deadlock when updating vol in cifs_reconnect()
    8a5aaa4562a9 cifs: Merge is_path_valid() into get_normalized_path()
    339134c15c64 cifs: Introduce helpers for finding TCP connection
    cf8c7aa90618 cifs: Get rid of kstrdup_const()'d paths
    3fa4c08104c4 cifs: Clean up DFS referral cache
    b73539b887a4 nilfs2: prevent general protection fault in nilfs_clear_dirty_page()
    1cc7dcfdeb5e writeback: fix dereferencing NULL mapping->host on writeback_page_template
    18a0202bec17 ip_tunnels: allow VXLAN/GENEVE to inherit TOS/TTL from VLAN
    ab530c9bec51 mmc: meson-gx: remove redundant mmc_request_done() call from irq context
    88b373d1c5e9 cgroup: Do not corrupt task iteration when rebinding subsystem
    c06c568e43e7 PCI: hv: Fix a race condition bug in hv_pci_query_relations()
    f02a67690777 Drivers: hv: vmbus: Fix vmbus_wait_for_unload() to scan present CPUs
    966708ed9dd9 nilfs2: fix buffer corruption due to concurrent device reads
    a93ae93e9f1b media: dvb-core: Fix use-after-free due to race at dvb_register_device()
    225bd8cc9c3f media: dvbdev: fix error logic at dvb_register_device()
    5bc971f0435f media: dvbdev: Fix memleak in dvb_register_device
    40d7530bc7fd tick/common: Align tick period during sched_timer setup
    b9b61fd1f74d x86/purgatory: remove PGO flags
    4d02a166cbee tracing: Add tracing_reset_all_online_cpus_unlocked() function
    e14e9cc588bd epoll: ep_autoremove_wake_function should use list_del_init_careful
    e77e5481d5bf list: add "list_del_init_careful()" to go with "list_empty_careful()"
    c32ab1c1959a mm: rewrite wait_on_page_bit_common() logic
    559cefc7c25f nilfs2: reject devices with insufficient block count

(From OE-Core rev: c03281719f62d47ff98a4172cc48d875cbde5f2e)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Dhairya Nagodra
3b52050443 harfbuzz: Resolve backported commit bug.
The commit [https://github.com/openembedded/openembedded-core/commit/c22bbe9b45e3]
backports fix for CVE-2023-25193 for version 2.6.4.
The apply() in src/hb-ot-layout-gpos-table.hh ends prematurely.
The if block in apply() has an extra return statement,
which causes it to return w/o executing
buffer->unsafe_to_concat_from_outbuffer() function.

(From OE-Core rev: e3fda60c4131c21cfb3139c56c1771e342d4b9bf)

Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Yuta Hayama
959e7b1432 cve-update-nvd2-native: always pass str for json.loads()
Currently json.loads() accepts one of the types str, bytes, or bytearray
as an argument, but bytes and bytearrays have only been allowed since
python 3.6. The version of Python3 provided by default on Ubuntu 16.04
and Debian 9.x is 3.5, so make raw_data type str to work correctly on
these build hosts.

(From OE-Core rev: 4efdf7a93254056b9ac47de470740ac113b031f2)

Signed-off-by: Yuta Hayama <hayama@lineo.co.jp>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Peter Marko
729e5e306f procps: patch CVE-2023-4016
Backport patch from upstream master.

There were three changes needed to apply the patch:
* move NEWS change to start of the file
* change file location from src/ps/ to ps/
* change xmalloc/xcmalloc to malloc/cmalloc

The x*malloc functions were introduced in commit in future version.
584028dbe5
They call the original function plus additionally throw error when out of memory.
https://gitlab.com/procps-ng/procps/-/blob/v4.0.3/local/xalloc.h?ref_type=tags
So this replacement is correct in context of our version.

(From OE-Core rev: 1632c7223b2f8cd595e1ba20bc006c68fc833295)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Vijay Anusuri
3e0bb5455b ghostscript: backport fix for CVE-2023-38559
Upstream-Status: Backport from https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d81b82c70bc1fb9991bb95f1201abb5dea55f57f

(From OE-Core rev: f70113d1d5b5359c8b668ba43aac362457927d9e)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:13 -10:00
Vivek Kumbhar
3afaf243ba qemu:fix CVE-2023-3354 VNC: improper I/O watch removal in TLS handshake can lead to remote unauthenticated denial of service
(From OE-Core rev: 447bab76f9ac465ad36540e3bfb9a2a3cdbfa6b6)

Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Emily Vekariya
00ba8af956 qemu: CVE-ID correction for CVE-2020-35505
- The commit [https://github.com/qemu/qemu/commit/995457517340]
  ("esp: ensure cmdfifo is not empty and current_dev is non-NULL")
  fixes CVE-2020-35505 instead of CVE-2020-35504.
- Hence, corrected the CVE-ID in CVE-2020-35505.patch.
- Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1909769

(From OE-Core rev: 9d54930a0c37e2878bbbe221341ebbd2bdd78a22)

Signed-off-by: Emily Vekariya <emily.vekariya@einfochips.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Dhairya Nagodra
3c6a02f04a dmidecode 3.2: Fix CVE-2023-30630
Upstream Repository: https://git.savannah.gnu.org/git/dmidecode.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2023-30630
Type: Security Fix
CVE: CVE-2023-30630
Score: 7.8
Patch: https://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=6ca381c1247c

(From OE-Core rev: f3def5af120355a2454c088724e147bbce785d1b)

Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Hitendra Prajapati
ebca640cbb tiff: fix multiple CVEs
Backport fixes for:
* CVE-2023-2908 - Upstream-Status: Backport from 9bd48f0dbd
* CVE-2023-3316 - Upstream-Status: Backport from d63de61b1e
* CVE-2023-3618 - Upstream-Status: Backport from 881a070194 && b5c7d4c4e0

(From OE-Core rev: 4929d08cefac9ae2ebbdf94ccdc51a0f67f28164)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Hitendra Prajapati
b5f81a875d tiff: fix multiple CVEs
Backport fixes for:
* CVE-2023-25433 - Upstream-Status: Backport from 9c22495e5e && 688012dca2
* CVE-2023-25434 & CVE-2023-25435 - Upstream-Status: Backport from 69818e2f2d

* CVE-2023-26965 & CVE-2023-26966 - Upstream-Status: Backport from import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u8.debian.tar.xz]

(From OE-Core rev: 3d322227477f9e82fc22de6e896174d04513d72b)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Peter Marko
2ff427ee40 libpcre2: patch CVE-2022-41409
Backport commit mentioned in NVD DB links.
94e1c00176

(From OE-Core rev: c25b88fc321b7c050108b29c75c0a159e0754f84)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Peter Marko
0de5f6a27a libarchive: ignore CVE-2023-30571
This issue was reported and discusses under [1] which is linked in NVD CVE report.
It was already documented that some parts or libarchive are thread safe and some not.
[2] was now merged to document that also reported function is not thread safe.
So this CVE *now* reports thread race condition for non-thread-safe function.
And as such the CVE report is now invalid.

The issue is still not closed for 2 reasons:
* better document what is and what is not thread safe
* request to public if someone could make these functions thread safe
This should however not invalidate above statment about ignoring this CVE.

[1] https://github.com/libarchive/libarchive/issues/1876
[2] https://github.com/libarchive/libarchive/pull/1875

(From OE-Core rev: 9374e680ae2376589a9bfe4565dfcf4dc9791aa8)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Vivek Kumbhar
f7f7d5514c go: fix CVE-2023-29406 net/http: insufficient sanitization of Host header
(From OE-Core rev: 07e03175de91739064ae5530b3df093b4d05510b)

Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Peter Marko
762bfb5fc5 libjpeg-turbo: patch CVE-2023-2804
Relevant links:
* linked fronm NVD:
  * https://github.com/libjpeg-turbo/libjpeg-turbo/issues/668#issuecomment-1492586118
* follow-up analysis:
  * https://github.com/libjpeg-turbo/libjpeg-turbo/issues/668#issuecomment-1496473989
  * picked commits fix all issues mentioned in this analysis

(From OE-Core rev: cb3c7efd313f758e9bade93b72527bc5dc470085)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Peter Marko
dcc4dbf463 python3: ignore CVE-2023-36632
This CVE shouldn't have been filed as the "exploit" is described in the
documentation as how the library behaves.

(From OE-Core rev: b66a677b76c7f15eb5c426f8dc7ac42e1e2e3f40)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c652f094d86c4efb7ff99accba63b8169493ab18)
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
Hitendra Prajapati
91feb9b975 ruby/cgi-gem: CVE-2021-33621 HTTP response splitting in CGI
Upstream-Status: Backport from 64c5045c0a

(From OE-Core rev: dfe4a2b601e094e2922b671f6cf73ff6a91f061f)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-08-16 03:55:12 -10:00
94 changed files with 12759 additions and 2431 deletions

View File

@@ -1,13 +1,13 @@
DISTRO : "3.1.27"
DISTRO : "3.1.28"
DISTRO_NAME_NO_CAP : "dunfell"
DISTRO_NAME : "Dunfell"
DISTRO_NAME_NO_CAP_MINUS_ONE : "zeus"
YOCTO_DOC_VERSION : "3.1.27"
YOCTO_DOC_VERSION : "3.1.28"
YOCTO_DOC_VERSION_MINUS_ONE : "3.0.4"
DISTRO_REL_TAG : "yocto-3.1.27"
DOCCONF_VERSION : "3.1.27"
DISTRO_REL_TAG : "yocto-3.1.28"
DOCCONF_VERSION : "3.1.28"
BITBAKE_SERIES : "1.46"
POKYVERSION : "23.0.27"
POKYVERSION : "23.0.28"
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"

View File

@@ -34,19 +34,35 @@ and conceptual information in the :doc:`../overview-manual/overview-manual`.
Supported Linux Distributions
=============================
Currently, the Yocto Project is supported on the following
distributions:
Currently, the &DISTRO; release ("&DISTRO_NAME;") of the Yocto Project is
supported on the following distributions:
- Ubuntu 16.04 (LTS)
- Ubuntu 20.04 (LTS)
- Ubuntu 22.04 (LTS)
- Fedora 37
- Debian GNU/Linux 11.x (Bullseye)
- AlmaLinux 8.8
The following distribution versions are still tested (being listed
in :term:`SANITY_TESTED_DISTROS`), even though the organizations
publishing them no longer make updates publicly available:
- Ubuntu 18.04 (LTS)
- OpenSUSE Leap 15.3
Finally, here are the distribution versions which were previously
tested on former revisions of "&DISTRO_NAME;", but no longer are:
- Ubuntu 16.04 (LTS)
- Ubuntu 19.04
- Ubuntu 20.04
- Ubuntu 22.04
- Fedora 28
- Fedora 29
@@ -67,20 +83,18 @@ distributions:
- CentOS 7.x
- CentOS 8.x
- Debian GNU/Linux 8.x (Jessie)
- Debian GNU/Linux 9.x (Stretch)
- Debian GNU/Linux 10.x (Buster)
- Debian GNU/Linux 11.x (Bullseye)
- OpenSUSE Leap 15.1
- OpenSUSE Leap 15.2
- OpenSUSE Leap 15.3
- AlmaLinux 8.5
- AlmaLinux 8.7

View File

@@ -1,6 +1,6 @@
DISTRO = "poky"
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
DISTRO_VERSION = "3.1.27"
DISTRO_VERSION = "3.1.28"
DISTRO_CODENAME = "dunfell"
SDK_VENDOR = "-pokysdk"
SDK_VERSION = "${@d.getVar('DISTRO_VERSION').replace('snapshot-${DATE}', 'snapshot')}"
@@ -43,29 +43,13 @@ SANITY_TESTED_DISTROS ?= " \
poky-2.7 \n \
poky-3.0 \n \
poky-3.1 \n \
ubuntu-16.04 \n \
ubuntu-18.04 \n \
ubuntu-19.04 \n \
ubuntu-20.04 \n \
ubuntu-22.04 \n \
fedora-30 \n \
fedora-31 \n \
fedora-32 \n \
fedora-33 \n \
fedora-34 \n \
fedora-35 \n \
fedora-36 \n \
centos-7 \n \
centos-8 \n \
debian-8 \n \
debian-9 \n \
debian-10 \n \
fedora-37 \n \
debian-11 \n \
opensuseleap-15.1 \n \
opensuseleap-15.2 \n \
opensuseleap-15.3 \n \
almalinux-8.5 \n \
almalinux-8.7 \n \
almalinux-8.8 \n \
"
# add poky sanity bbclass
INHERIT += "poky-sanity"

View File

@@ -143,13 +143,14 @@ do_unpack[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILD
do_clean[cleandirs] += " ${S} ${STAGING_KERNEL_DIR} ${B} ${STAGING_KERNEL_BUILDDIR}"
python do_symlink_kernsrc () {
s = d.getVar("S")
if s[-1] == '/':
# drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as directory name and fail
s=s[:-1]
kernsrc = d.getVar("STAGING_KERNEL_DIR")
if s != kernsrc:
bb.utils.mkdirhier(kernsrc)
bb.utils.remove(kernsrc, recurse=True)
if s[-1] == '/':
# drop trailing slash, so that os.symlink(kernsrc, s) doesn't use s as
# directory name and fail
s = s[:-1]
if d.getVar("EXTERNALSRC"):
# With EXTERNALSRC S will not be wiped so we can symlink to it
os.symlink(s, kernsrc)
@@ -417,12 +418,26 @@ kernel_do_install() {
#
install -d ${D}/${KERNEL_IMAGEDEST}
install -d ${D}/boot
#
# When including an initramfs bundle inside a FIT image, the fitImage is created after the install task
# by do_assemble_fitimage_initramfs.
# This happens after the generation of the initramfs bundle (done by do_bundle_initramfs).
# So, at the level of the install task we should not try to install the fitImage. fitImage is still not
# generated yet.
# After the generation of the fitImage, the deploy task copies the fitImage from the build directory to
# the deploy folder.
#
for imageType in ${KERNEL_IMAGETYPES} ; do
install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
if [ $imageType != "fitImage" ] || [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ] ; then
install -m 0644 ${KERNEL_OUTPUT_DIR}/${imageType} ${D}/${KERNEL_IMAGEDEST}/${imageType}-${KERNEL_VERSION}
if [ "${KERNEL_PACKAGE_NAME}" = "kernel" ]; then
ln -sf ${imageType}-${KERNEL_VERSION} ${D}/${KERNEL_IMAGEDEST}/${imageType}
fi
fi
done
install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}

View File

@@ -1,6 +1,6 @@
# Zap the root password if debug-tweaks feature is not enabled
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'empty-root-password' ], "", "zap_empty_root_password ; ",d)}'
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'empty-root-password' ], "", "zap_empty_root_password; ",d)}'
# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks or allow-empty-password is enabled
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-empty-password' ], "ssh_allow_empty_password; ", "",d)}'
@@ -12,7 +12,7 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'deb
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'post-install-logging' ], "postinst_enable_logging; ", "",d)}'
# Create /etc/timestamp during image construction to give a reasonably sane default time setting
ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp; "
# Tweak the mount options for rootfs in /etc/fstab if read-only-rootfs is enabled
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "read_only_rootfs_hook; ", "",d)}'
@@ -26,7 +26,7 @@ ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only
APPEND_append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro", "", d)}'
# Generates test data file with data store variables expanded in json format
ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data ; "
ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data; "
# Write manifest
IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.manifest"

View File

@@ -28,7 +28,7 @@
ROOTFS_DEBUG_FILES ?= ""
ROOTFS_DEBUG_FILES[doc] = "Lists additional files or directories to be installed with 'cp -a' in the format 'source1 target1;source2 target2;...'"
ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files ;"
ROOTFS_POSTPROCESS_COMMAND += "rootfs_debug_files;"
rootfs_debug_files () {
#!/bin/sh -e
echo "${ROOTFS_DEBUG_FILES}" | sed -e 's/;/\n/g' | while read source target mode; do

View File

@@ -6,10 +6,10 @@
# to the distro running on the build machine.
#
UNINATIVE_MAXGLIBCVERSION = "2.37"
UNINATIVE_VERSION = "4.0"
UNINATIVE_MAXGLIBCVERSION = "2.38"
UNINATIVE_VERSION = "4.3"
UNINATIVE_URL ?= "http://downloads.yoctoproject.org/releases/uninative/${UNINATIVE_VERSION}/"
UNINATIVE_CHECKSUM[aarch64] ?= "7baa8418a302df52e00916193b0a04f318356d9d2670c9a2bce3e966efefd738"
UNINATIVE_CHECKSUM[i686] ?= "83114d36883d43a521e280742b9849bf85d039b2f83d8e21d480659babe75ee8"
UNINATIVE_CHECKSUM[x86_64] ?= "fd75b2a1a67a10f6b7d65afb7d0f3e71a63b0038e428f34dfe420bb37716558a"
UNINATIVE_CHECKSUM[aarch64] ?= "8df05f4a41455018b4303b2e0ea4eac5c960b5a13713f6dbb33dfdb3e32753ec"
UNINATIVE_CHECKSUM[i686] ?= "bea76b4a97c9ba0077c0dd1295f519cd599dbf71f0ca1c964471c4cdb043addd"
UNINATIVE_CHECKSUM[x86_64] ?= "1c35f09a75c4096749bbe1e009df4e3968cde151424062cf4aa3ed89db22b030"

View File

@@ -226,6 +226,9 @@ def SSHCall(command, logger, timeout=None, **opts):
endtime = time.time() + timeout
except InterruptedError:
continue
except BlockingIOError:
logger.debug('BlockingIOError')
continue
# process hasn't returned yet
if not eof:

View File

@@ -67,7 +67,7 @@ class LtpTest(LtpTestBase):
def runltp(self, ltp_group):
cmd = '/opt/ltp/runltp -f %s -p -q -r /opt/ltp -l /opt/ltp/results/%s -I 1 -d /opt/ltp' % (ltp_group, ltp_group)
starttime = time.time()
(status, output) = self.target.run(cmd)
(status, output) = self.target.run(cmd, timeout=1200)
endtime = time.time()
with open(os.path.join(self.ltptest_log_dir, "%s-raw.log" % ltp_group), 'w') as f:

View File

@@ -57,8 +57,8 @@ class RpmBasicTest(OERuntimeTestCase):
return
time.sleep(1)
user_pss = [ps for ps in output.split("\n") if u + ' ' in ps]
msg = "There're %s 's process(es) still running: %s".format(u, "\n".join(user_pss))
assertTrue(True, msg=msg)
msg = "User %s has processes still running: %s" % (u, "\n".join(user_pss))
self.fail(msg=msg)
def unset_up_test_user(u):
# ensure no test1 process in running

View File

@@ -41,7 +41,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
with contextlib.ExitStack() as s:
# use the base work dir, as the nfs mount, since the recipe directory may not exist
tmpdir = get_bb_var("BASE_WORKDIR")
nfsport, mountport = s.enter_context(unfs_server(tmpdir))
nfsport, mountport = s.enter_context(unfs_server(tmpdir, udp = False))
# build core-image-minimal with required packages
default_installed_packages = [
@@ -61,7 +61,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
bitbake("core-image-minimal")
# start runqemu
qemu = s.enter_context(runqemu("core-image-minimal", runqemuparams = "nographic"))
qemu = s.enter_context(runqemu("core-image-minimal", runqemuparams = "nographic", qemuparams = "-m 1024"))
# validate that SSH is working
status, _ = qemu.run("uname")
@@ -70,7 +70,7 @@ class GlibcSelfTestBase(OESelftestTestCase, OEPTestResultTestCase):
# setup nfs mount
if qemu.run("mkdir -p \"{0}\"".format(tmpdir))[0] != 0:
raise Exception("Failed to setup NFS mount directory on target")
mountcmd = "mount -o noac,nfsvers=3,port={0},udp,mountport={1} \"{2}:{3}\" \"{3}\"".format(nfsport, mountport, qemu.server_ip, tmpdir)
mountcmd = "mount -o noac,nfsvers=3,port={0},mountport={1} \"{2}:{3}\" \"{3}\"".format(nfsport, mountport, qemu.server_ip, tmpdir)
status, output = qemu.run(mountcmd)
if status != 0:
raise Exception("Failed to setup NFS mount on target ({})".format(repr(output)))

View File

@@ -8,7 +8,7 @@ from oeqa.utils.commands import bitbake, get_bb_var, Command
from oeqa.utils.network import get_free_port
@contextlib.contextmanager
def unfs_server(directory, logger = None):
def unfs_server(directory, logger = None, udp = True):
unfs_sysroot = get_bb_var("RECIPE_SYSROOT_NATIVE", "unfs3-native")
if not os.path.exists(os.path.join(unfs_sysroot, "usr", "bin", "unfsd")):
# build native tool
@@ -22,7 +22,7 @@ def unfs_server(directory, logger = None):
exports.write("{0} (rw,no_root_squash,no_all_squash,insecure)\n".format(directory).encode())
# find some ports for the server
nfsport, mountport = get_free_port(udp = True), get_free_port(udp = True)
nfsport, mountport = get_free_port(udp), get_free_port(udp)
nenv = dict(os.environ)
nenv['PATH'] = "{0}/sbin:{0}/usr/sbin:{0}/usr/bin:".format(unfs_sysroot) + nenv.get('PATH', '')

View File

@@ -128,6 +128,8 @@ GRUBPLATFORM ??= "pc"
inherit autotools gettext texinfo pkgconfig
CFLAGS_remove = "-O2"
EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \
--disable-grub-mkfont \
--program-prefix="" \

View File

@@ -0,0 +1,166 @@
Upstream-Status: Backport [import from debian security.debian.org/debian-security/pool/updates/main/b/bind9/bind9_9.11.5.P4+dfsg-5.1+deb10u9.debian.tar.xz
Upstream patch https://downloads.isc.org/isc/bind9/9.16.42/patches/0001-CVE-2023-2828.patch]
Upstream Commit: https://github.com/isc-projects/bind9/commit/da0eafcdee52147e72d407cc3b9f179378ee1d3a
CVE: CVE-2023-2828
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
lib/dns/rbtdb.c | 106 +++++++++++++++++++++++++++++++++-----------------------
1 file changed, 63 insertions(+), 43 deletions(-)
diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c
index b1b928c..3165e26 100644
--- a/lib/dns/rbtdb.c
+++ b/lib/dns/rbtdb.c
@@ -792,7 +792,7 @@ static void update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
static void expire_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
bool tree_locked, expire_t reason);
static void overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start,
- isc_stdtime_t now, bool tree_locked);
+ size_t purgesize, bool tree_locked);
static isc_result_t resign_insert(dns_rbtdb_t *rbtdb, int idx,
rdatasetheader_t *newheader);
static void resign_delete(dns_rbtdb_t *rbtdb, rbtdb_version_t *version,
@@ -6784,6 +6784,16 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
static dns_dbmethods_t zone_methods;
+static size_t
+rdataset_size(rdatasetheader_t *header) {
+ if (!NONEXISTENT(header)) {
+ return (dns_rdataslab_size((unsigned char *)header,
+ sizeof(*header)));
+ }
+
+ return (sizeof(*header));
+}
+
static isc_result_t
addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
isc_stdtime_t now, dns_rdataset_t *rdataset, unsigned int options,
@@ -6932,7 +6942,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
}
if (cache_is_overmem)
- overmem_purge(rbtdb, rbtnode->locknum, now, tree_locked);
+ overmem_purge(rbtdb, rbtnode->locknum, rdataset_size(newheader),
+ tree_locked);
NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
isc_rwlocktype_write);
@@ -6947,9 +6958,14 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
cleanup_dead_nodes(rbtdb, rbtnode->locknum);
header = isc_heap_element(rbtdb->heaps[rbtnode->locknum], 1);
- if (header && header->rdh_ttl < now - RBTDB_VIRTUAL)
- expire_header(rbtdb, header, tree_locked,
- expire_ttl);
+ if (header != NULL) {
+ dns_ttl_t rdh_ttl = header->rdh_ttl;
+
+ if (rdh_ttl < now - RBTDB_VIRTUAL) {
+ expire_header(rbtdb, header, tree_locked,
+ expire_ttl);
+ }
+ }
/*
* If we've been holding a write lock on the tree just for
@@ -10388,54 +10404,58 @@ update_header(dns_rbtdb_t *rbtdb, rdatasetheader_t *header,
ISC_LIST_PREPEND(rbtdb->rdatasets[header->node->locknum], header, link);
}
+static size_t
+expire_lru_headers(dns_rbtdb_t *rbtdb, unsigned int locknum, size_t purgesize,
+ bool tree_locked) {
+ rdatasetheader_t *header, *header_prev;
+ size_t purged = 0;
+
+ for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]);
+ header != NULL && purged <= purgesize; header = header_prev)
+ {
+ header_prev = ISC_LIST_PREV(header, link);
+ /*
+ * Unlink the entry at this point to avoid checking it
+ * again even if it's currently used someone else and
+ * cannot be purged at this moment. This entry won't be
+ * referenced any more (so unlinking is safe) since the
+ * TTL was reset to 0.
+ */
+ ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header, link);
+ size_t header_size = rdataset_size(header);
+ expire_header(rbtdb, header, tree_locked, expire_lru);
+ purged += header_size;
+ }
+
+ return (purged);
+}
+
/*%
- * Purge some expired and/or stale (i.e. unused for some period) cache entries
- * under an overmem condition. To recover from this condition quickly, up to
- * 2 entries will be purged. This process is triggered while adding a new
- * entry, and we specifically avoid purging entries in the same LRU bucket as
- * the one to which the new entry will belong. Otherwise, we might purge
- * entries of the same name of different RR types while adding RRsets from a
- * single response (consider the case where we're adding A and AAAA glue records
- * of the same NS name).
- */
+ * Purge some stale (i.e. unused for some period - LRU based cleaning) cache
+ * entries under the overmem condition. To recover from this condition quickly,
+ * we cleanup entries up to the size of newly added rdata (passed as purgesize).
+ *
+ * This process is triggered while adding a new entry, and we specifically avoid
+ * purging entries in the same LRU bucket as the one to which the new entry will
+ * belong. Otherwise, we might purge entries of the same name of different RR
+ * types while adding RRsets from a single response (consider the case where
+ * we're adding A and AAAA glue records of the same NS name).
+*/
static void
-overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start,
- isc_stdtime_t now, bool tree_locked)
+overmem_purge(dns_rbtdb_t *rbtdb, unsigned int locknum_start, size_t purgesize,
+ bool tree_locked)
{
- rdatasetheader_t *header, *header_prev;
unsigned int locknum;
- int purgecount = 2;
+ size_t purged = 0;
for (locknum = (locknum_start + 1) % rbtdb->node_lock_count;
- locknum != locknum_start && purgecount > 0;
+ locknum != locknum_start && purged <= purgesize;
locknum = (locknum + 1) % rbtdb->node_lock_count) {
NODE_LOCK(&rbtdb->node_locks[locknum].lock,
isc_rwlocktype_write);
- header = isc_heap_element(rbtdb->heaps[locknum], 1);
- if (header && header->rdh_ttl < now - RBTDB_VIRTUAL) {
- expire_header(rbtdb, header, tree_locked,
- expire_ttl);
- purgecount--;
- }
-
- for (header = ISC_LIST_TAIL(rbtdb->rdatasets[locknum]);
- header != NULL && purgecount > 0;
- header = header_prev) {
- header_prev = ISC_LIST_PREV(header, link);
- /*
- * Unlink the entry at this point to avoid checking it
- * again even if it's currently used someone else and
- * cannot be purged at this moment. This entry won't be
- * referenced any more (so unlinking is safe) since the
- * TTL was reset to 0.
- */
- ISC_LIST_UNLINK(rbtdb->rdatasets[locknum], header,
- link);
- expire_header(rbtdb, header, tree_locked,
- expire_lru);
- purgecount--;
- }
+ purged += expire_lru_headers(rbtdb, locknum, purgesize - purged,
+ tree_locked);
NODE_UNLOCK(&rbtdb->node_locks[locknum].lock,
isc_rwlocktype_write);

View File

@@ -22,6 +22,7 @@ SRC_URI = "https://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \
file://CVE-2022-2795.patch \
file://CVE-2022-38177.patch \
file://CVE-2022-38178.patch \
file://CVE-2023-2828.patch \
"
SRC_URI[sha256sum] = "0d8efbe7ec166ada90e46add4267b7e7c934790cba9bd5af6b8380a4fbfb5aff"

View File

@@ -0,0 +1,283 @@
From 703418fe9d2e3b1e8d594df5788d8001a8116265 Mon Sep 17 00:00:00 2001
From: Jeffrey Bencteux <jeffbencteux@gmail.com>
Date: Fri, 30 Jun 2023 19:02:45 +0200
Subject: [PATCH] CVE-2023-40303: ftpd,rcp,rlogin,rsh,rshd,uucpd: fix: check
set*id() return values
Several setuid(), setgid(), seteuid() and setguid() return values
were not checked in ftpd/rcp/rlogin/rsh/rshd/uucpd code potentially
leading to potential security issues.
CVE: CVE-2023-40303
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=e4e65c03f4c11292a3e40ef72ca3f194c8bffdd6]
Signed-off-by: Jeffrey Bencteux <jeffbencteux@gmail.com>
Signed-off-by: Simon Josefsson <simon@josefsson.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
ftpd/ftpd.c | 10 +++++++---
src/rcp.c | 39 +++++++++++++++++++++++++++++++++------
src/rlogin.c | 11 +++++++++--
src/rsh.c | 25 +++++++++++++++++++++----
src/rshd.c | 20 +++++++++++++++++---
src/uucpd.c | 15 +++++++++++++--
6 files changed, 100 insertions(+), 20 deletions(-)
diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c
index 5db88d0..b52b122 100644
--- a/ftpd/ftpd.c
+++ b/ftpd/ftpd.c
@@ -862,7 +862,9 @@ end_login (struct credentials *pcred)
char *remotehost = pcred->remotehost;
int atype = pcred->auth_type;
- seteuid ((uid_t) 0);
+ if (seteuid ((uid_t) 0) == -1)
+ _exit (EXIT_FAILURE);
+
if (pcred->logged_in)
{
logwtmp_keep_open (ttyline, "", "");
@@ -1151,7 +1153,8 @@ getdatasock (const char *mode)
if (data >= 0)
return fdopen (data, mode);
- seteuid ((uid_t) 0);
+ if (seteuid ((uid_t) 0) == -1)
+ _exit (EXIT_FAILURE);
s = socket (ctrl_addr.ss_family, SOCK_STREAM, 0);
if (s < 0)
goto bad;
@@ -1978,7 +1981,8 @@ passive (int epsv, int af)
else /* !AF_INET6 */
((struct sockaddr_in *) &pasv_addr)->sin_port = 0;
- seteuid ((uid_t) 0);
+ if (seteuid ((uid_t) 0) == -1)
+ _exit (EXIT_FAILURE);
if (bind (pdata, (struct sockaddr *) &pasv_addr, pasv_addrlen) < 0)
{
if (seteuid ((uid_t) cred.uid))
diff --git a/src/rcp.c b/src/rcp.c
index bafa35f..366295c 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -347,14 +347,23 @@ main (int argc, char *argv[])
if (from_option)
{ /* Follow "protocol", send data. */
response ();
- setuid (userid);
+
+ if (setuid (userid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
+
source (argc, argv);
exit (errs);
}
if (to_option)
{ /* Receive data. */
- setuid (userid);
+ if (setuid (userid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
+
sink (argc, argv);
exit (errs);
}
@@ -539,7 +548,11 @@ toremote (char *targ, int argc, char *argv[])
if (response () < 0)
exit (EXIT_FAILURE);
free (bp);
- setuid (userid);
+
+ if (setuid (userid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
}
source (1, argv + i);
close (rem);
@@ -634,7 +647,12 @@ tolocal (int argc, char *argv[])
++errs;
continue;
}
- seteuid (userid);
+
+ if (seteuid (userid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
+ }
+
#if defined IP_TOS && defined IPPROTO_IP && defined IPTOS_THROUGHPUT
sslen = sizeof (ss);
(void) getpeername (rem, (struct sockaddr *) &ss, &sslen);
@@ -647,7 +665,12 @@ tolocal (int argc, char *argv[])
#endif
vect[0] = target;
sink (1, vect);
- seteuid (effuid);
+
+ if (seteuid (effuid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
+ }
+
close (rem);
rem = -1;
#ifdef SHISHI
@@ -1453,7 +1476,11 @@ susystem (char *s, int userid)
return (127);
case 0:
- setuid (userid);
+ if (setuid (userid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
+
execl (PATH_BSHELL, "sh", "-c", s, NULL);
_exit (127);
}
diff --git a/src/rlogin.c b/src/rlogin.c
index e5e11a7..6b38901 100644
--- a/src/rlogin.c
+++ b/src/rlogin.c
@@ -649,8 +649,15 @@ try_connect:
/* Now change to the real user ID. We have to be set-user-ID root
to get the privileged port that rcmd () uses. We now want, however,
to run as the real user who invoked us. */
- seteuid (uid);
- setuid (uid);
+ if (seteuid (uid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
+ }
+
+ if (setuid (uid) == -1)
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
doit (&osmask); /* The old mask will activate SIGURG and SIGUSR1! */
diff --git a/src/rsh.c b/src/rsh.c
index bd70372..b451a70 100644
--- a/src/rsh.c
+++ b/src/rsh.c
@@ -278,8 +278,17 @@ main (int argc, char **argv)
{
if (asrsh)
*argv = (char *) "rlogin";
- seteuid (getuid ());
- setuid (getuid ());
+
+ if (seteuid (getuid ()) == -1)
+ {
+ error (EXIT_FAILURE, errno, "seteuid() failed");
+ }
+
+ if (setuid (getuid ()) == -1)
+ {
+ error (EXIT_FAILURE, errno, "setuid() failed");
+ }
+
execv (PATH_RLOGIN, argv);
error (EXIT_FAILURE, errno, "cannot execute %s", PATH_RLOGIN);
}
@@ -543,8 +552,16 @@ try_connect:
error (0, errno, "setsockopt DEBUG (ignored)");
}
- seteuid (uid);
- setuid (uid);
+ if (seteuid (uid) == -1)
+ {
+ error (EXIT_FAILURE, errno, "seteuid() failed");
+ }
+
+ if (setuid (uid) == -1)
+ {
+ error (EXIT_FAILURE, errno, "setuid() failed");
+ }
+
#ifdef HAVE_SIGACTION
sigemptyset (&sigs);
sigaddset (&sigs, SIGINT);
diff --git a/src/rshd.c b/src/rshd.c
index b824a10..8cdcd06 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -1848,8 +1848,18 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
pwd->pw_shell = PATH_BSHELL;
/* Set the gid, then uid to become the user specified by "locuser" */
- setegid ((gid_t) pwd->pw_gid);
- setgid ((gid_t) pwd->pw_gid);
+ if (setegid ((gid_t) pwd->pw_gid) == -1)
+ {
+ rshd_error ("Cannot drop privileges (setegid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
+
+ if (setgid ((gid_t) pwd->pw_gid) == -1)
+ {
+ rshd_error ("Cannot drop privileges (setgid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
+
#ifdef HAVE_INITGROUPS
initgroups (pwd->pw_name, pwd->pw_gid); /* BSD groups */
#endif
@@ -1871,7 +1881,11 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
}
#endif /* WITH_PAM */
- setuid ((uid_t) pwd->pw_uid);
+ if (setuid ((uid_t) pwd->pw_uid) == -1)
+ {
+ rshd_error ("Cannot drop privileges (setuid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
/* We'll execute the client's command in the home directory
* of locuser. Note, that the chdir must be executed after
diff --git a/src/uucpd.c b/src/uucpd.c
index 55c3d44..6aba294 100644
--- a/src/uucpd.c
+++ b/src/uucpd.c
@@ -254,7 +254,12 @@ doit (struct sockaddr *sap, socklen_t salen)
sprintf (Username, "USER=%s", user);
sprintf (Logname, "LOGNAME=%s", user);
dologin (pw, sap, salen);
- setgid (pw->pw_gid);
+
+ if (setgid (pw->pw_gid) == -1)
+ {
+ fprintf (stderr, "setgid() failed");
+ return;
+ }
#ifdef HAVE_INITGROUPS
initgroups (pw->pw_name, pw->pw_gid);
#endif
@@ -263,7 +268,13 @@ doit (struct sockaddr *sap, socklen_t salen)
fprintf (stderr, "Login incorrect.");
return;
}
- setuid (pw->pw_uid);
+
+ if (setuid (pw->pw_uid) == -1)
+ {
+ fprintf (stderr, "setuid() failed");
+ return;
+ }
+
execl (uucico_location, "uucico", NULL);
perror ("uucico server: execl");
}
--
2.25.1

View File

@@ -0,0 +1,254 @@
From 70fe022f9dac760eaece0228cad17e3d29a57fb8 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon@josefsson.org>
Date: Mon, 31 Jul 2023 13:59:05 +0200
Subject: [PATCH] CVE-2023-40303: Indent changes in previous commit.
CVE: CVE-2023-40303
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=9122999252c7e21eb7774de11d539748e7bdf46d]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
src/rcp.c | 42 ++++++++++++++++++++++++------------------
src/rlogin.c | 12 ++++++------
src/rsh.c | 24 ++++++++++++------------
src/rshd.c | 24 ++++++++++++------------
src/uucpd.c | 16 ++++++++--------
5 files changed, 62 insertions(+), 56 deletions(-)
diff --git a/src/rcp.c b/src/rcp.c
index cdcf8500..652f22e6 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -347,9 +347,10 @@ main (int argc, char *argv[])
response ();
if (setuid (userid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (setuid() failed)");
+ }
source (argc, argv);
exit (errs);
@@ -358,9 +359,10 @@ main (int argc, char *argv[])
if (to_option)
{ /* Receive data. */
if (setuid (userid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (setuid() failed)");
+ }
sink (argc, argv);
exit (errs);
@@ -548,9 +550,10 @@ toremote (char *targ, int argc, char *argv[])
free (bp);
if (setuid (userid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (setuid() failed)");
+ }
}
source (1, argv + i);
close (rem);
@@ -645,9 +648,10 @@ tolocal (int argc, char *argv[])
}
if (seteuid (userid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (seteuid() failed)");
+ }
#if defined IP_TOS && defined IPPROTO_IP && defined IPTOS_THROUGHPUT
sslen = sizeof (ss);
@@ -663,9 +667,10 @@ tolocal (int argc, char *argv[])
sink (1, vect);
if (seteuid (effuid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (seteuid() failed)");
+ }
close (rem);
rem = -1;
@@ -1465,9 +1470,10 @@ susystem (char *s, int userid)
case 0:
if (setuid (userid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0,
+ "Could not drop privileges (setuid() failed)");
+ }
execl (PATH_BSHELL, "sh", "-c", s, NULL);
_exit (127);
diff --git a/src/rlogin.c b/src/rlogin.c
index c543de0c..4360202f 100644
--- a/src/rlogin.c
+++ b/src/rlogin.c
@@ -648,14 +648,14 @@ try_connect:
to get the privileged port that rcmd () uses. We now want, however,
to run as the real user who invoked us. */
if (seteuid (uid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (seteuid() failed)");
+ }
if (setuid (uid) == -1)
- {
- error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
- }
+ {
+ error (EXIT_FAILURE, 0, "Could not drop privileges (setuid() failed)");
+ }
doit (&osmask); /* The old mask will activate SIGURG and SIGUSR1! */
diff --git a/src/rsh.c b/src/rsh.c
index 6f60667d..179b47cd 100644
--- a/src/rsh.c
+++ b/src/rsh.c
@@ -278,14 +278,14 @@ main (int argc, char **argv)
*argv = (char *) "rlogin";
if (seteuid (getuid ()) == -1)
- {
- error (EXIT_FAILURE, errno, "seteuid() failed");
- }
+ {
+ error (EXIT_FAILURE, errno, "seteuid() failed");
+ }
if (setuid (getuid ()) == -1)
- {
- error (EXIT_FAILURE, errno, "setuid() failed");
- }
+ {
+ error (EXIT_FAILURE, errno, "setuid() failed");
+ }
execv (PATH_RLOGIN, argv);
error (EXIT_FAILURE, errno, "cannot execute %s", PATH_RLOGIN);
@@ -551,14 +551,14 @@ try_connect:
}
if (seteuid (uid) == -1)
- {
- error (EXIT_FAILURE, errno, "seteuid() failed");
- }
+ {
+ error (EXIT_FAILURE, errno, "seteuid() failed");
+ }
if (setuid (uid) == -1)
- {
- error (EXIT_FAILURE, errno, "setuid() failed");
- }
+ {
+ error (EXIT_FAILURE, errno, "setuid() failed");
+ }
#ifdef HAVE_SIGACTION
sigemptyset (&sigs);
diff --git a/src/rshd.c b/src/rshd.c
index 707790e7..3a153a18 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -1848,16 +1848,16 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
/* Set the gid, then uid to become the user specified by "locuser" */
if (setegid ((gid_t) pwd->pw_gid) == -1)
- {
- rshd_error ("Cannot drop privileges (setegid() failed)\n");
- exit (EXIT_FAILURE);
- }
+ {
+ rshd_error ("Cannot drop privileges (setegid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
if (setgid ((gid_t) pwd->pw_gid) == -1)
- {
- rshd_error ("Cannot drop privileges (setgid() failed)\n");
- exit (EXIT_FAILURE);
- }
+ {
+ rshd_error ("Cannot drop privileges (setgid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
#ifdef HAVE_INITGROUPS
initgroups (pwd->pw_name, pwd->pw_gid); /* BSD groups */
@@ -1881,10 +1881,10 @@ doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
#endif /* WITH_PAM */
if (setuid ((uid_t) pwd->pw_uid) == -1)
- {
- rshd_error ("Cannot drop privileges (setuid() failed)\n");
- exit (EXIT_FAILURE);
- }
+ {
+ rshd_error ("Cannot drop privileges (setuid() failed)\n");
+ exit (EXIT_FAILURE);
+ }
/* We'll execute the client's command in the home directory
* of locuser. Note, that the chdir must be executed after
diff --git a/src/uucpd.c b/src/uucpd.c
index 29cfce35..fde7b9c9 100644
--- a/src/uucpd.c
+++ b/src/uucpd.c
@@ -254,10 +254,10 @@ doit (struct sockaddr *sap, socklen_t salen)
dologin (pw, sap, salen);
if (setgid (pw->pw_gid) == -1)
- {
- fprintf (stderr, "setgid() failed");
- return;
- }
+ {
+ fprintf (stderr, "setgid() failed");
+ return;
+ }
#ifdef HAVE_INITGROUPS
initgroups (pw->pw_name, pw->pw_gid);
#endif
@@ -268,10 +268,10 @@ doit (struct sockaddr *sap, socklen_t salen)
}
if (setuid (pw->pw_uid) == -1)
- {
- fprintf (stderr, "setuid() failed");
- return;
- }
+ {
+ fprintf (stderr, "setuid() failed");
+ return;
+ }
execl (uucico_location, "uucico", NULL);
perror ("uucico server: execl");

View File

@@ -25,6 +25,8 @@ SRC_URI = "${GNU_MIRROR}/inetutils/inetutils-${PV}.tar.gz \
file://fix-buffer-fortify-tfpt.patch \
file://CVE-2021-40491.patch \
file://CVE-2022-39028.patch \
file://0001-CVE-2023-40303-ftpd-rcp-rlogin-rsh-rshd-uucpd-fix-ch.patch \
file://0002-CVE-2023-40303-Indent-changes-in-previous-commit.patch \
"
SRC_URI[md5sum] = "04852c26c47cc8c6b825f2b74f191f52"

View File

@@ -0,0 +1,189 @@
From f6213e03887237714eb5bcfc9089c707069f87c5 Mon Sep 17 00:00:00 2001
From: Damien Miller <djm@mindrot.org>
Date: Fri, 1 Oct 2021 16:35:49 +1000
Subject: [PATCH 01/12] make OPENSSL_HAS_ECC checks more thorough
ok dtucker
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/dee22129bbc61e25b1003adfa2bc584c5406ef2d]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-pkcs11-client.c | 16 ++++++++--------
ssh-pkcs11.c | 26 +++++++++++++-------------
2 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 8a0ffef..41114c7 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -163,7 +163,7 @@ rsa_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, int padding)
return (ret);
}
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
static ECDSA_SIG *
ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
const BIGNUM *rp, EC_KEY *ec)
@@ -220,12 +220,12 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
sshbuf_free(msg);
return (ret);
}
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
static RSA_METHOD *helper_rsa;
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
static EC_KEY_METHOD *helper_ecdsa;
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
/* redirect private key crypto operations to the ssh-pkcs11-helper */
static void
@@ -233,10 +233,10 @@ wrap_key(struct sshkey *k)
{
if (k->type == KEY_RSA)
RSA_set_method(k->rsa, helper_rsa);
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
else if (k->type == KEY_ECDSA)
EC_KEY_set_method(k->ecdsa, helper_ecdsa);
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
else
fatal("%s: unknown key type", __func__);
}
@@ -247,7 +247,7 @@ pkcs11_start_helper_methods(void)
if (helper_rsa != NULL)
return (0);
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
int (*orig_sign)(int, const unsigned char *, int, unsigned char *,
unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) = NULL;
if (helper_ecdsa != NULL)
@@ -257,7 +257,7 @@ pkcs11_start_helper_methods(void)
return (-1);
EC_KEY_METHOD_get_sign(helper_ecdsa, &orig_sign, NULL, NULL);
EC_KEY_METHOD_set_sign(helper_ecdsa, orig_sign, NULL, ecdsa_do_sign);
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == NULL)
fatal("%s: RSA_meth_dup failed", __func__);
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index a302c79..b56a41b 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -78,7 +78,7 @@ struct pkcs11_key {
int pkcs11_interactive = 0;
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
static void
ossl_error(const char *msg)
{
@@ -89,7 +89,7 @@ ossl_error(const char *msg)
error("%s: libcrypto error: %.100s", __func__,
ERR_error_string(e, NULL));
}
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
int
pkcs11_init(int interactive)
@@ -190,10 +190,10 @@ pkcs11_del_provider(char *provider_id)
static RSA_METHOD *rsa_method;
static int rsa_idx = 0;
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
static EC_KEY_METHOD *ec_key_method;
static int ec_key_idx = 0;
-#endif
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
/* release a wrapped object */
static void
@@ -492,7 +492,7 @@ pkcs11_rsa_wrap(struct pkcs11_provider *provider, CK_ULONG slotidx,
return (0);
}
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
/* openssl callback doing the actual signing operation */
static ECDSA_SIG *
ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
@@ -604,7 +604,7 @@ pkcs11_ecdsa_wrap(struct pkcs11_provider *provider, CK_ULONG slotidx,
return (0);
}
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
/* remove trailing spaces */
static void
@@ -679,7 +679,7 @@ pkcs11_key_included(struct sshkey ***keysp, int *nkeys, struct sshkey *key)
return (0);
}
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
static struct sshkey *
pkcs11_fetch_ecdsa_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
CK_OBJECT_HANDLE *obj)
@@ -802,7 +802,7 @@ fail:
return (key);
}
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
static struct sshkey *
pkcs11_fetch_rsa_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
@@ -910,7 +910,7 @@ pkcs11_fetch_x509_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
#endif
struct sshkey *key = NULL;
int i;
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
int nid;
#endif
const u_char *cp;
@@ -999,7 +999,7 @@ pkcs11_fetch_x509_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
key->type = KEY_RSA;
key->flags |= SSHKEY_FLAG_EXT;
rsa = NULL; /* now owned by key */
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
} else if (EVP_PKEY_base_id(evp) == EVP_PKEY_EC) {
if (EVP_PKEY_get0_EC_KEY(evp) == NULL) {
error("invalid x509; no ec key");
@@ -1030,7 +1030,7 @@ pkcs11_fetch_x509_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx,
key->type = KEY_ECDSA;
key->flags |= SSHKEY_FLAG_EXT;
ec = NULL; /* now owned by key */
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
} else {
error("unknown certificate key type");
goto out;
@@ -1237,11 +1237,11 @@ pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx,
case CKK_RSA:
key = pkcs11_fetch_rsa_pubkey(p, slotidx, &obj);
break;
-#ifdef HAVE_EC_KEY_METHOD_NEW
+#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
case CKK_ECDSA:
key = pkcs11_fetch_ecdsa_pubkey(p, slotidx, &obj);
break;
-#endif /* HAVE_EC_KEY_METHOD_NEW */
+#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
default:
/* XXX print key type? */
key = NULL;
--
2.41.0

View File

@@ -0,0 +1,581 @@
From 92cebfbcc221c9ef3f6bbb78da3d7699c0ae56be Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Wed, 19 Jul 2023 14:03:45 +0000
Subject: [PATCH 02/12] upstream: Separate ssh-pkcs11-helpers for each p11
module
Make ssh-pkcs11-client start an independent helper for each provider,
providing better isolation between modules and reliability if a single
module misbehaves.
This also implements reference counting of PKCS#11-hosted keys,
allowing ssh-pkcs11-helper subprocesses to be automatically reaped
when no remaining keys reference them. This fixes some bugs we have
that make PKCS11 keys unusable after they have been deleted, e.g.
https://bugzilla.mindrot.org/show_bug.cgi?id=3125
ok markus@
OpenBSD-Commit-ID: 0ce188b14fe271ab0568f4500070d96c5657244e
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/099cdf59ce1e72f55d421c8445bf6321b3004755]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-pkcs11-client.c | 372 +++++++++++++++++++++++++++++++++-----------
1 file changed, 282 insertions(+), 90 deletions(-)
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index 41114c7..4f3c6ed 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-pkcs11-client.c,v 1.16 2020/01/25 00:03:36 djm Exp $ */
+/* $OpenBSD: ssh-pkcs11-client.c,v 1.18 2023/07/19 14:03:45 djm Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
* Copyright (c) 2014 Pedro Martelletto. All rights reserved.
@@ -30,12 +30,11 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
+#include <limits.h>
#include <openssl/ecdsa.h>
#include <openssl/rsa.h>
-#include "openbsd-compat/openssl-compat.h"
-
#include "pathnames.h"
#include "xmalloc.h"
#include "sshbuf.h"
@@ -47,18 +46,140 @@
#include "ssh-pkcs11.h"
#include "ssherr.h"
+#include "openbsd-compat/openssl-compat.h"
+
/* borrows code from sftp-server and ssh-agent */
-static int fd = -1;
-static pid_t pid = -1;
+/*
+ * Maintain a list of ssh-pkcs11-helper subprocesses. These may be looked up
+ * by provider path or their unique EC/RSA METHOD pointers.
+ */
+struct helper {
+ char *path;
+ pid_t pid;
+ int fd;
+ RSA_METHOD *rsa_meth;
+ EC_KEY_METHOD *ec_meth;
+ int (*rsa_finish)(RSA *rsa);
+ void (*ec_finish)(EC_KEY *key);
+ size_t nrsa, nec; /* number of active keys of each type */
+};
+static struct helper **helpers;
+static size_t nhelpers;
+
+static struct helper *
+helper_by_provider(const char *path)
+{
+ size_t i;
+
+ for (i = 0; i < nhelpers; i++) {
+ if (helpers[i] == NULL || helpers[i]->path == NULL ||
+ helpers[i]->fd == -1)
+ continue;
+ if (strcmp(helpers[i]->path, path) == 0)
+ return helpers[i];
+ }
+ return NULL;
+}
+
+static struct helper *
+helper_by_rsa(const RSA *rsa)
+{
+ size_t i;
+ const RSA_METHOD *meth;
+
+ if ((meth = RSA_get_method(rsa)) == NULL)
+ return NULL;
+ for (i = 0; i < nhelpers; i++) {
+ if (helpers[i] != NULL && helpers[i]->rsa_meth == meth)
+ return helpers[i];
+ }
+ return NULL;
+
+}
+
+static struct helper *
+helper_by_ec(const EC_KEY *ec)
+{
+ size_t i;
+ const EC_KEY_METHOD *meth;
+
+ if ((meth = EC_KEY_get_method(ec)) == NULL)
+ return NULL;
+ for (i = 0; i < nhelpers; i++) {
+ if (helpers[i] != NULL && helpers[i]->ec_meth == meth)
+ return helpers[i];
+ }
+ return NULL;
+
+}
+
+static void
+helper_free(struct helper *helper)
+{
+ size_t i;
+ int found = 0;
+
+ if (helper == NULL)
+ return;
+ if (helper->path == NULL || helper->ec_meth == NULL ||
+ helper->rsa_meth == NULL)
+ fatal("%s: inconsistent helper", __func__);
+ debug3("%s: free helper for provider %s", __func__ , helper->path);
+ for (i = 0; i < nhelpers; i++) {
+ if (helpers[i] == helper) {
+ if (found)
+ fatal("%s: helper recorded more than once", __func__);
+ found = 1;
+ }
+ else if (found)
+ helpers[i - 1] = helpers[i];
+ }
+ if (found) {
+ helpers = xrecallocarray(helpers, nhelpers,
+ nhelpers - 1, sizeof(*helpers));
+ nhelpers--;
+ }
+ free(helper->path);
+ EC_KEY_METHOD_free(helper->ec_meth);
+ RSA_meth_free(helper->rsa_meth);
+ free(helper);
+}
+
+static void
+helper_terminate(struct helper *helper)
+{
+ if (helper == NULL) {
+ return;
+ } else if (helper->fd == -1) {
+ debug3("%s: already terminated", __func__);
+ } else {
+ debug3("terminating helper for %s; "
+ "remaining %zu RSA %zu ECDSA", __func__,
+ helper->path, helper->nrsa, helper->nec);
+ close(helper->fd);
+ /* XXX waitpid() */
+ helper->fd = -1;
+ helper->pid = -1;
+ }
+ /*
+ * Don't delete the helper entry until there are no remaining keys
+ * that reference it. Otherwise, any signing operation would call
+ * a free'd METHOD pointer and that would be bad.
+ */
+ if (helper->nrsa == 0 && helper->nec == 0)
+ helper_free(helper);
+}
static void
-send_msg(struct sshbuf *m)
+send_msg(int fd, struct sshbuf *m)
{
u_char buf[4];
size_t mlen = sshbuf_len(m);
int r;
+ if (fd == -1)
+ return;
POKE_U32(buf, mlen);
if (atomicio(vwrite, fd, buf, 4) != 4 ||
atomicio(vwrite, fd, sshbuf_mutable_ptr(m),
@@ -69,12 +190,15 @@ send_msg(struct sshbuf *m)
}
static int
-recv_msg(struct sshbuf *m)
+recv_msg(int fd, struct sshbuf *m)
{
u_int l, len;
u_char c, buf[1024];
int r;
+ sshbuf_reset(m);
+ if (fd == -1)
+ return 0; /* XXX */
if ((len = atomicio(read, fd, buf, 4)) != 4) {
error("read from helper failed: %u", len);
return (0); /* XXX */
@@ -83,7 +207,6 @@ recv_msg(struct sshbuf *m)
if (len > 256 * 1024)
fatal("response too long: %u", len);
/* read len bytes into m */
- sshbuf_reset(m);
while (len > 0) {
l = len;
if (l > sizeof(buf))
@@ -104,14 +227,17 @@ recv_msg(struct sshbuf *m)
int
pkcs11_init(int interactive)
{
- return (0);
+ return 0;
}
void
pkcs11_terminate(void)
{
- if (fd >= 0)
- close(fd);
+ size_t i;
+
+ debug3("%s: terminating %zu helpers", __func__, nhelpers);
+ for (i = 0; i < nhelpers; i++)
+ helper_terminate(helpers[i]);
}
static int
@@ -122,7 +248,11 @@ rsa_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, int padding)
u_char *blob = NULL, *signature = NULL;
size_t blen, slen = 0;
int r, ret = -1;
+ struct helper *helper;
+ if ((helper = helper_by_rsa(rsa)) == NULL || helper->fd == -1)
+ fatal("%s: no helper for PKCS11 key", __func__);
+ debug3("%s: signing with PKCS11 provider %s", __func__, helper->path);
if (padding != RSA_PKCS1_PADDING)
goto fail;
key = sshkey_new(KEY_UNSPEC);
@@ -144,10 +274,10 @@ rsa_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, int padding)
(r = sshbuf_put_string(msg, from, flen)) != 0 ||
(r = sshbuf_put_u32(msg, 0)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
- send_msg(msg);
+ send_msg(helper->fd, msg);
sshbuf_reset(msg);
- if (recv_msg(msg) == SSH2_AGENT_SIGN_RESPONSE) {
+ if (recv_msg(helper->fd, msg) == SSH2_AGENT_SIGN_RESPONSE) {
if ((r = sshbuf_get_string(msg, &signature, &slen)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
if (slen <= (size_t)RSA_size(rsa)) {
@@ -163,7 +293,26 @@ rsa_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, int padding)
return (ret);
}
-#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
+static int
+rsa_finish(RSA *rsa)
+{
+ struct helper *helper;
+
+ if ((helper = helper_by_rsa(rsa)) == NULL)
+ fatal("%s: no helper for PKCS11 key", __func__);
+ debug3("%s: free PKCS11 RSA key for provider %s", __func__, helper->path);
+ if (helper->rsa_finish != NULL)
+ helper->rsa_finish(rsa);
+ if (helper->nrsa == 0)
+ fatal("%s: RSA refcount error", __func__);
+ helper->nrsa--;
+ debug3("%s: provider %s remaining keys: %zu RSA %zu ECDSA", __func__,
+ helper->path, helper->nrsa, helper->nec);
+ if (helper->nrsa == 0 && helper->nec == 0)
+ helper_terminate(helper);
+ return 1;
+}
+
static ECDSA_SIG *
ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
const BIGNUM *rp, EC_KEY *ec)
@@ -175,7 +324,11 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
u_char *blob = NULL, *signature = NULL;
size_t blen, slen = 0;
int r, nid;
+ struct helper *helper;
+ if ((helper = helper_by_ec(ec)) == NULL || helper->fd == -1)
+ fatal("%s: no helper for PKCS11 key", __func__);
+ debug3("%s: signing with PKCS11 provider %s", __func__, helper->path);
nid = sshkey_ecdsa_key_to_nid(ec);
if (nid < 0) {
error("%s: couldn't get curve nid", __func__);
@@ -203,10 +356,10 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
(r = sshbuf_put_string(msg, dgst, dgst_len)) != 0 ||
(r = sshbuf_put_u32(msg, 0)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
- send_msg(msg);
+ send_msg(helper->fd, msg);
sshbuf_reset(msg);
- if (recv_msg(msg) == SSH2_AGENT_SIGN_RESPONSE) {
+ if (recv_msg(helper->fd, msg) == SSH2_AGENT_SIGN_RESPONSE) {
if ((r = sshbuf_get_string(msg, &signature, &slen)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
cp = signature;
@@ -220,75 +373,110 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len, const BIGNUM *inv,
sshbuf_free(msg);
return (ret);
}
-#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
-static RSA_METHOD *helper_rsa;
-#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
-static EC_KEY_METHOD *helper_ecdsa;
-#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
+static void
+ecdsa_do_finish(EC_KEY *ec)
+{
+ struct helper *helper;
+
+ if ((helper = helper_by_ec(ec)) == NULL)
+ fatal("%s: no helper for PKCS11 key", __func__);
+ debug3("%s: free PKCS11 ECDSA key for provider %s", __func__, helper->path);
+ if (helper->ec_finish != NULL)
+ helper->ec_finish(ec);
+ if (helper->nec == 0)
+ fatal("%s: ECDSA refcount error", __func__);
+ helper->nec--;
+ debug3("%s: provider %s remaining keys: %zu RSA %zu ECDSA", __func__,
+ helper->path, helper->nrsa, helper->nec);
+ if (helper->nrsa == 0 && helper->nec == 0)
+ helper_terminate(helper);
+}
/* redirect private key crypto operations to the ssh-pkcs11-helper */
static void
-wrap_key(struct sshkey *k)
+wrap_key(struct helper *helper, struct sshkey *k)
{
- if (k->type == KEY_RSA)
- RSA_set_method(k->rsa, helper_rsa);
-#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
- else if (k->type == KEY_ECDSA)
- EC_KEY_set_method(k->ecdsa, helper_ecdsa);
-#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
- else
+ debug3("%s: wrap %s for provider %s", __func__, sshkey_type(k), helper->path);
+ if (k->type == KEY_RSA) {
+ RSA_set_method(k->rsa, helper->rsa_meth);
+ if (helper->nrsa++ >= INT_MAX)
+ fatal("%s: RSA refcount error", __func__);
+ } else if (k->type == KEY_ECDSA) {
+ EC_KEY_set_method(k->ecdsa, helper->ec_meth);
+ if (helper->nec++ >= INT_MAX)
+ fatal("%s: EC refcount error", __func__);
+ } else
fatal("%s: unknown key type", __func__);
+ k->flags |= SSHKEY_FLAG_EXT;
+ debug3("%s: provider %s remaining keys: %zu RSA %zu ECDSA", __func__,
+ helper->path, helper->nrsa, helper->nec);
}
static int
-pkcs11_start_helper_methods(void)
+pkcs11_start_helper_methods(struct helper *helper)
{
- if (helper_rsa != NULL)
- return (0);
-
-#if defined(OPENSSL_HAS_ECC) && defined(HAVE_EC_KEY_METHOD_NEW)
- int (*orig_sign)(int, const unsigned char *, int, unsigned char *,
+ int (*ec_init)(EC_KEY *key);
+ int (*ec_copy)(EC_KEY *dest, const EC_KEY *src);
+ int (*ec_set_group)(EC_KEY *key, const EC_GROUP *grp);
+ int (*ec_set_private)(EC_KEY *key, const BIGNUM *priv_key);
+ int (*ec_set_public)(EC_KEY *key, const EC_POINT *pub_key);
+ int (*ec_sign)(int, const unsigned char *, int, unsigned char *,
unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) = NULL;
- if (helper_ecdsa != NULL)
- return (0);
- helper_ecdsa = EC_KEY_METHOD_new(EC_KEY_OpenSSL());
- if (helper_ecdsa == NULL)
- return (-1);
- EC_KEY_METHOD_get_sign(helper_ecdsa, &orig_sign, NULL, NULL);
- EC_KEY_METHOD_set_sign(helper_ecdsa, orig_sign, NULL, ecdsa_do_sign);
-#endif /* OPENSSL_HAS_ECC && HAVE_EC_KEY_METHOD_NEW */
-
- if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == NULL)
+ RSA_METHOD *rsa_meth;
+ EC_KEY_METHOD *ec_meth;
+
+ if ((ec_meth = EC_KEY_METHOD_new(EC_KEY_OpenSSL())) == NULL)
+ return -1;
+ EC_KEY_METHOD_get_sign(ec_meth, &ec_sign, NULL, NULL);
+ EC_KEY_METHOD_set_sign(ec_meth, ec_sign, NULL, ecdsa_do_sign);
+ EC_KEY_METHOD_get_init(ec_meth, &ec_init, &helper->ec_finish,
+ &ec_copy, &ec_set_group, &ec_set_private, &ec_set_public);
+ EC_KEY_METHOD_set_init(ec_meth, ec_init, ecdsa_do_finish,
+ ec_copy, ec_set_group, ec_set_private, ec_set_public);
+
+ if ((rsa_meth = RSA_meth_dup(RSA_get_default_method())) == NULL)
fatal("%s: RSA_meth_dup failed", __func__);
- if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") ||
- !RSA_meth_set_priv_enc(helper_rsa, rsa_encrypt))
+ helper->rsa_finish = RSA_meth_get_finish(rsa_meth);
+ if (!RSA_meth_set1_name(rsa_meth, "ssh-pkcs11-helper") ||
+ !RSA_meth_set_priv_enc(rsa_meth, rsa_encrypt) ||
+ !RSA_meth_set_finish(rsa_meth, rsa_finish))
fatal("%s: failed to prepare method", __func__);
- return (0);
+ helper->ec_meth = ec_meth;
+ helper->rsa_meth = rsa_meth;
+ return 0;
}
-static int
-pkcs11_start_helper(void)
+static struct helper *
+pkcs11_start_helper(const char *path)
{
int pair[2];
- char *helper, *verbosity = NULL;
-
- if (log_level_get() >= SYSLOG_LEVEL_DEBUG1)
- verbosity = "-vvv";
-
- if (pkcs11_start_helper_methods() == -1) {
- error("pkcs11_start_helper_methods failed");
- return (-1);
- }
+ char *prog, *verbosity = NULL;
+ struct helper *helper;
+ pid_t pid;
+ if (nhelpers >= INT_MAX)
+ fatal("%s: too many helpers", __func__);
+ debug3("%s: start helper for %s", __func__, path);
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1) {
error("socketpair: %s", strerror(errno));
- return (-1);
+ return NULL;
+ }
+ helper = xcalloc(1, sizeof(*helper));
+ if (pkcs11_start_helper_methods(helper) == -1) {
+ error("pkcs11_start_helper_methods failed");
+ goto fail;
}
if ((pid = fork()) == -1) {
error("fork: %s", strerror(errno));
- return (-1);
+ fail:
+ close(pair[0]);
+ close(pair[1]);
+ RSA_meth_free(helper->rsa_meth);
+ EC_KEY_METHOD_free(helper->ec_meth);
+ free(helper);
+ return NULL;
} else if (pid == 0) {
if ((dup2(pair[1], STDIN_FILENO) == -1) ||
(dup2(pair[1], STDOUT_FILENO) == -1)) {
@@ -297,18 +485,27 @@ pkcs11_start_helper(void)
}
close(pair[0]);
close(pair[1]);
- helper = getenv("SSH_PKCS11_HELPER");
- if (helper == NULL || strlen(helper) == 0)
- helper = _PATH_SSH_PKCS11_HELPER;
+ prog = getenv("SSH_PKCS11_HELPER");
+ if (prog == NULL || strlen(prog) == 0)
+ prog = _PATH_SSH_PKCS11_HELPER;
+ if (log_level_get() >= SYSLOG_LEVEL_DEBUG1)
+ verbosity = "-vvv";
debug("%s: starting %s %s", __func__, helper,
verbosity == NULL ? "" : verbosity);
- execlp(helper, helper, verbosity, (char *)NULL);
- fprintf(stderr, "exec: %s: %s\n", helper, strerror(errno));
+ execlp(prog, prog, verbosity, (char *)NULL);
+ fprintf(stderr, "exec: %s: %s\n", prog, strerror(errno));
_exit(1);
}
close(pair[1]);
- fd = pair[0];
- return (0);
+ helper->fd = pair[0];
+ helper->path = xstrdup(path);
+ helper->pid = pid;
+ debug3("%s: helper %zu for \"%s\" on fd %d pid %ld", __func__, nhelpers,
+ helper->path, helper->fd, (long)helper->pid);
+ helpers = xrecallocarray(helpers, nhelpers,
+ nhelpers + 1, sizeof(*helpers));
+ helpers[nhelpers++] = helper;
+ return helper;
}
int
@@ -322,9 +519,11 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
size_t blen;
u_int nkeys, i;
struct sshbuf *msg;
+ struct helper *helper;
- if (fd < 0 && pkcs11_start_helper() < 0)
- return (-1);
+ if ((helper = helper_by_provider(name)) == NULL &&
+ (helper = pkcs11_start_helper(name)) == NULL)
+ return -1;
if ((msg = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
@@ -332,10 +531,10 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
(r = sshbuf_put_cstring(msg, name)) != 0 ||
(r = sshbuf_put_cstring(msg, pin)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
- send_msg(msg);
+ send_msg(helper->fd, msg);
sshbuf_reset(msg);
- type = recv_msg(msg);
+ type = recv_msg(helper->fd, msg);
if (type == SSH2_AGENT_IDENTITIES_ANSWER) {
if ((r = sshbuf_get_u32(msg, &nkeys)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
@@ -350,7 +549,7 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
__func__, ssh_err(r));
if ((r = sshkey_from_blob(blob, blen, &k)) != 0)
fatal("%s: bad key: %s", __func__, ssh_err(r));
- wrap_key(k);
+ wrap_key(helper, k);
(*keysp)[i] = k;
if (labelsp)
(*labelsp)[i] = label;
@@ -371,22 +570,15 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
int
pkcs11_del_provider(char *name)
{
- int r, ret = -1;
- struct sshbuf *msg;
-
- if ((msg = sshbuf_new()) == NULL)
- fatal("%s: sshbuf_new failed", __func__);
- if ((r = sshbuf_put_u8(msg, SSH_AGENTC_REMOVE_SMARTCARD_KEY)) != 0 ||
- (r = sshbuf_put_cstring(msg, name)) != 0 ||
- (r = sshbuf_put_cstring(msg, "")) != 0)
- fatal("%s: buffer error: %s", __func__, ssh_err(r));
- send_msg(msg);
- sshbuf_reset(msg);
-
- if (recv_msg(msg) == SSH_AGENT_SUCCESS)
- ret = 0;
- sshbuf_free(msg);
- return (ret);
+ struct helper *helper;
+
+ /*
+ * ssh-agent deletes keys before calling this, so the helper entry
+ * should be gone before we get here.
+ */
+ debug3("%s: delete %s", __func__, name);
+ if ((helper = helper_by_provider(name)) != NULL)
+ helper_terminate(helper);
+ return 0;
}
-
#endif /* ENABLE_PKCS11 */
--
2.41.0

View File

@@ -0,0 +1,171 @@
From 2f1be98e83feb90665b9292eff8bb734537fd491 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Wed, 19 Jul 2023 14:02:27 +0000
Subject: [PATCH 03/12] upstream: Ensure FIDO/PKCS11 libraries contain expected
symbols
This checks via nlist(3) that candidate provider libraries contain one
of the symbols that we will require prior to dlopen(), which can cause
a number of side effects, including execution of constructors.
Feedback deraadt; ok markus
OpenBSD-Commit-ID: 1508a5fbd74e329e69a55b56c453c292029aefbe
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/29ef8a04866ca14688d5b7fed7b8b9deab851f77]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
misc.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++
misc.h | 1 +
ssh-pkcs11.c | 4 +++
ssh-sk.c | 6 ++--
4 files changed, 86 insertions(+), 2 deletions(-)
diff --git a/misc.c b/misc.c
index 3a31d5c..8a107e4 100644
--- a/misc.c
+++ b/misc.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
+#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -41,6 +42,9 @@
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
@@ -2266,3 +2270,76 @@ ssh_signal(int signum, sshsig_t handler)
}
return osa.sa_handler;
}
+
+
+/*
+ * Returns zero if the library at 'path' contains symbol 's', nonzero
+ * otherwise.
+ */
+int
+lib_contains_symbol(const char *path, const char *s)
+{
+#ifdef HAVE_NLIST_H
+ struct nlist nl[2];
+ int ret = -1, r;
+
+ memset(nl, 0, sizeof(nl));
+ nl[0].n_name = xstrdup(s);
+ nl[1].n_name = NULL;
+ if ((r = nlist(path, nl)) == -1) {
+ error("%s: nlist failed for %s", __func__, path);
+ goto out;
+ }
+ if (r != 0 || nl[0].n_value == 0 || nl[0].n_type == 0) {
+ error("%s: library %s does not contain symbol %s", __func__, path, s);
+ goto out;
+ }
+ /* success */
+ ret = 0;
+ out:
+ free(nl[0].n_name);
+ return ret;
+#else /* HAVE_NLIST_H */
+ int fd, ret = -1;
+ struct stat st;
+ void *m = NULL;
+ size_t sz = 0;
+
+ memset(&st, 0, sizeof(st));
+ if ((fd = open(path, O_RDONLY)) < 0) {
+ error("%s: open %s: %s", __func__, path, strerror(errno));
+ return -1;
+ }
+ if (fstat(fd, &st) != 0) {
+ error("%s: fstat %s: %s", __func__, path, strerror(errno));
+ goto out;
+ }
+ if (!S_ISREG(st.st_mode)) {
+ error("%s: %s is not a regular file", __func__, path);
+ goto out;
+ }
+ if (st.st_size < 0 ||
+ (size_t)st.st_size < strlen(s) ||
+ st.st_size >= INT_MAX/2) {
+ error("%s: %s bad size %lld", __func__, path, (long long)st.st_size);
+ goto out;
+ }
+ sz = (size_t)st.st_size;
+ if ((m = mmap(NULL, sz, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED ||
+ m == NULL) {
+ error("%s: mmap %s: %s", __func__, path, strerror(errno));
+ goto out;
+ }
+ if (memmem(m, sz, s, strlen(s)) == NULL) {
+ error("%s: %s does not contain expected string %s", __func__, path, s);
+ goto out;
+ }
+ /* success */
+ ret = 0;
+ out:
+ if (m != NULL && m != MAP_FAILED)
+ munmap(m, sz);
+ close(fd);
+ return ret;
+#endif /* HAVE_NLIST_H */
+}
diff --git a/misc.h b/misc.h
index 4a05db2..3f9f4db 100644
--- a/misc.h
+++ b/misc.h
@@ -86,6 +86,7 @@ const char *atoi_err(const char *, int *);
int parse_absolute_time(const char *, uint64_t *);
void format_absolute_time(uint64_t, char *, size_t);
int path_absolute(const char *);
+int lib_contains_symbol(const char *, const char *);
void sock_set_v6only(int);
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index b56a41b..639a6f7 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1499,6 +1499,10 @@ pkcs11_register_provider(char *provider_id, char *pin,
__func__, provider_id);
goto fail;
}
+ if (lib_contains_symbol(provider_id, "C_GetFunctionList") != 0) {
+ error("provider %s is not a PKCS11 library", provider_id);
+ goto fail;
+ }
/* open shared pkcs11-library */
if ((handle = dlopen(provider_id, RTLD_NOW)) == NULL) {
error("dlopen %s failed: %s", provider_id, dlerror());
diff --git a/ssh-sk.c b/ssh-sk.c
index 5ff9381..9df12cc 100644
--- a/ssh-sk.c
+++ b/ssh-sk.c
@@ -119,10 +119,12 @@ sshsk_open(const char *path)
#endif
return ret;
}
- if ((ret->dlhandle = dlopen(path, RTLD_NOW)) == NULL) {
- error("Provider \"%s\" dlopen failed: %s", path, dlerror());
+ if (lib_contains_symbol(path, "sk_api_version") != 0) {
+ error("provider %s is not an OpenSSH FIDO library", path);
goto fail;
}
+ if ((ret->dlhandle = dlopen(path, RTLD_NOW)) == NULL)
+ fatal("Provider \"%s\" dlopen failed: %s", path, dlerror());
if ((ret->sk_api_version = dlsym(ret->dlhandle,
"sk_api_version")) == NULL) {
error("Provider \"%s\" dlsym(sk_api_version) failed: %s",
--
2.41.0

View File

@@ -0,0 +1,34 @@
From 0862f338941bfdfb2cadee87de6d5fdca1b8f457 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Wed, 19 Jul 2023 13:55:53 +0000
Subject: [PATCH 04/12] upstream: terminate process if requested to load a
PKCS#11 provider that isn't a PKCS#11 provider; from / ok markus@
OpenBSD-Commit-ID: 39532cf18b115881bb4cfaee32084497aadfa05c
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/892506b13654301f69f9545f48213fc210e5c5cc]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-pkcs11.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ssh-pkcs11.c b/ssh-pkcs11.c
index 639a6f7..7530acc 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -1508,10 +1508,8 @@ pkcs11_register_provider(char *provider_id, char *pin,
error("dlopen %s failed: %s", provider_id, dlerror());
goto fail;
}
- if ((getfunctionlist = dlsym(handle, "C_GetFunctionList")) == NULL) {
- error("dlsym(C_GetFunctionList) failed: %s", dlerror());
- goto fail;
- }
+ if ((getfunctionlist = dlsym(handle, "C_GetFunctionList")) == NULL)
+ fatal("dlsym(C_GetFunctionList) failed: %s", dlerror());
p = xcalloc(1, sizeof(*p));
p->name = xstrdup(provider_id);
p->handle = handle;
--
2.41.0

View File

@@ -0,0 +1,194 @@
From a6cee3905edf070c0de135d3f2ee5b74da1dbd28 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Tue, 26 May 2020 01:26:58 +0000
Subject: [PATCH 05/12] upstream: Restrict ssh-agent from signing web
challenges for FIDO
keys.
When signing messages in ssh-agent using a FIDO key that has an
application string that does not start with "ssh:", ensure that the
message being signed is one of the forms expected for the SSH protocol
(currently pubkey authentication and sshsig signatures).
This prevents ssh-agent forwarding on a host that has FIDO keys
attached granting the ability for the remote side to sign challenges
for web authentication using those keys too.
Note that the converse case of web browsers signing SSH challenges is
already precluded because no web RP can have the "ssh:" prefix in the
application string that we require.
ok markus@
OpenBSD-Commit-ID: 9ab6012574ed0352d2f097d307f4a988222d1b19
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/0c111eb84efba7c2a38b2cc3278901a0123161b9]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 110 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 100 insertions(+), 10 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index ceb348c..1794f35 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.255 2020/02/06 22:30:54 naddy Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.258 2020/05/26 01:26:58 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -77,6 +77,7 @@
#include "xmalloc.h"
#include "ssh.h"
+#include "ssh2.h"
#include "sshbuf.h"
#include "sshkey.h"
#include "authfd.h"
@@ -167,6 +168,9 @@ static long lifetime = 0;
static int fingerprint_hash = SSH_FP_HASH_DEFAULT;
+/* Refuse signing of non-SSH messages for web-origin FIDO keys */
+static int restrict_websafe = 1;
+
static void
close_socket(SocketEntry *e)
{
@@ -282,6 +286,80 @@ agent_decode_alg(struct sshkey *key, u_int flags)
return NULL;
}
+/*
+ * This function inspects a message to be signed by a FIDO key that has a
+ * web-like application string (i.e. one that does not begin with "ssh:".
+ * It checks that the message is one of those expected for SSH operations
+ * (pubkey userauth, sshsig, CA key signing) to exclude signing challenges
+ * for the web.
+ */
+static int
+check_websafe_message_contents(struct sshkey *key,
+ const u_char *msg, size_t len)
+{
+ int matched = 0;
+ struct sshbuf *b;
+ u_char m, n;
+ char *cp1 = NULL, *cp2 = NULL;
+ int r;
+ struct sshkey *mkey = NULL;
+
+ if ((b = sshbuf_from(msg, len)) == NULL)
+ fatal("%s: sshbuf_new", __func__);
+
+ /* SSH userauth request */
+ if ((r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* sess_id */
+ (r = sshbuf_get_u8(b, &m)) == 0 && /* SSH2_MSG_USERAUTH_REQUEST */
+ (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* server user */
+ (r = sshbuf_get_cstring(b, &cp1, NULL)) == 0 && /* service */
+ (r = sshbuf_get_cstring(b, &cp2, NULL)) == 0 && /* method */
+ (r = sshbuf_get_u8(b, &n)) == 0 && /* sig-follows */
+ (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* alg */
+ (r = sshkey_froms(b, &mkey)) == 0 && /* key */
+ sshbuf_len(b) == 0) {
+ debug("%s: parsed userauth", __func__);
+ if (m == SSH2_MSG_USERAUTH_REQUEST && n == 1 &&
+ strcmp(cp1, "ssh-connection") == 0 &&
+ strcmp(cp2, "publickey") == 0 &&
+ sshkey_equal(key, mkey)) {
+ debug("%s: well formed userauth", __func__);
+ matched = 1;
+ }
+ }
+ free(cp1);
+ free(cp2);
+ sshkey_free(mkey);
+ sshbuf_free(b);
+ if (matched)
+ return 1;
+
+ if ((b = sshbuf_from(msg, len)) == NULL)
+ fatal("%s: sshbuf_new", __func__);
+ cp1 = cp2 = NULL;
+ mkey = NULL;
+
+ /* SSHSIG */
+ if ((r = sshbuf_cmp(b, 0, "SSHSIG", 6)) == 0 &&
+ (r = sshbuf_consume(b, 6)) == 0 &&
+ (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* namespace */
+ (r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* reserved */
+ (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* hashalg */
+ (r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* H(msg) */
+ sshbuf_len(b) == 0) {
+ debug("%s: parsed sshsig", __func__);
+ matched = 1;
+ }
+
+ sshbuf_free(b);
+ if (matched)
+ return 1;
+
+ /* XXX CA signature operation */
+
+ error("web-origin key attempting to sign non-SSH message");
+ return 0;
+}
+
/* ssh2 only */
static void
process_sign_request2(SocketEntry *e)
@@ -314,14 +392,20 @@ process_sign_request2(SocketEntry *e)
verbose("%s: user refused key", __func__);
goto send;
}
- if (sshkey_is_sk(id->key) &&
- (id->key->sk_flags & SSH_SK_USER_PRESENCE_REQD)) {
- if ((fp = sshkey_fingerprint(key, SSH_FP_HASH_DEFAULT,
- SSH_FP_DEFAULT)) == NULL)
- fatal("%s: fingerprint failed", __func__);
- notifier = notify_start(0,
- "Confirm user presence for key %s %s",
- sshkey_type(id->key), fp);
+ if (sshkey_is_sk(id->key)) {
+ if (strncmp(id->key->sk_application, "ssh:", 4) != 0 &&
+ !check_websafe_message_contents(key, data, dlen)) {
+ /* error already logged */
+ goto send;
+ }
+ if ((id->key->sk_flags & SSH_SK_USER_PRESENCE_REQD)) {
+ if ((fp = sshkey_fingerprint(key, SSH_FP_HASH_DEFAULT,
+ SSH_FP_DEFAULT)) == NULL)
+ fatal("%s: fingerprint failed", __func__);
+ notifier = notify_start(0,
+ "Confirm user presence for key %s %s",
+ sshkey_type(id->key), fp);
+ }
}
if ((r = sshkey_sign(id->key, &signature, &slen,
data, dlen, agent_decode_alg(key, flags),
@@ -1214,7 +1298,7 @@ main(int ac, char **av)
__progname = ssh_get_progname(av[0]);
seed_rng();
- while ((ch = getopt(ac, av, "cDdksE:a:P:t:")) != -1) {
+ while ((ch = getopt(ac, av, "cDdksE:a:O:P:t:")) != -1) {
switch (ch) {
case 'E':
fingerprint_hash = ssh_digest_alg_by_name(optarg);
@@ -1229,6 +1313,12 @@ main(int ac, char **av)
case 'k':
k_flag++;
break;
+ case 'O':
+ if (strcmp(optarg, "no-restrict-websafe") == 0)
+ restrict_websafe = 0;
+ else
+ fatal("Unknown -O option");
+ break;
case 'P':
if (provider_whitelist != NULL)
fatal("-P option already specified");
--
2.41.0

View File

@@ -0,0 +1,73 @@
From a5d845b7b42861d18f43e83de9f24c7374d1b458 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Fri, 18 Sep 2020 08:16:38 +0000
Subject: [PATCH 06/12] upstream: handle multiple messages in a single read()
PR#183 by Dennis Kaarsemaker; feedback and ok markus@
OpenBSD-Commit-ID: 8570bb4d02d00cf70b98590716ea6a7d1cce68d1
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/52a03e9fca2d74eef953ddd4709250f365ca3975]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index 1794f35..78f7268 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.258 2020/05/26 01:26:58 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.264 2020/09/18 08:16:38 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -853,8 +853,10 @@ send:
}
#endif /* ENABLE_PKCS11 */
-/* dispatch incoming messages */
-
+/*
+ * dispatch incoming message.
+ * returns 1 on success, 0 for incomplete messages or -1 on error.
+ */
static int
process_message(u_int socknum)
{
@@ -908,7 +910,7 @@ process_message(u_int socknum)
/* send a fail message for all other request types */
send_status(e, 0);
}
- return 0;
+ return 1;
}
switch (type) {
@@ -952,7 +954,7 @@ process_message(u_int socknum)
send_status(e, 0);
break;
}
- return 0;
+ return 1;
}
static void
@@ -1043,7 +1045,12 @@ handle_conn_read(u_int socknum)
if ((r = sshbuf_put(sockets[socknum].input, buf, len)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
explicit_bzero(buf, sizeof(buf));
- process_message(socknum);
+ for (;;) {
+ if ((r = process_message(socknum)) == -1)
+ return -1;
+ else if (r == 0)
+ break;
+ }
return 0;
}
--
2.41.0

View File

@@ -0,0 +1,125 @@
From 653cc18c922fc387b3d3aa1b081c5e5283cce28a Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Tue, 26 Jan 2021 00:47:47 +0000
Subject: [PATCH 07/12] upstream: use recallocarray to allocate the agent
sockets table;
also clear socket entries that are being marked as unused.
spinkle in some debug2() spam to make it easier to watch an agent
do its thing.
ok markus
OpenBSD-Commit-ID: 74582c8e82e96afea46f6c7b6813a429cbc75922
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/1fe16fd61bb53944ec510882acc0491abd66ff76]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index 78f7268..2635bc5 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.264 2020/09/18 08:16:38 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.269 2021/01/26 00:47:47 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -175,11 +175,12 @@ static void
close_socket(SocketEntry *e)
{
close(e->fd);
- e->fd = -1;
- e->type = AUTH_UNUSED;
sshbuf_free(e->input);
sshbuf_free(e->output);
sshbuf_free(e->request);
+ memset(e, '\0', sizeof(*e));
+ e->fd = -1;
+ e->type = AUTH_UNUSED;
}
static void
@@ -249,6 +250,8 @@ process_request_identities(SocketEntry *e)
struct sshbuf *msg;
int r;
+ debug2("%s: entering", __func__);
+
if ((msg = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((r = sshbuf_put_u8(msg, SSH2_AGENT_IDENTITIES_ANSWER)) != 0 ||
@@ -441,6 +444,7 @@ process_remove_identity(SocketEntry *e)
struct sshkey *key = NULL;
Identity *id;
+ debug2("%s: entering", __func__);
if ((r = sshkey_froms(e->request, &key)) != 0) {
error("%s: get key: %s", __func__, ssh_err(r));
goto done;
@@ -467,6 +471,7 @@ process_remove_all_identities(SocketEntry *e)
{
Identity *id;
+ debug2("%s: entering", __func__);
/* Loop over all identities and clear the keys. */
for (id = TAILQ_FIRST(&idtab->idlist); id;
id = TAILQ_FIRST(&idtab->idlist)) {
@@ -520,6 +525,7 @@ process_add_identity(SocketEntry *e)
u_char ctype;
int r = SSH_ERR_INTERNAL_ERROR;
+ debug2("%s: entering", __func__);
if ((r = sshkey_private_deserialize(e->request, &k)) != 0 ||
k == NULL ||
(r = sshbuf_get_cstring(e->request, &comment, NULL)) != 0) {
@@ -667,6 +673,7 @@ process_lock_agent(SocketEntry *e, int lock)
static u_int fail_count = 0;
size_t pwlen;
+ debug2("%s: entering", __func__);
/*
* This is deliberately fatal: the user has requested that we lock,
* but we can't parse their request properly. The only safe thing to
@@ -738,6 +745,7 @@ process_add_smartcard_key(SocketEntry *e)
struct sshkey **keys = NULL, *k;
Identity *id;
+ debug2("%s: entering", __func__);
if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 ||
(r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) {
error("%s: buffer error: %s", __func__, ssh_err(r));
@@ -818,6 +826,7 @@ process_remove_smartcard_key(SocketEntry *e)
int r, success = 0;
Identity *id, *nxt;
+ debug2("%s: entering", __func__);
if ((r = sshbuf_get_cstring(e->request, &provider, NULL)) != 0 ||
(r = sshbuf_get_cstring(e->request, &pin, NULL)) != 0) {
error("%s: buffer error: %s", __func__, ssh_err(r));
@@ -962,6 +971,8 @@ new_socket(sock_type type, int fd)
{
u_int i, old_alloc, new_alloc;
+ debug("%s: type = %s", __func__, type == AUTH_CONNECTION ? "CONNECTION" :
+ (type == AUTH_SOCKET ? "SOCKET" : "UNKNOWN"));
set_nonblock(fd);
if (fd > max_fd)
@@ -981,7 +992,8 @@ new_socket(sock_type type, int fd)
}
old_alloc = sockets_alloc;
new_alloc = sockets_alloc + 10;
- sockets = xreallocarray(sockets, new_alloc, sizeof(sockets[0]));
+ sockets = xrecallocarray(sockets, old_alloc, new_alloc,
+ sizeof(sockets[0]));
for (i = old_alloc; i < new_alloc; i++)
sockets[i].type = AUTH_UNUSED;
sockets_alloc = new_alloc;
--
2.41.0

View File

@@ -0,0 +1,315 @@
From c30158ea225cf8ad67c3dcc88fa9e4afbf8959a7 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Tue, 26 Jan 2021 00:53:31 +0000
Subject: [PATCH 08/12] upstream: more ssh-agent refactoring
Allow confirm_key() to accept an additional reason suffix
Factor publickey userauth parsing out into its own function and allow
it to optionally return things it parsed out of the message to its
caller.
feedback/ok markus@
OpenBSD-Commit-ID: 29006515617d1aa2d8b85cd2bf667e849146477e
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/e0e8bee8024fa9e31974244d14f03d799e5c0775]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 197 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 130 insertions(+), 67 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index 2635bc5..7ad323c 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.269 2021/01/26 00:47:47 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.270 2021/01/26 00:53:31 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -216,15 +216,16 @@ lookup_identity(struct sshkey *key)
/* Check confirmation of keysign request */
static int
-confirm_key(Identity *id)
+confirm_key(Identity *id, const char *extra)
{
char *p;
int ret = -1;
p = sshkey_fingerprint(id->key, fingerprint_hash, SSH_FP_DEFAULT);
if (p != NULL &&
- ask_permission("Allow use of key %s?\nKey fingerprint %s.",
- id->comment, p))
+ ask_permission("Allow use of key %s?\nKey fingerprint %s.%s%s",
+ id->comment, p,
+ extra == NULL ? "" : "\n", extra == NULL ? "" : extra))
ret = 0;
free(p);
@@ -290,74 +291,133 @@ agent_decode_alg(struct sshkey *key, u_int flags)
}
/*
- * This function inspects a message to be signed by a FIDO key that has a
- * web-like application string (i.e. one that does not begin with "ssh:".
- * It checks that the message is one of those expected for SSH operations
- * (pubkey userauth, sshsig, CA key signing) to exclude signing challenges
- * for the web.
+ * Attempt to parse the contents of a buffer as a SSH publickey userauth
+ * request, checking its contents for consistency and matching the embedded
+ * key against the one that is being used for signing.
+ * Note: does not modify msg buffer.
+ * Optionally extract the username and session ID from the request.
*/
static int
-check_websafe_message_contents(struct sshkey *key,
- const u_char *msg, size_t len)
+parse_userauth_request(struct sshbuf *msg, const struct sshkey *expected_key,
+ char **userp, struct sshbuf **sess_idp)
{
- int matched = 0;
- struct sshbuf *b;
- u_char m, n;
- char *cp1 = NULL, *cp2 = NULL;
+ struct sshbuf *b = NULL, *sess_id = NULL;
+ char *user = NULL, *service = NULL, *method = NULL, *pkalg = NULL;
int r;
+ u_char t, sig_follows;
struct sshkey *mkey = NULL;
- if ((b = sshbuf_from(msg, len)) == NULL)
- fatal("%s: sshbuf_new", __func__);
+ if (userp != NULL)
+ *userp = NULL;
+ if (sess_idp != NULL)
+ *sess_idp = NULL;
+ if ((b = sshbuf_fromb(msg)) == NULL)
+ fatal("%s: sshbuf_fromb", __func__);
/* SSH userauth request */
- if ((r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* sess_id */
- (r = sshbuf_get_u8(b, &m)) == 0 && /* SSH2_MSG_USERAUTH_REQUEST */
- (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* server user */
- (r = sshbuf_get_cstring(b, &cp1, NULL)) == 0 && /* service */
- (r = sshbuf_get_cstring(b, &cp2, NULL)) == 0 && /* method */
- (r = sshbuf_get_u8(b, &n)) == 0 && /* sig-follows */
- (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* alg */
- (r = sshkey_froms(b, &mkey)) == 0 && /* key */
- sshbuf_len(b) == 0) {
- debug("%s: parsed userauth", __func__);
- if (m == SSH2_MSG_USERAUTH_REQUEST && n == 1 &&
- strcmp(cp1, "ssh-connection") == 0 &&
- strcmp(cp2, "publickey") == 0 &&
- sshkey_equal(key, mkey)) {
- debug("%s: well formed userauth", __func__);
- matched = 1;
- }
+ if ((r = sshbuf_froms(b, &sess_id)) != 0)
+ goto out;
+ if (sshbuf_len(sess_id) == 0) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
}
- free(cp1);
- free(cp2);
- sshkey_free(mkey);
+ if ((r = sshbuf_get_u8(b, &t)) != 0 || /* SSH2_MSG_USERAUTH_REQUEST */
+ (r = sshbuf_get_cstring(b, &user, NULL)) != 0 || /* server user */
+ (r = sshbuf_get_cstring(b, &service, NULL)) != 0 || /* service */
+ (r = sshbuf_get_cstring(b, &method, NULL)) != 0 || /* method */
+ (r = sshbuf_get_u8(b, &sig_follows)) != 0 || /* sig-follows */
+ (r = sshbuf_get_cstring(b, &pkalg, NULL)) != 0 || /* alg */
+ (r = sshkey_froms(b, &mkey)) != 0) /* key */
+ goto out;
+ if (t != SSH2_MSG_USERAUTH_REQUEST ||
+ sig_follows != 1 ||
+ strcmp(service, "ssh-connection") != 0 ||
+ !sshkey_equal(expected_key, mkey) ||
+ sshkey_type_from_name(pkalg) != expected_key->type) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
+ if (strcmp(method, "publickey") != 0) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
+ if (sshbuf_len(b) != 0) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
+ /* success */
+ r = 0;
+ debug("%s: well formed userauth", __func__);
+ if (userp != NULL) {
+ *userp = user;
+ user = NULL;
+ }
+ if (sess_idp != NULL) {
+ *sess_idp = sess_id;
+ sess_id = NULL;
+ }
+ out:
sshbuf_free(b);
- if (matched)
- return 1;
+ sshbuf_free(sess_id);
+ free(user);
+ free(service);
+ free(method);
+ free(pkalg);
+ sshkey_free(mkey);
+ return r;
+}
- if ((b = sshbuf_from(msg, len)) == NULL)
- fatal("%s: sshbuf_new", __func__);
- cp1 = cp2 = NULL;
- mkey = NULL;
-
- /* SSHSIG */
- if ((r = sshbuf_cmp(b, 0, "SSHSIG", 6)) == 0 &&
- (r = sshbuf_consume(b, 6)) == 0 &&
- (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* namespace */
- (r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* reserved */
- (r = sshbuf_get_cstring(b, NULL, NULL)) == 0 && /* hashalg */
- (r = sshbuf_get_string_direct(b, NULL, NULL)) == 0 && /* H(msg) */
- sshbuf_len(b) == 0) {
- debug("%s: parsed sshsig", __func__);
- matched = 1;
- }
+/*
+ * Attempt to parse the contents of a buffer as a SSHSIG signature request.
+ * Note: does not modify buffer.
+ */
+static int
+parse_sshsig_request(struct sshbuf *msg)
+{
+ int r;
+ struct sshbuf *b;
+ if ((b = sshbuf_fromb(msg)) == NULL)
+ fatal("%s: sshbuf_fromb", __func__);
+
+ if ((r = sshbuf_cmp(b, 0, "SSHSIG", 6)) != 0 ||
+ (r = sshbuf_consume(b, 6)) != 0 ||
+ (r = sshbuf_get_cstring(b, NULL, NULL)) != 0 || /* namespace */
+ (r = sshbuf_get_string_direct(b, NULL, NULL)) != 0 || /* reserved */
+ (r = sshbuf_get_cstring(b, NULL, NULL)) != 0 || /* hashalg */
+ (r = sshbuf_get_string_direct(b, NULL, NULL)) != 0) /* H(msg) */
+ goto out;
+ if (sshbuf_len(b) != 0) {
+ r = SSH_ERR_INVALID_FORMAT;
+ goto out;
+ }
+ /* success */
+ r = 0;
+ out:
sshbuf_free(b);
- if (matched)
+ return r;
+}
+
+/*
+ * This function inspects a message to be signed by a FIDO key that has a
+ * web-like application string (i.e. one that does not begin with "ssh:".
+ * It checks that the message is one of those expected for SSH operations
+ * (pubkey userauth, sshsig, CA key signing) to exclude signing challenges
+ * for the web.
+ */
+static int
+check_websafe_message_contents(struct sshkey *key, struct sshbuf *data)
+{
+ if (parse_userauth_request(data, key, NULL, NULL) == 0) {
+ debug("%s: signed data matches public key userauth request", __func__);
return 1;
+ }
+ if (parse_sshsig_request(data) == 0) {
+ debug("%s: signed data matches SSHSIG signature request", __func__);
+ return 1;
+ }
- /* XXX CA signature operation */
+ /* XXX check CA signature operation */
error("web-origin key attempting to sign non-SSH message");
return 0;
@@ -367,21 +427,22 @@ check_websafe_message_contents(struct sshkey *key,
static void
process_sign_request2(SocketEntry *e)
{
- const u_char *data;
u_char *signature = NULL;
- size_t dlen, slen = 0;
+ size_t i, slen = 0;
u_int compat = 0, flags;
int r, ok = -1;
char *fp = NULL;
- struct sshbuf *msg;
+ struct sshbuf *msg = NULL, *data = NULL;
struct sshkey *key = NULL;
struct identity *id;
struct notifier_ctx *notifier = NULL;
- if ((msg = sshbuf_new()) == NULL)
+ debug("%s: entering", __func__);
+
+ if ((msg = sshbuf_new()) == NULL | (data = sshbuf_new()) == NULL)
fatal("%s: sshbuf_new failed", __func__);
if ((r = sshkey_froms(e->request, &key)) != 0 ||
- (r = sshbuf_get_string_direct(e->request, &data, &dlen)) != 0 ||
+ (r = sshbuf_get_stringb(e->request, data)) != 0 ||
(r = sshbuf_get_u32(e->request, &flags)) != 0) {
error("%s: couldn't parse request: %s", __func__, ssh_err(r));
goto send;
@@ -391,13 +452,13 @@ process_sign_request2(SocketEntry *e)
verbose("%s: %s key not found", __func__, sshkey_type(key));
goto send;
}
- if (id->confirm && confirm_key(id) != 0) {
+ if (id->confirm && confirm_key(id, NULL) != 0) {
verbose("%s: user refused key", __func__);
goto send;
}
if (sshkey_is_sk(id->key)) {
if (strncmp(id->key->sk_application, "ssh:", 4) != 0 &&
- !check_websafe_message_contents(key, data, dlen)) {
+ !check_websafe_message_contents(key, data)) {
/* error already logged */
goto send;
}
@@ -411,7 +472,7 @@ process_sign_request2(SocketEntry *e)
}
}
if ((r = sshkey_sign(id->key, &signature, &slen,
- data, dlen, agent_decode_alg(key, flags),
+ sshbuf_ptr(data), sshbuf_len(data), agent_decode_alg(key, flags),
id->sk_provider, compat)) != 0) {
error("%s: sshkey_sign: %s", __func__, ssh_err(r));
goto send;
@@ -420,8 +481,7 @@ process_sign_request2(SocketEntry *e)
ok = 0;
send:
notify_complete(notifier);
- sshkey_free(key);
- free(fp);
+
if (ok == 0) {
if ((r = sshbuf_put_u8(msg, SSH2_AGENT_SIGN_RESPONSE)) != 0 ||
(r = sshbuf_put_string(msg, signature, slen)) != 0)
@@ -432,7 +492,10 @@ process_sign_request2(SocketEntry *e)
if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ sshbuf_free(data);
sshbuf_free(msg);
+ sshkey_free(key);
+ free(fp);
free(signature);
}
--
2.41.0

View File

@@ -0,0 +1,38 @@
From 7adba46611e5d076d7d12d9f4162dd4cabd5ff50 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Fri, 29 Jan 2021 06:28:10 +0000
Subject: [PATCH 09/12] upstream: give typedef'd struct a struct name; makes
the fuzzer I'm
writing a bit easier
OpenBSD-Commit-ID: 1052ab521505a4d8384d67acb3974ef81b8896cb
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/8afaa7d7918419d3da6c0477b83db2159879cb33]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index 7ad323c..c99927c 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.270 2021/01/26 00:53:31 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.274 2021/01/29 06:28:10 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -108,7 +108,7 @@ typedef enum {
AUTH_CONNECTION
} sock_type;
-typedef struct {
+typedef struct socket_entry {
int fd;
sock_type type;
struct sshbuf *input;
--
2.41.0

View File

@@ -0,0 +1,39 @@
From 343e2a2c0ef754a7a86118016b248f7a73f8d510 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Fri, 29 Jan 2021 06:29:46 +0000
Subject: [PATCH 10/12] upstream: fix the values of enum sock_type
OpenBSD-Commit-ID: 18d048f4dbfbb159ff500cfc2700b8fb1407facd
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/1a4b92758690faa12f49079dd3b72567f909466d]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ssh-agent.c b/ssh-agent.c
index c99927c..7f1e14b 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.274 2021/01/29 06:28:10 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.275 2021/01/29 06:29:46 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -103,9 +103,9 @@
#define AGENT_RBUF_LEN (4096)
typedef enum {
- AUTH_UNUSED,
- AUTH_SOCKET,
- AUTH_CONNECTION
+ AUTH_UNUSED = 0,
+ AUTH_SOCKET = 1,
+ AUTH_CONNECTION = 2,
} sock_type;
typedef struct socket_entry {
--
2.41.0

View File

@@ -0,0 +1,307 @@
From 2b3b369c8cf71f9ef5942a5e074e6f86e7ca1e0c Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Sun, 19 Dec 2021 22:09:23 +0000
Subject: [PATCH 11/12] upstream: ssh-agent side of binding
record session ID/hostkey/forwarding status for each active socket.
Attempt to parse data-to-be-signed at signature request time and extract
session ID from the blob if it is a pubkey userauth request.
ok markus@
OpenBSD-Commit-ID: a80fd41e292b18b67508362129e9fed549abd318
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/4c1e3ce85e183a9d0c955c88589fed18e4d6a058]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
authfd.h | 3 +
ssh-agent.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++---
2 files changed, 170 insertions(+), 8 deletions(-)
diff --git a/authfd.h b/authfd.h
index c3bf625..9cc9807 100644
--- a/authfd.h
+++ b/authfd.h
@@ -76,6 +76,9 @@ int ssh_agent_sign(int sock, const struct sshkey *key,
#define SSH2_AGENTC_ADD_ID_CONSTRAINED 25
#define SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED 26
+/* generic extension mechanism */
+#define SSH_AGENTC_EXTENSION 27
+
#define SSH_AGENT_CONSTRAIN_LIFETIME 1
#define SSH_AGENT_CONSTRAIN_CONFIRM 2
#define SSH_AGENT_CONSTRAIN_MAXSIGN 3
diff --git a/ssh-agent.c b/ssh-agent.c
index 7f1e14b..01c7f2b 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.275 2021/01/29 06:29:46 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.280 2021/12/19 22:09:23 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -98,9 +98,15 @@
#endif
/* Maximum accepted message length */
-#define AGENT_MAX_LEN (256*1024)
+#define AGENT_MAX_LEN (256*1024)
/* Maximum bytes to read from client socket */
-#define AGENT_RBUF_LEN (4096)
+#define AGENT_RBUF_LEN (4096)
+/* Maximum number of recorded session IDs/hostkeys per connection */
+#define AGENT_MAX_SESSION_IDS 16
+/* Maximum size of session ID */
+#define AGENT_MAX_SID_LEN 128
+
+/* XXX store hostkey_sid in a refcounted tree */
typedef enum {
AUTH_UNUSED = 0,
@@ -108,12 +114,20 @@ typedef enum {
AUTH_CONNECTION = 2,
} sock_type;
+struct hostkey_sid {
+ struct sshkey *key;
+ struct sshbuf *sid;
+ int forwarded;
+};
+
typedef struct socket_entry {
int fd;
sock_type type;
struct sshbuf *input;
struct sshbuf *output;
struct sshbuf *request;
+ size_t nsession_ids;
+ struct hostkey_sid *session_ids;
} SocketEntry;
u_int sockets_alloc = 0;
@@ -174,10 +188,17 @@ static int restrict_websafe = 1;
static void
close_socket(SocketEntry *e)
{
+ size_t i;
+
close(e->fd);
sshbuf_free(e->input);
sshbuf_free(e->output);
sshbuf_free(e->request);
+ for (i = 0; i < e->nsession_ids; i++) {
+ sshkey_free(e->session_ids[i].key);
+ sshbuf_free(e->session_ids[i].sid);
+ }
+ free(e->session_ids);
memset(e, '\0', sizeof(*e));
e->fd = -1;
e->type = AUTH_UNUSED;
@@ -423,6 +444,18 @@ check_websafe_message_contents(struct sshkey *key, struct sshbuf *data)
return 0;
}
+static int
+buf_equal(const struct sshbuf *a, const struct sshbuf *b)
+{
+ if (sshbuf_ptr(a) == NULL || sshbuf_ptr(b) == NULL)
+ return SSH_ERR_INVALID_ARGUMENT;
+ if (sshbuf_len(a) != sshbuf_len(b))
+ return SSH_ERR_INVALID_FORMAT;
+ if (timingsafe_bcmp(sshbuf_ptr(a), sshbuf_ptr(b), sshbuf_len(a)) != 0)
+ return SSH_ERR_INVALID_FORMAT;
+ return 0;
+}
+
/* ssh2 only */
static void
process_sign_request2(SocketEntry *e)
@@ -431,8 +464,8 @@ process_sign_request2(SocketEntry *e)
size_t i, slen = 0;
u_int compat = 0, flags;
int r, ok = -1;
- char *fp = NULL;
- struct sshbuf *msg = NULL, *data = NULL;
+ char *fp = NULL, *user = NULL, *sig_dest = NULL;
+ struct sshbuf *msg = NULL, *data = NULL, *sid = NULL;
struct sshkey *key = NULL;
struct identity *id;
struct notifier_ctx *notifier = NULL;
@@ -452,7 +485,33 @@ process_sign_request2(SocketEntry *e)
verbose("%s: %s key not found", __func__, sshkey_type(key));
goto send;
}
- if (id->confirm && confirm_key(id, NULL) != 0) {
+ /*
+ * If session IDs were recorded for this socket, then use them to
+ * annotate the confirmation messages with the host keys.
+ */
+ if (e->nsession_ids > 0 &&
+ parse_userauth_request(data, key, &user, &sid) == 0) {
+ /*
+ * session ID from userauth request should match the final
+ * ID in the list recorded in the socket, unless the ssh
+ * client at that point lacks the binding extension (or if
+ * an attacker is trying to steal use of the agent).
+ */
+ i = e->nsession_ids - 1;
+ if (buf_equal(sid, e->session_ids[i].sid) == 0) {
+ if ((fp = sshkey_fingerprint(e->session_ids[i].key,
+ SSH_FP_HASH_DEFAULT, SSH_FP_DEFAULT)) == NULL)
+ fatal("%s: fingerprint failed", __func__);
+ debug3("%s: destination %s %s (slot %zu)", __func__,
+ sshkey_type(e->session_ids[i].key), fp, i);
+ xasprintf(&sig_dest, "public key request for "
+ "target user \"%s\" to %s %s", user,
+ sshkey_type(e->session_ids[i].key), fp);
+ free(fp);
+ fp = NULL;
+ }
+ }//
+ if (id->confirm && confirm_key(id, sig_dest) != 0) {
verbose("%s: user refused key", __func__);
goto send;
}
@@ -467,8 +526,10 @@ process_sign_request2(SocketEntry *e)
SSH_FP_DEFAULT)) == NULL)
fatal("%s: fingerprint failed", __func__);
notifier = notify_start(0,
- "Confirm user presence for key %s %s",
- sshkey_type(id->key), fp);
+ "Confirm user presence for key %s %s%s%s",
+ sshkey_type(id->key), fp,
+ sig_dest == NULL ? "" : "\n",
+ sig_dest == NULL ? "" : sig_dest);
}
}
if ((r = sshkey_sign(id->key, &signature, &slen,
@@ -492,11 +553,14 @@ process_sign_request2(SocketEntry *e)
if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
fatal("%s: buffer error: %s", __func__, ssh_err(r));
+ sshbuf_free(sid);
sshbuf_free(data);
sshbuf_free(msg);
sshkey_free(key);
free(fp);
free(signature);
+ free(sig_dest);
+ free(user);
}
/* shared */
@@ -925,6 +989,98 @@ send:
}
#endif /* ENABLE_PKCS11 */
+static int
+process_ext_session_bind(SocketEntry *e)
+{
+ int r, sid_match, key_match;
+ struct sshkey *key = NULL;
+ struct sshbuf *sid = NULL, *sig = NULL;
+ char *fp = NULL;
+ u_char fwd;
+ size_t i;
+
+ debug2("%s: entering", __func__);
+ if ((r = sshkey_froms(e->request, &key)) != 0 ||
+ (r = sshbuf_froms(e->request, &sid)) != 0 ||
+ (r = sshbuf_froms(e->request, &sig)) != 0 ||
+ (r = sshbuf_get_u8(e->request, &fwd)) != 0) {
+ error("%s: parse: %s", __func__, ssh_err(r));
+ goto out;
+ }
+ if ((fp = sshkey_fingerprint(key, SSH_FP_HASH_DEFAULT,
+ SSH_FP_DEFAULT)) == NULL)
+ fatal("%s: fingerprint failed", __func__);
+ /* check signature with hostkey on session ID */
+ if ((r = sshkey_verify(key, sshbuf_ptr(sig), sshbuf_len(sig),
+ sshbuf_ptr(sid), sshbuf_len(sid), NULL, 0, NULL)) != 0) {
+ error("%s: sshkey_verify for %s %s: %s", __func__, sshkey_type(key), fp, ssh_err(r));
+ goto out;
+ }
+ /* check whether sid/key already recorded */
+ for (i = 0; i < e->nsession_ids; i++) {
+ sid_match = buf_equal(sid, e->session_ids[i].sid) == 0;
+ key_match = sshkey_equal(key, e->session_ids[i].key);
+ if (sid_match && key_match) {
+ debug("%s: session ID already recorded for %s %s", __func__,
+ sshkey_type(key), fp);
+ r = 0;
+ goto out;
+ } else if (sid_match) {
+ error("%s: session ID recorded against different key "
+ "for %s %s", __func__, sshkey_type(key), fp);
+ r = -1;
+ goto out;
+ }
+ /*
+ * new sid with previously-seen key can happen, e.g. multiple
+ * connections to the same host.
+ */
+ }
+ /* record new key/sid */
+ if (e->nsession_ids >= AGENT_MAX_SESSION_IDS) {
+ error("%s: too many session IDs recorded", __func__);
+ goto out;
+ }
+ e->session_ids = xrecallocarray(e->session_ids, e->nsession_ids,
+ e->nsession_ids + 1, sizeof(*e->session_ids));
+ i = e->nsession_ids++;
+ debug("%s: recorded %s %s (slot %zu of %d)", __func__, sshkey_type(key), fp, i,
+ AGENT_MAX_SESSION_IDS);
+ e->session_ids[i].key = key;
+ e->session_ids[i].forwarded = fwd != 0;
+ key = NULL; /* transferred */
+ /* can't transfer sid; it's refcounted and scoped to request's life */
+ if ((e->session_ids[i].sid = sshbuf_new()) == NULL)
+ fatal("%s: sshbuf_new", __func__);
+ if ((r = sshbuf_putb(e->session_ids[i].sid, sid)) != 0)
+ fatal("%s: sshbuf_putb session ID: %s", __func__, ssh_err(r));
+ /* success */
+ r = 0;
+ out:
+ sshkey_free(key);
+ sshbuf_free(sid);
+ sshbuf_free(sig);
+ return r == 0 ? 1 : 0;
+}
+
+static void
+process_extension(SocketEntry *e)
+{
+ int r, success = 0;
+ char *name;
+
+ debug2("%s: entering", __func__);
+ if ((r = sshbuf_get_cstring(e->request, &name, NULL)) != 0) {
+ error("%s: parse: %s", __func__, ssh_err(r));
+ goto send;
+ }
+ if (strcmp(name, "session-bind@openssh.com") == 0)
+ success = process_ext_session_bind(e);
+ else
+ debug("%s: unsupported extension \"%s\"", __func__, name);
+send:
+ send_status(e, success);
+}
/*
* dispatch incoming message.
* returns 1 on success, 0 for incomplete messages or -1 on error.
@@ -1019,6 +1175,9 @@ process_message(u_int socknum)
process_remove_smartcard_key(e);
break;
#endif /* ENABLE_PKCS11 */
+ case SSH_AGENTC_EXTENSION:
+ process_extension(e);
+ break;
default:
/* Unknown message. Respond with failure. */
error("Unknown message %d", type);
--
2.41.0

View File

@@ -0,0 +1,120 @@
From 4fe3d0fbd3d6dc1f19354e0d73a3231c461ed044 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Wed, 19 Jul 2023 13:56:33 +0000
Subject: [PATCH 12/12] upstream: Disallow remote addition of FIDO/PKCS11
provider libraries to ssh-agent by default.
The old behaviour of allowing remote clients from loading providers
can be restored using `ssh-agent -O allow-remote-pkcs11`.
Detection of local/remote clients requires a ssh(1) that supports
the `session-bind@openssh.com` extension. Forwarding access to a
ssh-agent socket using non-OpenSSH tools may circumvent this control.
ok markus@
OpenBSD-Commit-ID: 4c2bdf79b214ae7e60cc8c39a45501344fa7bd7c
Upstream-Status: Backport [https://github.com/openssh/openssh-portable/commit/1f2731f5d7a8f8a8385c6031667ed29072c0d92a]
CVE: CVE-2023-38408
Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
---
ssh-agent.1 | 20 ++++++++++++++++++++
ssh-agent.c | 26 ++++++++++++++++++++++++--
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/ssh-agent.1 b/ssh-agent.1
index fff0db6..a0f1e21 100644
--- a/ssh-agent.1
+++ b/ssh-agent.1
@@ -97,6 +97,26 @@ The default is
Kill the current agent (given by the
.Ev SSH_AGENT_PID
environment variable).
+Currently two options are supported:
+.Cm allow-remote-pkcs11
+and
+.Pp
+The
+.Cm allow-remote-pkcs11
+option allows clients of a forwarded
+.Nm
+to load PKCS#11 or FIDO provider libraries.
+By default only local clients may perform this operation.
+Note that signalling that a
+.Nm
+client remote is performed by
+.Xr ssh 1 ,
+and use of other tools to forward access to the agent socket may circumvent
+this restriction.
+.Pp
+The
+.Cm no-restrict-websafe ,
+instructs
.It Fl P Ar provider_whitelist
Specify a pattern-list of acceptable paths for PKCS#11 and FIDO authenticator
shared libraries that may be used with the
diff --git a/ssh-agent.c b/ssh-agent.c
index 01c7f2b..40c1b6b 100644
--- a/ssh-agent.c
+++ b/ssh-agent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.280 2021/12/19 22:09:23 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.300 2023/07/19 13:56:33 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -167,6 +167,12 @@ char socket_dir[PATH_MAX];
/* PKCS#11/Security key path whitelist */
static char *provider_whitelist;
+/*
+ * Allows PKCS11 providers or SK keys that use non-internal providers to
+ * be added over a remote connection (identified by session-bind@openssh.com).
+ */
+static int remote_add_provider;
+
/* locking */
#define LOCK_SIZE 32
#define LOCK_SALT_SIZE 16
@@ -736,6 +742,15 @@ process_add_identity(SocketEntry *e)
if (strcasecmp(sk_provider, "internal") == 0) {
debug("%s: internal provider", __func__);
} else {
+ if (e->nsession_ids != 0 && !remote_add_provider) {
+ verbose("failed add of SK provider \"%.100s\": "
+ "remote addition of providers is disabled",
+ sk_provider);
+ free(sk_provider);
+ free(comment);
+ sshkey_free(k);
+ goto send;
+ }
if (realpath(sk_provider, canonical_provider) == NULL) {
verbose("failed provider \"%.100s\": "
"realpath: %s", sk_provider,
@@ -901,6 +916,11 @@ process_add_smartcard_key(SocketEntry *e)
goto send;
}
}
+ if (e->nsession_ids != 0 && !remote_add_provider) {
+ verbose("failed PKCS#11 add of \"%.100s\": remote addition of "
+ "providers is disabled", provider);
+ goto send;
+ }
if (realpath(provider, canonical_provider) == NULL) {
verbose("failed PKCS#11 add of \"%.100s\": realpath: %s",
provider, strerror(errno));
@@ -1556,7 +1576,9 @@ main(int ac, char **av)
break;
case 'O':
if (strcmp(optarg, "no-restrict-websafe") == 0)
- restrict_websafe = 0;
+ restrict_websafe = 0;
+ else if (strcmp(optarg, "allow-remote-pkcs11") == 0)
+ remote_add_provider = 1;
else
fatal("Unknown -O option");
break;
--
2.41.0

View File

@@ -27,6 +27,18 @@ SRC_URI = "http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar
file://CVE-2020-14145.patch \
file://CVE-2021-28041.patch \
file://CVE-2021-41617.patch \
file://CVE-2023-38408-01.patch \
file://CVE-2023-38408-02.patch \
file://CVE-2023-38408-03.patch \
file://CVE-2023-38408-04.patch \
file://CVE-2023-38408-05.patch \
file://CVE-2023-38408-06.patch \
file://CVE-2023-38408-07.patch \
file://CVE-2023-38408-08.patch \
file://CVE-2023-38408-09.patch \
file://CVE-2023-38408-10.patch \
file://CVE-2023-38408-11.patch \
file://CVE-2023-38408-12.patch \
"
SRC_URI[md5sum] = "3076e6413e8dbe56d33848c1054ac091"
SRC_URI[sha256sum] = "43925151e6cf6cee1450190c0e9af4dc36b41c12737619edff8bcebdff64e671"

View File

@@ -0,0 +1,37 @@
From 326909baf81a638d51fa8be1d8227518784f5cc4 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Tue, 14 Sep 2021 12:18:25 +0200
Subject: [PATCH] Configure: do not tweak mips cflags
This conflicts with mips machine definitons from yocto,
e.g.
| Error: -mips3 conflicts with the other architecture options, which imply -mips64r2
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
Configure | 10 ----------
1 file changed, 10 deletions(-)
Index: openssl-3.0.4/Configure
===================================================================
--- openssl-3.0.4.orig/Configure
+++ openssl-3.0.4/Configure
@@ -1243,16 +1243,6 @@ if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m)
push @{$config{shared_ldflag}}, "-mno-cygwin";
}
-if ($target =~ /linux.*-mips/ && !$disabled{asm}
- && !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
- # minimally required architecture flags for assembly modules
- my $value;
- $value = '-mips2' if ($target =~ /mips32/);
- $value = '-mips3' if ($target =~ /mips64/);
- unshift @{$config{cflags}}, $value;
- unshift @{$config{cxxflags}}, $value if $config{CXX};
-}
-
# If threads aren't disabled, check how possible they are
unless ($disabled{threads}) {
if ($auto_threads) {

View File

@@ -1,226 +0,0 @@
From 879f7080d7e141f415c79eaa3a8ac4a3dad0348b 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/20569)
CVE: CVE-2023-0464
Upstream-Status: Backport [https://git.openssl.org/gitweb/?p=openssl.git;a=patch;h=879f7080d7e141f415c79eaa3a8ac4a3dad0348b]
Signed-off-by: Nikhil R <nikhil.r@kpit.com>
---
crypto/x509v3/pcy_local.h | 8 +++++++-
crypto/x509v3/pcy_node.c | 12 +++++++++---
crypto/x509v3/pcy_tree.c | 37 +++++++++++++++++++++++++++----------
3 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/crypto/x509v3/pcy_local.h b/crypto/x509v3/pcy_local.h
index 5daf78de45..344aa06765 100644
--- a/crypto/x509v3/pcy_local.h
+++ b/crypto/x509v3/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;
@@ -159,7 +164,8 @@ X509_POLICY_NODE *tree_find_sk(STACK_OF(X509_POLICY_NODE) *sk,
X509_POLICY_NODE *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 policy_node_free(X509_POLICY_NODE *node);
int policy_node_match(const X509_POLICY_LEVEL *lvl,
const X509_POLICY_NODE *node, const ASN1_OBJECT *oid);
diff --git a/crypto/x509v3/pcy_node.c b/crypto/x509v3/pcy_node.c
index e2d7b15322..d574fb9d66 100644
--- a/crypto/x509v3/pcy_node.c
+++ b/crypto/x509v3/pcy_node.c
@@ -59,10 +59,15 @@ X509_POLICY_NODE *level_find_node(const X509_POLICY_LEVEL *level,
X509_POLICY_NODE *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) {
X509V3err(X509V3_F_LEVEL_ADD_NODE, ERR_R_MALLOC_FAILURE);
@@ -70,7 +75,7 @@ X509_POLICY_NODE *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 *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 *level_add_node(X509_POLICY_LEVEL *level,
}
}
+ tree->node_count++;
if (parent)
parent->nchild++;
diff --git a/crypto/x509v3/pcy_tree.c b/crypto/x509v3/pcy_tree.c
index 6e8322cbc5..6c7fd35405 100644
--- a/crypto/x509v3/pcy_tree.c
+++ b/crypto/x509v3/pcy_tree.c
@@ -13,6 +13,18 @@
#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
+
/*
* Enable this to print out the complete policy tree at various point during
* evaluation.
@@ -168,6 +180,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.
*
@@ -184,7 +199,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
level = tree->levels;
if ((data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0)) == NULL)
goto bad_tree;
- if (level_add_node(level, data, NULL, tree) == NULL) {
+ if (level_add_node(level, data, NULL, tree, 1) == NULL) {
policy_data_free(data);
goto bad_tree;
}
@@ -243,7 +258,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;
@@ -253,13 +269,13 @@ static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
X509_POLICY_NODE *node = sk_X509_POLICY_NODE_value(last->nodes, i);
if (policy_node_match(last, node, data->valid_policy)) {
- if (level_add_node(curr, data, node, NULL) == NULL)
+ if (level_add_node(curr, data, node, tree, 0) == NULL)
return 0;
matched = 1;
}
}
if (!matched && last->anyPolicy) {
- if (level_add_node(curr, data, last->anyPolicy, NULL) == NULL)
+ if (level_add_node(curr, data, last->anyPolicy, tree, 0) == NULL)
return 0;
}
return 1;
@@ -272,7 +288,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;
@@ -280,7 +297,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;
@@ -311,7 +328,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 (level_add_node(curr, data, node, tree) == NULL) {
+ if (level_add_node(curr, data, node, tree, 1) == NULL) {
policy_data_free(data);
return 0;
}
@@ -373,7 +390,7 @@ static int tree_link_any(X509_POLICY_LEVEL *curr,
}
/* Finally add link to anyPolicy */
if (last->anyPolicy &&
- level_add_node(curr, cache->anyPolicy, last->anyPolicy, NULL) == NULL)
+ level_add_node(curr, cache->anyPolicy, last->anyPolicy, tree, 0) == NULL)
return 0;
return 1;
}
@@ -555,7 +572,7 @@ static int tree_calculate_user_set(X509_POLICY_TREE *tree,
extra->qualifier_set = anyPolicy->data->qualifier_set;
extra->flags = POLICY_DATA_FLAG_SHARED_QUALIFIERS
| POLICY_DATA_FLAG_EXTRA_NODE;
- node = level_add_node(NULL, extra, anyPolicy->parent, tree);
+ node = level_add_node(NULL, extra, anyPolicy->parent, tree, 1);
}
if (!tree->user_policies) {
tree->user_policies = sk_X509_POLICY_NODE_new_null();
@@ -582,7 +599,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree)
for (i = 1; i < tree->nlevel; i++, curr++) {
cache = 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.34.1

View File

@@ -1,60 +0,0 @@
From b013765abfa80036dc779dd0e50602c57bb3bf95 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/20588)
CVE: CVE-2023-0465
Upstream-Status: Backport [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=b013765abfa80036dc779dd0e50602c57bb3bf95]
Comment: Refreshed first hunk
Signed-off-by: Omkar Patil <omkar.patil@kpit.com>
---
crypto/x509/x509_vfy.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
index 925fbb5412..1dfe4f9f31 100644
--- a/crypto/x509/x509_vfy.c
+++ b/crypto/x509/x509_vfy.c
@@ -1649,18 +1649,25 @@
}
/* 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))
continue;
+ cbcalled = 1;
if (!verify_cb_cert(ctx, x, i,
X509_V_ERR_INVALID_POLICY_EXTENSION))
return 0;
}
+ if (!cbcalled) {
+ /* Should not be able to get here */
+ X509err(X509_F_CHECK_POLICY, ERR_R_INTERNAL_ERROR);
+ return 0;
+ }
+ /* The callback ignored the error so we return success */
return 1;
}
if (ret == X509_PCY_TREE_FAILURE) {
--
2.34.1

View File

@@ -1,82 +0,0 @@
From 0d16b7e99aafc0b4a6d729eec65a411a7e025f0a 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/20564)
CVE: CVE-2023-0466
Upstream-Status: Backport [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=0d16b7e99aafc0b4a6d729eec65a411a7e025f0a]
Comment: Refreshed first hunk from CHANGE and NEWS
Signed-off-by: Omkar Patil <omkar.patil@kpit.com>
---
CHANGES | 5 +++++
NEWS | 1 +
doc/man3/X509_VERIFY_PARAM_set_flags.pod | 9 +++++++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGES b/CHANGES
index efccf7838e..b19f1429bb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,11 @@
Changes between 1.1.1s and 1.1.1t [7 Feb 2023]
+ *) Corrected documentation of X509_VERIFY_PARAM_add0_policy() to mention
+ that it does not enable policy checking. Thanks to
+ David Benjamin for discovering this issue. (CVE-2023-0466)
+ [Tomas Mraz]
+
*) Fixed X.400 address type confusion in X.509 GeneralName.
There is a type confusion vulnerability relating to X.400 address processing
diff --git a/NEWS b/NEWS
index 36a9bb6890..62615693fa 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@
Major changes between OpenSSL 1.1.1s and OpenSSL 1.1.1t [7 Feb 2023]
+ o Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466)
o Fixed X.400 address type confusion in X.509 GeneralName (CVE-2023-0286)
o Fixed Use-after-free following BIO_new_NDEF (CVE-2023-0215)
o Fixed Double free after calling PEM_read_bio_ex (CVE-2022-4450)
diff --git a/doc/man3/X509_VERIFY_PARAM_set_flags.pod b/doc/man3/X509_VERIFY_PARAM_set_flags.pod
index f6f304bf7b..aa292f9336 100644
--- a/doc/man3/X509_VERIFY_PARAM_set_flags.pod
+++ b/doc/man3/X509_VERIFY_PARAM_set_flags.pod
@@ -92,8 +92,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
@@ -377,6 +378,10 @@ and has no effect.
The X509_VERIFY_PARAM_get_hostflags() function was added in OpenSSL 1.1.0i.
+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-2020 The OpenSSL Project Authors. All Rights Reserved.
--
2.34.1

View File

@@ -1,122 +0,0 @@
From 9e209944b35cf82368071f160a744b6178f9b098 Mon Sep 17 00:00:00 2001
From: Richard Levitte <levitte@openssl.org>
Date: Fri, 12 May 2023 10:00:13 +0200
Subject: [PATCH] Restrict the size of OBJECT IDENTIFIERs that OBJ_obj2txt will
translate
OBJ_obj2txt() would translate any size OBJECT IDENTIFIER to canonical
numeric text form. For gigantic sub-identifiers, this would take a very
long time, the time complexity being O(n^2) where n is the size of that
sub-identifier.
To mitigate this, a restriction on the size that OBJ_obj2txt() will
translate to canonical numeric text form is added, based on RFC 2578
(STD 58), which says this:
> 3.5. OBJECT IDENTIFIER values
>
> An OBJECT IDENTIFIER value is an ordered list of non-negative numbers.
> For the SMIv2, each number in the list is referred to as a sub-identifier,
> there are at most 128 sub-identifiers in a value, and each sub-identifier
> has a maximum value of 2^32-1 (4294967295 decimal).
Fixes otc/security#96
Fixes CVE-2023-2650
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Upstream-Status: Backport [https://github.com/openssl/openssl/commit/9e209944b35cf82368071f160a744b6178f9b098]
CVE: CVE-2023-2650
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
CHANGES | 28 +++++++++++++++++++++++++++-
NEWS | 2 ++
crypto/objects/obj_dat.c | 19 +++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/CHANGES b/CHANGES
index 1eaaf4e..f2cf38f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,7 +7,33 @@
https://github.com/openssl/openssl/commits/ and pick the appropriate
release branch.
- Changes between 1.1.1s and 1.1.1t [7 Feb 2023]
+ Changes between 1.1.1t and 1.1.1u [xx XXX xxxx]
+
+ *) Mitigate for the time it takes for `OBJ_obj2txt` to translate gigantic
+ OBJECT IDENTIFIER sub-identifiers to canonical numeric text form.
+
+ OBJ_obj2txt() would translate any size OBJECT IDENTIFIER to canonical
+ numeric text form. For gigantic sub-identifiers, this would take a very
+ long time, the time complexity being O(n^2) where n is the size of that
+ sub-identifier. (CVE-2023-2650)
+
+ To mitigitate this, `OBJ_obj2txt()` will only translate an OBJECT
+ IDENTIFIER to canonical numeric text form if the size of that OBJECT
+ IDENTIFIER is 586 bytes or less, and fail otherwise.
+
+ The basis for this restriction is RFC 2578 (STD 58), section 3.5. OBJECT
+ IDENTIFIER values, which stipulates that OBJECT IDENTIFIERS may have at
+ most 128 sub-identifiers, and that the maximum value that each sub-
+ identifier may have is 2^32-1 (4294967295 decimal).
+
+ For each byte of every sub-identifier, only the 7 lower bits are part of
+ the value, so the maximum amount of bytes that an OBJECT IDENTIFIER with
+ these restrictions may occupy is 32 * 128 / 7, which is approximately 586
+ bytes.
+
+ Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
+
+Changes between 1.1.1s and 1.1.1t [7 Feb 2023]
*) Corrected documentation of X509_VERIFY_PARAM_add0_policy() to mention
that it does not enable policy checking. Thanks to
diff --git a/NEWS b/NEWS
index a86220a..41922c4 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@
Major changes between OpenSSL 1.1.1s and OpenSSL 1.1.1t [7 Feb 2023]
+ o Mitigate for very slow `OBJ_obj2txt()` performance with gigantic
+ OBJECT IDENTIFIER sub-identities. (CVE-2023-2650)
o Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466)
o Fixed X.400 address type confusion in X.509 GeneralName (CVE-2023-0286)
o Fixed Use-after-free following BIO_new_NDEF (CVE-2023-0215)
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index 7e8de72..d699915 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -428,6 +428,25 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
first = 1;
bl = NULL;
+ /*
+ * RFC 2578 (STD 58) says this about OBJECT IDENTIFIERs:
+ *
+ * > 3.5. OBJECT IDENTIFIER values
+ * >
+ * > An OBJECT IDENTIFIER value is an ordered list of non-negative
+ * > numbers. For the SMIv2, each number in the list is referred to as a
+ * > sub-identifier, there are at most 128 sub-identifiers in a value,
+ * > and each sub-identifier has a maximum value of 2^32-1 (4294967295
+ * > decimal).
+ *
+ * So a legitimate OID according to this RFC is at most (32 * 128 / 7),
+ * i.e. 586 bytes long.
+ *
+ * Ref: https://datatracker.ietf.org/doc/html/rfc2578#section-3.5
+ */
+ if (len > 586)
+ goto err;
+
while (len > 0) {
l = 0;
use_bn = 0;
--
2.25.1

View File

@@ -19,17 +19,14 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
file://reproducible.patch \
file://reproducibility.patch \
file://0001-Configure-add-2-missing-key-sorts.patch \
file://CVE-2023-0464.patch \
file://CVE-2023-0465.patch \
file://CVE-2023-0466.patch \
file://CVE-2023-2650.patch \
file://0001-Configure-do-not-tweak-mips-cflags.patch \
"
SRC_URI_append_class-nativesdk = " \
file://environment.d-openssl.sh \
"
SRC_URI[sha256sum] = "8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b"
SRC_URI[sha256sum] = "d6697e2871e77238460402e9362d47d18382b15ef9f246aba6c7bd780d38a6b0"
inherit lib_package multilib_header multilib_script ptest
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"

View File

@@ -58,7 +58,7 @@ elif targettype == "ssh":
user = os.environ.get("SSH_HOST_USER", None)
port = os.environ.get("SSH_HOST_PORT", None)
command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no"]
command = ["ssh", "-o", "UserKnownHostsFile=/dev/null", "-o", "StrictHostKeyChecking=no", "-o", "LogLevel=quiet"]
if port:
command += ["-p", str(port)]
if not host:

View File

@@ -24,7 +24,7 @@ IMAGE_FSTYPES = "wic.vmdk"
inherit core-image setuptools3
SRCREV ?= "88bec50206d02fef3cdc3eaabb638963144eb63b"
SRCREV ?= "6d6d43248e003895aa02103b2d239238e97d6167"
SRC_URI = "git://git.yoctoproject.org/poky;branch=dunfell \
file://Yocto_Build_Appliance.vmx \
file://Yocto_Build_Appliance.vmxf \

View File

@@ -136,7 +136,7 @@ def nvd_request_next(url, api_key, args):
if (r.headers['content-encoding'] == 'gzip'):
buf = r.read()
raw_data = gzip.decompress(buf)
raw_data = gzip.decompress(buf).decode("utf-8")
else:
raw_data = r.read().decode("utf-8")

View File

@@ -189,7 +189,7 @@ class SystemdUnit():
try:
for dependent in config.get('Install', prop):
# expand any %i to instance (ignoring escape sequence %%)
dependent = re.sub("([^%](%%)*)%i", "\\1{}".format(instance), dependent)
dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent)
wants = systemdir / "{}.{}".format(dependent, dirstem) / service
add_link(wants, target)

View File

@@ -0,0 +1,236 @@
From 24def311c6168d0dfb7c5f0f183b72b709c49265 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 20 Feb 2023 14:53:21 +0100
Subject: [PATCH] dmidecode: Split table fetching from decoding
Clean up function dmi_table so that it does only one thing:
* dmi_table() is renamed to dmi_table_get(). It now retrieves the
DMI table, but does not process it any longer.
* Decoding or dumping the table is now done in smbios3_decode(),
smbios_decode() and legacy_decode().
No functional change.
A side effect of this change is that writing the header and body of
dump files is now done in a single location. This is required to
further consolidate the writing of dump files.
CVE-ID: CVE-2023-30630
Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=39b2dd7b6ab7]
Backport Changes:
- In the file dmidecode.c, the commit [dd593d2] in v3.3 introduces
pr_info(). This is backported to printf() as per v3.2.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
(cherry picked from commit 39b2dd7b6ab719b920e96ed832cfb4bdd664e808)
Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
---
dmidecode.c | 86 ++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 62 insertions(+), 24 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index a3e9d6c..d6eedd1 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5211,8 +5211,9 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
}
}
-static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
- u32 flags)
+/* Allocates a buffer for the table, must be freed by the caller */
+static u8 *dmi_table_get(off_t base, u32 *len, u16 num, u32 ver,
+ const char *devmem, u32 flags)
{
u8 *buf;
@@ -5231,7 +5232,7 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
{
if (num)
printf("%u structures occupying %u bytes.\n",
- num, len);
+ num, *len);
if (!(opt.flags & FLAG_FROM_DUMP))
printf("Table at 0x%08llX.\n",
(unsigned long long)base);
@@ -5249,19 +5250,19 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
* would be the result of the kernel truncating the table on
* parse error.
*/
- size_t size = len;
+ size_t size = *len;
buf = read_file(flags & FLAG_NO_FILE_OFFSET ? 0 : base,
&size, devmem);
- if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len)
+ if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)*len)
{
fprintf(stderr, "Wrong DMI structures length: %u bytes "
"announced, only %lu bytes available.\n",
- len, (unsigned long)size);
+ *len, (unsigned long)size);
}
- len = size;
+ *len = size;
}
else
- buf = mem_chunk(base, len, devmem);
+ buf = mem_chunk(base, *len, devmem);
if (buf == NULL)
{
@@ -5271,15 +5272,9 @@ static void dmi_table(off_t base, u32 len, u16 num, u32 ver, const char *devmem,
fprintf(stderr,
"Try compiling dmidecode with -DUSE_MMAP.\n");
#endif
- return;
}
- if (opt.flags & FLAG_DUMP_BIN)
- dmi_table_dump(buf, len);
- else
- dmi_table_decode(buf, len, num, ver >> 8, flags);
-
- free(buf);
+ return buf;
}
@@ -5314,8 +5309,9 @@ static void overwrite_smbios3_address(u8 *buf)
static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
{
- u32 ver;
+ u32 ver, len;
u64 offset;
+ u8 *table;
/* Don't let checksum run beyond the buffer */
if (buf[0x06] > 0x20)
@@ -5341,8 +5337,12 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
return 0;
}
- dmi_table(((off_t)offset.h << 32) | offset.l,
- DWORD(buf + 0x0C), 0, ver, devmem, flags | FLAG_STOP_AT_EOT);
+ /* Maximum length, may get trimmed */
+ len = DWORD(buf + 0x0C);
+ table = dmi_table_get(((off_t)offset.h << 32) | offset.l, &len, 0, ver,
+ devmem, flags | FLAG_STOP_AT_EOT);
+ if (table == NULL)
+ return 1;
if (opt.flags & FLAG_DUMP_BIN)
{
@@ -5351,18 +5351,28 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 32);
overwrite_smbios3_address(crafted);
+ dmi_table_dump(table, len);
if (!(opt.flags & FLAG_QUIET))
printf("# Writing %d bytes to %s.\n", crafted[0x06],
opt.dumpfile);
write_dump(0, crafted[0x06], crafted, opt.dumpfile, 1);
}
+ else
+ {
+ dmi_table_decode(table, len, 0, ver >> 8,
+ flags | FLAG_STOP_AT_EOT);
+ }
+
+ free(table);
return 1;
}
static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
{
- u16 ver;
+ u16 ver, num;
+ u32 len;
+ u8 *table;
/* Don't let checksum run beyond the buffer */
if (buf[0x05] > 0x20)
@@ -5402,8 +5412,13 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
printf("SMBIOS %u.%u present.\n",
ver >> 8, ver & 0xFF);
- dmi_table(DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C),
- ver << 8, devmem, flags);
+ /* Maximum length, may get trimmed */
+ len = WORD(buf + 0x16);
+ num = WORD(buf + 0x1C);
+ table = dmi_table_get(DWORD(buf + 0x18), &len, num, ver << 8,
+ devmem, flags);
+ if (table == NULL)
+ return 1;
if (opt.flags & FLAG_DUMP_BIN)
{
@@ -5412,27 +5427,43 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 32);
overwrite_dmi_address(crafted + 0x10);
+ dmi_table_dump(table, len);
if (!(opt.flags & FLAG_QUIET))
printf("# Writing %d bytes to %s.\n", crafted[0x05],
opt.dumpfile);
write_dump(0, crafted[0x05], crafted, opt.dumpfile, 1);
}
+ else
+ {
+ dmi_table_decode(table, len, num, ver, flags);
+ }
+
+ free(table);
return 1;
}
static int legacy_decode(u8 *buf, const char *devmem, u32 flags)
{
+ u16 ver, num;
+ u32 len;
+ u8 *table;
+
if (!checksum(buf, 0x0F))
return 0;
+ ver = ((buf[0x0E] & 0xF0) << 4) + (buf[0x0E] & 0x0F);
if (!(opt.flags & FLAG_QUIET))
printf("Legacy DMI %u.%u present.\n",
buf[0x0E] >> 4, buf[0x0E] & 0x0F);
- dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C),
- ((buf[0x0E] & 0xF0) << 12) + ((buf[0x0E] & 0x0F) << 8),
- devmem, flags);
+ /* Maximum length, may get trimmed */
+ len = WORD(buf + 0x06);
+ num = WORD(buf + 0x0C);
+ table = dmi_table_get(DWORD(buf + 0x08), &len, num, ver << 8,
+ devmem, flags);
+ if (table == NULL)
+ return 1;
if (opt.flags & FLAG_DUMP_BIN)
{
@@ -5441,11 +5472,18 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 16);
overwrite_dmi_address(crafted);
+ dmi_table_dump(table, len);
if (!(opt.flags & FLAG_QUIET))
printf("# Writing %d bytes to %s.\n", 0x0F,
opt.dumpfile);
write_dump(0, 0x0F, crafted, opt.dumpfile, 1);
}
+ else
+ {
+ dmi_table_decode(table, len, num, ver, flags);
+ }
+
+ free(table);
return 1;
}

View File

@@ -0,0 +1,198 @@
From 58e8a07b1aef0e53af1642b30248255e53e42790 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 20 Feb 2023 14:53:25 +0100
Subject: [PATCH] dmidecode: Write the whole dump file at once
When option --dump-bin is used, write the whole dump file at once,
instead of opening and closing the file separately for the table
and then for the entry point.
As the file writing function is no longer generic, it gets moved
from util.c to dmidecode.c.
One minor functional change resulting from the new implementation is
that the entry point is written first now, so the messages printed
are swapped.
CVE: CVE-2023-30630
Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=d8cfbc808f38]
Backport Changes:
- In the file dmidecode.c, the commit [2241f1d] in v3.3 introduces
pr_info(). This is backported to printf() as per v3.2.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
(cherry picked from commit d8cfbc808f387e87091c25e7d5b8c2bb348bb206)
Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
---
dmidecode.c | 69 +++++++++++++++++++++++++++++++++++++++--------------
util.c | 40 -------------------------------
util.h | 1 -
3 files changed, 51 insertions(+), 59 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index d6eedd1..b91e53b 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -5094,11 +5094,56 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
}
}
-static void dmi_table_dump(const u8 *buf, u32 len)
+static int dmi_table_dump(const u8 *ep, u32 ep_len, const u8 *table,
+ u32 table_len)
{
+ FILE *f;
+
+ f = fopen(opt.dumpfile, "wb");
+ if (!f)
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("fopen");
+ return -1;
+ }
+
+ if (!(opt.flags & FLAG_QUIET))
+ printf("# Writing %d bytes to %s.\n", ep_len, opt.dumpfile);
+ if (fwrite(ep, ep_len, 1, f) != 1)
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("fwrite");
+ goto err_close;
+ }
+
+ if (fseek(f, 32, SEEK_SET) != 0)
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("fseek");
+ goto err_close;
+ }
+
if (!(opt.flags & FLAG_QUIET))
- printf("# Writing %d bytes to %s.\n", len, opt.dumpfile);
- write_dump(32, len, buf, opt.dumpfile, 0);
+ printf("# Writing %d bytes to %s.\n", table_len, opt.dumpfile);
+ if (fwrite(table, table_len, 1, f) != 1)
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("fwrite");
+ goto err_close;
+ }
+
+ if (fclose(f))
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("fclose");
+ return -1;
+ }
+
+ return 0;
+
+err_close:
+ fclose(f);
+ return -1;
}
static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
@@ -5351,11 +5396,7 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 32);
overwrite_smbios3_address(crafted);
- dmi_table_dump(table, len);
- if (!(opt.flags & FLAG_QUIET))
- printf("# Writing %d bytes to %s.\n", crafted[0x06],
- opt.dumpfile);
- write_dump(0, crafted[0x06], crafted, opt.dumpfile, 1);
+ dmi_table_dump(crafted, crafted[0x06], table, len);
}
else
{
@@ -5427,11 +5468,7 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 32);
overwrite_dmi_address(crafted + 0x10);
- dmi_table_dump(table, len);
- if (!(opt.flags & FLAG_QUIET))
- printf("# Writing %d bytes to %s.\n", crafted[0x05],
- opt.dumpfile);
- write_dump(0, crafted[0x05], crafted, opt.dumpfile, 1);
+ dmi_table_dump(crafted, crafted[0x05], table, len);
}
else
{
@@ -5472,11 +5509,7 @@ static int legacy_decode(u8 *buf, const char *devmem, u32 flags)
memcpy(crafted, buf, 16);
overwrite_dmi_address(crafted);
- dmi_table_dump(table, len);
- if (!(opt.flags & FLAG_QUIET))
- printf("# Writing %d bytes to %s.\n", 0x0F,
- opt.dumpfile);
- write_dump(0, 0x0F, crafted, opt.dumpfile, 1);
+ dmi_table_dump(crafted, 0x0F, table, len);
}
else
{
diff --git a/util.c b/util.c
index eeffdae..2e1931c 100644
--- a/util.c
+++ b/util.c
@@ -247,46 +247,6 @@ out:
return p;
}
-int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add)
-{
- FILE *f;
-
- f = fopen(dumpfile, add ? "r+b" : "wb");
- if (!f)
- {
- fprintf(stderr, "%s: ", dumpfile);
- perror("fopen");
- return -1;
- }
-
- if (fseek(f, base, SEEK_SET) != 0)
- {
- fprintf(stderr, "%s: ", dumpfile);
- perror("fseek");
- goto err_close;
- }
-
- if (fwrite(data, len, 1, f) != 1)
- {
- fprintf(stderr, "%s: ", dumpfile);
- perror("fwrite");
- goto err_close;
- }
-
- if (fclose(f))
- {
- fprintf(stderr, "%s: ", dumpfile);
- perror("fclose");
- return -1;
- }
-
- return 0;
-
-err_close:
- fclose(f);
- return -1;
-}
-
/* Returns end - start + 1, assuming start < end */
u64 u64_range(u64 start, u64 end)
{
diff --git a/util.h b/util.h
index 3094cf8..ef24eb9 100644
--- a/util.h
+++ b/util.h
@@ -27,5 +27,4 @@
int checksum(const u8 *buf, size_t len);
void *read_file(off_t base, size_t *len, const char *filename);
void *mem_chunk(off_t base, size_t len, const char *devmem);
-int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add);
u64 u64_range(u64 start, u64 end);

View File

@@ -0,0 +1,62 @@
From b7dacccff32294ea522df32a9391d0218e7600ea Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Mon, 20 Feb 2023 14:53:31 +0100
Subject: [PATCH] dmidecode: Do not let --dump-bin overwrite an existing file
Make sure that the file passed to option --dump-bin does not already
exist. In practice, it is rather unlikely that an honest user would
want to overwrite an existing dump file, while this possibility
could be used by a rogue user to corrupt a system file.
CVE: CVE-2023-30630
Upstream-Status: Backport [https://git.savannah.nongnu.org/cgit/dmidecode.git/commit/?id=6ca381c1247c]
Backport Changes:
- Ignored changes in man/dmidecode.8 file.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
(cherry picked from commit 6ca381c1247c81f74e1ca4e7706f70bdda72e6f2)
Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
---
dmidecode.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dmidecode.c b/dmidecode.c
index b91e53b..846d9a1 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -60,6 +60,7 @@
* https://www.dmtf.org/sites/default/files/DSP0270_1.0.1.pdf
*/
+#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
@@ -5097,13 +5098,22 @@ static void dmi_table_string(const struct dmi_header *h, const u8 *data, u16 ver
static int dmi_table_dump(const u8 *ep, u32 ep_len, const u8 *table,
u32 table_len)
{
+ int fd;
FILE *f;
- f = fopen(opt.dumpfile, "wb");
+ fd = open(opt.dumpfile, O_WRONLY|O_CREAT|O_EXCL, 0666);
+ if (fd == -1)
+ {
+ fprintf(stderr, "%s: ", opt.dumpfile);
+ perror("open");
+ return -1;
+ }
+
+ f = fdopen(fd, "wb");
if (!f)
{
fprintf(stderr, "%s: ", opt.dumpfile);
- perror("fopen");
+ perror("fdopen");
return -1;
}

View File

@@ -6,6 +6,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
SRC_URI = "${SAVANNAH_NONGNU_MIRROR}/dmidecode/${BP}.tar.xz \
file://0001-Committing-changes-from-do_unpack_extra.patch \
file://CVE-2023-30630-dependent_p1.patch \
file://CVE-2023-30630-dependent_p2.patch \
file://CVE-2023-30630.patch \
"
COMPATIBLE_HOST = "(i.86|x86_64|aarch64|arm|powerpc|powerpc64).*-linux"

View File

@@ -34,6 +34,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
file://0001-ppc_initreg.c-Incliude-asm-ptrace.h-for-pt_regs-defi.patch \
file://run-ptest \
file://ptest.patch \
file://CVE-2021-33294.patch \
"
SRC_URI_append_libc-musl = " \
file://0001-musl-obstack-fts.patch \

View File

@@ -0,0 +1,72 @@
From 480b6fa3662ba8ffeee274bf0d37423413c01e55 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Wed, 3 Mar 2021 21:40:53 +0100
Subject: [PATCH] readelf: Sanity check verneed and verdef offsets in handle_symtab.
We are going through vna_next, vn_next and vd_next in a while loop.
Make sure that all offsets are sane. We don't want things to wrap
around so we go in cycles.
https://sourceware.org/bugzilla/show_bug.cgi?id=27501
Signed-off-by: Mark Wielaard <mark@klomp.org>
Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=480b6fa3662ba8ffeee274bf0d37423413c01e55]
CVE: CVE-2021-33294
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
src/ChangeLog | 5 +++++
src/readelf.c | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 6af977e..f0d9e39 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-03 Mark Wielaard <mark@klomp.org>
+
+ * readelf.c (handle_symtab): Sanity check verneed vna_next,
+ vn_next and verdef vd_next offsets.
+
2019-11-26 Mark Wielaard <mark@klomp.org>
* Makefile.am (BUILD_STATIC): Add libraries needed for libdw.
diff --git a/src/readelf.c b/src/readelf.c
index 5994615..ab7a1c1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -2550,7 +2550,9 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
&vernaux_mem);
while (vernaux != NULL
&& vernaux->vna_other != *versym
- && vernaux->vna_next != 0)
+ && vernaux->vna_next != 0
+ && (verneed_data->d_size - vna_offset
+ >= vernaux->vna_next))
{
/* Update the offset. */
vna_offset += vernaux->vna_next;
@@ -2567,6 +2569,9 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Found it. */
break;
+ if (verneed_data->d_size - vn_offset < verneed->vn_next)
+ break;
+
vn_offset += verneed->vn_next;
verneed = (verneed->vn_next == 0
? NULL
@@ -2602,6 +2607,9 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
/* Found the definition. */
break;
+ if (verdef_data->d_size - vd_offset < verdef->vd_next)
+ break;
+
vd_offset += verdef->vd_next;
verdef = (verdef->vd_next == 0
? NULL
--
2.25.1

View File

@@ -68,6 +68,8 @@ SRC_URI += "\
file://CVE-2023-29402.patch \
file://CVE-2023-29404.patch \
file://CVE-2023-29400.patch \
file://CVE-2023-29406.patch \
file://CVE-2023-29409.patch \
"
SRC_URI_append_libc-musl = " file://0009-ld-replace-glibc-dynamic-linker-with-musl.patch"

View File

@@ -0,0 +1,212 @@
From 5fa6923b1ea891400153d04ddf1545e23b40041b Mon Sep 17 00:00:00 2001
From: Damien Neil <dneil@google.com>
Date: Wed, 28 Jun 2023 13:20:08 -0700
Subject: [PATCH] [release-branch.go1.19] net/http: validate Host header before
sending
Verify that the Host header we send is valid.
Avoids surprising behavior such as a Host of "go.dev\r\nX-Evil:oops"
adding an X-Evil header to HTTP/1 requests.
Add a test, skip the test for HTTP/2. HTTP/2 is not vulnerable to
header injection in the way HTTP/1 is, but x/net/http2 doesn't validate
the header and will go into a retry loop when the server rejects it.
CL 506995 adds the necessary validation to x/net/http2.
Updates #60374
Fixes #61075
For CVE-2023-29406
Change-Id: I05cb6866a9bead043101954dfded199258c6dd04
Reviewed-on: https://go-review.googlesource.com/c/go/+/506996
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
(cherry picked from commit 499458f7ca04087958987a33c2703c3ef03e27e2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/507358
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Upstream-Status: Backport [https://github.com/golang/go/commit/5fa6923b1ea891400153d04ddf1545e23b40041b]
CVE: CVE-2023-29406
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
---
src/net/http/http_test.go | 29 ---------------------
src/net/http/request.go | 47 ++++++++--------------------------
src/net/http/request_test.go | 11 ++------
src/net/http/transport_test.go | 18 +++++++++++++
4 files changed, 31 insertions(+), 74 deletions(-)
diff --git a/src/net/http/http_test.go b/src/net/http/http_test.go
index f4ea52d..ea38cb4 100644
--- a/src/net/http/http_test.go
+++ b/src/net/http/http_test.go
@@ -49,35 +49,6 @@ func TestForeachHeaderElement(t *testing.T) {
}
}
-func TestCleanHost(t *testing.T) {
- tests := []struct {
- in, want string
- }{
- {"www.google.com", "www.google.com"},
- {"www.google.com foo", "www.google.com"},
- {"www.google.com/foo", "www.google.com"},
- {" first character is a space", ""},
- {"[1::6]:8080", "[1::6]:8080"},
-
- // Punycode:
- {"гофер.рф/foo", "xn--c1ae0ajs.xn--p1ai"},
- {"bücher.de", "xn--bcher-kva.de"},
- {"bücher.de:8080", "xn--bcher-kva.de:8080"},
- // Verify we convert to lowercase before punycode:
- {"BÜCHER.de", "xn--bcher-kva.de"},
- {"BÜCHER.de:8080", "xn--bcher-kva.de:8080"},
- // Verify we normalize to NFC before punycode:
- {"gophér.nfc", "xn--gophr-esa.nfc"}, // NFC input; no work needed
- {"goph\u0065\u0301r.nfd", "xn--gophr-esa.nfd"}, // NFD input
- }
- for _, tt := range tests {
- got := cleanHost(tt.in)
- if tt.want != got {
- t.Errorf("cleanHost(%q) = %q, want %q", tt.in, got, tt.want)
- }
- }
-}
-
// Test that cmd/go doesn't link in the HTTP server.
//
// This catches accidental dependencies between the HTTP transport and
diff --git a/src/net/http/request.go b/src/net/http/request.go
index cb2edd2..2706300 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -18,7 +18,6 @@ import (
"io/ioutil"
"mime"
"mime/multipart"
- "net"
"net/http/httptrace"
"net/textproto"
"net/url"
@@ -26,7 +25,8 @@ import (
"strconv"
"strings"
"sync"
-
+
+ "golang.org/x/net/http/httpguts"
"golang.org/x/net/idna"
)
@@ -557,12 +557,19 @@ func (r *Request) write(w io.Writer, usingProxy bool, extraHeaders Header, waitF
// is not given, use the host from the request URL.
//
// Clean the host, in case it arrives with unexpected stuff in it.
- host := cleanHost(r.Host)
+ host := r.Host
if host == "" {
if r.URL == nil {
return errMissingHost
}
- host = cleanHost(r.URL.Host)
+ host = r.URL.Host
+ }
+ host, err = httpguts.PunycodeHostPort(host)
+ if err != nil {
+ return err
+ }
+ if !httpguts.ValidHostHeader(host) {
+ return errors.New("http: invalid Host header")
}
// According to RFC 6874, an HTTP client, proxy, or other
@@ -717,38 +724,6 @@ func idnaASCII(v string) (string, error) {
return idna.Lookup.ToASCII(v)
}
-// cleanHost cleans up the host sent in request's Host header.
-//
-// It both strips anything after '/' or ' ', and puts the value
-// into Punycode form, if necessary.
-//
-// Ideally we'd clean the Host header according to the spec:
-// https://tools.ietf.org/html/rfc7230#section-5.4 (Host = uri-host [ ":" port ]")
-// https://tools.ietf.org/html/rfc7230#section-2.7 (uri-host -> rfc3986's host)
-// https://tools.ietf.org/html/rfc3986#section-3.2.2 (definition of host)
-// But practically, what we are trying to avoid is the situation in
-// issue 11206, where a malformed Host header used in the proxy context
-// would create a bad request. So it is enough to just truncate at the
-// first offending character.
-func cleanHost(in string) string {
- if i := strings.IndexAny(in, " /"); i != -1 {
- in = in[:i]
- }
- host, port, err := net.SplitHostPort(in)
- if err != nil { // input was just a host
- a, err := idnaASCII(in)
- if err != nil {
- return in // garbage in, garbage out
- }
- return a
- }
- a, err := idnaASCII(host)
- if err != nil {
- return in // garbage in, garbage out
- }
- return net.JoinHostPort(a, port)
-}
-
// removeZone removes IPv6 zone identifier from host.
// E.g., "[fe80::1%en0]:8080" to "[fe80::1]:8080"
func removeZone(host string) string {
diff --git a/src/net/http/request_test.go b/src/net/http/request_test.go
index 461d66e..0d417ff 100644
--- a/src/net/http/request_test.go
+++ b/src/net/http/request_test.go
@@ -676,15 +676,8 @@ func TestRequestBadHost(t *testing.T) {
}
req.Host = "foo.com with spaces"
req.URL.Host = "foo.com with spaces"
- req.Write(logWrites{t, &got})
- want := []string{
- "GET /after HTTP/1.1\r\n",
- "Host: foo.com\r\n",
- "User-Agent: " + DefaultUserAgent + "\r\n",
- "\r\n",
- }
- if !reflect.DeepEqual(got, want) {
- t.Errorf("Writes = %q\n Want = %q", got, want)
+ if err := req.Write(logWrites{t, &got}); err == nil {
+ t.Errorf("Writing request with invalid Host: succeded, want error")
}
}
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
index fa0c370..0afb6b9 100644
--- a/src/net/http/transport_test.go
+++ b/src/net/http/transport_test.go
@@ -6249,3 +6249,21 @@ func TestIssue32441(t *testing.T) {
t.Error(err)
}
}
+
+func TestRequestSanitization(t *testing.T) {
+ setParallel(t)
+ defer afterTest(t)
+
+ ts := newClientServerTest(t, h1Mode, HandlerFunc(func(rw ResponseWriter, req *Request) {
+ if h, ok := req.Header["X-Evil"]; ok {
+ t.Errorf("request has X-Evil header: %q", h)
+ }
+ })).ts
+ defer ts.Close()
+ req, _ := NewRequest("GET", ts.URL, nil)
+ req.Host = "go.dev\r\nX-Evil:evil"
+ resp, _ := ts.Client().Do(req)
+ if resp != nil {
+ resp.Body.Close()
+ }
+}
--
2.25.1

View File

@@ -0,0 +1,175 @@
From 2300f7ef07718f6be4d8aa8486c7de99836e233f Mon Sep 17 00:00:00 2001
From: Roland Shoemaker <bracewell@google.com>
Date: Wed, 7 Jun 2023 15:27:13 -0700
Subject: [PATCH] [release-branch.go1.19] crypto/tls: restrict RSA keys in
certificates to <= 8192 bits
Extremely large RSA keys in certificate chains can cause a client/server
to expend significant CPU time verifying signatures. Limit this by
restricting the size of RSA keys transmitted during handshakes to <=
8192 bits.
Based on a survey of publicly trusted RSA keys, there are currently only
three certificates in circulation with keys larger than this, and all
three appear to be test certificates that are not actively deployed. It
is possible there are larger keys in use in private PKIs, but we target
the web PKI, so causing breakage here in the interests of increasing the
default safety of users of crypto/tls seems reasonable.
Thanks to Mateusz Poliwczak for reporting this issue.
Updates #61460
Fixes #61579
Fixes CVE-2023-29409
Change-Id: Ie35038515a649199a36a12fc2c5df3af855dca6c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1912161
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
(cherry picked from commit d865c715d92887361e4bd5596e19e513f27781b7)
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1965487
Reviewed-on: https://go-review.googlesource.com/c/go/+/514915
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: David Chase <drchase@google.com>
Upstream-Status: Backport [https://github.com/golang/go/commit/2300f7ef07718f6be4d8aa8486c7de99836e233f]
CVE: CVE-2023-29409
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
src/crypto/tls/handshake_client.go | 8 +++
src/crypto/tls/handshake_client_test.go | 78 +++++++++++++++++++++++++
src/crypto/tls/handshake_server.go | 4 ++
3 files changed, 90 insertions(+)
diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
index 4fb528c..ba33ea1 100644
--- a/src/crypto/tls/handshake_client.go
+++ b/src/crypto/tls/handshake_client.go
@@ -788,6 +788,10 @@ func (hs *clientHandshakeState) sendFinished(out []byte) error {
return nil
}
+// maxRSAKeySize is the maximum RSA key size in bits that we are willing
+// to verify the signatures of during a TLS handshake.
+const maxRSAKeySize = 8192
+
// verifyServerCertificate parses and verifies the provided chain, setting
// c.verifiedChains and c.peerCertificates or sending the appropriate alert.
func (c *Conn) verifyServerCertificate(certificates [][]byte) error {
@@ -798,6 +802,10 @@ func (c *Conn) verifyServerCertificate(certificates [][]byte) error {
c.sendAlert(alertBadCertificate)
return errors.New("tls: failed to parse certificate from server: " + err.Error())
}
+ if cert.PublicKeyAlgorithm == x509.RSA && cert.PublicKey.(*rsa.PublicKey).N.BitLen() > maxRSAKeySize {
+ c.sendAlert(alertBadCertificate)
+ return fmt.Errorf("tls: server sent certificate containing RSA key larger than %d bits", maxRSAKeySize)
+ }
certs[i] = cert
}
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
index 6bd3c37..8d20b2b 100644
--- a/src/crypto/tls/handshake_client_test.go
+++ b/src/crypto/tls/handshake_client_test.go
@@ -1984,3 +1984,81 @@ func TestCloseClientConnectionOnIdleServer(t *testing.T) {
t.Errorf("Error expected, but no error returned")
}
}
+
+// discardConn wraps a net.Conn but discards all writes, but reports that they happened.
+type discardConn struct {
+ net.Conn
+}
+
+func (dc *discardConn) Write(data []byte) (int, error) {
+ return len(data), nil
+}
+
+// largeRSAKeyCertPEM contains a 8193 bit RSA key
+const largeRSAKeyCertPEM = `-----BEGIN CERTIFICATE-----
+MIIInjCCBIWgAwIBAgIBAjANBgkqhkiG9w0BAQsFADASMRAwDgYDVQQDEwd0ZXN0
+aW5nMB4XDTIzMDYwNzIxMjMzNloXDTIzMDYwNzIzMjMzNlowEjEQMA4GA1UEAxMH
+dGVzdGluZzCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBAWdHsf6Rh2Ca
+n2SQwn4t4OQrOjbLLdGE1pM6TBKKrHUFy62uEL8atNjlcfXIsa4aEu3xNGiqxqur
+ZectlkZbm0FkaaQ1Wr9oikDY3KfjuaXdPdO/XC/h8AKNxlDOylyXwUSK/CuYb+1j
+gy8yF5QFvVfwW/xwTlHmhUeSkVSQPosfQ6yXNNsmMzkd+ZPWLrfq4R+wiNtwYGu0
+WSBcI/M9o8/vrNLnIppoiBJJ13j9CR1ToEAzOFh9wwRWLY10oZhoh1ONN1KQURx4
+qedzvvP2DSjZbUccdvl2rBGvZpzfOiFdm1FCnxB0c72Cqx+GTHXBFf8bsa7KHky9
+sNO1GUanbq17WoDNgwbY6H51bfShqv0CErxatwWox3we4EcAmFHPVTCYL1oWVMGo
+a3Eth91NZj+b/nGhF9lhHKGzXSv9brmLLkfvM1jA6XhNhA7BQ5Vz67lj2j3XfXdh
+t/BU5pBXbL4Ut4mIhT1YnKXAjX2/LF5RHQTE8Vwkx5JAEKZyUEGOReD/B+7GOrLp
+HduMT9vZAc5aR2k9I8qq1zBAzsL69lyQNAPaDYd1BIAjUety9gAYaSQffCgAgpRO
+Gt+DYvxS+7AT/yEd5h74MU2AH7KrAkbXOtlwupiGwhMVTstncDJWXMJqbBhyHPF8
+3UmZH0hbL4PYmzSj9LDWQQXI2tv6vrCpfts3Cqhqxz9vRpgY7t1Wu6l/r+KxYYz3
+1pcGpPvRmPh0DJm7cPTiXqPnZcPt+ulSaSdlxmd19OnvG5awp0fXhxryZVwuiT8G
+VDkhyARrxYrdjlINsZJZbQjO0t8ketXAELJOnbFXXzeCOosyOHkLwsqOO96AVJA8
+45ZVL5m95ClGy0RSrjVIkXsxTAMVG6SPAqKwk6vmTdRGuSPS4rhgckPVDHmccmuq
+dfnT2YkX+wB2/M3oCgU+s30fAHGkbGZ0pCdNbFYFZLiH0iiMbTDl/0L/z7IdK0nH
+GLHVE7apPraKC6xl6rPWsD2iSfrmtIPQa0+rqbIVvKP5JdfJ8J4alI+OxFw/znQe
+V0/Rez0j22Fe119LZFFSXhRv+ZSvcq20xDwh00mzcumPWpYuCVPozA18yIhC9tNn
+ALHndz0tDseIdy9vC71jQWy9iwri3ueN0DekMMF8JGzI1Z6BAFzgyAx3DkHtwHg7
+B7qD0jPG5hJ5+yt323fYgJsuEAYoZ8/jzZ01pkX8bt+UsVN0DGnSGsI2ktnIIk3J
+l+8krjmUy6EaW79nITwoOqaeHOIp8m3UkjEcoKOYrzHRKqRy+A09rY+m/cAQaafW
+4xp0Zv7qZPLwnu0jsqB4jD8Ll9yPB02ndsoV6U5PeHzTkVhPml19jKUAwFfs7TJg
+kXy+/xFhYVUCAwEAATANBgkqhkiG9w0BAQsFAAOCBAIAAQnZY77pMNeypfpba2WK
+aDasT7dk2JqP0eukJCVPTN24Zca+xJNPdzuBATm/8SdZK9lddIbjSnWRsKvTnO2r
+/rYdlPf3jM5uuJtb8+Uwwe1s+gszelGS9G/lzzq+ehWicRIq2PFcs8o3iQMfENiv
+qILJ+xjcrvms5ZPDNahWkfRx3KCg8Q+/at2n5p7XYjMPYiLKHnDC+RE2b1qT20IZ
+FhuK/fTWLmKbfYFNNga6GC4qcaZJ7x0pbm4SDTYp0tkhzcHzwKhidfNB5J2vNz6l
+Ur6wiYwamFTLqcOwWo7rdvI+sSn05WQBv0QZlzFX+OAu0l7WQ7yU+noOxBhjvHds
+14+r9qcQZg2q9kG+evopYZqYXRUNNlZKo9MRBXhfrISulFAc5lRFQIXMXnglvAu+
+Ipz2gomEAOcOPNNVldhKAU94GAMJd/KfN0ZP7gX3YvPzuYU6XDhag5RTohXLm18w
+5AF+ES3DOQ6ixu3DTf0D+6qrDuK+prdX8ivcdTQVNOQ+MIZeGSc6NWWOTaMGJ3lg
+aZIxJUGdo6E7GBGiC1YTjgFKFbHzek1LRTh/LX3vbSudxwaG0HQxwsU9T4DWiMqa
+Fkf2KteLEUA6HrR+0XlAZrhwoqAmrJ+8lCFX3V0gE9lpENfVHlFXDGyx10DpTB28
+DdjnY3F7EPWNzwf9P3oNT69CKW3Bk6VVr3ROOJtDxVu1ioWo3TaXltQ0VOnap2Pu
+sa5wfrpfwBDuAS9JCDg4ttNp2nW3F7tgXC6xPqw5pvGwUppEw9XNrqV8TZrxduuv
+rQ3NyZ7KSzIpmFlD3UwV/fGfz3UQmHS6Ng1evrUID9DjfYNfRqSGIGjDfxGtYD+j
+Z1gLJZuhjJpNtwBkKRtlNtrCWCJK2hidK/foxwD7kwAPo2I9FjpltxCRywZUs07X
+KwXTfBR9v6ij1LV6K58hFS+8ezZyZ05CeVBFkMQdclTOSfuPxlMkQOtjp8QWDj+F
+j/MYziT5KBkHvcbrjdRtUJIAi4N7zCsPZtjik918AK1WBNRVqPbrgq/XSEXMfuvs
+6JbfK0B76vdBDRtJFC1JsvnIrGbUztxXzyQwFLaR/AjVJqpVlysLWzPKWVX6/+SJ
+u1NQOl2E8P6ycyBsuGnO89p0S4F8cMRcI2X1XQsZ7/q0NBrOMaEp5T3SrWo9GiQ3
+o2SBdbs3Y6MBPBtTu977Z/0RO63J3M5i2tjUiDfrFy7+VRLKr7qQ7JibohyB8QaR
+9tedgjn2f+of7PnP/PEl1cCphUZeHM7QKUMPT8dbqwmKtlYY43EHXcvNOT5IBk3X
+9lwJoZk/B2i+ZMRNSP34ztAwtxmasPt6RAWGQpWCn9qmttAHAnMfDqe7F7jVR6rS
+u58=
+-----END CERTIFICATE-----`
+
+func TestHandshakeRSATooBig(t *testing.T) {
+ testCert, _ := pem.Decode([]byte(largeRSAKeyCertPEM))
+
+ c := &Conn{conn: &discardConn{}, config: testConfig.Clone()}
+
+ expectedErr := "tls: server sent certificate containing RSA key larger than 8192 bits"
+ err := c.verifyServerCertificate([][]byte{testCert.Bytes})
+ if err == nil || err.Error() != expectedErr {
+ t.Errorf("Conn.verifyServerCertificate unexpected error: want %q, got %q", expectedErr, err)
+ }
+
+ expectedErr = "tls: client sent certificate containing RSA key larger than 8192 bits"
+ err = c.processCertsFromClient(Certificate{Certificate: [][]byte{testCert.Bytes}})
+ if err == nil || err.Error() != expectedErr {
+ t.Errorf("Conn.processCertsFromClient unexpected error: want %q, got %q", expectedErr, err)
+ }
+}
diff --git a/src/crypto/tls/handshake_server.go b/src/crypto/tls/handshake_server.go
index b16415a..2e36840 100644
--- a/src/crypto/tls/handshake_server.go
+++ b/src/crypto/tls/handshake_server.go
@@ -738,6 +738,10 @@ func (c *Conn) processCertsFromClient(certificate Certificate) error {
c.sendAlert(alertBadCertificate)
return errors.New("tls: failed to parse client certificate: " + err.Error())
}
+ if certs[i].PublicKeyAlgorithm == x509.RSA && certs[i].PublicKey.(*rsa.PublicKey).N.BitLen() > maxRSAKeySize {
+ c.sendAlert(alertBadCertificate)
+ return fmt.Errorf("tls: client sent certificate containing RSA key larger than %d bits", maxRSAKeySize)
+ }
}
if len(certs) == 0 && requiresClientCert(c.config.ClientAuth) {
--
2.25.1

View File

@@ -61,6 +61,8 @@ CVE_CHECK_WHITELIST += "CVE-2020-15523 CVE-2022-26488"
# The mailcap module is insecure by design, so this can't be fixed in a meaningful way.
# The module will be removed in the future and flaws documented.
CVE_CHECK_WHITELIST += "CVE-2015-20107"
# Not an issue, in fact expected behaviour
CVE_CHECK_WHITELIST += "CVE-2023-36632"
PYTHON_MAJMIN = "3.8"

View File

@@ -137,7 +137,10 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
file://CVE-2021-3409-4.patch \
file://CVE-2021-3409-5.patch \
file://hw-display-qxl-Pass-requested-buffer-size-to-qxl_phy.patch \
file://CVE-2023-0330.patch \
file://CVE-2023-0330_1.patch \
file://CVE-2023-0330_2.patch \
file://CVE-2023-3354.patch \
file://CVE-2023-3180.patch \
"
UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"

View File

@@ -20,16 +20,19 @@ Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20210407195801.685-7-mark.cave-ayland@ilande.co.uk>
CVE: CVE-2020-35504
CVE: CVE-2020-35505
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/qemu/tree/debian/patches/CVE-2020-35505.patch?h=ubuntu/focal-security Upstream commit https://github.com/qemu/qemu/commit/99545751734035b76bd372c4e7215bb337428d89 ]
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Signed-off-by: Emily Vekariya <emily.vekariya@einfochips.com>
---
hw/scsi/esp.c | 3 +++
1 file changed, 3 insertions(+)
hw/scsi/esp.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
index c7d701bf..c2a67bc8 100644
--- a/hw/scsi/esp.c
+++ b/hw/scsi/esp.c
@@ -193,6 +193,10 @@ static void do_busid_cmd(ESPState *s, ui
@@ -193,6 +193,10 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid)
trace_esp_do_busid_cmd(busid);
lun = busid & 7;

View File

@@ -0,0 +1,135 @@
From a2e1753b8054344f32cf94f31c6399a58794a380 Mon Sep 17 00:00:00 2001
From: Alexander Bulekov <alxndr@bu.edu>
Date: Thu, 27 Apr 2023 17:10:06 -0400
Subject: [PATCH] memory: prevent dma-reentracy issues
Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA.
This flag is set/checked prior to calling a device's MemoryRegion
handlers, and set when device code initiates DMA. The purpose of this
flag is to prevent two types of DMA-based reentrancy issues:
1.) mmio -> dma -> mmio case
2.) bh -> dma write -> mmio case
These issues have led to problems such as stack-exhaustion and
use-after-frees.
Summary of the problem from Peter Maydell:
https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/62
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/540
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/541
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/556
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/557
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/827
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1282
Resolves: CVE-2023-0330
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230427211013.2994127-2-alxndr@bu.edu>
[thuth: Replace warn_report() with warn_report_once()]
Signed-off-by: Thomas Huth <thuth@redhat.com>
Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/a2e1753b8054344f32cf94f31c6399a58794a380]
CVE: CVE-2023-0330
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
include/exec/memory.h | 5 +++++
include/hw/qdev-core.h | 7 +++++++
memory.c | 16 ++++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2b8bccdd..0c8cdb8e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -378,6 +378,8 @@ struct MemoryRegion {
bool is_iommu;
RAMBlock *ram_block;
Object *owner;
+ /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
+ DeviceState *dev;
const MemoryRegionOps *ops;
void *opaque;
@@ -400,6 +402,9 @@ struct MemoryRegion {
const char *name;
unsigned ioeventfd_nb;
MemoryRegionIoeventfd *ioeventfds;
+
+ /* For devices designed to perform re-entrant IO into their own IO MRs */
+ bool disable_reentrancy_guard;
};
struct IOMMUMemoryRegion {
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1518495b..206f0a70 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -138,6 +138,10 @@ struct NamedGPIOList {
QLIST_ENTRY(NamedGPIOList) node;
};
+typedef struct {
+ bool engaged_in_io;
+} MemReentrancyGuard;
+
/**
* DeviceState:
* @realized: Indicates whether the device has been fully constructed.
@@ -163,6 +167,9 @@ struct DeviceState {
int num_child_bus;
int instance_id_alias;
int alias_required_for_version;
+
+ /* Is the device currently in mmio/pio/dma? Used to prevent re-entrancy */
+ MemReentrancyGuard mem_reentrancy_guard;
};
struct DeviceListener {
diff --git a/memory.c b/memory.c
index 8cafb86a..94ebcaf9 100644
--- a/memory.c
+++ b/memory.c
@@ -531,6 +531,18 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
access_size_max = 4;
}
+ /* Do not allow more than one simultaneous access to a device's IO Regions */
+ if (mr->dev && !mr->disable_reentrancy_guard &&
+ !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+ if (mr->dev->mem_reentrancy_guard.engaged_in_io) {
+ warn_report_once("Blocked re-entrant IO on MemoryRegion: "
+ "%s at addr: 0x%" HWADDR_PRIX,
+ memory_region_name(mr), addr);
+ return MEMTX_ACCESS_ERROR;
+ }
+ mr->dev->mem_reentrancy_guard.engaged_in_io = true;
+ }
+
/* FIXME: support unaligned access? */
access_size = MAX(MIN(size, access_size_max), access_size_min);
access_mask = MAKE_64BIT_MASK(0, access_size * 8);
@@ -545,6 +557,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
access_mask, attrs);
}
}
+ if (mr->dev) {
+ mr->dev->mem_reentrancy_guard.engaged_in_io = false;
+ }
return r;
}
@@ -1132,6 +1147,7 @@ static void memory_region_do_init(MemoryRegion *mr,
}
mr->name = g_strdup(name);
mr->owner = owner;
+ mr->dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
mr->ram_block = NULL;
if (name) {
--
2.25.1

View File

@@ -0,0 +1,49 @@
From 9d38a8434721a6479fe03fb5afb150ca793d3980 Mon Sep 17 00:00:00 2001
From: zhenwei pi <pizhenwei@bytedance.com>
Date: Thu, 3 Aug 2023 10:43:13 +0800
Subject: [PATCH] virtio-crypto: verify src&dst buffer length for sym request
For symmetric algorithms, the length of ciphertext must be as same
as the plaintext.
The missing verification of the src_len and the dst_len in
virtio_crypto_sym_op_helper() may lead buffer overflow/divulged.
This patch is originally written by Yiming Tao for QEMU-SECURITY,
resend it(a few changes of error message) in qemu-devel.
Fixes: CVE-2023-3180
Fixes: 04b9b37edda("virtio-crypto: add data queue processing handler")
Cc: Gonglei <arei.gonglei@huawei.com>
Cc: Mauro Matteo Cascella <mcascell@redhat.com>
Cc: Yiming Tao <taoym@zju.edu.cn>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230803024314.29962-2-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Upstream-Status: Backport from [https://gitlab.com/qemu-project/qemu/-/commit/9d38a8434721a6479fe03fb5afb150ca793d3980]
CVE: CVE-2023-3180
Signed-off-by: Ashish Sharma <asharma@mvista.com>
hw/virtio/virtio-crypto.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index 44faf5a522b..13aec771e11 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -634,6 +634,11 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev,
return NULL;
}
+ if (unlikely(src_len != dst_len)) {
+ virtio_error(vdev, "sym request src len is different from dst len");
+ return NULL;
+ }
+
max_len = (uint64_t)iv_len + aad_len + src_len + dst_len + hash_result_len;
if (unlikely(max_len > vcrypto->conf.max_size)) {
virtio_error(vdev, "virtio-crypto too big length");
--
GitLab

View File

@@ -0,0 +1,87 @@
From 10be627d2b5ec2d6b3dce045144aa739eef678b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Tue, 20 Jun 2023 09:45:34 +0100
Subject: [PATCH] io: remove io watch if TLS channel is closed during handshake
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The TLS handshake make take some time to complete, during which time an
I/O watch might be registered with the main loop. If the owner of the
I/O channel invokes qio_channel_close() while the handshake is waiting
to continue the I/O watch must be removed. Failing to remove it will
later trigger the completion callback which the owner is not expecting
to receive. In the case of the VNC server, this results in a SEGV as
vnc_disconnect_start() tries to shutdown a client connection that is
already gone / NULL.
CVE-2023-3354
Reported-by: jiangyegen <jiangyegen@huawei.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Upstream-Status: Backport [https://gitlab.com/qemu-project/qemu/-/commit/10be627d2b5ec2d6b3dce045144aa739eef678b4]
CVE: CVE-2023-3354
Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
---
include/io/channel-tls.h | 1 +
io/channel-tls.c | 18 ++++++++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h
index fdbdf12f..e49e2831 100644
--- a/include/io/channel-tls.h
+++ b/include/io/channel-tls.h
@@ -49,6 +49,7 @@ struct QIOChannelTLS {
QIOChannel *master;
QCryptoTLSSession *session;
QIOChannelShutdown shutdown;
+ guint hs_ioc_tag;
};
/**
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 7ec8ceff..8b32fbde 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -194,12 +194,13 @@ static void qio_channel_tls_handshake_task(QIOChannelTLS *ioc,
}
trace_qio_channel_tls_handshake_pending(ioc, status);
- qio_channel_add_watch_full(ioc->master,
- condition,
- qio_channel_tls_handshake_io,
- data,
- NULL,
- context);
+ ioc->hs_ioc_tag =
+ qio_channel_add_watch_full(ioc->master,
+ condition,
+ qio_channel_tls_handshake_io,
+ data,
+ NULL,
+ context);
}
}
@@ -214,6 +215,7 @@ static gboolean qio_channel_tls_handshake_io(QIOChannel *ioc,
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(
qio_task_get_source(task));
+ tioc->hs_ioc_tag = 0;
g_free(data);
qio_channel_tls_handshake_task(tioc, task, context);
@@ -371,6 +373,10 @@ static int qio_channel_tls_close(QIOChannel *ioc,
{
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(ioc);
+ if (tioc->hs_ioc_tag) {
+ g_clear_handle_id(&tioc->hs_ioc_tag, g_source_remove);
+ }
+
return qio_channel_close(tioc->master, errp);
}
--
2.25.1

View File

@@ -0,0 +1,139 @@
From 64c5045c0a6b84fdb938a8465a0890e5f7162708 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@ruby-lang.org>
Date: Tue, 22 Nov 2022 10:49:27 +0900
Subject: [PATCH] Prevent CRLF injection
Throw a RuntimeError if the HTTP response header contains CR or LF to
prevent HTTP response splitting.
https://hackerone.com/reports/1204695
Upstream-Status: Backport [https://github.com/ruby/cgi/commit/64c5045c0a6b84fdb938a8465a0890e5f7162708]
CVE: CVE-2021-33621
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
lib/cgi/core.rb | 45 +++++++++++++++++++++++--------------
test/cgi/test_cgi_header.rb | 8 +++++++
2 files changed, 36 insertions(+), 17 deletions(-)
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index bec76e0..62e6068 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -188,17 +188,28 @@ class CGI
# Using #header with the HTML5 tag maker will create a <header> element.
alias :header :http_header
+ def _no_crlf_check(str)
+ if str
+ str = str.to_s
+ raise "A HTTP status or header field must not include CR and LF" if str =~ /[\r\n]/
+ str
+ else
+ nil
+ end
+ end
+ private :_no_crlf_check
+
def _header_for_string(content_type) #:nodoc:
buf = ''.dup
if nph?()
- buf << "#{$CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}"
+ buf << "#{_no_crlf_check($CGI_ENV['SERVER_PROTOCOL']) || 'HTTP/1.0'} 200 OK#{EOL}"
buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
- buf << "Server: #{$CGI_ENV['SERVER_SOFTWARE']}#{EOL}"
+ buf << "Server: #{_no_crlf_check($CGI_ENV['SERVER_SOFTWARE'])}#{EOL}"
buf << "Connection: close#{EOL}"
end
- buf << "Content-Type: #{content_type}#{EOL}"
+ buf << "Content-Type: #{_no_crlf_check(content_type)}#{EOL}"
if @output_cookies
- @output_cookies.each {|cookie| buf << "Set-Cookie: #{cookie}#{EOL}" }
+ @output_cookies.each {|cookie| buf << "Set-Cookie: #{_no_crlf_check(cookie)}#{EOL}" }
end
return buf
end # _header_for_string
@@ -213,9 +224,9 @@ class CGI
## NPH
options.delete('nph') if defined?(MOD_RUBY)
if options.delete('nph') || nph?()
- protocol = $CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'
+ protocol = _no_crlf_check($CGI_ENV['SERVER_PROTOCOL']) || 'HTTP/1.0'
status = options.delete('status')
- status = HTTP_STATUS[status] || status || '200 OK'
+ status = HTTP_STATUS[status] || _no_crlf_check(status) || '200 OK'
buf << "#{protocol} #{status}#{EOL}"
buf << "Date: #{CGI.rfc1123_date(Time.now)}#{EOL}"
options['server'] ||= $CGI_ENV['SERVER_SOFTWARE'] || ''
@@ -223,38 +234,38 @@ class CGI
end
## common headers
status = options.delete('status')
- buf << "Status: #{HTTP_STATUS[status] || status}#{EOL}" if status
+ buf << "Status: #{HTTP_STATUS[status] || _no_crlf_check(status)}#{EOL}" if status
server = options.delete('server')
- buf << "Server: #{server}#{EOL}" if server
+ buf << "Server: #{_no_crlf_check(server)}#{EOL}" if server
connection = options.delete('connection')
- buf << "Connection: #{connection}#{EOL}" if connection
+ buf << "Connection: #{_no_crlf_check(connection)}#{EOL}" if connection
type = options.delete('type')
- buf << "Content-Type: #{type}#{EOL}" #if type
+ buf << "Content-Type: #{_no_crlf_check(type)}#{EOL}" #if type
length = options.delete('length')
- buf << "Content-Length: #{length}#{EOL}" if length
+ buf << "Content-Length: #{_no_crlf_check(length)}#{EOL}" if length
language = options.delete('language')
- buf << "Content-Language: #{language}#{EOL}" if language
+ buf << "Content-Language: #{_no_crlf_check(language)}#{EOL}" if language
expires = options.delete('expires')
buf << "Expires: #{CGI.rfc1123_date(expires)}#{EOL}" if expires
## cookie
if cookie = options.delete('cookie')
case cookie
when String, Cookie
- buf << "Set-Cookie: #{cookie}#{EOL}"
+ buf << "Set-Cookie: #{_no_crlf_check(cookie)}#{EOL}"
when Array
arr = cookie
- arr.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
+ arr.each {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
when Hash
hash = cookie
- hash.each_value {|c| buf << "Set-Cookie: #{c}#{EOL}" }
+ hash.each_value {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
end
end
if @output_cookies
- @output_cookies.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
+ @output_cookies.each {|c| buf << "Set-Cookie: #{_no_crlf_check(c)}#{EOL}" }
end
## other headers
options.each do |key, value|
- buf << "#{key}: #{value}#{EOL}"
+ buf << "#{_no_crlf_check(key)}: #{_no_crlf_check(value)}#{EOL}"
end
return buf
end # _header_for_hash
diff --git a/test/cgi/test_cgi_header.rb b/test/cgi/test_cgi_header.rb
index bab2d03..ec2f4de 100644
--- a/test/cgi/test_cgi_header.rb
+++ b/test/cgi/test_cgi_header.rb
@@ -176,6 +176,14 @@ class CGIHeaderTest < Test::Unit::TestCase
end
+ def test_cgi_http_header_crlf_injection
+ cgi = CGI.new
+ assert_raise(RuntimeError) { cgi.http_header("text/xhtml\r\nBOO") }
+ assert_raise(RuntimeError) { cgi.http_header("type" => "text/xhtml\r\nBOO") }
+ assert_raise(RuntimeError) { cgi.http_header("status" => "200 OK\r\nBOO") }
+ assert_raise(RuntimeError) { cgi.http_header("location" => "text/xhtml\r\nBOO") }
+ end
+
instance_methods.each do |method|
private method if method =~ /^test_(.*)/ && $1 != ENV['TEST']
--
2.25.1

View File

@@ -8,6 +8,7 @@ SRC_URI += " \
file://0001-Modify-shebang-of-libexec-y2racc-and-libexec-racc2y.patch \
file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \
file://CVE-2023-28756.patch \
file://CVE-2021-33621.patch \
"
SRC_URI[md5sum] = "f972fb0cce662966bec10d5c5f32d042"

View File

@@ -0,0 +1,24 @@
These tests require an unloaded host as otherwise timing sensitive tests can fail
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14371
Upstream-Status: Inappropriate
Signed-off-by: Ross Burton <ross.burton@arm.com>
--- a/test/Maketests~
+++ b/test/Maketests
@@ -2069,7 +2069,2 @@
-timeout:
- @echo $@ $(ZOS_FAIL)
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
typedregex1:
@@ -2297,7 +2292,2 @@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-time:
- @echo $@
- @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@

View File

@@ -16,6 +16,7 @@ PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
PACKAGECONFIG[mpfr] = "--with-mpfr,--without-mpfr, mpfr"
SRC_URI = "${GNU_MIRROR}/gawk/gawk-${PV}.tar.gz \
file://remove-sensitive-tests.patch \
file://run-ptest \
"
@@ -41,13 +42,20 @@ inherit ptest
do_install_ptest() {
mkdir ${D}${PTEST_PATH}/test
ln -s ${bindir}/gawk ${D}${PTEST_PATH}/gawk
for i in `grep -vE "@|^$|#|Gt-dummy" ${S}/test/Maketests |awk -F: '{print $1}'` Maketests inclib.awk; \
do cp ${S}/test/$i* ${D}${PTEST_PATH}/test; \
# The list of tests is all targets in Maketests, apart from the dummy Gt-dummy
TESTS=$(awk -F: '$1 == "Gt-dummy" { next } /[[:alnum:]]+:$/ { print $1 }' ${S}/test/Maketests)
for i in $TESTS Maketests inclib.awk; do
cp ${S}/test/$i* ${D}${PTEST_PATH}/test
done
sed -i -e 's|/usr/local/bin|${bindir}|g' \
-e 's|#!${base_bindir}/awk|#!${bindir}/awk|g' ${D}${PTEST_PATH}/test/*.awk
sed -i -e "s|GAWKLOCALE|LANG|g" ${D}${PTEST_PATH}/test/Maketests
sed -i -e "s|GAWKLOCALE|LANG|g" ${D}${PTEST_PATH}/test/Maketests
# These tests require an unloaded host as otherwise timing sensitive tests can fail
# https://bugzilla.yoctoproject.org/show_bug.cgi?id=14371
rm -f ${D}${PTEST_PATH}/test/time.*
rm -f ${D}${PTEST_PATH}/test/timeout.*
}
RDEPENDS_${PN}-ptest += "make"

View File

@@ -0,0 +1,31 @@
From d81b82c70bc1fb9991bb95f1201abb5dea55f57f Mon Sep 17 00:00:00 2001
From: Chris Liddell <chris.liddell@artifex.com>
Date: Mon, 17 Jul 2023 14:06:37 +0100
Subject: [PATCH] Bug 706897: Copy pcx buffer overrun fix from
devices/gdevpcx.c
Bounds check the buffer, before dereferencing the pointer.
Upstream-Status: Backport [https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=d81b82c70bc1fb9991bb95f1201abb5dea55f57f]
CVE: CVE-2023-38559
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
base/gdevdevn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/base/gdevdevn.c b/base/gdevdevn.c
index 3b019d6..2888776 100644
--- a/base/gdevdevn.c
+++ b/base/gdevdevn.c
@@ -1980,7 +1980,7 @@ devn_pcx_write_rle(const byte * from, const byte * end, int step, gp_file * file
byte data = *from;
from += step;
- if (data != *from || from == end) {
+ if (from >= end || data != *from) {
if (data >= 0xc0)
gp_fputc(0xc1, file);
} else {
--
2.25.1

View File

@@ -40,6 +40,7 @@ SRC_URI_BASE = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/d
file://CVE-2021-3781_2.patch \
file://CVE-2021-3781_3.patch \
file://CVE-2023-28879.patch \
file://0001-Bug-706897-Copy-pcx-buffer-overrun-fix-from-devices-.patch \
"
SRC_URI = "${SRC_URI_BASE} \

View File

@@ -46,6 +46,9 @@ SRC_URI = "http://libarchive.org/downloads/libarchive-${PV}.tar.gz \
SRC_URI[md5sum] = "d953ed6b47694dadf0e6042f8f9ff451"
SRC_URI[sha256sum] = "b60d58d12632ecf1e8fad7316dc82c6b9738a35625746b47ecdcaf4aed176176"
# upstream-wontfix: upstream has documented that reported function is not thread-safe
CVE_CHECK_WHITELIST += "CVE-2023-30571"
inherit autotools update-alternatives pkgconfig
CPPFLAGS += "-I${WORKDIR}/extra-includes"

View File

@@ -13,9 +13,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
SECTION = "libs"
DEPENDS += "libtirpc libnsl2"
PV = "3.1+git${SRCPV}"
PV = "3.2"
SRCREV = "062f31999b35393abf7595cb89dfc9590d5a42ad"
SRCREV = "cd0d391af9535b56e612ed227c1b89be269f3d59"
SRC_URI = "git://github.com/thkukuk/libnss_nis;branch=master;protocol=https \
"

View File

@@ -0,0 +1,85 @@
From 2c933ecba3bb1d3041a5a7a53a7b4078a6003413 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@dropbear.xyz>
Date: Thu, 10 Aug 2023 21:18:38 +1000
Subject: [PATCH] ps: Fix possible buffer overflow in -C option
ps allocates memory using malloc(length of arg * len of struct).
In certain strange circumstances, the arg length could be very large
and the multiplecation will overflow, allocating a small amount of
memory.
Subsequent strncpy() will then write into unallocated memory.
The fix is to use calloc. It's slower but this is a one-time
allocation. Other malloc(x * y) calls have also been replaced
by calloc(x, y)
References:
https://www.freelists.org/post/procps/ps-buffer-overflow-CVE-20234016
https://nvd.nist.gov/vuln/detail/CVE-2023-4016
https://gitlab.com/procps-ng/procps/-/issues/297
https://bugs.debian.org/1042887
Signed-off-by: Craig Small <csmall@dropbear.xyz>
CVE: CVE-2023-4016
Upstream-Status: Backport [https://gitlab.com/procps-ng/procps/-/commit/2c933ecba3bb1d3041a5a7a53a7b4078a6003413]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
NEWS | 1 +
ps/parser.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index b9509734..64fa3da8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+ * ps: Fix buffer overflow in -C option CVE-2023-4016 Debian #1042887, issue #297
+
procps-ng-3.3.16
----------------
* library: Increment to 8:2:0
diff --git a/ps/parser.c b/ps/parser.c
index 248aa741..15873dfa 100644
--- a/ps/parser.c
+++ b/ps/parser.c
@@ -184,7 +184,6 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
const char *err; /* error code that could or did happen */
/*** prepare to operate ***/
node = malloc(sizeof(selection_node));
- node->u = malloc(strlen(arg)*sizeof(sel_union)); /* waste is insignificant */
node->n = 0;
buf = strdup(arg);
/*** sanity check and count items ***/
@@ -205,6 +204,7 @@ static const char *parse_list(const char *arg, const char *(*parse_fn)(char *, s
} while (*++walk);
if(need_item) goto parse_error;
node->n = items;
+ node->u = calloc(items, sizeof(sel_union));
/*** actually parse the list ***/
walk = buf;
while(items--){
@@ -1031,15 +1031,15 @@ static const char *parse_trailing_pids(void){
thisarg = ps_argc - 1; /* we must be at the end now */
pidnode = malloc(sizeof(selection_node));
- pidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ pidnode->u = calloc(i, sizeof(sel_union)); /* waste is insignificant */
pidnode->n = 0;
grpnode = malloc(sizeof(selection_node));
- grpnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ grpnode->u = calloc(i,sizeof(sel_union)); /* waste is insignificant */
grpnode->n = 0;
sidnode = malloc(sizeof(selection_node));
- sidnode->u = malloc(i*sizeof(sel_union)); /* waste is insignificant */
+ sidnode->u = calloc(i, sizeof(sel_union)); /* waste is insignificant */
sidnode->n = 0;
while(i--){
--
GitLab

View File

@@ -14,6 +14,7 @@ inherit autotools gettext pkgconfig update-alternatives
SRC_URI = "git://gitlab.com/procps-ng/procps.git;protocol=https;branch=master \
file://sysctl.conf \
file://CVE-2023-4016.patch \
"
SRCREV = "59c88e18f29000ceaf7e5f98181b07be443cf12f"

View File

@@ -1,4 +1,4 @@
From 8708b9e081192786c027bb7f5f23d76dbe5c19e8 Mon Sep 17 00:00:00 2001
From 9c8e972dbecda93546038d24444d8216397d75a3 Mon Sep 17 00:00:00 2001
From: Behdad Esfahbod <behdad@behdad.org>
Date: Mon, 6 Feb 2023 14:51:25 -0700
Subject: [PATCH] [GPOS] Avoid O(n^2) behavior in mark-attachment
@@ -8,13 +8,15 @@ Comment1: The Original Patch [https://github.com/harfbuzz/harfbuzz/commit/85be87
Comment2: The Patch contained files MarkBasePosFormat1.hh and MarkLigPosFormat1.hh which were moved from hb-ot-layout-gpos-table.hh as per https://github.com/harfbuzz/harfbuzz/commit/197d9a5c994eb41c8c89b7b958b26b1eacfeeb00
CVE: CVE-2023-25193
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
---
src/hb-ot-layout-gpos-table.hh | 101 ++++++++++++++++++++++++---------
src/hb-ot-layout-gpos-table.hh | 103 +++++++++++++++++++++++----------
src/hb-ot-layout-gsubgpos.hh | 5 +-
2 files changed, 77 insertions(+), 29 deletions(-)
2 files changed, 78 insertions(+), 30 deletions(-)
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 024312d..88df13d 100644
index 024312d..db5f9ae 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -1458,6 +1458,25 @@ struct MarkBasePosFormat1
@@ -102,8 +104,9 @@ index 024312d..88df13d 100644
+ //if (!_hb_glyph_info_is_base_glyph (&buffer->info[idx])) { return_trace (false); }
- unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[skippy_iter.idx].codepoint);
- if (base_index == NOT_COVERED) return_trace (false);
+ unsigned int base_index = (this+baseCoverage).get_coverage (buffer->info[idx].codepoint);
if (base_index == NOT_COVERED) return_trace (false);
+ if (base_index == NOT_COVERED)
+ {
+ buffer->unsafe_to_concat_from_outbuffer (idx, buffer->idx + 1);
+ return_trace (false);
@@ -174,6 +177,3 @@ index 5a7e564..437123c 100644
void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; init_iters (); }
void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; init_iters (); }
void set_random (bool random_) { random = random_; }
--
2.25.1

View File

@@ -0,0 +1,97 @@
From 9679473547874c472569d54fecce32b463999a9d Mon Sep 17 00:00:00 2001
From: DRC <information@libjpeg-turbo.org>
Date: Tue, 4 Apr 2023 19:06:20 -0500
Subject: [PATCH] Decomp: Don't enable 2-pass color quant w/ RGB565
The 2-pass color quantization algorithm assumes 3-sample pixels. RGB565
is the only 3-component colorspace that doesn't have 3-sample pixels, so
we need to treat it as a special case when determining whether to enable
2-pass color quantization. Otherwise, attempting to initialize 2-pass
color quantization with an RGB565 output buffer could cause
prescan_quantize() to read from uninitialized memory and subsequently
underflow/overflow the histogram array.
djpeg is supposed to fail gracefully if both -rgb565 and -colors are
specified, because none of its destination managers (image writers)
support color quantization with RGB565. However, prescan_quantize() was
called before that could occur. It is possible but very unlikely that
these issues could have been reproduced in applications other than
djpeg. The issues involve the use of two features (12-bit precision and
RGB565) that are incompatible, and they also involve the use of two
rarely-used legacy features (RGB565 and color quantization) that don't
make much sense when combined.
Fixes #668
Fixes #671
Fixes #680
CVE: CVE-2023-2804
Upstream-Status: Backport [https://github.com/libjpeg-turbo/libjpeg-turbo/commit/9679473547874c472569d54fecce32b463999a9d]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
ChangeLog.md | 6 ++++++
jdmaster.c | 5 +++--
jquant2.c | 5 +++--
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index e605abe73..de0c4d0dd 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,3 +1,9 @@ quality values.
+9. Fixed an oversight in 1.4 beta1[8] that caused various segfaults and buffer
+overruns when attempting to decompress various specially-crafted malformed
+12-bit-per-component JPEG images using a 12-bit-per-component build of djpeg
+(`-DWITH_12BIT=1`) with both color quantization and RGB565 color conversion
+enabled.
+
2.0.4
=====
diff --git a/jdmaster.c b/jdmaster.c
index b20906438..8d8ef9956 100644
--- a/jdmaster.c
+++ b/jdmaster.c
@@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009-2011, 2016, D. R. Commander.
+ * Copyright (C) 2009-2011, 2016, 2023, D. R. Commander.
* Copyright (C) 2013, Linaro Limited.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
@@ -492,7 +492,8 @@ master_selection(j_decompress_ptr cinfo)
if (cinfo->raw_data_out)
ERREXIT(cinfo, JERR_NOTIMPL);
/* 2-pass quantizer only works in 3-component color space. */
- if (cinfo->out_color_components != 3) {
+ if (cinfo->out_color_components != 3 ||
+ cinfo->out_color_space == JCS_RGB565) {
cinfo->enable_1pass_quant = TRUE;
cinfo->enable_external_quant = FALSE;
cinfo->enable_2pass_quant = FALSE;
diff --git a/jquant2.c b/jquant2.c
index 6570613bb..c760380fb 100644
--- a/jquant2.c
+++ b/jquant2.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2009, 2014-2015, D. R. Commander.
+ * Copyright (C) 2009, 2014-2015, 2020, 2023, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -1230,7 +1230,8 @@ jinit_2pass_quantizer(j_decompress_ptr cinfo)
cquantize->error_limiter = NULL;
/* Make sure jdmaster didn't give me a case I can't handle */
- if (cinfo->out_color_components != 3)
+ if (cinfo->out_color_components != 3 ||
+ cinfo->out_color_space == JCS_RGB565)
ERREXIT(cinfo, JERR_NOTIMPL);
/* Allocate the histogram/inverse colormap storage */

View File

@@ -0,0 +1,75 @@
From 0deab87e24ab3106d5332205f829d1846fa65001 Mon Sep 17 00:00:00 2001
From: DRC <information@libjpeg-turbo.org>
Date: Thu, 6 Apr 2023 18:33:41 -0500
Subject: [PATCH] jpeg_crop_scanline: Fix calc w/sclg + 2x4,4x2 samp
When computing the downsampled width for a particular component,
jpeg_crop_scanline() needs to take into account the fact that the
libjpeg code uses a combination of IDCT scaling and upsampling to
implement 4x2 and 2x4 upsampling with certain decompression scaling
factors. Failing to account for that led to incomplete upsampling of
4x2- or 2x4-subsampled components, which caused the color converter to
read from uninitialized memory. With 12-bit data precision, this caused
a buffer overrun or underrun and subsequent segfault if the
uninitialized memory contained a value that was outside of the valid
sample range (because the color converter uses the value as an array
index.)
Fixes #669
CVE: CVE-2023-2804
Upstream-Status: Backport [https://github.com/libjpeg-turbo/libjpeg-turbo/commit/0deab87e24ab3106d5332205f829d1846fa65001]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
ChangeLog.md | 8 ++++++++
jdapistd.c | 10 ++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog.md b/ChangeLog.md
index de0c4d0dd..159bd1610 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -4,6 +4,14 @@ overruns when attempting to decompress various specially-crafted malformed
(`-DWITH_12BIT=1`) with both color quantization and RGB565 color conversion
enabled.
+10. Fixed an issue whereby `jpeg_crop_scanline()` sometimes miscalculated the
+downsampled width for components with 4x2 or 2x4 subsampling factors if
+decompression scaling was enabled. This caused the components to be upsampled
+incompletely, which caused the color converter to read from uninitialized
+memory. With 12-bit data precision, this caused a buffer overrun or underrun
+and subsequent segfault if the sample value read from unitialized memory was
+outside of the valid sample range.
+
2.0.4
=====
diff --git a/jdapistd.c b/jdapistd.c
index 628626254..eb577928c 100644
--- a/jdapistd.c
+++ b/jdapistd.c
@@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
- * Copyright (C) 2010, 2015-2018, 2020, D. R. Commander.
+ * Copyright (C) 2010, 2015-2018, 2020, 2023, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@@ -225,9 +225,11 @@ jpeg_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
/* Set downsampled_width to the new output width. */
orig_downsampled_width = compptr->downsampled_width;
compptr->downsampled_width =
- (JDIMENSION)jdiv_round_up((long)(cinfo->output_width *
- compptr->h_samp_factor),
- (long)cinfo->max_h_samp_factor);
+ (JDIMENSION)jdiv_round_up((long)cinfo->output_width *
+ (long)(compptr->h_samp_factor *
+ compptr->_DCT_scaled_size),
+ (long)(cinfo->max_h_samp_factor *
+ cinfo->_min_DCT_scaled_size));
if (compptr->downsampled_width < 2 && orig_downsampled_width >= 2)
reinit_upsampler = TRUE;

View File

@@ -16,6 +16,8 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BPN}-${PV}.tar.gz \
file://CVE-2021-46822.patch \
file://CVE-2020-35538-1.patch \
file://CVE-2020-35538-2.patch \
file://CVE-2023-2804-1.patch \
file://CVE-2023-2804-2.patch \
"
SRC_URI[md5sum] = "d01d9e0c28c27bc0de9f4e2e8ff49855"

View File

@@ -134,7 +134,7 @@ LIC_FILES_CHKSUM = "file://LICENCE.Abilis;md5=b5ee3f410780e56711ad48eadc22b8bc \
"
# WHENCE checksum is defined separately to ease overriding it if
# class-devupstream is selected.
WHENCE_CHKSUM = "a0997fc7a9af4e46d96529d6ef13b58a"
WHENCE_CHKSUM = "57bf874056926f12aec2405d3fc390d9"
# These are not common licenses, set NO_GENERIC_LICENSE for them
# so that the license files will be copied from fetched source
@@ -212,7 +212,7 @@ SRC_URI:class-devupstream = "git://git.kernel.org/pub/scm/linux/kernel/git/firmw
# Pin this to the 20220509 release, override this in local.conf
SRCREV:class-devupstream ?= "b19cbdca78ab2adfd210c91be15a22568e8b8cae"
SRC_URI[sha256sum] = "8b1acfa16f1ee94732a6acb50d9d6c835cf53af11068bd89ed207bbe04a1e951"
SRC_URI[sha256sum] = "87597111c0d4b71b31e53cb85a92c386921b84c825a402db8c82e0e86015500d"
inherit allarch
@@ -239,6 +239,7 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
${PN}-rs9113 ${PN}-rs9116 \
${PN}-rtl-license ${PN}-rtl8188 ${PN}-rtl8192cu ${PN}-rtl8192ce ${PN}-rtl8192su ${PN}-rtl8723 ${PN}-rtl8821 \
${PN}-rtl8168 \
${PN}-rtl8822 \
${PN}-cypress-license \
${PN}-broadcom-license \
${PN}-bcm-0bb4-0306 \
@@ -313,14 +314,15 @@ PACKAGES =+ "${PN}-ralink-license ${PN}-ralink \
${PN}-qcom-vpu-1.0 ${PN}-qcom-vpu-2.0 \
${PN}-qcom-adreno-a2xx ${PN}-qcom-adreno-a3xx ${PN}-qcom-adreno-a4xx ${PN}-qcom-adreno-a530 \
${PN}-qcom-adreno-a630 ${PN}-qcom-adreno-a650 ${PN}-qcom-adreno-a660 \
${PN}-qcom-apq8096-audio ${PN}-qcom-apq8096-modem \
${PN}-qcom-apq8016-modem ${PN}-qcom-apq8016-wifi \
${PN}-qcom-apq8096-adreno ${PN}-qcom-apq8096-audio ${PN}-qcom-apq8096-modem \
${PN}-qcom-sc8280xp-lenovo-x13s-compat \
${PN}-qcom-sc8280xp-lenovo-x13s-audio \
${PN}-qcom-sc8280xp-lenovo-x13s-adreno \
${PN}-qcom-sc8280xp-lenovo-x13s-compute \
${PN}-qcom-sc8280xp-lenovo-x13s-sensors \
${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \
${PN}-qcom-sm8250-audio ${PN}-qcom-sm8250-compute \
${PN}-qcom-sdm845-adreno ${PN}-qcom-sdm845-audio ${PN}-qcom-sdm845-compute ${PN}-qcom-sdm845-modem \
${PN}-qcom-sm8250-adreno ${PN}-qcom-sm8250-audio ${PN}-qcom-sm8250-compute \
${PN}-amlogic-vdec-license ${PN}-amlogic-vdec \
${PN}-lt9611uxc ${PN}-lontium-license \
${PN}-whence-license \
@@ -411,7 +413,7 @@ LICENSE_${PN}-mt7601u-license = "Firmware-ralink_a_mediatek_company_firmware"
FILES_${PN}-mt7601u-license = "${nonarch_base_libdir}/firmware/LICENCE.ralink_a_mediatek_company_firmware"
FILES_${PN}-mt7601u = " \
${nonarch_base_libdir}/firmware/mt7601u.bin \
${nonarch_base_libdir}/firmware/mediatek/mt7601u.bin \
"
RDEPENDS_${PN}-mt7601u += "${PN}-mt7601u-license"
@@ -563,6 +565,7 @@ LICENSE_${PN}-rtl8192ce = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl8192su = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl8723 = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl8821 = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl8822 = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl-license = "Firmware-rtlwifi_firmware"
LICENSE_${PN}-rtl8168 = "WHENCE"
@@ -590,6 +593,11 @@ FILES_${PN}-rtl8821 = " \
FILES_${PN}-rtl8168 = " \
${nonarch_base_libdir}/firmware/rtl_nic/rtl8168*.fw \
"
FILES_${PN}-rtl8822 = " \
${nonarch_base_libdir}/firmware/rtl_bt/rtl8822*.bin \
${nonarch_base_libdir}/firmware/rtw88/rtw8822*.bin \
${nonarch_base_libdir}/firmware/rtlwifi/rtl8822*.bin \
"
RDEPENDS_${PN}-rtl8188 += "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8192ce += "${PN}-rtl-license"
@@ -597,6 +605,7 @@ RDEPENDS_${PN}-rtl8192cu += "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8192su = "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8723 += "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8821 += "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8822 += "${PN}-rtl-license"
RDEPENDS_${PN}-rtl8168 += "${PN}-whence-license"
# For ti-connectivity
@@ -978,16 +987,21 @@ LICENSE_${PN}-qcom-adreno-a530 = "Firmware-qcom"
LICENSE_${PN}-qcom-adreno-a630 = "Firmware-qcom"
LICENSE_${PN}-qcom-adreno-a650 = "Firmware-qcom"
LICENSE_${PN}-qcom-adreno-a660 = "Firmware-qcom"
LICENSE_${PN}-qcom-apq8016-modem = "Firmware-qcom"
LICENSE_${PN}-qcom-apq8016-wifi = "Firmware-qcom"
LICENSE_${PN}-qcom-apq8096-audio = "Firmware-qcom"
LICENSE_${PN}-qcom-apq8096-adreno = "Firmware-qcom"
LICENSE_${PN}-qcom-apq8096-modem = "Firmware-qcom"
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-audio = "Firmware-qcom"
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "Firmware-qcom"
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-compute = "Firmware-qcom"
LICENSE_${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "Firmware-qcom"
LICENSE_${PN}-qcom-sdm845-audio = "Firmware-qcom"
LICENSE_${PN}-qcom-sdm845-adreno = "Firmware-qcom"
LICENSE_${PN}-qcom-sdm845-compute = "Firmware-qcom"
LICENSE_${PN}-qcom-sdm845-modem = "Firmware-qcom"
LICENSE_${PN}-qcom-sm8250-audio = "Firmware-qcom"
LICENSE_${PN}-qcom-sm8250-adreno = "Firmware-qcom"
LICENSE_${PN}-qcom-sm8250-compute = "Firmware-qcom"
FILES_${PN}-qcom-license = "${nonarch_base_libdir}/firmware/LICENSE.qcom ${nonarch_base_libdir}/firmware/qcom/NOTICE.txt"
@@ -1001,10 +1015,13 @@ FILES_${PN}-qcom-vpu-2.0 = "${nonarch_base_libdir}/firmware/qcom/vpu-2.0/*"
FILES_${PN}-qcom-adreno-a2xx = "${nonarch_base_libdir}/firmware/qcom/leia_*.fw ${nonarch_base_libdir}/firmware/qcom/yamato_*.fw"
FILES_${PN}-qcom-adreno-a3xx = "${nonarch_base_libdir}/firmware/qcom/a3*_*.fw ${nonarch_base_libdir}/firmware/a300_*.fw"
FILES_${PN}-qcom-adreno-a4xx = "${nonarch_base_libdir}/firmware/qcom/a4*_*.fw"
FILES_${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.*"
FILES_${PN}-qcom-adreno-a630 = "${nonarch_base_libdir}/firmware/qcom/a630*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/a630*.*"
FILES_${PN}-qcom-adreno-a650 = "${nonarch_base_libdir}/firmware/qcom/a650*.* ${nonarch_base_libdir}/firmware/qcom/sm8250/a650*.*"
FILES_${PN}-qcom-adreno-a530 = "${nonarch_base_libdir}/firmware/qcom/a530*.fw*"
FILES_${PN}-qcom-adreno-a630 = "${nonarch_base_libdir}/firmware/qcom/a630*.*"
FILES_${PN}-qcom-adreno-a650 = "${nonarch_base_libdir}/firmware/qcom/a650*.*"
FILES_${PN}-qcom-adreno-a660 = "${nonarch_base_libdir}/firmware/qcom/a660*.*"
FILES_${PN}-qcom-apq8016-modem = "${nonarch_base_libdir}/firmware/qcom/apq8016/mba.mbn ${nonarch_base_libdir}/firmware/qcom/apq8016/modem.mbn"
FILES_${PN}-qcom-apq8016-wifi = "${nonarch_base_libdir}/firmware/qcom/apq8016/wcnss.mbn ${nonarch_base_libdir}/firmware/qcom/apq8016/WCNSS*"
FILES_${PN}-qcom-apq8096-adreno = "${nonarch_base_libdir}/firmware/qcom/apq8096/a530_zap.mbn ${nonarch_base_libdir}/firmware/qcom/a530_zap.mdt"
FILES_${PN}-qcom-apq8096-audio = "${nonarch_base_libdir}/firmware/qcom/apq8096/adsp*.*"
FILES_${PN}-qcom-apq8096-modem = "${nonarch_base_libdir}/firmware/qcom/apq8096/mba.mbn ${nonarch_base_libdir}/firmware/qcom/apq8096/modem*.* ${nonarch_base_libdir}/firmware/qcom/apq8096/wlanmdsp.mbn"
FILES_${PN}-qcom-sc8280xp-lenovo-x13s-compat = "${nonarch_base_libdir}/firmware/qcom/LENOVO/21BX"
@@ -1012,9 +1029,11 @@ FILES_${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${nonarch_base_libdir}/firmware/q
FILES_${PN}-qcom-sc8280xp-lenovo-x13s-adreno = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/qcdxkmsuc8280.mbn"
FILES_${PN}-qcom-sc8280xp-lenovo-x13s-compute = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*cdsp*.*"
FILES_${PN}-qcom-sc8280xp-lenovo-x13s-sensors = "${nonarch_base_libdir}/firmware/qcom/sc8280xp/LENOVO/21BX/*slpi*.*"
FILES_${PN}-qcom-sdm845-adreno = "${nonarch_base_libdir}/firmware/qcom/sdm845/a630*.*"
FILES_${PN}-qcom-sdm845-audio = "${nonarch_base_libdir}/firmware/qcom/sdm845/adsp*.*"
FILES_${PN}-qcom-sdm845-compute = "${nonarch_base_libdir}/firmware/qcom/sdm845/cdsp*.*"
FILES_${PN}-qcom-sdm845-modem = "${nonarch_base_libdir}/firmware/qcom/sdm845/mba.mbn ${nonarch_base_libdir}/firmware/qcom/sdm845/modem*.* ${nonarch_base_libdir}/firmware/qcom/sdm845/wlanmdsp.mbn"
FILES_${PN}-qcom-sm8250-adreno = "${nonarch_base_libdir}/firmware/qcom/sm8250/a650*.*"
FILES_${PN}-qcom-sm8250-audio = "${nonarch_base_libdir}/firmware/qcom/sm8250/adsp*.*"
FILES_${PN}-qcom-sm8250-compute = "${nonarch_base_libdir}/firmware/qcom/sm8250/cdsp*.*"
RDEPENDS_${PN}-qcom-venus-1.8 = "${PN}-qcom-license"
@@ -1030,6 +1049,8 @@ RDEPENDS_${PN}-qcom-adreno-a530 = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-adreno-a630 = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-adreno-a650 = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-adreno-a660 = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-apq8016-modem = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-apq8016-wifi = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-apq8096-audio = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-apq8096-modem = "${PN}-qcom-license"
RDEPENDS_${PN}-qcom-sc8280xp-lenovo-x13s-audio = "${PN}-qcom-license"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
#! /usr/bin/env python3
# Generate granular CVE status metadata for a specific version of the kernel
# using data from linuxkernelcves.com.
#
# SPDX-License-Identifier: GPL-2.0-only
import argparse
import datetime
import json
import pathlib
import re
from packaging.version import Version
def parse_version(s):
"""
Parse the version string and either return a packaging.version.Version, or
None if the string was unset or "unk".
"""
if s and s != "unk":
# packaging.version.Version doesn't approve of versions like v5.12-rc1-dontuse
s = s.replace("-dontuse", "")
return Version(s)
return None
def main(argp=None):
parser = argparse.ArgumentParser()
parser.add_argument("datadir", type=pathlib.Path, help="Path to a clone of https://github.com/nluedtke/linux_kernel_cves")
parser.add_argument("version", type=Version, help="Kernel version number to generate data for, such as 6.1.38")
args = parser.parse_args(argp)
datadir = args.datadir
version = args.version
base_version = f"{version.major}.{version.minor}"
with open(datadir / "data" / "kernel_cves.json", "r") as f:
cve_data = json.load(f)
with open(datadir / "data" / "stream_fixes.json", "r") as f:
stream_data = json.load(f)
print(f"""
# Auto-generated CVE metadata, DO NOT EDIT BY HAND.
# Generated at {datetime.datetime.now()} for version {version}
python check_kernel_cve_status_version() {{
this_version = "{version}"
kernel_version = d.getVar("LINUX_VERSION")
if kernel_version != this_version:
bb.warn("Kernel CVE status needs updating: generated for %s but kernel is %s" % (this_version, kernel_version))
}}
do_cve_check[prefuncs] += "check_kernel_cve_status_version"
""")
for cve, data in cve_data.items():
if "affected_versions" not in data:
print(f"# Skipping {cve}, no affected_versions")
print()
continue
affected = data["affected_versions"]
first_affected, last_affected = re.search(r"(.+) to (.+)", affected).groups()
first_affected = parse_version(first_affected)
last_affected = parse_version(last_affected)
handled = False
if not last_affected:
print(f"# {cve} has no known resolution")
elif first_affected and version < first_affected:
print(f"# fixed-version: only affects {first_affected} onwards")
handled = True
elif last_affected < version:
print(f"# fixed-version: Fixed after version {last_affected}")
handled = True
else:
if cve in stream_data:
backport_data = stream_data[cve]
if base_version in backport_data:
backport_ver = Version(backport_data[base_version]["fixed_version"])
if backport_ver <= version:
print(f"# cpe-stable-backport: Backported in {backport_ver}")
handled = True
else:
# TODO print a note that the kernel needs bumping
print(f"# {cve} needs backporting (fixed from {backport_ver})")
else:
print(f"# {cve} needs backporting (fixed from {last_affected})")
else:
print(f"# {cve} needs backporting (fixed from {last_affected})")
if handled:
print(f'CVE_CHECK_WHITELIST += "{cve}"')
print()
if __name__ == "__main__":
main()

View File

@@ -11,13 +11,13 @@ python () {
raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
}
SRCREV_machine ?= "8d8179549a233e7517523ac12887016451da2e20"
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
SRCREV_machine ?= "6a552f5822442183d2487c91903f27085183ca0e"
SRCREV_meta ?= "25f38de25d47570a132a18a1dc147b10e05b378b"
SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
LINUX_VERSION ?= "5.4.248"
LINUX_VERSION ?= "5.4.251"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"

View File

@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
require recipes-kernel/linux/linux-yocto.inc
LINUX_VERSION ?= "5.4.248"
LINUX_VERSION ?= "5.4.251"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
KMETA = "kernel-meta"
KCONF_BSP_AUDIT_LEVEL = "2"
SRCREV_machine_qemuarm ?= "ca5368c73bab4eb276a8e721df28c02ceb8f3eeb"
SRCREV_machine ?= "abb579170926348d1518bc1a2de8cb1cdf403808"
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
SRCREV_machine_qemuarm ?= "29ae0b5c67d29249bf00cb8eaaae5914d928bbd6"
SRCREV_machine ?= "16db12c2685020aa6347a18df5099f40a9176366"
SRCREV_meta ?= "25f38de25d47570a132a18a1dc147b10e05b378b"
PV = "${LINUX_VERSION}+git${SRCPV}"

View File

@@ -1,6 +1,7 @@
KBRANCH ?= "v5.4/standard/base"
require recipes-kernel/linux/linux-yocto.inc
include recipes-kernel/linux/cve-exclusion_5.4.inc
# board specific branches
KBRANCH_qemuarm ?= "v5.4/standard/arm-versatile-926ejs"
@@ -12,16 +13,16 @@ KBRANCH_qemux86 ?= "v5.4/standard/base"
KBRANCH_qemux86-64 ?= "v5.4/standard/base"
KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
SRCREV_machine_qemuarm ?= "68775a8671944b96c6a1ee795809f81149951f2d"
SRCREV_machine_qemuarm64 ?= "54bc3d459501d8df9baf093a34d8bb676c207a07"
SRCREV_machine_qemumips ?= "ba2d346cc66307fa6332b9fb86eb8ca66f30ebcd"
SRCREV_machine_qemuppc ?= "6703d4c7c75fab78e0c72227a98aba8071d5b1c3"
SRCREV_machine_qemuriscv64 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
SRCREV_machine_qemux86 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
SRCREV_machine_qemux86-64 ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
SRCREV_machine_qemumips64 ?= "66cac7d41a43594760f6ac48e848d73315cc5dd3"
SRCREV_machine ?= "d18af0e8acb7c4cb245739fa8165a44845ff2ba0"
SRCREV_meta ?= "465d61ba36f5c7e32d1fddef078d5d2068fcc2cc"
SRCREV_machine_qemuarm ?= "9a096c043b453855252aece3716d50fdf4111a77"
SRCREV_machine_qemuarm64 ?= "25499e5c52ebb2111a3dd7dd863937f56cf2a39d"
SRCREV_machine_qemumips ?= "12e990899599d1aac8dd8007a8864db68135d6f0"
SRCREV_machine_qemuppc ?= "19d91ad471bb87a464520283e58d5ff83c7151fa"
SRCREV_machine_qemuriscv64 ?= "2adacd3242d46ddaff62e5a4695b98edf01cccc5"
SRCREV_machine_qemux86 ?= "2adacd3242d46ddaff62e5a4695b98edf01cccc5"
SRCREV_machine_qemux86-64 ?= "2adacd3242d46ddaff62e5a4695b98edf01cccc5"
SRCREV_machine_qemumips64 ?= "854f6bee15babf95445644cba59691cd45173180"
SRCREV_machine ?= "2adacd3242d46ddaff62e5a4695b98edf01cccc5"
SRCREV_meta ?= "25f38de25d47570a132a18a1dc147b10e05b378b"
# remap qemuarm to qemuarma15 for the 5.4 kernel
# KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +31,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
LINUX_VERSION ?= "5.4.248"
LINUX_VERSION ?= "5.4.251"
DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
DEPENDS += "openssl-native util-linux-native"

View File

@@ -4,7 +4,7 @@ Date: Tue, 30 Aug 2022 16:56:48 +0200
Subject: [PATCH] Revised handling of TIFFTAG_INKNAMES and related
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u7.debian.tar.xz ]
CVE: CVE-2022-3599
CVE: CVE-2022-3599 CVE-2022-4645 CVE-2023-30774
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
Origin: https://gitlab.com/libtiff/libtiff/-/commit/e813112545942107551433d61afd16ac094ff246

View File

@@ -0,0 +1,173 @@
From 9c22495e5eeeae9e00a1596720c969656bb8d678 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Fri, 3 Feb 2023 15:31:31 +0100
Subject: [PATCH] tiffcrop correctly update buffersize after rotateImage()
fix#520 rotateImage() set up a new buffer and calculates its size
individually. Therefore, seg_buffs[] size needs to be updated accordingly.
Before this fix, the seg_buffs buffer size was calculated with a different
formula than within rotateImage().
Closes #520.
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/9c22495e5eeeae9e00a1596720c969656bb8d678 && https://gitlab.com/libtiff/libtiff/-/commit/688012dca2c39033aa2dc7bcea9796787cfd1b44]
CVE: CVE-2023-25433
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
tools/tiffcrop.c | 69 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 56 insertions(+), 13 deletions(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 742615a..aab0ec6 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -531,7 +531,7 @@ static int rotateContigSamples24bits(uint16, uint16, uint16, uint32,
static int rotateContigSamples32bits(uint16, uint16, uint16, uint32,
uint32, uint32, uint8 *, uint8 *);
static int rotateImage(uint16, struct image_data *, uint32 *, uint32 *,
- unsigned char **, int);
+ unsigned char **, size_t *);
static int mirrorImage(uint16, uint16, uint16, uint32, uint32,
unsigned char *);
static int invertImage(uint16, uint16, uint16, uint32, uint32,
@@ -6384,7 +6384,7 @@ static int correct_orientation(struct image_data *image, unsigned char **work_b
* but switch xres, yres there. */
uint32_t width = image->width;
uint32_t length = image->length;
- if (rotateImage(rotation, image, &width, &length, work_buff_ptr, TRUE))
+ if (rotateImage(rotation, image, &width, &length, work_buff_ptr, NULL))
{
TIFFError ("correct_orientation", "Unable to rotate image");
return (-1);
@@ -7607,8 +7607,12 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
{
+ /* rotateImage() set up a new buffer and calculates its size
+ * individually. Therefore, seg_buffs size needs to be updated
+ * accordingly. */
+ size_t rot_buf_size = 0;
if (rotateImage(crop->rotation, image, &crop->combined_width,
- &crop->combined_length, &crop_buff, FALSE))
+ &crop->combined_length, &crop_buff, &rot_buf_size))
{
TIFFError("processCropSelections",
"Failed to rotate composite regions by %d degrees", crop->rotation);
@@ -7713,8 +7717,13 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
{
- if (rotateImage(crop->rotation, image, &crop->regionlist[i].width,
- &crop->regionlist[i].length, &crop_buff, FALSE))
+ /* Furthermore, rotateImage() set up a new buffer and calculates
+ * its size individually. Therefore, seg_buffs size needs to be
+ * updated accordingly. */
+ size_t rot_buf_size = 0;
+ if (rotateImage(
+ crop->rotation, image, &crop->regionlist[i].width,
+ &crop->regionlist[i].length, &crop_buff, &rot_buf_size))
{
TIFFError("processCropSelections",
"Failed to rotate crop region by %d degrees", crop->rotation);
@@ -7725,8 +7734,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
crop->combined_width = total_width;
crop->combined_length = total_length;
seg_buffs[i].buffer = crop_buff;
- seg_buffs[i].size = (((crop->regionlist[i].width * image->bps + 7 ) / 8)
- * image->spp) * crop->regionlist[i].length;
+ seg_buffs[i].size = rot_buf_size;
}
}
}
@@ -7735,7 +7743,6 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
/* Copy the crop section of the data from the current image into a buffer
* and adjust the IFD values to reflect the new size. If no cropping is
- * required, use the origial read buffer as the crop buffer.
*
* There is quite a bit of redundancy between this routine and the more
* specialized processCropSelections, but this provides
@@ -7846,7 +7853,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
{
if (rotateImage(crop->rotation, image, &crop->combined_width,
- &crop->combined_length, crop_buff_ptr, TRUE))
+ &crop->combined_length, crop_buff_ptr, NULL))
{
TIFFError("createCroppedImage",
"Failed to rotate image or cropped selection by %d degrees", crop->rotation);
@@ -8515,7 +8522,8 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
uint32 bytes_per_pixel, bytes_per_sample;
uint32 row, rowsize, src_offset, dst_offset;
uint32 i, col, width, length;
- uint32 colsize, buffsize, col_offset, pix_offset;
+ uint32 colsize, col_offset, pix_offset;
+ tmsize_t buffsize;
unsigned char *ibuff;
unsigned char *src;
unsigned char *dst;
@@ -8528,12 +8536,41 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
spp = image->spp;
bps = image->bps;
+ if ((spp != 0 && bps != 0 &&
+ width > (uint32_t)((UINT32_MAX - 7) / spp / bps)) ||
+ (spp != 0 && bps != 0 &&
+ length > (uint32_t)((UINT32_MAX - 7) / spp / bps)))
+ {
+ TIFFError("rotateImage", "Integer overflow detected.");
+ return (-1);
+ }
+
rowsize = ((bps * spp * width) + 7) / 8;
colsize = ((bps * spp * length) + 7) / 8;
if ((colsize * width) > (rowsize * length))
- buffsize = (colsize + 1) * width;
+{
+ if (((tmsize_t)colsize + 1) != 0 &&
+ (tmsize_t)width > ((TIFF_TMSIZE_T_MAX - NUM_BUFF_OVERSIZE_BYTES) /
+ ((tmsize_t)colsize + 1)))
+ {
+ TIFFError("rotateImage",
+ "Integer overflow when calculating buffer size.");
+ return (-1);
+ }
+ buffsize = ((tmsize_t)colsize + 1) * width;
+ }
else
- buffsize = (rowsize + 1) * length;
+ {
+ if (((tmsize_t)rowsize + 1) != 0 &&
+ (tmsize_t)length > ((TIFF_TMSIZE_T_MAX - NUM_BUFF_OVERSIZE_BYTES) /
+ ((tmsize_t)rowsize + 1)))
+ {
+ TIFFError("rotateImage",
+ "Integer overflow when calculating buffer size.");
+ return (-1);
+ }
+ buffsize = (rowsize + 1) * length;
+ }
bytes_per_sample = (bps + 7) / 8;
bytes_per_pixel = ((bps * spp) + 7) / 8;
@@ -8556,11 +8593,17 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
/* Add 3 padding bytes for extractContigSamplesShifted32bits */
if (!(rbuff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES)))
{
- TIFFError("rotateImage", "Unable to allocate rotation buffer of %1u bytes", buffsize + NUM_BUFF_OVERSIZE_BYTES);
+ TIFFError("rotateImage",
+ "Unable to allocate rotation buffer of %" TIFF_SSIZE_FORMAT
+ " bytes ",
+ buffsize + NUM_BUFF_OVERSIZE_BYTES);
return (-1);
}
_TIFFmemset(rbuff, '\0', buffsize + NUM_BUFF_OVERSIZE_BYTES);
+ if (rot_buf_size != NULL)
+ *rot_buf_size = buffsize;
+
ibuff = *ibuff_ptr;
switch (rotation)
{
--
2.25.1

View File

@@ -0,0 +1,94 @@
From 69818e2f2d246e6631ac2a2da692c3706b849c38 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Sun, 29 Jan 2023 11:09:26 +0100
Subject: [PATCH] tiffcrop: Amend rotateImage() not to toggle the input (main)
image width and length parameters when only cropped image sections are
rotated. Remove buffptr from region structure because never used.
Closes #492 #493 #494 #495 #499 #518 #519
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/69818e2f2d246e6631ac2a2da692c3706b849c38]
CVE: CVE-2023-25434 & CVE-2023-25435
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
tools/tiffcrop.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index aab0ec6..ce84414 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -531,7 +531,7 @@ static int rotateContigSamples24bits(uint16, uint16, uint16, uint32,
static int rotateContigSamples32bits(uint16, uint16, uint16, uint32,
uint32, uint32, uint8 *, uint8 *);
static int rotateImage(uint16, struct image_data *, uint32 *, uint32 *,
- unsigned char **, size_t *);
+ unsigned char **, size_t *, int);
static int mirrorImage(uint16, uint16, uint16, uint32, uint32,
unsigned char *);
static int invertImage(uint16, uint16, uint16, uint32, uint32,
@@ -6382,10 +6382,11 @@ static int correct_orientation(struct image_data *image, unsigned char **work_b
/* Dummy variable in order not to switch two times the
* image->width,->length within rotateImage(),
* but switch xres, yres there. */
- uint32_t width = image->width;
- uint32_t length = image->length;
- if (rotateImage(rotation, image, &width, &length, work_buff_ptr, NULL))
- {
+ uint32_t width = image->width;
+ uint32_t length = image->length;
+ if (rotateImage(rotation, image, &width, &length, work_buff_ptr, NULL,
+ TRUE))
+ {
TIFFError ("correct_orientation", "Unable to rotate image");
return (-1);
}
@@ -7612,7 +7613,8 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
* accordingly. */
size_t rot_buf_size = 0;
if (rotateImage(crop->rotation, image, &crop->combined_width,
- &crop->combined_length, &crop_buff, &rot_buf_size))
+ &crop->combined_length, &crop_buff, &rot_buf_size,
+ FALSE))
{
TIFFError("processCropSelections",
"Failed to rotate composite regions by %d degrees", crop->rotation);
@@ -7721,9 +7723,10 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
* its size individually. Therefore, seg_buffs size needs to be
* updated accordingly. */
size_t rot_buf_size = 0;
- if (rotateImage(
- crop->rotation, image, &crop->regionlist[i].width,
- &crop->regionlist[i].length, &crop_buff, &rot_buf_size))
+ if (rotateImage(crop->rotation, image,
+ &crop->regionlist[i].width,
+ &crop->regionlist[i].length, &crop_buff,
+ &rot_buf_size, FALSE))
{
TIFFError("processCropSelections",
"Failed to rotate crop region by %d degrees", crop->rotation);
@@ -7853,7 +7856,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */
{
if (rotateImage(crop->rotation, image, &crop->combined_width,
- &crop->combined_length, crop_buff_ptr, NULL))
+ &crop->combined_length, crop_buff_ptr, NULL, TRUE))
{
TIFFError("createCroppedImage",
"Failed to rotate image or cropped selection by %d degrees", crop->rotation);
@@ -8515,8 +8518,10 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
/* Rotate an image by a multiple of 90 degrees clockwise */
static int
-rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
- uint32 *img_length, unsigned char **ibuff_ptr, int rot_image_params)
+rotateImage(uint16 rotation, struct image_data *image,
+ uint32 *img_width, uint32 *img_length,
+ unsigned char **ibuff_ptr, size_t *rot_buf_size,
+ int rot_image_params)
{
int shift_width;
uint32 bytes_per_pixel, bytes_per_sample;
--
2.25.1

View File

@@ -0,0 +1,90 @@
From ec8ef90c1f573c9eb1f17d6a056aa0015f184acf Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Tue, 14 Feb 2023 20:43:43 +0100
Subject: [PATCH] tiffcrop: Do not reuse input buffer for subsequent images.
Fix issue 527
Reuse of read_buff within loadImage() from previous image is quite unsafe, because other functions (like rotateImage() etc.) reallocate that buffer with different size without updating the local prev_readsize value.
Closes #527
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u8.debian.tar.xz]
CVE: CVE-2023-26965
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
tools/tiffcrop.c | 40 ++++++++++------------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index ce84414..a533089 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -5935,9 +5935,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
uint32 tw = 0, tl = 0; /* Tile width and length */
tmsize_t tile_rowsize = 0;
unsigned char *read_buff = NULL;
- unsigned char *new_buff = NULL;
int readunit = 0;
- static tmsize_t prev_readsize = 0;
TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);
TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);
@@ -6232,37 +6230,20 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
read_buff = *read_ptr;
/* +3 : add a few guard bytes since reverseSamples16bits() can read a bit */
/* outside buffer */
- if (!read_buff)
+ if (read_buff)
{
- if( buffsize > 0xFFFFFFFFU - 3 )
- {
- TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
- return (-1);
- }
- read_buff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES);
+ _TIFFfree(read_buff);
}
- else
- {
- if (prev_readsize < buffsize)
- {
- if( buffsize > 0xFFFFFFFFU - 3 )
- {
- TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
- return (-1);
- }
- new_buff = _TIFFrealloc(read_buff, buffsize + NUM_BUFF_OVERSIZE_BYTES);
- if (!new_buff)
- {
- free (read_buff);
- read_buff = (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES);
- }
- else
- read_buff = new_buff;
- }
- }
+ if (buffsize > 0xFFFFFFFFU - 3)
+ {
+ TIFFError("loadImage", "Required read buffer size too large");
+ return (-1);
+ }
+ read_buff =
+ (unsigned char *)_TIFFmalloc(buffsize + NUM_BUFF_OVERSIZE_BYTES);
if (!read_buff)
{
- TIFFError("loadImage", "Unable to allocate/reallocate read buffer");
+ TIFFError("loadImage", "Unable to allocate read buffer");
return (-1);
}
@@ -6270,7 +6251,6 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
read_buff[buffsize+1] = 0;
read_buff[buffsize+2] = 0;
- prev_readsize = buffsize;
*read_ptr = read_buff;
/* N.B. The read functions used copy separate plane data into a buffer as interleaved
--
2.25.1

View File

@@ -0,0 +1,35 @@
From b0e1c25dd1d065200c8d8f59ad0afe014861a1b9 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Thu, 16 Feb 2023 12:03:16 +0100
Subject: [PATCH] tif_luv: Check and correct for NaN data in uv_encode().
Closes #530
Upstream-Status: Backport [import from debian http://security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u8.debian.tar.xz]
CVE: CVE-2023-26966
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
libtiff/tif_luv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
index 6fe4858..8b2c5f1 100644
--- a/libtiff/tif_luv.c
+++ b/libtiff/tif_luv.c
@@ -923,6 +923,13 @@ uv_encode(double u, double v, int em) /* encode (u',v') coordinates */
{
register int vi, ui;
+ /* check for NaN */
+ if (u != u || v != v)
+ {
+ u = U_NEU;
+ v = V_NEU;
+ }
+
if (v < UV_VSTART)
return oog_encode(u, v);
vi = itrunc((v - UV_VSTART)*(1./UV_SQSIZ), em);
--
2.25.1

View File

@@ -0,0 +1,33 @@
From 8c0859a80444c90b8dfb862a9f16de74e16f0a9e Mon Sep 17 00:00:00 2001
From: xiaoxiaoafeifei <lliangliang2007@163.com>
Date: Fri, 21 Apr 2023 13:01:34 +0000
Subject: [PATCH] countInkNamesString(): fix `UndefinedBehaviorSanitizer`:
applying zero offset to null pointer
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/9bd48f0dbd64fb94dc2b5b05238fde0bfdd4ff3f]
CVE: CVE-2023-2908
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
libtiff/tif_dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index 9d8267a..6389b40 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -145,10 +145,10 @@ static uint16
countInkNamesString(TIFF *tif, uint32 slen, const char *s)
{
uint16 i = 0;
- const char *ep = s + slen;
- const char *cp = s;
if (slen > 0) {
+ const char *ep = s + slen;
+ const char *cp = s;
do {
for (; cp < ep && *cp != '\0'; cp++) {}
if (cp >= ep)
--
2.25.1

View File

@@ -0,0 +1,59 @@
From d63de61b1ec3385f6383ef9a1f453e4b8b11d536 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Fri, 3 Feb 2023 17:38:55 +0100
Subject: [PATCH] TIFFClose() avoid NULL pointer dereferencing. fix#515
Closes #515
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/d63de61b1ec3385f6383ef9a1f453e4b8b11d536]
CVE: CVE-2023-3316
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
libtiff/tif_close.c | 11 +++++++----
tools/tiffcrop.c | 5 ++++-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/libtiff/tif_close.c b/libtiff/tif_close.c
index e4228df..335e80f 100644
--- a/libtiff/tif_close.c
+++ b/libtiff/tif_close.c
@@ -118,13 +118,16 @@ TIFFCleanup(TIFF* tif)
*/
void
-TIFFClose(TIFF* tif)
+TIFFClose(TIFF *tif)
{
- TIFFCloseProc closeproc = tif->tif_closeproc;
- thandle_t fd = tif->tif_clientdata;
+ if (tif != NULL)
+ {
+ TIFFCloseProc closeproc = tif->tif_closeproc;
+ thandle_t fd = tif->tif_clientdata;
TIFFCleanup(tif);
- (void) (*closeproc)(fd);
+ (void)(*closeproc)(fd);
+ }
}
/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index a533089..f14bb0c 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -2526,7 +2526,10 @@ main(int argc, char* argv[])
}
}
- TIFFClose(out);
+ if (out != NULL)
+ {
+ TIFFClose(out);
+ }
return (0);
} /* end main */
--
2.25.1

View File

@@ -0,0 +1,34 @@
From 881a070194783561fd209b7c789a4e75566f7f37 Mon Sep 17 00:00:00 2001
From: zhailiangliang <zhailiangliang@loongson.cn>
Date: Tue, 7 Mar 2023 15:02:08 +0800
Subject: [PATCH] Fix memory leak in tiffcrop.c
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/881a070194783561fd209b7c789a4e75566f7f37]
CVE: CVE-2023-3618
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
tools/tiffcrop.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index f14bb0c..7121c7c 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -7746,8 +7746,13 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
read_buff = *read_buff_ptr;
+ /* Memory is freed before crop_buff_ptr is overwritten */
+ if (*crop_buff_ptr != NULL)
+ {
+ _TIFFfree(*crop_buff_ptr);
+ }
+
/* process full image, no crop buffer needed */
- crop_buff = read_buff;
*crop_buff_ptr = read_buff;
crop->combined_width = image->width;
crop->combined_length = image->length;
--
2.25.1

View File

@@ -0,0 +1,47 @@
From b5c7d4c4e03333ac16b5cfb11acaaeaa493334f8 Mon Sep 17 00:00:00 2001
From: Su_Laus <sulau@freenet.de>
Date: Fri, 5 May 2023 19:43:46 +0200
Subject: [PATCH] Consider error return of writeSelections(). Fixes #553
Upstream-Status: Backport [https://gitlab.com/libtiff/libtiff/-/commit/b5c7d4c4e03333ac16b5cfb11acaaeaa493334f8]
CVE: CVE-2023-3618
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
tools/tiffcrop.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 7121c7c..93b7f96 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -2437,9 +2437,15 @@ main(int argc, char* argv[])
{ /* Whole image or sections not based on output page size */
if (crop.selections > 0)
{
- writeSelections(in, &out, &crop, &image, &dump, seg_buffs,
- mp, argv[argc - 1], &next_page, total_pages);
- }
+ if (writeSelections(in, &out, &crop, &image, &dump,
+ seg_buffs, mp, argv[argc - 1],
+ &next_page, total_pages))
+ {
+ TIFFError("main",
+ "Unable to write new image selections");
+ exit(EXIT_FAILURE);
+ }
+ }
else /* One file all images and sections */
{
if (update_output_file (&out, mp, crop.exp_mode, argv[argc - 1],
@@ -7749,7 +7755,7 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
/* Memory is freed before crop_buff_ptr is overwritten */
if (*crop_buff_ptr != NULL)
{
- _TIFFfree(*crop_buff_ptr);
+ _TIFFfree(*crop_buff_ptr);
}
/* process full image, no crop buffer needed */
--
2.25.1

View File

@@ -36,6 +36,14 @@ SRC_URI = "http://download.osgeo.org/libtiff/tiff-${PV}.tar.gz \
file://CVE-2022-48281.patch \
file://CVE-2023-0795_0796_0797_0798_0799.patch \
file://CVE-2023-0800_0801_0802_0803_0804.patch \
file://CVE-2023-25433.patch \
file://CVE-2023-25434-CVE-2023-25435.patch \
file://CVE-2023-26965.patch \
file://CVE-2023-26966.patch \
file://CVE-2023-2908.patch \
file://CVE-2023-3316.patch \
file://CVE-2023-3618-1.patch \
file://CVE-2023-3618-2.patch \
"
SRC_URI[md5sum] = "2165e7aba557463acc0664e71a3ed424"
SRC_URI[sha256sum] = "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634"

View File

@@ -0,0 +1,38 @@
From 0c667188e0c6cda615a036b8a2b4125f2c404dde Mon Sep 17 00:00:00 2001
From: SaltyMilk <soufiane.elmelcaoui@gmail.com>
Date: Mon, 10 Jul 2023 21:43:28 +0200
Subject: [PATCH] fopen: optimize
Closes #11419
Upstream-Status: Backport [https://github.com/curl/curl/commit/0c667188e0c6cda615a036b8a2b4125f2c404dde]
CVE: CVE-2023-32001
Signed-off-by: Ashish Sharma <asharma@mvista.com>
lib/fopen.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/fopen.c b/lib/fopen.c
index c9c9e3d6e73a2..b6e3cadddef65 100644
--- a/lib/fopen.c
+++ b/lib/fopen.c
@@ -56,13 +56,13 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
int fd = -1;
*tempname = NULL;
- if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
- /* a non-regular file, fallback to direct fopen() */
- *fh = fopen(filename, FOPEN_WRITETEXT);
- if(*fh)
- return CURLE_OK;
+ *fh = fopen(filename, FOPEN_WRITETEXT);
+ if(!*fh)
goto fail;
- }
+ if(fstat(fileno(*fh), &sb) == -1 || !S_ISREG(sb.st_mode))
+ return CURLE_OK;
+ fclose(*fh);
+ *fh = NULL;
result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
if(result)

View File

@@ -52,6 +52,7 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
file://CVE-2023-27536.patch \
file://CVE-2023-28320.patch \
file://CVE-2023-28320-fol1.patch \
file://CVE-2023-32001.patch \
"
SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"

View File

@@ -0,0 +1,74 @@
From 94e1c001761373b7d9450768aa15d04c25547a35 Mon Sep 17 00:00:00 2001
From: Philip Hazel <Philip.Hazel@gmail.com>
Date: Tue, 16 Aug 2022 17:00:45 +0100
Subject: [PATCH] Diagnose negative repeat value in pcre2test subject line
CVE: CVE-2022-41409
Upstream-Status: Backport [https://github.com/PCRE2Project/pcre2/commit/94e1c001761373b7d9450768aa15d04c25547a35]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
ChangeLog | 3 +++
src/pcre2test.c | 4 ++--
testdata/testinput2 | 3 +++
testdata/testoutput2 | 4 ++++
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index eab50eb7..276eb57a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@ fully read in caseless matching.
24. Fixed an issue affecting recursions in JIT caused by duplicated data
transfers.
+20. A negative repeat value in a pcre2test subject line was not being
+diagnosed, leading to infinite looping.
+
Version 10.34 21-November-2019
------------------------------
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 08f86096..f6f5d66c 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -6700,9 +6700,9 @@ while ((c = *p++) != 0)
}
i = (int32_t)li;
- if (i-- == 0)
+ if (i-- <= 0)
{
- fprintf(outfile, "** Zero repeat not allowed\n");
+ fprintf(outfile, "** Zero or negative repeat not allowed\n");
return PR_OK;
}
diff --git a/testdata/testinput2 b/testdata/testinput2
index 655e519..14e00ed 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -5772,4 +5772,7 @@ a)"xI
/(a)?a/I
manm
+--
+ \[X]{-10}
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index c733c12..958f246 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -17435,6 +17435,10 @@ Subject length lower bound = 1
manm
0: a
+--
+ \[X]{-10}
+** Zero or negative repeat not allowed
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data

View File

@@ -14,6 +14,7 @@ SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/pcre2-${PV}.tar.bz2
file://pcre-cross.patch \
file://CVE-2022-1586.patch \
file://CVE-2022-1587.patch \
file://CVE-2022-41409.patch \
"
SRC_URI[md5sum] = "d280b62ded13f9ccf2fac16ee5286366"

View File

@@ -745,6 +745,10 @@ def create_recipe(args):
for handler in handlers:
handler.process(srctree_use, classes, lines_before, lines_after, handled, extravalues)
# native and nativesdk classes are special and must be inherited last
# If present, put them at the end of the classes list
classes.sort(key=lambda c: c in ("native", "nativesdk"))
extrafiles = extravalues.pop('extrafiles', {})
extra_pn = extravalues.pop('PN', None)
extra_pv = extravalues.pop('PV', None)

View File

@@ -58,7 +58,11 @@ def append_resultsdata(results, f, configmap=store_map, configvars=extra_configv
testseries = posixpath.basename(posixpath.dirname(url.path))
else:
with open(f, "r") as filedata:
data = json.load(filedata)
try:
data = json.load(filedata)
except json.decoder.JSONDecodeError:
print("Cannot decode {}. Possible corruption. Skipping.".format(f))
data = ""
testseries = os.path.basename(os.path.dirname(f))
else:
data = f