Compare commits

..

199 Commits

Author SHA1 Message Date
Steve Sakoman
a9e3cc3b9e build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 82e67bd9c77f0c5cbb652ca91071b9e57bdcfb33)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-22 03:37:47 -10:00
Steve Sakoman
378b447059 poky.conf: bump version for 3.1.31
(From meta-yocto rev: 11fa082996c6c9e95b2f31eabaf22bc7167fe370)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-22 03:31:37 -10:00
Steve Sakoman
adfae38944 documentation: update for 3.1.31
(From yocto-docs rev: b56d349ae7cabf7d84d5dbde3751d93ab2f11747)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-22 03:31:37 -10:00
Maxin B. John
40c106bc61 ref-manual: classes: remove insserv bbclass
insserv.bbclass was removed from oe-core:

commit e6bb5dbb62
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Sun May 10 12:30:49 2015 +0100

insserv: Remove

(From yocto-docs rev: 383fbedb057ffb28dddf201995ae622ce7b7eff5)

Signed-off-by: Maxin John <maxin.john@gmail.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-22 03:31:37 -10:00
Simone Weiß
acf1b57188 dev-manual: start.rst: update use of Download page
The yocto website has changed its structure. Update the section for
Accessing the Downloads page to match the new structure.

(From yocto-docs rev: f9a3b59c130d498c02dfdc016958c92ac74737a7)

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-22 03:31:37 -10:00
Vijay Anusuri
d9d1a730ae libtiff: Fix for CVE-2023-6228
Upstream-Status: Backport [1e7d217a32]

(From OE-Core rev: ff66998ef81dbc35465e30eec96ee9be51f5da80)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:19 -10:00
Vijay Anusuri
854aafaea4 qemu: Backport fix for CVE-2023-2861
Updated 0012-fix-libcap-header-issue-on-some-distro.patch to resolve
patch fuzz caused by the CVE-2023-2861 patch

Upstream-Status: Backport
[a5804fcf7b
&
f6b0de53fb]

(From OE-Core rev: cede843cdd1d1a83b2d616086aa69a2b584f9442)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:19 -10:00
Peter Marko
7e3b27865d zlib: ignore CVE-2023-6992
This CVE is for iCPE cloudflare:zlib.

Alternative to ignoring would be to limit CVE_PRODUCT, but
historic CVEs already have two - gnu:zlib and zlib:zlib.
So limiting it could miss future CVEs.

(From OE-Core rev: 5dc87309639e78195eb1283afc193f6eac63b044)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:19 -10:00
Vijay Anusuri
2f7e1a230e libxml2: Fix for CVE-2023-45322
Backport patch for gitlab issue mentioned in NVD CVE report.
* https://gitlab.gnome.org/GNOME/libxml2/-/issues/583
Backport also one of 14 patches for older issue with similar errors
to have clean cherry-pick without patch fuzz.
* https://gitlab.gnome.org/GNOME/libxml2/-/issues/344

The CVE is disputed because the maintainer does not think that
errors after memory allocation failures are not critical enough
to warrant a CVE ID.
This patch will formally fix reported error case, trying to backport
another 13 patches and resolve conflicts would be probably overkill
due to disputed state.
This CVE was ignored on master branch (as diputed).

(From OE-Core rev: 03b766e42beb42a2085285308acbcf941f346b06)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:19 -10:00
Vijay Anusuri
0948746aac xserver-xorg: Fix for CVE-2023-6377 and CVE-2023-6478
Upstream-Status: Backport
[0c1a93d319
& 14f480010a]

(From OE-Core rev: f5eff24d386215e5b5aee5c3261f5602b47c7f02)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:19 -10:00
Vijay Anusuri
5c5aa47adb go: Backport fix for CVE-2023-45287
Upstream-Status: Backport
[9baafabac9
&
c9d5f60eaa
&
8f676144ad
&
8a81fdf165]

(From OE-Core rev: 20e1d10a3ebefc8c5237c065c25eba4182d22efd)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-21 08:33:18 -10:00
Michael Opdenacker
b418ede994 ref-manual: update tested and supported distros
According to currently active workers
https://autobuilder.yoctoproject.org/typhoon/#/workers
and to the "workers_prev_releases" definition
in https://git.yoctoproject.org/yocto-autobuilder2/tree/config.py

Also correct the text saying that SANITY_TESTED_DISTROS
lists currently tested distros.

Also replace AlmaLinux 8.8 and 9.2 by just AlmaLinux 8 and 9,
as we update our workers anyway.

(From yocto-docs rev: db466a25a3cf8dfb660f65c12573265a702d0d8f)

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:04 -10:00
Dmitry Baryshkov
dc5397b0f6 linux-firmware: upgrade 20230804 -> 20231030
License-Update: additional firmwares

(From OE-Core rev: b3dd6852c0d6b8aa9b36377d7024ac95062e8098)

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 7c725d1f2ed9a271d39d899ac2534558c2d103fc)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:03 -10:00
Dhairya Nagodra
60b073d8c3 cve-update-nvd2-native: increase the delay between subsequent request failures
Sometimes NVD servers are unstable and return too many errors.
There is an option to have higher fetch attempts to increase the chances
of successfully fetching the CVE data.

Additionally, it also makes sense to progressively increase the delay
after a failed request to an already unstable or busy server.
The increase in delay is reset after every successful request and
the maximum delay is limited to 30 seconds.

Also, the logs are improved to give more clarity.

(From OE-Core rev: 9e03b7a9879fd16e32f4eccb78b438f6fa9db74d)

Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 7101d654635b707e56b0dbae8c2146b312d211ea)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:03 -10:00
Dhairya Nagodra
11a511fbc9 cve-update-nvd2-native: faster requests with API keys
As per NVD, the public rate limit is 5 requests in 30s (6s delay).
Using an API key increases the limit to 50 requests in 30s (0.6s delay).
However, NVD still recommends sleeping for several seconds so that the
other legitimate requests are serviced without denial or interruption.
Keeping the default sleep at 6 seconds and 2 seconds with an API key.

For failures, the wait time is unchanged (6 seconds).

Reference: https://nvd.nist.gov/developers/start-here#RateLimits

(From OE-Core rev: eb5ab00be33a503205401541e88c32ba9da1d75c)

Signed-off-by: Dhairya Nagodra <dnagodra@cisco.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 5c32e2941d1dc3d04a799a1b7cbd275c1ccc9e79)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:03 -10:00
Peter Marko
1a94a64268 cve-update-nvd2-native: make number of fetch attemtps configurable
Sometimes NVD servers are unstable and return too many errors.

Last time we increased number of attempts from 3 to 5, but
further increasing is not reasonable as in normal case
too many retries is just abusive.

Keep retries low as default and allow to increase as needed.

(From OE-Core rev: ee2a6ade703317d09f7df60ef7ce300d8f868f54)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 6b6fd8043d83b99000054ab6ad2c745d07c6bcc1)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:03 -10:00
Peter Marko
982ab5d6d9 cve-update-nvd2-native: remove unused variable CVE_SOCKET_TIMEOUT
This variable is not referenced in oe-core anymore.

(From OE-Core rev: 70676801f1f8fe498ff34fc1db72b6a3bf438d4a)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 905b45a814cb33327503b793741c19b44c8550b3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-10 03:57:03 -10:00
Shubham Kulkarni
8873e8d033 tzdata: Upgrade to 2023d
(From OE-Core rev: 3ea36d92800b139eaaf75995cdd59912b63db9ee)

Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 2956b1aa22129951b8c08ac06ff1ffd66811a26c)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-05 03:25:39 -10:00
Vijay Anusuri
bcf4caec9e qemu: Fix CVE-2023-5088
A bug in QEMU could cause a guest I/O operation otherwise
addressed to an arbitrary disk offset to be targeted to
offset 0 instead (potentially overwriting the VM's boot code).

This change is to fix CVE-2023-5088.

Link: 7d7512019f

(From OE-Core rev: df9e2d40c52b752940de61388997e485da56de0c)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-05 03:25:39 -10:00
Vijay Anusuri
a2bf2f28c4 go: Fix CVE-2023-39326
A malicious HTTP sender can use chunk extensions to cause a receiver
reading from a request or response body to read many more bytes from
the network than are in the body. A malicious HTTP client can further
exploit this to cause a server to automatically read a large amount
of data (up to about 1GiB) when a handler fails to read the entire
body of a request. Chunk extensions are a little-used HTTP feature
which permit including additional metadata in a request or response
body sent using the chunked encoding. The net/http chunked encoding
reader discards this metadata. A sender can exploit this by inserting
a large metadata segment with each byte transferred. The chunk reader
now produces an error if the ratio of real body to encoded bytes grows
too small.

References:
https://nvd.nist.gov/vuln/detail/CVE-2023-39326
https://security-tracker.debian.org/tracker/CVE-2023-39326

(From OE-Core rev: 5b55648f3142762c9563289c1b19aa3b7de27164)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-05 03:25:38 -10:00
Richard Purdie
c0e5370a91 bitbake: lib/bb: Add workaround for libgcc issues with python 3.8 and 3.9
With python 3.8 and 3.9, we see intermittent errors of:

libgcc_s.so.1 must be installed for pthread_cancel to work
Aborted (core dumped)

which seem related to:

https://stackoverflow.com/questions/64797838/libgcc-s-so-1-must-be-installed-for-pthread-cancel-to-work
https://bugs.ams1.psf.io/issue42888

These tend to occur on debian 11 and ubuntu 20.04.

Workaround this by ensuring libgcc is preloaded in all cases.

(Bitbake rev: 36959b25c64044dd4bca65bd1bb1243823d51545)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-05 03:25:38 -10:00
Insu Park
e25b0dcc9e bitbake: data: Add missing dependency handling of remove operator
A recipe variable handles its dependencies even on the "contains"
variables within the "inline Python expressions" like bb.utils.filter().
And it also handles those in the append operator correctly, but the
problem is that it does not so in the remove operator.

Fix it by adding the missing dependencies every time the remove
operator has been handled.
Also add a test case to check if the override operators handle
dependencies correctly.

(Bitbake rev: 48799c68b69b7921c809e0fc970303866643eb2a)

Signed-off-by: Insu Park <insu0.park@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Cherry-picked from master: b90520eedb1dbc7f6a3928d089fe74fafb864eb5
- Conflicts in data.py are resolved as the master branch moved
  handle_contains() and handle_remove() out of the try block
  and added the 3rd argument, "exclusions", to handle_contains().
- The test code in codeparser.py are modified as the master branch
  added three more arguments to the build_dependencies().

Signed-off-by: Insu Park <insu0.park@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-01-05 03:25:38 -10:00
Steve Sakoman
80cc03ec40 testimage: drop target_dumper and host_dumper
The target_dumper code is basically broken. It has been reading binary files
over the text base serial communication and runs at every command failure which
makes no sense. Each run might overwrite files from the previous run and the
output appears corrupted due to confusion from the binary data.

It isn't possible to cherry-pick "testimage: Drop target_dumper and most of monitor_dumper"
from master, so just make target_dumper and host_dumper empty functions.

For further details see:

https://lists.openembedded.org/g/openembedded-architecture/message/1888

(From OE-Core rev: 94e9019d2f170a26206c2774381a1d183313ecaa)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:14 -10:00
Hitendra Prajapati
1de3816043 bluez5: fix CVE-2023-45866
Upstream-Status: Backport from https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=25a471a83e02e1effb15d5a488b3f0085eaeb675

(From OE-Core rev: 1df2bdf370346dac70451159adf1ae85d1a2dacd)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:14 -10:00
Vijay Anusuri
fc412fa80d openssh: backport Debian patch for CVE-2023-48795
import patches from ubuntu to fix
 CVE-2023-48795

Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/openssh/tree/debian/patches?h=ubuntu%2Ffocal-security
Upstream commit 1edb00c58f]

Reference: https://ubuntu.com/security/CVE-2023-48795

(From OE-Core rev: 4026a1cc3aa242a80c306b34b030f05d41b55dda)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:14 -10:00
Virendra Thakur
0aa12e4919 binutils: fix multiple cve
Fix below CVE's
CVE-2022-47007
CVE-2022-47008
CVE-2022-47010
CVE-2022-47011
CVE-2022-48063
CVE-2022-47695

(From OE-Core rev: 873163936937a583278e3cd97c6226935f2faa0c)

Signed-off-by: Virendra Thakur <virendrak@kpit.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:14 -10:00
Vijay Anusuri
3433d043c7 flac: Backport fix for CVE-2021-0561
Upstream-Status: Backport [e1575e4a7c]

(From OE-Core rev: 9b2cd2d5e0dac297b3a1779e6720e0ee2a3de168)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:13 -10:00
Lee Chee Yang
39aad83070 curl: fix CVE-2023-46218
import patch from ubuntu
http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.68.0-1ubuntu2.21.debian.tar.xz

upstream https://github.com/curl/curl/commit/2b0994c29a721c91c57

(From OE-Core rev: 7bf11847b18d2f9a7e5467d686af817cb504b206)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-29 05:29:13 -10:00
Richard Purdie
ef0c19babe testimage: Exclude wtmp from target-dumper commands
wtmp is filled with binary data which the run_serial command can't cope with.
Catting this results in confusion of the serial interface and potentially large
backlogs of data in the buffers which can hang qemu.

Exclude the problematic files from the command.

(From OE-Core rev: 05d9f9c6b27c0216fa4e349109ef42cf91bb4084)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 599ac08a6f6fb3f6a89a897c8e06367c63c2f979)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Vijay Anusuri
6b9d89ec0b libxml2: Backport fix for CVE-2021-3516
Upstream-Status: Backport [1358d157d0]

(From OE-Core rev: 29c182375d91806d1e802b026f84b24e7c5d4b35)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Vivek Kumbhar
c7fbe91c2a libsndfile: fix CVE-2021-4156 heap out-of-bounds read in src/flac.c in flac_buffer_copy
Upstream-Status: Backport from ced91d7b97

(From OE-Core rev: d922a288f79834d8f1120a4454b97803290e5c36)

Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Lee Chee Yang
3eda06c358 binutils: Fix CVE-2023-25584
import patch from ubuntu to fix CVE-2023-25584
http://archive.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.34-6ubuntu1.7.debian.tar.xz

upstream patch :
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=77c225bdeb410cf60da804879ad41622f5f1aa44

(From OE-Core rev: 8eff0e0ce44c60efcf6bec083d5794313f3ac4ad)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Lee Chee Yang
8efd61ccb1 perl: fix CVE-2023-31484/47038/47100
import patch from ubuntu
http://archive.ubuntu.com/ubuntu/pool/main/p/perl/perl_5.30.0-9ubuntu0.5.debian.tar.xz

fix:
CVE-2023-31484
CVE-2023-47038
CVE-2023-47100

as per https://ubuntu.com/security/CVE-2023-47100 ,
CVE-2023-47100 is duplicate of CVE-2023-47038.

perl import entire CPAN in single commit,
hence backport fix from their upstream cpan instead.

(From OE-Core rev: 74861848ba0d3ba920ef54f016240807ba42682a)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Bhabu Bindu
43fa25ea6f glibc: Fix CVE-2023-4813
Add patch to fix CVE-2023-4813

Link: https://security-tracker.debian.org/tracker/CVE-2023-4813

(From OE-Core rev: d735b2a94091f9a4a91917c73bd73d9ce4a31e3e)

Signed-off-by: Bhabu Bindu <bhabu.bindu@kpit.com>
Signed-off-by: Poonam Jadhav <ppjadhav456@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Marta Rybczynska
f56b099225 bitbake: toastergui: verify that an existing layer path is given
Verify that an existing layer path was given when adding a new
layer.

Manually using the shell for globbing is unnecessary, use the glob
function instead for cleaner code.

(Bitbake rev: 48d1d18c23b3f514dc7a1ee12cc35cf5993af88d)

Signed-off-by: Marta Rybczynska <marta.rybczynska@syslinbit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-21 05:17:55 -10:00
Steve Sakoman
dbe19706ec build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 55157aa2f8b157b1cc63e1134d9eba6db0cf16da)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-11 05:16:30 -10:00
Bruce Ashfield
b86bf0103c linux-yocto-rt/5.4: fix buld failure
Integrating the following commit(s) to linux-yocto/5.4:

1/1 [
    Author: Bruce Ashfield
    Email: bruce.ashfield@gmail.com
    Subject: rt: drop -stable migrate_disable
    Date: Mon, 11 Dec 2023 08:50:52 -0500

    The -rt branches already have a migrate disable mechanism, we
    drop the -stable version to fix build issues.

    Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
]

(From OE-Core rev: f29aff4a2a907f70c5397f9f1f7b5c1f8beb8647)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-11 05:13:16 -10:00
Steve Sakoman
bf9eabafc2 build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 7e65b351fa8eda4ee7b9f1f2a8dbfe14e0ef697a)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-10 06:03:17 -10:00
Ross Burton
8c297c4b42 bitbake: siggen: use correct umask when writing siginfo
We try to write sstate with group-write permissions so that sstate-cache
can be shared between multiple users.  However the siginfo files are
created in various tasks which may set their own umask (such as
do_populate_sysroot, 0022).  This results in no group write permission
on the intermediate directories, which is fatal when sharing a cache.

Fix this by wrapping the siginfo mkdir in a umask change to 0002.

(Bitbake rev: c0d60794a32e3f8bbfbbd6800d87ef2782aacf2c)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-10 05:55:55 -10:00
Ross Burton
658a3832de bitbake: utils: add umask changing context manager
Add a umask context manager which can be used to temporarily change the
umask in a 'with' block.

(Bitbake rev: 6ca998054e422da72c7906d3ec4f204d88c32ee0)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-10 05:55:55 -10:00
Steve Sakoman
0b105ed7c8 build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 0abf394b12c7cd5c24da1eb6ab24bec30658998a)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:49:08 -10:00
Steve Sakoman
25972743e6 poky.conf: bump version for 3.1.30
(From meta-yocto rev: 795cef721de8e993bc2561e6c89caa6f10ee206a)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Steve Sakoman
2e5bead98f documentation: update for 3.1.30
(From yocto-docs rev: 2bf8c79006a7ea17f123f585b32cf8fedaea9bb5)

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-12-08 11:45:59 -10:00
Steve Sakoman
7dd1d3973e cve-exclusion_5.4.inc: update for 5.4.262
(From OE-Core rev: fa5f8927e547da16588cf11dcf090f4ed53f3933)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Bruce Ashfield
9e0ebdc95f linux-yocto/5.4: update to v5.4.262
Updating  to the latest korg -stable release that comprises
the following commits:

    8e221b47173d Linux 5.4.262
    b053223b7cf4 netfilter: nf_tables: bogus EBUSY when deleting flowtable after flush (for 5.4)
    c35df8b8c572 netfilter: nf_tables: disable toggling dormant table state more than once
    e10f661adc55 netfilter: nf_tables: fix table flag updates
    46c2947fcd71 netfilter: nftables: update table flags from the commit phase
    b09e6ccf0d12 netfilter: nf_tables: double hook unregistration in netns path
    b05a24cc453e netfilter: nf_tables: unregister flowtable hooks on netns exit
    a995a68e8a3b netfilter: nf_tables: fix memleak when more than 255 elements expired
    b95d7af657a8 netfilter: nft_set_hash: try later when GC hits EAGAIN on iteration
    61a7b3de20e2 netfilter: nft_set_rbtree: use read spinlock to avoid datapath contention
    03caf75da105 netfilter: nft_set_rbtree: skip sync GC for new elements in this transaction
    021d734c7eaa netfilter: nf_tables: defer gc run if previous batch is still pending
    38ed6a5f836f netfilter: nf_tables: use correct lock to protect gc_list
    4b6346dc1edf netfilter: nf_tables: GC transaction race with abort path
    b76dcf466223 netfilter: nf_tables: GC transaction race with netns dismantle
    29ff9b8efb84 netfilter: nf_tables: fix GC transaction races with netns and netlink event exit path
    1398a0eee290 netfilter: nf_tables: remove busy mark and gc batch API
    85520a1f1d87 netfilter: nft_set_hash: mark set element as dead when deleting from packet path
    c357648929c8 netfilter: nf_tables: adapt set backend to use GC transaction API
    bbdb3b65aa91 netfilter: nf_tables: GC transaction API to avoid race with control plane
    1da4874d05da netfilter: nf_tables: don't skip expired elements during walk
    acaee227cf79 netfilter: nft_set_rbtree: fix overlap expiration walk
    899aa5638568 netfilter: nft_set_rbtree: fix null deref on element insertion
    181859bdfb97 netfilter: nft_set_rbtree: Switch to node list walk for overlap detection
    3c7ec098e3b5 netfilter: nf_tables: drop map element references from preparation phase
    6b880f3b2c04 netfilter: nftables: rename set element data activation/deactivation functions
    e1eed9e0b5e8 netfilter: nf_tables: pass context to nft_set_destroy()
    961c4511c757 tracing: Have trace_event_file have ref counters
    7676a41d90c5 drm/amdgpu: fix error handling in amdgpu_bo_list_get()
    36383005f1db ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks
    e95f74653dff ext4: correct the start block of counting reserved clusters
    1fbfdcc3d65e ext4: correct return value of ext4_convert_meta_bg
    dfdfd3f21830 ext4: correct offset of gdb backup in non meta_bg group to update_backups
    85c12e80c474 ext4: apply umask if ACL support is disabled
    d2aed8814f02 Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
    b9e5f633b35d nfsd: fix file memleak on client_opens_release
    339d7d40d3dc media: venus: hfi: add checks to handle capabilities from firmware
    cab97cdd409a media: venus: hfi: fix the check to handle session buffer requirement
    5d39d0c1f43f media: venus: hfi_parser: Add check to keep the number of codecs within range
    497b12d47cc6 media: sharp: fix sharp encoding
    92d8a0478fb3 media: lirc: drop trailing space from scancode transmit
    cac054d10324 i2c: i801: fix potential race in i801_block_transaction_byte_by_byte
    b132e462363f net: dsa: lan9303: consequently nested-lock physical MDIO
    229738d71702 Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
    4074957ec6bb Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE
    356a2ee5fc36 Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables
    afe92b66a5d8 bluetooth: Add device 13d3:3571 to device tables
    dc073a2626d3 bluetooth: Add device 0bda:887b to device tables
    75d26f7f6118 Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559
    323710a6b4c6 Bluetooth: btusb: add Realtek 8822CE to usb_device_id table
    981ee23b8d48 Bluetooth: btusb: Add flag to define wideband speech capability
    0fe69c99cc13 tty: serial: meson: fix hard LOCKUP on crtscts mode
    8f40bbf7dc01 serial: meson: Use platform_get_irq() to get the interrupt
    a1113f2c9b2c tty: serial: meson: retrieve port FIFO size from DT
    13391526d817 serial: meson: remove redundant initialization of variable id
    6245d0d70fe8 ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
    4ef452297de4 ALSA: info: Fix potential deadlock at disconnection
    c7df9523fed2 parisc/pgtable: Do not drop upper 5 address bits of physical address
    c32dfec86714 parisc: Prevent booting 64-bit kernels on PA1.x machines
    d570d139cb38 i3c: master: cdns: Fix reading status register
    ad6941b192ca mm/cma: use nth_page() in place of direct struct page manipulation
    36512866607e dmaengine: stm32-mdma: correct desc prep when channel running
    4a5c267d5700 mcb: fix error handling for different scenarios when parsing
    25eb381a736e i2c: core: Run atomic i2c xfer when !preemptible
    975b5ff33f9a kernel/reboot: emergency_restart: Set correct system_state
    421f9ccc75c5 quota: explicitly forbid quota files from being encrypted
    7d0c36cd2e65 jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev
    665c2f186b8c btrfs: don't arbitrarily slow down delalloc if we're committing
    b5a8382cf829 PM: hibernate: Clean up sync_read handling in snapshot_write_next()
    2b3cfdaa8833 PM: hibernate: Use __get_safe_page() rather than touching the list
    612c17a90fce mmc: vub300: fix an error code
    398940412e8d clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks
    0b2b22b706ec parisc/pdc: Add width field to struct pdc_model
    012dba0ab814 PCI: keystone: Don't discard .probe() callback
    9988c9dc3c8b PCI: keystone: Don't discard .remove() callback
    a438322e0078 genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware
    683c562c434d mmc: meson-gx: Remove setting of CMD_CFG_ERROR
    d894f9288cff ACPI: resource: Do IRQ override on TongFang GMxXGxx
    7b15bc9b753f PCI/sysfs: Protect driver's D3cold preference from user space
    78d3487b5b87 hvc/xen: fix error path in xen_hvc_init() to always register frontend driver
    6b21ae025b82 audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare()
    c0d01f03aaac audit: don't take task_lock() in audit_exe_compare() code path
    4d0a828775f0 KVM: x86: Ignore MSR_AMD64_TW_CFG access
    5066faedd2f7 KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
    268d17ab637a x86/cpu/hygon: Fix the CPU topology evaluation for real
    acbc12b0b348 scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers
    bae690510316 bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END
    6933bc9a5f77 randstruct: Fix gcc-plugin performance mode to stay in group
    c94d05ac6937 media: venus: hfi: add checks to perform sanity on queue pointers
    6d028ade9db7 cifs: spnego: add ';' in HOST_KEY_LEN
    26415e35f669 tools/power/turbostat: Fix a knl bug
    a49786297b83 macvlan: Don't propagate promisc change to lower dev in passthru
    04cb9ab8ebc5 net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
    c740f4716a44 net/mlx5_core: Clean driver version and name
    e4bdbcce8e02 net/mlx5e: fix double free of encap_header
    5cc1f24f7333 net: stmmac: fix rx budget limit check
    c4b712d1a814 net: stmmac: Rework stmmac_rx()
    b2762d13dfae netfilter: nf_conntrack_bridge: initialize err to 0
    fd51e7541ff6 net: ethernet: cortina: Fix MTU max setting
    823bffdaac39 net: ethernet: cortina: Handle large frames
    f5055d7345d6 net: ethernet: cortina: Fix max RX frame define
    b4f0e605a508 bonding: stop the device in bond_setup_by_slave()
    7ea0a719e578 ptp: annotate data-race around q->head and q->tail
    89af55e0fa13 xen/events: fix delayed eoi list handling
    db957a2f5481 ppp: limit MRU to 64K
    f3b250d91993 tipc: Fix kernel-infoleak due to uninitialized TLV value
    77236275d4cd net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()
    14c6cd41c851 tty: Fix uninit-value access in ppp_sync_receive()
    4d2d30f0792b ipvlan: add ipvlan_route_v6_outbound() helper
    ed53c1518811 NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
    fe449f8b9727 wifi: iwlwifi: Use FW rate for non-data frames
    eca19db60f99 pwm: Fix double shift bug
    d996530ba92c ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
    6d703922bc9e kgdb: Flush console before entering kgdb on panic
    eac3e4760aa1 drm/amd/display: Avoid NULL dereference of timing generator
    514565ff7fce media: cobalt: Use FIELD_GET() to extract Link Width
    2bb42a27a92f gfs2: ignore negated quota changes
    a251e20a2cbe media: vivid: avoid integer overflow
    8f83c85ee882 media: gspca: cpia1: shift-out-of-bounds in set_flicker
    a8f829886d47 i2c: sun6i-p2wi: Prevent potential division by zero
    80876a07ca3b usb: gadget: f_ncm: Always set current gadget in ncm_bind()
    460284dfb10b tty: vcc: Add check for kstrdup() in vcc_probe()
    35b9435123ef HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W
    b549acf99982 scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
    33906b36b15d atm: iphase: Do PCI error checks on own line
    54f4dde8fa0c PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
    2527775616f3 ALSA: hda: Fix possible null-ptr-deref when assigning a stream
    953ed26a77c6 ARM: 9320/1: fix stack depot IRQ stack filter
    7467ca10a5ff jfs: fix array-index-out-of-bounds in diAlloc
    ecfb47f13b08 jfs: fix array-index-out-of-bounds in dbFindLeaf
    32bd8f1cbcf8 fs/jfs: Add validity check for db_maxag and db_agpref
    a81a56b4cbe3 fs/jfs: Add check for negative db_l2nbperpage
    e18d266fb3f1 RDMA/hfi1: Use FIELD_GET() to extract Link Width
    c9c133469730 crypto: pcrypt - Fix hungtask for PADATA_RESET
    ddd6e5266343 selftests/efivarfs: create-read: fix a resource leak
    437e0fa907ba drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
    d50a56749e5a drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga
    c847379a5d00 drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
    1f24c286f4a4 drm/komeda: drop all currently held locks if deadlock happens
    5305ae0d4ad8 platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e
    3c4236f1b2a7 Bluetooth: Fix double free in hci_conn_cleanup
    3cf391e4174a wifi: ath10k: Don't touch the CE interrupt registers after power up
    252bde6b17b8 net: annotate data-races around sk->sk_dst_pending_confirm
    73909810ac27 net: annotate data-races around sk->sk_tx_queue_mapping
    bd653b07095a wifi: ath10k: fix clang-specific fortify warning
    32cc96dc5f4e wifi: ath9k: fix clang-specific fortify warnings
    efeae5f4972f wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
    770da15be321 wifi: mac80211_hwsim: fix clang-specific fortify warning
    cfe13e1486d4 x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
    91f7467ac96a clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
    da667a3f8e23 clocksource/drivers/timer-imx-gpt: Fix potential memory leak
    788c0b3442ea perf/core: Bail out early if the request AUX area is out of bound
    dcd85e3c9293 locking/ww_mutex/test: Fix potential workqueue corruption
    ef379773e2e7 Linux 5.4.261
    3542ef5c3748 btrfs: use u64 for buffer sizes in the tree search ioctls
    7868e6151a6d Revert "mmc: core: Capture correct oemid-bits for eMMC cards"
    7be3aca8d73d fbdev: fsl-diu-fb: mark wr_reg_wa() static
    6c66d737b272 fbdev: imsttfb: fix a resource leak in probe
    b90c8dfd715f fbdev: imsttfb: Fix error path of imsttfb_probe()
    4a6a3f1b3840 spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies
    157333513d14 drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE
    21858a75dc78 netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
    ae99c5e16a83 netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs
    11380557c236 netfilter: xt_recent: fix (increase) ipv6 literal buffer length
    cce1d4668191 r8169: respect userspace disabling IFF_MULTICAST
    e820e23338d1 tg3: power down device only on SYSTEM_POWER_OFF
    f8065cde49b2 net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
    592f934b7a22 net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
    85513df59a3e Fix termination state for idr_for_each_entry_ul()
    56cddb5e657f net: r8169: Disable multicast filter for RTL8168H and RTL8107E
    e5a664ef4928 dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
    3af0af2f98f3 dccp: Call security_inet_conn_request() after setting IPv4 addresses.
    afa49774d812 inet: shrink struct flowi_common
    2199260c42e6 tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
    cbdcdf42d15d llc: verify mac len before reading mac header
    50d122536661 Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
    e3677bfcbbcb pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
    6e9b5295892e pwm: sti: Reduce number of allocations and drop usage of chip_data
    19e45307f71f pwm: sti: Avoid conditional gotos
    c4d5179e42b4 regmap: prevent noinc writes from clobbering cache
    d62d868b30b8 media: dvb-usb-v2: af9035: fix missing unlock
    7843a9bfbe13 media: s3c-camif: Avoid inappropriate kfree()
    b35fdade92c5 media: bttv: fix use after free error due to btv->timeout timer
    0bc0e36fccc2 pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
    1502edd4a014 pcmcia: ds: fix refcount leak in pcmcia_device_add()
    58d6fb6a933c pcmcia: cs: fix possible hung task and memory leak pccardd()
    37212eede637 rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
    204beeb509d3 i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
    247ed618f534 powerpc/pseries: fix potential memory leak in init_cpu_associativity()
    cee681d4b22b powerpc/imc-pmu: Use the correct spinlock initializer.
    dc5804b47b66 powerpc/xive: Fix endian conversion size
    b6cffe8dd7cd modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host
    90ab33735e2e f2fs: fix to initialize map.m_pblk in f2fs_precache_extents()
    9f20b06214dc dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc()
    688326e2cf9e USB: usbip: fix stub_dev hub disconnect
    b003b7a7d42e tools: iio: iio_generic_buffer ensure alignment
    7a64d15db7aa tools: iio: iio_generic_buffer: Fix some integer type and calculation
    db6d5b9ff6e8 tools: iio: privatize globals and functions in iio_generic_buffer.c file
    55b90e4c406a misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()
    ed9b2ad3b9ca dmaengine: ti: edma: handle irq_of_parse_and_map() errors
    64c47749fc75 usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency
    4050f13f71f2 tty: tty_jobctrl: fix pid memleak in disassociate_ctty()
    ba46faaa49c5 leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
    abfd682fc5f0 ledtrig-cpu: Limit to 8 CPUs
    f6c3b7a4ce51 leds: pwm: Don't disable the PWM when the LED should be off
    cd6f50115fab leds: pwm: convert to atomic PWM API
    9686f771c096 leds: pwm: simplify if condition
    87b1ee831ddf mfd: dln2: Fix double put in dln2_probe
    b843d2cd134b ASoC: ams-delta.c: use component after check
    4634c9cc726d ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails
    66888e6953f8 sh: bios: Revive earlyprintk support
    fdcbe9ce7bf3 RDMA/hfi1: Workaround truncation compilation error
    01698922f5d3 scsi: ufs: core: Leave space for '\0' in utf8 desc string
    3c61391a31a6 ext4: move 'ix' sanity check to corrent position
    454e6493bbda ARM: 9321/1: memset: cast the constant byte to unsigned char
    727203e6e7e7 hid: cp2112: Fix duplicate workqueue initialization
    48bb2931f24c HID: cp2112: Use irqchip template
    7b62cf90d0ea crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
    090e89c71620 crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
    40ba3fa21250 nd_btt: Make BTT lanes preemptible
    68655462f8be sched/rt: Provide migrate_disable/enable() inlines
    d14a373fe559 libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
    f5d95a39683e hwrng: geode - fix accessing registers
    e4e4d4abb82b clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped
    ce11e445d0ae firmware: ti_sci: Mark driver as non removable
    5d97cc0b491e firmware: ti_sci: Replace HTTP links with HTTPS ones
    cc1a1dcb411f soc: qcom: llcc: Handle a second device without data corruption
    813fdddde20f soc: qcom: Rename llcc-slice to llcc-qcom
    077010717b52 soc: qcom: llcc cleanup to get rid of sdm845 specific driver file
    3da50ee512e2 ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator
    6b464d9414e3 arm64: dts: qcom: sdm845-mtp: fix WiFi configuration
    64d990086065 drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
    ddc42881f170 drm/radeon: possible buffer overflow
    4a29f0f7a1b7 drm/rockchip: vop: Fix call to crtc reset helper
    824f0f4f93c6 drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs
    eaf62ea6504f hwmon: (coretemp) Fix potentially truncated sysfs attribute name
    9fb0eed09e14 platform/x86: wmi: Fix opening of char device
    22117b77eecb platform/x86: wmi: remove unnecessary initializations
    1607ea8a8161 platform/x86: wmi: Fix probe failure when failing to register WMI devices
    d1461f0c9ca0 clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data
    e8ae4b49dd9c clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data
    cfa68e0ac5dc clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data
    2705c5b97f50 clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data
    fbe466f06d4e clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data
    8ae911637b0b clk: npcm7xx: Fix incorrect kfree
    cbcf67b0bc5d clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
    3d38bc4bab88 clk: imx: Select MXC_CLK for CLK_IMX8QXP
    ae98b5ef991a clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src
    15f335494bb3 clk: qcom: gcc-sm8150: use ARRAY_SIZE instead of specifying num_parents
    141ccc127230 clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies
    dbf13624b2de regmap: debugfs: Fix a erroneous check after snprintf()
    af50165c1218 ipvlan: properly track tx_errors
    76304c749e05 net: add DEV_STATS_READ() helper
    4482b250c895 ipv6: avoid atomic fragment on GSO packets
    19d527337870 ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
    5105d46146f2 tcp: fix cookie_init_timestamp() overflows
    e4e819bdc8f3 tcp: Remove one extra ktime_get_ns() from cookie_init_timestamp
    7ab8aa73002c chtls: fix tp->rcv_tstamp initialization
    75bbf6e93462 r8169: fix rare issue with broken rx after link-down on RTL8125
    282342bc47c6 r8169: use tp_to_dev instead of open code
    3091ab943dfc thermal: core: prevent potential string overflow
    35854733ae67 can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on()
    b53be254d30f can: dev: can_restart(): don't crash kernel if carrier is OK
    a29f012a27cf wifi: rtlwifi: fix EDCA limit set by BT coexistence
    bed72a332f02 tcp_metrics: do not create an entry from tcp_init_metrics()
    f3902c0e6f08 tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics()
    b78f2b7774a0 tcp_metrics: add missing barriers on delete
    af0fe2c2ff4d wifi: mt76: mt7603: rework/fix rx pse hang check
    a2e99dbdc127 wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
    c9b929f7932b tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed
    25eaef1d0d0e i40e: fix potential memory leaks in i40e_remove()
    09ce728c9e27 genirq/matrix: Exclude managed interrupts in irq_matrix_allocated()
    3718a48ef495 vfs: fix readahead(2) on block devices

(From OE-Core rev: a1e332f095eec1cb7a386a14c9ff4ce59594901a)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Bruce Ashfield
9716962e34 linux-yocto/5.4: update to v5.4.260
Updating  to the latest korg -stable release that comprises
the following commits:

    87e8e7a7aa1f Linux 5.4.260
    8b0ecf2167a0 tty: 8250: Add support for Intashield IS-100
    6dd5561b2385 tty: 8250: Add support for Brainboxes UP cards
    03145e0ff8ab tty: 8250: Add support for additional Brainboxes UC cards
    5a6471372f9b tty: 8250: Remove UC-257 and UC-431
    72f236b57f1c usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility
    792a91fcd20d PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device
    4b865e0d78a0 Revert "ARM: dts: Move am33xx and am43xx mmc nodes to sdhci-omap driver"
    4e53bab11f01 nvmet-tcp: Fix a possible UAF in queue intialization setup
    2c9415ec8ea9 nvmet-tcp: move send/recv error handling in the send/recv methods instead of call-sites
    784ef618b2cc remove the sx8 block driver
    a31f8222a74c ata: ahci: fix enum constants for gcc-13
    cc1afa62e231 net: chelsio: cxgb4: add an error code check in t4_load_phy_fw
    7e429d1f3994 platform/mellanox: mlxbf-tmfifo: Fix a warning message
    5f4f58eac361 platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e
    88d1aa03eb16 scsi: mpt3sas: Fix in error path
    b1f62e3ef90c fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit()
    fb02de64791c ASoC: rt5650: fix the wrong result of key button
    b6c09ff5eada netfilter: nfnetlink_log: silence bogus compiler warning
    6c23b6d308af spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
    788b308340ef fbdev: atyfb: only use ioremap_uc() on i386 and ia64
    848b9c688865 Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport
    a0bf183db438 dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe
    39ae053abbad irqchip/stm32-exti: add missing DT IRQ flag translation
    fbcd05a0dbda Input: i8042 - add Fujitsu Lifebook E5411 to i8042 quirk table
    cda248f16924 x86: Fix .brk attribute in linker script
    01e6885b75e2 rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
    cff56d7a9274 rpmsg: glink: Release driver_override
    3d1478598057 rpmsg: Fix calling device_lock() on non-initialized device
    e70898ae1a42 rpmsg: Fix kfree() of static memory on setting driver_override
    0df5d801359e rpmsg: Constify local variable in field store macro
    063444d66f90 driver: platform: Add helper for safer setting of driver_override
    83ecffd40c65 ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow
    66cfd4cf6ac8 ext4: avoid overlapping preallocations due to overflow
    1e0a5dec2638 ext4: add two helper functions extent_logical_end() and pa_logical_end()
    c2102ac1033f x86/mm: Fix RESERVE_BRK() for older binutils
    ced79d864bfd x86/mm: Simplify RESERVE_BRK()
    5fc242c11804 nfsd: lock_rename() needs both directories to live on the same fs
    e9a988cd4c8b f2fs: fix to do sanity check on inode type during garbage collection
    750de03de7e1 smbdirect: missing rc checks while waiting for rdma events
    5776aeee2a60 kobject: Fix slab-out-of-bounds in fill_kobj_path()
    0a45e0e5dd8d arm64: fix a concurrency issue in emulation_proc_handler()
    6ba2ffe3cb1c drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
    9d29933f36e1 x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
    1ed21b207ece i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
    f48670c3b089 clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
    511f3e9bbb0a perf/core: Fix potential NULL deref
    8de78231cba9 nvmem: imx: correct nregs for i.MX6UL
    0b2c3a8601cc nvmem: imx: correct nregs for i.MX6SLL
    6063678df7fa nvmem: imx: correct nregs for i.MX6ULL
    12337d3e8819 i2c: aspeed: Fix i2c bus hang in slave read
    e3d8ef87a9b1 i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
    5764f6e546a9 i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
    a3b9bcedd7ad i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
    07ec3d952a4a i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
    519ff2d9fecf iio: exynos-adc: request second interupt only when touchscreen mode is used
    2bf9fbd13635 gtp: fix fragmentation needed check with gso
    2ab1b7ad5046 gtp: uapi: fix GTPA_MAX
    54ba3b8267b0 tcp: fix wrong RTO timeout when received SACK reneging
    29cb3f81bc71 r8152: Cancel hw_phy_work if we have an error in probe
    6124d0b100bf r8152: Run the unload routine if we have errors during probe
    1d3cb4aa9388 r8152: Increase USB control msg timeout to 5000ms as per spec
    2f8da9511607 net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
    ec885679fa9a igc: Fix ambiguity in the ethtool advertising
    3b098edafefa neighbour: fix various data-races
    418ca6e63e06 igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
    00ef4a7de62c treewide: Spelling fix in comment
    e44e78ff44e5 r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
    b9ba50fc18d7 r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
    a27c6bfc5287 virtio-mmio: fix memory leak of vm_dev
    8d394fcb0398 virtio_balloon: Fix endless deflation and inflation on arm64
    be84e96426ed mcb-lpc: Reallocate memory region to avoid memory overlapping
    3235094d55de mcb: Return actual parsed size when reading chameleon table
    fbe17a8be10a selftests/ftrace: Add new test case which checks non unique symbol
    4d057ca86eaa mtd: rawnand: marvell: Ensure program page operations are successful
    86ea40e6ad22 Linux 5.4.259
    c01ac092d97c xfrm6: fix inet6_dev refcount underflow problem
    b849a38e187d Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name
    4d161e18b1c4 Bluetooth: hci_sock: fix slab oob read in create_monitor_event
    a0f0e43128f3 phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
    d1618b922347 phy: mapphone-mdm6600: Fix runtime PM for remove
    4db06513a0ee phy: mapphone-mdm6600: Fix runtime disable on probe
    083ff5b50cf8 ASoC: pxa: fix a memory leak in probe()
    27a17a259005 gpio: vf610: set value before the direction to avoid a glitch
    664aad86e5e8 s390/pci: fix iommu bitmap allocation
    7252c8b98185 perf: Disallow mis-matched inherited group reads
    32279bbbd811 USB: serial: option: add Fibocom to DELL custom modem FM101R-GL
    1ff2a7fa0cc0 USB: serial: option: add entry for Sierra EM9191 with new firmware
    eb8f5e40cbe6 USB: serial: option: add Telit LE910C4-WWX 0x1035 composition
    b43a412aa1ef ACPI: irq: Fix incorrect return value in acpi_register_gsi()
    3189d2d58728 Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()"
    690eb3772f97 mmc: core: Capture correct oemid-bits for eMMC cards
    894b678d865b mmc: core: sdio: hold retuning if sdio in 1-bit mode
    37ae7c493a07 mtd: physmap-core: Restore map_rom fallback
    de28fa53318e mtd: spinand: micron: correct bitmask for ecc status
    bd68f5068401 mtd: rawnand: qcom: Unmap the right resource upon probe failure
    a787e07755b6 Bluetooth: hci_event: Fix using memcmp when comparing keys
    897d6aee8fb4 HID: multitouch: Add required quirk for Synaptics 0xcd7e device
    9cae05233b44 btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c
    693ecef54334 drm: panel-orientation-quirks: Add quirk for One Mix 2S
    4030effab831 sky2: Make sure there is at least one frag_addr available
    340bb4b71661 regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()"
    d7604e819aa6 wifi: cfg80211: avoid leaking stack data into trace
    139234011fde wifi: mac80211: allow transmitting EAPOL frames with tainted key
    b48595f5b1c6 Bluetooth: hci_core: Fix build warnings
    16e36cde2738 Bluetooth: Avoid redundant authentication
    fa83d852e987 HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
    981dfec995a6 tracing: relax trace_event_eval_update() execution with cond_resched()
    b5d9f34f38ba ata: libata-eh: Fix compilation warning in ata_eh_link_report()
    392f597eadd7 gpio: timberdale: Fix potential deadlock on &tgpio->lock
    91ae08dc3033 overlayfs: set ctime when setting mtime and atime
    01a4e9bc63b7 i2c: mux: Avoid potential false error message in i2c_mux_add_adapter
    97cb55f41e2a btrfs: initialize start_slot in btrfs_log_prealloc_extents
    a055d9d4dd78 btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
    d65dbb2aa4f3 ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone
    611c991b9e5f ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CBA
    b2d0649c8edf ACPI: resource: Skip IRQ override on ASUS ExpertBook B1502CBA
    8c0982fc4b72 ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA
    0818716a9012 ACPI: resource: Add Asus ExpertBook B2502 to Asus quirks
    c6f7b3358640 ACPI: resource: Skip IRQ override on Asus Vivobook S5602ZA
    b1f5f4720f52 ACPI: resource: Add ASUS model S5402ZA to quirks
    fdcd669371da ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA
    cd202a9f88f1 ACPI: resources: Add DMI-based legacy IRQ override quirk
    26b2bc9bdcde ACPI: Drop acpi_dev_irqresource_disabled()
    583913b1a667 resource: Add irqresource_disabled()
    d6878d39b675 net: pktgen: Fix interface flags printing
    cee9ea14c8c7 netfilter: nft_set_rbtree: .deactivate fails if element has expired
    863acae0b83a neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section
    f34916502d91 net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
    b1ad377bbaf7 i40e: prevent crash on probe if hw registers have invalid values
    c813d17660f8 net: usb: smsc95xx: Fix an error code in smsc95xx_reset()
    47419f2aefb3 ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
    00a251ea4507 tun: prevent negative ifindex
    8710dbe09e46 tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb
    1ae2c7d44e7e tcp: fix excessive TLP and RACK timeouts from HZ rounding
    eb1a33195a30 net: rfkill: gpio: prevent value glitch during probe
    cd44e14573c4 net: ipv6: fix return value check in esp_remove_trailer
    03b88b7d2a13 net: ipv4: fix return value check in esp_remove_trailer
    0cb7b894e47b xfrm: interface: use DEV_STATS_INC()
    bcacdf4debe5 xfrm: fix a data-race in xfrm_gen_index()
    639e979a7d15 qed: fix LL2 RX buffer allocation
    1cb76fec3ed6 netfilter: nft_payload: fix wrong mac header matching
    6b2875b52746 KVM: x86: Mask LVTPC when handling a PMI
    1d434d83136e regmap: fix NULL deref on lookup
    76050b0cc5a7 nfc: nci: fix possible NULL pointer dereference in send_acknowledge()
    80ce32ab9bee ice: fix over-shifted variable
    ec8f0d0fe6a7 Bluetooth: avoid memcmp() out of bounds warning
    1a00e3544b28 Bluetooth: hci_event: Fix coding style
    84598a339bf9 Bluetooth: vhci: Fix race when opening vhci device
    1769ac55dbf3 Bluetooth: Fix a refcnt underflow problem for hci_conn
    97ce8eca07c9 Bluetooth: Reject connection with the device which has same BD_ADDR
    6ce347833612 Bluetooth: hci_event: Ignore NULL link key
    6ad3e9fd3632 usb: hub: Guard against accesses to uninitialized BOS descriptors
    57e83c2445cd Documentation: sysctl: align cells in second content column
    947cd2fba15e dev_forward_skb: do not scrub skb mark within the same name space
    65d34cfd4e34 ravb: Fix use-after-free issue in ravb_tx_timeout_work()
    de6e271338c1 powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
    85ae11da8504 powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
    077fdae908e2 dmaengine: mediatek: Fix deadlock caused by synchronize_irq()
    6ea15d9f7ac2 x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs
    e7ca00f35d8a usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
    1e4414c3870e usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
    2a433d325563 pinctrl: avoid unsafe code pattern in find_pinctrl()
    d5b11bd89377 cgroup: Remove duplicates in cgroup v1 tasks file
    1e59ebed9cf3 Input: xpad - add PXN V900 support
    8664fa7fbbbf Input: psmouse - fix fast_reconnect function for PS/2 mode
    5aa514100aaf Input: powermate - fix use-after-free in powermate_config_complete
    3cdce751b026 ceph: fix incorrect revoked caps assert in ceph_fill_file_size()
    92cd1635c685 libceph: use kernel_connect()
    5704225cdd87 mcb: remove is_added flag from mcb_device struct
    2bf6c93e17c4 iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
    84af249e48c5 iio: pressure: dps310: Adjust Timeout Settings
    00cd9d9c12f4 iio: pressure: bmp280: Fix NULL pointer exception
    f4c11b2ea0f9 usb: musb: Modify the "HWVers" register address
    fc1ecea726ec usb: musb: Get the musb_qh poniter after musb_giveback
    c0fb0419c1ad usb: dwc3: Soft reset phy on probe for host
    7efac5b4c209 net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read
    57942b0763cf usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
    e39710084664 dmaengine: stm32-mdma: abort resume if no ongoing transfer
    3345799c4f2e workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()
    95733ea130e3 nfc: nci: assert requested protocol is valid
    7adcf014bda1 net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
    22ca282ea00b ixgbe: fix crash with empty VF macvlan list
    0cc6c070d926 drm/vmwgfx: fix typo of sizeof argument
    80a3c0068471 xen-netback: use default TX queue size for vifs
    332587dc7fed mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type
    85c2857ef900 ieee802154: ca8210: Fix a potential UAF in ca8210_probe
    daff72af3ff1 ravb: Fix up dma_free_coherent() call in ravb_remove()
    d3d2aecc1ffe drm/msm/dsi: skip the wait for video mode done if not applicable
    a0c24f802da7 drm: etvnaviv: fix bad backport leading to warning
    907a380eb3a1 net: prevent address rewrite in kernel_bind()
    061a18239ced quota: Fix slow quotaoff
    cd0e2bf7fb22 HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect
    8e39b5fb834f pwm: hibvt: Explicitly set .polarity in .get_state()
    c4eff809d622 lib/test_meminit: fix off-by-one error in test_pages()
    ffdd8f56a46b RDMA/cxgb4: Check skb value for failure to allocate

(From OE-Core rev: c25c484eb696b8859c7183f1b26a30a1172d56ac)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Bruce Ashfield
fd1ba91818 linux-yocto/5.4: update to v5.4.258
Updating  to the latest korg -stable release that comprises
the following commits:

    02f78c59a0ed Linux 5.4.258
    f70c285cf02c xen/events: replace evtchn_rwlock with RCU
    e2614ab16a7e ima: rework CONFIG_IMA dependency block
    b5c3bc4b8104 NFS: Fix a race in __nfs_list_for_each_server()
    f0ea421fa2f7 parisc: Restore __ldcw_align for PA-RISC 2.0 processors
    14e5d94d5c86 RDMA/mlx5: Fix NULL string error
    6e26812e289b RDMA/siw: Fix connection failure handling
    8ab1fb16dce0 RDMA/uverbs: Fix typo of sizeof argument
    26d48f7090b8 RDMA/cma: Fix truncation compilation warning in make_cma_ports
    f102dd8a1795 gpio: pxa: disable pinctrl calls for MMP_GPIO
    e38aceeadb4b gpio: aspeed: fix the GPIO number passed to pinctrl_gpio_set_config()
    8584ee20a56c IB/mlx4: Fix the size of a buffer in add_port_entries()
    35b689ee4b57 RDMA/core: Require admin capabilities to set system parameters
    1047ca5bae20 cpupower: add Makefile dependencies for install targets
    3c2f536c3d32 sctp: update hb timer immediately after users change hb_interval
    caf0c61f14e7 sctp: update transport state when processing a dupcook packet
    14fc22c92937 tcp: fix delayed ACKs for MSS boundary condition
    2791d64e6607 tcp: fix quick-ack counting to count actual ACKs of new data
    7fbce1e46b41 net: stmmac: dwmac-stm32: fix resume on STM32 MCU
    f110aa377ddc netfilter: handle the connecting collision properly in nf_conntrack_proto_sctp
    191d87a19cf1 net: nfc: llcp: Add lock when modifying device list
    310f1c92f65a net: usb: smsc75xx: Fix uninit-value access in __smsc75xx_read_reg
    899205521005 net: dsa: mv88e6xxx: Avoid EEPROM timeout when EEPROM is absent
    1fc793d68d50 ipv4, ipv6: Fix handling of transhdrlen in __ip{,6}_append_data()
    95eabb075a59 net: fix possible store tearing in neigh_periodic_work()
    10a301c83a3d modpost: add missing else to the "of" check
    5e1c1bf53e5f NFSv4: Fix a nfs4_state_manager() race
    f90821f66727 NFS: Add a helper nfs_client_for_each_server()
    e2d4fc53e9f7 NFS4: Trace state recovery operation
    c87f66c43c1b scsi: target: core: Fix deadlock due to recursive locking
    8a1fa738b491 ima: Finish deprecation of IMA_TRUSTED_KEYRING Kconfig
    442e50393a29 regmap: rbtree: Fix wrong register marked as in-cache when creating new node
    52008a5e22ac wifi: mt76: mt76x02: fix MT76x0 external LNA gain handling
    31b27776905a drivers/net: process the result of hdlc_open() and add call of hdlc_close() in uhdlc_close()
    b8e260654a29 wifi: mwifiex: Fix oob check condition in mwifiex_process_rx_packet
    1b67be400a96 wifi: iwlwifi: dbg_ini: fix structure packing
    c6d358387632 ubi: Refuse attaching if mtd's erasesize is 0
    b4ec10b962f7 net: prevent rewrite of msg_name in sock_sendmsg()
    53b700b41a06 net: replace calls to sock->ops->connect() with kernel_connect()
    3c4bfa7a56c8 wifi: mwifiex: Fix tlv_buf_left calculation
    2e608cede0ae qed/red_ll2: Fix undefined behavior bug in struct qed_ll2_info
    810248a12999 scsi: zfcp: Fix a double put in zfcp_port_enqueue()
    e60272ab021c Revert "PCI: qcom: Disable write access to read only registers for IP v2.3.3"
    6e37de4a1407 rbd: take header_rwsem in rbd_dev_refresh() only when updating
    bc2a3044015f rbd: decouple parent info read-in from updating rbd_dev
    2e0114edeb47 rbd: decouple header read-in from updating rbd_dev->header
    32a59639c551 rbd: move rbd_dev_refresh() definition
    ff10b1fad581 fs: binfmt_elf_efpic: fix personality for ELF-FDPIC
    43e5dc1ee2ea ata: libata-sata: increase PMP SRST timeout to 10s
    ac1aebd4e3b8 ata: libata-core: Do not register PM operations for SAS ports
    9313aab5f649 ata: libata-core: Fix port and device removal
    9207666f166c ata: libata-core: Fix ata_port_request_pm() locking
    d9483f5aecf4 net: thunderbolt: Fix TCPv6 GSO checksum calculation
    47062af85961 btrfs: properly report 0 avail for very full file systems
    cf221a7880ea ring-buffer: Update "shortest_full" in polling
    ec7b2e7b365c i2c: i801: unregister tco_pdev in i801_probe() error path
    a4ecd8562c0e ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
    ec1df5d37d59 ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q
    193b5a1c6c67 nilfs2: fix potential use after free in nilfs_gccache_submit_read_data()
    bf3c728e3692 serial: 8250_port: Check IRQ data before use
    76ffbd900b6a Smack:- Use overlay inode label in smack_inode_copy_up()
    957a9916db5b smack: Retrieve transmuting information in smack_inode_getsecurity()
    c9ce9bab2301 smack: Record transmuting in smk_transmuted
    d037d8964fb8 i40e: fix return of uninitialized aq_ret in i40e_set_vsi_promisc
    2d78e2d3e31f i40e: always propagate error value in i40e_set_vsi_promisc()
    8ed4b5d710b0 i40e: improve locking of mac_filter_hash
    30055e020ab2 watchdog: iTCO_wdt: Set NO_REBOOT if the watchdog is not already running
    c54a392fc79e watchdog: iTCO_wdt: No need to stop the timer in probe
    d68c61092c3d nvme-pci: do not set the NUMA node of device if it has none
    283f24df8303 fbdev/sh7760fb: Depend on FB=y
    ee1f5c63e919 ncsi: Propagate carrier gain/loss events to the NCSI controller
    b42eac146247 powerpc/watchpoints: Annotate atomic context in more places
    723904ce853e bpf: Clarify error expectations from bpf_clone_redirect
    db4afbc6c1a1 spi: nxp-fspi: reset the FLSHxCR1 registers
    3502dd803138 ata: libata-eh: do not clear ATA_PFLAG_EH_PENDING in ata_eh_reset()
    05264d6551e1 ring-buffer: Avoid softlockup in ring_buffer_resize()
    1d28224d49f3 selftests/ftrace: Correctly enable event in instance-event.tc
    ded3551163fc parisc: irq: Make irq_stack_union static to avoid sparse warning
    a721e5788aca parisc: drivers: Fix sparse warning
    2569e0ceff8a parisc: iosapic.c: Fix sparse warnings
    f1a0dd9243f0 parisc: sba: Fix compile warning wrt list of SBA devices
    6db9cdfdc3c5 gpio: pmic-eic-sprd: Add can_sleep flag for PMIC EIC chip
    4a62d23eba66 xtensa: boot/lib: fix function prototypes
    e11fa78a3722 xtensa: boot: don't add include-dirs
    5ed83a0a3953 xtensa: iss/network: make functions static
    b821e6a8b2f5 xtensa: add default definition for XCHAL_HAVE_DIV32
    49dc6fcd4b6a bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart wake-up
    841733189b2e ARM: dts: ti: omap: motorola-mapphone: Fix abe_clkctrl warning on boot
    3468fa39d898 clk: tegra: fix error return case for recalc_rate
    6938a6cbe651 MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled
    5b0d13e2d9f6 ata: libata: disallow dev-initiated LPM transitions to unsupported states
    617a89ff55e3 drm/amd/display: prevent potential division by zero errors
    07b63a3dcfef drm/amd/display: Fix LFC multiplier changing erratically
    11e3f781f6e3 drm/amd/display: Reinstate LFC optimization
    a4628a5b98e4 scsi: qla2xxx: Fix deletion race condition
    0a51c838c58f scsi: qla2xxx: Fix update_fcport for current_topology
    ecdf4c658b6e Input: i8042 - add quirk for TUXEDO Gemini 17 Gen1/Clevo PD70PN
    0926a2b7cb60 i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()
    e09db461f258 gpio: tb10x: Fix an error handling path in tb10x_gpio_probe()
    02a233986c9e netfilter: ipset: Fix race between IPSET_CMD_CREATE and IPSET_CMD_SWAP
    812da2a08dc5 net: rds: Fix possible NULL-pointer dereference
    c5f6478686bb team: fix null-ptr-deref when team device type is changed
    ad8d39c7b437 net: bridge: use DEV_STATS_INC()
    121a7c474ce0 net: hns3: add 5ms delay before clear firmware reset irq source
    a6f4d582e25d dccp: fix dccp_v4_err()/dccp_v6_err() again
    16b88d7a1436 powerpc/perf/hv-24x7: Update domain value check
    810fd23d9715 ipv4: fix null-deref in ipv4_link_failure
    8f228c326d68 i40e: Fix VF VLAN offloading when port VLAN is configured
    8b835db2793a i40e: Fix warning message and call stack during rmmod i40e driver
    9cbec71a5721 i40e: Remove scheduling while atomic possibility
    0988fc499f67 i40e: Fix for persistent lldp support
    09475d647670 ASoC: imx-audmix: Fix return error with devm_clk_get()
    ca1d4e3c4dba selftests: tls: swap the TX and RX sockets in some tests
    b9eb384fd4fd selftests/tls: Add {} to avoid static checker warning
    40e34ea01748 bpf: Avoid deadlock when using queue and stack maps from NMI
    eec981349b03 netfilter: nf_tables: disallow element removal on anonymous sets
    d2a6844be5bd ASoC: meson: spdifin: start hw on dai probe
    0c908e159588 ext4: do not let fstrim block system suspend
    4db34feaf297 ext4: move setting of trimmed bit into ext4_try_to_trim_range()
    767a50bef2aa ext4: replace the traditional ternary conditional operator with with max()/min()
    2fd502f53bf4 ext4: mark group as trimmed only if it was fully scanned
    635901bdbd7e ext4: change s_last_trim_minblks type to unsigned long
    2d874151584d ext4: scope ret locally in ext4_try_to_trim_range()
    c71cb46affe9 ext4: add new helper interface ext4_try_to_trim_range()
    b0dcbd4bb957 ext4: remove the 'group' parameter of ext4_trim_extent
    bf0660756510 ata: libahci: clear pending interrupt status
    e6807c873d87 tracing: Increase trace array ref count on enable and filter files
    7d3f6612e90b SUNRPC: Mark the cred for revalidation if the server rejects it
    321c75b01cc8 NFS/pNFS: Report EINVAL errors from connect() to the server

(From OE-Core rev: 013883aef0e9bfc6817ae1e5c5d1f1abafdf4cd0)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Tim Orling
2b4a973db3 vim: upgrade 9.0.2068 -> 9.0.2130
https://github.com/vim/vim/compare/v9.0.2068...v9.0.2130

CVE: CVE-2023-48231
CVE: CVE-2023-48232
CVE: CVE-2023-48233
CVE: CVE-2023-48234
CVE: CVE-2023-48235
CVE: CVE-2023-48236
CVE: CVE-2023-48237

(From OE-Core rev: 6baa307e0445bef8993b50cf45eeeeb1c2c3529d)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 5978d565a9e700485fc563dfe2e3c0045dd74b59)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Lee Chee Yang
45845f8056 qemu: ignore CVE-2021-20295 CVE-2023-2680
Ignore RHEL specific CVE-2021-20295 CVE-2023-2680.

(From OE-Core rev: 2c0822d9e7b8e7d013ef89c7e82e19fff39228a9)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Lee Chee Yang
d0120e8aec epiphany: fix CVE-2022-29536
(From OE-Core rev: 507b9de9df375721cd307163fe06c3ee567385e8)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Vivek Kumbhar
97b8007eff libsndfile: fix CVE-2022-33065 Signed integer overflow in src/mat4.c
(From OE-Core rev: f9cc32ed3c67c8fe60debbc23b579e120038b2e9)

Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Ashish Sharma
59f99476d8 mdadm: Backport fix for CVE-2023-28938
Upstream-Status: Backport from [https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/patch/?id=7d374a1869d3a84971d027a7f4233878c8f25a62]
CVE: CVE-2023-28938
(From OE-Core rev: 8cf02e6b60e2916b9e4832590257d5d184258e9c)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
poojitha adireddy
7f8394e2b1 binutils: Mark CVE-2022-47696 as patched
CVE-2022-47696 and CVE-2023-25588 are representing similar kind
of vulnerability.

Reference:
https://ubuntu.com/security/CVE-2022-47696
https://sourceware.org/bugzilla/show_bug.cgi?id=29677

(From OE-Core rev: a2af1a2b05e3046995f48e4d823c9dfc97b95529)

Signed-off-by: poojitha adireddy <pooadire@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
poojitha adireddy
24fe566155 binutils 2.34: Fix CVE-2021-46174
Upstream Repository: https://sourceware.org/git/binutils-gdb.git

Bug Details: https://nvd.nist.gov/vuln/detail/CVE-2021-46174
Type: Security Fix
CVE: CVE-2021-46174
Score: 7.5
Patch: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cad4d6b91e97

(From OE-Core rev: 94f2468de191f8c1dd236efb91f3094a76ddffc9)

Signed-off-by: poojitha adireddy <pooadire@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-08 11:45:59 -10:00
Steve Sakoman
b8f1972b84 vim: use upstream generated .po files
A previous commit attempted to fix reproducibility errors by forcing
regeneration of .po files. Unfortunately this triggered a different
type of reproducibility issue.

Work around this by adjusting the timestamps of the troublesome .po
files so they are not regenerated and we use the shipped upstream
versions of the files.

The shipped version of ru.cp1251.po doesn't seem to have been created
with the vim tooling and specifies CP1251 instead of cp1251, fix that.

(From OE-Core rev: 0764da7e3f1d71eb390e5eb8a9aa1323c24d1c19)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Archana Polampalli
75bc08971b vim: Upgrade 9.0.2048 -> 9.0.2068
This includes CVE fix for CVE-2023-46246.
9198c1f2b (tag: v9.0.2068) patch 9.0.2068: [security] overflow in :history

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

(From OE-Core rev: 2854c285ebf615ea71ecfc6fc559419e72005c5e)

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Etienne Cordonnier
c86e8fe287 vim: update obsolete comment
vim 8.3 has been out for a long time, so this comment is obsolete.
However we still need UPSTREAM_VERSION_UNKNOWN, since we ignore
the last digit of the upstream version number.

Test result:
$ devtool check-upgrade-status vim
  ...
  INFO: vim                       9.0.1592        UNKNOWN         Tom Rini <trini@konsulko.com> c0370529c027abc5b1698d53fcfb8c02a0c515da

(From OE-Core rev: 65f5de85c3f488136d1ec2b1f7fe8d8426d6c5b3)

(From OE-Core rev: be68cf4c3e4218cc360ce7a645c92b631224ce94)

Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 868a19357841470eb55fb7f1c4ab1af09dea99ed)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Richard Purdie
3afde32bfa vim: Improve locale handling
When making checkouts from git, the timestamps can vary and occasionally two files
can end up with the same stamp. This triggers make to regenerate ru.cp1251.po from
ru.po for example. If it isn't regenerated, the output isn't quite the same leading
to reproducibility issues (CP1251 vs cp1251).

Since we added all locales to buildtools tarball now, we can drop the locale
restrictions too. We need to generate a native binary for the sjis conversion
tool so also tweak that.

(From OE-Core rev: 14982eabcdb96c2f7ef9e28d6c0daedb53aa96c4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Vijay Anusuri
0efbcefe73 tiff: backport Debian patch to fix CVE-2022-40090
import patch from ubuntu to fix
 CVE-2022-40090

Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/tiff/tree/debian/patches?h=ubuntu/focal-security
Upstream commit
c7caec9a4d]

(From OE-Core rev: 999af9858676a0f5112ef3a9d9156be349f90cb4)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Hitendra Prajapati
c64835823a grub: fix CVE-2023-4692 & CVE-2023-4693
Upstream-Status: Backport from https://git.savannah.gnu.org/cgit/grub.git/commit/?id=43651027d24e62a7a463254165e1e46e42aecdea && https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=0ed2458cc4eff6d9a9199527e2a0b6d445802f94

(From OE-Core rev: f461056d88db0eae5573a0c0ad23c408cff80bd8)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Vijay Anusuri
716693cccc avahi: backport Debian patches to fix multiple CVE's
import patches from ubuntu to fix
 CVE-2023-1981
 CVE-2023-38469
 CVE-2023-38470
 CVE-2023-38471
 CVE-2023-38472
 CVE-2023-38473

Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches?h=ubuntu/focal-security
Upstream commit
a2696da2f2
&
a337a1ba7d
&
c6cab87df2
&
94cb648911
&
20dec84b24
&
894f085f40
&
b675f70739
&
b024ae5749
&
b448c9f771]

(From OE-Core rev: 4771e335cd4d95e734d7f07a718319f4543ce2f1)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Vijay Anusuri
8cabed090e bind: Backport fix for CVE-2023-3341
Upstream-Status: Backport [c4fac5ca98]

(From OE-Core rev: e0fbe202981c9074547881dbeb7eb58670808fc3)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:19 -10:00
Lee Chee Yang
be8b0f8178 curl: fix CVE-2023-28321 CVE-2023-28322
import patch from ubuntu curl_7.68.0-1ubuntu2.20.

minor change to CVE-2023-28321.patch tests/data/test1397 part
so the patch can be apply.

(From OE-Core rev: 5cc1f487928df04c58709dd88ef6c17c171da7a5)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:18 -10:00
Vijay Anusuri
7c678246f6 shadow: backport patch to fix CVE-2023-29383
The fix of CVE-2023-29383.patch contains a bug that it rejects all
characters that are not control ones, so backup another patch named
"0001-Overhaul-valid_field.patch" from upstream to fix it.

(From OE-Core rev: ab48ab23de6f6bb1f05689c97724140d4bef8faa)

Upstream-Status: Backport
[e5905c4b84
&
2eaea70111]

(From OE-Core rev: a53d446c289f07854e286479cd7e4843ddd0ee8c)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:18 -10:00
Lee Chee Yang
d3f1ae99a7 python3-setuptools: fix CVE-2022-40897
import patch from ubuntu setuptools_45.2.0-1ubuntu0.1 .

(From OE-Core rev: a939696d7c70c42e404ec30a9d75e5ea4f742c78)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:18 -10:00
Lee Chee Yang
d843ae7d5d wayland: fix CVE-2021-3782
take CVE-2021-3782.patch from OE-core rev 09b8ff8d2361b2db001bc963f481db294ccf2170.

(From OE-Core rev: 9c3f494bf54c4d4b7ec776ab18d900bf9fbd042a)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:18 -10:00
Vijay Anusuri
63909c1cc6 libx11: Fix for CVE-2023-43785 CVE-2023-43786 and CVE-2023-43787
import patches from ubuntu to fix
 CVE-2023-43785
 CVE-2023-43786
 CVE-2023-43787

Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/libx11/tree/debian/patches?h=ubuntu/focal-security
Upstream commit
6858d468d9
&
204c3393c4
&
73a37d5f2f
&
b4031fc023
&
7916869d16]

Reference: https://launchpad.net/ubuntu/+source/libx11/2:1.6.9-2ubuntu1.6

(From OE-Core rev: 0ebeabda9096b44ead2293356c5947367c6042fe)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-12-01 04:14:18 -10:00
Steve Sakoman
4553984904 selftest: skip virgl test on all fedora
This test will fail any time the host has libdrm > 2.4.107

(From OE-Core rev: ff7dbcc0206203e2ece68ca91a37050a4bc822a2)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Steve Sakoman
1149fde2f4 lz4: Update sstate/equiv versions to clean cache
There are cached reproducibility issues on the autobuilder due to CFLAGS
issues, flush the bad data out the system by bumping the versions.

(From OE-Core rev: f398c84405913bd8038c007f43f991f54d136571)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Mikko Rapeli
cdc9522ede lz4: use CFLAGS from bitbake
Currently lz4 uses it's own defaults which include O3 optimization.
Switch from O3 to bitbake default O2 reduces binary package size
from 467056 to 331888 bytes. Enables also building with Os if needed.

(From OE-Core rev: af571c0841265dfa4bd87546080e499336a37fcc)

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit abaaf8c6bcd368728d298937a9406eb2aebc7a7d)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Naveen Saini
800272477a resolvconf: Fix fetch error
Branch 'master' renamed to 'unstable', which causing following failure.

Error:
Fetcher failure: Unable to find revision cb19bbfbe7e52174332f68bf2f295b39d119fad3 in branch master even from upstream

Switch to 'unstanble' branch.

(From OE-Core rev: d4b96dc1e457b4e68c5bad685ffcfd2f250162e7)

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Naveen Saini
6fd1064e82 assimp: Explicitly use nobranch=1 in SRC_URI
Branch 'assimp_5.0_release' is not present in repo.

Error:
assimp-5.0.1-r0 do_fetch: Fetcher failure: Unable to find revision 8f0c6b04b2257a520aaab38421b2e090204b69df in branch assimp_5.0_release even from upstream

Set nobranch=1, to fetch from v5.0.1 tag.

(From OE-Core rev: 4bd92b9621909b8b528b648529baaaa48bc1c424)

Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Ross Burton
76fb1012eb cve-check: don't warn if a patch is remote
We don't make do_cve_check depend on do_unpack because that would be a
waste of time 99% of the time.  The compromise here is that we can't
scan remote patches for issues, but this isn't a problem so downgrade
the warning to a note.

Also move the check for CVEs in the filename before the local file check
so that even with remote patches, we still check for CVE references in
the name.

(From OE-Core rev: 32a19dfbaac38cd4864281a1131ac65e1216318f)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0251cad677579f5b4dcc25fa2f8552c6040ac2cf)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Ross Burton
1b7c8a3e7e cve-check: slightly more verbose warning when adding the same package twice
Occasionally the cve-check tool will warn that it is adding the same
package twice.  Knowing what this package is might be the first step
towards understanding where this message comes from.

(From OE-Core rev: e3574760ee59c1ca7d2698f09ddd37ee568f04f3)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c1179faec8583a8b7df192cf1cbf221f0e3001fc)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Ross Burton
38c0d384bd cve-check: sort the package list in the JSON report
The JSON report generated by the cve-check class is basically a huge
list of packages.  This list of packages is, however, unsorted.

To make things easier for people comparing the JSON, or more
specifically for git when archiving the JSON over time in a git
repository, we can sort the list by package name.

(From OE-Core rev: 5a509bc6f26247cc7561189d582c91816042fd91)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e9861be0e5020830c2ecc24fd091f4f5b05da036)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Vijay Anusuri
01cabaea04 xserver-xorg: Fix for CVE-2023-5367 and CVE-2023-5380
Upstream-Status: Backport
[541ab2ecd4
&
564ccf2ce9]

(From OE-Core rev: 41b87e7493f7b50ba0ddad941d37ef4a24a749d8)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Steve Sakoman
72c7bacfd3 Revert "qemu: Backport fix for CVE-2023-0330"
This reverts commit 45ce9885351a2344737170e6e810dc67ab3e7ea9.

Unfortunately this backport results in qemuarmv5 failing to boot with
a qemu lsi hw error.

[YOCTO #15274]

See discussion: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15274

(From OE-Core rev: 14aa11aecf503cef08e43c90cf0bd574721ca965)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Ashish Sharma
8a8d40420f zlib: Backport fix for CVE-2023-45853
Upstream-Status: Backport from [73331a6a04]

(From OE-Core rev: bbe5e13c2ff981d7defd14f9e2d91ebbe107bb4b)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Soumya Sambu
a405e12beb libwebp: Fix CVE-2023-4863
Heap buffer overflow in WebP in Google Chrome prior to 116.0.5845.187
allowed a remote attacker to perform an out of bounds memory write via
a crafted HTML page.

Removed CVE-2023-5129.patch as CVE-2023-5129 is duplicate of CVE-2023-4863.

CVE: CVE-2023-4863

References:
https://nvd.nist.gov/vuln/detail/CVE-2023-4863
https://security-tracker.debian.org/tracker/CVE-2023-4863
https://bugzilla.redhat.com/show_bug.cgi?id=2238431#c12

(From OE-Core rev: b69bef1169cb33c153384be81845eaf903dc1570)

Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Peter Marko
be04eefcaf glibc: ignore CVE-2023-4527
This vulnerability was introduced in 2.36, so 2.31 is not vulnerable.

(From OE-Core rev: 3471922461627c0f0487feb09cfdc4cfeeb3f3ca)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Vijay Anusuri
77214fc5d4 tiff: backport Debian patch to fix CVE-2023-41175
Upstream-Status: Backport [import from debian security.debian.org/debian-security/pool/updates/main/t/tiff/tiff_4.1.0+git191117-2~deb10u8.debian.tar.xz
Upstream commit 6e2dac5f90]

Reference: https://security-tracker.debian.org/tracker/CVE-2023-41175

(From OE-Core rev: ef66190f834fde453af431cc2aadebac82b7e5b5)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Hitendra Prajapati
cd9a699320 tiff: Security fix for CVE-2023-40745
Upstream-Status: Backport from 4fc16f649f

(From OE-Core rev: d282b85cf69ecfbce12224428c713cd0dc639ced)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Vijay Anusuri
5e9e6627ac tiff: CVE patch correction for CVE-2023-3576
- The commit [881a070194]
fixes CVE-2023-3576
- Hence, renamed the CVE-2023-3618-1.patch to CVE-2023-3576.patch
- Reference: https://security-tracker.debian.org/tracker/CVE-2023-3576
             https://security-tracker.debian.org/tracker/CVE-2023-3618

(From OE-Core rev: 56088368bdd22a939b813c7aefd5ba475c6d4021)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Lee Chee Yang
facedadb5c kexec-tools: Ignore Fedora/RedHat specific CVE-2021-20269
(From OE-Core rev: d34567be6e87afdec55973f8f75be8d44b4acd1b)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-17 06:00:32 -10:00
Samantha Jalabert
e66a386604 bitbake: Fix disk space monitoring on cephfs
Error occured while running bitbake on cephfs:

WARNING: The free inode of path is running low (-0.001K left)
ERROR: Immediately halt since the disk space monitor action is "HALT"!

(Bitbake rev: 3c7b210e9599058a48d0c38ce8034b94e2d0f781)

Signed-off-by: Samantha Jalabert <samantha.jalabert@syslinbit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-11-09 04:38:54 -10:00
Steve Sakoman
aeac103466 build-appliance-image: Update to dunfell head revision
(From OE-Core rev: 0dbf3a15321b8033ff8ed86c6aa261fdb9c3d5bb)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:24:08 -10:00
Steve Sakoman
9a045bde41 poky.conf: bump version for 3.1.29
(From meta-yocto rev: ca9b97e06e2632b2a04002eb9bb06cd6a2c656c6)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:20 -10:00
Steve Sakoman
6ebec3f39b documentation: update for 3.1.29
(From yocto-docs rev: 4cb67f0f3c3e792b5925d9d3a7002a776e5c85e8)

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-10-27 04:21:20 -10:00
Steve Sakoman
9f0c1bc687 cve-exclusion_5.4.inc: update for 5.4.257
(From OE-Core rev: 0f75737a408aef19937ee023a5e6b3e881cbd99b)

Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:20 -10:00
Steve Sakoman
1d15d166d0 patch.py: Use shlex instead of deprecated pipe
The pipe library is deprecated in Python 3.11 and will be removed in
Python 3.13.  pipe.quote is just an import of shlex.quote anyway.

Clean up imports while we're at it.

(From OE-Core rev: a6ef13bdad40826d76a3331cd0878bb22510f375)

Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
(cherry picked from commit 5f33c7b99a991c380d1813da8248ba5470ca4d4e)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:19 -10:00
Richard Purdie
5c342965c4 resulttool/report: Avoid divide by zero
Avoid a divide by zero traceback if unfortunate test counts are encountered.

(From OE-Core rev: 33d3374a7149ad1afe86d86c0dc2a948f70e26bd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit c5aeea53dfacb53dedb8445cb3523dc3a8cb6dca)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:19 -10:00
Meenali Gupta
6f375f52f5 linux-firmware: upgrade 20230625 -> 20230804
License-Update: additional firmwares

upgrade include fix for CVE-2023-20569 CVE-2022-40982 CVE-2023-20593

Changelog:
      https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

References:
      https://nvd.nist.gov/vuln/detail/CVE-2023-20569
      https://nvd.nist.gov/vuln/detail/CVE-2022-40982
      https://nvd.nist.gov/vuln/detail/CVE-2023-20593

(From OE-Core rev: 42d08fdcd3c95dbef795bb74f0ff5db8ff1b0a19)

Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
(cherry picked from commit d3f1448246c9711f4f23f2e12c664e0ba3ae3f02)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:19 -10:00
Siddharth Doshi
52250009cd vim: Upgrade 9.0.2009 -> 9.0.2048
This includes CVE fix for CVE-2023-5535.

(From OE-Core rev: 35fc341402f38619922dcfc4dc9e58b00be26259)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:19 -10:00
Ashish Sharma
6f56a14cdc binutils: Backport fix CVE-2023-25588
Upstream-Status: Backport from [https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=d12f8998d2d086f0a6606589e5aedb7147e6f2f1]
CVE: CVE-2023-25588
(From OE-Core rev: 6ffbb78f63e5adaadfaa9f5d5e9871ce3cfe7abf)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-27 04:21:19 -10:00
Richard Purdie
f1cf9f0f12 SECURITY.md: Add file
Add a SECURITY.md file with hints for security researchers and other
parties who might report potential security vulnerabilities.

(From meta-yocto rev: d8b84cfded9137a74ab0052ff2d7710887f29f10)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-24 05:22:46 -10:00
Marta Rybczynska
0d5e538519 bitbake: SECURITY.md: add file
Add a SECURITY.md file with hints for security researchers and other
parties who might report potential security vulnerabilities.

(Bitbake rev: dd826595414c5dc1a649f45a9dd2430bf6d4699b)

Signed-off-by: Marta Rybczynska <marta.rybczynska@syslinbit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-24 05:22:46 -10:00
Marek Vasut
374e198436 systemd: Backport systemd-resolved: use hostname for certificate validation in DoT
Widely accepted certificates for IP addresses are expensive and only
affordable for larger organizations. Therefore if the user provides
the hostname in the DNS= option, we should use it instead of the IP
address.

This fixes https://nvd.nist.gov/vuln/detail/CVE-2018-21029 per
suggestion https://github.com/systemd/systemd-stable/issues/72 .

CVE: CVE-2018-21029
(From OE-Core rev: 6b4a583169ae40a8d51e7ffa33785409b5111a81)

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:31 -10:00
Ryan Eatmon
42c52c4f24 kernel.bbclass: Add force flag to rm calls
The latest 6.5 kernels do not appear to create the source file in
${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source so the
recipe errors out when trying to remove it.  Simple fix is to add the
-f (force) flag to the call.

(From OE-Core rev: 2e669bf797b15d803e7d6a700e449bdc467a4bcc)

(From OE-Core rev: 844faa7c51ae8ec0966e9c5c3f70a1dbf2222c21)

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>

Backported from kirkstone commit 7e177848f97e.
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:31 -10:00
Siddharth Doshi
1a3807e0ca libxpm: upgrade to 3.5.17
- This upgrade includes multiple security fixes.
CVE-2022-4883
CVE-2022-44617
CVE-2022-46285
CVE-2022-44617
CVE-2023-43788
CVE-2023-43789

- Removed CVE-2022-46285 as it is already fixed by this upgrade.

- License-update: additional copyright holders
f0857c0 man pages: Correct Copyright/License notices
Due to this commit LIC_FILES_CHKSUM is changed

- Disable reading compressed files as that requires compress/uncompress executables.
Following the approach in oe-core/master:
7de4084634 libxpm: upgrade 3.5.14 -> 3.5.15

- Add XORG_EXT to specify tar.xz as upstream has switched from bz2 to xz compression.

(From OE-Core rev: 47e270a4fd2e086b5ee9f38891f326ce505f2319)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Siddharth Doshi
c7ddb9b198 xorg-lib-common: Add variable to set tarball type
Upstream has switched some new releases from bz2 to xz compression. Add
an XORG_EXT variable so recipes can set the file name extension needed
for the compression type.

Following the approach in oe-core/master: 6a8068e036b4b2a40b38896275b936916b4db76e
xorg-lib-common: Add variable to set tarball type use a variable for the tarball suffix/compression format.

(From OE-Core rev: ff386fb5632c26ceb12d2381e9128b0546aef795)

Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Siddharth Doshi
ffbede6d58 vim: Upgrade 9.0.1894 -> 9.0.2009
This includes CVE fix for CVE-2023-5441.

(From OE-Core rev: 624081236d5554dbc7c044396caabc3464b1b3ac)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Pawan
2f34ea89db libwebp: Update CVE ID CVE-2023-4863
Notice that it references different CVE id:
https://nvd.nist.gov/vuln/detail/CVE-2023-5129
which was marked as a rejected duplicate of:
https://nvd.nist.gov/vuln/detail/CVE-2023-4863
but it's the same issue. Hence update CVE ID CVE-2023-4863
to CVE-2023-5129.patch.

(From OE-Core rev: 7dce529515baa843ba3e5c89b2ad605b9845c59b)

Signed-off-by: Pawan <badganchipv@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Siddharth Doshi
aa99487732 glib-2.0: Fix multiple vulnerabilities
CVE's Fixed:
CVE-2023-29499: glib: GVariant offset table entry size is not checked in is_normal()
CVE-2023-32611: glib: g_variant_byteswap() can take a long time with some non-normal inputs
CVE-2023-32636: glib: Timeout in fuzz_variant_text
CVE-2023-32643: glib: Heap-buffer-overflow in g_variant_serialised_get_child
CVE-2023-32665: glib: GVariant deserialisation does not match spec for non-normal data

(From OE-Core rev: b576beba80d44e67762d46bf3bc2f14c05bc0f6b)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Mike Crowe
8ae21cd487 curl: Backport fix for CVE-2023-38546
Take patch from Debian 7.64.0-4+deb10u7.

(From OE-Core rev: 364a9e46f167c2501785cd55a71cf9a614e64710)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
CVE: CVE-2023-38546
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Mike Crowe
5a6d2dc704 curl: Backport fix for CVE-2023-38545
Backporting this change required tweaking the error value since the
two-level CURLE_PROXY error reporting was introduced after curl
7.69.1. The test required some tweaks to not rely on more-recent
improvements to the test infrastructure too.

(From OE-Core rev: ccec26b1437f1ece4cb4f27581b0df904297358f)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
CVE: CVE-2023-38545
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Marek Vasut
f6f3a08371 libtiff: Add fix for tiffcrop CVE-2023-1916
Add fix for tiffcrop tool CVE-2023-1916 [1].

A flaw was found in tiffcrop, a program distributed by the libtiff
package. A specially crafted tiff file can lead to an out-of-bounds
read in the extractImageSection function in tools/tiffcrop.c, resulting
in a denial of service and limited information disclosure. This issue
affects libtiff versions 4.x.

The tool is no longer part of newer libtiff distributions, hence the
fix is rejected by upstream in [2]. The backport is still applicable
to older versions of libtiff, pick the CVE fix from ubuntu 20.04 [3].

[1] https://nvd.nist.gov/vuln/detail/CVE-2023-1916
[2] https://gitlab.com/libtiff/libtiff/-/merge_requests/535
[3] https://packages.ubuntu.com/source/focal-updates/tiff

(From OE-Core rev: 28ad0fdd30f490612aca6cc96ee503e5f92360a8)

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-20 05:35:30 -10:00
Marek Vasut
cd97a607c6 cpio: Replace fix wrong CRC with ASCII CRC for large files with upstream backport
Replace the original "Wrong CRC with ASCII CRC for large files"
patch with upstream backport, and add additional fix on top of
the same problem which upstream detected and fixed.

(From OE-Core rev: 0e167ef0eb7ac62ddb991ce80c27882863d8ee7c)

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Sourav Pramanik
f4cb2f5d52 openssl: Upgrade 1.1.1v -> 1.1.1w
https://www.openssl.org/news/openssl-1.1.1-notes.html

Major changes between OpenSSL 1.1.1v and OpenSSL 1.1.1w [11 Sep 2023]

* Fix POLY1305 MAC implementation corrupting XMM registers on Windows (CVE-2023-4807)

(From OE-Core rev: 79b29a5f77efab978f6a2918d02ee611638aef85)

Signed-off-by: Sourav Kumar Pramanik <pramanik.souravkumar@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Marek Vasut
3ee56c9b97 busybox: Backport CVE-2022-48174 fix
There is a stack overflow vulnerability in ash.c:6030 in busybox before
1.35. In the environment of Internet of Vehicles, this vulnerability can
be executed from command to arbitrary code execution.

https://nvd.nist.gov/vuln/detail/CVE-2022-48174

CVE: CVE-2022-48174
(From OE-Core rev: 634daf953e4bd8c6df3ee341b5e93cc81e1a620d)

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Vijay Anusuri
eebb034b21 ghostscript: Backport fix CVE-2023-43115
In Artifex Ghostscript through 10.01.2, gdevijs.c in GhostPDL can lead to remote
code execution via crafted PostScript documents because they can switch to the
IJS device, or change the IjsServer parameter, after SAFER has been activated.
NOTE: it is a documented risk that the IJS server can be specified on a gs
command line (the IJS device inherently must execute a command to start the IJS server).

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

Upstream commit:
https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=e59216049cac290fb437a04c4f41ea46826cfba5

(From OE-Core rev: a43f7277061ee6c30c42c9318e3e9dd076563f5d)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Shinu Chandran
e4d507b93b libpcre2 : Follow up fix CVE-2022-1586
CVE-2022-1586 was originally fixed by OE commit
https://github.com/openembedded/openembedded-core/commit/7f4daf88b71f
through libpcre2 commit
https://github.com/PCRE2Project/pcre2/commit/50a51cb7e672

The follow up patch is required to resolve a bug in the initial fix[50a51cb7e672]
https://github.com/PCRE2Project/pcre2/commit/d4fa336fbcc3

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2022-1586
https://security-tracker.debian.org/tracker/CVE-2022-1586

(From OE-Core rev: 7e2fe508b456207fd991ece7621ef8ba24b89e59)

Signed-off-by: Shinu Chandran <shinucha@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Hitendra Prajapati
d01194c739 xdg-utils: Fix CVE-2022-4055
Upstream-Status: Backport from f67c4d1f8b

(From OE-Core rev: 22d2c549ba6d8be137d1d290d9a04691ca1858f2)

Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Julian Haller
ee94c92957 dbus: Add missing CVE_PRODUCT
The current dunfell CVE scans report 0 CVEs for our dbus version. This
is not correct, though, as we use the wrong product name to query it.
Fix this to get a proper CVE list.

(From OE-Core rev: 922872c85d417a5a319aa4beef57ffa4d05faf27)

Signed-off-by: Julian Haller <julian.haller@philips.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Julian Haller
5a893c6e96 dbus: Backport fix for CVE-2023-34969
Upstream commit 37a4dc5835

(From OE-Core rev: 42bf7fee204890b15f80bf0749431aefb33efd99)

Signed-off-by: Julian Haller <julian.haller@philips.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Shubham Kulkarni
43ffc2a5e7 go: Update fix for CVE-2023-24538 & CVE-2023-39318
Add missing files in fix for CVE-2023-24538 & CVE-2023-39318

Upstream Link -
CVE-2023-24538: b1e3ecfa06
CVE-2023-39318: 023b542edf

(From OE-Core rev: cc6f7a8e8805058aababb65e10da7ed2e3d77461)

Signed-off-by: Shubham Kulkarni <skulkarni@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Vijay Anusuri
a9d6f0c153 gawk: backport Debian patch to fix CVE-2023-4156
Upstream-Status: Backport
[https://git.launchpad.net/ubuntu/+source/gawk/tree/debian/patches?h=ubuntu/focal-security
&
https://git.savannah.gnu.org/gitweb/?p=gawk.git;a=commitdiff;h=e709eb829448ce040087a3fc5481db6bfcaae212]

(From OE-Core rev: 68412b76948ce185d87fda73ead7b73e5ad6defd)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Vijay Anusuri
e3ae311c5f cups: Backport fix for CVE-2023-32360 and CVE-2023-4504
Upstream commits:
a0c8b9c955
& 2431caddb7

(From OE-Core rev: d14dce8ba2a8b4bf05c7c5ea7292b0c2c327f088)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-13 05:47:07 -10:00
Mike Crowe
278d77034e glibc: Fix CVE-2023-4911 "Looney Tunables"
Take the patch from the source for Debian's glibc 2.31-13+deb11u7
package, the changelog for which starts with:

 glibc (2.31-13+deb11u7) bullseye-security; urgency=medium

   * debian/patches/any/local-CVE-2023-4911.patch: Fix a buffer overflow in the
     dynamic loader's processing of the GLIBC_TUNABLES environment variable
     (CVE-2023-4911).

This addresses the "Looney Tunables" vulnerability described at
https://www.qualys.com/2023/10/03/cve-2023-4911/looney-tunables-local-privilege-escalation-glibc-ld-so.txt

(From OE-Core rev: 9a800a2e2c2b14eab8c1f83cb4ac3b94a70dd23c)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-06 05:41:57 -10:00
Bruce Ashfield
c0535262c8 linux-yocto/5.4: update to v5.4.257
Updating  to the latest korg -stable release that comprises
the following commits:

    a140610d8aff Linux 5.4.257
    42900fd140c8 net/sched: Retire rsvp classifier
    b3637835ac99 drm/amdgpu: fix amdgpu_cs_p1_user_fence
    650ebbba5c15 mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller
    b1ef1f2f3737 ext4: fix rec_len verify error
    e4efb0aaf288 scsi: megaraid_sas: Fix deadlock on firmware crashdump
    44654114fb6f i2c: aspeed: Reset the i2c controller when timeout occurs
    ce47fe53f78b tracefs: Add missing lockdown check to tracefs_create_dir()
    b6c042d4ac6a nfsd: fix change_info in NFSv4 RENAME replies
    952e477f9080 tracing: Have option files inc the trace array ref count
    ff8cf370d359 tracing: Have current_trace inc the trace array ref count
    a70c6e57316b btrfs: fix lockdep splat and potential deadlock after failure running delayed items
    8e8dcc0f1518 attr: block mode changes of symlinks
    a8403f9fd402 md/raid1: fix error: ISO C90 forbids mixed declarations
    349640248b5e selftests: tracing: Fix to unmount tracefs for recovering environment
    5b50c95cf842 btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
    b61aad18b38a btrfs: add a helper to read the superblock metadata_uuid
    bd0fe5489102 btrfs: move btrfs_pinned_by_swapfile prototype into volumes.h
    a04cce3e79c6 perf tools: Add an option to build without libbfd
    f3701ef61fd7 perf jevents: Make build dependency on test JSONs
    a12e9ba7f346 tools features: Add feature test to check if libbfd has buildid support
    964e025ceefd kobject: Add sanity check for kset->kobj.ktype in kset_register()
    545d1070ed7c media: pci: ipu3-cio2: Initialise timing struct to avoid a compiler warning
    44d72e9edd1b serial: cpm_uart: Avoid suspicious locking
    2cbe6a88fbdd scsi: target: iscsi: Fix buffer overflow in lio_target_nacl_info_show()
    9cd6b3802d7c usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc
    abe0cd279aee media: pci: cx23885: replace BUG with error return
    641e60223971 media: tuners: qt1010: replace BUG_ON with a regular error
    991c77fe18c6 media: az6007: Fix null-ptr-deref in az6007_i2c_xfer()
    8dc5b370254a media: anysee: fix null-ptr-deref in anysee_master_xfer
    0c02eb70b1dd media: af9005: Fix null-ptr-deref in af9005_i2c_xfer
    beb9550494e7 media: dw2102: Fix null-ptr-deref in dw2102_i2c_transfer()
    b49c6e5dd236 media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xfer
    7ffe14fce742 powerpc/pseries: fix possible memory leak in ibmebus_bus_init()
    5873df019512 jfs: fix invalid free of JFS_IP(ipimap)->i_imap in diUnmount
    b12ccbfdf653 fs/jfs: prevent double-free in dbUnmount() after failed jfs_remount()
    a7fde3d46ac6 ext2: fix datatype of block number in ext2_xattr_set2()
    25a68f2286be md: raid1: fix potential OOB in raid1_remove_disk()
    77918680ab07 bus: ti-sysc: Configure uart quirks for k3 SoC
    279e32b79d03 drm/exynos: fix a possible null-pointer dereference due to data race in exynos_drm_crtc_atomic_disable()
    3beb97bed860 wifi: mac80211_hwsim: drop short frames
    6773ea9982dc alx: fix OOB-read compiler warning
    fd1a177d2ccb mmc: sdhci-esdhc-imx: improve ESDHC_FLAG_ERR010450
    ff75c853b7db tpm_tis: Resend command to recover from data transfer errors
    61f5453e9706 crypto: lib/mpi - avoid null pointer deref in mpi_cmp_ui()
    d1473fc030d3 wifi: mwifiex: fix fortify warning
    38eb4ef67f60 wifi: ath9k: fix printk specifier
    93f4a0b74413 devlink: remove reload failed checks in params get/set callbacks
    aadb178c5123 hw_breakpoint: fix single-stepping when using bpf_overflow_handler
    cb37e7fa2339 perf/smmuv3: Enable HiSilicon Erratum 162001900 quirk for HIP08/09
    4de282f49135 ACPI: video: Add backlight=native DMI quirk for Lenovo Ideapad Z470
    d0a13c395e22 kernel/fork: beware of __put_task_struct() calling context
    3bf4463e40a1 ACPICA: Add AML_NO_OPERAND_RESOLVE flag to Timer
    117fb80cd1e6 locks: fix KASAN: use-after-free in trace_event_raw_event_filelock_lock
    7afbfde45d66 btrfs: output extra debug info if we failed to find an inline backref
    6079dc77c6f3 autofs: fix memory leak of waitqueues in autofs_catatonic_mode
    8c027a5798f1 parisc: Drop loops_per_jiffy from per_cpu struct
    4316b8294503 drm/amd/display: Fix a bug when searching for insert_above_mpcc
    1ce8362b4ac6 kcm: Fix error handling for SOCK_DGRAM in kcm_sendmsg().
    b5fc6fd660ab ixgbe: fix timestamp configuration code
    f9f3ce7719eb net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict()
    08d36f317c40 platform/mellanox: mlxbf-tmfifo: Drop jumbo frames
    0507815ae94b mlxbf-tmfifo: sparse tags for config access
    7efc9e97f6e2 platform/mellanox: mlxbf-tmfifo: Drop the Rx packet if no more descriptors
    479c71cda14b kcm: Fix memory leak in error path of kcm_sendmsg()
    c565533407cd r8152: check budget for r8152_poll()
    653fbddbdfc6 net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_hwlro_get_fdir_all()
    ba6673824efa net: ethernet: mvpp2_main: fix possible OOB write in mvpp2_ethtool_get_rxnfc()
    5624f26a3574 net: ipv4: fix one memleak in __inet_del_ifa()
    e757ca9c1ca1 clk: imx8mm: Move 1443X/1416X PLL clock structure to common place
    75e0bd976154 ARM: dts: BCM5301X: Extend RAM to full 256MB for Linksys EA6500 V2
    5f71716772b8 usb: typec: bus: verify partner exists in typec_altmode_attention
    14fe0f8627f8 usb: typec: tcpm: Refactor tcpm_handle_vdm_request
    979f8743f373 usb: typec: tcpm: Refactor tcpm_handle_vdm_request payload handling
    6ca8e31480b5 perf tools: Handle old data in PERF_RECORD_ATTR
    dffa46d0ca52 perf hists browser: Fix hierarchy mode header
    6095dd28217e mtd: rawnand: brcmnand: Fix potential false time out warning
    aae45746f4ae mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write
    09417fbf12f8 mtd: rawnand: brcmnand: Fix crash during the panic_write
    aa64f6f0ce7e btrfs: use the correct superblock to compare fsid in btrfs_validate_super
    6eb1fc314ce4 btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
    b0d236e3afac fuse: nlookup missing decrement in fuse_direntplus_link
    0e918d7c00da ata: pata_ftide010: Add missing MODULE_DESCRIPTION
    e03ac1773414 ata: sata_gemini: Add missing MODULE_DESCRIPTION
    118db787bab3 sh: boards: Fix CEU buffer size passed to dma_declare_coherent_memory()
    89099d73b2dd net: hns3: fix the port information display when sfp is absent
    a44602888bbe netfilter: nfnetlink_osf: avoid OOB read
    62c363e6041c ip_tunnels: use DEV_STATS_INC()
    a5dffc12038f idr: fix param name in idr_alloc_cyclic() doc
    6b0cb9c05584 s390/zcrypt: don't leak memory if dev_set_name() fails
    c149b61301fe igb: Change IGB_MIN to allow set rx/tx value between 64 and 80
    4a5defbfe88b igbvf: Change IGBVF_MIN to allow set rx/tx value between 64 and 80
    c805b8741476 igc: Change IGC_MIN to allow set rx/tx value between 64 and 80
    8047a4898498 kcm: Destroy mutex in kcm_exit_net()
    a6d11571b91d net: sched: sch_qfq: Fix UAF in qfq_dequeue()
    f1ba9a03b166 af_unix: Fix data race around sk->sk_err.
    1ffed3ea8750 af_unix: Fix data-races around sk->sk_shutdown.
    5d91b7891f4a af_unix: Fix data-race around unix_tot_inflight.
    adcf4e069358 af_unix: Fix data-races around user->unix_inflight.
    e13db62db9ef net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr
    23b4b1a069e9 veth: Fixing transmit return status for dropped packets
    0133bc289720 igb: disable virtualization features on 82580
    41f10a4d78fe net: read sk->sk_family once in sk_mc_loop()
    cd12efc54ff8 ipv4: annotate data-races around fi->fib_dead
    01585fa32650 sctp: annotate data-races around sk->sk_wmem_queued
    04301da4d870 pwm: lpc32xx: Remove handling of PWM channels
    565f7bb0b3fe watchdog: intel-mid_wdt: add MODULE_ALIAS() to allow auto-load
    7a0e41223e98 perf top: Don't pass an ERR_PTR() directly to perf_session__delete()
    c5be10f1bf61 x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
    1d0cc1a9c4bd perf annotate bpf: Don't enclose non-debug code with an assert()
    c7cc4dc2473c kconfig: fix possible buffer overflow
    0158dab8e8b8 NFSv4/pnfs: minor fix for cleanup path in nfs4_get_device_info
    64c5e916fabe soc: qcom: qmi_encdec: Restrict string length in decode
    5c7608d976ab clk: qcom: gcc-mdm9615: use proper parent for pll0_vote clock
    b88626c47217 parisc: led: Reduce CPU overhead for disk & lan LED computation
    536f30922556 parisc: led: Fix LAN receive and transmit LEDs
    cbfffe51221b lib/test_meminit: allocate pages up to order MAX_ORDER
    9b7f6e500969 drm/ast: Fix DRAM init on AST2200
    8ffa40ff64aa fbdev/ep93xx-fb: Do not assign to struct fb_info.dev
    6d5eb57a02a5 scsi: qla2xxx: Remove unsupported ql2xenabledif option
    e24bc58113d1 scsi: qla2xxx: Turn off noisy message log
    05935f9106f1 scsi: qla2xxx: Fix erroneous link up failure
    61641000ad33 scsi: qla2xxx: fix inconsistent TMF timeout
    f966dc8c2d18 net/ipv6: SKB symmetric hash should incorporate transport ports
    d31331e2df6e drm: fix double free for gbo in drm_gem_vram_init and drm_gem_vram_create
    34eb4bd9152c udf: initialize newblock to 0
    206d2b7bafc0 usb: typec: tcpci: clear the fault status bit
    824421868102 serial: sc16is7xx: fix broken port 0 uart init
    159bc8c6b5db sc16is7xx: Set iobase to device index
    355ac795843f cpufreq: brcmstb-avs-cpufreq: Fix -Warray-bounds bug
    5e7d0acc69b5 crypto: stm32 - fix loop iterating through scatterlist for DMA
    306e356d583d s390/ipl: add missing secure/has_secure file to ipl type 'unknown'
    e972231db29b pstore/ram: Check start of empty przs during init
    b6c9d040191f fsverity: skip PKCS#7 parser when keyring is empty
    712491c9abf2 net: handle ARPHRD_PPP in dev_is_mac_header_xmit()
    15b3727108c7 X.509: if signature is unsupported skip validation
    7a7dd70cb954 dccp: Fix out of bounds access in DCCP error handler
    1c675c937cb2 dlm: fix plock lookup when using multiple lockspaces
    8cd1c5cec6c9 parisc: Fix /proc/cpuinfo output for lscpu
    0337bb53cb7d procfs: block chmod on /proc/thread-self/comm
    2e1f12ce0da7 Revert "PCI: Mark NVIDIA T4 GPUs to avoid bus reset"
    eb1fa4819d9c ntb: Fix calculation ntb_transport_tx_free_entry()
    b2a6a169c222 ntb: Clean up tx tail index on link down
    94491412a2af ntb: Drop packets when qp link is down
    ff3bb51e2136 media: dvb: symbol fixup for dvb_attach()
    b047ac1528a1 xtensa: PMU: fix base address for the newer hardware
    2791a2a69a2c backlight/lv5207lp: Compare against struct fb_info.device
    bc86f29e1281 backlight/bd6107: Compare against struct fb_info.device
    3dd8ff569596 backlight/gpio_backlight: Compare against struct fb_info.device
    c2e1ce4fa498 ARM: OMAP2+: Fix -Warray-bounds warning in _pwrdm_state_switch()
    f53ab5a2bf20 ipmi_si: fix a memleak in try_smi_init()
    e7f97980f735 ALSA: pcm: Fix missing fixup call in compat hw_refine ioctl
    29811f4b8255 PM / devfreq: Fix leak in devfreq_dev_release()
    c2ad60ed38b8 igb: set max size RX buffer when store bad packet is enabled
    d44403ec0676 skbuff: skb_segment, Call zero copy functions before using skbuff frags
    64831fb6a204 netfilter: xt_sctp: validate the flag_info count
    28ce8495b559 netfilter: xt_u32: validate user space input
    109e830585e8 netfilter: ipset: add the missing IP_SET_HASH_WITH_NET0 macro for ip_set_hash_netportnet.c
    3d54e9949930 igmp: limit igmpv3_newpack() packet size to IP_MAX_MTU
    ec6ad9d99ef4 virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
    12fcca2ee445 cpufreq: Fix the race condition while updating the transition_task of policy
    fe5dd3950178 dmaengine: ste_dma40: Add missing IRQ check in d40_probe
    e0f2d85ea3d0 um: Fix hostaudio build errors
    88d508faf3dd mtd: rawnand: fsmc: handle clk prepare error in fsmc_nand_resume()
    efa7f31669f0 rpmsg: glink: Add check for kstrdup
    d2473df751d2 phy/rockchip: inno-hdmi: do not power on rk3328 post pll on reg write
    f36a06988c19 phy/rockchip: inno-hdmi: round fractal pixclock in rk3328 recalc_rate
    b0d5d77b14b4 phy/rockchip: inno-hdmi: use correct vco_div_5 macro on rk3328
    90e037cabc2c tracing: Fix race issue between cpu buffer write and swap
    ac78921ec246 x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
    df7ca43fe090 HID: multitouch: Correct devm device reference for hidinput input_dev name
    cf48a7ba5c09 HID: logitech-dj: Fix error handling in logi_dj_recv_switch_to_dj_mode()
    011daffb53ce RDMA/siw: Correct wrong debug message
    35a78898cdfd RDMA/siw: Balance the reference of cep->kref in the error path
    9b6296861a5a Revert "IB/isert: Fix incorrect release of isert connection"
    03db4fe7917b amba: bus: fix refcount leak
    93a4aefa5745 serial: tegra: handle clk prepare error in tegra_uart_hw_init()
    d2bf25674cea scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock
    b1e3199bade0 scsi: core: Use 32-bit hostnum in scsi_host_lookup()
    103b41e97275 media: ov2680: Fix regulators being left enabled on ov2680_power_on() errors
    009b1202a099 media: ov2680: Fix vflip / hflip set functions
    560624cf1d3a media: ov2680: Fix ov2680_bayer_order()
    218b60bc06bc media: ov2680: Remove auto-gain and auto-exposure controls
    768d4d230c02 media: i2c: ov2680: Set V4L2_CTRL_FLAG_MODIFY_LAYOUT on flips
    c04ae531eea6 media: ov5640: Enable MIPI interface in ov5640_set_power_mipi()
    916219c523e0 media: i2c: ov5640: Configure HVP lines in s_power callback
    93c518d28600 USB: gadget: f_mass_storage: Fix unused variable warning
    0d8c6770983e media: go7007: Remove redundant if statement
    38269b9ec843 iommu/vt-d: Fix to flush cache of PASID directory table
    a94aaffe9290 IB/uverbs: Fix an potential error pointer dereference
    c3a679853826 driver core: test_async: fix an error code
    27a218419c86 dma-buf/sync_file: Fix docs syntax
    c9e6c1fefcd5 coresight: tmc: Explicit type conversions to prevent integer overflow
    463934ca5d98 scsi: qedf: Do not touch __user pointer in qedf_dbg_fp_int_cmd_read() directly
    668ce8d508a3 scsi: qedf: Do not touch __user pointer in qedf_dbg_debug_cmd_read() directly
    06a2dde58f40 scsi: qedf: Do not touch __user pointer in qedf_dbg_stop_io_on_error_cmd_read() directly
    e26d52128691 x86/APM: drop the duplicate APM_MINOR_DEV macro
    c65be6ad55e5 serial: sprd: Fix DMA buffer leak issue
    730d1b7ec94c serial: sprd: Assign sprd_port after initialized to avoid wrong access
    dff8066579c0 serial: sprd: remove redundant sprd_port cleanup
    a7d80271a150 serial: sprd: getting port index via serial aliases only
    47f3be62eab5 scsi: qla4xxx: Add length check when parsing nlattrs
    bc66e701ca8f scsi: be2iscsi: Add length check when parsing nlattrs
    161d4509dde4 scsi: iscsi: Add strlen() check in iscsi_if_set{_host}_param()
    bc4fbf2dab31 usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()
    de4345fe4312 media: mediatek: vcodec: Return NULL if no vdec_fb is found
    02c0ea731f31 media: cx24120: Add retval check for cx24120_message_send()
    75d6ef197c48 media: dvb-usb: m920x: Fix a potential memory leak in m920x_i2c_xfer()
    74697b417624 media: dib7000p: Fix potential division by zero
    afd90d353f80 drivers: usb: smsusb: fix error handling code in smsusb_init_device
    4bc5ffaf8ac4 media: v4l2-core: Fix a potential resource leak in v4l2_fwnode_parse_link()
    008b334af84a media: v4l2-fwnode: simplify v4l2_fwnode_parse_link
    064e156e9f66 media: v4l2-fwnode: fix v4l2_fwnode_parse_link handling
    7a9619e38c2b NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN
    16282aeca44b NFSD: da_addr_body field missing in some GETDEVICEINFO replies
    93a14ab67582 fs: lockd: avoid possible wrong NULL parameter
    d3351799be41 jfs: validate max amount of blocks before allocation.
    65bf8a196ba2 powerpc/iommu: Fix notifiers being shared by PCI and VIO buses
    650803f93dd8 nfs/blocklayout: Use the passed in gfp flags
    68ba08ab40c5 wifi: ath10k: Use RMW accessors for changing LNKCTL
    ab28c56192f5 drm/radeon: Use RMW accessors for changing LNKCTL
    d835a13232c0 drm/radeon: Prefer pcie_capability_read_word()
    06c0c15ab03c drm/radeon: Replace numbers with PCI_EXP_LNKCTL2 definitions
    30e633dbcd4c drm/radeon: Correct Transmit Margin masks
    108ce391d6da drm/amdgpu: Use RMW accessors for changing LNKCTL
    7085f1aab194 drm/amdgpu: Prefer pcie_capability_read_word()
    62a1c1bd45d8 drm/amdgpu: Replace numbers with PCI_EXP_LNKCTL2 definitions
    adf810206cca drm/amdgpu: Correct Transmit Margin masks
    7f9129b66c87 PCI: Add #defines for Enter Compliance, Transmit Margin
    81d1de3b9793 powerpc/fadump: reset dump area size if fadump memory reserve fails
    7159a27b1ac1 clk: imx: composite-8m: fix clock pauses when set_rate would be a no-op
    044ff5356a3b PCI/ASPM: Use RMW accessors for changing LNKCTL
    73d73556ed1d PCI: pciehp: Use RMW accessors for changing LNKCTL
    e7e3268ae9b7 PCI: Mark NVIDIA T4 GPUs to avoid bus reset
    a611e38d5b94 clk: sunxi-ng: Modify mismatched function name
    9ad9cca12b10 drivers: clk: keystone: Fix parameter judgment in _of_pll_clk_init()
    de677f4379fa ipmi:ssif: Fix a memory leak when scanning for an adapter
    ef0d286989b1 ipmi:ssif: Add check for kstrdup
    90fddb87892e ALSA: ac97: Fix possible error value of *rac97
    0b1e48e4dccb of: unittest: Fix overlay type in apply/revert check
    0a6f39488c38 drm/mediatek: Fix potential memory leak if vmap() fail
    f6364fa751d7 audit: fix possible soft lockup in __audit_inode_child()
    43f0c2bb16af smackfs: Prevent underflow in smk_set_cipso()
    b8a61df6f404 drm/msm/mdp5: Don't leak some plane state
    1f3d0e65d111 ima: Remove deprecated IMA_TRUSTED_KEYRING Kconfig
    dbdc828991ae drm/panel: simple: Add missing connector type and pixel format for AUO T215HVN01
    4db0a85cf865 drm/armada: Fix off-by-one error in armada_overlay_get_property()
    dadf0d0dfcc8 of: unittest: fix null pointer dereferencing in of_unittest_find_node_by_name()
    def1fd88ae97 drm/tegra: dpaux: Fix incorrect return value of platform_get_irq
    c1ff601e1aa5 drm/tegra: Remove superfluous error messages around platform_get_irq()
    1603f086200a md/md-bitmap: hold 'reconfig_mutex' in backlog_store()
    630be0110e6a md/bitmap: don't set max_write_behind if there is no write mostly device
    a8f8c4e7281c drm/amdgpu: Update min() to min_t() in 'amdgpu_info_ioctl'
    c6b423ab655c arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC
    69d9fb39480c ARM: dts: BCM53573: Fix Ethernet info for Luxul devices
    e6fc20a5425b drm: adv7511: Fix low refresh rate register for ADV7533/5
    88d32b9ad274 ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)
    dfe36c23abf9 ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210
    febead00308f ARM: dts: s5pv210: correct ethernet unit address in SMDKV210
    00b3f8004bdc ARM: dts: s5pv210: use defines for IRQ flags in SMDKV210
    9dff1deb2507 ARM: dts: s5pv210: add RTC 32 KHz clock in SMDKV210
    df9929c61c9d ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)
    c20456c2cd29 ARM: dts: s3c64xx: align pinctrl with dtschema
    a355d140eb49 ARM: dts: s3c6410: align node SROM bus node name with dtschema in Mini6410
    e5deee40fa04 ARM: dts: s3c6410: move fixed clocks under root node in Mini6410
    d38b67da1572 drm/etnaviv: fix dumping of active MMU context
    5b8c8527a2c3 ARM: dts: BCM53573: Use updated "spi-gpio" binding properties
    5680c01363ea ARM: dts: BCM53573: Add cells sizes to PCIe node
    17a5848bdca0 ARM: dts: BCM53573: Drop nonexistent "default-off" LED trigger
    c01cbe6c0345 drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar()
    d40c192e1198 quota: fix dqput() to follow the guarantees dquot_srcu should provide
    dd918952b1ed quota: add new helper dquot_active()
    88c0cdfe10fb quota: rename dquot_active() to inode_quota_active()
    29d7249bb61c quota: factor out dquot_write_dquot()
    f2f64c2951a3 quota: avoid increasing DQST_LOOKUPS when iterating over dirty/inuse list
    1e4f7ce32a1d drm/bridge: tc358764: Fix debug print parameter order
    835f0a848a8b netrom: Deny concurrent connect().
    da13749d5ff7 net/sched: sch_hfsc: Ensure inner classes have fsc curve
    83382eafc745 mlxsw: i2c: Limit single transaction buffer size
    b2d7f0f313b8 mlxsw: i2c: Fix chunk size setting in output mailbox buffer
    400ef5f79c90 net: arcnet: Do not call kfree_skb() under local_irq_disable()
    f306bbdce631 wifi: ath9k: use IS_ERR() with debugfs_create_dir()
    231086e6a363 wifi: mwifiex: avoid possible NULL skb pointer dereference
    5f6f00bcf947 wifi: ath9k: protect WMI command response buffer replacement with a lock
    ff703b5f3f3c wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx
    df1753eae74b wifi: mwifiex: Fix missed return in oob checks failed path
    8f717752f94e wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
    ab4810042cdd fs: ocfs2: namei: check return value of ocfs2_add_entry()
    dbe64279ae34 lwt: Check LWTUNNEL_XMIT_CONTINUE strictly
    67f8f2bae8e7 lwt: Fix return values of BPF xmit ops
    12bf7d9cc6af hwrng: iproc-rng200 - Implement suspend and resume calls
    4f1ca8e39732 hwrng: iproc-rng200 - use semicolons rather than commas to separate statements
    6c015ebce180 crypto: caam - fix unchecked return value error
    ec348676c7d0 Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe()
    0ce06035ea67 crypto: stm32 - Properly handle pm_runtime_get failing
    34de9f1d6359 wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
    87f8c5442373 mwifiex: switch from 'pci_' to 'dma_' API
    29eca8b7863d wifi: mwifiex: Fix OOB and integer underflow when rx packets
    042aeb45e484 can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM
    516f21f21068 spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe()
    4fb6fcc04a99 regmap: rbtree: Use alloc_flags for memory allocations
    57935355dc67 tcp: tcp_enter_quickack_mode() should be static
    75b8b5b52985 bpf: Clear the probe_addr for uprobe
    a0fa690894c1 cpufreq: powernow-k8: Use related_cpus instead of cpus in driver.exit()
    991b7c260476 perf/imx_ddr: don't enable counter0 if none of 4 counters are used
    07415be140d0 x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved
    6dbac48ea344 x86/boot: Annotate local functions
    c418814fae86 x86/asm: Make more symbols local
    3eb241e47d05 OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
    5d3975e36c64 tmpfs: verify {g,u}id mount options correctly
    48c54877ce33 fs: Fix error checking for d_hash_and_lookup()
    0c8c20538115 new helper: lookup_positive_unlocked()
    0a2b1eb8a9ce eventfd: prevent underflow for eventfd semaphores
    3e9617d63edf eventfd: Export eventfd_ctx_do_read()
    f59ff666989c reiserfs: Check the return value from __getblk()
    e74903b5fbc9 Revert "net: macsec: preserve ingress frame ordering"
    b36c4a731aae udf: Handle error when adding extent to a file
    7648ea9896b3 udf: Check consistency of Space Bitmap Descriptor
    3e2265cda14e powerpc/32s: Fix assembler warning about r0
    aea73dde7180 net: Avoid address overwrite in kernel_connect
    d7d42f114252 platform/mellanox: Fix mlxbf-tmfifo not handling all virtio CONSOLE notifications
    6614af25e142 ALSA: seq: oss: Fix racy open/close of MIDI devices
    601dc776a09a scsi: storvsc: Always set no_report_opcodes
    107f5cad230b cifs: add a warning when the in-flight count goes negative
    f31618e4fc00 sctp: handle invalid error codes without calling BUG()
    8d7395d0ea5e bnx2x: fix page fault following EEH recovery
    c1ce2f09573e netlabel: fix shift wrapping bug in netlbl_catmap_setlong()
    499eb477f76b scsi: qedi: Fix potential deadlock on &qedi_percpu->p_work_lock
    d0189e40c2d1 idmaengine: make FSL_EDMA and INTEL_IDMA64 depends on HAS_IOMEM
    617d1d0e1730 net: usb: qmi_wwan: add Quectel EM05GV2
    5d2481bc924e clk: fixed-mmio: make COMMON_CLK_FIXED_MMIO depend on HAS_IOMEM
    3899c1d158c5 security: keys: perform capable check only on privileged operations
    97ed1be29bf0 platform/x86: huawei-wmi: Silence ambient light sensor
    762c352dfc41 platform/x86: intel: hid: Always call BTNL ACPI method
    0e3f0e55974c ASoC: atmel: Fix the 8K sample parameter in I2SC master
    0b718d1d5780 ASoc: codecs: ES8316: Fix DMIC config
    b796adfc9869 fs/nls: make load_nls() take a const parameter
    35a9b057bfd4 s390/dasd: fix hanging device after request requeue
    d7768b33d0fd s390/dasd: use correct number of retries for ERP requests
    a21ff228f0e1 m68k: Fix invalid .section syntax
    4dfc0d1edad3 vxlan: generalize vxlan_parse_gpe_hdr and remove unused args
    d65c5ef975d1 ethernet: atheros: fix return value check in atl1c_tso_csum()
    ea95a0111494 ASoC: da7219: Check for failure reading AAD IRQ events
    216953c3de60 ASoC: da7219: Flush pending AAD IRQ when suspending
    b6f827c3f8db 9p: virtio: make sure 'offs' is initialized in zc_request
    b6fefef07dca pinctrl: amd: Don't show `Invalid config param` errors
    99a73016a5e1 nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse
    724474dfaa98 nilfs2: fix general protection fault in nilfs_lookup_dirty_data_buffers()
    efe8244ba960 fsi: master-ast-cf: Add MODULE_FIRMWARE macro
    6b701dab1993 firmware: stratix10-svc: Fix an NULL vs IS_ERR() bug in probe
    bee7f3a49469 serial: sc16is7xx: fix bug when first setting GPIO direction
    a6650d27ab2c Bluetooth: btsdio: fix use after free bug in btsdio_remove due to race condition
    5876cae6d6ef staging: rtl8712: fix race condition
    a17c6efa1413 HID: wacom: remove the battery when the EKR is off
    e4f5ad7b539a USB: serial: option: add FOXCONN T99W368/T99W373 product
    837f6647b2bf USB: serial: option: add Quectel EM05G variant (0x030e)
    1d2432804815 modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules
    6938ef59e3ff rtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff
    0e0914f9a899 net: enetc: use EXPORT_SYMBOL_GPL for enetc_phc_index
    6b39bd898bb0 mmc: au1xmmc: force non-modular build and remove symbol_get usage
    7a67c5d93292 ARM: pxa: remove use of symbol_get()
    e83f5d13cb73 erofs: ensure that the post-EOF tails are all zeroed

(From OE-Core rev: 0111b5b152c1bcff0ab26cf8632ca9002237f070)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Bruce Ashfield
5ee2872089 linux-yocto/5.4: update to v5.4.256
Updating  to the latest korg -stable release that comprises
the following commits:

    0c2544add9fc Linux 5.4.256
    1ba96e65ef4c Revert "MIPS: Alchemy: fix dbdma2"
    94aef0fe5a82 powerpc/pmac/smp: Drop unnecessary volatile qualifier
    b29a10fd0734 powerpc/pmac/smp: Avoid unused-variable warnings
    5eb967dd50a5 Linux 5.4.255
    e171795856a6 dma-buf/sw_sync: Avoid recursive lock during fence signal
    f49cac7634da pinctrl: renesas: rza2: Add lock around pinctrl_generic{{add,remove}_group,{add,remove}_function}
    197c546a598a clk: Fix undefined reference to `clk_rate_exclusive_{get,put}'
    7fd9cded5646 scsi: core: raid_class: Remove raid_component_add()
    56428d89a0da scsi: snic: Fix double free in snic_tgt_create()
    b6db4ef5ea41 irqchip/mips-gic: Don't touch vl_map if a local interrupt is not routable
    61b5d77169e1 Documentation/sysctl: document page_lock_unfairness
    b2421a196cb0 ALSA: pcm: Check for null pointer of pointer substream before dereferencing it
    e8bf830efa8a interconnect: Do not skip aggregation for disabled paths
    456a7a73404c Revert "ALSA: pcm: Use SG-buffer only when direct DMA is available"
    52a7c86e63d2 ALSA: pcm: Fix build error on m68k and others
    a1ef12540ebd rtnetlink: Reject negative ifindexes in RTM_NEWLINK
    c404e1e19780 mm: allow a controlled amount of unfairness in the page lock
    97640d8e2cee x86/fpu: Set X86_FEATURE_OSXSAVE feature after enabling OSXSAVE in CR4
    b156ce3b3b61 drm/display/dp: Fix the DP DSC Receiver cap size
    9e5fe282f9e2 PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus
    ac0e0df5180c media: vcodec: Fix potential array out-of-bounds in encoder queue_setup
    79a05ca73637 radix tree: remove unused variable
    32639f13441b lib/clz_ctz.c: Fix __clzdi2() and __ctzdi2() for 32-bit kernels
    c5f261825ff6 batman-adv: Hold rtnl lock during MTU update via netlink
    61b71562beb3 batman-adv: Fix batadv_v_ogm_aggr_send memory leak
    5fb1a2133707 batman-adv: Fix TT global entry leak when client roamed back
    e6e9d7808179 batman-adv: Do not get eth header before batadv_check_management_packet
    c97442e09884 batman-adv: Don't increase MTU when set by user
    22288ea6beba batman-adv: Trigger events for auto adjusted MTU
    3b83759fd46c nfsd: Fix race to FREE_STATEID and cl_revoked
    c0284760f470 clk: Fix slab-out-of-bounds error in devm_clk_release()
    a0bc5cf2e7f4 NFSv4: Fix dropped lock for racing OPEN and delegation return
    815fb2531a48 ibmveth: Use dcbf rather than dcbfl
    35e31aff6160 bonding: fix macvlan over alb bond support
    faf3f988cc63 net: remove bond_slave_has_mac_rcu()
    eebd074af272 net/sched: fix a qdisc modification with ambiguous command request
    62383d9fa1af igb: Avoid starting unnecessary workqueues
    adef04cc4819 net: validate veth and vxcan peer ifindexes
    52ddda8d218b net: bcmgenet: Fix return value check for fixed_phy_register()
    189ad377d1ca net: bgmac: Fix return value check for fixed_phy_register()
    dcbfcb54a28f ipvlan: Fix a reference count leak warning in ipvlan_ns_exit()
    8e6433fecb2b dccp: annotate data-races in dccp_poll()
    7d6cc6919952 sock: annotate data-races around prot->memory_pressure
    d28ea7acfae7 octeontx2-af: SDP: fix receive link config
    05319d707732 tracing: Fix memleak due to race between current_tracer and trace
    c8920972d086 drm/amd/display: check TG is non-null before checking if enabled
    7d4174a99b1d drm/amd/display: do not wait for mpc idle if tg is disabled
    94239d1830a1 ASoC: fsl_sai: Disable bit clock with transmitter
    ef9cae4a6c8d ASoC: fsl_sai: Add new added registers and new bit definition
    1b3d75104542 ASoC: fsl_sai: Refine enable/disable TE/RE sequence in trigger()
    f9afb326b7ba regmap: Account for register length in SMBus I/O limits
    7e1d1456c8db ALSA: pcm: Fix potential data race at PCM memory allocation helpers
    140797d0a46e ALSA: pcm: Use SG-buffer only when direct DMA is available
    95b30a431254 ALSA: pcm: Set per-card upper limit of PCM buffer allocations
    d0ef103e192c dm integrity: reduce vmalloc space footprint on 32-bit architectures
    072d247d7a62 dm integrity: increase RECALC_SECTORS to improve recalculate speed
    4e96ee117500 fbdev: fix potential OOB read in fast_imageblit()
    ebf84320a587 fbdev: Fix sys_imageblit() for arbitrary image widths
    96f8e80656ec fbdev: Improve performance of sys_imageblit()
    7e5b7360df81 MIPS: cpu-features: Use boot_cpu_type for CPU type based features
    302a8fbf8cab MIPS: cpu-features: Enable octeon_cache by cpu_type
    7b57fc3f4c49 fs: dlm: fix mismatch of plock results from userspace
    721d5b514dfc fs: dlm: use dlm_plock_info for do_unlock_close
    da794f6dd549 fs: dlm: change plock interrupted message to debug again
    f03726ef19e1 fs: dlm: add pid to debug log
    8b73497e50ef dlm: replace usage of found with dedicated list iterator variable
    526cc04d718b dlm: improve plock logging if interrupted
    7abd6dce29f6 PCI: acpiphp: Reassign resources on bridge if necessary
    fce081555293 net: phy: broadcom: stub c45 read/write for 54810
    e91d5ace7051 mmc: f-sdh30: fix order of function calls in sdhci_f_sdh30_remove
    a0e20e267aec net: xfrm: Amend XFRMA_SEC_CTX nla_policy structure
    f0c10a4497af net: fix the RTO timer retransmitting skb every 1ms if linear option is enabled
    b1be2cfcf6cf virtio-net: set queues after driver_ok
    4821df2ffe38 af_unix: Fix null-ptr-deref in unix_stream_sendpage().
    0afc186aba1e netfilter: set default timeout to 3 secs for sctp shutdown send and recv state
    6875690b0eea mmc: block: Fix in_flight[issue_type] value error
    54deee3fab1b mmc: wbsd: fix double mmc_free_host() in wbsd_init()
    4259dd534245 cifs: Release folio lock on fscache read hit.
    03373410247b ALSA: usb-audio: Add support for Mythware XA001AU capture and playback interfaces.
    b653289ca646 serial: 8250: Fix oops for port->pm on uart_change_pm()
    7b4e6bff03e2 ASoC: meson: axg-tdm-formatter: fix channel slot allocation
    29d862ee5fef ASoC: rt5665: add missed regulator_bulk_disable
    f21fa1892d42 ARM: dts: imx: Set default tuning step for imx6sx usdhc
    aadee0ae0a5f ARM: dts: imx: Set default tuning step for imx7d usdhc
    a23e10dafd77 ARM: dts: imx: Adjust dma-apbh node name
    536c1bbedd5d ARM: dts: imx7s: Drop dma-apb interrupt-names
    37cfbf847c2d bus: ti-sysc: Flush posted write on enable before reset
    4637b2fa6541 bus: ti-sysc: Improve reset to work with modules with no sysconfig
    210ff31342ad net: do not allow gso_size to be set to GSO_BY_FRAGS
    1c7db7abd4ba sock: Fix misuse of sk_under_memory_pressure()
    aa670bdefc0c net: dsa: mv88e6xxx: Wait for EEPROM done before HW reset
    702c58a05eb5 i40e: fix misleading debug logs
    ac16de2d02eb team: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves
    81da9e2c4255 netfilter: nft_dynset: disallow object maps
    bdd7c2ff4143 ipvs: fix racy memcpy in proc_do_sync_threshold
    38e5c37bfab1 selftests: mirror_gre_changes: Tighten up the TTL test match
    8046beb890eb xfrm: add NULL check in xfrm_update_ae_params
    d34c30442d5e ip_vti: fix potential slab-use-after-free in decode_session6
    eb47e612e59c ip6_vti: fix slab-use-after-free in decode_session6
    db0e50741f03 xfrm: fix slab-use-after-free in decode_session6
    64c6df80d35a xfrm: interface: rename xfrm_interface.c to xfrm_interface_core.c
    32cc777c0a53 net: af_key: fix sadb_x_filter validation
    373848d51fde net: xfrm: Fix xfrm_address_filter OOB read
    a0a462a0f209 btrfs: fix BUG_ON condition in btrfs_cancel_balance
    cc423a972cfd tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms
    1d29e21ed09f powerpc/rtas_flash: allow user copy to flash block cache objects
    97ddf1c2105a fbdev: mmp: fix value check in mmphw_probe()
    3259e2d8781f i2c: bcm-iproc: Fix bcm_iproc_i2c_isr deadlock issue
    b788ad3b2468 virtio-mmio: don't break lifecycle of vm_dev
    e22a4b77b69d virtio-mmio: Use to_virtio_mmio_device() to simply code
    432429d1b25f virtio-mmio: convert to devm_platform_ioremap_resource
    12c4c227891e nfsd: Remove incorrect check in nfsd4_validate_stateid
    a4e3c4cd02f5 nfsd4: kill warnings on testing stateids with mismatched clientids
    ff652b0150a4 net/ncsi: Fix gma flag setting after response
    b66a1defb205 tracing/probes: Fix to update dynamic data counter if fetcharg uses it
    bdc309d89b32 tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
    cc93a372e03e leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename
    939b8b312adc mmc: sunxi: fix deferred probing
    c6d1a281ae83 mmc: bcm2835: fix deferred probing
    b48b4b1885f7 USB: dwc3: qcom: fix NULL-deref on suspend
    6da1f9fd9c8e usb: dwc3: qcom: Add helper functions to enable,disable wake irqs
    5335bb0cefde interconnect: Add helpers for enabling/disabling a path
    e062fb979410 interconnect: Move internal structs into a separate file
    abc25a18a64c irqchip/mips-gic: Use raw spinlock for gic_lock
    05de6069b52c irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()
    1224e5a9787c ALSA: hda: Fix unhandled register update during auto-suspend period
    a55d55a30781 PM: runtime: Add pm_runtime_get_if_active()
    e5d98d42bca5 PM-runtime: add tracepoints for usage_count changes
    59aba9d5cd36 iommu/amd: Fix "Guest Virtual APIC Table Root Pointer" configuration in IRTE
    8f302378c704 iio: addac: stx104: Fix race condition when converting analog-to-digital
    7251b2915d33 iio: addac: stx104: Fix race condition for stx104_write_raw()
    70d135e7de08 iio: stx104: Move to addac subdirectory
    8ba99f7fc7eb iio: adc: stx104: Implement and utilize register structures
    4edf338adee7 iio: adc: stx104: Utilize iomap interface
    e13b26d0dd10 iio: add addac subdirectory
    e6f66a0ad755 IMA: allow/fix UML builds
    635278e97a94 powerpc/kasan: Disable KCOV in KASAN code
    109f0aaa0b88 ALSA: hda: fix a possible null-pointer dereference due to data race in snd_hdac_regmap_sync()
    97ed58437705 ALSA: hda/realtek: Add quirks for Unis H3C Desktop B760 & Q760
    c6059af6bf5e drm/amdgpu: Fix potential fence use-after-free v2
    fe49aa73cca6 Bluetooth: L2CAP: Fix use-after-free
    22100df1d57f pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()
    b4a7ab57effb gfs2: Fix possible data races in gfs2_show_options()
    c4d5c945b69a usb: chipidea: imx: don't request QoS for imx8ulp
    c1c5826223ae media: platform: mediatek: vpu: fix NULL ptr dereference
    ef009fe2010e media: v4l2-mem2mem: add lock to protect parameter num_rdy
    2a8807f9f511 FS: JFS: Check for read-only mounted filesystem in txBegin
    a7d17d6bd7cd FS: JFS: Fix null-ptr-deref Read in txBegin
    2225000d62c1 MIPS: dec: prom: Address -Warray-bounds warning
    6e7d9d76e565 fs: jfs: Fix UBSAN: array-index-out-of-bounds in dbAllocDmapLev
    3f1368af47ac udf: Fix uninitialized array access for some pathnames
    8f203dd401e8 ovl: check type and offset of struct vfsmount in ovl_entry
    8abed186aabd HID: add quirk for 03f0:464a HP Elite Presenter Mouse
    3f378783c47b quota: fix warning in dqgrab()
    c3a1f5ba11c5 quota: Properly disable quotas when add_dquot_ref() fails
    dd445ebbee88 ALSA: emu10k1: roll up loops in DSP setup code for Audigy
    b8fab6aebdf2 drm/radeon: Fix integer overflow in radeon_cs_parser_init
    3a3bb438dae3 macsec: use DEV_STATS_INC()
    b5e20a3ddea4 macsec: Fix traffic counters/statistics
    4b854879f82d selftests: forwarding: tc_flower: Relax success criterion
    e5883ffdd0a8 mmc: sdhci-f-sdh30: Replace with sdhci_pltfm
    e7bd70c3bc62 mmc: sdhci_f_sdh30: convert to devm_platform_ioremap_resource

(From OE-Core rev: 5ab843389d08da0f04636c8dc02998865c6f5c4c)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Bruce Ashfield
f38a69e59f linux-yocto/5.4: update to v5.4.254
Updating  to the latest korg -stable release that comprises
the following commits:

    fd2a1d1f32ea Linux 5.4.254
    e7711f15ed6b sch_netem: fix issues in netem_change() vs get_dist_table()
    3c3ffd6a3cf7 alpha: remove __init annotation from exported page_is_ram()
    e12fac07f61c scsi: core: Fix possible memory leak if device_add() fails
    cea09922f5f7 scsi: snic: Fix possible memory leak if device_add() fails
    12162414a7c1 scsi: 53c700: Check that command slot is not NULL
    048ebc9a28fb scsi: storvsc: Fix handling of virtual Fibre Channel timeouts
    ecb1fbe2879f scsi: core: Fix legacy /proc parsing buffer overflow
    979822844209 netfilter: nf_tables: report use refcount overflow
    137e25f0906e nvme-rdma: fix potential unbalanced freeze & unfreeze
    ab32fbe3fe70 nvme-tcp: fix potential unbalanced freeze & unfreeze
    756c024698f4 btrfs: set cache_block_group_error if we find an error
    fa7bc2684a05 btrfs: don't stop integrity writeback too early
    0a3b5893c6b1 ibmvnic: Handle DMA unmapping of login buffs in release functions
    d66a27113ebb net/mlx5: Allow 0 for total host VFs
    d7b2df974299 dmaengine: mcf-edma: Fix a potential un-allocated memory access
    e913d89445e3 wifi: cfg80211: fix sband iftype data lookup for AP_VLAN
    c2145b18740c IB/hfi1: Fix possible panic during hotplug remove
    9d469552c9d2 drivers: net: prevent tun_build_skb() to exceed the packet size limit
    67eebc7a9217 dccp: fix data-race around dp->dccps_mss_cache
    ef8810965f0c bonding: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves
    9c7deea5afcc net/packet: annotate data-races around tp->status
    60d9662f39f5 mISDN: Update parameter type of dsp_cmx_send()
    dd72849bce27 selftests/rseq: Fix build with undefined __weak
    302d848188d6 drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes
    ed8dcd9543b8 x86: Move gds_ucode_mitigated() declaration to header
    6b342b1f3b01 x86/mm: Fix VDSO and VVAR placement on 5-level paging machines
    91a5e755e11f x86/cpu/amd: Enable Zenbleed fix for AMD Custom APU 0405
    14254212b431 usb: common: usb-conn-gpio: Prevent bailing out if initial role is none
    25038d3f16b9 usb: dwc3: Properly handle processing of pending events
    044f4446e06b usb-storage: alauda: Fix uninit-value in alauda_check_media()
    b97dad01c121 binder: fix memory leak in binder_init()
    182f0e71ff34 iio: cros_ec: Fix the allocation size for cros_ec_command
    d2c539c216cc nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput
    655716938d14 x86/pkeys: Revert a5eff7259790 ("x86/pkeys: Add PKRU value to init_fpstate")
    ea1b4c31161f radix tree test suite: fix incorrect allocation size for pthreads
    aa0bfe169d29 drm/nouveau/gr: enable memory loads on helper invocation on all channels
    8a489b0bc87c dmaengine: pl330: Return DMA_PAUSED when transaction is paused
    7c62508d6b91 ipv6: adjust ndisc_is_useropt() to also return true for PIO
    0a67c1262162 mmc: moxart: read scr register without changing byte order
    4b4223f7d26d Linux 5.4.253
    9e5374875f96 Revert "driver core: Annotate dev_err_probe() with __must_check"
    ca33c0704151 drivers: core: fix kernel-doc markup for dev_err_probe()
    04ece65d9bad driver code: print symbolic error code
    f2c1b4f9c157 driver core: Annotate dev_err_probe() with __must_check
    2e8fc2ddffee ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node
    a1ba8725577b ARM: dts: imx6sll: fixup of operating points
    6c71d73945d2 ARM: dts: imx: add usb alias
    66579ee141a5 ARM: dts: imx: Align L2 cache-controller nodename with dtschema
    3b454fb938e1 ARM: dts: imx6sll: Make ssi node name same as other platforms
    03b119d900fd arm64: dts: stratix10: fix incorrect I2C property for SCL signal
    72c946246e21 ceph: defer stopping mdsc delayed_work
    f82fe11a30ae ceph: use kill_anon_super helper
    82edffead586 ceph: show tasks waiting on caps in debugfs caps file
    632023a2b3ac PM: sleep: wakeirq: fix wake irq arming
    d7f34e2cdd12 PM / wakeirq: support enabling wake-up irq after runtime_suspend called
    9cbffa33749a selftests/rseq: Play nice with binaries statically linked against glibc 2.35+
    13553469bdbd selftests/rseq: check if libc rseq support is registered
    a65e7b4b31ca powerpc/mm/altmap: Fix altmap boundary check
    f8cf0f83cf04 mtd: rawnand: omap_elm: Fix incorrect type in assignment
    2af8ed119722 test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation
    0f68b0f8eb5a test_firmware: prevent race conditions by a correct implementation of locking
    040cdadf9fdc ext2: Drop fragment support
    0336b42456e4 fs: Protect reconfiguration of sb read-write from racing writes
    a05ac5d00eb7 net: usbnet: Fix WARNING in usbnet_start_xmit/usb_submit_urb
    a2da00d1ea1a Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb
    0a44ceba77c3 fs/sysv: Null check to prevent null-ptr-deref bug
    1202deb153d6 net: tap_open(): set sk_uid from current_fsuid()
    1d53ea776760 net: tun_chr_open(): set sk_uid from current_fsuid()
    ae9cf40873d3 mtd: rawnand: meson: fix OOB available bytes for ECC
    8deaaf4be175 mtd: spinand: toshiba: Fix ecc_get_status
    eacb19bd7cd2 USB: zaurus: Add ID for A-300/B-500/C-700
    5107f9e8db60 libceph: fix potential hang in ceph_osdc_notify()
    6f14228e82fe scsi: zfcp: Defer fc_rport blocking until after ADISC response
    a490c2e8927e tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen
    6d49ed957d77 tcp_metrics: annotate data-races around tm->tcpm_net
    fc566cf344d8 tcp_metrics: annotate data-races around tm->tcpm_vals[]
    76b47daba7cd tcp_metrics: annotate data-races around tm->tcpm_lock
    38661fe6d001 tcp_metrics: annotate data-races around tm->tcpm_stamp
    96f14d689dc5 tcp_metrics: fix addr_same() helper
    0438e60a00d4 ip6mr: Fix skb_under_panic in ip6mr_cache_report()
    5b3dbedb8d4a net: dcb: choose correct policy to parse DCB_ATTR_BCN
    363c56f97122 net: ll_temac: fix error checking of irq_of_parse_and_map()
    7928f81443f6 net: ll_temac: Switch to use dev_err_probe() helper
    97d8a0bbda6b driver core: add device probe log helper
    227b8ce59cd3 bpf: sockmap: Remove preempt_disable in sock_map_sk_acquire
    1c8262f31fd2 net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free
    83e3d4b0ae37 net/sched: cls_fw: No longer copy tcf_result on update to avoid use-after-free
    be785808db32 net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free
    b705759a1a25 net: add missing data-race annotation for sk_ll_usec
    95dd65f29070 net: add missing data-race annotations around sk->sk_peek_off
    8a6dddcb47a6 net: add missing READ_ONCE(sk->sk_rcvbuf) annotation
    ec4b7532d70b net: add missing READ_ONCE(sk->sk_sndbuf) annotation
    9cd3adc26e53 net: add missing READ_ONCE(sk->sk_rcvlowat) annotation
    481186cad78f net: annotate data-races around sk->sk_max_pacing_rate
    1774250a20d7 mISDN: hfcpci: Fix potential deadlock on &hc->lock
    42b28808070e net: sched: cls_u32: Fix match key mis-addressing
    1b047dc9108e perf test uprobe_from_different_cu: Skip if there is no gcc
    ad46d4861ed3 rtnetlink: let rtnl_bridge_setlink checks IFLA_BRIDGE_MODE length
    80381ecf2933 net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer()
    800d8c96bf99 net/mlx5: DR, fix memory leak in mlx5dr_cmd_create_reformat_ctx
    4730c0a1131c KVM: s390: fix sthyi error handling
    d2fb0969262c word-at-a-time: use the same return type for has_zero regardless of endianness
    be4d2b456206 loop: Select I/O scheduler 'none' from inside add_disk()
    11e929c38029 perf: Fix function pointer case
    1db90f97d719 arm64: Fix bit-shifting UB in the MIDR_CPU_MODEL() macro
    f41cab7a4653 arm64: Add AMPERE1 to the Spectre-BHB affected list
    6e4aa8c89034 ASoC: cs42l51: fix driver to properly autoload with automatic module loading
    cf8ecd6ea680 net/sched: sch_qfq: account for stab overhead in qfq_enqueue
    0e0f324c259d btrfs: fix race between quota disable and quota assign ioctls
    4f8f86bc5d33 btrfs: qgroup: return ENOTCONN instead of EINVAL when quotas are not enabled
    8c1d1f3a33e5 btrfs: qgroup: remove one-time use variables for quota_root checks
    c8b1499e420e cpufreq: intel_pstate: Drop ACPI _PSS states table patching
    f331413e1cf1 ACPI: processor: perflib: Avoid updating frequency QoS unnecessarily
    511851c87031 ACPI: processor: perflib: Use the "no limit" frequency QoS
    81cd6ceee7ce dm cache policy smq: ensure IO doesn't prevent cleaner policy progress
    e3efc4767a46 ASoC: wm8904: Fill the cache for WM8904_ADC_TEST_0 register
    00748bc586a4 s390/dasd: fix hanging device after quiesce/resume
    73e872466ddc virtio-net: fix race between set queues and probe
    6db2a3c5c201 btrfs: check if the transaction was aborted at btrfs_wait_for_commit()
    5adbd7ccd430 irq-bcm6345-l1: Do not assume a fixed block to cpu mapping
    a0019e13a9e9 tpm_tis: Explicitly check for error code
    d1c6e68003d3 btrfs: check for commit error at btrfs_attach_transaction_barrier()
    ee2eed8306b3 hwmon: (nct7802) Fix for temp6 (PECI1) processed even if PECI1 disabled
    5373a1aa91b2 staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
    352e0cae4cce Documentation: security-bugs.rst: clarify CVE handling
    e331a88ea56b Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group
    fd21197af575 Revert "usb: xhci: tegra: Fix error check"
    e0c92c329131 usb: xhci-mtk: set the dma max_seg_size
    3f39d58a0c1a USB: quirks: add quirk for Focusrite Scarlett
    8f86b1b3b539 usb: ohci-at91: Fix the unhandle interrupt when resume
    640cb5f5e4b4 usb: dwc3: don't reset device side if dwc3 was configured as host-only
    a7d080cf4fab usb: dwc3: pci: skip BYT GPIO lookup table for hardwired phy
    5fc6ace75ceb Revert "usb: dwc3: core: Enable AutoRetry feature in the controller"
    80d40a3d6d45 can: gs_usb: gs_can_close(): add missing set of CAN state to CAN_STATE_STOPPED
    58f0affb3c47 USB: serial: simple: sort driver entries
    43ee3cf0c783 USB: serial: simple: add Kaufmann RKS+CAN VCP
    bcf1fc781ea1 USB: serial: option: add Quectel EC200A module support
    3ec7c5ef6021 USB: serial: option: support Quectel EM060K_128
    da7ebd86cd2e serial: sifive: Fix sifive_serial_console_setup() section
    d674cb90a9ef serial: 8250_dw: Preserve original value of DLF register
    cdcc35e64541 tracing: Fix warning in trace_buffered_event_disable()
    d7b20279244f ring-buffer: Fix wrong stat of cpu_buffer->read
    f6e1e569ac97 ata: pata_ns87415: mark ns87560_tf_read static
    53c06e0d15ee dm raid: fix missing reconfig_mutex unlock in raid_ctr() error paths
    9ebcca93bd41 block: Fix a source code comment in include/uapi/linux/blkzoned.h
    c0aad2fe1b9f ASoC: fsl_spdif: Silence output on stop
    3bd1b4793b01 drm/msm: Fix IS_ERR_OR_NULL() vs NULL check in a5xx_submit_in_rb()
    4970f72f810c drm/msm/adreno: Fix snapshot BINDLESS_DATA size
    5200bd7e6096 drm/msm/dpu: drop enum dpu_core_perf_data_bus_id
    4990f529b745 RDMA/mlx4: Make check for invalid flags stricter
    74843851d418 benet: fix return value check in be_lancer_xmit_workarounds()
    07d9723cef28 net/sched: mqprio: Add length check for TCA_MQPRIO_{MAX/MIN}_RATE64
    2eb617529458 net/sched: mqprio: add extack to mqprio_parse_nlattr()
    29c5eb0ffac7 net/sched: mqprio: refactor nlattr parsing to a separate function
    17afc24d20c9 platform/x86: msi-laptop: Fix rfkill out-of-sync on MSI Wind U100
    504177c84f04 team: reset team's flags when down link is P2P device
    a3bb02598db9 bonding: reset bond's flags when down link is P2P device
    d87d67c8bdd1 tcp: Reduce chance of collisions in inet6_hashfn().
    458294ee1537 ipv6 addrconf: fix bug where deleting a mngtmpaddr can create a new temporary address
    a249705862d7 ethernet: atheros: fix return value check in atl1e_tso_csum()
    195e806b2afb phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()
    27b63e8b8552 vxlan: calculate correct header length for GPE
    5e98318c632d i40e: Fix an NULL vs IS_ERR() bug for debugfs_create_dir()
    6b1ee62ecbf1 ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
    65bd66a794bf keys: Fix linking a duplicate key to a keyring's assoc_array
    c1df96689fe1 uapi: General notification queue definitions
    ea64c727f201 scsi: qla2xxx: Array index may go out of bound
    5e387df414f9 scsi: qla2xxx: Fix inconsistent format argument type in qla_os.c
    629628738078 pwm: meson: fix handling of period/duty if greater than UINT_MAX
    7ae4671a868e pwm: meson: Simplify duplicated per-channel tracking
    8abacc57af7b pwm: meson: Remove redundant assignment to variable fin_freq
    680e1455b828 ftrace: Fix possible warning on checking all pages used in ftrace_process_locs()
    05ff1d355e0b ftrace: Store the order of pages allocated in ftrace_page
    e3098e52bf5a ftrace: Check if pages were allocated before calling free_pages()
    aad84a978841 ftrace: Add information on number of page groups allocated
    bd020c7763d6 fs: dlm: interrupt posix locks only when process is killed
    f61d5752aed0 dlm: rearrange async condition return
    ed092c495e29 dlm: cleanup plock_op vs plock_xop
    a50ad9f8c06c PCI/ASPM: Avoid link retraining race
    e50434e33de9 PCI/ASPM: Factor out pcie_wait_for_retrain()
    7411202a0fee PCI/ASPM: Return 0 or -ETIMEDOUT from pcie_retrain_link()
    8eb15ff216c1 ext4: Fix reusing stale buffer heads from last failed mounting
    0204319de8ea ext4: rename journal_dev to s_journal_dev inside ext4_sb_info
    356056cbe667 btrfs: fix extent buffer leak after tree mod log failure at split_node()
    63008dab58ad btrfs: fix race between quota disable and relocation
    0a55f346e0e5 btrfs: qgroup: catch reserved space leaks at unmount time
    b070f29a6143 bcache: Fix __bch_btree_node_alloc to make the failure behavior consistent
    38a6dd2b68f9 bcache: remove 'int n' from parameter list of bch_bucket_alloc_set()
    edb81d6e1e50 gpio: tps68470: Make tps68470_gpio_output() always set the initial value
    34e71f7d3a03 jbd2: Fix wrongly judgement for buffer head removing while doing checkpoint
    937cb20746c8 jbd2: recheck chechpointing non-dirty buffer
    acc9a81f7cb2 jbd2: remove redundant buffer io error checks
    05d440d0f5da jbd2: fix kernel-doc markups
    b41fa1ed91de jbd2: fix incorrect code style

(From OE-Core rev: d6d1a9c20536d9f8abc60419eec93fec66496964)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Bruce Ashfield
b731a65e4f linux-yocto/5.4: update to v5.4.252
Updating  to the latest korg -stable release that comprises
the following commits:

    21732fd22497 Linux 5.4.252
    9399ea1ce481 x86: fix backwards merge of GDS/SRSO bit
    bc7b9a6c2ca4 xen/netback: Fix buffer overrun triggered by unusual packet
    43ed6f79b3e7 x86/cpu, kvm: Add support for CPUID_80000021_EAX
    1f0618bb2456 x86/bugs: Increase the x86 bugs vector size to two u32s
    08ba48152a8a tools headers cpufeatures: Sync with the kernel sources
    694b40dcfb41 x86/cpufeatures: Assign dedicated feature word for CPUID_0x8000001F[EAX]
    4fa849d4af68 x86/cpu: Add VM page flush MSR availablility as a CPUID feature
    998eec066607 x86/cpufeatures: Add SEV-ES CPU feature
    3e21d8b0f3a9 Documentation/x86: Fix backwards on/off logic about YMM support
    ad7670dd65cb x86/mm: Initialize text poking earlier
    979366f5c2aa mm: Move mm_cachep initialization to mm_init()
    3d1b8cfdd0c9 x86/mm: Use mm_alloc() in poking_init()
    ddcf05fe8850 x86/mm: fix poking_init() for Xen PV guests
    3f8968f1f0ad x86/xen: Fix secondary processors' FPU initialization
    e56c1e0f9134 KVM: Add GDS_NO support to KVM
    ed56430ab253 x86/speculation: Add Kconfig option for GDS
    e35c65794365 x86/speculation: Add force option to GDS mitigation
    f68f9f2df68e x86/speculation: Add Gather Data Sampling mitigation
    6e6044366897 x86/fpu: Move FPU initialization into arch_cpu_finalize_init()
    2ee37a46aa13 x86/fpu: Mark init functions __init
    77fe8150579c x86/fpu: Remove cpuinfo argument from init functions
    95356fff6fee init, x86: Move mem_encrypt_init() into arch_cpu_finalize_init()
    7aa2cec22e28 init: Invoke arch_cpu_finalize_init() earlier
    944d5c3ffa4b init: Remove check_bugs() leftovers
    a03ef708788e um/cpu: Switch to arch_cpu_finalize_init()
    98c3955e145f sparc/cpu: Switch to arch_cpu_finalize_init()
    568d68fc1dd4 sh/cpu: Switch to arch_cpu_finalize_init()
    18cd611a3eaa mips/cpu: Switch to arch_cpu_finalize_init()
    2febb4a73004 m68k/cpu: Switch to arch_cpu_finalize_init()
    1f4494ea77e8 ia64/cpu: Switch to arch_cpu_finalize_init()
    73719e89e32b ARM: cpu: Switch to arch_cpu_finalize_init()
    1743bc756b6b x86/cpu: Switch to arch_cpu_finalize_init()
    afe787cf253b init: Provide arch_cpu_finalize_init()

(From OE-Core rev: 9255ec4beb9eaa6f5d4b8a51a6b2ac4e511309fc)

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Alexander Kanavin
da06aaf910 nasm: update 2.15.03 -> 2.15.05
Use autotools-brokensep as new version needs that.

upgrade include fix for CVE-2020-21686 and CVE-2022-29654

(cherry picked from commit c9c724ffa36757b56e70bc8d7b880c0c5777b153)

(From OE-Core rev: ed262f94b81cbf78e6a335912875bee8a65ca7c6)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Lee Chee Yang
4d9612b31c python3: update to 3.8.18
https://docs.python.org/release/3.8.18/whatsnew/changelog.html#changelog

Release date: 2023-08-24

Security
gh-108310: Fixed an issue where instances of ssl.SSLSocket were
vulnerable to a bypass of the TLS handshake and included protections
(like certificate verification) and treating sent unencrypted data as if
it were post-handshake TLS encrypted data. Security issue reported as
CVE-2023-40217 by Aapo Oksman. Patch by Gregory P. Smith.

Library
gh-107845: tarfile.data_filter() now takes the location of symlinks into
account when determining their target, so it will no longer reject some
valid tarballs with LinkOutsideDestinationError.

Tools/Demos
gh-107565: Update multissltests and GitHub CI workflows to use OpenSSL
1.1.1v, 3.0.10, and 3.1.2.

(From OE-Core rev: 9205496344bede4a16372ca7a02c2819a976640b)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Siddharth Doshi
cbb7afa601 go: Fix CVE-2023-39318 and CVE-2023-39319
Upstream-Status: Backport from [023b542edf]
CVE: CVE-2023-39318
Upstream-Status: Backport from [2070531d2f]
CVE: CVE-2023-39319
(From OE-Core rev: 8de380d765d8f47a961c6e45eba1cfa4d2feb68f)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Lee Chee Yang
f27e86a4d7 qemu: fix CVE-2020-24165
(From OE-Core rev: 93efa56fb87217035275dcb04c4a19b79b95ccaf)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Vijay Anusuri
16c91216f1 ghostscript: fix CVE-2023-36664
Artifex Ghostscript through 10.01.2 mishandles permission validation for
pipe devices (with the %pipe% prefix or the | pipe character prefix).

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2023-36664

Upstream commits:
https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=4ceaf92815302863a8c86fcfcf2347e0118dd3a5
https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=5e65eeae225c7d02d447de5abaf4a8e6d234fcea
https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=fb342fdb60391073a69147cb71af1ac416a81099

(From OE-Core rev: 13534218ec37706d9decca5b5bd0453e312d72b0)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Archana Polampalli
e62c723b0c nasm: fix CVE-2022-44370
NASM v2.16 was discovered to contain a heap buffer overflow in the
component quote_for_pmake() asm/nasm.c:856

References:
https://nvd.nist.gov/vuln/detail/CVE-2022-44370

Upstream patches:
2d4e695241

( cherry picked from commit 1568df72136f46f0767bba56c10c48bf2a1ec259 )

(From OE-Core rev: 91e716b75861f2a4acee58a0c3f95e511058f1dc)

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:51 -10:00
Lee Chee Yang
fe546dca3f libxpm: fix CVE-2022-46285
(From OE-Core rev: bd594af20fce07908f8e0fb1765b0e0ccc641e86)

Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:50 -10:00
Colin McAllister
00722bacdd libwebp: Fix CVE-2023-5129
Add patch from libwebp 1.1.0 to fix CVE-2023-5129.

(From OE-Core rev: 2ab6568d35e3d68f77a73bf56eb2d38aa6ada236)

Signed-off-by: Colin McAllister <colinmca242@gmail.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:50 -10:00
Ashish Sharma
15854dc716 mdadm: Backport fix for CVE-2023-28736
(From OE-Core rev: fb37fa3661095b8ebe68c2ffa36aabf35da30b91)

Signed-off-by: Ashish Sharma <asharma@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-10-04 05:17:50 -10:00
Richard Purdie
f980ef9fec vim: Upgrade 9.0.1664 -> 9.0.1894
This includes multiple CVE fixes.

The license change is due to changes in maintainership, the license
itself is unchanged.

(From OE-Core rev: a9d194f21a3bdebca8aaff204804a5fdc67c76d1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 91e66b93a0c0928f0c2cfe78e22898a6c9800f34)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Archana Polampalli
994a224d40 vim: upgrade 9.0.1592 -> 9.0.1664
Fixes:
https://nvd.nist.gov/vuln/detail/CVE-2023-3896
8154e642a (tag: v9.0.1664) patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' set

(From OE-Core rev: e9591ead43b70da5665f53f8a54f6e0c8f4d0dda)

Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4a1ab744142c9229f03a359b45e5e89a1fbae0d3)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Ross Burton
d32656ac24 gcc: Fix -fstack-protector issue on aarch64
This series of patches fixes deficiencies in GCC's -fstack-protector
implementation for AArch64 when using dynamically allocated stack space.
This is CVE-2023-4039.  See:

https://developer.arm.com/Arm%20Security%20Center/GCC%20Stack%20Protector%20Vulnerability%20AArch64
https://github.com/metaredteam/external-disclosures/security/advisories/GHSA-x7ch-h5rf-w2mf

for more details.

(From OE-Core rev: d411ef9f660c443c00eee9bfbbc8c60c3cd0e92d)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Michael Opdenacker
669079e7c0 flac: fix CVE-2020-22219
Buffer Overflow vulnerability in function bitwriter_grow_ in flac before
1.4.0 allows remote attackers to run arbitrary code via crafted input to
the encoder.

(From OE-Core rev: 87d92cb3d20c2686caddaa29cd17e18850ad9484)

Signed-off-by: Meenali Gupta <meenali.gupta@windriver.com>
Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Tested-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Vijay Anusuri
ea9b55c858 go: Backport fix for CVE-2022-41725 and CVE-2023-24536
Upstream-commit:
874b3132a8
&
4e5a313524
&
5246fa5e75
&
5c55ac9bf1
&
ef41a4e2fa
&
7a359a651c
&
7917b5f312

(From OE-Core rev: 532eb2c57fb1817999a857fc71db4438717ccadb)

Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Siddharth Doshi
0734868d9d libxml2: Fix CVE-2023-39615
Upstream-Status: Backport from [d0c3f01e11, 235b15a590]
CVE: CVE-2023-39615
(From OE-Core rev: d8a585a8c3712cdce9d9a5241ae7e620bc014ed9)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
Siddharth Doshi
007a6e2dad gdb: Fix CVE-2023-39128
Note: The Fix needs to be pushed in gdb rather than bintuils-gdb as we are
disabling gdb in binutils configure.

Upstream-Status: Backport from [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=033bc52bb6190393c8eed80925fa78cc35b40c6d]
CVE: CVE-2023-39128
(From OE-Core rev: c991fdbb63a6de754399ac4fe04288ea66d34c4d)

Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2023-09-29 04:29:01 -10:00
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
268 changed files with 33734 additions and 2618 deletions

24
SECURITY.md Normal file
View File

@@ -0,0 +1,24 @@
How to Report a Potential Vulnerability?
========================================
If you would like to report a public issue (for example, one with a released
CVE number), please report it using the
[https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Security Security Bugzilla].
If you have a patch ready, submit it following the same procedure as any other
patch as described in README.md.
If you are dealing with a not-yet released or urgent issue, please send a
message to security AT yoctoproject DOT org, including as many details as
possible: the layer or software module affected, the recipe and its version,
and any example code, if available.
Branches maintained with security fixes
---------------------------------------
See [https://wiki.yoctoproject.org/wiki/Stable_Release_and_LTS Stable release and LTS]
for detailed info regarding the policies and maintenance of Stable branches.
The [https://wiki.yoctoproject.org/wiki/Releases Release page] contains a list of all
releases of the Yocto Project. Versions in grey are no longer actively maintained with
security patches, but well-tested patches may still be accepted for them for
significant issues.

24
bitbake/SECURITY.md Normal file
View File

@@ -0,0 +1,24 @@
How to Report a Potential Vulnerability?
========================================
If you would like to report a public issue (for example, one with a released
CVE number), please report it using the
[https://bugzilla.yoctoproject.org/enter_bug.cgi?product=Security Security Bugzilla].
If you have a patch ready, submit it following the same procedure as any other
patch as described in README.md.
If you are dealing with a not-yet released or urgent issue, please send a
message to security AT yoctoproject DOT org, including as many details as
possible: the layer or software module affected, the recipe and its version,
and any example code, if available.
Branches maintained with security fixes
---------------------------------------
See [https://wiki.yoctoproject.org/wiki/Stable_Release_and_LTS Stable release and LTS]
for detailed info regarding the policies and maintenance of Stable branches.
The [https://wiki.yoctoproject.org/wiki/Releases Release page] contains a list of all
releases of the Yocto Project. Versions in grey are no longer actively maintained with
security patches, but well-tested patches may still be accepted for them for
significant issues.

View File

@@ -15,6 +15,13 @@ import sys
if sys.version_info < (3, 5, 0):
raise RuntimeError("Sorry, python 3.5.0 or later is required for this version of bitbake")
if sys.version_info < (3, 10, 0):
# With python 3.8 and 3.9, we see errors of "libgcc_s.so.1 must be installed for pthread_cancel to work"
# https://stackoverflow.com/questions/64797838/libgcc-s-so-1-must-be-installed-for-pthread-cancel-to-work
# https://bugs.ams1.psf.io/issue42888
# so ensure libgcc_s is loaded early on
import ctypes
libgcc_s = ctypes.CDLL('libgcc_s.so.1')
class BBHandledException(Exception):
"""

View File

@@ -301,6 +301,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
value += "\n_remove of %s" % r
deps |= r2.references
deps = deps | (keys & r2.execs)
value = handle_contains(value, r2.contains, d)
return value
if "vardepvalue" in varflags:

View File

@@ -229,9 +229,10 @@ class diskMonitor:
freeInode = st.f_favail
if minInode and freeInode < minInode:
# Some filesystems use dynamic inodes so can't run out
# (e.g. btrfs). This is reported by the inode count being 0.
if st.f_files == 0:
# Some filesystems use dynamic inodes so can't run out.
# This is reported by the inode count being 0 (btrfs) or the free
# inode count being -1 (cephfs).
if st.f_files == 0 or st.f_favail == -1:
self.devDict[k][2] = None
continue
# Always show warning, the self.checked would always be False if the action is WARN

View File

@@ -318,7 +318,8 @@ class SignatureGeneratorBasic(SignatureGenerator):
else:
sigfile = stampbase + "." + task + ".sigbasedata" + "." + self.basehash[tid]
bb.utils.mkdirhier(os.path.dirname(sigfile))
with bb.utils.umask(0o002):
bb.utils.mkdirhier(os.path.dirname(sigfile))
data = {}
data['task'] = task

View File

@@ -412,6 +412,32 @@ esac
# Check final value
self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['anothervalue', 'yetanothervalue', 'lastone'])
def test_contains_vardeps_override_operators(self):
# Check override operators handle dependencies correctly with the contains functionality
expr_plain = 'testval'
expr_prepend = '${@bb.utils.filter("TESTVAR1", "testval1", d)} '
expr_append = ' ${@bb.utils.filter("TESTVAR2", "testval2", d)}'
expr_remove = '${@bb.utils.contains("TESTVAR3", "no-testval", "testval", "", d)}'
# Check dependencies
self.d.setVar('ANOTHERVAR', expr_plain)
self.d.prependVar('ANOTHERVAR', expr_prepend)
self.d.appendVar('ANOTHERVAR', expr_append)
self.d.setVar('ANOTHERVAR:remove', expr_remove)
self.d.setVar('TESTVAR1', 'blah')
self.d.setVar('TESTVAR2', 'testval2')
self.d.setVar('TESTVAR3', 'no-testval')
deps, values = bb.data.build_dependencies("ANOTHERVAR", set(self.d.keys()), set(), set(), self.d)
self.assertEqual(sorted(values.splitlines()),
sorted([
expr_prepend + expr_plain + expr_append,
'_remove of ' + expr_remove,
'TESTVAR1{testval1} = Unset',
'TESTVAR2{testval2} = Set',
'TESTVAR3{no-testval} = Set',
]))
# Check final value
self.assertEqual(self.d.getVar('ANOTHERVAR').split(), ['testval2'])
#Currently no wildcard support
#def test_vardeps_wildcards(self):
# self.d.setVar("oe_libinstall", "echo test")

View File

@@ -969,6 +969,17 @@ def which(path, item, direction = 0, history = False, executable=False):
return "", hist
return ""
@contextmanager
def umask(new_mask):
"""
Context manager to set the umask to a specific mask, and restore it afterwards.
"""
current_mask = os.umask(new_mask)
try:
yield
finally:
os.umask(current_mask)
def to_boolean(string, default=None):
if not string:
return default

View File

@@ -11,7 +11,7 @@ import os
import re
import logging
import json
import subprocess
import glob
from collections import Counter
from orm.models import Project, ProjectTarget, Build, Layer_Version
@@ -234,13 +234,11 @@ class XhrSetDefaultImageUrl(View):
def scan_layer_content(layer,layer_version):
# if this is a local layer directory, we can immediately scan its content
if layer.local_source_dir:
if os.path.isdir(layer.local_source_dir):
try:
# recipes-*/*/*.bb
cmd = '%s %s' % ('ls', os.path.join(layer.local_source_dir,'recipes-*/*/*.bb'))
recipes_list = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=subprocess.STDOUT).stdout.read()
recipes_list = recipes_list.decode("utf-8").strip()
if recipes_list and 'No such' not in recipes_list:
recipes_list = glob.glob(os.path.join(layer.local_source_dir, 'recipes-*/*/*.bb'))
for recipe in recipes_list:
for recipe in recipes_list.split('\n'):
recipe_path = recipe[recipe.rfind('recipes-'):]
recipe_name = recipe[recipe.rfind('/')+1:].replace('.bb','')
@@ -260,6 +258,9 @@ def scan_layer_content(layer,layer_version):
except Exception as e:
logger.warning("ERROR:scan_layer_content: %s" % e)
else:
logger.warning("ERROR: wrong path given")
raise KeyError("local_source_dir")
class XhrLayer(View):
""" Delete, Get, Add and Update Layer information

View File

@@ -659,7 +659,7 @@ Follow these steps to locate and download a particular tarball:
Using the Downloads Page
------------------------
The :yocto_home:`Yocto Project Website <>` uses a "DOWNLOADS" page
The :yocto_home:`Yocto Project Website <>` uses a "RELEASES" page
from which you can locate and download tarballs of any Yocto Project
release. Rather than Git repositories, these files represent snapshot
tarballs similar to the tarballs located in the Index of Releases
@@ -676,12 +676,13 @@ Releases <#accessing-index-of-releases>`__" section.
1. *Go to the Yocto Project Website:* Open The
:yocto_home:`Yocto Project Website <>` in your browser.
2. *Get to the Downloads Area:* Select the "DOWNLOADS" item from the
pull-down "SOFTWARE" tab menu near the top of the page.
#. *Get to the Downloads Area:* Select the "RELEASES" item from the
pull-down "DEVELOPMENT" tab menu near the top of the page.
3. *Select a Yocto Project Release:* Use the menu next to "RELEASE" to
display and choose a recent or past supported Yocto Project release
(e.g. &DISTRO_NAME_NO_CAP;, &DISTRO_NAME_NO_CAP_MINUS_ONE;, and so forth).
#. *Select a Yocto Project Release:* On the top of the "RELEASE" page currently
supported releases are displayed, further down past supported Yocto Project
releases are visible. The "Download" links in the rows of the table there
will lead to the download tarballs for the release.
.. note::
@@ -691,9 +692,9 @@ Releases <#accessing-index-of-releases>`__" section.
You can use the "RELEASE ARCHIVE" link to reveal a menu of all Yocto
Project releases.
4. *Download Tools or Board Support Packages (BSPs):* From the
"DOWNLOADS" page, you can download tools or BSPs as well. Just scroll
down the page and look for what you need.
#. *Download Tools or Board Support Packages (BSPs):* Next to the tarballs you
will find download tools or BSPs as well. Just select a Yocto Project
release and look for what you need.
Accessing Nightly Builds
------------------------

View File

@@ -1,13 +1,13 @@
DISTRO : "3.1.27"
DISTRO : "3.1.31"
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.31"
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.31"
DOCCONF_VERSION : "3.1.31"
BITBAKE_SERIES : "1.46"
POKYVERSION : "23.0.27"
POKYVERSION : "23.0.31"
YOCTO_POKY : "poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;"
YOCTO_DL_URL : "https://downloads.yoctoproject.org"
YOCTO_AB_URL : "https://autobuilder.yoctoproject.org"

View File

@@ -1315,16 +1315,6 @@ The following list shows the tests you can list with the ``WARN_QA`` and
automatically get these versions. Consequently, you should only need
to explicitly add dependencies to binary driver recipes.
.. _ref-classes-insserv:
``insserv.bbclass``
===================
The ``insserv`` class uses the ``insserv`` utility to update the order
of symbolic links in ``/etc/rc?.d/`` within an image based on
dependencies specified by LSB headers in the ``init.d`` scripts
themselves.
.. _ref-classes-kernel:
``kernel.bbclass``

View File

@@ -34,19 +34,31 @@ 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 38
- Debian GNU/Linux 11.x (Bullseye)
- AlmaLinux 8
The following distribution versions are still tested even though the
organizations publishing them no longer make updates publicly available:
- Ubuntu 18.04 (LTS)
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
@@ -65,26 +77,24 @@ distributions:
- Fedora 36
- Fedora 37
- 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
.. note::
- While the Yocto Project Team attempts to ensure all Yocto Project

View File

@@ -1,6 +1,6 @@
DISTRO = "poky"
DISTRO_NAME = "Poky (Yocto Project Reference Distro)"
DISTRO_VERSION = "3.1.27"
DISTRO_VERSION = "3.1.31"
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

@@ -97,6 +97,8 @@ def generate_json_report(d, out_path, link_path):
cve_check_merge_jsons(summary, data)
filename = f.readline()
summary["package"].sort(key=lambda d: d['name'])
with open(out_path, "w") as f:
json.dump(summary, f, indent=2)

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)
@@ -404,8 +405,8 @@ kernel_do_install() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
rm "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
# If the kernel/ directory is empty remove it to prevent QA issues
rmdir --ignore-fail-on-non-empty "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel"
else
@@ -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

@@ -99,30 +99,9 @@ TESTIMAGE_DUMP_DIR ?= "${LOG_DIR}/runtime-hostdump/"
TESTIMAGE_UPDATE_VARS ?= "DL_DIR WORKDIR DEPLOY_DIR"
testimage_dump_target () {
top -bn1
ps
free
df
# The next command will export the default gateway IP
export DEFAULT_GATEWAY=$(ip route | awk '/default/ { print $3}')
ping -c3 $DEFAULT_GATEWAY
dmesg
netstat -an
ip address
# Next command will dump logs from /var/log/
find /var/log/ -type f 2>/dev/null -exec echo "====================" \; -exec echo {} \; -exec echo "====================" \; -exec cat {} \; -exec echo "" \;
}
testimage_dump_host () {
top -bn1
iostat -x -z -N -d -p ALL 20 2
ps -ef
free
df
memstat
dmesg
ip -s link
netstat -an
}
python do_testimage() {

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

@@ -75,7 +75,7 @@ def cve_check_merge_jsons(output, data):
for product in output["package"]:
if product["name"] == data["package"][0]["name"]:
bb.error("Error adding the same package twice")
bb.error("Error adding the same package %s twice" % product["name"])
return
output["package"].append(data["package"][0])
@@ -114,11 +114,6 @@ def get_patched_cves(d):
for url in oe.patch.src_patches(d):
patch_file = bb.fetch.decodeurl(url)[2]
# Remote compressed patches may not be unpacked, so silently ignore them
if not os.path.isfile(patch_file):
bb.warn("%s does not exist, cannot extract CVE list" % patch_file)
continue
# Check patch file name for CVE ID
fname_match = cve_file_name_match.search(patch_file)
if fname_match:
@@ -126,6 +121,12 @@ def get_patched_cves(d):
patched_cves.add(cve)
bb.debug(2, "Found CVE %s from patch file name %s" % (cve, patch_file))
# Remote patches won't be present and compressed patches won't be
# unpacked, so say we're not scanning them
if not os.path.isfile(patch_file):
bb.note("%s is remote or compressed, not scanning content" % patch_file)
continue
with open(patch_file, "r", encoding="utf-8") as f:
try:
patch_text = f.read()

View File

@@ -2,6 +2,9 @@
# SPDX-License-Identifier: GPL-2.0-only
#
import os
import shlex
import subprocess
import oe.path
import oe.types
@@ -24,7 +27,6 @@ class CmdError(bb.BBHandledException):
def runcmd(args, dir = None):
import pipes
import subprocess
if dir:
@@ -35,7 +37,7 @@ def runcmd(args, dir = None):
# print("cwd: %s -> %s" % (olddir, dir))
try:
args = [ pipes.quote(str(arg)) for arg in args ]
args = [ shlex.quote(str(arg)) for arg in args ]
cmd = " ".join(args)
# print("cmd: %s" % cmd)
(exitstatus, output) = subprocess.getstatusoutput(cmd)

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

@@ -185,14 +185,8 @@ class TestImage(OESelftestTestCase):
self.skipTest('virgl isn\'t working with Centos 7')
if distro and distro == 'centos-8':
self.skipTest('virgl isn\'t working with Centos 8')
if distro and distro == 'fedora-34':
self.skipTest('virgl isn\'t working with Fedora 34')
if distro and distro == 'fedora-35':
self.skipTest('virgl isn\'t working with Fedora 35')
if distro and distro == 'fedora-36':
self.skipTest('virgl isn\'t working with Fedora 36')
if distro and distro == 'fedora-37':
self.skipTest('virgl isn\'t working with Fedora 37')
if distro and distro.startswith('fedora'):
self.skipTest('virgl isn\'t working with Fedora')
if distro and distro == 'opensuseleap-15.0':
self.skipTest('virgl isn\'t working with Opensuse 15.0')
if distro and distro == 'ubuntu-22.04':

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

@@ -0,0 +1,97 @@
From 43651027d24e62a7a463254165e1e46e42aecdea Mon Sep 17 00:00:00 2001
From: Maxim Suhanov <dfirblog@gmail.com>
Date: Mon, 28 Aug 2023 16:31:57 +0300
Subject: [PATCH] fs/ntfs: Fix an OOB write when parsing the $ATTRIBUTE_LIST
attribute for the $MFT file
When parsing an extremely fragmented $MFT file, i.e., the file described
using the $ATTRIBUTE_LIST attribute, current NTFS code will reuse a buffer
containing bytes read from the underlying drive to store sector numbers,
which are consumed later to read data from these sectors into another buffer.
These sectors numbers, two 32-bit integers, are always stored at predefined
offsets, 0x10 and 0x14, relative to first byte of the selected entry within
the $ATTRIBUTE_LIST attribute. Usually, this won't cause any problem.
However, when parsing a specially-crafted file system image, this may cause
the NTFS code to write these integers beyond the buffer boundary, likely
causing the GRUB memory allocator to misbehave or fail. These integers contain
values which are controlled by on-disk structures of the NTFS file system.
Such modification and resulting misbehavior may touch a memory range not
assigned to the GRUB and owned by firmware or another EFI application/driver.
This fix introduces checks to ensure that these sector numbers are never
written beyond the boundary.
Fixes: CVE-2023-4692
Reported-by: Maxim Suhanov <dfirblog@gmail.com>
Signed-off-by: Maxim Suhanov <dfirblog@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=43651027d24e62a7a463254165e1e46e42aecdea]
CVE: CVE-2023-4692
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
grub-core/fs/ntfs.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c
index 2f34f76..c8d3683 100644
--- a/grub-core/fs/ntfs.c
+++ b/grub-core/fs/ntfs.c
@@ -184,7 +184,7 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr)
}
if (at->attr_end)
{
- grub_uint8_t *pa;
+ grub_uint8_t *pa, *pa_end;
at->emft_buf = grub_malloc (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR);
if (at->emft_buf == NULL)
@@ -209,11 +209,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr)
}
at->attr_nxt = at->edat_buf;
at->attr_end = at->edat_buf + u32at (pa, 0x30);
+ pa_end = at->edat_buf + n;
}
else
{
at->attr_nxt = at->attr_end + u16at (pa, 0x14);
at->attr_end = at->attr_end + u32at (pa, 4);
+ pa_end = at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR);
}
at->flags |= GRUB_NTFS_AF_ALST;
while (at->attr_nxt < at->attr_end)
@@ -230,6 +232,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr)
at->flags |= GRUB_NTFS_AF_GPOS;
at->attr_cur = at->attr_nxt;
pa = at->attr_cur;
+
+ if ((pa >= pa_end) || (pa_end - pa < 0x18))
+ {
+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list");
+ return NULL;
+ }
+
grub_set_unaligned32 ((char *) pa + 0x10,
grub_cpu_to_le32 (at->mft->data->mft_start));
grub_set_unaligned32 ((char *) pa + 0x14,
@@ -240,6 +249,13 @@ find_attr (struct grub_ntfs_attr *at, grub_uint8_t attr)
{
if (*pa != attr)
break;
+
+ if ((pa >= pa_end) || (pa_end - pa < 0x18))
+ {
+ grub_error (GRUB_ERR_BAD_FS, "can\'t parse attribute list");
+ return NULL;
+ }
+
if (read_attr
(at, pa + 0x10,
u32at (pa, 0x10) * (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR),
--
2.25.1

View File

@@ -0,0 +1,62 @@
From 0ed2458cc4eff6d9a9199527e2a0b6d445802f94 Mon Sep 17 00:00:00 2001
From: Maxim Suhanov <dfirblog@gmail.com>
Date: Mon, 28 Aug 2023 16:32:33 +0300
Subject: [PATCH] fs/ntfs: Fix an OOB read when reading data from the resident
$DATA attribute
When reading a file containing resident data, i.e., the file data is stored in
the $DATA attribute within the NTFS file record, not in external clusters,
there are no checks that this resident data actually fits the corresponding
file record segment.
When parsing a specially-crafted file system image, the current NTFS code will
read the file data from an arbitrary, attacker-chosen memory offset and of
arbitrary, attacker-chosen length.
This allows an attacker to display arbitrary chunks of memory, which could
contain sensitive information like password hashes or even plain-text,
obfuscated passwords from BS EFI variables.
This fix implements a check to ensure that resident data is read from the
corresponding file record segment only.
Fixes: CVE-2023-4693
Reported-by: Maxim Suhanov <dfirblog@gmail.com>
Signed-off-by: Maxim Suhanov <dfirblog@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=0ed2458cc4eff6d9a9199527e2a0b6d445802f94]
CVE: CVE-2023-4693
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
grub-core/fs/ntfs.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/grub-core/fs/ntfs.c b/grub-core/fs/ntfs.c
index c8d3683..4d1fe42 100644
--- a/grub-core/fs/ntfs.c
+++ b/grub-core/fs/ntfs.c
@@ -401,7 +401,18 @@ read_data (struct grub_ntfs_attr *at, grub_uint8_t *pa, grub_uint8_t *dest,
{
if (ofs + len > u32at (pa, 0x10))
return grub_error (GRUB_ERR_BAD_FS, "read out of range");
- grub_memcpy (dest, pa + u32at (pa, 0x14) + ofs, len);
+
+ if (u32at (pa, 0x10) > (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR))
+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute too large");
+
+ if (pa >= at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR))
+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range");
+
+ if (u16at (pa, 0x14) + u32at (pa, 0x10) >
+ (grub_addr_t) at->mft->buf + (at->mft->data->mft_size << GRUB_NTFS_BLK_SHR) - (grub_addr_t) pa)
+ return grub_error (GRUB_ERR_BAD_FS, "resident attribute out of range");
+
+ grub_memcpy (dest, pa + u16at (pa, 0x14) + ofs, len);
return 0;
}
--
2.25.1

View File

@@ -109,6 +109,8 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
file://CVE-2020-27749.patch \
file://CVE-2021-20225.patch \
file://CVE-2021-20233.patch \
file://CVE-2023-4692.patch \
file://CVE-2023-4693.patch \
"
SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
@@ -128,6 +130,8 @@ GRUBPLATFORM ??= "pc"
inherit autotools gettext texinfo pkgconfig
CFLAGS_remove = "-O2"
EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \
--disable-grub-mkfont \
--program-prefix="" \

View File

@@ -22,6 +22,15 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2d5025d4aa3495befef8f17206a5b0a1 \
SRC_URI = "https://github.com/lathiat/avahi/releases/download/v${PV}/avahi-${PV}.tar.gz \
file://fix-CVE-2017-6519.patch \
file://CVE-2021-3468.patch \
file://CVE-2023-1981.patch \
file://CVE-2023-38469-1.patch \
file://CVE-2023-38469-2.patch \
file://CVE-2023-38470-1.patch \
file://CVE-2023-38470-2.patch \
file://CVE-2023-38471-1.patch \
file://CVE-2023-38471-2.patch \
file://CVE-2023-38472.patch \
file://CVE-2023-38473.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/lathiat/avahi/releases/"

View File

@@ -0,0 +1,60 @@
Backport of:
From a2696da2f2c50ac43b6c4903f72290d5c3fa9f6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Thu, 17 Nov 2022 01:51:53 +0100
Subject: [PATCH] Emit error if requested service is not found
It currently just crashes instead of replying with error. Check return
value and emit error instead of passing NULL pointer to reply.
Fixes #375
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-1981.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/a2696da2f2c50ac43b6c4903f72290d5c3fa9f6f]
CVE: CVE-2023-1981
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-daemon/dbus-protocol.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
--- a/avahi-daemon/dbus-protocol.c
+++ b/avahi-daemon/dbus-protocol.c
@@ -391,10 +391,14 @@ static DBusHandlerResult msg_server_impl
}
t = avahi_alternative_host_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
+ if (t) {
+ avahi_dbus_respond_string(c, m, t);
+ avahi_free(t);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ } else {
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Hostname not found");
+ }
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "GetAlternativeServiceName")) {
char *n, *t;
@@ -405,10 +409,14 @@ static DBusHandlerResult msg_server_impl
}
t = avahi_alternative_service_name(n);
- avahi_dbus_respond_string(c, m, t);
- avahi_free(t);
-
- return DBUS_HANDLER_RESULT_HANDLED;
+ if (t) {
+ avahi_dbus_respond_string(c, m, t);
+ avahi_free(t);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ } else {
+ return avahi_dbus_respond_error(c, m, AVAHI_ERR_NOT_FOUND, "Service not found");
+ }
} else if (dbus_message_is_method_call(m, AVAHI_DBUS_INTERFACE_SERVER, "EntryGroupNew")) {
Client *client;

View File

@@ -0,0 +1,48 @@
From a337a1ba7d15853fb56deef1f464529af6e3a1cf Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Mon, 23 Oct 2023 20:29:31 +0000
Subject: [PATCH] core: reject overly long TXT resource records
Closes https://github.com/lathiat/avahi/issues/455
CVE-2023-38469
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38469-1.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/a337a1ba7d15853fb56deef1f464529af6e3a1cf]
CVE: CVE-2023-38469
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-core/rr.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: avahi-0.7/avahi-core/rr.c
===================================================================
--- avahi-0.7.orig/avahi-core/rr.c
+++ avahi-0.7/avahi-core/rr.c
@@ -32,6 +32,7 @@
#include <avahi-common/malloc.h>
#include <avahi-common/defs.h>
+#include "dns.h"
#include "rr.h"
#include "log.h"
#include "util.h"
@@ -688,11 +689,17 @@ int avahi_record_is_valid(AvahiRecord *r
case AVAHI_DNS_TYPE_TXT: {
AvahiStringList *strlst;
+ size_t used = 0;
- for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next)
+ for (strlst = r->data.txt.string_list; strlst; strlst = strlst->next) {
if (strlst->size > 255 || strlst->size <= 0)
return 0;
+ used += 1+strlst->size;
+ if (used > AVAHI_DNS_RDATA_MAX)
+ return 0;
+ }
+
return 1;
}
}

View File

@@ -0,0 +1,65 @@
From c6cab87df290448a63323c8ca759baa516166237 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Wed, 25 Oct 2023 18:15:42 +0000
Subject: [PATCH] tests: pass overly long TXT resource records
to make sure they don't crash avahi any more.
It reproduces https://github.com/lathiat/avahi/issues/455
Canonical notes:
nickgalanis> removed first hunk since there is no .github dir in this release
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38469-2.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/c6cab87df290448a63323c8ca759baa516166237]
CVE: CVE-2023-38469
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-client/client-test.c | 14 ++++++++++++++
1 files changed, 14 insertions(+)
Index: avahi-0.7/avahi-client/client-test.c
===================================================================
--- avahi-0.7.orig/avahi-client/client-test.c
+++ avahi-0.7/avahi-client/client-test.c
@@ -22,6 +22,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include <assert.h>
#include <avahi-client/client.h>
@@ -33,6 +34,8 @@
#include <avahi-common/malloc.h>
#include <avahi-common/timeval.h>
+#include <avahi-core/dns.h>
+
static const AvahiPoll *poll_api = NULL;
static AvahiSimplePoll *simple_poll = NULL;
@@ -222,6 +225,9 @@ int main (AVAHI_GCC_UNUSED int argc, AVA
uint32_t cookie;
struct timeval tv;
AvahiAddress a;
+ uint8_t rdata[AVAHI_DNS_RDATA_MAX+1];
+ AvahiStringList *txt = NULL;
+ int r;
simple_poll = avahi_simple_poll_new();
poll_api = avahi_simple_poll_get(simple_poll);
@@ -258,6 +264,14 @@ int main (AVAHI_GCC_UNUSED int argc, AVA
printf("%s\n", avahi_strerror(avahi_entry_group_add_service (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "Lathiat's Site", "_http._tcp", NULL, NULL, 80, "foo=bar", NULL)));
printf("add_record: %d\n", avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "\5booya", 6));
+ memset(rdata, 1, sizeof(rdata));
+ r = avahi_string_list_parse(rdata, sizeof(rdata), &txt);
+ assert(r >= 0);
+ assert(avahi_string_list_serialize(txt, NULL, 0) == sizeof(rdata));
+ error = avahi_entry_group_add_service_strlst(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", "_qotd._tcp", NULL, NULL, 123, txt);
+ assert(error == AVAHI_ERR_INVALID_RECORD);
+ avahi_string_list_free(txt);
+
avahi_entry_group_commit (group);
domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, (char*) "omghai3u");

View File

@@ -0,0 +1,57 @@
From 94cb6489114636940ac683515417990b55b5d66c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Tue, 11 Apr 2023 15:29:59 +0200
Subject: [PATCH] Ensure each label is at least one byte long
The only allowed exception is single dot, where it should return empty
string.
Fixes #454.
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38470-1.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/94cb6489114636940ac683515417990b55b5d66c]
CVE: CVE-2023-38470
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-common/domain-test.c | 14 ++++++++++++++
avahi-common/domain.c | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
Index: avahi-0.7/avahi-common/domain-test.c
===================================================================
--- avahi-0.7.orig/avahi-common/domain-test.c
+++ avahi-0.7/avahi-common/domain-test.c
@@ -45,6 +45,20 @@ int main(AVAHI_GCC_UNUSED int argc, AVAH
printf("%s\n", s = avahi_normalize_name_strdup("fo\\\\o\\..f oo."));
avahi_free(s);
+ printf("%s\n", s = avahi_normalize_name_strdup("."));
+ avahi_free(s);
+
+ s = avahi_normalize_name_strdup(",.=.}.=.?-.}.=.?.?.}.}.?.?.?.z.?.?.}.}."
+ "}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.}.}.}"
+ ".?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.=.=.?.?.}.}.?.?.?.zM.?`"
+ "?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}??.}.}.?.?."
+ "?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM.?`?.}.}.}."
+ "??.?.zM.?`?.}.}.}.?.?.?.r.=.?.}.=.?.?.}.?.?.?.}.=.?.?.}?"
+ "?.}.}.?.?.?.z.?.?.}.}.}.?.?.?.r.=.=.}.=.?.}}.}.?.?.?.zM."
+ "?`?.}.}.}.?.?.?.r.=.=.?.?`.?.?}.}.}.?.?.?.r.=.?.}.=.?.?."
+ "}.?.?.?.}.=.?.?.}");
+ assert(s == NULL);
+
printf("%i\n", avahi_domain_equal("\\065aa bbb\\.\\046cc.cc\\\\.dee.fff.", "Aaa BBB\\.\\.cc.cc\\\\.dee.fff"));
printf("%i\n", avahi_domain_equal("A", "a"));
Index: avahi-0.7/avahi-common/domain.c
===================================================================
--- avahi-0.7.orig/avahi-common/domain.c
+++ avahi-0.7/avahi-common/domain.c
@@ -201,7 +201,7 @@ char *avahi_normalize_name(const char *s
}
if (!empty) {
- if (size < 1)
+ if (size < 2)
return NULL;
*(r++) = '.';

View File

@@ -0,0 +1,53 @@
From 20dec84b2480821704258bc908e7b2bd2e883b24 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Tue, 19 Sep 2023 03:21:25 +0000
Subject: [PATCH] [common] bail out when escaped labels can't fit into ret
Fixes:
```
==93410==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f9e76f14c16 at pc 0x00000047208d bp 0x7ffee90a6a00 sp 0x7ffee90a61c8
READ of size 1110 at 0x7f9e76f14c16 thread T0
#0 0x47208c in __interceptor_strlen (out/fuzz-domain+0x47208c) (BuildId: 731b20c1eef22c2104e75a6496a399b10cfc7cba)
#1 0x534eb0 in avahi_strdup avahi/avahi-common/malloc.c:167:12
#2 0x53862c in avahi_normalize_name_strdup avahi/avahi-common/domain.c:226:12
```
and
```
fuzz-domain: fuzz/fuzz-domain.c:38: int LLVMFuzzerTestOneInput(const uint8_t *, size_t): Assertion `avahi_domain_equal(s, t)' failed.
==101571== ERROR: libFuzzer: deadly signal
#0 0x501175 in __sanitizer_print_stack_trace (/home/vagrant/avahi/out/fuzz-domain+0x501175) (BuildId: 682bf6400aff9d41b64b6e2cc3ef5ad600216ea8)
#1 0x45ad2c in fuzzer::PrintStackTrace() (/home/vagrant/avahi/out/fuzz-domain+0x45ad2c) (BuildId: 682bf6400aff9d41b64b6e2cc3ef5ad600216ea8)
#2 0x43fc07 in fuzzer::Fuzzer::CrashCallback() (/home/vagrant/avahi/out/fuzz-domain+0x43fc07) (BuildId: 682bf6400aff9d41b64b6e2cc3ef5ad600216ea8)
#3 0x7f1581d7ebaf (/lib64/libc.so.6+0x3dbaf) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#4 0x7f1581dcf883 in __pthread_kill_implementation (/lib64/libc.so.6+0x8e883) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#5 0x7f1581d7eafd in gsignal (/lib64/libc.so.6+0x3dafd) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#6 0x7f1581d6787e in abort (/lib64/libc.so.6+0x2687e) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#7 0x7f1581d6779a in __assert_fail_base.cold (/lib64/libc.so.6+0x2679a) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#8 0x7f1581d77186 in __assert_fail (/lib64/libc.so.6+0x36186) (BuildId: c9f62793b9e886eb1b95077d4f26fe2b4aa1ac25)
#9 0x5344a4 in LLVMFuzzerTestOneInput /home/vagrant/avahi/fuzz/fuzz-domain.c:38:9
```
It's a follow-up to 94cb6489114636940ac683515417990b55b5d66c
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38471-2.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/20dec84b2480821704258bc908e7b2bd2e883b24]
CVE: CVE-2023-38470 #Follow-up patch
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-common/domain.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Index: avahi-0.7/avahi-common/domain.c
===================================================================
--- avahi-0.7.orig/avahi-common/domain.c
+++ avahi-0.7/avahi-common/domain.c
@@ -210,7 +210,8 @@ char *avahi_normalize_name(const char *s
} else
empty = 0;
- avahi_escape_label(label, strlen(label), &r, &size);
+ if (!(avahi_escape_label(label, strlen(label), &r, &size)))
+ return NULL;
}
return ret_s;

View File

@@ -0,0 +1,73 @@
From 894f085f402e023a98cbb6f5a3d117bd88d93b09 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 23 Oct 2023 13:38:35 +0200
Subject: [PATCH] core: extract host name using avahi_unescape_label()
Previously we could create invalid escape sequence when we split the
string on dot. For example, from valid host name "foo\\.bar" we have
created invalid name "foo\\" and tried to set that as the host name
which crashed the daemon.
Fixes #453
CVE-2023-38471
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38471-1.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/894f085f402e023a98cbb6f5a3d117bd88d93b09]
CVE: CVE-2023-38471
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-core/server.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
Index: avahi-0.7/avahi-core/server.c
===================================================================
--- avahi-0.7.orig/avahi-core/server.c
+++ avahi-0.7/avahi-core/server.c
@@ -1253,7 +1253,11 @@ static void update_fqdn(AvahiServer *s)
}
int avahi_server_set_host_name(AvahiServer *s, const char *host_name) {
- char *hn = NULL;
+ char label_escaped[AVAHI_LABEL_MAX*4+1];
+ char label[AVAHI_LABEL_MAX];
+ char *hn = NULL, *h;
+ size_t len;
+
assert(s);
AVAHI_CHECK_VALIDITY(s, !host_name || avahi_is_valid_host_name(host_name), AVAHI_ERR_INVALID_HOST_NAME);
@@ -1263,17 +1267,28 @@ int avahi_server_set_host_name(AvahiServ
else
hn = avahi_normalize_name_strdup(host_name);
- hn[strcspn(hn, ".")] = 0;
+ h = hn;
+ if (!avahi_unescape_label((const char **)&hn, label, sizeof(label))) {
+ avahi_free(h);
+ return AVAHI_ERR_INVALID_HOST_NAME;
+ }
+
+ avahi_free(h);
- if (avahi_domain_equal(s->host_name, hn) && s->state != AVAHI_SERVER_COLLISION) {
- avahi_free(hn);
+ h = label_escaped;
+ len = sizeof(label_escaped);
+ if (!avahi_escape_label(label, strlen(label), &h, &len))
+ return AVAHI_ERR_INVALID_HOST_NAME;
+
+ if (avahi_domain_equal(s->host_name, label_escaped) && s->state != AVAHI_SERVER_COLLISION)
return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
- }
withdraw_host_rrs(s);
avahi_free(s->host_name);
- s->host_name = hn;
+ s->host_name = avahi_strdup(label_escaped);
+ if (!s->host_name)
+ return AVAHI_ERR_NO_MEMORY;
update_fqdn(s);

View File

@@ -0,0 +1,52 @@
From b675f70739f404342f7f78635d6e2dcd85a13460 Mon Sep 17 00:00:00 2001
From: Evgeny Vereshchagin <evvers@ya.ru>
Date: Tue, 24 Oct 2023 22:04:51 +0000
Subject: [PATCH] core: return errors from avahi_server_set_host_name properly
It's a follow-up to 894f085f402e023a98cbb6f5a3d117bd88d93b09
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38471-2.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/b675f70739f404342f7f78635d6e2dcd85a13460]
CVE: CVE-2023-38471 #Follow-up Patch
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-core/server.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: avahi-0.7/avahi-core/server.c
===================================================================
--- avahi-0.7.orig/avahi-core/server.c
+++ avahi-0.7/avahi-core/server.c
@@ -1267,10 +1267,13 @@ int avahi_server_set_host_name(AvahiServ
else
hn = avahi_normalize_name_strdup(host_name);
+ if (!hn)
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
+
h = hn;
if (!avahi_unescape_label((const char **)&hn, label, sizeof(label))) {
avahi_free(h);
- return AVAHI_ERR_INVALID_HOST_NAME;
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
}
avahi_free(h);
@@ -1278,7 +1281,7 @@ int avahi_server_set_host_name(AvahiServ
h = label_escaped;
len = sizeof(label_escaped);
if (!avahi_escape_label(label, strlen(label), &h, &len))
- return AVAHI_ERR_INVALID_HOST_NAME;
+ return avahi_server_set_errno(s, AVAHI_ERR_INVALID_HOST_NAME);
if (avahi_domain_equal(s->host_name, label_escaped) && s->state != AVAHI_SERVER_COLLISION)
return avahi_server_set_errno(s, AVAHI_ERR_NO_CHANGE);
@@ -1288,7 +1291,7 @@ int avahi_server_set_host_name(AvahiServ
avahi_free(s->host_name);
s->host_name = avahi_strdup(label_escaped);
if (!s->host_name)
- return AVAHI_ERR_NO_MEMORY;
+ return avahi_server_set_errno(s, AVAHI_ERR_NO_MEMORY);
update_fqdn(s);

View File

@@ -0,0 +1,45 @@
From b024ae5749f4aeba03478e6391687c3c9c8dee40 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Thu, 19 Oct 2023 17:36:44 +0200
Subject: [PATCH] core: make sure there is rdata to process before parsing it
Fixes #452
CVE-2023-38472
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38472.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/b024ae5749f4aeba03478e6391687c3c9c8dee40]
CVE: CVE-2023-38472
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-client/client-test.c | 3 +++
avahi-daemon/dbus-entry-group.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
Index: avahi-0.7/avahi-client/client-test.c
===================================================================
--- avahi-0.7.orig/avahi-client/client-test.c
+++ avahi-0.7/avahi-client/client-test.c
@@ -272,6 +272,9 @@ int main (AVAHI_GCC_UNUSED int argc, AVA
assert(error == AVAHI_ERR_INVALID_RECORD);
avahi_string_list_free(txt);
+ error = avahi_entry_group_add_record (group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, "TestX", 0x01, 0x10, 120, "", 0);
+ assert(error != AVAHI_OK);
+
avahi_entry_group_commit (group);
domain = avahi_domain_browser_new (avahi, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, NULL, AVAHI_DOMAIN_BROWSER_BROWSE, 0, avahi_domain_browser_callback, (char*) "omghai3u");
Index: avahi-0.7/avahi-daemon/dbus-entry-group.c
===================================================================
--- avahi-0.7.orig/avahi-daemon/dbus-entry-group.c
+++ avahi-0.7/avahi-daemon/dbus-entry-group.c
@@ -340,7 +340,7 @@ DBusHandlerResult avahi_dbus_msg_entry_g
if (!(r = avahi_record_new_full (name, clazz, type, ttl)))
return avahi_dbus_respond_error(c, m, AVAHI_ERR_NO_MEMORY, NULL);
- if (avahi_rdata_parse (r, rdata, size) < 0) {
+ if (!rdata || avahi_rdata_parse (r, rdata, size) < 0) {
avahi_record_unref (r);
return avahi_dbus_respond_error(c, m, AVAHI_ERR_INVALID_RDATA, NULL);
}

View File

@@ -0,0 +1,109 @@
From b448c9f771bada14ae8de175695a9729f8646797 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 11 Oct 2023 17:45:44 +0200
Subject: [PATCH] common: derive alternative host name from its unescaped
version
Normalization of input makes sure we don't have to deal with special
cases like unescaped dot at the end of label.
Fixes #451 #487
CVE-2023-38473
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/avahi/tree/debian/patches/CVE-2023-38473.patch?h=ubuntu/focal-security
Upstream commit https://github.com/lathiat/avahi/commit/b448c9f771bada14ae8de175695a9729f8646797]
CVE: CVE-2023-38473
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
avahi-common/alternative-test.c | 3 +++
avahi-common/alternative.c | 27 +++++++++++++++++++--------
2 files changed, 22 insertions(+), 8 deletions(-)
Index: avahi-0.7/avahi-common/alternative-test.c
===================================================================
--- avahi-0.7.orig/avahi-common/alternative-test.c
+++ avahi-0.7/avahi-common/alternative-test.c
@@ -31,6 +31,9 @@ int main(AVAHI_GCC_UNUSED int argc, AVAH
const char* const test_strings[] = {
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXüüüüüüü",
+ ").",
+ "\\.",
+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\\",
"gurke",
"-",
" #",
Index: avahi-0.7/avahi-common/alternative.c
===================================================================
--- avahi-0.7.orig/avahi-common/alternative.c
+++ avahi-0.7/avahi-common/alternative.c
@@ -49,15 +49,20 @@ static void drop_incomplete_utf8(char *c
}
char *avahi_alternative_host_name(const char *s) {
+ char label[AVAHI_LABEL_MAX], alternative[AVAHI_LABEL_MAX*4+1];
+ char *alt, *r, *ret;
const char *e;
- char *r;
+ size_t len;
assert(s);
if (!avahi_is_valid_host_name(s))
return NULL;
- if ((e = strrchr(s, '-'))) {
+ if (!avahi_unescape_label(&s, label, sizeof(label)))
+ return NULL;
+
+ if ((e = strrchr(label, '-'))) {
const char *p;
e++;
@@ -74,19 +79,18 @@ char *avahi_alternative_host_name(const
if (e) {
char *c, *m;
- size_t l;
int n;
n = atoi(e)+1;
if (!(m = avahi_strdup_printf("%i", n)))
return NULL;
- l = e-s-1;
+ len = e-label-1;
- if (l >= AVAHI_LABEL_MAX-1-strlen(m)-1)
- l = AVAHI_LABEL_MAX-1-strlen(m)-1;
+ if (len >= AVAHI_LABEL_MAX-1-strlen(m)-1)
+ len = AVAHI_LABEL_MAX-1-strlen(m)-1;
- if (!(c = avahi_strndup(s, l))) {
+ if (!(c = avahi_strndup(label, len))) {
avahi_free(m);
return NULL;
}
@@ -100,7 +104,7 @@ char *avahi_alternative_host_name(const
} else {
char *c;
- if (!(c = avahi_strndup(s, AVAHI_LABEL_MAX-1-2)))
+ if (!(c = avahi_strndup(label, AVAHI_LABEL_MAX-1-2)))
return NULL;
drop_incomplete_utf8(c);
@@ -109,6 +113,13 @@ char *avahi_alternative_host_name(const
avahi_free(c);
}
+ alt = alternative;
+ len = sizeof(alternative);
+ ret = avahi_escape_label(r, strlen(r), &alt, &len);
+
+ avahi_free(r);
+ r = avahi_strdup(ret);
+
assert(avahi_is_valid_host_name(r));
return r;

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

@@ -0,0 +1,175 @@
From c4fac5ca98efd02fbaef43601627c7a3a09f5a71 Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Tue, 20 Jun 2023 15:21:36 +1000
Subject: [PATCH] Limit isccc_cc_fromwire recursion depth
Named and rndc do not need a lot of recursion so the depth is
set to 10.
Taken from BIND 9.16.44 change.
Upstream-Status: Backport [https://gitlab.isc.org/isc-projects/bind9/-/commit/c4fac5ca98efd02fbaef43601627c7a3a09f5a71]
CVE: CVE-2023-3341
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
lib/isccc/cc.c | 38 +++++++++++++++++++++++---------
lib/isccc/include/isccc/result.h | 4 +++-
lib/isccc/result.c | 4 +++-
3 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c
index e012685..8eac3d6 100644
--- a/lib/isccc/cc.c
+++ b/lib/isccc/cc.c
@@ -53,6 +53,10 @@
#define MAX_TAGS 256
#define DUP_LIFETIME 900
+#ifndef ISCCC_MAXDEPTH
+#define ISCCC_MAXDEPTH \
+ 10 /* Big enough for rndc which just sends a string each way. */
+#endif
typedef isccc_sexpr_t *sexpr_ptr;
@@ -561,19 +565,25 @@ verify(isccc_sexpr_t *alist, unsigned char *data, unsigned int length,
static isc_result_t
table_fromwire(isccc_region_t *source, isccc_region_t *secret,
- uint32_t algorithm, isccc_sexpr_t **alistp);
+ uint32_t algorithm, unsigned int depth, isccc_sexpr_t **alistp);
static isc_result_t
-list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp);
+list_fromwire(isccc_region_t *source, unsigned int depth,
+ isccc_sexpr_t **listp);
static isc_result_t
-value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) {
+value_fromwire(isccc_region_t *source, unsigned int depth,
+ isccc_sexpr_t **valuep) {
unsigned int msgtype;
uint32_t len;
isccc_sexpr_t *value;
isccc_region_t active;
isc_result_t result;
+ if (depth > ISCCC_MAXDEPTH) {
+ return (ISCCC_R_MAXDEPTH);
+ }
+
if (REGION_SIZE(*source) < 1 + 4)
return (ISC_R_UNEXPECTEDEND);
GET8(msgtype, source->rstart);
@@ -591,9 +601,9 @@ value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) {
} else
result = ISC_R_NOMEMORY;
} else if (msgtype == ISCCC_CCMSGTYPE_TABLE)
- result = table_fromwire(&active, NULL, 0, valuep);
+ result = table_fromwire(&active, NULL, 0, depth + 1, valuep);
else if (msgtype == ISCCC_CCMSGTYPE_LIST)
- result = list_fromwire(&active, valuep);
+ result = list_fromwire(&active, depth + 1, valuep);
else
result = ISCCC_R_SYNTAX;
@@ -602,7 +612,7 @@ value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) {
static isc_result_t
table_fromwire(isccc_region_t *source, isccc_region_t *secret,
- uint32_t algorithm, isccc_sexpr_t **alistp)
+ uint32_t algorithm, unsigned int depth, isccc_sexpr_t **alistp)
{
char key[256];
uint32_t len;
@@ -613,6 +623,10 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret,
REQUIRE(alistp != NULL && *alistp == NULL);
+ if (depth > ISCCC_MAXDEPTH) {
+ return (ISCCC_R_MAXDEPTH);
+ }
+
checksum_rstart = NULL;
first_tag = true;
alist = isccc_alist_create();
@@ -628,7 +642,7 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret,
GET_MEM(key, len, source->rstart);
key[len] = '\0'; /* Ensure NUL termination. */
value = NULL;
- result = value_fromwire(source, &value);
+ result = value_fromwire(source, depth + 1, &value);
if (result != ISC_R_SUCCESS)
goto bad;
if (isccc_alist_define(alist, key, value) == NULL) {
@@ -661,14 +675,18 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret,
}
static isc_result_t
-list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) {
+list_fromwire(isccc_region_t *source, unsigned int depth, isccc_sexpr_t **listp) {
isccc_sexpr_t *list, *value;
isc_result_t result;
+ if (depth > ISCCC_MAXDEPTH) {
+ return (ISCCC_R_MAXDEPTH);
+ }
+
list = NULL;
while (!REGION_EMPTY(*source)) {
value = NULL;
- result = value_fromwire(source, &value);
+ result = value_fromwire(source, depth + 1, &value);
if (result != ISC_R_SUCCESS) {
isccc_sexpr_free(&list);
return (result);
@@ -699,7 +717,7 @@ isccc_cc_fromwire(isccc_region_t *source, isccc_sexpr_t **alistp,
if (version != 1)
return (ISCCC_R_UNKNOWNVERSION);
- return (table_fromwire(source, secret, algorithm, alistp));
+ return (table_fromwire(source, secret, algorithm, 0, alistp));
}
static isc_result_t
diff --git a/lib/isccc/include/isccc/result.h b/lib/isccc/include/isccc/result.h
index 6c79dd7..a85861c 100644
--- a/lib/isccc/include/isccc/result.h
+++ b/lib/isccc/include/isccc/result.h
@@ -47,8 +47,10 @@
#define ISCCC_R_CLOCKSKEW (ISC_RESULTCLASS_ISCCC + 4)
/*% Duplicate */
#define ISCCC_R_DUPLICATE (ISC_RESULTCLASS_ISCCC + 5)
+/*% Maximum recursion depth */
+#define ISCCC_R_MAXDEPTH (ISC_RESULTCLASS_ISCCC + 6)
-#define ISCCC_R_NRESULTS 6 /*%< Number of results */
+#define ISCCC_R_NRESULTS 7 /*%< Number of results */
ISC_LANG_BEGINDECLS
diff --git a/lib/isccc/result.c b/lib/isccc/result.c
index 8419bbb..325200b 100644
--- a/lib/isccc/result.c
+++ b/lib/isccc/result.c
@@ -40,7 +40,8 @@ static const char *text[ISCCC_R_NRESULTS] = {
"bad auth", /* 3 */
"expired", /* 4 */
"clock skew", /* 5 */
- "duplicate" /* 6 */
+ "duplicate", /* 6 */
+ "max depth", /* 7 */
};
static const char *ids[ISCCC_R_NRESULTS] = {
@@ -50,6 +51,7 @@ static const char *ids[ISCCC_R_NRESULTS] = {
"ISCCC_R_EXPIRED",
"ISCCC_R_CLOCKSKEW",
"ISCCC_R_DUPLICATE",
+ "ISCCC_R_MAXDEPTH",
};
#define ISCCC_RESULT_RESULTSET 2
--
2.25.1

View File

@@ -22,6 +22,8 @@ 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 \
file://CVE-2023-3341.patch \
"
SRC_URI[sha256sum] = "0d8efbe7ec166ada90e46add4267b7e7c934790cba9bd5af6b8380a4fbfb5aff"

View File

@@ -59,6 +59,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
file://CVE-2022-0204.patch \
file://CVE-2022-39176.patch \
file://CVE-2022-3637.patch \
file://CVE-2023-45866.patch \
"
S = "${WORKDIR}/bluez-${PV}"

View File

@@ -0,0 +1,54 @@
From 25a471a83e02e1effb15d5a488b3f0085eaeb675 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Tue, 10 Oct 2023 13:03:12 -0700
Subject: input.conf: Change default of ClassicBondedOnly
This changes the default of ClassicBondedOnly since defaulting to false
is not inline with HID specification which mandates the of Security Mode
4:
BLUETOOTH SPECIFICATION Page 84 of 123
Human Interface Device (HID) Profile:
5.4.3.4.2 Security Modes
Bluetooth HID Hosts shall use Security Mode 4 when interoperating with
Bluetooth HID devices that are compliant to the Bluetooth Core
Specification v2.1+EDR[6].
Upstream-Status: Backport [https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=25a471a83e02e1effb15d5a488b3f0085eaeb675]
CVE: CVE-2023-45866
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
---
profiles/input/device.c | 2 +-
profiles/input/input.conf | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 375314e..0236488 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -93,7 +93,7 @@ struct input_device {
static int idle_timeout = 0;
static bool uhid_enabled = false;
-static bool classic_bonded_only = false;
+static bool classic_bonded_only = true;
void input_set_idle_timeout(int timeout)
{
diff --git a/profiles/input/input.conf b/profiles/input/input.conf
index 4c70bc5..d8645f3 100644
--- a/profiles/input/input.conf
+++ b/profiles/input/input.conf
@@ -17,7 +17,7 @@
# platforms may want to make sure that input connections only come from bonded
# device connections. Several older mice have been known for not supporting
# pairing/encryption.
-# Defaults to false to maximize device compatibility.
+# Defaults to true for security.
#ClassicBondedOnly=true
# LE upgrade security
--
2.25.1

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

@@ -0,0 +1,468 @@
(modified to not remove ssh_packet_read_expect(), to add to
KexAlgorithms in sshd.c and sshconnect2.c as this version pre-dates
kex_proposal_populate_entries(), replace debug*_f() with debug*(),
error*_f() with error*(), and fatal_f() with fatal())
Backport of:
From 1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Mon, 18 Dec 2023 14:45:17 +0000
Subject: [PATCH] upstream: implement "strict key exchange" in ssh and sshd
This adds a protocol extension to improve the integrity of the SSH
transport protocol, particular in and around the initial key exchange
(KEX) phase.
Full details of the extension are in the PROTOCOL file.
with markus@
OpenBSD-Commit-ID: 2a66ac962f0a630d7945fee54004ed9e9c439f14
Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/openssh/tree/debian/patches/CVE-2023-48795.patch?h=ubuntu/focal-security
Upstream commit https://github.com/openssh/openssh-portable/commit/1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5]
CVE: CVE-2023-48795
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
PROTOCOL | 26 +++++++++++++++++
kex.c | 68 +++++++++++++++++++++++++++++++++-----------
kex.h | 1 +
packet.c | 78 ++++++++++++++++++++++++++++++++++++++-------------
sshconnect2.c | 14 +++------
sshd.c | 7 +++--
6 files changed, 146 insertions(+), 48 deletions(-)
diff --git a/PROTOCOL b/PROTOCOL
index f75c1c0..89bddfe 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -102,6 +102,32 @@ OpenSSH supports the use of ECDH in Curve25519 for key exchange as
described at:
http://git.libssh.org/users/aris/libssh.git/plain/doc/curve25519-sha256@libssh.org.txt?h=curve25519
+1.9 transport: strict key exchange extension
+
+OpenSSH supports a number of transport-layer hardening measures under
+a "strict KEX" feature. This feature is signalled similarly to the
+RFC8308 ext-info feature: by including a additional algorithm in the
+initiial SSH2_MSG_KEXINIT kex_algorithms field. The client may append
+"kex-strict-c-v00@openssh.com" to its kex_algorithms and the server
+may append "kex-strict-s-v00@openssh.com". These pseudo-algorithms
+are only valid in the initial SSH2_MSG_KEXINIT and MUST be ignored
+if they are present in subsequent SSH2_MSG_KEXINIT packets.
+
+When an endpoint that supports this extension observes this algorithm
+name in a peer's KEXINIT packet, it MUST make the following changes to
+the the protocol:
+
+a) During initial KEX, terminate the connection if any unexpected or
+ out-of-sequence packet is received. This includes terminating the
+ connection if the first packet received is not SSH2_MSG_KEXINIT.
+ Unexpected packets for the purpose of strict KEX include messages
+ that are otherwise valid at any time during the connection such as
+ SSH2_MSG_DEBUG and SSH2_MSG_IGNORE.
+b) After sending or receiving a SSH2_MSG_NEWKEYS message, reset the
+ packet sequence number to zero. This behaviour persists for the
+ duration of the connection (i.e. not just the first
+ SSH2_MSG_NEWKEYS).
+
2. Connection protocol changes
2.1. connection: Channel write close extension "eow@openssh.com"
diff --git a/kex.c b/kex.c
index ce85f04..3129a4e 100644
--- a/kex.c
+++ b/kex.c
@@ -63,7 +63,7 @@
#include "digest.h"
/* prototype */
-static int kex_choose_conf(struct ssh *);
+static int kex_choose_conf(struct ssh *, uint32_t seq);
static int kex_input_newkeys(int, u_int32_t, struct ssh *);
static const char *proposal_names[PROPOSAL_MAX] = {
@@ -173,6 +173,18 @@ kex_names_valid(const char *names)
return 1;
}
+/* returns non-zero if proposal contains any algorithm from algs */
+static int
+has_any_alg(const char *proposal, const char *algs)
+{
+ char *cp;
+
+ if ((cp = match_list(proposal, algs, NULL)) == NULL)
+ return 0;
+ free(cp);
+ return 1;
+}
+
/*
* Concatenate algorithm names, avoiding duplicates in the process.
* Caller must free returned string.
@@ -180,7 +192,7 @@ kex_names_valid(const char *names)
char *
kex_names_cat(const char *a, const char *b)
{
- char *ret = NULL, *tmp = NULL, *cp, *p, *m;
+ char *ret = NULL, *tmp = NULL, *cp, *p;
size_t len;
if (a == NULL || *a == '\0')
@@ -197,10 +209,8 @@ kex_names_cat(const char *a, const char *b)
}
strlcpy(ret, a, len);
for ((p = strsep(&cp, ",")); p && *p != '\0'; (p = strsep(&cp, ","))) {
- if ((m = match_list(ret, p, NULL)) != NULL) {
- free(m);
+ if (has_any_alg(ret, p))
continue; /* Algorithm already present */
- }
if (strlcat(ret, ",", len) >= len ||
strlcat(ret, p, len) >= len) {
free(tmp);
@@ -409,7 +419,12 @@ kex_protocol_error(int type, u_int32_t seq, struct ssh *ssh)
{
int r;
- error("kex protocol error: type %d seq %u", type, seq);
+ /* If in strict mode, any unexpected message is an error */
+ if ((ssh->kex->flags & KEX_INITIAL) && ssh->kex->kex_strict) {
+ ssh_packet_disconnect(ssh, "strict KEX violation: "
+ "unexpected packet type %u (seqnr %u)", type, seq);
+ }
+ error("type %u seq %u", type, seq);
if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 ||
(r = sshpkt_put_u32(ssh, seq)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
@@ -481,6 +496,11 @@ kex_input_ext_info(int type, u_int32_t seq, struct ssh *ssh)
ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &kex_protocol_error);
if ((r = sshpkt_get_u32(ssh, &ninfo)) != 0)
return r;
+ if (ninfo >= 1024) {
+ error("SSH2_MSG_EXT_INFO with too many entries, expected "
+ "<=1024, received %u", ninfo);
+ return dispatch_protocol_error(type, seq, ssh);
+ }
for (i = 0; i < ninfo; i++) {
if ((r = sshpkt_get_cstring(ssh, &name, NULL)) != 0)
return r;
@@ -581,7 +601,7 @@ kex_input_kexinit(int type, u_int32_t seq, struct ssh *ssh)
error("%s: no hex", __func__);
return SSH_ERR_INTERNAL_ERROR;
}
- ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL);
+ ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_protocol_error);
ptr = sshpkt_ptr(ssh, &dlen);
if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
return r;
@@ -617,7 +637,7 @@ kex_input_kexinit(int type, u_int32_t seq, struct ssh *ssh)
if (!(kex->flags & KEX_INIT_SENT))
if ((r = kex_send_kexinit(ssh)) != 0)
return r;
- if ((r = kex_choose_conf(ssh)) != 0)
+ if ((r = kex_choose_conf(ssh, seq)) != 0)
return r;
if (kex->kex_type < KEX_MAX && kex->kex[kex->kex_type] != NULL)
@@ -880,7 +900,13 @@ proposals_match(char *my[PROPOSAL_MAX], char *peer[PROPOSAL_MAX])
}
static int
-kex_choose_conf(struct ssh *ssh)
+kexalgs_contains(char **peer, const char *ext)
+{
+ return has_any_alg(peer[PROPOSAL_KEX_ALGS], ext);
+}
+
+static int
+kex_choose_conf(struct ssh *ssh, uint32_t seq)
{
struct kex *kex = ssh->kex;
struct newkeys *newkeys;
@@ -905,13 +931,23 @@ kex_choose_conf(struct ssh *ssh)
sprop=peer;
}
- /* Check whether client supports ext_info_c */
- if (kex->server && (kex->flags & KEX_INITIAL)) {
- char *ext;
-
- ext = match_list("ext-info-c", peer[PROPOSAL_KEX_ALGS], NULL);
- kex->ext_info_c = (ext != NULL);
- free(ext);
+ /* Check whether peer supports ext_info/kex_strict */
+ if ((kex->flags & KEX_INITIAL) != 0) {
+ if (kex->server) {
+ kex->ext_info_c = kexalgs_contains(peer, "ext-info-c");
+ kex->kex_strict = kexalgs_contains(peer,
+ "kex-strict-c-v00@openssh.com");
+ } else {
+ kex->kex_strict = kexalgs_contains(peer,
+ "kex-strict-s-v00@openssh.com");
+ }
+ if (kex->kex_strict) {
+ debug3("will use strict KEX ordering");
+ if (seq != 0)
+ ssh_packet_disconnect(ssh,
+ "strict KEX violation: "
+ "KEXINIT was not the first packet");
+ }
}
/* Algorithm Negotiation */
diff --git a/kex.h b/kex.h
index a5ae6ac..cae38f7 100644
--- a/kex.h
+++ b/kex.h
@@ -145,6 +145,7 @@ struct kex {
u_int kex_type;
char *server_sig_algs;
int ext_info_c;
+ int kex_strict;
struct sshbuf *my;
struct sshbuf *peer;
struct sshbuf *client_version;
diff --git a/packet.c b/packet.c
index 6d3e917..43139f9 100644
--- a/packet.c
+++ b/packet.c
@@ -1203,8 +1203,13 @@ ssh_packet_send2_wrapped(struct ssh *ssh)
sshbuf_dump(state->output, stderr);
#endif
/* increment sequence number for outgoing packets */
- if (++state->p_send.seqnr == 0)
+ if (++state->p_send.seqnr == 0) {
+ if ((ssh->kex->flags & KEX_INITIAL) != 0) {
+ ssh_packet_disconnect(ssh, "outgoing sequence number "
+ "wrapped during initial key exchange");
+ }
logit("outgoing seqnr wraps around");
+ }
if (++state->p_send.packets == 0)
if (!(ssh->compat & SSH_BUG_NOREKEY))
return SSH_ERR_NEED_REKEY;
@@ -1212,6 +1217,11 @@ ssh_packet_send2_wrapped(struct ssh *ssh)
state->p_send.bytes += len;
sshbuf_reset(state->outgoing_packet);
+ if (type == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
+ debug("resetting send seqnr %u", state->p_send.seqnr);
+ state->p_send.seqnr = 0;
+ }
+
if (type == SSH2_MSG_NEWKEYS)
r = ssh_set_newkeys(ssh, MODE_OUT);
else if (type == SSH2_MSG_USERAUTH_SUCCESS && state->server_side)
@@ -1345,8 +1355,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
/* Stay in the loop until we have received a complete packet. */
for (;;) {
/* Try to read a packet from the buffer. */
- r = ssh_packet_read_poll_seqnr(ssh, typep, seqnr_p);
- if (r != 0)
+ if ((r = ssh_packet_read_poll_seqnr(ssh, typep, seqnr_p)) != 0)
break;
/* If we got a packet, return it. */
if (*typep != SSH_MSG_NONE)
@@ -1633,10 +1642,16 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
if ((r = sshbuf_consume(state->input, mac->mac_len)) != 0)
goto out;
}
+
if (seqnr_p != NULL)
*seqnr_p = state->p_read.seqnr;
- if (++state->p_read.seqnr == 0)
+ if (++state->p_read.seqnr == 0) {
+ if ((ssh->kex->flags & KEX_INITIAL) != 0) {
+ ssh_packet_disconnect(ssh, "incoming sequence number "
+ "wrapped during initial key exchange");
+ }
logit("incoming seqnr wraps around");
+ }
if (++state->p_read.packets == 0)
if (!(ssh->compat & SSH_BUG_NOREKEY))
return SSH_ERR_NEED_REKEY;
@@ -1702,6 +1717,10 @@ ssh_packet_read_poll2(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
#endif
/* reset for next packet */
state->packlen = 0;
+ if (*typep == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
+ debug("resetting read seqnr %u", state->p_read.seqnr);
+ state->p_read.seqnr = 0;
+ }
/* do we need to rekey? */
if (ssh_packet_need_rekeying(ssh, 0)) {
@@ -1726,10 +1745,39 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
r = ssh_packet_read_poll2(ssh, typep, seqnr_p);
if (r != 0)
return r;
- if (*typep) {
- state->keep_alive_timeouts = 0;
- DBG(debug("received packet type %d", *typep));
+ if (*typep == 0) {
+ /* no message ready */
+ return 0;
+ }
+ state->keep_alive_timeouts = 0;
+ DBG(debug("received packet type %d", *typep));
+
+ /* Always process disconnect messages */
+ if (*typep == SSH2_MSG_DISCONNECT) {
+ if ((r = sshpkt_get_u32(ssh, &reason)) != 0 ||
+ (r = sshpkt_get_string(ssh, &msg, NULL)) != 0)
+ return r;
+ /* Ignore normal client exit notifications */
+ do_log2(ssh->state->server_side &&
+ reason == SSH2_DISCONNECT_BY_APPLICATION ?
+ SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_ERROR,
+ "Received disconnect from %s port %d:"
+ "%u: %.400s", ssh_remote_ipaddr(ssh),
+ ssh_remote_port(ssh), reason, msg);
+ free(msg);
+ return SSH_ERR_DISCONNECTED;
}
+
+ /*
+ * Do not implicitly handle any messages here during initial
+ * KEX when in strict mode. They will be need to be allowed
+ * explicitly by the KEX dispatch table or they will generate
+ * protocol errors.
+ */
+ if (ssh->kex != NULL &&
+ (ssh->kex->flags & KEX_INITIAL) && ssh->kex->kex_strict)
+ return 0;
+ /* Implicitly handle transport-level messages */
switch (*typep) {
case SSH2_MSG_IGNORE:
debug3("Received SSH2_MSG_IGNORE");
@@ -1744,19 +1792,6 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
debug("Remote: %.900s", msg);
free(msg);
break;
- case SSH2_MSG_DISCONNECT:
- if ((r = sshpkt_get_u32(ssh, &reason)) != 0 ||
- (r = sshpkt_get_string(ssh, &msg, NULL)) != 0)
- return r;
- /* Ignore normal client exit notifications */
- do_log2(ssh->state->server_side &&
- reason == SSH2_DISCONNECT_BY_APPLICATION ?
- SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_ERROR,
- "Received disconnect from %s port %d:"
- "%u: %.400s", ssh_remote_ipaddr(ssh),
- ssh_remote_port(ssh), reason, msg);
- free(msg);
- return SSH_ERR_DISCONNECTED;
case SSH2_MSG_UNIMPLEMENTED:
if ((r = sshpkt_get_u32(ssh, &seqnr)) != 0)
return r;
@@ -2235,6 +2270,7 @@ kex_to_blob(struct sshbuf *m, struct kex *kex)
(r = sshbuf_put_u32(m, kex->hostkey_type)) != 0 ||
(r = sshbuf_put_u32(m, kex->hostkey_nid)) != 0 ||
(r = sshbuf_put_u32(m, kex->kex_type)) != 0 ||
+ (r = sshbuf_put_u32(m, kex->kex_strict)) != 0 ||
(r = sshbuf_put_stringb(m, kex->my)) != 0 ||
(r = sshbuf_put_stringb(m, kex->peer)) != 0 ||
(r = sshbuf_put_stringb(m, kex->client_version)) != 0 ||
@@ -2397,6 +2433,7 @@ kex_from_blob(struct sshbuf *m, struct kex **kexp)
(r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_type)) != 0 ||
(r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_nid)) != 0 ||
(r = sshbuf_get_u32(m, &kex->kex_type)) != 0 ||
+ (r = sshbuf_get_u32(m, &kex->kex_strict)) != 0 ||
(r = sshbuf_get_stringb(m, kex->my)) != 0 ||
(r = sshbuf_get_stringb(m, kex->peer)) != 0 ||
(r = sshbuf_get_stringb(m, kex->client_version)) != 0 ||
@@ -2724,6 +2761,7 @@ sshpkt_disconnect(struct ssh *ssh, const char *fmt,...)
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
+ debug2("sending SSH2_MSG_DISCONNECT: %s", buf);
if ((r = sshpkt_start(ssh, SSH2_MSG_DISCONNECT)) != 0 ||
(r = sshpkt_put_u32(ssh, SSH2_DISCONNECT_PROTOCOL_ERROR)) != 0 ||
(r = sshpkt_put_cstring(ssh, buf)) != 0 ||
diff --git a/sshconnect2.c b/sshconnect2.c
index 5df9477..617ed9f 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -218,7 +218,8 @@ ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port)
fatal("%s: kex_assemble_namelist", __func__);
free(all_key);
- if ((s = kex_names_cat(options.kex_algorithms, "ext-info-c")) == NULL)
+ if ((s = kex_names_cat(options.kex_algorithms,
+ "ext-info-c,kex-strict-c-v00@openssh.com")) == NULL)
fatal("%s: kex_names_cat", __func__);
myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(s);
myproposal[PROPOSAL_ENC_ALGS_CTOS] =
@@ -343,7 +344,6 @@ struct cauthmethod {
};
static int input_userauth_service_accept(int, u_int32_t, struct ssh *);
-static int input_userauth_ext_info(int, u_int32_t, struct ssh *);
static int input_userauth_success(int, u_int32_t, struct ssh *);
static int input_userauth_failure(int, u_int32_t, struct ssh *);
static int input_userauth_banner(int, u_int32_t, struct ssh *);
@@ -460,7 +460,7 @@ ssh_userauth2(struct ssh *ssh, const char *local_user,
ssh->authctxt = &authctxt;
ssh_dispatch_init(ssh, &input_userauth_error);
- ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &input_userauth_ext_info);
+ ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, kex_input_ext_info);
ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_ACCEPT, &input_userauth_service_accept);
ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */
pubkey_cleanup(ssh);
@@ -505,13 +505,6 @@ input_userauth_service_accept(int type, u_int32_t seq, struct ssh *ssh)
return r;
}
-/* ARGSUSED */
-static int
-input_userauth_ext_info(int type, u_int32_t seqnr, struct ssh *ssh)
-{
- return kex_input_ext_info(type, seqnr, ssh);
-}
-
void
userauth(struct ssh *ssh, char *authlist)
{
@@ -593,6 +586,7 @@ input_userauth_success(int type, u_int32_t seq, struct ssh *ssh)
free(authctxt->methoddata);
authctxt->methoddata = NULL;
authctxt->success = 1; /* break out */
+ ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, dispatch_protocol_error);
return 0;
}
diff --git a/sshd.c b/sshd.c
index 60b2aaf..ffea38c 100644
--- a/sshd.c
+++ b/sshd.c
@@ -2323,11 +2323,13 @@ static void
do_ssh2_kex(struct ssh *ssh)
{
char *myproposal[PROPOSAL_MAX] = { KEX_SERVER };
+ char *s;
struct kex *kex;
int r;
- myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(
- options.kex_algorithms);
+ if ((s = kex_names_cat(options.kex_algorithms, "kex-strict-s-v00@openssh.com")) == NULL)
+ fatal("kex_names_cat");
+ myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(s);
myproposal[PROPOSAL_ENC_ALGS_CTOS] = compat_cipher_proposal(
options.ciphers);
myproposal[PROPOSAL_ENC_ALGS_STOC] = compat_cipher_proposal(
@@ -2382,6 +2384,7 @@ do_ssh2_kex(struct ssh *ssh)
packet_send();
packet_write_wait();
#endif
+ free(s);
debug("KEX done");
}
--
2.25.1

View File

@@ -27,6 +27,19 @@ 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 \
file://CVE-2023-48795.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] = "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8"
inherit lib_package multilib_header multilib_script ptest
MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"

View File

@@ -11,7 +11,7 @@ AUTHOR = "Thomas Hood"
HOMEPAGE = "http://packages.debian.org/resolvconf"
RDEPENDS_${PN} = "bash"
SRC_URI = "git://salsa.debian.org/debian/resolvconf.git;protocol=https;branch=master \
SRC_URI = "git://salsa.debian.org/debian/resolvconf.git;protocol=https;branch=unstable \
file://fix-path-for-busybox.patch \
file://99_resolvconf \
"

View File

@@ -0,0 +1,82 @@
From c18ebf861528ef24958dd99a146482d2a40014c7 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Mon, 12 Jun 2023 17:48:47 +0200
Subject: [PATCH] shell: avoid segfault on ${0::0/0~09J}. Closes 15216
function old new delta
evaluate_string 1011 1053 +42
CVE: CVE-2022-48174
Upstream-Status: Backport [d417193cf37ca1005830d7e16f5fa7e1d8a44209]
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
shell/math.c | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/shell/math.c b/shell/math.c
index af1ab55c0..79824e81f 100644
--- a/shell/math.c
+++ b/shell/math.c
@@ -578,6 +578,28 @@ static arith_t strto_arith_t(const char *nptr, char **endptr)
# endif
#endif
+//TODO: much better estimation than expr_len/2? Such as:
+//static unsigned estimate_nums_and_names(const char *expr)
+//{
+// unsigned count = 0;
+// while (*(expr = skip_whitespace(expr)) != '\0') {
+// const char *p;
+// if (isdigit(*expr)) {
+// while (isdigit(*++expr))
+// continue;
+// count++;
+// continue;
+// }
+// p = endofname(expr);
+// if (p != expr) {
+// expr = p;
+// count++;
+// continue;
+// }
+// }
+// return count;
+//}
+
static arith_t FAST_FUNC
evaluate_string(arith_state_t *math_state, const char *expr)
{
@@ -585,10 +607,12 @@ evaluate_string(arith_state_t *math_state, const char *expr)
const char *errmsg;
const char *start_expr = expr = skip_whitespace(expr);
unsigned expr_len = strlen(expr) + 2;
- /* Stack of integers */
- /* The proof that there can be no more than strlen(startbuf)/2+1
- * integers in any given correct or incorrect expression
- * is left as an exercise to the reader. */
+ /* Stack of integers/names */
+ /* There can be no more than strlen(startbuf)/2+1
+ * integers/names in any given correct or incorrect expression.
+ * (modulo "09v09v09v09v09v" case,
+ * but we have code to detect that early)
+ */
var_or_num_t *const numstack = alloca((expr_len / 2) * sizeof(numstack[0]));
var_or_num_t *numstackptr = numstack;
/* Stack of operator tokens */
@@ -657,6 +681,13 @@ evaluate_string(arith_state_t *math_state, const char *expr)
numstackptr->var = NULL;
errno = 0;
numstackptr->val = strto_arith_t(expr, (char**) &expr);
+ /* A number can't be followed by another number, or a variable name.
+ * We'd catch this later anyway, but this would require numstack[]
+ * to be twice as deep to handle strings where _every_ char is
+ * a new number or name. Example: 09v09v09v09v09v09v09v09v09v
+ */
+ if (isalnum(*expr) || *expr == '_')
+ goto err;
if (errno)
numstackptr->val = 0; /* bash compat */
goto num;
--
2.40.1

View File

@@ -55,6 +55,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
file://CVE-2021-42374.patch \
file://CVE-2021-42376.patch \
file://CVE-2021-423xx-awk.patch \
file://CVE-2022-48174.patch \
file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \
file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \
"

View File

@@ -8,6 +8,7 @@ SRC_URI = "https://dbus.freedesktop.org/releases/dbus/dbus-${PV}.tar.gz \
file://tmpdir.patch \
file://dbus-1.init \
file://clear-guid_from_server-if-send_negotiate_unix_f.patch \
file://CVE-2023-34969.patch \
"
SRC_URI[sha256sum] = "bc42d196c1756ac520d61bf3ccd6f42013617def45dd1e591a6091abf51dca38"
@@ -31,3 +32,5 @@ PACKAGECONFIG[systemd] = "--enable-systemd --with-systemdsystemunitdir=${systemd
PACKAGECONFIG[x11] = "--with-x --enable-x11-autolaunch,--without-x --disable-x11-autolaunch, virtual/libx11 libsm"
PACKAGECONFIG[user-session] = "--enable-user-session --with-systemduserunitdir=${systemd_user_unitdir},--disable-user-session"
PACKAGECONFIG[verbose-mode] = "--enable-verbose-mode,,,"
CVE_PRODUCT += "d-bus_project:d-bus freedesktop:dbus freedesktop:libdbus"

View File

@@ -0,0 +1,96 @@
From 37a4dc5835731a1f7a81f1b67c45b8dfb556dd1c Mon Sep 17 00:00:00 2001
From: hongjinghao <q1204531485@163.com>
Date: Mon, 5 Jun 2023 18:17:06 +0100
Subject: [PATCH] bus: Assign a serial number for messages from the driver
Normally, it's enough to rely on a message being given a serial number
by the DBusConnection just before it is actually sent. However, in the
rare case where the policy blocks the driver from sending a message
(due to a deny rule or the outgoing message quota being full), we need
to get a valid serial number sooner, so that we can copy it into the
DBUS_HEADER_FIELD_REPLY_SERIAL field (which is mandatory) in the error
message sent to monitors. Otherwise, the dbus-daemon will crash with
an assertion failure if at least one Monitoring client is attached,
because zero is not a valid serial number to copy.
This fixes a denial-of-service vulnerability: if a privileged user is
monitoring the well-known system bus using a Monitoring client like
dbus-monitor or `busctl monitor`, then an unprivileged user can cause
denial-of-service by triggering this crash. A mitigation for this
vulnerability is to avoid attaching Monitoring clients to the system
bus when they are not needed. If there are no Monitoring clients, then
the vulnerable code is not reached.
Co-authored-by: Simon McVittie <smcv@collabora.com>
Resolves: dbus/dbus#457
(cherry picked from commit b159849e031000d1dbc1ab876b5fc78a3ce9b534)
---
bus/connection.c | 15 +++++++++++++++
dbus/dbus-connection-internal.h | 2 ++
dbus/dbus-connection.c | 11 ++++++++++-
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/bus/connection.c b/bus/connection.c
index b3583433..215f0230 100644
--- a/bus/connection.c
+++ b/bus/connection.c
@@ -2350,6 +2350,21 @@ bus_transaction_send_from_driver (BusTransaction *transaction,
if (!dbus_message_set_sender (message, DBUS_SERVICE_DBUS))
return FALSE;
+ /* Make sure the message has a non-zero serial number, otherwise
+ * bus_transaction_capture_error_reply() will not be able to mock up
+ * a corresponding reply for it. Normally this would be delayed until
+ * the first time we actually send the message out from a
+ * connection, when the transaction is committed, but that's too late
+ * in this case.
+ */
+ if (dbus_message_get_serial (message) == 0)
+ {
+ dbus_uint32_t next_serial;
+
+ next_serial = _dbus_connection_get_next_client_serial (connection);
+ dbus_message_set_serial (message, next_serial);
+ }
+
if (bus_connection_is_active (connection))
{
if (!dbus_message_set_destination (message,
diff --git a/dbus/dbus-connection-internal.h b/dbus/dbus-connection-internal.h
index 48357321..ba79b192 100644
--- a/dbus/dbus-connection-internal.h
+++ b/dbus/dbus-connection-internal.h
@@ -54,6 +54,8 @@ DBUS_PRIVATE_EXPORT
DBusConnection * _dbus_connection_ref_unlocked (DBusConnection *connection);
DBUS_PRIVATE_EXPORT
void _dbus_connection_unref_unlocked (DBusConnection *connection);
+DBUS_PRIVATE_EXPORT
+dbus_uint32_t _dbus_connection_get_next_client_serial (DBusConnection *connection);
void _dbus_connection_queue_received_message_link (DBusConnection *connection,
DBusList *link);
dbus_bool_t _dbus_connection_has_messages_to_send_unlocked (DBusConnection *connection);
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index c525b6dc..09cef278 100644
--- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -1456,7 +1456,16 @@ _dbus_connection_unref_unlocked (DBusConnection *connection)
_dbus_connection_last_unref (connection);
}
-static dbus_uint32_t
+/**
+ * Allocate and return the next non-zero serial number for outgoing messages.
+ *
+ * This method is only valid to call from single-threaded code, such as
+ * the dbus-daemon, or with the connection lock held.
+ *
+ * @param connection the connection
+ * @returns A suitable serial number for the next message to be sent on the connection.
+ */
+dbus_uint32_t
_dbus_connection_get_next_client_serial (DBusConnection *connection)
{
dbus_uint32_t serial;
--
2.25.1

View File

@@ -0,0 +1,290 @@
From 5f4485c4ff57fdefb1661531788def7ca5a47328 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 17 Aug 2023 04:19:44 +0000
Subject: [PATCH] gvariant-serialiser: Check offset table entry size is minimal
The entries in an offset table (which is used for variable sized arrays
and tuples containing variable sized members) are sized so that they can
address every byte in the overall variant.
The specification requires that for a variant to be in normal form, its
offset table entries must be the minimum width such that they can
address every byte in the variant.
That minimality requirement was not checked in
`g_variant_is_normal_form()`, leading to two different byte arrays being
interpreted as the normal form of a given variant tree. That kind of
confusion could potentially be exploited, and is certainly a bug.
Fix it by adding the necessary checks on offset table entry width, and
unit tests.
Spotted by William Manley.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2794
CVE: CVE-2023-29499
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/5f4485c4ff57fdefb1661531788def7ca5a47328]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-serialiser.c | 19 +++-
glib/tests/gvariant.c | 176 +++++++++++++++++++++++++++++++++++++
2 files changed, 194 insertions(+), 1 deletion(-)
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index 0bf7243..5aa2cbc 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -694,6 +694,10 @@ gvs_variable_sized_array_get_frame_offsets (GVariantSerialised value)
out.data_size = last_end;
out.array = value.data + last_end;
out.length = offsets_array_size / out.offset_size;
+
+ if (out.length > 0 && gvs_calculate_total_size (last_end, out.length) != value.size)
+ return out; /* offset size not minimal */
+
out.is_normal = TRUE;
return out;
@@ -1201,6 +1205,7 @@ gvs_tuple_is_normal (GVariantSerialised value)
gsize length;
gsize offset;
gsize i;
+ gsize offset_table_size;
/* as per the comment in gvs_tuple_get_child() */
if G_UNLIKELY (value.data == NULL && value.size != 0)
@@ -1305,7 +1310,19 @@ gvs_tuple_is_normal (GVariantSerialised value)
}
}
- return offset_ptr == offset;
+ /* @offset_ptr has been counting backwards from the end of the variant, to
+ * find the beginning of the offset table. @offset has been counting forwards
+ * from the beginning of the variant to find the end of the data. They should
+ * have met in the middle. */
+ if (offset_ptr != offset)
+ return FALSE;
+
+ offset_table_size = value.size - offset_ptr;
+ if (value.size > 0 &&
+ gvs_calculate_total_size (offset, offset_table_size / offset_size) != value.size)
+ return FALSE; /* offset size not minimal */
+
+ return TRUE;
}
/* Variants {{{2
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index d640c81..4ce0e4f 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -5092,6 +5092,86 @@ test_normal_checking_array_offsets2 (void)
g_variant_unref (variant);
}
+/* Test that an otherwise-valid serialised GVariant is considered non-normal if
+ * its offset table entries are too wide.
+ *
+ * See §2.3.6 (Framing Offsets) of the GVariant specification. */
+static void
+test_normal_checking_array_offsets_minimal_sized (void)
+{
+ GVariantBuilder builder;
+ gsize i;
+ GVariant *aay_constructed = NULL;
+ const guint8 *data = NULL;
+ guint8 *data_owned = NULL;
+ GVariant *aay_deserialised = NULL;
+ GVariant *aay_normalised = NULL;
+
+ /* Construct an array of type aay, consisting of 128 elements which are each
+ * an empty array, i.e. `[[] * 128]`. This is chosen because the inner
+ * elements are variable sized (making the outer array variable sized, so it
+ * must have an offset table), but they are also zero-sized when serialised.
+ * So the serialised representation of @aay_constructed consists entirely of
+ * its offset table, which is entirely zeroes.
+ *
+ * The array is chosen to be 128 elements long because that means offset
+ * table entries which are 1 byte long. If the elements in the array were
+ * non-zero-sized (to the extent that the overall array is ≥256 bytes long),
+ * the offset table entries would end up being 2 bytes long. */
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("aay"));
+
+ for (i = 0; i < 128; i++)
+ g_variant_builder_add_value (&builder, g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0));
+
+ aay_constructed = g_variant_builder_end (&builder);
+
+ /* Verify that the constructed array is in normal form, and its serialised
+ * form is `b'\0' * 128`. */
+ g_assert_true (g_variant_is_normal_form (aay_constructed));
+ g_assert_cmpuint (g_variant_n_children (aay_constructed), ==, 128);
+ g_assert_cmpuint (g_variant_get_size (aay_constructed), ==, 128);
+
+ data = g_variant_get_data (aay_constructed);
+ for (i = 0; i < g_variant_get_size (aay_constructed); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ /* Construct a serialised `aay` GVariant which is `b'\0' * 256`. This has to
+ * be a non-normal form of `[[] * 128]`, with 2-byte-long offset table
+ * entries, because each offset table entry has to be able to reference all of
+ * the byte boundaries in the container. All the entries in the offset table
+ * are zero, so all the elements of the array are zero-sized. */
+ data = data_owned = g_malloc0 (256);
+ aay_deserialised = g_variant_new_from_data (G_VARIANT_TYPE ("aay"),
+ data,
+ 256,
+ FALSE,
+ g_free,
+ g_steal_pointer (&data_owned));
+
+ g_assert_false (g_variant_is_normal_form (aay_deserialised));
+ g_assert_cmpuint (g_variant_n_children (aay_deserialised), ==, 128);
+ g_assert_cmpuint (g_variant_get_size (aay_deserialised), ==, 256);
+
+ data = g_variant_get_data (aay_deserialised);
+ for (i = 0; i < g_variant_get_size (aay_deserialised); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ /* Get its normal form. That should change the serialised size. */
+ aay_normalised = g_variant_get_normal_form (aay_deserialised);
+
+ g_assert_true (g_variant_is_normal_form (aay_normalised));
+ g_assert_cmpuint (g_variant_n_children (aay_normalised), ==, 128);
+ g_assert_cmpuint (g_variant_get_size (aay_normalised), ==, 128);
+
+ data = g_variant_get_data (aay_normalised);
+ for (i = 0; i < g_variant_get_size (aay_normalised); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ g_variant_unref (aay_normalised);
+ g_variant_unref (aay_deserialised);
+ g_variant_unref (aay_constructed);
+}
+
/* Test that a tuple with invalidly large values in its offset table is
* normalised successfully without looping infinitely. */
static void
@@ -5286,6 +5366,98 @@ test_normal_checking_tuple_offsets4 (void)
g_variant_unref (variant);
}
+/* Test that an otherwise-valid serialised GVariant is considered non-normal if
+ * its offset table entries are too wide.
+ *
+ * See §2.3.6 (Framing Offsets) of the GVariant specification. */
+static void
+test_normal_checking_tuple_offsets_minimal_sized (void)
+{
+ GString *type_string = NULL;
+ GVariantBuilder builder;
+ gsize i;
+ GVariant *ray_constructed = NULL;
+ const guint8 *data = NULL;
+ guint8 *data_owned = NULL;
+ GVariant *ray_deserialised = NULL;
+ GVariant *ray_normalised = NULL;
+
+ /* Construct a tuple of type (ay…ay), consisting of 129 members which are each
+ * an empty array, i.e. `([] * 129)`. This is chosen because the inner
+ * members are variable sized, so the outer tuple must have an offset table,
+ * but they are also zero-sized when serialised. So the serialised
+ * representation of @ray_constructed consists entirely of its offset table,
+ * which is entirely zeroes.
+ *
+ * The tuple is chosen to be 129 members long because that means it has 128
+ * offset table entries which are 1 byte long each. If the members in the
+ * tuple were non-zero-sized (to the extent that the overall tuple is ≥256
+ * bytes long), the offset table entries would end up being 2 bytes long.
+ *
+ * 129 members are used unlike 128 array elements in
+ * test_normal_checking_array_offsets_minimal_sized(), because the last member
+ * in a tuple never needs an offset table entry. */
+ type_string = g_string_new ("");
+ g_string_append_c (type_string, '(');
+ for (i = 0; i < 129; i++)
+ g_string_append (type_string, "ay");
+ g_string_append_c (type_string, ')');
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE (type_string->str));
+
+ for (i = 0; i < 129; i++)
+ g_variant_builder_add_value (&builder, g_variant_new_array (G_VARIANT_TYPE_BYTE, NULL, 0));
+
+ ray_constructed = g_variant_builder_end (&builder);
+
+ /* Verify that the constructed tuple is in normal form, and its serialised
+ * form is `b'\0' * 128`. */
+ g_assert_true (g_variant_is_normal_form (ray_constructed));
+ g_assert_cmpuint (g_variant_n_children (ray_constructed), ==, 129);
+ g_assert_cmpuint (g_variant_get_size (ray_constructed), ==, 128);
+
+ data = g_variant_get_data (ray_constructed);
+ for (i = 0; i < g_variant_get_size (ray_constructed); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ /* Construct a serialised `(ay…ay)` GVariant which is `b'\0' * 256`. This has
+ * to be a non-normal form of `([] * 129)`, with 2-byte-long offset table
+ * entries, because each offset table entry has to be able to reference all of
+ * the byte boundaries in the container. All the entries in the offset table
+ * are zero, so all the members of the tuple are zero-sized. */
+ data = data_owned = g_malloc0 (256);
+ ray_deserialised = g_variant_new_from_data (G_VARIANT_TYPE (type_string->str),
+ data,
+ 256,
+ FALSE,
+ g_free,
+ g_steal_pointer (&data_owned));
+
+ g_assert_false (g_variant_is_normal_form (ray_deserialised));
+ g_assert_cmpuint (g_variant_n_children (ray_deserialised), ==, 129);
+ g_assert_cmpuint (g_variant_get_size (ray_deserialised), ==, 256);
+
+ data = g_variant_get_data (ray_deserialised);
+ for (i = 0; i < g_variant_get_size (ray_deserialised); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ /* Get its normal form. That should change the serialised size. */
+ ray_normalised = g_variant_get_normal_form (ray_deserialised);
+
+ g_assert_true (g_variant_is_normal_form (ray_normalised));
+ g_assert_cmpuint (g_variant_n_children (ray_normalised), ==, 129);
+ g_assert_cmpuint (g_variant_get_size (ray_normalised), ==, 128);
+
+ data = g_variant_get_data (ray_normalised);
+ for (i = 0; i < g_variant_get_size (ray_normalised); i++)
+ g_assert_cmpuint (data[i], ==, 0);
+
+ g_variant_unref (ray_normalised);
+ g_variant_unref (ray_deserialised);
+ g_variant_unref (ray_constructed);
+ g_string_free (type_string, TRUE);
+}
+
/* Test that an empty object path is normalised successfully to the base object
* path, /. */
static void
@@ -5431,6 +5603,8 @@ main (int argc, char **argv)
test_normal_checking_array_offsets);
g_test_add_func ("/gvariant/normal-checking/array-offsets2",
test_normal_checking_array_offsets2);
+ g_test_add_func ("/gvariant/normal-checking/array-offsets/minimal-sized",
+ test_normal_checking_array_offsets_minimal_sized);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets",
test_normal_checking_tuple_offsets);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets2",
@@ -5439,6 +5613,8 @@ main (int argc, char **argv)
test_normal_checking_tuple_offsets3);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets4",
test_normal_checking_tuple_offsets4);
+ g_test_add_func ("/gvariant/normal-checking/tuple-offsets/minimal-sized",
+ test_normal_checking_tuple_offsets_minimal_sized);
g_test_add_func ("/gvariant/normal-checking/empty-object-path",
test_normal_checking_empty_object_path);
--
2.24.4

View File

@@ -0,0 +1,89 @@
From 1deacdd4e8e35a5cf1417918ca4f6b0afa6409b1 Mon Sep 17 00:00:00 2001
From: William Manley <will@stb-tester.com>
Date: Wed, 9 Aug 2023 10:04:49 +0000
Subject: [PATCH] gvariant-core: Consolidate construction of
`GVariantSerialised`
So I only need to change it in one place.
This introduces no functional changes.
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/1deacdd4e8e35a5cf1417918ca4f6b0afa6409b1]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant.c | 8 +++++---
glib/tests/gvariant.c | 24 ++++++++++++++++++++++++
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/glib/gvariant.c b/glib/gvariant.c
index 8ba701e..4dbd9e8 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5952,14 +5952,16 @@ g_variant_byteswap (GVariant *value)
g_variant_serialised_byteswap (serialised);
bytes = g_bytes_new_take (serialised.data, serialised.size);
- new = g_variant_new_from_bytes (g_variant_get_type (value), bytes, TRUE);
+ new = g_variant_ref_sink (g_variant_new_from_bytes (g_variant_get_type (value), bytes, TRUE));
g_bytes_unref (bytes);
}
else
/* contains no multi-byte data */
- new = value;
+ new = g_variant_get_normal_form (value);
- return g_variant_ref_sink (new);
+ g_assert (g_variant_is_trusted (new));
+
+ return g_steal_pointer (&new);
}
/**
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 4ce0e4f..3dda08e 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -3834,6 +3834,29 @@ test_gv_byteswap (void)
g_free (string);
}
+static void
+test_gv_byteswap_non_normal_non_aligned (void)
+{
+ const guint8 data[] = { 0x02 };
+ GVariant *v = NULL;
+ GVariant *v_byteswapped = NULL;
+
+ g_test_summary ("Test that calling g_variant_byteswap() on a variant which "
+ "is in non-normal form and doesnt need byteswapping returns "
+ "the same variant in normal form.");
+
+ v = g_variant_new_from_data (G_VARIANT_TYPE_BOOLEAN, data, sizeof (data), FALSE, NULL, NULL);
+ g_assert_false (g_variant_is_normal_form (v));
+
+ v_byteswapped = g_variant_byteswap (v);
+ g_assert_true (g_variant_is_normal_form (v_byteswapped));
+
+ g_assert_cmpvariant (v, v_byteswapped);
+
+ g_variant_unref (v);
+ g_variant_unref (v_byteswapped);
+}
+
static void
test_parser (void)
{
@@ -5570,6 +5593,7 @@ main (int argc, char **argv)
g_test_add_func ("/gvariant/builder-memory", test_builder_memory);
g_test_add_func ("/gvariant/hashing", test_hashing);
g_test_add_func ("/gvariant/byteswap", test_gv_byteswap);
+ g_test_add_func ("/gvariant/byteswap/non-normal-non-aligned", test_gv_byteswap_non_normal_non_aligned);
g_test_add_func ("/gvariant/parser", test_parses);
g_test_add_func ("/gvariant/parser/integer-bounds", test_parser_integer_bounds);
g_test_add_func ("/gvariant/parser/recursion", test_parser_recursion);
--
2.24.4

View File

@@ -0,0 +1,255 @@
From 446e69f5edd72deb2196dee36bbaf8056caf6948 Mon Sep 17 00:00:00 2001
From: William Manley <will@stb-tester.com>
Date: Wed, 9 Aug 2023 10:39:34 +0000
Subject: [PATCH] gvariant-serialiser: Factor out functions for dealing with
framing offsets
This introduces no functional changes.
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/446e69f5edd72deb2196dee36bbaf8056caf6948]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant.c | 81 +++++++++++++++++++++++++++++++++----------
glib/tests/gvariant.c | 57 ++++++++++++++++++++++++++----
2 files changed, 112 insertions(+), 26 deletions(-)
diff --git a/glib/gvariant.c b/glib/gvariant.c
index 4dbd9e8..a80c2c9 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5788,7 +5788,8 @@ g_variant_iter_loop (GVariantIter *iter,
/* Serialised data {{{1 */
static GVariant *
-g_variant_deep_copy (GVariant *value)
+g_variant_deep_copy (GVariant *value,
+ gboolean byteswap)
{
switch (g_variant_classify (value))
{
@@ -5806,7 +5807,7 @@ g_variant_deep_copy (GVariant *value)
for (i = 0, n_children = g_variant_n_children (value); i < n_children; i++)
{
GVariant *child = g_variant_get_child_value (value, i);
- g_variant_builder_add_value (&builder, g_variant_deep_copy (child));
+ g_variant_builder_add_value (&builder, g_variant_deep_copy (child, byteswap));
g_variant_unref (child);
}
@@ -5820,28 +5821,63 @@ g_variant_deep_copy (GVariant *value)
return g_variant_new_byte (g_variant_get_byte (value));
case G_VARIANT_CLASS_INT16:
- return g_variant_new_int16 (g_variant_get_int16 (value));
+ if (byteswap)
+ return g_variant_new_int16 (GUINT16_SWAP_LE_BE (g_variant_get_int16 (value)));
+ else
+ return g_variant_new_int16 (g_variant_get_int16 (value));
case G_VARIANT_CLASS_UINT16:
- return g_variant_new_uint16 (g_variant_get_uint16 (value));
+ if (byteswap)
+ return g_variant_new_uint16 (GUINT16_SWAP_LE_BE (g_variant_get_uint16 (value)));
+ else
+ return g_variant_new_uint16 (g_variant_get_uint16 (value));
case G_VARIANT_CLASS_INT32:
- return g_variant_new_int32 (g_variant_get_int32 (value));
+ if (byteswap)
+ return g_variant_new_int32 (GUINT32_SWAP_LE_BE (g_variant_get_int32 (value)));
+ else
+ return g_variant_new_int32 (g_variant_get_int32 (value));
case G_VARIANT_CLASS_UINT32:
- return g_variant_new_uint32 (g_variant_get_uint32 (value));
+ if (byteswap)
+ return g_variant_new_uint32 (GUINT32_SWAP_LE_BE (g_variant_get_uint32 (value)));
+ else
+ return g_variant_new_uint32 (g_variant_get_uint32 (value));
case G_VARIANT_CLASS_INT64:
- return g_variant_new_int64 (g_variant_get_int64 (value));
+ if (byteswap)
+ return g_variant_new_int64 (GUINT64_SWAP_LE_BE (g_variant_get_int64 (value)));
+ else
+ return g_variant_new_int64 (g_variant_get_int64 (value));
case G_VARIANT_CLASS_UINT64:
- return g_variant_new_uint64 (g_variant_get_uint64 (value));
+ if (byteswap)
+ return g_variant_new_uint64 (GUINT64_SWAP_LE_BE (g_variant_get_uint64 (value)));
+ else
+ return g_variant_new_uint64 (g_variant_get_uint64 (value));
case G_VARIANT_CLASS_HANDLE:
- return g_variant_new_handle (g_variant_get_handle (value));
+ if (byteswap)
+ return g_variant_new_handle (GUINT32_SWAP_LE_BE (g_variant_get_handle (value)));
+ else
+ return g_variant_new_handle (g_variant_get_handle (value));
case G_VARIANT_CLASS_DOUBLE:
- return g_variant_new_double (g_variant_get_double (value));
+ if (byteswap)
+ {
+ /* We have to convert the double to a uint64 here using a union,
+ * because a cast will round it numerically. */
+ union
+ {
+ guint64 u64;
+ gdouble dbl;
+ } u1, u2;
+ u1.dbl = g_variant_get_double (value);
+ u2.u64 = GUINT64_SWAP_LE_BE (u1.u64);
+ return g_variant_new_double (u2.dbl);
+ }
+ else
+ return g_variant_new_double (g_variant_get_double (value));
case G_VARIANT_CLASS_STRING:
return g_variant_new_string (g_variant_get_string (value, NULL));
@@ -5896,7 +5932,7 @@ g_variant_get_normal_form (GVariant *value)
if (g_variant_is_normal_form (value))
return g_variant_ref (value);
- trusted = g_variant_deep_copy (value);
+ trusted = g_variant_deep_copy (value, FALSE);
g_assert (g_variant_is_trusted (trusted));
return g_variant_ref_sink (trusted);
@@ -5916,6 +5952,11 @@ g_variant_get_normal_form (GVariant *value)
* contain multi-byte numeric data. That include strings, booleans,
* bytes and containers containing only these things (recursively).
*
+ * While this function can safely handle untrusted, non-normal data, it is
+ * recommended to check whether the input is in normal form beforehand, using
+ * g_variant_is_normal_form(), and to reject non-normal inputs if your
+ * application can be strict about what inputs it rejects.
+ *
* The returned value is always in normal form and is marked as trusted.
*
* Returns: (transfer full): the byteswapped form of @value
@@ -5933,21 +5974,20 @@ g_variant_byteswap (GVariant *value)
g_variant_type_info_query (type_info, &alignment, NULL);
- if (alignment)
- /* (potentially) contains multi-byte numeric data */
+ if (alignment && g_variant_is_normal_form (value))
{
+ /* (potentially) contains multi-byte numeric data, but is also already in
+ * normal form so we can use a faster byteswapping codepath on the
+ * serialised data */
GVariantSerialised serialised = { 0, };
- GVariant *trusted;
GBytes *bytes;
- trusted = g_variant_get_normal_form (value);
- serialised.type_info = g_variant_get_type_info (trusted);
- serialised.size = g_variant_get_size (trusted);
+ serialised.type_info = g_variant_get_type_info (value);
+ serialised.size = g_variant_get_size (value);
serialised.data = g_malloc (serialised.size);
serialised.ordered_offsets_up_to = G_MAXSIZE; /* operating on the normal form */
serialised.checked_offsets_up_to = G_MAXSIZE;
- g_variant_store (trusted, serialised.data);
- g_variant_unref (trusted);
+ g_variant_store (value, serialised.data);
g_variant_serialised_byteswap (serialised);
@@ -5955,6 +5995,9 @@ g_variant_byteswap (GVariant *value)
new = g_variant_ref_sink (g_variant_new_from_bytes (g_variant_get_type (value), bytes, TRUE));
g_bytes_unref (bytes);
}
+ else if (alignment)
+ /* (potentially) contains multi-byte numeric data */
+ new = g_variant_ref_sink (g_variant_deep_copy (value, TRUE));
else
/* contains no multi-byte data */
new = g_variant_get_normal_form (value);
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 3dda08e..679dd40 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -2284,24 +2284,67 @@ serialise_tree (TreeInstance *tree,
static void
test_byteswap (void)
{
- GVariantSerialised one = { 0, }, two = { 0, };
+ GVariantSerialised one = { 0, }, two = { 0, }, three = { 0, };
TreeInstance *tree;
-
+ GVariant *one_variant = NULL;
+ GVariant *two_variant = NULL;
+ GVariant *two_byteswapped = NULL;
+ GVariant *three_variant = NULL;
+ GVariant *three_byteswapped = NULL;
+ guint8 *three_data_copy = NULL;
+ gsize three_size_copy = 0;
+
+ /* Write a tree out twice, once normally and once byteswapped. */
tree = tree_instance_new (NULL, 3);
serialise_tree (tree, &one);
+ one_variant = g_variant_new_from_data (G_VARIANT_TYPE (g_variant_type_info_get_type_string (one.type_info)),
+ one.data, one.size, FALSE, NULL, NULL);
+
i_am_writing_byteswapped = TRUE;
serialise_tree (tree, &two);
+ serialise_tree (tree, &three);
i_am_writing_byteswapped = FALSE;
- g_variant_serialised_byteswap (two);
-
- g_assert_cmpmem (one.data, one.size, two.data, two.size);
- g_assert_cmpuint (one.depth, ==, two.depth);
-
+ /* Swap the first byteswapped one back using the function we want to test. */
+ two_variant = g_variant_new_from_data (G_VARIANT_TYPE (g_variant_type_info_get_type_string (two.type_info)),
+ two.data, two.size, FALSE, NULL, NULL);
+ two_byteswapped = g_variant_byteswap (two_variant);
+
+ /* Make the second byteswapped one non-normal (hopefully), and then byteswap
+ * it back using the function we want to test in its non-normal mode.
+ * This might not work because its not necessarily possible to make an
+ * arbitrary random variant non-normal. Adding a single zero byte to the end
+ * often makes something non-normal but still readable. */
+ three_size_copy = three.size + 1;
+ three_data_copy = g_malloc (three_size_copy);
+ memcpy (three_data_copy, three.data, three.size);
+ three_data_copy[three.size] = '\0';
+
+ three_variant = g_variant_new_from_data (G_VARIANT_TYPE (g_variant_type_info_get_type_string (three.type_info)),
+ three_data_copy, three_size_copy, FALSE, NULL, NULL);
+ three_byteswapped = g_variant_byteswap (three_variant);
+
+ /* Check theyre the same. We can always compare @one_variant and
+ * @two_byteswapped. We can only compare @two_byteswapped and
+ * @three_byteswapped if @two_variant and @three_variant are equal: in that
+ * case, the corruption to @three_variant was enough to make it non-normal but
+ * not enough to change its value. */
+ g_assert_cmpvariant (one_variant, two_byteswapped);
+
+ if (g_variant_equal (two_variant, three_variant))
+ g_assert_cmpvariant (two_byteswapped, three_byteswapped);
+
+ g_variant_unref (three_byteswapped);
+ g_variant_unref (three_variant);
+ g_variant_unref (two_byteswapped);
+ g_variant_unref (two_variant);
+ g_variant_unref (one_variant);
tree_instance_free (tree);
g_free (one.data);
g_free (two.data);
+ g_free (three.data);
+ g_free (three_data_copy);
}
static void
--
2.24.4

View File

@@ -0,0 +1,49 @@
From 21a204147b16539b3eda3143b32844c49e29f4d4 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 17 Aug 2023 11:33:49 +0000
Subject: [PATCH] gvariant: Propagate trust when getting a child of a
serialised variant
If a variant is trusted, that means all its children are trusted, so
ensure that their checked offsets are set as such.
This allows a lot of the offset table checks to be avoided when getting
children from trusted serialised tuples, which speeds things up.
No unit test is included because this is just a performance fix. If
there are other slownesses, or regressions, in serialised `GVariant`
performance, the fuzzing setup will catch them like it did this one.
This change does reduce the time to run the oss-fuzz reproducer from 80s
to about 0.7s on my machine.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2841
oss-fuzz#54314
CVE: CVE-2023-32636
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/21a204147b16539b3eda3143b32844c49e29f4d4]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index 1b9d5cc..ed57c70 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -1173,8 +1173,8 @@ g_variant_get_child_value (GVariant *value,
child->contents.serialised.bytes =
g_bytes_ref (value->contents.serialised.bytes);
child->contents.serialised.data = s_child.data;
- child->contents.serialised.ordered_offsets_up_to = s_child.ordered_offsets_up_to;
- child->contents.serialised.checked_offsets_up_to = s_child.checked_offsets_up_to;
+ child->contents.serialised.ordered_offsets_up_to = (value->state & STATE_TRUSTED) ? G_MAXSIZE : s_child.ordered_offsets_up_to;
+ child->contents.serialised.checked_offsets_up_to = (value->state & STATE_TRUSTED) ? G_MAXSIZE : s_child.checked_offsets_up_to;
return child;
}
--
2.24.4

View File

@@ -0,0 +1,154 @@
From 78da5faccb3e065116b75b3ff87ff55381da6c76 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 17 Aug 2023 11:24:43 +0000
Subject: [PATCH] gvariant: Check offset table doesn't fall outside variant
bounds
When dereferencing the first entry in the offset table for a tuple,
check that it doesnt fall outside the bounds of the variant first.
This prevents an out-of-bounds read from some non-normal tuples.
This bug was introduced in commit 73d0aa81c2575a5c9ae77d.
Includes a unit test, although the test will likely only catch the
original bug if run with asan enabled.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2840
oss-fuzz#54302
CVE: CVE-2023-32643
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/78da5faccb3e065116b75b3ff87ff55381da6c76]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-serialiser.c | 12 ++++++--
glib/tests/gvariant.c | 63 ++++++++++++++++++++++++++++++++++++++
2 files changed, 72 insertions(+), 3 deletions(-)
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index 5aa2cbc..4e50ed7 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -979,7 +979,8 @@ gvs_tuple_get_member_bounds (GVariantSerialised value,
member_info = g_variant_type_info_member_info (value.type_info, index_);
- if (member_info->i + 1)
+ if (member_info->i + 1 &&
+ offset_size * (member_info->i + 1) <= value.size)
member_start = gvs_read_unaligned_le (value.data + value.size -
offset_size * (member_info->i + 1),
offset_size);
@@ -990,7 +991,8 @@ gvs_tuple_get_member_bounds (GVariantSerialised value,
member_start &= member_info->b;
member_start |= member_info->c;
- if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_LAST)
+ if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_LAST &&
+ offset_size * (member_info->i + 1) <= value.size)
member_end = value.size - offset_size * (member_info->i + 1);
else if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_FIXED)
@@ -1001,11 +1003,15 @@ gvs_tuple_get_member_bounds (GVariantSerialised value,
member_end = member_start + fixed_size;
}
- else /* G_VARIANT_MEMBER_ENDING_OFFSET */
+ else if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_OFFSET &&
+ offset_size * (member_info->i + 2) <= value.size)
member_end = gvs_read_unaligned_le (value.data + value.size -
offset_size * (member_info->i + 2),
offset_size);
+ else /* invalid */
+ member_end = G_MAXSIZE;
+
if (out_member_start != NULL)
*out_member_start = member_start;
if (out_member_end != NULL)
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 679dd40..2eca8be 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -5432,6 +5432,67 @@ test_normal_checking_tuple_offsets4 (void)
g_variant_unref (variant);
}
+/* This is a regression test that dereferencing the first element in the offset
+ * table doesnt dereference memory before the start of the GVariant. The first
+ * element in the offset table gives the offset of the final member in the
+ * tuple (the offset table is stored in reverse), and the position of this final
+ * member is needed to check that none of the tuple members overlap with the
+ * offset table
+ *
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2840 */
+static void
+test_normal_checking_tuple_offsets5 (void)
+{
+ /* A tuple of type (sss) in normal form would have an offset table with two
+ * entries:
+ * - The first entry (lowest index in the table) gives the offset of the
+ * third `s` in the tuple, as the offset table is reversed compared to the
+ * tuple members.
+ * - The second entry (highest index in the table) gives the offset of the
+ * second `s` in the tuple.
+ * - The offset of the first `s` in the tuple is always 0.
+ *
+ * See §2.5.4 (Structures) of the GVariant specification for details, noting
+ * that the table is only layed out this way because all three members of the
+ * tuple have non-fixed sizes.
+ *
+ * Its not clear whether the 0xaa data of this variant is part of the strings
+ * in the tuple, or part of the offset table. It doesnt really matter. This
+ * is a regression test to check that the code to validate the offset table
+ * doesnt unconditionally try to access the first entry in the offset table
+ * by subtracting the table size from the end of the GVariant data.
+ *
+ * In this non-normal case, that would result in an address off the start of
+ * the GVariant data, and an out-of-bounds read, because the GVariant is one
+ * byte long, but the offset table is calculated as two bytes long (with 1B
+ * sized entries) from the tuples type.
+ */
+ const GVariantType *data_type = G_VARIANT_TYPE ("(sss)");
+ const guint8 data[] = { 0xaa };
+ gsize size = sizeof (data);
+ GVariant *variant = NULL;
+ GVariant *normal_variant = NULL;
+ GVariant *expected = NULL;
+
+ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2840");
+
+ variant = g_variant_new_from_data (data_type, data, size, FALSE, NULL, NULL);
+ g_assert_nonnull (variant);
+
+ g_assert_false (g_variant_is_normal_form (variant));
+
+ normal_variant = g_variant_get_normal_form (variant);
+ g_assert_nonnull (normal_variant);
+
+ expected = g_variant_new_parsed ("('', '', '')");
+ g_assert_cmpvariant (expected, variant);
+ g_assert_cmpvariant (expected, normal_variant);
+
+ g_variant_unref (expected);
+ g_variant_unref (normal_variant);
+ g_variant_unref (variant);
+}
+
/* Test that an otherwise-valid serialised GVariant is considered non-normal if
* its offset table entries are too wide.
*
@@ -5680,6 +5741,8 @@ main (int argc, char **argv)
test_normal_checking_tuple_offsets3);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets4",
test_normal_checking_tuple_offsets4);
+ g_test_add_func ("/gvariant/normal-checking/tuple-offsets5",
+ test_normal_checking_tuple_offsets5);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets/minimal-sized",
test_normal_checking_tuple_offsets_minimal_sized);
g_test_add_func ("/gvariant/normal-checking/empty-object-path",
--
2.24.4

View File

@@ -0,0 +1,103 @@
From 1deacdd4e8e35a5cf1417918ca4f6b0afa6409b1 Mon Sep 17 00:00:00 2001
From: William Manley <will@stb-tester.com>
Date: Wed, 9 Aug 2023 10:04:49 +0000
Subject: [PATCH] gvariant-core: Consolidate construction of
`GVariantSerialised`
So I only need to change it in one place.
This introduces no functional changes.
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/1deacdd4e8e35a5cf1417918ca4f6b0afa6409b1]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-core.c | 49 ++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index 9397573..aa0e0a0 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -349,6 +349,27 @@ g_variant_ensure_size (GVariant *value)
}
}
+/* < private >
+ * g_variant_to_serialised:
+ * @value: a #GVariant
+ *
+ * Gets a GVariantSerialised for a GVariant in state STATE_SERIALISED.
+ */
+inline static GVariantSerialised
+g_variant_to_serialised (GVariant *value)
+{
+ g_assert (value->state & STATE_SERIALISED);
+ {
+ GVariantSerialised serialised = {
+ value->type_info,
+ (gpointer) value->contents.serialised.data,
+ value->size,
+ value->depth,
+ };
+ return serialised;
+ }
+}
+
/* < private >
* g_variant_serialise:
* @value: a #GVariant
@@ -991,16 +1012,8 @@ g_variant_n_children (GVariant *value)
g_variant_lock (value);
if (value->state & STATE_SERIALISED)
- {
- GVariantSerialised serialised = {
- value->type_info,
- (gpointer) value->contents.serialised.data,
- value->size,
- value->depth,
- };
-
- n_children = g_variant_serialised_n_children (serialised);
- }
+ n_children = g_variant_serialised_n_children (
+ g_variant_to_serialised (value));
else
n_children = value->contents.tree.n_children;
@@ -1061,12 +1074,7 @@ g_variant_get_child_value (GVariant *value,
}
{
- GVariantSerialised serialised = {
- value->type_info,
- (gpointer) value->contents.serialised.data,
- value->size,
- value->depth,
- };
+ GVariantSerialised serialised = g_variant_to_serialised (value);
GVariantSerialised s_child;
GVariant *child;
@@ -1179,14 +1187,7 @@ g_variant_is_normal_form (GVariant *value)
if (value->state & STATE_SERIALISED)
{
- GVariantSerialised serialised = {
- value->type_info,
- (gpointer) value->contents.serialised.data,
- value->size,
- value->depth
- };
-
- if (g_variant_serialised_is_normal (serialised))
+ if (g_variant_serialised_is_normal (g_variant_to_serialised (value)))
value->state |= STATE_TRUSTED;
}
else
--
2.24.4

View File

@@ -0,0 +1,210 @@
From 446e69f5edd72deb2196dee36bbaf8056caf6948 Mon Sep 17 00:00:00 2001
From: William Manley <will@stb-tester.com>
Date: Wed, 9 Aug 2023 10:39:34 +0000
Subject: [PATCH] gvariant-serialiser: Factor out functions for dealing with
framing offsets
This introduces no functional changes.
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/446e69f5edd72deb2196dee36bbaf8056caf6948]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-serialiser.c | 108 +++++++++++++++++++------------------
1 file changed, 57 insertions(+), 51 deletions(-)
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index 83e9d85..c7c2114 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -633,30 +633,62 @@ gvs_calculate_total_size (gsize body_size,
return body_size + 8 * offsets;
}
+struct Offsets
+{
+ gsize data_size;
+
+ guchar *array;
+ gsize length;
+ guint offset_size;
+
+ gboolean is_normal;
+};
+
static gsize
-gvs_variable_sized_array_n_children (GVariantSerialised value)
+gvs_offsets_get_offset_n (struct Offsets *offsets,
+ gsize n)
+{
+ return gvs_read_unaligned_le (
+ offsets->array + (offsets->offset_size * n), offsets->offset_size);
+}
+
+static struct Offsets
+gvs_variable_sized_array_get_frame_offsets (GVariantSerialised value)
{
+ struct Offsets out = { 0, };
gsize offsets_array_size;
- gsize offset_size;
gsize last_end;
if (value.size == 0)
- return 0;
-
- offset_size = gvs_get_offset_size (value.size);
+ {
+ out.is_normal = TRUE;
+ return out;
+ }
- last_end = gvs_read_unaligned_le (value.data + value.size -
- offset_size, offset_size);
+ out.offset_size = gvs_get_offset_size (value.size);
+ last_end = gvs_read_unaligned_le (value.data + value.size - out.offset_size,
+ out.offset_size);
if (last_end > value.size)
- return 0;
+ return out; /* offsets not normal */
offsets_array_size = value.size - last_end;
- if (offsets_array_size % offset_size)
- return 0;
+ if (offsets_array_size % out.offset_size)
+ return out; /* offsets not normal */
+
+ out.data_size = last_end;
+ out.array = value.data + last_end;
+ out.length = offsets_array_size / out.offset_size;
+ out.is_normal = TRUE;
- return offsets_array_size / offset_size;
+ return out;
+}
+
+static gsize
+gvs_variable_sized_array_n_children (GVariantSerialised value)
+{
+ return gvs_variable_sized_array_get_frame_offsets (value).length;
}
static GVariantSerialised
@@ -664,8 +696,9 @@ gvs_variable_sized_array_get_child (GVariantSerialised value,
gsize index_)
{
GVariantSerialised child = { 0, };
- gsize offset_size;
- gsize last_end;
+
+ struct Offsets offsets = gvs_variable_sized_array_get_frame_offsets (value);
+
gsize start;
gsize end;
@@ -673,18 +706,11 @@ gvs_variable_sized_array_get_child (GVariantSerialised value,
g_variant_type_info_ref (child.type_info);
child.depth = value.depth + 1;
- offset_size = gvs_get_offset_size (value.size);
-
- last_end = gvs_read_unaligned_le (value.data + value.size -
- offset_size, offset_size);
-
if (index_ > 0)
{
guint alignment;
- start = gvs_read_unaligned_le (value.data + last_end +
- (offset_size * (index_ - 1)),
- offset_size);
+ start = gvs_offsets_get_offset_n (&offsets, index_ - 1);
g_variant_type_info_query (child.type_info, &alignment, NULL);
start += (-start) & alignment;
@@ -692,11 +718,9 @@ gvs_variable_sized_array_get_child (GVariantSerialised value,
else
start = 0;
- end = gvs_read_unaligned_le (value.data + last_end +
- (offset_size * index_),
- offset_size);
+ end = gvs_offsets_get_offset_n (&offsets, index_);
- if (start < end && end <= value.size && end <= last_end)
+ if (start < end && end <= value.size && end <= offsets.data_size)
{
child.data = value.data + start;
child.size = end - start;
@@ -768,34 +792,16 @@ static gboolean
gvs_variable_sized_array_is_normal (GVariantSerialised value)
{
GVariantSerialised child = { 0, };
- gsize offsets_array_size;
- guchar *offsets_array;
- guint offset_size;
guint alignment;
- gsize last_end;
- gsize length;
gsize offset;
gsize i;
- if (value.size == 0)
- return TRUE;
-
- offset_size = gvs_get_offset_size (value.size);
- last_end = gvs_read_unaligned_le (value.data + value.size -
- offset_size, offset_size);
+ struct Offsets offsets = gvs_variable_sized_array_get_frame_offsets (value);
- if (last_end > value.size)
+ if (!offsets.is_normal)
return FALSE;
- offsets_array_size = value.size - last_end;
-
- if (offsets_array_size % offset_size)
- return FALSE;
-
- offsets_array = value.data + value.size - offsets_array_size;
- length = offsets_array_size / offset_size;
-
- if (length == 0)
+ if (value.size != 0 && offsets.length == 0)
return FALSE;
child.type_info = g_variant_type_info_element (value.type_info);
@@ -803,14 +809,14 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
child.depth = value.depth + 1;
offset = 0;
- for (i = 0; i < length; i++)
+ for (i = 0; i < offsets.length; i++)
{
gsize this_end;
- this_end = gvs_read_unaligned_le (offsets_array + offset_size * i,
- offset_size);
+ this_end = gvs_read_unaligned_le (offsets.array + offsets.offset_size * i,
+ offsets.offset_size);
- if (this_end < offset || this_end > last_end)
+ if (this_end < offset || this_end > offsets.data_size)
return FALSE;
while (offset & alignment)
@@ -832,7 +838,7 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
offset = this_end;
}
- g_assert (offset == last_end);
+ g_assert (offset == offsets.data_size);
return TRUE;
}
--
2.24.4

View File

@@ -0,0 +1,417 @@
From ade71fb544391b2e33e1859645726bfee0d5eaaf Mon Sep 17 00:00:00 2001
From: William Manley <will@stb-tester.com>
Date: Wed, 16 Aug 2023 03:12:21 +0000
Subject: [PATCH] gvariant: Don't allow child elements to overlap with each
other
If different elements of a variable sized array can overlap with each
other then we can cause a `GVariant` to normalise to a much larger type.
This commit changes the behaviour of `GVariant` with non-normal form data. If
an invalid frame offset is found all subsequent elements are given their
default value.
When retrieving an element at index `n` we scan the frame offsets up to index
`n` and if they are not in order we return an element with the default value
for that type. This guarantees that elements don't overlap with each
other. We remember the offset we've scanned up to so we don't need to
repeat this work on subsequent accesses. We skip these checks for trusted
data.
Unfortunately this makes random access of untrusted data O(n) — at least
on first access. It doesn't affect the algorithmic complexity of accessing
elements in order, such as when using the `GVariantIter` interface. Also:
the cost of validation will be amortised as the `GVariant` instance is
continued to be used.
I've implemented this with 4 different functions, 1 for each element size,
rather than looping calling `gvs_read_unaligned_le` in the hope that the
compiler will find it easy to optimise and should produce fairly tight
code.
Fixes: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/ade71fb544391b2e33e1859645726bfee0d5eaaf]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-core.c | 35 ++++++++++++++++
glib/gvariant-serialiser.c | 86 ++++++++++++++++++++++++++++++++++++--
glib/gvariant-serialiser.h | 8 ++++
glib/tests/gvariant.c | 45 ++++++++++++++++++++
4 files changed, 171 insertions(+), 3 deletions(-)
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index aa0e0a0..9b51e15 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -65,6 +65,7 @@ struct _GVariant
{
GBytes *bytes;
gconstpointer data;
+ gsize ordered_offsets_up_to;
} serialised;
struct
@@ -162,6 +163,24 @@ struct _GVariant
* if .data pointed to the appropriate number of nul
* bytes.
*
+ * .ordered_offsets_up_to: If ordered_offsets_up_to == n this means that all
+ * the frame offsets up to and including the frame
+ * offset determining the end of element n are in
+ * order. This guarantees that the bytes of element
+ * n don't overlap with any previous element.
+ *
+ * For trusted data this is set to G_MAXSIZE and we
+ * don't check that the frame offsets are in order.
+ *
+ * Note: This doesn't imply the offsets are good in
+ * any way apart from their ordering. In particular
+ * offsets may be out of bounds for this value or
+ * may imply that the data overlaps the frame
+ * offsets themselves.
+ *
+ * This field is only relevant for arrays of non
+ * fixed width types.
+ *
* .tree: Only valid when the instance is in tree form.
*
* Note that accesses from other threads could result in
@@ -365,6 +384,7 @@ g_variant_to_serialised (GVariant *value)
(gpointer) value->contents.serialised.data,
value->size,
value->depth,
+ value->contents.serialised.ordered_offsets_up_to,
};
return serialised;
}
@@ -396,6 +416,7 @@ g_variant_serialise (GVariant *value,
serialised.size = value->size;
serialised.data = data;
serialised.depth = value->depth;
+ serialised.ordered_offsets_up_to = 0;
children = (gpointer *) value->contents.tree.children;
n_children = value->contents.tree.n_children;
@@ -439,6 +460,15 @@ g_variant_fill_gvs (GVariantSerialised *serialised,
g_assert (serialised->size == value->size);
serialised->depth = value->depth;
+ if (value->state & STATE_SERIALISED)
+ {
+ serialised->ordered_offsets_up_to = value->contents.serialised.ordered_offsets_up_to;
+ }
+ else
+ {
+ serialised->ordered_offsets_up_to = 0;
+ }
+
if (serialised->data)
/* g_variant_store() is a public API, so it
* it will reacquire the lock if it needs to.
@@ -481,6 +511,7 @@ g_variant_ensure_serialised (GVariant *value)
bytes = g_bytes_new_take (data, value->size);
value->contents.serialised.data = g_bytes_get_data (bytes, NULL);
value->contents.serialised.bytes = bytes;
+ value->contents.serialised.ordered_offsets_up_to = G_MAXSIZE;
value->state |= STATE_SERIALISED;
}
}
@@ -561,6 +592,7 @@ g_variant_new_from_bytes (const GVariantType *type,
serialised.type_info = value->type_info;
serialised.data = (guchar *) g_bytes_get_data (bytes, &serialised.size);
serialised.depth = 0;
+ serialised.ordered_offsets_up_to = trusted ? G_MAXSIZE : 0;
if (!g_variant_serialised_check (serialised))
{
@@ -610,6 +642,8 @@ g_variant_new_from_bytes (const GVariantType *type,
value->contents.serialised.data = g_bytes_get_data (bytes, &value->size);
}
+ value->contents.serialised.ordered_offsets_up_to = trusted ? G_MAXSIZE : 0;
+
g_clear_pointer (&owned_bytes, g_bytes_unref);
return value;
@@ -1108,6 +1142,7 @@ g_variant_get_child_value (GVariant *value,
child->contents.serialised.bytes =
g_bytes_ref (value->contents.serialised.bytes);
child->contents.serialised.data = s_child.data;
+ child->contents.serialised.ordered_offsets_up_to = s_child.ordered_offsets_up_to;
return child;
}
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index c7c2114..fe0b1a4 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -1,6 +1,7 @@
/*
* Copyright © 2007, 2008 Ryan Lortie
* Copyright © 2010 Codethink Limited
+ * Copyright © 2020 William Manley
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -264,6 +265,7 @@ gvs_fixed_sized_maybe_get_child (GVariantSerialised value,
value.type_info = g_variant_type_info_element (value.type_info);
g_variant_type_info_ref (value.type_info);
value.depth++;
+ value.ordered_offsets_up_to = 0;
return value;
}
@@ -295,7 +297,7 @@ gvs_fixed_sized_maybe_serialise (GVariantSerialised value,
{
if (n_children)
{
- GVariantSerialised child = { NULL, value.data, value.size, value.depth + 1 };
+ GVariantSerialised child = { NULL, value.data, value.size, value.depth + 1, 0 };
gvs_filler (&child, children[0]);
}
@@ -317,6 +319,7 @@ gvs_fixed_sized_maybe_is_normal (GVariantSerialised value)
/* proper element size: "Just". recurse to the child. */
value.type_info = g_variant_type_info_element (value.type_info);
value.depth++;
+ value.ordered_offsets_up_to = 0;
return g_variant_serialised_is_normal (value);
}
@@ -358,6 +361,7 @@ gvs_variable_sized_maybe_get_child (GVariantSerialised value,
value.data = NULL;
value.depth++;
+ value.ordered_offsets_up_to = 0;
return value;
}
@@ -388,7 +392,7 @@ gvs_variable_sized_maybe_serialise (GVariantSerialised value,
{
if (n_children)
{
- GVariantSerialised child = { NULL, value.data, value.size - 1, value.depth + 1 };
+ GVariantSerialised child = { NULL, value.data, value.size - 1, value.depth + 1, 0 };
/* write the data for the child. */
gvs_filler (&child, children[0]);
@@ -408,6 +412,7 @@ gvs_variable_sized_maybe_is_normal (GVariantSerialised value)
value.type_info = g_variant_type_info_element (value.type_info);
value.size--;
value.depth++;
+ value.ordered_offsets_up_to = 0;
return g_variant_serialised_is_normal (value);
}
@@ -691,6 +696,32 @@ gvs_variable_sized_array_n_children (GVariantSerialised value)
return gvs_variable_sized_array_get_frame_offsets (value).length;
}
+/* Find the index of the first out-of-order element in @data, assuming that
+ * @data is an array of elements of given @type, starting at index @start and
+ * containing a further @len-@start elements. */
+#define DEFINE_FIND_UNORDERED(type) \
+ static gsize \
+ find_unordered_##type (const guint8 *data, gsize start, gsize len) \
+ { \
+ gsize off; \
+ type current, previous; \
+ \
+ memcpy (&previous, data + start * sizeof (current), sizeof (current)); \
+ for (off = (start + 1) * sizeof (current); off < len * sizeof (current); off += sizeof (current)) \
+ { \
+ memcpy (&current, data + off, sizeof (current)); \
+ if (current < previous) \
+ break; \
+ previous = current; \
+ } \
+ return off / sizeof (current) - 1; \
+ }
+
+DEFINE_FIND_UNORDERED (guint8);
+DEFINE_FIND_UNORDERED (guint16);
+DEFINE_FIND_UNORDERED (guint32);
+DEFINE_FIND_UNORDERED (guint64);
+
static GVariantSerialised
gvs_variable_sized_array_get_child (GVariantSerialised value,
gsize index_)
@@ -706,6 +737,49 @@ gvs_variable_sized_array_get_child (GVariantSerialised value,
g_variant_type_info_ref (child.type_info);
child.depth = value.depth + 1;
+ /* If the requested @index_ is beyond the set of indices whose framing offsets
+ * have been checked, check the remaining offsets to see whether theyre
+ * normal (in order, no overlapping array elements). */
+ if (index_ > value.ordered_offsets_up_to)
+ {
+ switch (offsets.offset_size)
+ {
+ case 1:
+ {
+ value.ordered_offsets_up_to = find_unordered_guint8 (
+ offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ break;
+ }
+ case 2:
+ {
+ value.ordered_offsets_up_to = find_unordered_guint16 (
+ offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ break;
+ }
+ case 4:
+ {
+ value.ordered_offsets_up_to = find_unordered_guint32 (
+ offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ break;
+ }
+ case 8:
+ {
+ value.ordered_offsets_up_to = find_unordered_guint64 (
+ offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ break;
+ }
+ default:
+ /* gvs_get_offset_size() only returns maximum 8 */
+ g_assert_not_reached ();
+ }
+ }
+
+ if (index_ > value.ordered_offsets_up_to)
+ {
+ /* Offsets are invalid somewhere, so return an empty child. */
+ return child;
+ }
+
if (index_ > 0)
{
guint alignment;
@@ -840,6 +914,9 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
g_assert (offset == offsets.data_size);
+ /* All offsets have now been checked. */
+ value.ordered_offsets_up_to = G_MAXSIZE;
+
return TRUE;
}
@@ -1072,7 +1149,7 @@ gvs_tuple_is_normal (GVariantSerialised value)
for (i = 0; i < length; i++)
{
const GVariantMemberInfo *member_info;
- GVariantSerialised child;
+ GVariantSerialised child = { 0, };
gsize fixed_size;
guint alignment;
gsize end;
@@ -1132,6 +1209,9 @@ gvs_tuple_is_normal (GVariantSerialised value)
offset = end;
}
+ /* All element bounds have been checked above. */
+ value.ordered_offsets_up_to = G_MAXSIZE;
+
{
gsize fixed_size;
guint alignment;
diff --git a/glib/gvariant-serialiser.h b/glib/gvariant-serialiser.h
index 81343e9..99d18ef 100644
--- a/glib/gvariant-serialiser.h
+++ b/glib/gvariant-serialiser.h
@@ -29,6 +29,14 @@ typedef struct
guchar *data;
gsize size;
gsize depth; /* same semantics as GVariant.depth */
+ /* If ordered_offsets_up_to == n this means that all the frame offsets up to and
+ * including the frame offset determining the end of element n are in order.
+ * This guarantees that the bytes of element n don't overlap with any previous
+ * element.
+ *
+ * This is both read and set by g_variant_serialised_get_child for arrays of
+ * non-fixed-width types */
+ gsize ordered_offsets_up_to;
} GVariantSerialised;
/* deserialisation */
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 0e5ec8e..967e9a1 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2010 Codethink Limited
+ * Copyright © 2020 William Manley
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1283,6 +1284,7 @@ random_instance_filler (GVariantSerialised *serialised,
serialised->size = instance->size;
serialised->depth = 0;
+ serialised->ordered_offsets_up_to = 0;
g_assert_true (serialised->type_info == instance->type_info);
g_assert_cmpuint (serialised->size, ==, instance->size);
@@ -5039,6 +5041,47 @@ test_normal_checking_array_offsets (void)
g_variant_unref (variant);
}
+/* This is a regression test that we can't have non-normal values that take up
+ * significantly more space than the normal equivalent, by specifying the
+ * offset table entries so that array elements overlap.
+ *
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2121#note_832242 */
+static void
+test_normal_checking_array_offsets2 (void)
+{
+ const guint8 data[] = {
+ 'h', 'i', '\0',
+ 0x03, 0x00, 0x03,
+ 0x06, 0x00, 0x06,
+ 0x09, 0x00, 0x09,
+ 0x0c, 0x00, 0x0c,
+ 0x0f, 0x00, 0x0f,
+ 0x12, 0x00, 0x12,
+ 0x15, 0x00, 0x15,
+ };
+ gsize size = sizeof (data);
+ const GVariantType *aaaaaaas = G_VARIANT_TYPE ("aaaaaaas");
+ GVariant *variant = NULL;
+ GVariant *normal_variant = NULL;
+ GVariant *expected = NULL;
+
+ variant = g_variant_new_from_data (aaaaaaas, data, size, FALSE, NULL, NULL);
+ g_assert_nonnull (variant);
+
+ normal_variant = g_variant_get_normal_form (variant);
+ g_assert_nonnull (normal_variant);
+ g_assert_cmpuint (g_variant_get_size (normal_variant), <=, size * 2);
+
+ expected = g_variant_new_parsed (
+ "[[[[[[['hi', '', ''], [], []], [], []], [], []], [], []], [], []], [], []]");
+ g_assert_cmpvariant (expected, variant);
+ g_assert_cmpvariant (expected, normal_variant);
+
+ g_variant_unref (expected);
+ g_variant_unref (normal_variant);
+ g_variant_unref (variant);
+}
+
/* Test that a tuple with invalidly large values in its offset table is
* normalised successfully without looping infinitely. */
static void
@@ -5206,6 +5249,8 @@ main (int argc, char **argv)
test_normal_checking_tuples);
g_test_add_func ("/gvariant/normal-checking/array-offsets",
test_normal_checking_array_offsets);
+ g_test_add_func ("/gvariant/normal-checking/array-offsets2",
+ test_normal_checking_array_offsets2);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets",
test_normal_checking_tuple_offsets);
g_test_add_func ("/gvariant/normal-checking/empty-object-path",
--
2.24.4

View File

@@ -0,0 +1,113 @@
From 345cae9c1aa7bf6752039225ef4c8d8d69fa8d76 Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Fri, 11 Aug 2023 04:09:12 +0000
Subject: [PATCH] gvariant-serialiser: Factor out code to get bounds of a tuple
member
This introduces no functional changes.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/345cae9c1aa7bf6752039225ef4c8d8d69fa8d76]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-serialiser.c | 73 ++++++++++++++++++++++++--------------
1 file changed, 46 insertions(+), 27 deletions(-)
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index fe0b1a4..6f9b366 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -942,6 +942,51 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
* for the tuple. See the notes in gvarianttypeinfo.h.
*/
+static void
+gvs_tuple_get_member_bounds (GVariantSerialised value,
+ gsize index_,
+ gsize offset_size,
+ gsize *out_member_start,
+ gsize *out_member_end)
+{
+ const GVariantMemberInfo *member_info;
+ gsize member_start, member_end;
+
+ member_info = g_variant_type_info_member_info (value.type_info, index_);
+
+ if (member_info->i + 1)
+ member_start = gvs_read_unaligned_le (value.data + value.size -
+ offset_size * (member_info->i + 1),
+ offset_size);
+ else
+ member_start = 0;
+
+ member_start += member_info->a;
+ member_start &= member_info->b;
+ member_start |= member_info->c;
+
+ if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_LAST)
+ member_end = value.size - offset_size * (member_info->i + 1);
+
+ else if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_FIXED)
+ {
+ gsize fixed_size;
+
+ g_variant_type_info_query (member_info->type_info, NULL, &fixed_size);
+ member_end = member_start + fixed_size;
+ }
+
+ else /* G_VARIANT_MEMBER_ENDING_OFFSET */
+ member_end = gvs_read_unaligned_le (value.data + value.size -
+ offset_size * (member_info->i + 2),
+ offset_size);
+
+ if (out_member_start != NULL)
+ *out_member_start = member_start;
+ if (out_member_end != NULL)
+ *out_member_end = member_end;
+}
+
static gsize
gvs_tuple_n_children (GVariantSerialised value)
{
@@ -997,33 +1042,7 @@ gvs_tuple_get_child (GVariantSerialised value,
}
}
- if (member_info->i + 1)
- start = gvs_read_unaligned_le (value.data + value.size -
- offset_size * (member_info->i + 1),
- offset_size);
- else
- start = 0;
-
- start += member_info->a;
- start &= member_info->b;
- start |= member_info->c;
-
- if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_LAST)
- end = value.size - offset_size * (member_info->i + 1);
-
- else if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_FIXED)
- {
- gsize fixed_size;
-
- g_variant_type_info_query (child.type_info, NULL, &fixed_size);
- end = start + fixed_size;
- child.size = fixed_size;
- }
-
- else /* G_VARIANT_MEMBER_ENDING_OFFSET */
- end = gvs_read_unaligned_le (value.data + value.size -
- offset_size * (member_info->i + 2),
- offset_size);
+ gvs_tuple_get_member_bounds (value, index_, offset_size, &start, &end);
/* The child should not extend into the offset table. */
if (index_ != g_variant_type_info_n_members (value.type_info) - 1)
--
2.24.4

View File

@@ -0,0 +1,80 @@
From 73d0aa81c2575a5c9ae77dcb94da919579014fc0 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Fri, 11 Aug 2023 04:13:02 +0000
Subject: [PATCH] gvariant-serialiser: Rework child size calculation
This reduces a few duplicate calls to `g_variant_type_info_query()` and
explains why theyre needed.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/73d0aa81c2575a5c9ae77dcb94da919579014fc0]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-serialiser.c | 31 +++++++++----------------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index 6f9b366..fb75923 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -1007,14 +1007,18 @@ gvs_tuple_get_child (GVariantSerialised value,
child.depth = value.depth + 1;
offset_size = gvs_get_offset_size (value.size);
+ /* Ensure the size is set for fixed-sized children, or
+ * g_variant_serialised_check() will fail, even if we return
+ * (child.data == NULL) to indicate an error. */
+ if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_FIXED)
+ g_variant_type_info_query (child.type_info, NULL, &child.size);
+
/* tuples are the only (potentially) fixed-sized containers, so the
* only ones that have to deal with the possibility of having %NULL
* data with a non-zero %size if errors occurred elsewhere.
*/
if G_UNLIKELY (value.data == NULL && value.size != 0)
{
- g_variant_type_info_query (child.type_info, NULL, &child.size);
-
/* this can only happen in fixed-sized tuples,
* so the child must also be fixed sized.
*/
@@ -1032,29 +1036,12 @@ gvs_tuple_get_child (GVariantSerialised value,
else
{
if (offset_size * (member_info->i + 1) > value.size)
- {
- /* if the child is fixed size, return its size.
- * if child is not fixed-sized, return size = 0.
- */
- g_variant_type_info_query (child.type_info, NULL, &child.size);
-
- return child;
- }
+ return child;
}
- gvs_tuple_get_member_bounds (value, index_, offset_size, &start, &end);
-
/* The child should not extend into the offset table. */
- if (index_ != g_variant_type_info_n_members (value.type_info) - 1)
- {
- GVariantSerialised last_child;
- last_child = gvs_tuple_get_child (value,
- g_variant_type_info_n_members (value.type_info) - 1);
- last_end = last_child.data + last_child.size - value.data;
- g_variant_type_info_unref (last_child.type_info);
- }
- else
- last_end = end;
+ gvs_tuple_get_member_bounds (value, index_, offset_size, &start, &end);
+ gvs_tuple_get_member_bounds (value, g_variant_type_info_n_members (value.type_info) - 1, offset_size, NULL, &last_end);
if (start < end && end <= value.size && end <= last_end)
{
--
2.24.4

View File

@@ -0,0 +1,396 @@
From 7cf6f5b69146d20948d42f0c476688fe17fef787 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Wed, 16 Aug 2023 12:09:06 +0000
Subject: [PATCH] gvariant: Don't allow child elements of a tuple to overlap
each other
This is similar to the earlier commit which prevents child elements of a
variable-sized array from overlapping each other, but this time for
tuples. It is based heavily on ideas by William Manley.
Tuples are slightly different from variable-sized arrays in that they
contain a mixture of fixed and variable sized elements. All but one of
the variable sized elements have an entry in the frame offsets table.
This means that if we were to just check the ordering of the frame
offsets table, the variable sized elements could still overlap
interleaving fixed sized elements, which would be bad.
Therefore we have to check the elements rather than the frame offsets.
The logic of checking the elements up to the index currently being
requested, and caching the result in `ordered_offsets_up_to`, means that
the algorithmic cost implications are the same for this commit as for
variable-sized arrays: an O(N) cost for these checks is amortised out
over N accesses to O(1) per access.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/7cf6f5b69146d20948d42f0c476688fe17fef787]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-core.c | 6 +-
glib/gvariant-serialiser.c | 40 ++++++++
glib/gvariant-serialiser.h | 7 +-
glib/gvariant.c | 1 +
glib/tests/gvariant.c | 181 +++++++++++++++++++++++++++++++++++++
5 files changed, 232 insertions(+), 3 deletions(-)
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index 9b51e15..b951cd9 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -1,6 +1,7 @@
/*
* Copyright © 2007, 2008 Ryan Lortie
* Copyright © 2010 Codethink Limited
+ * Copyright © 2022 Endless OS Foundation, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -179,7 +180,7 @@ struct _GVariant
* offsets themselves.
*
* This field is only relevant for arrays of non
- * fixed width types.
+ * fixed width types and for tuples.
*
* .tree: Only valid when the instance is in tree form.
*
@@ -1117,6 +1118,9 @@ g_variant_get_child_value (GVariant *value,
*/
s_child = g_variant_serialised_get_child (serialised, index_);
+ /* Update the cached ordered_offsets_up_to, since @serialised will be thrown away when this function exits */
+ value->contents.serialised.ordered_offsets_up_to = MAX (value->contents.serialised.ordered_offsets_up_to, serialised.ordered_offsets_up_to);
+
/* Check whether this would cause nesting too deep. If so, return a fake
* child. The only situation we expect this to happen in is with a variant,
* as all other deeply-nested types have a static type, and hence should
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index fb75923..cd4a3e6 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -942,6 +942,10 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
* for the tuple. See the notes in gvarianttypeinfo.h.
*/
+/* Note: This doesnt guarantee that @out_member_end >= @out_member_start; that
+ * condition may not hold true for invalid serialised variants. The caller is
+ * responsible for checking the returned values and handling invalid ones
+ * appropriately. */
static void
gvs_tuple_get_member_bounds (GVariantSerialised value,
gsize index_,
@@ -1028,6 +1032,42 @@ gvs_tuple_get_child (GVariantSerialised value,
return child;
}
+ /* If the requested @index_ is beyond the set of indices whose framing offsets
+ * have been checked, check the remaining offsets to see whether theyre
+ * normal (in order, no overlapping tuple elements).
+ *
+ * Unlike the checks in gvs_variable_sized_array_get_child(), we have to check
+ * all the tuple *elements* here, not just all the framing offsets, since
+ * tuples contain a mix of elements which use framing offsets and ones which
+ * dont. None of them are allowed to overlap. */
+ if (index_ > value.ordered_offsets_up_to)
+ {
+ gsize i, prev_i_end = 0;
+
+ if (value.ordered_offsets_up_to > 0)
+ gvs_tuple_get_member_bounds (value, value.ordered_offsets_up_to - 1, offset_size, NULL, &prev_i_end);
+
+ for (i = value.ordered_offsets_up_to; i <= index_; i++)
+ {
+ gsize i_start, i_end;
+
+ gvs_tuple_get_member_bounds (value, i, offset_size, &i_start, &i_end);
+
+ if (i_start > i_end || i_start < prev_i_end || i_end > value.size)
+ break;
+
+ prev_i_end = i_end;
+ }
+
+ value.ordered_offsets_up_to = i - 1;
+ }
+
+ if (index_ > value.ordered_offsets_up_to)
+ {
+ /* Offsets are invalid somewhere, so return an empty child. */
+ return child;
+ }
+
if (member_info->ending_type == G_VARIANT_MEMBER_ENDING_OFFSET)
{
if (offset_size * (member_info->i + 2) > value.size)
diff --git a/glib/gvariant-serialiser.h b/glib/gvariant-serialiser.h
index 99d18ef..144aec8 100644
--- a/glib/gvariant-serialiser.h
+++ b/glib/gvariant-serialiser.h
@@ -34,8 +34,11 @@ typedef struct
* This guarantees that the bytes of element n don't overlap with any previous
* element.
*
- * This is both read and set by g_variant_serialised_get_child for arrays of
- * non-fixed-width types */
+ * This is both read and set by g_variant_serialised_get_child() for arrays of
+ * non-fixed-width types, and for tuples.
+ *
+ * Even when dealing with tuples, @ordered_offsets_up_to is an element index,
+ * rather than an index into the frame offsets. */
gsize ordered_offsets_up_to;
} GVariantSerialised;
diff --git a/glib/gvariant.c b/glib/gvariant.c
index d6f68a9..cdb428e 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5945,6 +5945,7 @@ g_variant_byteswap (GVariant *value)
serialised.type_info = g_variant_get_type_info (trusted);
serialised.size = g_variant_get_size (trusted);
serialised.data = g_malloc (serialised.size);
+ serialised.ordered_offsets_up_to = G_MAXSIZE; /* operating on the normal form */
g_variant_store (trusted, serialised.data);
g_variant_unref (trusted);
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 967e9a1..a84b02e 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -1,6 +1,7 @@
/*
* Copyright © 2010 Codethink Limited
* Copyright © 2020 William Manley
+ * Copyright © 2022 Endless OS Foundation, LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1451,6 +1452,7 @@ test_maybe (void)
serialised.data = flavoured_malloc (needed_size, flavour);
serialised.size = needed_size;
serialised.depth = 0;
+ serialised.ordered_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised,
random_instance_filler,
@@ -1574,6 +1576,7 @@ test_array (void)
serialised.data = flavoured_malloc (needed_size, flavour);
serialised.size = needed_size;
serialised.depth = 0;
+ serialised.ordered_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) instances, n_children);
@@ -1738,6 +1741,7 @@ test_tuple (void)
serialised.data = flavoured_malloc (needed_size, flavour);
serialised.size = needed_size;
serialised.depth = 0;
+ serialised.ordered_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) instances, n_children);
@@ -1834,6 +1838,7 @@ test_variant (void)
serialised.data = flavoured_malloc (needed_size, flavour);
serialised.size = needed_size;
serialised.depth = 0;
+ serialised.ordered_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) &instance, 1);
@@ -5106,6 +5111,176 @@ test_normal_checking_tuple_offsets (void)
g_variant_unref (variant);
}
+/* This is a regression test that we can't have non-normal values that take up
+ * significantly more space than the normal equivalent, by specifying the
+ * offset table entries so that tuple elements overlap.
+ *
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2121#note_838503 and
+ * https://gitlab.gnome.org/GNOME/glib/-/issues/2121#note_838513 */
+static void
+test_normal_checking_tuple_offsets2 (void)
+{
+ const GVariantType *data_type = G_VARIANT_TYPE ("(yyaiyyaiyy)");
+ const guint8 data[] = {
+ 0x12, 0x34, 0x56, 0x78, 0x01,
+ /*
+ ^───────────────────┘
+
+ ^^^^^^^^^^ 1st yy
+ ^^^^^^^^^^ 2nd yy
+ ^^^^^^^^^^ 3rd yy
+ ^^^^ Framing offsets
+ */
+
+ /* If this variant was encoded normally, it would be something like this:
+ * 0x12, 0x34, pad, pad, [array bytes], 0x56, 0x78, pad, pad, [array bytes], 0x9A, 0xBC, 0xXX
+ * ^─────────────────────────────────────────────────────┘
+ *
+ * ^^^^^^^^^^ 1st yy
+ * ^^^^^^^^^^ 2nd yy
+ * ^^^^^^^^^^ 3rd yy
+ * ^^^^ Framing offsets
+ */
+ };
+ gsize size = sizeof (data);
+ GVariant *variant = NULL;
+ GVariant *normal_variant = NULL;
+ GVariant *expected = NULL;
+
+ variant = g_variant_new_from_data (data_type, data, size, FALSE, NULL, NULL);
+ g_assert_nonnull (variant);
+
+ normal_variant = g_variant_get_normal_form (variant);
+ g_assert_nonnull (normal_variant);
+ g_assert_cmpuint (g_variant_get_size (normal_variant), <=, size * 3);
+
+ expected = g_variant_new_parsed (
+ "@(yyaiyyaiyy) (0x12, 0x34, [], 0x00, 0x00, [], 0x00, 0x00)");
+ g_assert_cmpvariant (expected, variant);
+ g_assert_cmpvariant (expected, normal_variant);
+
+ g_variant_unref (expected);
+ g_variant_unref (normal_variant);
+ g_variant_unref (variant);
+}
+
+/* This is a regression test that overlapping entries in the offset table are
+ * decoded consistently, even though theyre non-normal.
+ *
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2121#note_910935 */
+static void
+test_normal_checking_tuple_offsets3 (void)
+{
+ /* The expected decoding of this non-normal byte stream is complex. See
+ * section 2.7.3 (Handling Non-Normal Serialised Data) of the GVariant
+ * specification.
+ *
+ * The rule “Child Values Overlapping Framing Offsets” from the specification
+ * says that the first `ay` must be decoded as `[0x01]` even though it
+ * overlaps the first byte of the offset table. However, since commit
+ * 7eedcd76f7d5b8c98fa60013e1fe6e960bf19df3, GLib explicitly doesnt allow
+ * this as its exploitable. So the first `ay` must be given a default value.
+ *
+ * The second and third `ay`s must be given default values because of rule
+ * “End Boundary Precedes Start Boundary”.
+ *
+ * The `i` must be given a default value because of rule “Start or End
+ * Boundary of a Child Falls Outside the Container”.
+ */
+ const GVariantType *data_type = G_VARIANT_TYPE ("(ayayiay)");
+ const guint8 data[] = {
+ 0x01, 0x00, 0x02,
+ /*
+ ^──┘
+
+ ^^^^^^^^^^ 1st ay, bytes 0-2 (but given a default value anyway, see above)
+ 2nd ay, bytes 2-0
+ i, bytes 0-4
+ 3rd ay, bytes 4-1
+ ^^^^^^^^^^ Framing offsets
+ */
+ };
+ gsize size = sizeof (data);
+ GVariant *variant = NULL;
+ GVariant *normal_variant = NULL;
+ GVariant *expected = NULL;
+
+ variant = g_variant_new_from_data (data_type, data, size, FALSE, NULL, NULL);
+ g_assert_nonnull (variant);
+
+ g_assert_false (g_variant_is_normal_form (variant));
+
+ normal_variant = g_variant_get_normal_form (variant);
+ g_assert_nonnull (normal_variant);
+ g_assert_cmpuint (g_variant_get_size (normal_variant), <=, size * 3);
+
+ expected = g_variant_new_parsed ("@(ayayiay) ([], [], 0, [])");
+ g_assert_cmpvariant (expected, variant);
+ g_assert_cmpvariant (expected, normal_variant);
+
+ g_variant_unref (expected);
+ g_variant_unref (normal_variant);
+ g_variant_unref (variant);
+}
+
+/* This is a regression test that overlapping entries in the offset table are
+ * decoded consistently, even though theyre non-normal.
+ *
+ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2121#note_910935 */
+static void
+test_normal_checking_tuple_offsets4 (void)
+{
+ /* The expected decoding of this non-normal byte stream is complex. See
+ * section 2.7.3 (Handling Non-Normal Serialised Data) of the GVariant
+ * specification.
+ *
+ * The rule “Child Values Overlapping Framing Offsets” from the specification
+ * says that the first `ay` must be decoded as `[0x01]` even though it
+ * overlaps the first byte of the offset table. However, since commit
+ * 7eedcd76f7d5b8c98fa60013e1fe6e960bf19df3, GLib explicitly doesnt allow
+ * this as its exploitable. So the first `ay` must be given a default value.
+ *
+ * The second `ay` must be given a default value because of rule “End Boundary
+ * Precedes Start Boundary”.
+ *
+ * The third `ay` must be given a default value because its framing offsets
+ * overlap that of the first `ay`.
+ */
+ const GVariantType *data_type = G_VARIANT_TYPE ("(ayayay)");
+ const guint8 data[] = {
+ 0x01, 0x00, 0x02,
+ /*
+ ^──┘
+
+ ^^^^^^^^^^ 1st ay, bytes 0-2 (but given a default value anyway, see above)
+ 2nd ay, bytes 2-0
+ 3rd ay, bytes 0-1
+ ^^^^^^^^^^ Framing offsets
+ */
+ };
+ gsize size = sizeof (data);
+ GVariant *variant = NULL;
+ GVariant *normal_variant = NULL;
+ GVariant *expected = NULL;
+
+ variant = g_variant_new_from_data (data_type, data, size, FALSE, NULL, NULL);
+ g_assert_nonnull (variant);
+
+ g_assert_false (g_variant_is_normal_form (variant));
+
+ normal_variant = g_variant_get_normal_form (variant);
+ g_assert_nonnull (normal_variant);
+ g_assert_cmpuint (g_variant_get_size (normal_variant), <=, size * 3);
+
+ expected = g_variant_new_parsed ("@(ayayay) ([], [], [])");
+ g_assert_cmpvariant (expected, variant);
+ g_assert_cmpvariant (expected, normal_variant);
+
+ g_variant_unref (expected);
+ g_variant_unref (normal_variant);
+ g_variant_unref (variant);
+}
+
/* Test that an empty object path is normalised successfully to the base object
* path, /. */
static void
@@ -5253,6 +5428,12 @@ main (int argc, char **argv)
test_normal_checking_array_offsets2);
g_test_add_func ("/gvariant/normal-checking/tuple-offsets",
test_normal_checking_tuple_offsets);
+ g_test_add_func ("/gvariant/normal-checking/tuple-offsets2",
+ test_normal_checking_tuple_offsets2);
+ g_test_add_func ("/gvariant/normal-checking/tuple-offsets3",
+ test_normal_checking_tuple_offsets3);
+ g_test_add_func ("/gvariant/normal-checking/tuple-offsets4",
+ test_normal_checking_tuple_offsets4);
g_test_add_func ("/gvariant/normal-checking/empty-object-path",
test_normal_checking_empty_object_path);
--
2.24.4

View File

@@ -0,0 +1,49 @@
From e6490c84e84ba9f182fbd83b51ff4f9f5a0a1793 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Wed, 16 Aug 2023 03:42:47 +0000
Subject: [PATCH] gvariant: Port g_variant_deep_copy() to count its iterations
directly
This is equivalent to what `GVariantIter` does, but it means that
`g_variant_deep_copy()` is making its own `g_variant_get_child_value()`
calls.
This will be useful in an upcoming commit, where those child values will
be inspected a little more deeply.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/e6490c84e84ba9f182fbd83b51ff4f9f5a0a1793]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/glib/gvariant.c b/glib/gvariant.c
index cdb428e..fdd36be 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5799,14 +5799,13 @@ g_variant_deep_copy (GVariant *value)
case G_VARIANT_CLASS_VARIANT:
{
GVariantBuilder builder;
- GVariantIter iter;
- GVariant *child;
+ gsize i, n_children;
g_variant_builder_init (&builder, g_variant_get_type (value));
- g_variant_iter_init (&iter, value);
- while ((child = g_variant_iter_next_value (&iter)))
+ for (i = 0, n_children = g_variant_n_children (value); i < n_children; i++)
{
+ GVariant *child = g_variant_get_child_value (value, i);
g_variant_builder_add_value (&builder, g_variant_deep_copy (child));
g_variant_unref (child);
}
--
2.24.4

View File

@@ -0,0 +1,394 @@
From d1a293c4e29880b8d17bb826c9a426a440ca4a91 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 17 Aug 2023 01:30:38 +0000
Subject: [PATCH] gvariant: Track checked and ordered offsets independently
The past few commits introduced the concept of known-good offsets in the
offset table (which is used for variable-width arrays and tuples).
Good offsets are ones which are non-overlapping with all the previous
offsets in the table.
If a bad offset is encountered when indexing into the array or tuple,
the cached known-good offset index will not be increased. In this way,
all child variants at and beyond the first bad offset can be returned as
default values rather than dereferencing potentially invalid data.
In this case, there was no information about the fact that the indexes
between the highest known-good index and the requested one had been
checked already. That could lead to a pathological case where an offset
table with an invalid first offset is repeatedly checked in full when
trying to access higher-indexed children.
Avoid that by storing the index of the highest checked offset in the
table, as well as the index of the highest good/ordered offset.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/d1a293c4e29880b8d17bb826c9a426a440ca4a91]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant-core.c | 28 ++++++++++++++++++++++++
glib/gvariant-serialiser.c | 44 +++++++++++++++++++++++++++-----------
glib/gvariant-serialiser.h | 9 ++++++++
glib/gvariant.c | 1 +
glib/tests/gvariant.c | 5 +++++
5 files changed, 75 insertions(+), 12 deletions(-)
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index b951cd9..1b9d5cc 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -67,6 +67,7 @@ struct _GVariant
GBytes *bytes;
gconstpointer data;
gsize ordered_offsets_up_to;
+ gsize checked_offsets_up_to;
} serialised;
struct
@@ -182,6 +183,24 @@ struct _GVariant
* This field is only relevant for arrays of non
* fixed width types and for tuples.
*
+ * .checked_offsets_up_to: Similarly to .ordered_offsets_up_to, this stores
+ * the index of the highest element, n, whose frame
+ * offsets (and all the preceding frame offsets)
+ * have been checked for validity.
+ *
+ * It is always the case that
+ * .checked_offsets_up_to ≥ .ordered_offsets_up_to.
+ *
+ * If .checked_offsets_up_to == .ordered_offsets_up_to,
+ * then a bad offset has not been found so far.
+ *
+ * If .checked_offsets_up_to > .ordered_offsets_up_to,
+ * then a bad offset has been found at
+ * (.ordered_offsets_up_to + 1).
+ *
+ * This field is only relevant for arrays of non
+ * fixed width types and for tuples.
+ *
* .tree: Only valid when the instance is in tree form.
*
* Note that accesses from other threads could result in
@@ -386,6 +405,7 @@ g_variant_to_serialised (GVariant *value)
value->size,
value->depth,
value->contents.serialised.ordered_offsets_up_to,
+ value->contents.serialised.checked_offsets_up_to,
};
return serialised;
}
@@ -418,6 +438,7 @@ g_variant_serialise (GVariant *value,
serialised.data = data;
serialised.depth = value->depth;
serialised.ordered_offsets_up_to = 0;
+ serialised.checked_offsets_up_to = 0;
children = (gpointer *) value->contents.tree.children;
n_children = value->contents.tree.n_children;
@@ -464,10 +485,12 @@ g_variant_fill_gvs (GVariantSerialised *serialised,
if (value->state & STATE_SERIALISED)
{
serialised->ordered_offsets_up_to = value->contents.serialised.ordered_offsets_up_to;
+ serialised->checked_offsets_up_to = value->contents.serialised.checked_offsets_up_to;
}
else
{
serialised->ordered_offsets_up_to = 0;
+ serialised->checked_offsets_up_to = 0;
}
if (serialised->data)
@@ -513,6 +536,7 @@ g_variant_ensure_serialised (GVariant *value)
value->contents.serialised.data = g_bytes_get_data (bytes, NULL);
value->contents.serialised.bytes = bytes;
value->contents.serialised.ordered_offsets_up_to = G_MAXSIZE;
+ value->contents.serialised.checked_offsets_up_to = G_MAXSIZE;
value->state |= STATE_SERIALISED;
}
}
@@ -594,6 +618,7 @@ g_variant_new_from_bytes (const GVariantType *type,
serialised.data = (guchar *) g_bytes_get_data (bytes, &serialised.size);
serialised.depth = 0;
serialised.ordered_offsets_up_to = trusted ? G_MAXSIZE : 0;
+ serialised.checked_offsets_up_to = trusted ? G_MAXSIZE : 0;
if (!g_variant_serialised_check (serialised))
{
@@ -644,6 +669,7 @@ g_variant_new_from_bytes (const GVariantType *type,
}
value->contents.serialised.ordered_offsets_up_to = trusted ? G_MAXSIZE : 0;
+ value->contents.serialised.checked_offsets_up_to = trusted ? G_MAXSIZE : 0;
g_clear_pointer (&owned_bytes, g_bytes_unref);
@@ -1120,6 +1146,7 @@ g_variant_get_child_value (GVariant *value,
/* Update the cached ordered_offsets_up_to, since @serialised will be thrown away when this function exits */
value->contents.serialised.ordered_offsets_up_to = MAX (value->contents.serialised.ordered_offsets_up_to, serialised.ordered_offsets_up_to);
+ value->contents.serialised.checked_offsets_up_to = MAX (value->contents.serialised.checked_offsets_up_to, serialised.checked_offsets_up_to);
/* Check whether this would cause nesting too deep. If so, return a fake
* child. The only situation we expect this to happen in is with a variant,
@@ -1147,6 +1174,7 @@ g_variant_get_child_value (GVariant *value,
g_bytes_ref (value->contents.serialised.bytes);
child->contents.serialised.data = s_child.data;
child->contents.serialised.ordered_offsets_up_to = s_child.ordered_offsets_up_to;
+ child->contents.serialised.checked_offsets_up_to = s_child.checked_offsets_up_to;
return child;
}
diff --git a/glib/gvariant-serialiser.c b/glib/gvariant-serialiser.c
index cd4a3e6..0bf7243 100644
--- a/glib/gvariant-serialiser.c
+++ b/glib/gvariant-serialiser.c
@@ -120,6 +120,8 @@
*
* @depth has no restrictions; the depth of a top-level serialised #GVariant is
* zero, and it increases for each level of nested child.
+ *
+ * @checked_offsets_up_to is always ≥ @ordered_offsets_up_to
*/
/* < private >
@@ -147,6 +149,9 @@ g_variant_serialised_check (GVariantSerialised serialised)
!(serialised.size == 0 || serialised.data != NULL))
return FALSE;
+ if (serialised.ordered_offsets_up_to > serialised.checked_offsets_up_to)
+ return FALSE;
+
/* Depending on the native alignment requirements of the machine, the
* compiler will insert either 3 or 7 padding bytes after the char.
* This will result in the sizeof() the struct being 12 or 16.
@@ -266,6 +271,7 @@ gvs_fixed_sized_maybe_get_child (GVariantSerialised value,
g_variant_type_info_ref (value.type_info);
value.depth++;
value.ordered_offsets_up_to = 0;
+ value.checked_offsets_up_to = 0;
return value;
}
@@ -297,7 +303,7 @@ gvs_fixed_sized_maybe_serialise (GVariantSerialised value,
{
if (n_children)
{
- GVariantSerialised child = { NULL, value.data, value.size, value.depth + 1, 0 };
+ GVariantSerialised child = { NULL, value.data, value.size, value.depth + 1, 0, 0 };
gvs_filler (&child, children[0]);
}
@@ -320,6 +326,7 @@ gvs_fixed_sized_maybe_is_normal (GVariantSerialised value)
value.type_info = g_variant_type_info_element (value.type_info);
value.depth++;
value.ordered_offsets_up_to = 0;
+ value.checked_offsets_up_to = 0;
return g_variant_serialised_is_normal (value);
}
@@ -362,6 +369,7 @@ gvs_variable_sized_maybe_get_child (GVariantSerialised value,
value.depth++;
value.ordered_offsets_up_to = 0;
+ value.checked_offsets_up_to = 0;
return value;
}
@@ -392,7 +400,7 @@ gvs_variable_sized_maybe_serialise (GVariantSerialised value,
{
if (n_children)
{
- GVariantSerialised child = { NULL, value.data, value.size - 1, value.depth + 1, 0 };
+ GVariantSerialised child = { NULL, value.data, value.size - 1, value.depth + 1, 0, 0 };
/* write the data for the child. */
gvs_filler (&child, children[0]);
@@ -413,6 +421,7 @@ gvs_variable_sized_maybe_is_normal (GVariantSerialised value)
value.size--;
value.depth++;
value.ordered_offsets_up_to = 0;
+ value.checked_offsets_up_to = 0;
return g_variant_serialised_is_normal (value);
}
@@ -739,39 +748,46 @@ gvs_variable_sized_array_get_child (GVariantSerialised value,
/* If the requested @index_ is beyond the set of indices whose framing offsets
* have been checked, check the remaining offsets to see whether theyre
- * normal (in order, no overlapping array elements). */
- if (index_ > value.ordered_offsets_up_to)
+ * normal (in order, no overlapping array elements).
+ *
+ * Dont bother checking if the highest known-good offset is lower than the
+ * highest checked offset, as that means theres an invalid element at that
+ * index, so theres no need to check further. */
+ if (index_ > value.checked_offsets_up_to &&
+ value.ordered_offsets_up_to == value.checked_offsets_up_to)
{
switch (offsets.offset_size)
{
case 1:
{
value.ordered_offsets_up_to = find_unordered_guint8 (
- offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ offsets.array, value.checked_offsets_up_to, index_ + 1);
break;
}
case 2:
{
value.ordered_offsets_up_to = find_unordered_guint16 (
- offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ offsets.array, value.checked_offsets_up_to, index_ + 1);
break;
}
case 4:
{
value.ordered_offsets_up_to = find_unordered_guint32 (
- offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ offsets.array, value.checked_offsets_up_to, index_ + 1);
break;
}
case 8:
{
value.ordered_offsets_up_to = find_unordered_guint64 (
- offsets.array, value.ordered_offsets_up_to, index_ + 1);
+ offsets.array, value.checked_offsets_up_to, index_ + 1);
break;
}
default:
/* gvs_get_offset_size() only returns maximum 8 */
g_assert_not_reached ();
}
+
+ value.checked_offsets_up_to = index_;
}
if (index_ > value.ordered_offsets_up_to)
@@ -916,6 +932,7 @@ gvs_variable_sized_array_is_normal (GVariantSerialised value)
/* All offsets have now been checked. */
value.ordered_offsets_up_to = G_MAXSIZE;
+ value.checked_offsets_up_to = G_MAXSIZE;
return TRUE;
}
@@ -1040,14 +1057,15 @@ gvs_tuple_get_child (GVariantSerialised value,
* all the tuple *elements* here, not just all the framing offsets, since
* tuples contain a mix of elements which use framing offsets and ones which
* dont. None of them are allowed to overlap. */
- if (index_ > value.ordered_offsets_up_to)
+ if (index_ > value.checked_offsets_up_to &&
+ value.ordered_offsets_up_to == value.checked_offsets_up_to)
{
gsize i, prev_i_end = 0;
- if (value.ordered_offsets_up_to > 0)
- gvs_tuple_get_member_bounds (value, value.ordered_offsets_up_to - 1, offset_size, NULL, &prev_i_end);
+ if (value.checked_offsets_up_to > 0)
+ gvs_tuple_get_member_bounds (value, value.checked_offsets_up_to - 1, offset_size, NULL, &prev_i_end);
- for (i = value.ordered_offsets_up_to; i <= index_; i++)
+ for (i = value.checked_offsets_up_to; i <= index_; i++)
{
gsize i_start, i_end;
@@ -1060,6 +1078,7 @@ gvs_tuple_get_child (GVariantSerialised value,
}
value.ordered_offsets_up_to = i - 1;
+ value.checked_offsets_up_to = index_;
}
if (index_ > value.ordered_offsets_up_to)
@@ -1257,6 +1276,7 @@ gvs_tuple_is_normal (GVariantSerialised value)
/* All element bounds have been checked above. */
value.ordered_offsets_up_to = G_MAXSIZE;
+ value.checked_offsets_up_to = G_MAXSIZE;
{
gsize fixed_size;
diff --git a/glib/gvariant-serialiser.h b/glib/gvariant-serialiser.h
index 144aec8..e132451 100644
--- a/glib/gvariant-serialiser.h
+++ b/glib/gvariant-serialiser.h
@@ -40,6 +40,15 @@ typedef struct
* Even when dealing with tuples, @ordered_offsets_up_to is an element index,
* rather than an index into the frame offsets. */
gsize ordered_offsets_up_to;
+
+ /* Similar to @ordered_offsets_up_to. This gives the index of the child element
+ * whose frame offset is the highest in the offset table which has been
+ * checked so far.
+ *
+ * This is always ≥ @ordered_offsets_up_to. It is always an element index.
+ *
+ * See documentation in gvariant-core.c for `struct GVariant` for details. */
+ gsize checked_offsets_up_to;
} GVariantSerialised;
/* deserialisation */
diff --git a/glib/gvariant.c b/glib/gvariant.c
index fdd36be..f910bd4 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5945,6 +5945,7 @@ g_variant_byteswap (GVariant *value)
serialised.size = g_variant_get_size (trusted);
serialised.data = g_malloc (serialised.size);
serialised.ordered_offsets_up_to = G_MAXSIZE; /* operating on the normal form */
+ serialised.checked_offsets_up_to = G_MAXSIZE;
g_variant_store (trusted, serialised.data);
g_variant_unref (trusted);
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index a84b02e..640f3c0 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -1286,6 +1286,7 @@ random_instance_filler (GVariantSerialised *serialised,
serialised->depth = 0;
serialised->ordered_offsets_up_to = 0;
+ serialised->checked_offsets_up_to = 0;
g_assert_true (serialised->type_info == instance->type_info);
g_assert_cmpuint (serialised->size, ==, instance->size);
@@ -1453,6 +1454,7 @@ test_maybe (void)
serialised.size = needed_size;
serialised.depth = 0;
serialised.ordered_offsets_up_to = 0;
+ serialised.checked_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised,
random_instance_filler,
@@ -1577,6 +1579,7 @@ test_array (void)
serialised.size = needed_size;
serialised.depth = 0;
serialised.ordered_offsets_up_to = 0;
+ serialised.checked_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) instances, n_children);
@@ -1742,6 +1745,7 @@ test_tuple (void)
serialised.size = needed_size;
serialised.depth = 0;
serialised.ordered_offsets_up_to = 0;
+ serialised.checked_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) instances, n_children);
@@ -1839,6 +1843,7 @@ test_variant (void)
serialised.size = needed_size;
serialised.depth = 0;
serialised.ordered_offsets_up_to = 0;
+ serialised.checked_offsets_up_to = 0;
g_variant_serialiser_serialise (serialised, random_instance_filler,
(gpointer *) &instance, 1);
--
2.24.4

View File

@@ -0,0 +1,97 @@
From 298a537d5f6783e55d87e40011ee3fd3b22b72f9 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Thu, 17 Aug 2023 01:39:01 +0000
Subject: [PATCH] gvariant: Zero-initialise various GVariantSerialised objects
The following few commits will add a couple of new fields to
`GVariantSerialised`, and they should be zero-filled by default.
Try and pre-empt that a bit by zero-filling `GVariantSerialised` by
default in a few places.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2121
CVE: CVE-2023-32665
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/glib/-/commit/298a537d5f6783e55d87e40011ee3fd3b22b72f9]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
glib/gvariant.c | 2 +-
glib/tests/gvariant.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/glib/gvariant.c b/glib/gvariant.c
index f910bd4..8ba701e 100644
--- a/glib/gvariant.c
+++ b/glib/gvariant.c
@@ -5936,7 +5936,7 @@ g_variant_byteswap (GVariant *value)
if (alignment)
/* (potentially) contains multi-byte numeric data */
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
GVariant *trusted;
GBytes *bytes;
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 640f3c0..d640c81 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -1446,7 +1446,7 @@ test_maybe (void)
for (flavour = 0; flavour < 8; flavour += alignment)
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
GVariantSerialised child;
serialised.type_info = type_info;
@@ -1572,7 +1572,7 @@ test_array (void)
for (flavour = 0; flavour < 8; flavour += alignment)
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
serialised.type_info = array_info;
serialised.data = flavoured_malloc (needed_size, flavour);
@@ -1738,7 +1738,7 @@ test_tuple (void)
for (flavour = 0; flavour < 8; flavour += alignment)
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
serialised.type_info = type_info;
serialised.data = flavoured_malloc (needed_size, flavour);
@@ -1835,7 +1835,7 @@ test_variant (void)
for (flavour = 0; flavour < 8; flavour += alignment)
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
GVariantSerialised child;
serialised.type_info = type_info;
@@ -2284,7 +2284,7 @@ serialise_tree (TreeInstance *tree,
static void
test_byteswap (void)
{
- GVariantSerialised one, two;
+ GVariantSerialised one = { 0, }, two = { 0, };
TreeInstance *tree;
tree = tree_instance_new (NULL, 3);
@@ -2358,7 +2358,7 @@ test_serialiser_children (void)
static void
test_fuzz (gdouble *fuzziness)
{
- GVariantSerialised serialised;
+ GVariantSerialised serialised = { 0, };
TreeInstance *tree;
/* make an instance */
--
2.24.4

View File

@@ -42,6 +42,20 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
file://CVE-2021-28153-3.patch \
file://CVE-2021-28153-4.patch \
file://CVE-2021-28153-5.patch \
file://CVE-2023-32665-0001.patch \
file://CVE-2023-32665-0002.patch \
file://CVE-2023-32665-0003.patch \
file://CVE-2023-32665-0004.patch \
file://CVE-2023-32665-0005.patch \
file://CVE-2023-32665-0006.patch \
file://CVE-2023-32665-0007.patch \
file://CVE-2023-32665-0008.patch \
file://CVE-2023-32665-0009.patch \
file://CVE-2023-29499.patch \
file://CVE-2023-32611-0001.patch \
file://CVE-2023-32611-0002.patch \
file://CVE-2023-32643.patch \
file://CVE-2023-32636.patch \
"
SRC_URI_append_class-native = " file://relocate-modules.patch"

View File

@@ -0,0 +1,986 @@
From 1c37b8022e8763fedbb3f79c02e05c6acfe5a215 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date: Thu, 17 Mar 2022 11:44:34 +0530
Subject: [PATCH] Simplify allocations and fix merge and continue actions [BZ
#28931]
Allocations for address tuples is currently a bit confusing because of
the pointer chasing through PAT, making it hard to observe the sequence
in which allocations have been made. Narrow scope of the pointer
chasing through PAT so that it is only used where necessary.
This also tightens actions behaviour with the hosts database in
getaddrinfo to comply with the manual text. The "continue" action
discards previous results and the "merge" action results in an immedate
lookup failure. Consequently, chaining of allocations across modules is
no longer necessary, thus opening up cleanup opportunities.
A test has been added that checks some combinations to ensure that they
work correctly.
Resolves: BZ #28931
CVE: CVE-2023-4813
Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=1c37b8022e8763fedbb3f79c02e05c6acfe5a215]
Comments: Hunks refreshed
Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Bhabu Bindu <bhabu.bindu@kpit.com>
---
nss/Makefile | 1 +
nss/tst-nss-gai-actions.c | 149 ++++++
nss/tst-nss-gai-actions.root/etc/host.conf | 1 +
nss/tst-nss-gai-actions.root/etc/hosts | 508 +++++++++++++++++++++
sysdeps/posix/getaddrinfo.c | 143 +++---
5 files changed, 750 insertions(+), 52 deletions(-)
create mode 100644 nss/tst-nss-gai-actions.c
create mode 100644 nss/tst-nss-gai-actions.root/etc/host.conf
create mode 100644 nss/tst-nss-gai-actions.root/etc/hosts
diff --git a/nss/Makefile b/nss/Makefile
index 42a59535cb..d8b06b44fb 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -61,6 +61,7 @@
tests-container = \
tst-nss-test3 \
+ tst-nss-gai-actions \
tst-nss-files-hosts-long \
tst-nss-db-endpwent \
tst-nss-db-endgrent
diff --git a/nss/tst-nss-gai-actions.c b/nss/tst-nss-gai-actions.c
new file mode 100644
index 0000000000..efca6cd183
--- /dev/null
+++ b/nss/tst-nss-gai-actions.c
@@ -0,0 +1,149 @@
+/* Test continue and merge NSS actions for getaddrinfo.
+ Copyright The GNU Toolchain Authors.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <dlfcn.h>
+#include <gnu/lib-names.h>
+#include <nss.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <support/check.h>
+#include <support/format_nss.h>
+#include <support/support.h>
+#include <support/xstdio.h>
+#include <support/xunistd.h>
+
+enum
+{
+ ACTION_MERGE = 0,
+ ACTION_CONTINUE,
+};
+
+static const char *
+family_str (int family)
+{
+ switch (family)
+ {
+ case AF_UNSPEC:
+ return "AF_UNSPEC";
+ case AF_INET:
+ return "AF_INET";
+ default:
+ __builtin_unreachable ();
+ }
+}
+
+static const char *
+action_str (int action)
+{
+ switch (action)
+ {
+ case ACTION_MERGE:
+ return "merge";
+ case ACTION_CONTINUE:
+ return "continue";
+ default:
+ __builtin_unreachable ();
+ }
+}
+
+static void
+do_one_test (int action, int family, bool canon)
+{
+ struct addrinfo hints =
+ {
+ .ai_family = family,
+ };
+
+ struct addrinfo *ai;
+
+ if (canon)
+ hints.ai_flags = AI_CANONNAME;
+
+ printf ("***** Testing \"files [SUCCESS=%s] files\" for family %s, %s\n",
+ action_str (action), family_str (family),
+ canon ? "AI_CANONNAME" : "");
+
+ int ret = getaddrinfo ("example.org", "80", &hints, &ai);
+
+ switch (action)
+ {
+ case ACTION_MERGE:
+ if (ret == 0)
+ {
+ char *formatted = support_format_addrinfo (ai, ret);
+
+ printf ("merge unexpectedly succeeded:\n %s\n", formatted);
+ support_record_failure ();
+ free (formatted);
+ }
+ else
+ return;
+ case ACTION_CONTINUE:
+ {
+ char *formatted = support_format_addrinfo (ai, ret);
+
+ /* Verify that the result appears exactly once. */
+ const char *expected = "address: STREAM/TCP 192.0.0.1 80\n"
+ "address: DGRAM/UDP 192.0.0.1 80\n"
+ "address: RAW/IP 192.0.0.1 80\n";
+
+ const char *contains = strstr (formatted, expected);
+ const char *contains2 = NULL;
+
+ if (contains != NULL)
+ contains2 = strstr (contains + strlen (expected), expected);
+
+ if (contains == NULL || contains2 != NULL)
+ {
+ printf ("continue failed:\n%s\n", formatted);
+ support_record_failure ();
+ }
+
+ free (formatted);
+ break;
+ }
+ default:
+ __builtin_unreachable ();
+ }
+}
+
+static void
+do_one_test_set (int action)
+{
+ char buf[32];
+
+ snprintf (buf, sizeof (buf), "files [SUCCESS=%s] files",
+ action_str (action));
+ __nss_configure_lookup ("hosts", buf);
+
+ do_one_test (action, AF_UNSPEC, false);
+ do_one_test (action, AF_INET, false);
+ do_one_test (action, AF_INET, true);
+}
+
+static int
+do_test (void)
+{
+ do_one_test_set (ACTION_CONTINUE);
+ do_one_test_set (ACTION_MERGE);
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/nss/tst-nss-gai-actions.root/etc/host.conf b/nss/tst-nss-gai-actions.root/etc/host.conf
new file mode 100644
index 0000000000..d1a59f73a9
--- /dev/null
+++ b/nss/tst-nss-gai-actions.root/etc/host.conf
@@ -0,0 +1 @@
+multi on
diff --git a/nss/tst-nss-gai-actions.root/etc/hosts b/nss/tst-nss-gai-actions.root/etc/hosts
new file mode 100644
index 0000000000..50ce9774dc
--- /dev/null
+++ b/nss/tst-nss-gai-actions.root/etc/hosts
@@ -0,0 +1,508 @@
+192.0.0.1 example.org
+192.0.0.2 example.org
+192.0.0.3 example.org
+192.0.0.4 example.org
+192.0.0.5 example.org
+192.0.0.6 example.org
+192.0.0.7 example.org
+192.0.0.8 example.org
+192.0.0.9 example.org
+192.0.0.10 example.org
+192.0.0.11 example.org
+192.0.0.12 example.org
+192.0.0.13 example.org
+192.0.0.14 example.org
+192.0.0.15 example.org
+192.0.0.16 example.org
+192.0.0.17 example.org
+192.0.0.18 example.org
+192.0.0.19 example.org
+192.0.0.20 example.org
+192.0.0.21 example.org
+192.0.0.22 example.org
+192.0.0.23 example.org
+192.0.0.24 example.org
+192.0.0.25 example.org
+192.0.0.26 example.org
+192.0.0.27 example.org
+192.0.0.28 example.org
+192.0.0.29 example.org
+192.0.0.30 example.org
+192.0.0.31 example.org
+192.0.0.32 example.org
+192.0.0.33 example.org
+192.0.0.34 example.org
+192.0.0.35 example.org
+192.0.0.36 example.org
+192.0.0.37 example.org
+192.0.0.38 example.org
+192.0.0.39 example.org
+192.0.0.40 example.org
+192.0.0.41 example.org
+192.0.0.42 example.org
+192.0.0.43 example.org
+192.0.0.44 example.org
+192.0.0.45 example.org
+192.0.0.46 example.org
+192.0.0.47 example.org
+192.0.0.48 example.org
+192.0.0.49 example.org
+192.0.0.50 example.org
+192.0.0.51 example.org
+192.0.0.52 example.org
+192.0.0.53 example.org
+192.0.0.54 example.org
+192.0.0.55 example.org
+192.0.0.56 example.org
+192.0.0.57 example.org
+192.0.0.58 example.org
+192.0.0.59 example.org
+192.0.0.60 example.org
+192.0.0.61 example.org
+192.0.0.62 example.org
+192.0.0.63 example.org
+192.0.0.64 example.org
+192.0.0.65 example.org
+192.0.0.66 example.org
+192.0.0.67 example.org
+192.0.0.68 example.org
+192.0.0.69 example.org
+192.0.0.70 example.org
+192.0.0.71 example.org
+192.0.0.72 example.org
+192.0.0.73 example.org
+192.0.0.74 example.org
+192.0.0.75 example.org
+192.0.0.76 example.org
+192.0.0.77 example.org
+192.0.0.78 example.org
+192.0.0.79 example.org
+192.0.0.80 example.org
+192.0.0.81 example.org
+192.0.0.82 example.org
+192.0.0.83 example.org
+192.0.0.84 example.org
+192.0.0.85 example.org
+192.0.0.86 example.org
+192.0.0.87 example.org
+192.0.0.88 example.org
+192.0.0.89 example.org
+192.0.0.90 example.org
+192.0.0.91 example.org
+192.0.0.92 example.org
+192.0.0.93 example.org
+192.0.0.94 example.org
+192.0.0.95 example.org
+192.0.0.96 example.org
+192.0.0.97 example.org
+192.0.0.98 example.org
+192.0.0.99 example.org
+192.0.0.100 example.org
+192.0.0.101 example.org
+192.0.0.102 example.org
+192.0.0.103 example.org
+192.0.0.104 example.org
+192.0.0.105 example.org
+192.0.0.106 example.org
+192.0.0.107 example.org
+192.0.0.108 example.org
+192.0.0.109 example.org
+192.0.0.110 example.org
+192.0.0.111 example.org
+192.0.0.112 example.org
+192.0.0.113 example.org
+192.0.0.114 example.org
+192.0.0.115 example.org
+192.0.0.116 example.org
+192.0.0.117 example.org
+192.0.0.118 example.org
+192.0.0.119 example.org
+192.0.0.120 example.org
+192.0.0.121 example.org
+192.0.0.122 example.org
+192.0.0.123 example.org
+192.0.0.124 example.org
+192.0.0.125 example.org
+192.0.0.126 example.org
+192.0.0.127 example.org
+192.0.0.128 example.org
+192.0.0.129 example.org
+192.0.0.130 example.org
+192.0.0.131 example.org
+192.0.0.132 example.org
+192.0.0.133 example.org
+192.0.0.134 example.org
+192.0.0.135 example.org
+192.0.0.136 example.org
+192.0.0.137 example.org
+192.0.0.138 example.org
+192.0.0.139 example.org
+192.0.0.140 example.org
+192.0.0.141 example.org
+192.0.0.142 example.org
+192.0.0.143 example.org
+192.0.0.144 example.org
+192.0.0.145 example.org
+192.0.0.146 example.org
+192.0.0.147 example.org
+192.0.0.148 example.org
+192.0.0.149 example.org
+192.0.0.150 example.org
+192.0.0.151 example.org
+192.0.0.152 example.org
+192.0.0.153 example.org
+192.0.0.154 example.org
+192.0.0.155 example.org
+192.0.0.156 example.org
+192.0.0.157 example.org
+192.0.0.158 example.org
+192.0.0.159 example.org
+192.0.0.160 example.org
+192.0.0.161 example.org
+192.0.0.162 example.org
+192.0.0.163 example.org
+192.0.0.164 example.org
+192.0.0.165 example.org
+192.0.0.166 example.org
+192.0.0.167 example.org
+192.0.0.168 example.org
+192.0.0.169 example.org
+192.0.0.170 example.org
+192.0.0.171 example.org
+192.0.0.172 example.org
+192.0.0.173 example.org
+192.0.0.174 example.org
+192.0.0.175 example.org
+192.0.0.176 example.org
+192.0.0.177 example.org
+192.0.0.178 example.org
+192.0.0.179 example.org
+192.0.0.180 example.org
+192.0.0.181 example.org
+192.0.0.182 example.org
+192.0.0.183 example.org
+192.0.0.184 example.org
+192.0.0.185 example.org
+192.0.0.186 example.org
+192.0.0.187 example.org
+192.0.0.188 example.org
+192.0.0.189 example.org
+192.0.0.190 example.org
+192.0.0.191 example.org
+192.0.0.192 example.org
+192.0.0.193 example.org
+192.0.0.194 example.org
+192.0.0.195 example.org
+192.0.0.196 example.org
+192.0.0.197 example.org
+192.0.0.198 example.org
+192.0.0.199 example.org
+192.0.0.200 example.org
+192.0.0.201 example.org
+192.0.0.202 example.org
+192.0.0.203 example.org
+192.0.0.204 example.org
+192.0.0.205 example.org
+192.0.0.206 example.org
+192.0.0.207 example.org
+192.0.0.208 example.org
+192.0.0.209 example.org
+192.0.0.210 example.org
+192.0.0.211 example.org
+192.0.0.212 example.org
+192.0.0.213 example.org
+192.0.0.214 example.org
+192.0.0.215 example.org
+192.0.0.216 example.org
+192.0.0.217 example.org
+192.0.0.218 example.org
+192.0.0.219 example.org
+192.0.0.220 example.org
+192.0.0.221 example.org
+192.0.0.222 example.org
+192.0.0.223 example.org
+192.0.0.224 example.org
+192.0.0.225 example.org
+192.0.0.226 example.org
+192.0.0.227 example.org
+192.0.0.228 example.org
+192.0.0.229 example.org
+192.0.0.230 example.org
+192.0.0.231 example.org
+192.0.0.232 example.org
+192.0.0.233 example.org
+192.0.0.234 example.org
+192.0.0.235 example.org
+192.0.0.236 example.org
+192.0.0.237 example.org
+192.0.0.238 example.org
+192.0.0.239 example.org
+192.0.0.240 example.org
+192.0.0.241 example.org
+192.0.0.242 example.org
+192.0.0.243 example.org
+192.0.0.244 example.org
+192.0.0.245 example.org
+192.0.0.246 example.org
+192.0.0.247 example.org
+192.0.0.248 example.org
+192.0.0.249 example.org
+192.0.0.250 example.org
+192.0.0.251 example.org
+192.0.0.252 example.org
+192.0.0.253 example.org
+192.0.0.254 example.org
+192.0.1.1 example.org
+192.0.1.2 example.org
+192.0.1.3 example.org
+192.0.1.4 example.org
+192.0.1.5 example.org
+192.0.1.6 example.org
+192.0.1.7 example.org
+192.0.1.8 example.org
+192.0.1.9 example.org
+192.0.1.10 example.org
+192.0.1.11 example.org
+192.0.1.12 example.org
+192.0.1.13 example.org
+192.0.1.14 example.org
+192.0.1.15 example.org
+192.0.1.16 example.org
+192.0.1.17 example.org
+192.0.1.18 example.org
+192.0.1.19 example.org
+192.0.1.20 example.org
+192.0.1.21 example.org
+192.0.1.22 example.org
+192.0.1.23 example.org
+192.0.1.24 example.org
+192.0.1.25 example.org
+192.0.1.26 example.org
+192.0.1.27 example.org
+192.0.1.28 example.org
+192.0.1.29 example.org
+192.0.1.30 example.org
+192.0.1.31 example.org
+192.0.1.32 example.org
+192.0.1.33 example.org
+192.0.1.34 example.org
+192.0.1.35 example.org
+192.0.1.36 example.org
+192.0.1.37 example.org
+192.0.1.38 example.org
+192.0.1.39 example.org
+192.0.1.40 example.org
+192.0.1.41 example.org
+192.0.1.42 example.org
+192.0.1.43 example.org
+192.0.1.44 example.org
+192.0.1.45 example.org
+192.0.1.46 example.org
+192.0.1.47 example.org
+192.0.1.48 example.org
+192.0.1.49 example.org
+192.0.1.50 example.org
+192.0.1.51 example.org
+192.0.1.52 example.org
+192.0.1.53 example.org
+192.0.1.54 example.org
+192.0.1.55 example.org
+192.0.1.56 example.org
+192.0.1.57 example.org
+192.0.1.58 example.org
+192.0.1.59 example.org
+192.0.1.60 example.org
+192.0.1.61 example.org
+192.0.1.62 example.org
+192.0.1.63 example.org
+192.0.1.64 example.org
+192.0.1.65 example.org
+192.0.1.66 example.org
+192.0.1.67 example.org
+192.0.1.68 example.org
+192.0.1.69 example.org
+192.0.1.70 example.org
+192.0.1.71 example.org
+192.0.1.72 example.org
+192.0.1.73 example.org
+192.0.1.74 example.org
+192.0.1.75 example.org
+192.0.1.76 example.org
+192.0.1.77 example.org
+192.0.1.78 example.org
+192.0.1.79 example.org
+192.0.1.80 example.org
+192.0.1.81 example.org
+192.0.1.82 example.org
+192.0.1.83 example.org
+192.0.1.84 example.org
+192.0.1.85 example.org
+192.0.1.86 example.org
+192.0.1.87 example.org
+192.0.1.88 example.org
+192.0.1.89 example.org
+192.0.1.90 example.org
+192.0.1.91 example.org
+192.0.1.92 example.org
+192.0.1.93 example.org
+192.0.1.94 example.org
+192.0.1.95 example.org
+192.0.1.96 example.org
+192.0.1.97 example.org
+192.0.1.98 example.org
+192.0.1.99 example.org
+192.0.1.100 example.org
+192.0.1.101 example.org
+192.0.1.102 example.org
+192.0.1.103 example.org
+192.0.1.104 example.org
+192.0.1.105 example.org
+192.0.1.106 example.org
+192.0.1.107 example.org
+192.0.1.108 example.org
+192.0.1.109 example.org
+192.0.1.110 example.org
+192.0.1.111 example.org
+192.0.1.112 example.org
+192.0.1.113 example.org
+192.0.1.114 example.org
+192.0.1.115 example.org
+192.0.1.116 example.org
+192.0.1.117 example.org
+192.0.1.118 example.org
+192.0.1.119 example.org
+192.0.1.120 example.org
+192.0.1.121 example.org
+192.0.1.122 example.org
+192.0.1.123 example.org
+192.0.1.124 example.org
+192.0.1.125 example.org
+192.0.1.126 example.org
+192.0.1.127 example.org
+192.0.1.128 example.org
+192.0.1.129 example.org
+192.0.1.130 example.org
+192.0.1.131 example.org
+192.0.1.132 example.org
+192.0.1.133 example.org
+192.0.1.134 example.org
+192.0.1.135 example.org
+192.0.1.136 example.org
+192.0.1.137 example.org
+192.0.1.138 example.org
+192.0.1.139 example.org
+192.0.1.140 example.org
+192.0.1.141 example.org
+192.0.1.142 example.org
+192.0.1.143 example.org
+192.0.1.144 example.org
+192.0.1.145 example.org
+192.0.1.146 example.org
+192.0.1.147 example.org
+192.0.1.148 example.org
+192.0.1.149 example.org
+192.0.1.150 example.org
+192.0.1.151 example.org
+192.0.1.152 example.org
+192.0.1.153 example.org
+192.0.1.154 example.org
+192.0.1.155 example.org
+192.0.1.156 example.org
+192.0.1.157 example.org
+192.0.1.158 example.org
+192.0.1.159 example.org
+192.0.1.160 example.org
+192.0.1.161 example.org
+192.0.1.162 example.org
+192.0.1.163 example.org
+192.0.1.164 example.org
+192.0.1.165 example.org
+192.0.1.166 example.org
+192.0.1.167 example.org
+192.0.1.168 example.org
+192.0.1.169 example.org
+192.0.1.170 example.org
+192.0.1.171 example.org
+192.0.1.172 example.org
+192.0.1.173 example.org
+192.0.1.174 example.org
+192.0.1.175 example.org
+192.0.1.176 example.org
+192.0.1.177 example.org
+192.0.1.178 example.org
+192.0.1.179 example.org
+192.0.1.180 example.org
+192.0.1.181 example.org
+192.0.1.182 example.org
+192.0.1.183 example.org
+192.0.1.184 example.org
+192.0.1.185 example.org
+192.0.1.186 example.org
+192.0.1.187 example.org
+192.0.1.188 example.org
+192.0.1.189 example.org
+192.0.1.190 example.org
+192.0.1.191 example.org
+192.0.1.192 example.org
+192.0.1.193 example.org
+192.0.1.194 example.org
+192.0.1.195 example.org
+192.0.1.196 example.org
+192.0.1.197 example.org
+192.0.1.198 example.org
+192.0.1.199 example.org
+192.0.1.200 example.org
+192.0.1.201 example.org
+192.0.1.202 example.org
+192.0.1.203 example.org
+192.0.1.204 example.org
+192.0.1.205 example.org
+192.0.1.206 example.org
+192.0.1.207 example.org
+192.0.1.208 example.org
+192.0.1.209 example.org
+192.0.1.210 example.org
+192.0.1.211 example.org
+192.0.1.212 example.org
+192.0.1.213 example.org
+192.0.1.214 example.org
+192.0.1.215 example.org
+192.0.1.216 example.org
+192.0.1.217 example.org
+192.0.1.218 example.org
+192.0.1.219 example.org
+192.0.1.220 example.org
+192.0.1.221 example.org
+192.0.1.222 example.org
+192.0.1.223 example.org
+192.0.1.224 example.org
+192.0.1.225 example.org
+192.0.1.226 example.org
+192.0.1.227 example.org
+192.0.1.228 example.org
+192.0.1.229 example.org
+192.0.1.230 example.org
+192.0.1.231 example.org
+192.0.1.232 example.org
+192.0.1.233 example.org
+192.0.1.234 example.org
+192.0.1.235 example.org
+192.0.1.236 example.org
+192.0.1.237 example.org
+192.0.1.238 example.org
+192.0.1.239 example.org
+192.0.1.240 example.org
+192.0.1.241 example.org
+192.0.1.242 example.org
+192.0.1.243 example.org
+192.0.1.244 example.org
+192.0.1.245 example.org
+192.0.1.246 example.org
+192.0.1.247 example.org
+192.0.1.248 example.org
+192.0.1.249 example.org
+192.0.1.250 example.org
+192.0.1.251 example.org
+192.0.1.252 example.org
+192.0.1.253 example.org
+192.0.1.254 example.org
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 18dccd5924..3d9bea60c6 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -458,11 +458,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (name != NULL)
{
- at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
- at->family = AF_UNSPEC;
- at->scopeid = 0;
- at->next = NULL;
-
if (req->ai_flags & AI_IDN)
{
char *out;
@@ -473,13 +468,21 @@ gaih_inet (const char *name, const struct gaih_service *service,
malloc_name = true;
}
- if (__inet_aton_exact (name, (struct in_addr *) at->addr) != 0)
+ uint32_t addr[4];
+ if (__inet_aton_exact (name, (struct in_addr *) addr) != 0)
{
+ at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
+ at->scopeid = 0;
+ at->next = NULL;
+
if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET)
- at->family = AF_INET;
+ {
+ memcpy (at->addr, addr, sizeof (at->addr));
+ at->family = AF_INET;
+ }
else if (req->ai_family == AF_INET6 && (req->ai_flags & AI_V4MAPPED))
{
- at->addr[3] = at->addr[0];
+ at->addr[3] = addr[0];
at->addr[2] = htonl (0xffff);
at->addr[1] = 0;
at->addr[0] = 0;
@@ -505,49 +505,62 @@
if (req->ai_flags & AI_CANONNAME)
canon = name;
+
+ goto process_list;
}
- else if (at->family == AF_UNSPEC)
+
+ char *scope_delim = strchr (name, SCOPE_DELIMITER);
+ int e;
+
+ if (scope_delim == NULL)
+ e = inet_pton (AF_INET6, name, addr);
+ else
+ e = __inet_pton_length (AF_INET6, name, scope_delim - name, addr);
+
+ if (e > 0)
{
- char *scope_delim = strchr (name, SCOPE_DELIMITER);
- int e;
- if (scope_delim == NULL)
- e = inet_pton (AF_INET6, name, at->addr);
+ at = alloca_account (sizeof (struct gaih_addrtuple),
+ alloca_used);
+ at->scopeid = 0;
+ at->next = NULL;
+
+ if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6)
+ {
+ memcpy (at->addr, addr, sizeof (at->addr));
+ at->family = AF_INET6;
+ }
+ else if (req->ai_family == AF_INET
+ && IN6_IS_ADDR_V4MAPPED (addr))
+ {
+ at->addr[0] = addr[3];
+ at->addr[1] = addr[1];
+ at->addr[2] = addr[2];
+ at->addr[3] = addr[3];
+ at->family = AF_INET;
+ }
else
- e = __inet_pton_length (AF_INET6, name, scope_delim - name,
- at->addr);
- if (e > 0)
{
- if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6)
- at->family = AF_INET6;
- else if (req->ai_family == AF_INET
- && IN6_IS_ADDR_V4MAPPED (at->addr))
- {
- at->addr[0] = at->addr[3];
- at->family = AF_INET;
- }
- else
- {
- result = -EAI_ADDRFAMILY;
- goto free_and_return;
- }
-
- if (scope_delim != NULL
- && __inet6_scopeid_pton ((struct in6_addr *) at->addr,
- scope_delim + 1,
- &at->scopeid) != 0)
- {
- result = -EAI_NONAME;
- goto free_and_return;
- }
+ result = -EAI_ADDRFAMILY;
+ goto free_and_return;
+ }
- if (req->ai_flags & AI_CANONNAME)
- canon = name;
+ if (scope_delim != NULL
+ && __inet6_scopeid_pton ((struct in6_addr *) at->addr,
+ scope_delim + 1,
+ &at->scopeid) != 0)
+ {
+ result = -EAI_NONAME;
+ goto free_and_return;
}
+
+ if (req->ai_flags & AI_CANONNAME)
+ canon = name;
+
+ goto process_list;
}
- if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0)
+ if ((req->ai_flags & AI_NUMERICHOST) == 0)
{
- struct gaih_addrtuple **pat = &at;
int no_data = 0;
int no_inet6_data = 0;
service_user *nip;
@@ -543,6 +559,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
enum nss_status status = NSS_STATUS_UNAVAIL;
int no_more;
struct resolv_context *res_ctx = NULL;
+ bool do_merge = false;
/* If we do not have to look for IPv6 addresses or the canonical
name, use the simple, old functions, which do not support
@@ -579,7 +596,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
result = -EAI_MEMORY;
goto free_and_return;
}
- *pat = addrmem;
+ at = addrmem;
}
else
{
@@ -632,6 +649,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
struct gaih_addrtuple *addrfree = addrmem;
+ struct gaih_addrtuple **pat = &at;
+
for (int i = 0; i < air->naddrs; ++i)
{
socklen_t size = (air->family[i] == AF_INET
@@ -695,12 +714,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
free (air);
- if (at->family == AF_UNSPEC)
- {
- result = -EAI_NONAME;
- goto free_and_return;
- }
-
goto process_list;
}
else if (err == 0)
@@ -750,6 +763,22 @@
while (!no_more)
{
+ /* Always start afresh; continue should discard previous results
+ and the hosts database does not support merge. */
+ at = NULL;
+ free (canonbuf);
+ free (addrmem);
+ canon = canonbuf = NULL;
+ addrmem = NULL;
+ got_ipv6 = false;
+
+ if (do_merge)
+ {
+ __set_h_errno (NETDB_INTERNAL);
+ __set_errno (EBUSY);
+ break;
+ }
+
no_data = 0;
nss_gethostbyname4_r fct4 = NULL;
@@ -744,12 +773,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
{
while (1)
{
- status = DL_CALL_FCT (fct4, (name, pat,
+ status = DL_CALL_FCT (fct4, (name, &at,
tmpbuf->data, tmpbuf->length,
&errno, &h_errno,
NULL));
if (status == NSS_STATUS_SUCCESS)
break;
+ /* gethostbyname4_r may write into AT, so reset it. */
+ at = NULL;
if (status != NSS_STATUS_TRYAGAIN
|| errno != ERANGE || h_errno != NETDB_INTERNAL)
{
@@ -774,7 +805,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
no_data = 1;
if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
- canon = (*pat)->name;
+ canon = at->name;
+
+ struct gaih_addrtuple **pat = &at;
while (*pat != NULL)
{
@@ -826,6 +859,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (fct != NULL)
{
+ struct gaih_addrtuple **pat = &at;
+
if (req->ai_family == AF_INET6
|| req->ai_family == AF_UNSPEC)
{
@@ -917,6 +946,10 @@
if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
break;
+ /* The hosts database does not support MERGE. */
+ if (nss_next_action (nip, status) == NSS_ACTION_MERGE)
+ do_merge = true;
+
if (nip->next == NULL)
no_more = -1;
else
@@ -930,7 +969,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
process_list:
- if (at->family == AF_UNSPEC)
+ if (at == NULL)
{
result = -EAI_NONAME;
goto free_and_return;
--
2.39.3

View File

@@ -0,0 +1,63 @@
From d2b77337f734fcacdfc8e0ddec14cf31a746c7be Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Mon, 11 Sep 2023 18:53:15 -0400
Subject: [PATCH v2] tunables: Terminate immediately if end of input is reached
The string parsing routine may end up writing beyond bounds of tunestr
if the input tunable string is malformed, of the form name=name=val.
This gets processed twice, first as name=name=val and next as name=val,
resulting in tunestr being name=name=val:name=val, thus overflowing
tunestr.
Terminate the parsing loop at the first instance itself so that tunestr
does not overflow.
---
Changes from v1:
- Also null-terminate tunestr before exiting.
elf/dl-tunables.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
Upstream-Status: Backport [git://sourceware.org/git/glibc.git]
CVE: CVE-2023-4911
diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c
index 8e7ee9df10..76cf8b9da3 100644
--- a/elf/dl-tunables.c
+++ b/elf/dl-tunables.c
@@ -187,11 +187,7 @@ parse_tunables (char *tunestr, char *valstring)
/* If we reach the end of the string before getting a valid name-value
pair, bail out. */
if (p[len] == '\0')
- {
- if (__libc_enable_secure)
- tunestr[off] = '\0';
- return;
- }
+ break;
/* We did not find a valid name-value pair before encountering the
colon. */
@@ -251,9 +247,16 @@ parse_tunables (char *tunestr, char *valstring)
}
}
- if (p[len] != '\0')
- p += len + 1;
+ /* We reached the end while processing the tunable string. */
+ if (p[len] == '\0')
+ break;
+
+ p += len + 1;
}
+
+ /* Terminate tunestr before we leave. */
+ if (__libc_enable_secure)
+ tunestr[off] = '\0';
}
#endif
--
2.41.0

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

@@ -29,6 +29,13 @@ CVE_CHECK_WHITELIST += "CVE-2019-1010025"
# https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=dunfell&id=e1e89ff7d75c3d2223f9e3bd875b9b0c5e15836b
CVE_CHECK_WHITELIST += "CVE-2021-35942"
# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2023-4527
# This vulnerability was introduced in 2.36 by commit
# f282cdbe7f436c75864e5640a409a10485e9abb2 resolv: Implement no-aaaa stub resolver option
# so our version is not yet vulnerable
# See https://sourceware.org/bugzilla/show_bug.cgi?id=30842
CVE_CHECK_WHITELIST += "CVE-2023-4527"
DEPENDS += "gperf-native bison-native make-native"
NATIVESDKFIXES ?= ""
@@ -80,6 +87,8 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \
file://0037-Avoid-deadlock-between-pthread_create-and-ctors.patch \
file://CVE-2023-0687.patch \
file://CVE-2023-4911.patch \
file://CVE-2023-4813.patch \
"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build-${TARGET_SYS}"

View File

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

View File

@@ -0,0 +1,35 @@
From 1358d157d0bd83be1dfe356a69213df9fac0b539 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 21 Apr 2021 13:23:27 +0200
Subject: [PATCH] Fix use-after-free with `xmllint --html --push`
Call htmlCtxtUseOptions to make sure that names aren't stored in
dictionaries.
Note that this issue only affects xmllint using the HTML push parser.
Fixes #230.
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/1358d157d0bd83be1dfe356a69213df9fac0b539]
CVE: CVE-2021-3516
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
xmllint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xmllint.c b/xmllint.c
index 6ca1bf54d..dbef273a8 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -2213,7 +2213,7 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (res > 0) {
ctxt = htmlCreatePushParserCtxt(NULL, NULL,
chars, res, filename, XML_CHAR_ENCODING_NONE);
- xmlCtxtUseOptions(ctxt, options);
+ htmlCtxtUseOptions(ctxt, options);
while ((res = fread(chars, 1, pushsize, f)) > 0) {
htmlParseChunk(ctxt, chars, res, 0);
}
--
GitLab

View File

@@ -0,0 +1,36 @@
From d0c3f01e110d54415611c5fa0040cdf4a56053f9 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sat, 6 May 2023 17:47:37 +0200
Subject: [PATCH] parser: Fix old SAX1 parser with custom callbacks
For some reason, xmlCtxtUseOptionsInternal set the start and end element
SAX handlers to the internal DOM builder functions when XML_PARSE_SAX1
was specified. This means that custom SAX handlers could never work with
that flag because these functions would receive the wrong user data
argument and crash immediately.
Fixes #535.
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d0c3f01e110d54415611c5fa0040cdf4a56053f9]
CVE: CVE-2023-39615
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
parser.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/parser.c b/parser.c
index 6e09208..7814e6e 100644
--- a/parser.c
+++ b/parser.c
@@ -15156,8 +15156,6 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encodi
}
#ifdef LIBXML_SAX1_ENABLED
if (options & XML_PARSE_SAX1) {
- ctxt->sax->startElement = xmlSAX2StartElement;
- ctxt->sax->endElement = xmlSAX2EndElement;
ctxt->sax->startElementNs = NULL;
ctxt->sax->endElementNs = NULL;
ctxt->sax->initialized = 1;
--
2.24.4

View File

@@ -0,0 +1,71 @@
From 235b15a590eecf97b09e87bdb7e4f8333e9de129 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Mon, 8 May 2023 17:58:02 +0200
Subject: [PATCH] SAX: Always initialize SAX1 element handlers
Follow-up to commit d0c3f01e. A parser context will be initialized to
SAX version 2, but this can be overridden with XML_PARSE_SAX1 later,
so we must initialize the SAX1 element handlers as well.
Change the check in xmlDetectSAX2 to only look for XML_SAX2_MAGIC, so
we don't switch to SAX1 if the SAX2 element handlers are NULL.
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/libxml2/-/commit/235b15a590eecf97b09e87bdb7e4f8333e9de129]
CVE: CVE-2023-39615
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
SAX2.c | 11 +++++++----
parser.c | 5 +----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/SAX2.c b/SAX2.c
index 5f141f9..902d34d 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -2869,20 +2869,23 @@ xmlSAXVersion(xmlSAXHandler *hdlr, int version)
{
if (hdlr == NULL) return(-1);
if (version == 2) {
- hdlr->startElement = NULL;
- hdlr->endElement = NULL;
hdlr->startElementNs = xmlSAX2StartElementNs;
hdlr->endElementNs = xmlSAX2EndElementNs;
hdlr->serror = NULL;
hdlr->initialized = XML_SAX2_MAGIC;
#ifdef LIBXML_SAX1_ENABLED
} else if (version == 1) {
- hdlr->startElement = xmlSAX2StartElement;
- hdlr->endElement = xmlSAX2EndElement;
hdlr->initialized = 1;
#endif /* LIBXML_SAX1_ENABLED */
} else
return(-1);
+#ifdef LIBXML_SAX1_ENABLED
+ hdlr->startElement = xmlSAX2StartElement;
+ hdlr->endElement = xmlSAX2EndElement;
+#else
+ hdlr->startElement = NULL;
+ hdlr->endElement = NULL;
+#endif /* LIBXML_SAX1_ENABLED */
hdlr->internalSubset = xmlSAX2InternalSubset;
hdlr->externalSubset = xmlSAX2ExternalSubset;
hdlr->isStandalone = xmlSAX2IsStandalone;
diff --git a/parser.c b/parser.c
index 7814e6e..cf0fb38 100644
--- a/parser.c
+++ b/parser.c
@@ -1102,10 +1102,7 @@ xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL) return;
sax = ctxt->sax;
#ifdef LIBXML_SAX1_ENABLED
- if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
- ((sax->startElementNs != NULL) ||
- (sax->endElementNs != NULL) ||
- ((sax->startElement == NULL) && (sax->endElement == NULL))))
+ if ((sax) && (sax->initialized == XML_SAX2_MAGIC))
ctxt->sax2 = 1;
#else
ctxt->sax2 = 1;
--
2.24.4

View File

@@ -0,0 +1,44 @@
From 99fc048d7f7292c5ee18e44c400bd73bc63a47ed Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Fri, 14 Aug 2020 14:18:50 +0200
Subject: [PATCH] Don't use SAX1 if all element handlers are NULL
Running xmllint with "--sax --noout" installs a SAX2 handler with all
callbacks set to NULL. In this case or similar situations, we don't want
to switch to SAX1 parsing.
Note: This patch is needed for "CVE-2023-39615-0002" patch to apply.
Without this patch the build will fail with undefined sax error.
Upstream-Status: Backport from [https://gitlab.gnome.org/GNOME/libxml2/-/commit/99fc048d7f7292c5ee18e44c400bd73bc63a47ed]
Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
---
parser.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/parser.c b/parser.c
index bb677b0..6e09208 100644
--- a/parser.c
+++ b/parser.c
@@ -1098,11 +1098,15 @@ xmlHasFeature(xmlFeature feature)
*/
static void
xmlDetectSAX2(xmlParserCtxtPtr ctxt) {
+ xmlSAXHandlerPtr sax;
if (ctxt == NULL) return;
+ sax = ctxt->sax;
#ifdef LIBXML_SAX1_ENABLED
- if ((ctxt->sax) && (ctxt->sax->initialized == XML_SAX2_MAGIC) &&
- ((ctxt->sax->startElementNs != NULL) ||
- (ctxt->sax->endElementNs != NULL))) ctxt->sax2 = 1;
+ if ((sax) && (sax->initialized == XML_SAX2_MAGIC) &&
+ ((sax->startElementNs != NULL) ||
+ (sax->endElementNs != NULL) ||
+ ((sax->startElement == NULL) && (sax->endElement == NULL))))
+ ctxt->sax2 = 1;
#else
ctxt->sax2 = 1;
#endif /* LIBXML_SAX1_ENABLED */
--
2.24.4

View File

@@ -0,0 +1,50 @@
From a22bd982bf10291deea8ba0c61bf75b898c604ce Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 2 Nov 2022 15:44:42 +0100
Subject: [PATCH] malloc-fail: Fix memory leak in xmlStaticCopyNodeList
Found with libFuzzer, see #344.
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/a22bd982bf10291deea8ba0c61bf75b898c604ce]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
tree.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tree.c b/tree.c
index 507869efe..647288ce3 100644
--- a/tree.c
+++ b/tree.c
@@ -4461,7 +4461,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
}
if (doc->intSubset == NULL) {
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
- if (q == NULL) return(NULL);
+ if (q == NULL) goto error;
q->doc = doc;
q->parent = parent;
doc->intSubset = (xmlDtdPtr) q;
@@ -4473,7 +4473,7 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
} else
#endif /* LIBXML_TREE_ENABLED */
q = xmlStaticCopyNode(node, doc, parent, 1);
- if (q == NULL) return(NULL);
+ if (q == NULL) goto error;
if (ret == NULL) {
q->prev = NULL;
ret = p = q;
@@ -4486,6 +4486,9 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
node = node->next;
}
return(ret);
+error:
+ xmlFreeNodeList(ret);
+ return(NULL);
}
/**
--
GitLab

View File

@@ -0,0 +1,80 @@
From d39f78069dff496ec865c73aa44d7110e429bce9 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Wed, 23 Aug 2023 20:24:24 +0200
Subject: [PATCH] tree: Fix copying of DTDs
- Don't create multiple DTD nodes.
- Fix UAF if malloc fails.
- Skip DTD nodes if tree module is disabled.
Fixes #583.
CVE: CVE-2023-45322
Upstream-Status: Backport [https://gitlab.gnome.org/GNOME/libxml2/-/commit/d39f78069dff496ec865c73aa44d7110e429bce9]
Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
---
tree.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/tree.c b/tree.c
index 6c8a875b9..02c1b5791 100644
--- a/tree.c
+++ b/tree.c
@@ -4471,29 +4471,28 @@ xmlNodePtr
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
xmlNodePtr ret = NULL;
xmlNodePtr p = NULL,q;
+ xmlDtdPtr newSubset = NULL;
while (node != NULL) {
-#ifdef LIBXML_TREE_ENABLED
if (node->type == XML_DTD_NODE ) {
- if (doc == NULL) {
+#ifdef LIBXML_TREE_ENABLED
+ if ((doc == NULL) || (doc->intSubset != NULL)) {
node = node->next;
continue;
}
- if (doc->intSubset == NULL) {
- q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
- if (q == NULL) goto error;
- q->doc = doc;
- q->parent = parent;
- doc->intSubset = (xmlDtdPtr) q;
- xmlAddChild(parent, q);
- } else {
- q = (xmlNodePtr) doc->intSubset;
- xmlAddChild(parent, q);
- }
- } else
+ q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
+ if (q == NULL) goto error;
+ q->doc = doc;
+ q->parent = parent;
+ newSubset = (xmlDtdPtr) q;
+#else
+ node = node->next;
+ continue;
#endif /* LIBXML_TREE_ENABLED */
+ } else {
q = xmlStaticCopyNode(node, doc, parent, 1);
- if (q == NULL) goto error;
+ if (q == NULL) goto error;
+ }
if (ret == NULL) {
q->prev = NULL;
ret = p = q;
@@ -4505,6 +4504,8 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
}
node = node->next;
}
+ if (newSubset != NULL)
+ doc->intSubset = newSubset;
return(ret);
error:
xmlFreeNodeList(ret);
--
GitLab

Some files were not shown because too many files have changed in this diff Show More