Patch review
cover Patch review
Please review this set of patches for dunfell and have comments back by end of day Monday.
Passed a-full on autobuilder:
https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/3112
The following changes since commit da3bd5e0934b6462ae53225a58305235849b32d5:
asciidoc: properly detect and compare Python versions >= 3.10 (2022-01-09 06:49:29 -1000)
are available in the Git repository at:
git://git.openembedded.org/openembedded-core-contrib stable/dunfell-nut
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=stable/dunfell-nut
Akash Hadke (1):
glibc: Add fix for data races in pthread_create and TLS access
Alexander Kanavin (1):
parselogs: add a couple systemd false positives
Anuj Mittal (1):
xserver-xorg: update CVE_PRODUCT
Konrad Weihmann (1):
cve-check: add lockfile to task
Mingli Yu (1):
wic: use shutil.which
Ricardo Ribalda Delgado (1):
wic: misc: Do not find for executables in ASSUME_PROVIDED
Richard Purdie (1):
expat: Update HOMEPAGE to current url
Ross Burton (2):
cve-update-db-native: use fetch task
xserver-xorg: whitelist two CVEs
Steve Sakoman (2):
valgrind: skip flakey ptest (gdbserver_tests/hginfo) oeqa/selftest/cases/tinfoil.py: increase timeout 60->120s
test_wait_event
meta/classes/cve-check.bbclass | 3 +- meta/lib/oeqa/runtime/cases/parselogs.py | 2 + meta/lib/oeqa/selftest/cases/tinfoil.py | 4 +- meta/recipes-core/expat/expat_2.2.9.bb | 2 +- ...ate-slotinfo-to-avoid-use-after-free.patch | 66 +++++ ...hread_create-and-TLS-access-BZ-19329.patch | 191 ++++++++++++ ...d-atomics-for-racy-accesses-BZ-19329.patch | 206 +++++++++++++ .../0033-elf-Add-test-case-for-BZ-19329.patch | 144 +++++++++ ...elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch | 180 ++++++++++++ ...-lazy-relocation-of-tlsdesc-BZ-27137.patch | 56 ++++ ...-lazy-relocation-of-tlsdesc-BZ-27137.patch | 124 ++++++++ ...ock-between-pthread_create-and-ctors.patch | 276 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.31.bb | 8 + .../recipes-core/meta/cve-update-db-native.bb | 9 +- .../valgrind/valgrind/remove-for-aarch64 | 1 + .../valgrind/valgrind/remove-for-all | 1 + .../xorg-xserver/xserver-xorg.inc | 10 +- scripts/lib/wic/engine.py | 6 +- scripts/lib/wic/misc.py | 16 +- scripts/wic | 4 +- 20 files changed, 1292 insertions(+), 17 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0030-elf-Refactor_dl_update-slotinfo-to-avoid-use-after-free.patch create mode 100644 meta/recipes-core/glibc/glibc/0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-elf-Use-relaxed-atomics-for-racy-accesses-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0033-elf-Add-test-case-for-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0034-elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch create mode 100644 meta/recipes-core/glibc/glibc/0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch create mode 100644 meta/recipes-core/glibc/glibc/0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch create mode 100644 meta/recipes-core/glibc/glibc/0037-Avoid-deadlock-between-pthread_create-and-ctors.patch
Signature · 1 line
2.25.1
PATCH 1/11 valgrind: skip flakey ptest (gdbserver_tests/hginfo)
This ptest was already disabled in master branch with: valgrind: skip broken ptests for glibc 2.34
https://git.openembedded.org/openembedded-core/commit/?id=c177c7f9ef6f90ca49074f003accb8e9a1a645aa
--- meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 | 1 + meta/recipes-devtools/valgrind/valgrind/remove-for-all | 1 + 2 files changed, 2 insertions(+)
meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 +1 -0
@@ -120,6 +120,7 @@ drd/tests/tc19_shadowmem drd/tests/tc21_pthonce drd/tests/tc22_exit_w_lock drd/tests/tc23_bogus_condwait +gdbserver_tests/hginfo helgrind/tests/annotate_rwlock helgrind/tests/annotate_smart_pointer helgrind/tests/bar_bad
meta/recipes-devtools/valgrind/valgrind/remove-for-all +1 -0
@@ -1,2 +1,3 @@ drd/tests/bar_bad drd/tests/bar_bad_xml +gdbserver_tests/hginfo
Signature · 1 line
2.25.1
PATCH 2/11 oeqa/selftest/cases/tinfoil.py: increase timeout 60->120s test_wait_event
In reply to Steve SakomanThe test is timing out on fedora autobuilder workers
--- meta/lib/oeqa/selftest/cases/tinfoil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/cases/tinfoil.py +2 -2
@@ -100,9 +100,9 @@ class TinfoilTests(OESelftestTestCase): eventreceived = False commandcomplete = False start = time.time() - # Wait for maximum 60s in total so we'd detect spurious heartbeat events for example + # Wait for maximum 120s in total so we'd detect spurious heartbeat events for example while (not (eventreceived == True and commandcomplete == True) - and (time.time() - start < 60)): + and (time.time() - start < 120)): # if we received both events (on let's say a good day), we are done event = tinfoil.wait_event(1) if event:
Signature · 1 line
2.25.1
PATCH 3/11 cve-update-db-native: use fetch task
In reply to Steve SakomanFrom: Ross Burton <[email protected]>
Instead of inventing a new task to fetch the CVE data, use the existing fetch task.
--- meta/classes/cve-check.bbclass | 2 +- meta/recipes-core/meta/cve-update-db-native.bb | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
meta/classes/cve-check.bbclass +1 -1
@@ -110,7 +110,7 @@ python do_cve_check () { } addtask cve_check before do_build after do_fetch -do_cve_check[depends] = "cve-update-db-native:do_populate_cve_db" +do_cve_check[depends] = "cve-update-db-native:do_fetch" do_cve_check[nostamp] = "1" python cve_check_cleanup () {
meta/recipes-core/meta/cve-update-db-native.bb +5 -4
@@ -17,7 +17,7 @@ python () { raise bb.parse.SkipRecipe("Skip recipe when cve-check class is not loaded.") } -python do_populate_cve_db() { +python do_fetch() { """ Update NVD database with json data feed """
@@ -110,7 +110,9 @@ python do_populate_cve_db() { conn.close() } -do_populate_cve_db[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" +do_fetch[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" +do_fetch[file-checksums] = "" +do_fetch[vardeps] = "" def initialize_db(c): c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)")
@@ -217,7 +219,6 @@ def update_db(c, jsondata): parse_node_and_insert(c, config, cveId) -addtask do_populate_cve_db before do_fetch -do_populate_cve_db[nostamp] = "1" +do_fetch[nostamp] = "1" EXCLUDE_FROM_WORLD = "1"
Signature · 1 line
2.25.1
PATCH 4/11 cve-check: add lockfile to task
In reply to Steve SakomanFrom: Konrad Weihmann <[email protected]>
this should prevent running into the very rare error sqlite3.OperationalError: attempt to write a readonly database
As highlighted by https://www.sqlite.org/faq.html#q5
it is likely that the adapter won't allow use multiple exec calls at the same time.
So it's best to prevent multiple accesses at a time, by reusing the already in place CVE_CHECK_DB_FILE_LOCK
YOCTO #14110
--- meta/classes/cve-check.bbclass | 1 + 1 file changed, 1 insertion(+)
meta/classes/cve-check.bbclass +1 -0
@@ -110,6 +110,7 @@ python do_cve_check () { } addtask cve_check before do_build after do_fetch +do_cve_check[lockfiles] += "${CVE_CHECK_DB_FILE_LOCK}" do_cve_check[depends] = "cve-update-db-native:do_fetch" do_cve_check[nostamp] = "1"
Signature · 1 line
2.25.1
PATCH 5/11 xserver-xorg: update CVE_PRODUCT
In reply to Steve SakomanFrom: Anuj Mittal <[email protected]>
Some of the CVEs have x_server as the product name.
--- meta/recipes-graphics/xorg-xserver/xserver-xorg.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/xorg-xserver/xserver-xorg.inc +1 -1
@@ -18,7 +18,7 @@ INC_PR = "r8" XORG_PN = "xorg-server" SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.bz2" -CVE_PRODUCT = "xorg-server" +CVE_PRODUCT = "xorg-server x_server" S = "${WORKDIR}/${XORG_PN}-${PV}"
Signature · 1 line
2.25.1
PATCH 6/11 wic: misc: Do not find for executables in ASSUME_PROVIDED
In reply to Steve SakomanFrom: Ricardo Ribalda Delgado <[email protected]>
Executables like tar won't be available on the native sysroot, as they are part of the ASSUME_PROVIDED variable.
--- scripts/lib/wic/misc.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
scripts/lib/wic/misc.py +12 -2
@@ -46,7 +46,8 @@ NATIVE_RECIPES = {"bmaptool": "bmap-tools", "parted": "parted", "sfdisk": "util-linux", "sgdisk": "gptfdisk", - "syslinux": "syslinux" + "syslinux": "syslinux", + "tar": "tar" } def runtool(cmdln_or_args):
@@ -113,6 +114,15 @@ def exec_cmd(cmd_and_args, as_shell=False): """ return _exec_cmd(cmd_and_args, as_shell)[1] +def find_executable(cmd, paths): + recipe = cmd + if recipe in NATIVE_RECIPES: + recipe = NATIVE_RECIPES[recipe] + provided = get_bitbake_var("ASSUME_PROVIDED") + if provided and "%s-native" % recipe in provided: + return True + + return spawn.find_executable(cmd, paths) def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): """
@@ -141,7 +151,7 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): logger.debug("exec_native_cmd: %s", native_cmd_and_args) # If the command isn't in the native sysroot say we failed. - if spawn.find_executable(args[0], native_paths): + if find_executable(args[0], native_paths): ret, out = _exec_cmd(native_cmd_and_args, True) else: ret = 127
Signature · 1 line
2.25.1
PATCH 7/11 wic: use shutil.which
In reply to Steve SakomanFrom: Mingli Yu <[email protected]>
Use shutil.which to find the executable instead to silence the below warning:
$ cat tmp/work/intel_x86_64-poky-linux/core-image-base/1.0-r5/temp/log.do_image_wic [snip] DEBUG: Executing shell function do_image_wic /path/layers/oe-core/scripts/wic:27: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils import spawn INFO: Creating image(s)... [snip]
--- scripts/lib/wic/engine.py | 6 +++--- scripts/lib/wic/misc.py | 4 ++-- scripts/wic | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
scripts/lib/wic/engine.py +3 -3
@@ -19,10 +19,10 @@ import os import tempfile import json import subprocess +import shutil import re from collections import namedtuple, OrderedDict -from distutils.spawn import find_executable from wic import WicError from wic.filemap import sparse_copy
@@ -245,7 +245,7 @@ class Disk: for path in pathlist.split(':'): self.paths = "%s%s:%s" % (native_sysroot, path, self.paths) - self.parted = find_executable("parted", self.paths) + self.parted = shutil.which("parted", path=self.paths) if not self.parted: raise WicError("Can't find executable parted")
@@ -283,7 +283,7 @@ class Disk: "resize2fs", "mkswap", "mkdosfs", "debugfs"): aname = "_%s" % name if aname not in self.__dict__: - setattr(self, aname, find_executable(name, self.paths)) + setattr(self, aname, shutil.which(name, path=self.paths)) if aname not in self.__dict__ or self.__dict__[aname] is None: raise WicError("Can't find executable '{}'".format(name)) return self.__dict__[aname]
scripts/lib/wic/misc.py +2 -2
@@ -16,9 +16,9 @@ import logging import os import re import subprocess +import shutil from collections import defaultdict -from distutils import spawn from wic import WicError
@@ -122,7 +122,7 @@ def find_executable(cmd, paths): if provided and "%s-native" % recipe in provided: return True - return spawn.find_executable(cmd, paths) + return shutil.which(cmd, path=paths) def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): """
scripts/wic +2 -2
@@ -22,9 +22,9 @@ import sys import argparse import logging import subprocess +import shutil from collections import namedtuple -from distutils import spawn # External modules scripts_path = os.path.dirname(os.path.realpath(__file__))
@@ -47,7 +47,7 @@ if os.environ.get('SDKTARGETSYSROOT'): break sdkroot = os.path.dirname(sdkroot) -bitbake_exe = spawn.find_executable('bitbake') +bitbake_exe = shutil.which('bitbake') if bitbake_exe: bitbake_path = scriptpath.add_bitbake_lib_path() import bb
Signature · 1 line
2.25.1
PATCH 8/11 expat: Update HOMEPAGE to current url
In reply to Steve SakomanFrom: Richard Purdie <[email protected]>
Upstream pointed out we were using an old url for HOMEPAGE. Update it to the current url.
--- meta/recipes-core/expat/expat_2.2.9.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/expat/expat_2.2.9.bb +1 -1
@@ -1,6 +1,6 @@ SUMMARY = "A stream-oriented XML parser library" DESCRIPTION = "Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags)" -HOMEPAGE = "http://expat.sourceforge.net/" +HOMEPAGE = "https://github.com/libexpat/libexpat" SECTION = "libs" LICENSE = "MIT"
Signature · 1 line
2.25.1
PATCH 9/11 xserver-xorg: whitelist two CVEs
In reply to Steve SakomanFrom: Ross Burton <[email protected]>
CVE-2011-4613 is specific to Debian/Ubuntu.
CVE-2020-25697 is a non-trivial attack that may not actually be feasible considering the default behaviour for clients is to exit if the connection is lost.
--- meta/recipes-graphics/xorg-xserver/xserver-xorg.inc | 8 ++++++++ 1 file changed, 8 insertions(+)
meta/recipes-graphics/xorg-xserver/xserver-xorg.inc +8 -0
@@ -19,6 +19,14 @@ XORG_PN = "xorg-server" SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.bz2" CVE_PRODUCT = "xorg-server x_server" +# This is specific to Debian's xserver-wrapper.c +CVE_CHECK_WHITELIST += "CVE-2011-4613" +# As per upstream, exploiting this flaw is non-trivial and it requires exact +# timing on the behalf of the attacker. Many graphical applications exit if their +# connection to the X server is lost, so a typical desktop session is either +# impossible or difficult to exploit. There is currently no upstream patch +# available for this flaw. +CVE_CHECK_WHITELIST += "CVE-2020-25697" S = "${WORKDIR}/${XORG_PN}-${PV}"
Signature · 1 line
2.25.1
PATCH 10/11 parselogs: add a couple systemd false positives
In reply to Steve SakomanFrom: Alexander Kanavin <[email protected]>
New systemd has changed the phrasing when skipping things, with unfortunate use of 'failed':
[ 1.623667] systemd[1]: Journal Audit Socket was skipped because of a failed condition check (ConditionSecurity=audit). [ 1.688258] systemd[1]: Load Kernel Modules was skipped because all trigger condition checks failed.
--- meta/lib/oeqa/runtime/cases/parselogs.py | 2 ++ 1 file changed, 2 insertions(+)
meta/lib/oeqa/runtime/cases/parselogs.py +2 -0
@@ -61,6 +61,8 @@ common_errors = [ "[rdrand]: Initialization Failed", "[pulseaudio] authkey.c: Failed to open cookie file", "[pulseaudio] authkey.c: Failed to load authentication key", + "was skipped because of a failed condition check", + "was skipped because all trigger condition checks failed", ] video_related = [
Signature · 1 line
2.25.1
PATCH 11/11 glibc: Add fix for data races in pthread_create and TLS access
In reply to Steve SakomanFrom: Akash Hadke <[email protected]>
Inconsistency detected by ld.so: dl-tls.c: 493: _dl_allocate_tls_init: Assertion `listp->slotinfo[cnt].gen <= _rtld_local._dl_tls_generation' failed! caused by dlopen (in _dl_add_to_slotinfo and in dl_open_worker) doing
listp->slotinfo[idx].gen = GL(dl_tls_generation) + 1;
//...
if (any_tls && __builtin_expect (++GL(dl_tls_generation) == 0, 0))
while pthread_create (in _dl_allocate_tls_init) concurrently doing
assert (listp->slotinfo[cnt].gen <= GL(dl_tls_generation));
Backported below patch that can fix the following bugs with a lock that prevents DTV setup running concurrently with dlopen or dlclose.
Bug 19329: https://sourceware.org/bugzilla/show_bug.cgi?id=19329
Bug 27111: https://sourceware.org/bugzilla/show_bug.cgi?id=27111
Patch: 0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch
It requires a supporting patch 0030-elf-Refactor_dl_update-slotinfo-to-avoid-use-after-free.patch
After adding the above fix there is a number of racy read accesses to globals that will be changed to relaxed MO atomics in follow-up patch given below.
This fixes the regressions and avoids cluttering the main part of the fix.
0032-elf-Use-relaxed-atomics-for-racy-accesses-BZ-19329.patch
Backported the below patch to add the test to check the added fix. 0033-elf-Add-test-case-for-BZ-19329.patch
Previously modids were never resused for a
different module, but after dlopen failure all gaps are reused not just the ones caused by the unfinished dlopened.
The code has to handle reused modids already which seems to work, however the data races at thread creation and tls access (see bug 19329 and bug 27111) may be more severe if slots are reused. Fixing the races are not simpler if reuse is disallowed and reuse has other benefits so upstream added fix
https://sourceware.org/git/?p=glibc.git;a=commit;h=572bd547d57a39b6cf0ea072545dc4048921f4c3
for the following bug.
Bug 27135: https://sourceware.org/bugzilla/show_bug.cgi?id=27135
But in glibc upstream the commit 572bd547d57a was reverted as the issue with 572bd547d57a patch was the DTV entry only updated on dl_open_worker() with the update_tls_slotinfo() call after all dependencies are being processed by _dl_map_object_deps(). However _dl_map_object_deps() itself might call _dl_next_tls_modid(), and since the _dl_tls_dtv_slotinfo_list::map was not yet set the entry can be wrongly reused.
So added below patch to fix Bug 27135.
0034-elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch
Not all TLS access related data races got fixed by adding 0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch, there are additional races at lazy tlsdesc relocations.
Bug 27137: https://sourceware.org/bugzilla/show_bug.cgi?id=27137
Backported below patches to fix this issue.
0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch
0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch
The fix 0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch for bug 19329 caused a regression such that pthread_create can deadlock when concurrent ctors from dlopen are waiting for it
to finish.
Bug 28357: https://sourceware.org/bugzilla/show_bug.cgi?id=28357
Backported below patch to fix this issue. 0037-Avoid-deadlock-between-pthread_create-and-ctors.patch
--- ...ate-slotinfo-to-avoid-use-after-free.patch | 66 +++++ ...hread_create-and-TLS-access-BZ-19329.patch | 191 ++++++++++++ ...d-atomics-for-racy-accesses-BZ-19329.patch | 206 +++++++++++++ .../0033-elf-Add-test-case-for-BZ-19329.patch | 144 +++++++++ ...elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch | 180 ++++++++++++ ...-lazy-relocation-of-tlsdesc-BZ-27137.patch | 56 ++++ ...-lazy-relocation-of-tlsdesc-BZ-27137.patch | 124 ++++++++ ...ock-between-pthread_create-and-ctors.patch | 276 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.31.bb | 8 + 9 files changed, 1251 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0030-elf-Refactor_dl_update-slotinfo-to-avoid-use-after-free.patch create mode 100644 meta/recipes-core/glibc/glibc/0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0032-elf-Use-relaxed-atomics-for-racy-accesses-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0033-elf-Add-test-case-for-BZ-19329.patch create mode 100644 meta/recipes-core/glibc/glibc/0034-elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch create mode 100644 meta/recipes-core/glibc/glibc/0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch create mode 100644 meta/recipes-core/glibc/glibc/0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch create mode 100644 meta/recipes-core/glibc/glibc/0037-Avoid-deadlock-between-pthread_create-and-ctors.patch
meta/recipes-core/glibc/glibc/0030-elf-Refactor_dl_update-slotinfo-to-avoid-use-after-free.patch new file +66 -0
@@ -0,0 +1,66 @@ +From c0669ae1a629e16b536bf11cdd0865e0dbcf4bee Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy <[email protected]> +Date: Wed, 30 Dec 2020 21:52:38 +0000 +Subject: [PATCH] elf: Refactor _dl_update_slotinfo to avoid use after free + +map is not valid to access here because it can be freed by a concurrent +dlclose: during tls access (via __tls_get_addr) _dl_update_slotinfo is +called without holding dlopen locks. So don't check the modid of map. + +The map == 0 and map != 0 code paths can be shared (avoiding the dtv +resize in case of map == 0 is just an optimization: larger dtv than +necessary would be fine too). + +Reviewed-by: Adhemerval Zanella <[email protected]> +--- + elf/dl-tls.c | 21 +++++---------------- + 1 file changed, 5 insertions(+), 16 deletions(-) +--- +Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=patch;h=c0669ae1a629e16b536bf11cdd0865e0dbcf4bee] +Signed-off-by: Akash Hadke <[email protected]> +Signed-off-by: Akash Hadke <[email protected]> +--- +diff --git a/elf/dl-tls.c b/elf/dl-tls.c +index 24d00c14ef..f8b32b3ecb 100644 +--- a/elf/dl-tls.c ++++ b/elf/dl-tls.c +@@ -743,6 +743,8 @@ _dl_update_slotinfo (unsigned long int req_modid) + { + for (size_t cnt = total == 0 ? 1 : 0; cnt < listp->len; ++cnt) + { ++ size_t modid = total + cnt; ++ + size_t gen = listp->slotinfo[cnt].gen; + + if (gen > new_gen) +@@ -758,25 +760,12 @@ _dl_update_slotinfo (unsigned long int req_modid) + + /* If there is no map this means the entry is empty. */ + struct link_map *map = listp->slotinfo[cnt].map; +- if (map == NULL) +- { +- if (dtv[-1].counter >= total + cnt) +- { +- /* If this modid was used at some point the memory +- might still be allocated. */ +- free (dtv[total + cnt].pointer.to_free); +- dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED; +- dtv[total + cnt].pointer.to_free = NULL; +- } +- +- continue; +- } +- + /* Check whether the current dtv array is large enough. */ +- size_t modid = map->l_tls_modid; +- assert (total + cnt == modid); + if (dtv[-1].counter < modid) + { ++ if (map == NULL) ++ continue; ++ + /* Resize the dtv. */ + dtv = _dl_resize_dtv (dtv); + +-- +2.27.0
meta/recipes-core/glibc/glibc/0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch new file +191 -0
191 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0032-elf-Use-relaxed-atomics-for-racy-accesses-BZ-19329.patch new file +206 -0
206 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0033-elf-Add-test-case-for-BZ-19329.patch new file +144 -0
144 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0034-elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch new file +180 -0
180 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch new file +56 -0
56 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch new file +124 -0
124 lines not on this page · raw message
meta/recipes-core/glibc/glibc/0037-Avoid-deadlock-between-pthread_create-and-ctors.patch new file +276 -0
276 lines not on this page · raw message
meta/recipes-core/glibc/glibc_2.31.bb +8 -0
@@ -70,6 +70,14 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://CVE-2021-33574_1.patch \ file://CVE-2021-33574_2.patch \ file://CVE-2021-38604.patch \ + file://0030-elf-Refactor_dl_update-slotinfo-to-avoid-use-after-free.patch \ + file://0031-elf-Fix-data-races-in-pthread_create-and-TLS-access-BZ-19329.patch \ + file://0032-elf-Use-relaxed-atomics-for-racy-accesses-BZ-19329.patch \ + file://0033-elf-Add-test-case-for-BZ-19329.patch \ + file://0034-elf-Fix-DTV-gap-reuse-logic-BZ-27135.patch \ + file://0035-x86_64-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \ + file://0036-i386-Avoid-lazy-relocation-of-tlsdesc-BZ-27137.patch \ + file://0037-Avoid-deadlock-between-pthread_create-and-ctors.patch \ " S = "${WORKDIR}/git" B = "${WORKDIR}/build-${TARGET_SYS}"
Signature · 1 line
2.25.1