From b0f3c0fb99d15b5914ac876b62ff16b3e11d0b80 Mon Sep 17 00:00:00 2001 From: George McCollister Date: Mon, 13 Mar 2017 16:06:16 -0700 Subject: [PATCH 001/129] gdb-cross-canadian: Depend on nativesdk-python3-importlib Add missing dependency on nativesdk-python3-importlib so the imp Python module is installed. Before this patch, running gdb from the sdk would give the following error: Python Exception No module named 'imp': (From OE-Core rev: ad00a31fbe93e073a2d83616efcd08c5a7ef37c9) (From OE-Core rev: d6e7dc5cbf1cc09c8882a717cd4dd34d10ec7fa3) Signed-off-by: George McCollister Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-devtools/gdb/gdb-cross-canadian.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc index e53081d0c0..3ff1989538 100644 --- a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc +++ b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc @@ -14,7 +14,8 @@ GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'" PACKAGECONFIG ??= "python readline" PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,nativesdk-python3, \ nativesdk-python3-core nativesdk-python3-lang nativesdk-python3-re \ - nativesdk-python3-codecs nativesdk-python3-netclient" + nativesdk-python3-codecs nativesdk-python3-netclient \ + nativesdk-python3-importlib" PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline" SSTATE_DUPWHITELIST += "${STAGING_DATADIR}/gdb" From 8ab3fa375891eba3dc102b6ee7fee3582070654b Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Mon, 13 Mar 2017 16:06:17 -0700 Subject: [PATCH 002/129] python-3.5-manifest: Add imp to importlib The imp python module is the forerunner of importlib. Include imp in the importlib subpackage instead of the misc subpackage so that it can be depended on without bringing in a bunch of unrelated, unused modules. (Slightly modified backport of afd9de380dc04780da1eeb94a4c8c46529254231 by George McCollister ) [YOCTO#11134] (From OE-Core rev: 65f6010346c08bf90f381a2d834dd9908ba2100c) Signed-off-by: Juro Bystricky Signed-off-by: Richard Purdie --- meta/recipes-devtools/python/python-3.5-manifest.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/python/python-3.5-manifest.inc b/meta/recipes-devtools/python/python-3.5-manifest.inc index 304611432e..6c690db805 100644 --- a/meta/recipes-devtools/python/python-3.5-manifest.inc +++ b/meta/recipes-devtools/python/python-3.5-manifest.inc @@ -115,7 +115,7 @@ FILES_${PN}-image="${libdir}/python3.5/colorsys.* ${libdir}/python3.5/imghdr.* $ SUMMARY_${PN}-importlib="Python import implementation library" RDEPENDS_${PN}-importlib="${PN}-core ${PN}-lang" -FILES_${PN}-importlib="${libdir}/python3.5/importlib " +FILES_${PN}-importlib="${libdir}/python3.5/importlib ${libdir}/python3.5/imp.* " SUMMARY_${PN}-io="Python low-level I/O" RDEPENDS_${PN}-io="${PN}-core ${PN}-math" From 1038cb98e65b142f36a13cf83ddb787f29b4d6e0 Mon Sep 17 00:00:00 2001 From: Joe Slater Date: Tue, 7 Mar 2017 15:00:55 -0800 Subject: [PATCH 003/129] e2fsprogs: have configure expand @mkdir_p@ Without doing this, locale data is not written into usr/src/locale. We could also just use MKDIR_P instead of mkdir_p. (From OE-Core rev: 6a767f6587a9d60e21fa1d9687c7c08efe3f89ab) Signed-off-by: Joe Slater Signed-off-by: Richard Purdie --- .../e2fsprogs/e2fsprogs/mkdir_p.patch | 20 +++++++++++++++++++ .../e2fsprogs/e2fsprogs_1.43.bb | 1 + 2 files changed, 21 insertions(+) create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdir_p.patch diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdir_p.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdir_p.patch new file mode 100644 index 0000000000..b0fa4b8cc5 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/mkdir_p.patch @@ -0,0 +1,20 @@ +e2fsprogs: expand @mkdir_p@ + +Add AC_SUBST to configure.ac. @mkdir_p@ is currently +not expanded so no locale data is written into usr/share/locale. + +Upstream-Status: Pending + +Signed-off-by: Joe Slater + +--- a/configure.ac ++++ b/configure.ac +@@ -811,6 +811,8 @@ AC_SUBST(PACKAGE) + AC_SUBST(VERSION) + + AM_GNU_GETTEXT ++dnl @MKDIR_P@ is expanded in AM_GNU_GETTEXT ++AC_SUBST([mkdir_p],['$(MKDIR_P)']) + dnl + dnl End of configuration options + dnl diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb index f4855bc430..5e30ec90b0 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb @@ -9,6 +9,7 @@ SRC_URI += "file://acinclude.m4 \ file://ptest.patch \ file://mkdir.patch \ file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ + file://mkdir_p.patch \ " SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" From fd78c35086036bc3fd981bc25a51fc9ce6cc66f5 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 3 Mar 2017 14:37:24 +0200 Subject: [PATCH 004/129] lib/oe/gpg_sign: sign rpm packages in chunks of 100 Split the file list into chunks in order to avoid "OSError: [Errno 7] Argument list too long" This would happend when a package has huge amount of subpackages, e.g. glibc-locale. [YOCTO #11069] (From OE-Core rev: 786eafd7b1080eccfe1c7d417eede20d75d80cb0) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton (cherry picked from commit 874f5016fd4dc76bc867b68470297fe59e78a9e6) Signed-off-by: Richard Purdie --- meta/lib/oe/gpg_sign.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py index 38eb0cb137..683ae5bf43 100644 --- a/meta/lib/oe/gpg_sign.py +++ b/meta/lib/oe/gpg_sign.py @@ -35,11 +35,12 @@ def sign_rpms(self, files, keyid, passphrase): cmd += "--define '%%__gpg %s' " % self.gpg_bin if self.gpg_path: cmd += "--define '_gpg_path %s' " % self.gpg_path - cmd += ' '.join(files) - status, output = oe.utils.getstatusoutput(cmd) - if status: - raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output) + # Sign in chunks of 100 packages + for i in range(0, len(files), 100): + status, output = oe.utils.getstatusoutput(cmd + ' '.join(files[i:i+100])) + if status: + raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output) def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True): """Create a detached signature of a file""" From 5e874ac0b1fa8c13f2abd906b27f55509cba2ef9 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 3 Mar 2017 14:37:25 +0200 Subject: [PATCH 005/129] rpm: support customizing gpg command line Add a new %_gpg_sign_cmd_extra_args macro that allows customizing the gpg options used when signing rpm packages. This is needed to be able to sign packages with gpg 2.1 which requires "--pinentry-mode loopback" to allow non-interactive signing. [YOCTO #11054] (From OE-Core rev: 5cbba2c4016ad84a54f83531868aa6e66eef468e) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton (cherry picked from commit 373a7146d596d27376a003014df0d06f3df5348d) Signed-off-by: Richard Purdie --- ...-macros-add-_gpg_sign_cmd_extra_args.patch | 43 +++++++++++++++++++ meta/recipes-devtools/rpm/rpm_5.4.16.bb | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta/recipes-devtools/rpm/rpm/0001-macros-add-_gpg_sign_cmd_extra_args.patch diff --git a/meta/recipes-devtools/rpm/rpm/0001-macros-add-_gpg_sign_cmd_extra_args.patch b/meta/recipes-devtools/rpm/rpm/0001-macros-add-_gpg_sign_cmd_extra_args.patch new file mode 100644 index 0000000000..eb43a87346 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/0001-macros-add-_gpg_sign_cmd_extra_args.patch @@ -0,0 +1,43 @@ +From fa9726ff69f86d6a87c4c4bd7e3d2881999a872a Mon Sep 17 00:00:00 2001 +From: Markus Lehtonen +Date: Thu, 23 Feb 2017 11:14:20 +0200 +Subject: [PATCH] macros: add %_gpg_sign_cmd_extra_args + +Similar to what rpm4 has. This macro can be used to customize the +gpg command line options when signing packages. This is needed for +gpg 2.1 which requires "--pinentry-mode loopback" to allow +non-interactive signing. + +Upstream-Status: Pending + +Signed-off-by: Markus Lehtonen +--- + macros/macros.in | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/macros/macros.in b/macros/macros.in +index 8bc5840..fda3c66 100644 +--- a/macros/macros.in ++++ b/macros/macros.in +@@ -524,7 +524,9 @@ $_arbitrary_tags_tests Foo:Bar + %_gpg_passphrase_way %{?_gpg_passphrase:--passphrase "%{_gpg_passphrase}"}%{!?_gpg_passphrase:--passphrase-fd 3} + + %__gpg_check_password_cmd %{__gpg} \ +- gpg --batch --no-verbose %{_gpg_passphrase_way} -u "%{_gpg_name}" -so - ++ gpg --batch --no-verbose %{_gpg_passphrase_way} \ ++ %{?_gpg_sign_cmd_extra_args:%{_gpg_sign_cmd_extra_args}} \ ++ -u "%{_gpg_name}" -so - + #%__pgp_check_password_cmd %{__pgp} \ + # pgp +batchmode=on +verbose=0 "%{_pgp_name}" -sf + #%__pgp5_check_password_cmd %{__pgp} \ +@@ -532,6 +534,7 @@ $_arbitrary_tags_tests Foo:Bar + + %__gpg_sign_cmd %{__gpg} \ + gpg --batch --no-verbose --no-armor %{_gpg_passphrase_way} --no-secmem-warning \ ++ %{?_gpg_sign_cmd_extra_args:%{_gpg_sign_cmd_extra_args}} \ + -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename} + #%__pgp_sign_cmd %{__pgp} \ + # pgp +batchmode=on +verbose=0 +armor=off \ +-- +2.10.2 + diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb b/meta/recipes-devtools/rpm/rpm_5.4.16.bb index 85eb5fef1e..497af8e055 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb @@ -119,6 +119,7 @@ SRC_URI += " \ file://gcc6-stdlib.patch \ file://0001-system.h-query.c-support-nosignature.patch \ file://rpm-ensure-rpm2cpio-call-rpm-relocation-code.patch \ + file://0001-macros-add-_gpg_sign_cmd_extra_args.patch \ " # OE specific changes From 35c95af7a8330618b2d047af8f5c2623da85c91d Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 3 Mar 2017 14:37:26 +0200 Subject: [PATCH 006/129] lib/oe/gpg_sign: make gpg version a property of the signer (From OE-Core rev: 951d22cb62891c4bc078925c4af8445d7be940e0) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton (cherry picked from commit a00a362e3dc18ba04230cbbd6f91264e5d76f40d) Signed-off-by: Richard Purdie --- meta/lib/oe/gpg_sign.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py index 683ae5bf43..16eb7f83bf 100644 --- a/meta/lib/oe/gpg_sign.py +++ b/meta/lib/oe/gpg_sign.py @@ -10,6 +10,7 @@ def __init__(self, d): self.gpg_bin = d.getVar('GPG_BIN', True) or \ bb.utils.which(os.getenv('PATH'), 'gpg') self.gpg_path = d.getVar('GPG_PATH', True) + self.gpg_version = self.get_gpg_version() self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpm") def export_pubkey(self, output_file, keyid, armor=True): @@ -59,9 +60,7 @@ def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor #gpg > 2.1 supports password pipes only through the loopback interface #gpg < 2.1 errors out if given unknown parameters - dots = self.get_gpg_version().split('.') - assert len(dots) >= 2 - if int(dots[0]) >= 2 and int(dots[1]) >= 1: + if self.gpg_version > (2,1,): cmd += ['--pinentry-mode', 'loopback'] cmd += [input_file] @@ -88,10 +87,11 @@ def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor def get_gpg_version(self): - """Return the gpg version""" + """Return the gpg version as a tuple of ints""" import subprocess try: - return subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8") + ver_str = subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8") + return tuple([int(i) for i in ver_str.split('.')]) except subprocess.CalledProcessError as e: raise bb.build.FuncFailed("Could not get gpg version: %s" % e) From 6c08cf277a8a804a69ca9e173d0eeb51f0eb09bc Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Fri, 3 Mar 2017 14:37:27 +0200 Subject: [PATCH 007/129] lib/oe/gpg_sign: fix rpm signing with gpg > 2.1 We need to check the gpg version and alter its command line options accordingly. [YOCTO #11054] (From OE-Core rev: 863459e6b565eb6b1a74b78bc01e884ffeac2085) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton (cherry picked from commit 44a44b7e582a5a654baf21829d168568481c13d9) Signed-off-by: Richard Purdie --- meta/lib/oe/gpg_sign.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py index 16eb7f83bf..ba61f98909 100644 --- a/meta/lib/oe/gpg_sign.py +++ b/meta/lib/oe/gpg_sign.py @@ -32,6 +32,8 @@ def sign_rpms(self, files, keyid, passphrase): cmd = self.rpm_bin + " --addsign --define '_gpg_name %s' " % keyid cmd += "--define '_gpg_passphrase %s' " % passphrase + if self.gpg_version > (2,1,): + cmd += "--define '_gpg_sign_cmd_extra_args --pinentry-mode=loopback' " if self.gpg_bin: cmd += "--define '%%__gpg %s' " % self.gpg_bin if self.gpg_path: From c8daf507295b76c0ea080e043a6e7a26dcdd83e4 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 20 Jan 2017 11:28:04 +0000 Subject: [PATCH 008/129] bitbake: data_smart: Fix unneeded variable manipulation If was pointed out that if we have: XXX = " A" XXX_remove_inactive-override = "YY" then XXX can become "A" and the leading space can be removed. This is because the remove override code changes the variable value even when there is no removals active. In the process it dirties the cache. We don't really need to do this so tweak the code accordingly. (Bitbake rev: f1ee6dfd3d193a9055320bdd555c1dbaa63f9475) Signed-off-by: Richard Purdie --- bitbake/lib/bb/data_smart.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index f100446dcc..805a9a71fa 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -748,13 +748,14 @@ def getVarFlag(self, var, flag, expand, noweakdefault=False, parsing=False): if match: removes.extend(self.expand(r).split()) - filtered = filter(lambda v: v not in removes, - value.split()) - value = " ".join(filtered) - if expand and var in self.expand_cache: - # We need to ensure the expand cache has the correct value - # flag == "_content" here - self.expand_cache[var].value = value + if removes: + filtered = filter(lambda v: v not in removes, + value.split()) + value = " ".join(filtered) + if expand and var in self.expand_cache: + # We need to ensure the expand cache has the correct value + # flag == "_content" here + self.expand_cache[var].value = value return value def delVarFlag(self, var, flag, **loginfo): From ca66b08b3b7254dea23d1a8ac9eedbe2396e7f12 Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Sun, 15 Jan 2017 11:13:36 -0800 Subject: [PATCH 009/129] bitbake: cooker.py: new multiconfig '*' syntax support Currently you cannot build a target for all the configured multiconfigs without specifying a list. The list can be quite long, requiring to type several lines of text. This enhancement is to support globbing so that you can do this, e.g. instead of: $ bitbake multiconfig:A:bash multiconfig:B:bash bash you can do: $ bitbake multiconfig:*:bash There are real world use cases where it is desirable to use multiconfig with two different tasks. For example: SDKs with multiple toolchains but also containing set of additional host tools, or multiconfig builds requiring one image for the main CPU(s) and a different co-image for a companion CPU. For this reason, two variations of the new syntax are supported. For example, the following: $ bitbake multiconfig:*:meta-toolhchain would expand to: $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain meta-toolchain However the following: $ bitbake multiconfig:*:meta-toolhchain hosttools would expand to: $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain hosttools In other words, if the user specified the "default" task explicitly, it replaces the implicit "default" task. [YOCTO#10680] (Bitbake rev: 3e80d47bea51b64ed6c8bffc033f2d11a630481e) Signed-off-by: Juro Bystricky Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 0f48efca6a..4877c4b644 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -668,7 +668,37 @@ def buildTaskData(self, pkgs_to_build, task, abort, allowincomplete=False): if not task.startswith("do_"): task = "do_%s" % task - fulltargetlist = self.checkPackages(pkgs_to_build, task) + targetlist = self.checkPackages(pkgs_to_build, task) + fulltargetlist = [] + defaulttask_implicit = '' + defaulttask_explicit = False + wildcard = False + + # Wild card expansion: + # Replace string such as "multiconfig:*:bash" + # into "multiconfig:A:bash multiconfig:B:bash bash" + for k in targetlist: + if k.startswith("multiconfig:"): + if wildcard: + bb.fatal('multiconfig conflict') + if k.split(":")[1] == "*": + wildcard = True + for mc in self.multiconfigs: + if mc: + fulltargetlist.append(k.replace('*', mc)) + # implicit default task + else: + defaulttask_implicit = k.split(":")[2] + else: + fulltargetlist.append(k) + else: + defaulttask_explicit = True + fulltargetlist.append(k) + + if not defaulttask_explicit and defaulttask_implicit != '': + fulltargetlist.append(defaulttask_implicit) + + bb.debug(1,"Target list: %s" % (str(fulltargetlist))) taskdata = {} localdata = {} From ca020278b39cd1afeb380f7d3f28c39c26d8b2af Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Mon, 6 Feb 2017 08:49:20 -0800 Subject: [PATCH 010/129] bitbake: cooker.py: run sanity checks for multiconfig Also run sanity check for all additional multiconfig configurations as listed in BBMULTICONFIG, not just the "default" configuration. [YOCTO#10810] (Bitbake rev: 0f7fdaa8212a8b9f1f089d32e652400d6c4b4822) Signed-off-by: Juro Bystricky Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 4877c4b644..07897be279 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -1623,7 +1623,8 @@ def updateCache(self): if self.state != state.parsing and not self.parsecache_valid: self.parseConfiguration () if CookerFeatures.SEND_SANITYEVENTS in self.featureset: - bb.event.fire(bb.event.SanityCheck(False), self.data) + for mc in self.multiconfigs: + bb.event.fire(bb.event.SanityCheck(False), self.databuilder.mcdata[mc]) for mc in self.multiconfigs: ignore = self.databuilder.mcdata[mc].getVar("ASSUME_PROVIDED", True) or "" From 555d77678507d313ba0e1a20ae868082b40046ed Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 17 Mar 2017 19:24:00 -0400 Subject: [PATCH 011/129] file: update SRCREV for 5.28 to fix fetch fail on missing commit Machines that cloned a while ago will have the commit, but new deployments won't because it seems the upstream changed/rebased and the old commit ID has been garbage-collected away. Hence the fetch fails to check out the named commit ID. Both the old (gone) commit, and the "new" commit show the same dates and commit log and point at 5.28, so hopefully this is the right thing to do. A git diff of the two seems to only show a blanket uprev of CVS tags and deletion of a couple autogen'd files, and no real source changes. (From OE-Core rev: adb71e06768adadda7b69c3b5e81ca3ad67237f4) Cc: Christos Zoulas (From OE-Core rev: 87c17b352daa63bc4f62e8802982288ab1839f1b) Signed-off-by: Paul Gortmaker Signed-off-by: Richard Purdie Signed-off-by: Denys Dmytriyenko Signed-off-by: Richard Purdie --- meta/recipes-devtools/file/file_5.28.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/file/file_5.28.bb b/meta/recipes-devtools/file/file_5.28.bb index e64a89c804..048fb8ef9d 100644 --- a/meta/recipes-devtools/file/file_5.28.bb +++ b/meta/recipes-devtools/file/file_5.28.bb @@ -19,7 +19,7 @@ SRC_URI = "git://github.com/file/file.git \ file://0001-Add-P-prompt-into-Usage-info.patch \ " -SRCREV = "3c521817322a6bf5160cfeb09b9145ccde587b2a" +SRCREV = "acbaf156236cbc54b3cf3bc6cbf05d80cb196451" S = "${WORKDIR}/git" inherit autotools From e292e935b077a95ae093d4b425c7e95b177b030b Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 21 Mar 2017 22:17:57 +0000 Subject: [PATCH 012/129] Revert "file: update SRCREV for 5.28 to fix fetch fail on missing commit" This reverts commit 87c17b352daa63bc4f62e8802982288ab1839f1b. Upstream restored the original hashes. Signed-off-by: Richard Purdie --- meta/recipes-devtools/file/file_5.28.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/file/file_5.28.bb b/meta/recipes-devtools/file/file_5.28.bb index 048fb8ef9d..e64a89c804 100644 --- a/meta/recipes-devtools/file/file_5.28.bb +++ b/meta/recipes-devtools/file/file_5.28.bb @@ -19,7 +19,7 @@ SRC_URI = "git://github.com/file/file.git \ file://0001-Add-P-prompt-into-Usage-info.patch \ " -SRCREV = "acbaf156236cbc54b3cf3bc6cbf05d80cb196451" +SRCREV = "3c521817322a6bf5160cfeb09b9145ccde587b2a" S = "${WORKDIR}/git" inherit autotools From 924e576b8930fd2268d85f0b151e5f68a3c2afce Mon Sep 17 00:00:00 2001 From: Daniel Lublin Date: Mon, 5 Dec 2016 18:42:05 +0100 Subject: [PATCH 013/129] bitbake: lib/bs4: Fix imports from html5lib >= 0.9999999/1.0b8 As of html5lib 0.9999999/1.0b8 (released on July 14, 2016), some modules have moved from _base to base. Handle this, while staying compatible with earlier versions. (Bitbake rev: bdf7a362ecdafd47f309b7a21feac4b94624f287) Signed-off-by: Daniel Lublin Signed-off-by: Richard Purdie --- bitbake/lib/bs4/builder/_html5lib.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bitbake/lib/bs4/builder/_html5lib.py b/bitbake/lib/bs4/builder/_html5lib.py index f0e5924ebb..2b7a70aa11 100644 --- a/bitbake/lib/bs4/builder/_html5lib.py +++ b/bitbake/lib/bs4/builder/_html5lib.py @@ -15,7 +15,14 @@ whitespace_re, ) import html5lib +try: + # html5lib >= 0.99999999/1.0b9 + from html5lib.treebuilders import base as treebuildersbase +except ImportError: + # html5lib <= 0.9999999/1.0b8 + from html5lib.treebuilders import _base as treebuildersbase from html5lib.constants import namespaces + from bs4.element import ( Comment, Doctype, @@ -67,7 +74,7 @@ def test_fragment_to_document(self, fragment): return '%s' % fragment -class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder): +class TreeBuilderForHtml5lib(treebuildersbase.TreeBuilder): def __init__(self, soup, namespaceHTMLElements): self.soup = soup @@ -105,7 +112,7 @@ def getDocument(self): return self.soup def getFragment(self): - return html5lib.treebuilders._base.TreeBuilder.getFragment(self).element + return treebuildersbase.TreeBuilder.getFragment(self).element class AttrList(object): def __init__(self, element): @@ -137,9 +144,9 @@ def __contains__(self, name): return name in list(self.attrs.keys()) -class Element(html5lib.treebuilders._base.Node): +class Element(treebuildersbase.Node): def __init__(self, element, soup, namespace): - html5lib.treebuilders._base.Node.__init__(self, element.name) + treebuildersbase.Node.__init__(self, element.name) self.element = element self.soup = soup self.namespace = namespace @@ -324,7 +331,7 @@ def getNameTuple(self): class TextNode(Element): def __init__(self, element, soup): - html5lib.treebuilders._base.Node.__init__(self, None) + treebuildersbase.Node.__init__(self, None) self.element = element self.soup = soup From 30166f042dbae918178c470c645c3b947ddf5b41 Mon Sep 17 00:00:00 2001 From: Li Zhou Date: Mon, 13 Feb 2017 10:53:24 +0800 Subject: [PATCH 014/129] bash: fix CVE-2016-9401 popd in bash might allow local users to bypass the restricted shell and cause a use-after-free via a crafted address. Porting patch from to solve CVE-2016-9401. (From OE-Core rev: 9b5e17b45ca5b2518f1f7c13bb2f79b5b669744f) Signed-off-by: Li Zhou Signed-off-by: Ross Burton (cherry picked from commit 6987b317d5ce8dc50a37ebba395aa8424bec358c) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../bash/bash/CVE-2016-9401.patch | 50 +++++++++++++++++++ meta/recipes-extended/bash/bash_4.3.30.bb | 1 + 2 files changed, 51 insertions(+) create mode 100644 meta/recipes-extended/bash/bash/CVE-2016-9401.patch diff --git a/meta/recipes-extended/bash/bash/CVE-2016-9401.patch b/meta/recipes-extended/bash/bash/CVE-2016-9401.patch new file mode 100644 index 0000000000..28c927743c --- /dev/null +++ b/meta/recipes-extended/bash/bash/CVE-2016-9401.patch @@ -0,0 +1,50 @@ +From fa741771ed47b30547be63b5b5dbfb51977aca12 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Fri, 20 Jan 2017 11:47:31 -0500 +Subject: [PATCH] Bash-4.4 patch 6 + +Bug-Reference-URL: +https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00116.html + +Reference to upstream patch: +https://ftp.gnu.org/pub/gnu/bash/bash-4.4-patches/bash44-006 + +Bug-Description: +Out-of-range negative offsets to popd can cause the shell to crash attempting +to free an invalid memory block. + +Upstream-Status: Backport +CVE: CVE-2016-9401 +Signed-off-by: Li Zhou +--- + builtins/pushd.def | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/builtins/pushd.def b/builtins/pushd.def +index 9c6548f..8a13bae 100644 +--- a/builtins/pushd.def ++++ b/builtins/pushd.def +@@ -359,7 +359,7 @@ popd_builtin (list) + break; + } + +- if (which > directory_list_offset || (directory_list_offset == 0 && which == 0)) ++ if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0)) + { + pushd_error (directory_list_offset, which_word ? which_word : ""); + return (EXECUTION_FAILURE); +@@ -381,6 +381,11 @@ popd_builtin (list) + remove that directory from the list and shift the remainder + of the list into place. */ + i = (direction == '+') ? directory_list_offset - which : which; ++ if (i < 0 || i > directory_list_offset) ++ { ++ pushd_error (directory_list_offset, which_word ? which_word : ""); ++ return (EXECUTION_FAILURE); ++ } + free (pushd_directory_list[i]); + directory_list_offset--; + +-- +1.9.1 + diff --git a/meta/recipes-extended/bash/bash_4.3.30.bb b/meta/recipes-extended/bash/bash_4.3.30.bb index 765562fbdd..e398e87b60 100644 --- a/meta/recipes-extended/bash/bash_4.3.30.bb +++ b/meta/recipes-extended/bash/bash_4.3.30.bb @@ -30,6 +30,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ file://fix-run-builtins.patch \ file://0001-help-fix-printf-format-security-warning.patch \ file://fix-run-intl.patch \ + file://CVE-2016-9401.patch \ " SRC_URI[tarball.md5sum] = "a27b3ee9be83bd3ba448c0ff52b28447" From b6e0d7c99f1f0044f745f87d44e777619df6271c Mon Sep 17 00:00:00 2001 From: Sona Sarmadi Date: Fri, 24 Feb 2017 13:49:18 +0100 Subject: [PATCH 015/129] tar: CVE-2016-6321 Skip members whose names contain "..". Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6321 Upstream patch: http://git.savannah.gnu.org/cgit/tar.git/commit/?id=7340f67b9860ea0531c1450e5aa261c50f671 (From OE-Core rev: 3dd835eb0cdd6f530aef5c870d06bc971eec7857) Signed-off-by: Sona Sarmadi Signed-off-by: Ross Burton (cherry picked from commit cfa2b5facd1aa6a2bac4cb04687e1a977c533934) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../tar/tar/CVE-2016-6321.patch | 66 +++++++++++++++++++ meta/recipes-extended/tar/tar_1.29.bb | 1 + 2 files changed, 67 insertions(+) create mode 100644 meta/recipes-extended/tar/tar/CVE-2016-6321.patch diff --git a/meta/recipes-extended/tar/tar/CVE-2016-6321.patch b/meta/recipes-extended/tar/tar/CVE-2016-6321.patch new file mode 100644 index 0000000000..6d35bcc513 --- /dev/null +++ b/meta/recipes-extended/tar/tar/CVE-2016-6321.patch @@ -0,0 +1,66 @@ +From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Sat, 29 Oct 2016 21:04:40 -0700 +Subject: [PATCH] When extracting, skip ".." members + +* NEWS: Document this. +* src/extract.c (extract_archive): Skip members whose names +contain "..". + +CVE: CVE-2016-6321 +Upstream-Status: Backport + +Cherry picked from commit: 7340f67 When extracting, skip ".." members + +Signed-off-by: Sona Sarmadi +--- + NEWS | 8 +++++++- + src/extract.c | 8 ++++++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/NEWS b/NEWS +index 501164a..fc97cfc 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,6 +1,12 @@ +-GNU tar NEWS - User visible changes. 2016-05-16 ++GNU tar NEWS - User visible changes. 2016-10-29 + Please send GNU tar bug reports to + ++* Member names containing '..' components are now skipped when extracting. ++ ++This fixes tar's behavior to match its documentation, and is a bit ++safer when extracting untrusted archives over old files (an unsafe ++practice that the tar manual has long recommended against). ++ + + version 1.29 - Sergey Poznyakoff, 2016-05-16 + +diff --git a/src/extract.c b/src/extract.c +index f982433..7904148 100644 +--- a/src/extract.c ++++ b/src/extract.c +@@ -1629,12 +1629,20 @@ extract_archive (void) + { + char typeflag; + tar_extractor_t fun; ++ bool skip_dotdot_name; + + fatal_exit_hook = extract_finish; + + set_next_block_after (current_header); + ++ skip_dotdot_name = (!absolute_names_option ++ && contains_dot_dot (current_stat_info.orig_file_name)); ++ if (skip_dotdot_name) ++ ERROR ((0, 0, _("%s: Member name contains '..'"), ++ quotearg_colon (current_stat_info.orig_file_name))); ++ + if (!current_stat_info.file_name[0] ++ || skip_dotdot_name + || (interactive_option + && !confirm ("extract", current_stat_info.file_name))) + { +-- +1.9.1 + diff --git a/meta/recipes-extended/tar/tar_1.29.bb b/meta/recipes-extended/tar/tar_1.29.bb index efce57d9d7..f22d9c9388 100644 --- a/meta/recipes-extended/tar/tar_1.29.bb +++ b/meta/recipes-extended/tar/tar_1.29.bb @@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" SRC_URI += "file://remove-gets.patch \ file://musl_dirent.patch \ + file://CVE-2016-6321.patch \ " SRC_URI[md5sum] = "955cd533955acb1804b83fd70218da51" SRC_URI[sha256sum] = "236b11190c0a3a6885bdb8d61424f2b36a5872869aa3f7f695dea4b4843ae2f2" From bd2009ecfc1451edfc9b8d29224be32ae064a6da Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Thu, 15 Dec 2016 07:21:45 -0800 Subject: [PATCH 016/129] tzdata: update to 2016j MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Briefly: Saratov, Russia moves from +03 to +04 on 2016-12-04. Changes to future time stamps Saratov, Russia switches from +03 to +04 on 2016-12-04 at 02:00. This hives off a new zone Europe/Saratov from Europe/Volgograd. (Thanks to Yuri Konotopov and Stepan Golosunov.) Changes to past time stamps The new zone Asia/Atyrau for Atyraū Region, Kazakhstan, is like Asia/Aqtau except it switched from +05/+06 to +04/+05 in spring 1999, not fall 1994. (Thanks to Stepan Golosunov.) Changes to past time zone abbreviations Asia/Gaza and Asia/Hebron now use "EEST", not "EET", to denote summer time before 1948. The old use of "EET" was a typo. (From OE-Core rev: a0b389b5f3effad5194109f9914dec6125b3569d) (From OE-Core rev: 5e117f4250d6155d3014f85dd1cbbfad0afdf282) Signed-off-by: Armin Kuster Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit 147d7802926153ef0abb12d5e738576d8dfd02d7) Signed-off-by: Richard Purdie --- .../tzdata/{tzdata_2016i.bb => tzdata_2016j.bb} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename meta/recipes-extended/tzdata/{tzdata_2016i.bb => tzdata_2016j.bb} (98%) diff --git a/meta/recipes-extended/tzdata/tzdata_2016i.bb b/meta/recipes-extended/tzdata/tzdata_2016j.bb similarity index 98% rename from meta/recipes-extended/tzdata/tzdata_2016i.bb rename to meta/recipes-extended/tzdata/tzdata_2016j.bb index 3801a3fced..1ef330e5fb 100644 --- a/meta/recipes-extended/tzdata/tzdata_2016i.bb +++ b/meta/recipes-extended/tzdata/tzdata_2016j.bb @@ -9,8 +9,8 @@ DEPENDS = "tzcode-native" SRC_URI = "http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata" UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" -SRC_URI[tzdata.md5sum] = "73912ecfa6a9a8048ddf2e719d9bc39d" -SRC_URI[tzdata.sha256sum] = "b6966ec982ef64fe48cebec437096b4f57f4287519ed32dde59c86d3a1853845" +SRC_URI[tzdata.md5sum] = "db361d005ac8b30a2d18c5ca38d3e8ab" +SRC_URI[tzdata.sha256sum] = "f5ee4e0f115f6c2faee1c4b16193a97338cbd1b503f2cea6c5a768c82ff39dc8" inherit allarch From af70b781aefe0e7c579e0d53d8f299f420f9e6ce Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Thu, 15 Dec 2016 07:21:44 -0800 Subject: [PATCH 017/129] tzcode-native: update to 2016j MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changes to code zic no longer mishandles file systems that lack hard links, fixing bugs introduced in 2016g. (Problems reported by Tom Lane.) Also, when the destination already contains symbolic links, zic should now work better on systems where the 'link' system call does not follow symbolic links. Changes to documentation and commentary tz-link.htm now documents the relationship between release version numbers and development-repository commit tags. (Suggested by Paul Koning.) The 'Theory' file now documents UT. iso3166.tab now accents "Curaçao", and commentary now mentions the names "Cabo Verde" and "Czechia". (Thanks to Jiří Boháč.) (From OE-Core rev: 3fb5ddce97af1d4ada0dcc7f9c0ceef6ac392918) (From OE-Core rev: b83b3565554c923468049ea1fdc9bb5dcec631aa) Signed-off-by: Armin Kuster Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (cherry picked from commit f9d6b482f2275c054dff91b81ac901b612f9c9b4) Signed-off-by: Richard Purdie --- .../{tzcode-native_2016i.bb => tzcode-native_2016j.bb} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename meta/recipes-extended/tzcode/{tzcode-native_2016i.bb => tzcode-native_2016j.bb} (69%) diff --git a/meta/recipes-extended/tzcode/tzcode-native_2016i.bb b/meta/recipes-extended/tzcode/tzcode-native_2016j.bb similarity index 69% rename from meta/recipes-extended/tzcode/tzcode-native_2016i.bb rename to meta/recipes-extended/tzcode/tzcode-native_2016j.bb index 9d3d5a1334..630fd42d64 100644 --- a/meta/recipes-extended/tzcode/tzcode-native_2016i.bb +++ b/meta/recipes-extended/tzcode/tzcode-native_2016j.bb @@ -9,10 +9,10 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata" UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" -SRC_URI[tzcode.md5sum] = "8fae14cba9396462955b7859cf04ba48" -SRC_URI[tzcode.sha256sum] = "411e8adcb6288b17d6c2624fde65e7d82654ca69b813ae121504ff66f0cfba7b" -SRC_URI[tzdata.md5sum] = "73912ecfa6a9a8048ddf2e719d9bc39d" -SRC_URI[tzdata.sha256sum] = "b6966ec982ef64fe48cebec437096b4f57f4287519ed32dde59c86d3a1853845" +SRC_URI[tzcode.md5sum] = "0684b98eb184fab250b6ca946862078d" +SRC_URI[tzcode.sha256sum] = "b9effc4fb4051df4a356cbe5857bf99e2fa32e00d8340f2e8a4d58f0c9ccb0b7" +SRC_URI[tzdata.md5sum] = "db361d005ac8b30a2d18c5ca38d3e8ab" +SRC_URI[tzdata.sha256sum] = "f5ee4e0f115f6c2faee1c4b16193a97338cbd1b503f2cea6c5a768c82ff39dc8" S = "${WORKDIR}" From c7fc10a5f620ad038167b9eaf2454435c1e6a93e Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Tue, 28 Feb 2017 19:48:30 -0800 Subject: [PATCH 018/129] tzcode-native: update to 2017a Changes to code zic no longer mishandles some transitions in January 2038 when it attempts to work around Qt bug 53071. This fixes a bug affecting Pacific/Tongatapu that was introduced in zic 2016e. localtime.c now contains a workaround, useful when loading a file generated by a buggy zic. (Problem and localtime.c fix reported by Bradley White.) zdump -i now outputs non-hour numeric time zone abbreviations without a colon, e.g., "+0530" rather than "+05:30". This agrees with zic %z and with common practice, and simplifies auditing of zdump output. zdump is now buildable again with -DUSE_LTZ=0. (Problem reported by Joseph Myers.) zdump.c now always includes private.h, to avoid code duplication with private.h. (Problem reported by Kees Dekker.) localtime.c no longer mishandles early or late timestamps when TZ is set to a POSIX-style string that specifies DST. (Problem reported by Kees Dekker.) date and strftime now cause %z to generate "-0000" instead of "+0000" when the UT offset is zero and the time zone abbreviation begins with "-". Changes to documentation and commentary The 'Theory' file now better documents choice of historical time zone abbreviations. (Problems reported by Michael Deckers.) tz-link.htm now covers leap smearing, which is popular in clouds. (From OE-Core rev: 064457dd47cff339ae442c29ce23648a83a695b9) Signed-off-by: Armin Kuster Signed-off-by: Ross Burton (cherry picked from commit 6c95fbf51ec538e29083a4a890d106b732c1b182) Signed-off-by: Richard Purdie --- .../{tzcode-native_2016j.bb => tzcode-native_2017a.bb} | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename meta/recipes-extended/tzcode/{tzcode-native_2016j.bb => tzcode-native_2017a.bb} (69%) diff --git a/meta/recipes-extended/tzcode/tzcode-native_2016j.bb b/meta/recipes-extended/tzcode/tzcode-native_2017a.bb similarity index 69% rename from meta/recipes-extended/tzcode/tzcode-native_2016j.bb rename to meta/recipes-extended/tzcode/tzcode-native_2017a.bb index 630fd42d64..0daac531fd 100644 --- a/meta/recipes-extended/tzcode/tzcode-native_2016j.bb +++ b/meta/recipes-extended/tzcode/tzcode-native_2017a.bb @@ -9,10 +9,10 @@ SRC_URI =" http://www.iana.org/time-zones/repository/releases/tzcode${PV}.tar.gz http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata" UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" -SRC_URI[tzcode.md5sum] = "0684b98eb184fab250b6ca946862078d" -SRC_URI[tzcode.sha256sum] = "b9effc4fb4051df4a356cbe5857bf99e2fa32e00d8340f2e8a4d58f0c9ccb0b7" -SRC_URI[tzdata.md5sum] = "db361d005ac8b30a2d18c5ca38d3e8ab" -SRC_URI[tzdata.sha256sum] = "f5ee4e0f115f6c2faee1c4b16193a97338cbd1b503f2cea6c5a768c82ff39dc8" +SRC_URI[tzcode.md5sum] = "eef0bfac7a52dce6989a7d8b40d86fe0" +SRC_URI[tzcode.sha256sum] = "02f2c6b58b99edd0d47f0cad34075b359fd1a4dab71850f493b0404ded3b38ac" +SRC_URI[tzdata.md5sum] = "cb8274cd175f8a4d9d1b89895df876dc" +SRC_URI[tzdata.sha256sum] = "df3a5c4d0a2cf0cde0b3f35796ccf6c9acfd598b8e70f8dece5404cd7626bbd6" S = "${WORKDIR}" From fe4703c473348b1cc86fee06ac770ee439f4c077 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Tue, 28 Feb 2017 19:48:31 -0800 Subject: [PATCH 019/129] tzdata: update to 2017a MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Briefly: Southern Chile moves from -04/-03 to -03, and Mongolia discontinues DST. Changes to future time stamps Mongolia no longer observes DST. (Thanks to Ganbold Tsagaankhuu.) Chile's Region of Magallanes moves from -04/-03 to -03 year-round. Its clocks diverge from America/Santiago starting 2017-05-13 at 23:00, hiving off a new zone America/Punta_Arenas. Although the Chilean government says this change expires in May 2019, for now assume it's permanent. (Thanks to Juan Correa and Deborah Goldsmith.) This also affects Antarctica/Palmer. Changes to past time stamps Fix many entries for historical time stamps for Europe/Madrid before 1979, to agree with tables compiled by Pere Planesas of the National Astronomical Observatory of Spain. As a side effect, this changes some time stamps for Africa/Ceuta before 1929, which are probably guesswork anyway. (Thanks to Steve Allen and Pierpaolo Bernardi for the heads-ups, and to Michael Deckers for correcting the 1901 transition.) Ecuador observed DST from 1992-11-28 to 1993-02-05. (Thanks to Alois Treindl.) Asia/Atyrau and Asia/Oral were at +03 (not +04) before 1930-06-21. (Thanks to Stepan Golosunov.) Changes to past and future time zone abbreviations Switch to numeric time zone abbreviations for South America, as part of the ongoing project of removing invented abbreviations. This avoids the need to invent an abbreviation for the new Chilean new zone. Similarly, switch from invented to numeric time zone abbreviations for Afghanistan, American Samoa, the Azores, Bangladesh, Bhutan, the British Indian Ocean Territory, Brunei, Cape Verde, Chatham Is, Christmas I, Cocos (Keeling) Is, Cook Is, Dubai, East Timor, Eucla, Fiji, French Polynesia, Greenland, Indochina, Iran, Iraq, Kiribati, Lord Howe, Macquarie, Malaysia, the Maldives, Marshall Is, Mauritius, Micronesia, Mongolia, Myanmar, Nauru, Nepal, New Caledonia, Niue, Norfolk I, Palau, Papua New Guinea, the Philippines, Pitcairn, Qatar, Réunion, St Pierre & Miquelon, Samoa, Saudi Arabia, Seychelles, Singapore, Solomon Is, Tokelau, Tuvalu, Wake, Vanuatu, Wallis & Futuna, and Xinjiang; for 20-minute daylight saving time in Ghana before 1943; for half-hour daylight saving time in Belize before 1944 and in the Dominican Republic before 1975; and for Canary Islands before 1946, for Guinea-Bissau before 1975, for Iceland before 1969, for Indian Summer Time before 1942, for Indonesia before around 1964, for Kenya before 1960, for Liberia before 1973, for Madeira before 1967, for Namibia before 1943, for the Netherlands in 1937-9, for Pakistan before 1971, for Western Sahara before 1977, and for Zaporozhye in 1880-1924. For Alaska time from 1900 through 1967, instead of "CAT" use the abbreviation "AST", the abbreviation commonly used at the time (Atlantic Standard Time had not been standardized yet). Use "AWT" and "APT" instead of the invented abbreviations "CAWT" and "CAPT". Use "CST" and "CDT" instead of invented abbreviations for Macau before 1999 and Taiwan before 1938, and use "JST" instead of the invented abbreviation "JCST" for Japan and Korea before 1938. Change to database entry category Move the Pacific/Johnston link from 'australasia' to 'backward', since Johnston is now uninhabited. (From OE-Core rev: 697ea2e2776e54b5cac70461b8aafa2c9b7a0bc3) Signed-off-by: Armin Kuster Signed-off-by: Ross Burton (cherry picked from commit 784a8379260759700ab8482b1699c9567d6e9f3f) Signed-off-by: Richard Purdie --- .../tzdata/{tzdata_2016j.bb => tzdata_2017a.bb} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename meta/recipes-extended/tzdata/{tzdata_2016j.bb => tzdata_2017a.bb} (98%) diff --git a/meta/recipes-extended/tzdata/tzdata_2016j.bb b/meta/recipes-extended/tzdata/tzdata_2017a.bb similarity index 98% rename from meta/recipes-extended/tzdata/tzdata_2016j.bb rename to meta/recipes-extended/tzdata/tzdata_2017a.bb index 1ef330e5fb..ce59d7102c 100644 --- a/meta/recipes-extended/tzdata/tzdata_2016j.bb +++ b/meta/recipes-extended/tzdata/tzdata_2017a.bb @@ -9,8 +9,8 @@ DEPENDS = "tzcode-native" SRC_URI = "http://www.iana.org/time-zones/repository/releases/tzdata${PV}.tar.gz;name=tzdata" UPSTREAM_CHECK_URI = "http://www.iana.org/time-zones" -SRC_URI[tzdata.md5sum] = "db361d005ac8b30a2d18c5ca38d3e8ab" -SRC_URI[tzdata.sha256sum] = "f5ee4e0f115f6c2faee1c4b16193a97338cbd1b503f2cea6c5a768c82ff39dc8" +SRC_URI[tzdata.md5sum] = "cb8274cd175f8a4d9d1b89895df876dc" +SRC_URI[tzdata.sha256sum] = "df3a5c4d0a2cf0cde0b3f35796ccf6c9acfd598b8e70f8dece5404cd7626bbd6" inherit allarch From c567b4e058f8f25fec1f905ab6b46eb4202ca0e2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 9 Mar 2017 09:48:44 +0000 Subject: [PATCH 020/129] tzcode-native: Set cc to ${CC} Building on a system without "cc" showed this recipe doesn't respect the $CC variable. Fix this by passing the right option to the makefile. (From OE-Core rev: 313d977fdfe571ad6edf65c6ed20bbb0110dc320) Signed-off-by: Richard Purdie (cherry picked from commit 402080c0a77443f541fa3d658b79f3fba327279d) Signed-off-by: Richard Purdie --- meta/recipes-extended/tzcode/tzcode-native_2017a.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/recipes-extended/tzcode/tzcode-native_2017a.bb b/meta/recipes-extended/tzcode/tzcode-native_2017a.bb index 0daac531fd..2c26744f33 100644 --- a/meta/recipes-extended/tzcode/tzcode-native_2017a.bb +++ b/meta/recipes-extended/tzcode/tzcode-native_2017a.bb @@ -18,6 +18,8 @@ S = "${WORKDIR}" inherit native +EXTRA_OEMAKE += "cc=${CC}" + do_install () { install -d ${D}${bindir}/ install -m 755 zic ${D}${bindir}/ From 561ff936f1d8ba50b728d14636f41f5a13e525e7 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Tue, 7 Mar 2017 14:41:56 +0100 Subject: [PATCH 021/129] wic: filemap: Fixed spared_copy skip This patches removes the empty space in front of the copied file which was skipped. Without this reduction it's not possible to place a partition with rawcopy and skip parameter on a desired alignment. (From OE-Core rev: e29deac69ed29226b68001db2fcfb3ed24c0568a) Signed-off-by: Daniel Schultz Signed-off-by: Ross Burton (cherry picked from commit 5c024d71f9413b81ee1707dbc41f0721f8f27bdb) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/lib/wic/filemap.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index f3240ba8d8..162603ed0a 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py @@ -543,9 +543,9 @@ def sparse_copy(src_fname, dst_fname, offset=0, skip=0): end = (last + 1) * fmap.block_size if start < skip < end: - start = skip - - fmap._f_image.seek(start, os.SEEK_SET) + fmap._f_image.seek(skip, os.SEEK_SET) + else: + fmap._f_image.seek(start, os.SEEK_SET) dst_file.seek(offset + start, os.SEEK_SET) chunk_size = 1024 * 1024 From b5fe7ef2ed936a53ed8fed95238775170a8ae7f3 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Tue, 7 Mar 2017 14:41:55 +0100 Subject: [PATCH 022/129] wic: plugins: rawcopy: Fixed wrong variable type Without the int() function this variable will be a string. This will led to a error in Filemap on line 545 due wrong types. > [...] > File > ".../poky/scripts/lib/wic/filemap.py", line 545, in sparse_copy > if start < skip < end: > TypeError: unorderable types: int() < str() (From OE-Core rev: 5b9bcfef9086c19a4577d36729b7b339f959d5c4) Signed-off-by: Daniel Schultz Signed-off-by: Ross Burton (cherry picked from commit 46b5814bcdc0e7e3cb293e877e2aa949baf5fef8) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/lib/wic/plugins/source/rawcopy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index 5bd22fdeb5..618dd4475c 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -71,7 +71,7 @@ def do_prepare_partition(cls, part, source_params, cr, cr_workdir, dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno)) if 'skip' in source_params: - sparse_copy(src, dst, skip=source_params['skip']) + sparse_copy(src, dst, skip=int(source_params['skip'])) else: sparse_copy(src, dst) From 458b9e69494895a3bce955164819e725292310a7 Mon Sep 17 00:00:00 2001 From: Maxin John Date: Tue, 17 Jan 2017 18:20:34 +0200 Subject: [PATCH 023/129] busybox: refresh the flock patch Upstream accepted the flock fix with some improvements. Backport those changes. (From OE-Core rev: 58c01c9ccbec416b297dacd4b917d4073c35c6fb) Signed-off-by: Maxin B. John Signed-off-by: Maxin B. John Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...-behaviour-of-c-parameter-to-match-u.patch | 77 ++++++++----------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch index 8bcbd73de9..78520f0d90 100644 --- a/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch +++ b/meta/recipes-core/busybox/busybox/0001-flock-update-the-behaviour-of-c-parameter-to-match-u.patch @@ -1,35 +1,24 @@ -From 198f18addf1d814c2fefcb492f3b9fbd221669bb Mon Sep 17 00:00:00 2001 -From: "Maxin B. John" -Date: Wed, 20 Apr 2016 18:24:45 +0300 -Subject: [PATCH] flock: update the behaviour of -c parameter to match upstream - -In upstream, -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" +From e1d426fd65c00a6d01a10d85edf8a294ae8a2d2b Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Sun, 24 Apr 2016 18:19:49 +0200 +Subject: [PATCH] flock: fix -c; improve error handling of fork+exec function old new delta -flock_main 286 377 +91 -.rodata 155849 155890 +41 +flock_main 254 334 +80 -Upstream-Status: Submitted -[ http://lists.busybox.net/pipermail/busybox/2016-April/084142.html ] +Upstream-Status: Backport +Signed-off-by: Denys Vlasenko Signed-off-by: Maxin B. John --- - util-linux/flock.c | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) + util-linux/flock.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/util-linux/flock.c b/util-linux/flock.c -index 05a747f..c85a25d 100644 +index 05a747f..539a835 100644 --- a/util-linux/flock.c +++ b/util-linux/flock.c -@@ -20,6 +20,7 @@ int flock_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; - int flock_main(int argc UNUSED_PARAM, char **argv) - { - int mode, opt, fd; -+ char *cmd_args[4]; - enum { - OPT_s = (1 << 0), - OPT_x = (1 << 1), -@@ -57,7 +58,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv) +@@ -57,7 +57,6 @@ int flock_main(int argc UNUSED_PARAM, char **argv) /* If it is "flock FILE -c PROG", then -c isn't caught by getopt32: * we use "+" in order to support "flock -opt FILE PROG -with-opts", * we need to remove -c by hand. @@ -37,35 +26,37 @@ index 05a747f..c85a25d 100644 */ if (argv[0] && argv[0][0] == '-' -@@ -65,7 +65,10 @@ int flock_main(int argc UNUSED_PARAM, char **argv) - || (ENABLE_LONG_OPTS && strcmp(argv[0] + 1, "-command") == 0) +@@ -66,6 +65,9 @@ int flock_main(int argc UNUSED_PARAM, char **argv) ) ) { -- argv++; -+ if (argc != optind + 3) -+ bb_error_msg_and_die("-c requires exactly one command argument"); -+ else -+ argv++; + argv++; ++ if (argv[1]) ++ bb_error_msg_and_die("-c takes only one argument"); ++ opt |= OPT_c; } if (OPT_s == LOCK_SH && OPT_x == LOCK_EX && OPT_n == LOCK_NB && OPT_u == LOCK_UN) { -@@ -89,9 +92,14 @@ int flock_main(int argc UNUSED_PARAM, char **argv) - return EXIT_FAILURE; +@@ -90,8 +92,21 @@ int flock_main(int argc UNUSED_PARAM, char **argv) bb_perror_nomsg_and_die(); } -- + - if (argv[0]) -- return spawn_and_wait(argv); -- -+ if (argv[0]) { -+ cmd_args[0] = getenv("SHELL"); -+ if (!cmd_args[0]) -+ cmd_args[0] = (char*)DEFAULT_SHELL; -+ cmd_args[1] = (char*)"-c"; -+ cmd_args[2] = argv[0]; -+ cmd_args[3] = NULL; -+ return spawn_and_wait(cmd_args); -+ } ++ if (argv[0]) { ++ if (!(opt & OPT_c)) { ++ int rc = spawn_and_wait(argv); ++ if (rc < 0) ++ bb_simple_perror_msg(argv[0]); ++ return rc; ++ } ++ /* -c 'PROG ARGS' means "run sh -c 'PROG ARGS'" */ ++ argv -= 2; ++ argv[0] = (char*)get_shell_name(); ++ argv[1] = (char*)"-c"; ++ /* argv[2] = "PROG ARGS"; */ ++ /* argv[3] = NULL; */ + return spawn_and_wait(argv); ++ } + return EXIT_SUCCESS; } -- From ae95c1e7cbfb8cccf689274d4da95da76d4bee02 Mon Sep 17 00:00:00 2001 From: Zubair Lutfullah Kakakhel Date: Fri, 16 Dec 2016 15:14:19 +0000 Subject: [PATCH 024/129] openssl: Add support for many MIPS configurations Add more case statements to catch MIPS tune configurations (From OE-Core rev: d9f8f12881d1b1be5761f0aa3a1785f979dc9076) Signed-off-by: Zubair Lutfullah Kakakhel Signed-off-by: Ross Burton (cherry picked from commit cd1f6fbf9a2113cf510c25de2eb3895468e79149) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-connectivity/openssl/openssl.inc | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/meta/recipes-connectivity/openssl/openssl.inc b/meta/recipes-connectivity/openssl/openssl.inc index f3a2c5abd7..2ef8b38be8 100644 --- a/meta/recipes-connectivity/openssl/openssl.inc +++ b/meta/recipes-connectivity/openssl/openssl.inc @@ -107,18 +107,24 @@ do_configure () { linux-gnu64-x86_64) target=linux-x86_64 ;; - linux-mips) - target=debian-mips + linux-gnun32-mips*el) + target=debian-mipsn32el + ;; + linux-gnun32-mips*) + target=debian-mipsn32 + ;; + linux-mips*64*el) + target=debian-mips64el ;; - linux-mipsel) + linux-mips*64*) + target=debian-mips64 + ;; + linux-mips*el) target=debian-mipsel ;; - linux-*-mips64 | linux-mips64) - target=debian-mips64 - ;; - linux-*-mips64el | linux-mips64el) - target=debian-mips64el - ;; + linux-mips*) + target=debian-mips + ;; linux-microblaze*|linux-nios2*) target=linux-generic32 ;; From 7c0a184f8b5412a109fdeeb0d89c501e41ede35a Mon Sep 17 00:00:00 2001 From: Zubair Lutfullah Kakakhel Date: Wed, 23 Nov 2016 13:47:31 +0000 Subject: [PATCH 025/129] gmp: Disable assembly for MIPS R6 gmplib has some assembly routines. These have not been optimized for MIPS R6 yet. Add --disable-assembly so that the C implementation is used. (From OE-Core rev: b21d5c0c615c99bd0d756ab32818acc3b648fb4e) Signed-off-by: Zubair Lutfullah Kakakhel Signed-off-by: Ross Burton (cherry picked from commit b0975809fe43b7506cc30a60245f5e32b275a3ec) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-support/gmp/gmp_6.1.1.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/recipes-support/gmp/gmp_6.1.1.bb b/meta/recipes-support/gmp/gmp_6.1.1.bb index 303c3ef9e2..614d21ab7d 100644 --- a/meta/recipes-support/gmp/gmp_6.1.1.bb +++ b/meta/recipes-support/gmp/gmp_6.1.1.bb @@ -21,6 +21,7 @@ SRC_URI[sha256sum] = "a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95b acpaths = "" EXTRA_OECONF += " --enable-cxx=detect" +EXTRA_OECONF_mipsarchr6_append = " --disable-assembly" PACKAGES =+ "libgmpxx" FILES_libgmpxx = "${libdir}/libgmpxx${SOLIBS}" From 6c3d10ea62ad282a764da83aa701f92c6d3db6cb Mon Sep 17 00:00:00 2001 From: Randy Witt Date: Tue, 21 Feb 2017 10:04:49 -0800 Subject: [PATCH 026/129] image_types.bbclass: IMAGE_TYPEDEP_ now adds deps for conversion types Previously if IMAGE_TYPEDEP_* contained a conversion type of the form, "foo.bar", the dependency on CONVERSION_DEPENDS_bar would not get added to the task depends for do_rootfs. [YOCTO #10883] (From OE-Core rev: c0ff0e1ff872b04006b26c6db4f8c9cf053b0764) Signed-off-by: Randy Witt Signed-off-by: Ross Burton (cherry picked from commit 037d39898e0e16c6d5b24a8d3844abfb328d3c14) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/image_types.bbclass | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 1ce8334e3a..5020a5a9d4 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -17,17 +17,25 @@ def imagetypes_getdepends(d): d += ":do_populate_sysroot" deps.add(d) + # Take a type in the form of foo.bar.car and split it into the items + # needed for the image deps "foo", and the conversion deps ["bar", "car"] + def split_types(typestring): + types = typestring.split(".") + return types[0], types[1:] + fstypes = set((d.getVar('IMAGE_FSTYPES', True) or "").split()) fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS', True) or "").split()) deps = set() for typestring in fstypes: - types = typestring.split(".") - basetype, resttypes = types[0], types[1:] - + basetype, resttypes = split_types(typestring) adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype, True) , deps) + for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype, True) or "").split(): + base, rest = split_types(typedepends) + resttypes += rest adddep(d.getVar('IMAGE_DEPENDS_%s' % typedepends, True) , deps) + for ctype in resttypes: adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype, True), deps) adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype, True), deps) From 99c6c878ee122a04f23ef49ea653208ca1c7aa77 Mon Sep 17 00:00:00 2001 From: Andre McCurdy Date: Tue, 21 Feb 2017 10:04:50 -0800 Subject: [PATCH 027/129] image_types.bbclass: fix image dependency chain collection If image type "foo" depends on image type "bar.xz", then dependencies should be collected from the base image type (ie "IMAGE_DEPENDS_bar") not from "IMAGE_DEPENDS_bar.xz". (From OE-Core rev: 854fff614059100494326adeec7c48fa5272d080) Signed-off-by: Andre McCurdy Signed-off-by: Richard Purdie (cherry picked from commit 8a9f249a9166347cc0468191ce130003e3d306e1) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/image_types.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 5020a5a9d4..3bfa60ba26 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -33,8 +33,8 @@ def imagetypes_getdepends(d): for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype, True) or "").split(): base, rest = split_types(typedepends) + adddep(d.getVar('IMAGE_DEPENDS_%s' % base, True) , deps) resttypes += rest - adddep(d.getVar('IMAGE_DEPENDS_%s' % typedepends, True) , deps) for ctype in resttypes: adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype, True), deps) From 7549ae82cdafdebc587cbfd21ac4a96f47903398 Mon Sep 17 00:00:00 2001 From: Juro Bystricky Date: Wed, 15 Mar 2017 12:39:12 -0700 Subject: [PATCH 028/129] sanity.bbclass: modify check for shell Due to the recently implemented update-alternatives for bash binary, sanity checker may end up with a (false-positive) error such as: Error, /bin/sh links to /bin/bash.bash, must be dash or bash This patch modifies the test: presence of "/bash" or "/dash" in shell binary name results in pass. [YOCTO#11108] (From OE-Core rev: 3f2bc735e514b27a21ac47524fe0c5ca16e19dd7) Signed-off-by: Juro Bystricky Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/sanity.bbclass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index 7682ffbb8c..a11b581a08 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass @@ -929,7 +929,9 @@ def check_sanity_everybuild(status, d): # If /bin/sh is a symlink, check that it points to dash or bash if os.path.islink('/bin/sh'): real_sh = os.path.realpath('/bin/sh') - if not real_sh.endswith('/dash') and not real_sh.endswith('/bash'): + # Due to update-alternatives, the shell name may take various + # forms, such as /bin/dash, bin/bash, /bin/bash.bash ... + if '/dash' not in real_sh and '/bash' not in real_sh: status.addresult("Error, /bin/sh links to %s, must be dash or bash\n" % real_sh) def check_sanity(sanity_data): From 8a2eb1a75e3fe0020f50e348d4a2c7d49fd5f276 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Wed, 23 Nov 2016 00:00:18 -0800 Subject: [PATCH 029/129] runqemu-export-rootfs: fix inconsistent var names Fixed: $ runqemu nfs qemux86-64 [snip] On your target please remember to add the following options for NFS nfsroot=IP_ADDRESS:/path/to/nfsroot,nfsvers=3,port=,mountprog=,nfsprog=,udp,mountport= [snip] Note that the values are null, this is because their var names are inconsistent. [YOCTO #10519] (From OE-Core rev: b572921b359010f281cdb861a73bf05317c6dacf) Signed-off-by: Robert Yang Signed-off-by: Ross Burton Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/runqemu-export-rootfs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs index 3dee131166..0dd3eba8b6 100755 --- a/scripts/runqemu-export-rootfs +++ b/scripts/runqemu-export-rootfs @@ -78,23 +78,17 @@ if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then fi # rpc.mountd RPC port -NFS_MOUNTPROG=$[ 21111 + $NFS_INSTANCE ] +MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ] # rpc.nfsd RPC port -NFS_NFSPROG=$[ 11111 + $NFS_INSTANCE ] -# NFS port number -NFS_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] +NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] +# NFS server port number +NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] # mountd port number -MOUNT_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] +MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] ## For debugging you would additionally add ## --debug all -UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFS_NFSPROG -n $NFS_PORT -y $NFS_MOUNTPROG -m $MOUNT_PORT" - -# Setup the exports file -if [ "$1" = "start" ]; then - echo "Creating exports file..." - echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS -fi +UNFSD_OPTS="-p -N -i $NFSPID -e $EXPORTS -x $NFSD_RPCPORT -n $NFSD_PORT -y $MOUNTD_RPCPORT -m $MOUNTD_PORT" # See how we were called. case "$1" in @@ -114,6 +108,9 @@ case "$1" in exit 1 fi + echo "Creating exports file..." + echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS + echo "Starting User Mode nfsd" echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS" $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS From 3305872894552d7d1d486ca4441b1a7c5a39bf6e Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Wed, 23 Nov 2016 00:57:39 -0800 Subject: [PATCH 030/129] runqemu: support multiple qemus running when nfs Fixed: * In build1: $ runqemu nfs qemux86-64 In build2: $ runqemu nfs qemux86-64 It would fail before since the port numerbs and conf files are conflicted, now make runqemu-export-rootfs work together with runqemu to fix the problem. * And we don't need export PSEUDO_LOCALSTATEDIR in runqemu, the runqemu-export-rootfs can handle it well based on NFS_EXPORT_DIR. * Remove "async" option from unfsd to fix warning in syslog: Warning: unknown exports option `async' ignored * Fixed typos Both slirp and tap can work. (From OE-Core rev: f3a9ff2cea88cf4c90b1037b3ca17e6a63ea33ee) Signed-off-by: Robert Yang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/runqemu | 57 +++++++++++++++++++++++------------ scripts/runqemu-export-rootfs | 10 +++--- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/scripts/runqemu b/scripts/runqemu index dbe17abfc5..1df6875111 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -676,17 +676,35 @@ class BaseConfig(object): else: self.nfs_server = '192.168.7.1' - nfs_instance = int(self.nfs_instance) - - mountd_rpcport = 21111 + nfs_instance - nfsd_rpcport = 11111 + nfs_instance - nfsd_port = 3049 + 2 * nfs_instance - mountd_port = 3048 + 2 * nfs_instance - unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s" % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port) - self.unfs_opts = unfs_opts + # Figure out a new nfs_instance to allow multiple qemus running. + # CentOS 7.1's ps doesn't print full command line without "ww" + # when invoke by subprocess.Popen(). + cmd = "ps auxww" + ps = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8') + pattern = '/bin/unfsd .* -i .*\.pid -e .*/exports([0-9]+) ' + all_instances = re.findall(pattern, ps, re.M) + if all_instances: + all_instances.sort(key=int) + self.nfs_instance = int(all_instances.pop()) + 1 + + mountd_rpcport = 21111 + self.nfs_instance + nfsd_rpcport = 11111 + self.nfs_instance + nfsd_port = 3049 + 2 * self.nfs_instance + mountd_port = 3048 + 2 * self.nfs_instance + + # Export vars for runqemu-export-rootfs + export_dict = { + 'NFS_INSTANCE': self.nfs_instance, + 'MOUNTD_RPCPORT': mountd_rpcport, + 'NFSD_RPCPORT': nfsd_rpcport, + 'NFSD_PORT': nfsd_port, + 'MOUNTD_PORT': mountd_port, + } + for k, v in export_dict.items(): + # Use '%s' since they are integers + os.putenv(k, '%s' % v) - p = '%s/.runqemu-sdk/pseudo' % os.getenv('HOME') - os.putenv('PSEUDO_LOCALSTATEDIR', p) + self.unfs_opts="nfsvers=3,port=%s,mountprog=%s,nfsprog=%s,udp,mountport=%s" % (nfsd_port, mountd_rpcport, nfsd_rpcport, mountd_port) # Extract .tar.bz2 or .tar.bz if no self.nfs_dir if not self.nfs_dir: @@ -714,7 +732,7 @@ class BaseConfig(object): self.nfs_dir = dest # Start the userspace NFS server - cmd = 'runqemu-export-rootfs restart %s' % self.nfs_dir + cmd = 'runqemu-export-rootfs start %s' % self.nfs_dir logger.info('Running %s...' % cmd) if subprocess.call(cmd, shell=True) != 0: raise Exception('Failed to run %s' % cmd) @@ -723,6 +741,8 @@ class BaseConfig(object): def setup_slirp(self): + """Setup user networking""" + if self.fstype == 'nfs': self.setup_nfs() self.kernel_cmdline_script += ' ip=dhcp' @@ -790,14 +810,13 @@ class BaseConfig(object): logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.") return 1 self.tap = tap - n0 = tap[3:] - n1 = int(n0) * 2 + 1 - n2 = n1 + 1 - self.nfs_instance = n0 + tapnum = int(tap[3:]) + gateway = tapnum * 2 + 1 + client = gateway + 1 if self.fstype == 'nfs': self.setup_nfs() - self.kernel_cmdline_script += " ip=192.168.7.%s::192.168.7.%s:255.255.255.0" % (n2, n1) - mac = "52:54:00:12:34:%02x" % n2 + self.kernel_cmdline_script += " ip=192.168.7.%s::192.168.7.%s:255.255.255.0" % (client, gateway) + mac = "52:54:00:12:34:%02x" % client qb_tap_opt = self.get('QB_TAP_OPT') if qb_tap_opt: qemu_tap_opt = qb_tap_opt.replace('@TAP@', tap).replace('@MAC@', mac) @@ -840,11 +859,11 @@ class BaseConfig(object): vm_drive = '-drive if=none,id=hd,file=%s,format=%s -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd' \ % (self.rootfs, rootfs_format) elif subprocess.call(cmd2, shell=True) == 0: - logger.info('Using scsi drive') + logger.info('Using ide drive') vm_drive = "%s,format=%s" % (self.rootfs, rootfs_format) else: logger.warn("Can't detect drive type %s" % self.rootfs) - logger.warn('Tring to use virtio block drive') + logger.warn('Trying to use virtio block drive') vm_drive = '-drive if=virtio,file=%s,format=%s' % (self.rootfs, rootfs_format) self.rootfs_options = '%s -no-reboot' % vm_drive self.kernel_cmdline = 'root=%s rw highres=off' % (self.get('QB_KERNEL_ROOT')) diff --git a/scripts/runqemu-export-rootfs b/scripts/runqemu-export-rootfs index 0dd3eba8b6..7ebc07194d 100755 --- a/scripts/runqemu-export-rootfs +++ b/scripts/runqemu-export-rootfs @@ -78,13 +78,13 @@ if [ ! -d "$PSEUDO_LOCALSTATEDIR" ]; then fi # rpc.mountd RPC port -MOUNTD_RPCPORT=$[ 21111 + $NFS_INSTANCE ] +MOUNTD_RPCPORT=${MOUNTD_RPCPORT:=$[ 21111 + $NFS_INSTANCE ]} # rpc.nfsd RPC port -NFSD_RPCPORT=$[ 11111 + $NFS_INSTANCE ] +NFSD_RPCPORT=${NFSD_RPCPORT:=$[ 11111 + $NFS_INSTANCE ]} # NFS server port number -NFSD_PORT=$[ 3049 + 2 * $NFS_INSTANCE ] +NFSD_PORT=${NFSD_PORT:=$[ 3049 + 2 * $NFS_INSTANCE ]} # mountd port number -MOUNTD_PORT=$[ 3048 + 2 * $NFS_INSTANCE ] +MOUNTD_PORT=${MOUNTD_PORT:=$[ 3048 + 2 * $NFS_INSTANCE ]} ## For debugging you would additionally add ## --debug all @@ -109,7 +109,7 @@ case "$1" in fi echo "Creating exports file..." - echo "$NFS_EXPORT_DIR (rw,async,no_root_squash,no_all_squash,insecure)" > $EXPORTS + echo "$NFS_EXPORT_DIR (rw,no_root_squash,no_all_squash,insecure)" > $EXPORTS echo "Starting User Mode nfsd" echo " $PSEUDO $PSEUDO_OPTS $OECORE_NATIVE_SYSROOT/usr/bin/unfsd $UNFSD_OPTS" From 53b19e7e7fa44b7d04fced41e409282b39705b1b Mon Sep 17 00:00:00 2001 From: Anders Darander Date: Mon, 13 Feb 2017 16:06:56 -0600 Subject: [PATCH 031/129] python-3-manifest: fix adding imp to importlib Commit: 512334f102a33833d39af53467894315f0715d07 "python-3.5-manifest: Add imp to importlib" added imp to importlib in the generated manifest, but not in the generator script. (From OE-Core rev: 70bea8d0be82781ce615794434225418cce63a90) Signed-off-by: Anders Darander Signed-off-by: Ross Burton Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/contrib/python/generate-manifest-3.5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/contrib/python/generate-manifest-3.5.py b/scripts/contrib/python/generate-manifest-3.5.py index 2906cc66d0..71a71f7afc 100755 --- a/scripts/contrib/python/generate-manifest-3.5.py +++ b/scripts/contrib/python/generate-manifest-3.5.py @@ -269,7 +269,7 @@ def make( self ): "formatter.* htmlentitydefs.* htmllib.* markupbase.* sgmllib.* HTMLParser.* " ) m.addPackage( "${PN}-importlib", "Python import implementation library", "${PN}-core ${PN}-lang", - "importlib" ) + "importlib imp.*" ) m.addPackage( "${PN}-gdbm", "Python GNU database support", "${PN}-core", "lib-dynload/_gdbm.*.so" ) From 46b3cc9d8d9edf74a28207aaf2c399357fc56111 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 23 Mar 2017 13:16:30 +0100 Subject: [PATCH 032/129] package_manager.py: respect OPKGLIBDIR * respect it for incremental rootfs generation * add lists_dir option to opkg.conf * also fix setting info_dir and status_file when they use default value, the problem is that self.opkg_dir is already prefixed with rootfs directory, comparing it with /var/lib/opkg always returned false and the options were appended to config file unnecessary * with opkg 0.3.4 we can use VARDIR prefix added in: commit d2a8e23dc669adc398f4bb8bcfcabfcf925708f7 Author: Florin Gherendi Date: Mon Dec 19 12:25:38 2016 +0200 libopkg: make the /var and /etc directories configurable at compile time. (From OE-Core rev: f1d21d1d408d89cc3bd59cd30ab10c902863c7c0) Signed-off-by: Martin Jansa Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/lib/oe/package_manager.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index a9d216a88e..13577b18bd 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -1673,13 +1673,15 @@ def _create_custom_config(self): self.d.getVar('FEED_DEPLOYDIR_BASE_URI', True), arch)) - if self.opkg_dir != '/var/lib/opkg': + if self.d.getVar('OPKGLIBDIR', True) != '/var/lib': # There is no command line option for this anymore, we need to add # info_dir and status_file to config file, if OPKGLIBDIR doesn't have # the default value of "/var/lib" as defined in opkg: - # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_INFO_DIR "/var/lib/opkg/info" - # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_STATUS_FILE "/var/lib/opkg/status" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_LISTS_DIR VARDIR "/lib/opkg/lists" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_INFO_DIR VARDIR "/lib/opkg/info" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_STATUS_FILE VARDIR "/lib/opkg/status" cfg_file.write("option info_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'info')) + cfg_file.write("option lists_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'lists')) cfg_file.write("option status_file %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'status')) @@ -1698,13 +1700,15 @@ def _create_config(self): config_file.write("src oe-%s file:%s\n" % (arch, pkgs_dir)) - if self.opkg_dir != '/var/lib/opkg': + if self.d.getVar('OPKGLIBDIR', True) != '/var/lib': # There is no command line option for this anymore, we need to add # info_dir and status_file to config file, if OPKGLIBDIR doesn't have # the default value of "/var/lib" as defined in opkg: - # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_INFO_DIR "/var/lib/opkg/info" - # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_STATUS_FILE "/var/lib/opkg/status" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_LISTS_DIR VARDIR "/lib/opkg/lists" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_INFO_DIR VARDIR "/lib/opkg/info" + # libopkg/opkg_conf.h:#define OPKG_CONF_DEFAULT_STATUS_FILE VARDIR "/lib/opkg/status" config_file.write("option info_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'info')) + config_file.write("option lists_dir %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'lists')) config_file.write("option status_file %s\n" % os.path.join(self.d.getVar('OPKGLIBDIR', True), 'opkg', 'status')) def insert_feeds_uris(self): @@ -1860,7 +1864,10 @@ def dummy_install(self, pkgs): # Create an temp dir as opkg root for dummy installation temp_rootfs = self.d.expand('${T}/opkg') - temp_opkg_dir = os.path.join(temp_rootfs, 'var/lib/opkg') + opkg_lib_dir = self.d.getVar('OPKGLIBDIR', True) + if opkg_lib_dir[0] == "/": + opkg_lib_dir = opkg_lib_dir[1:] + temp_opkg_dir = os.path.join(temp_rootfs, opkg_lib_dir, 'opkg') bb.utils.mkdirhier(temp_opkg_dir) opkg_args = "-f %s -o %s " % (self.config_file, temp_rootfs) From a8500d9c75d25a6c2f3de1f0e58c6192debe07b5 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 23 Mar 2017 13:16:29 +0100 Subject: [PATCH 033/129] rootfs.py: Respect OPKGLIBDIR variable * when OPKGLIBDIR doesn't have the default /var/lib value it will silently fail to copy package database from normal rootfs to debugfs rootfs and then when trying to install *-dbg complimentary packages it won't install anything, because installed_pkgs.txt file generated from debugfs is empty (From OE-Core rev: 0554537271f56d95cb43e09bb831f57f82e8f3ac) Signed-off-by: Martin Jansa Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/lib/oe/rootfs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index ed40b23ee4..c4a5086bec 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -949,7 +949,9 @@ def _create(self): if self.progress_reporter: self.progress_reporter.next_stage() - self._setup_dbg_rootfs(['/etc', '/var/lib/opkg', '/usr/lib/ssl']) + opkg_lib_dir = self.d.getVar('OPKGLIBDIR', True) + opkg_dir = os.path.join(opkg_lib_dir, 'opkg') + self._setup_dbg_rootfs(['/etc', opkg_dir, '/usr/lib/ssl']) execute_pre_post_process(self.d, opkg_post_process_cmds) From e9c681777b394b9eaa3c6cb572bfa1ca4b501d6e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Mon, 20 Mar 2017 13:38:20 -0400 Subject: [PATCH 034/129] sstate.bbclass: update .siginfo atime .siginfo files are not being accessed from local or NFS-mounted sstate mirrors when sstate package is installed, so their atime is not updated. If sstate mirror is cleaned based on access time, they get deleted, even though they are still being used. Updated atime of .siginfo symlinks with 'touch -a'. This command dereferences symlinks pointing to the local mirror and updates atime of the .siginfo file on the mirror. [YOCTO #10857] (From OE-Core rev: 9f8013e3339533c7d60139c1993a5d077fe02ee5) Signed-off-by: Ed Bartosh Signed-off-by: Ross Burton Signed-off-by: Denys Dmytriyenko Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/sstate.bbclass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 8643f3d247..4fdfcc83ec 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass @@ -724,6 +724,8 @@ python sstate_sign_package () { # sstate_unpack_package () { tar -xvzf ${SSTATE_PKG} + # update .siginfo atime on local/NFS mirror + [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo # Use "! -w ||" to return true for read only files [ ! -w ${SSTATE_PKG} ] || touch --no-dereference ${SSTATE_PKG} [ ! -w ${SSTATE_PKG}.sig ] || [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig From be54ac0ebdb6aac23d05fb806580a0ceb7e191dd Mon Sep 17 00:00:00 2001 From: "Sullivan, California L" Date: Mon, 27 Mar 2017 14:33:37 -0700 Subject: [PATCH 035/129] parselogs: Whitelist NUC6 firmware load error message on genericx86-64 This was already whitelisted, but the 4.8 kernel changed the error message, causing it to get caught by parselogs again. Fixes [YOCTO #10494]. (From OE-Core rev: a163060c25615fd29cdc477319f83997e65d0846) Signed-off-by: California Sullivan Signed-off-by: Ross Burton (cherry picked from commit e1bad14231115f3b1a2bf844ef5b2022c648b55d) Signed-off-by: California Sullivan Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/lib/oeqa/runtime/parselogs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/lib/oeqa/runtime/parselogs.py b/meta/lib/oeqa/runtime/parselogs.py index e79c39a8f1..aa5008bba9 100644 --- a/meta/lib/oeqa/runtime/parselogs.py +++ b/meta/lib/oeqa/runtime/parselogs.py @@ -142,6 +142,7 @@ 'Failed to load firmware i915', 'Failed to fetch GuC', 'Failed to initialize GuC', + 'Failed to load DMC firmware', 'The driver is built-in, so to load the firmware you need to', ] + x86_common, 'edgerouter' : [ From 017b38fc783125a251004ffb14d1e7264b486a71 Mon Sep 17 00:00:00 2001 From: Joe Slater Date: Thu, 30 Mar 2017 14:16:08 -0700 Subject: [PATCH 036/129] volatile-binds: correct some errors reported by systemd systemd-tmpfiles-setup will fail at boot, so we suppress the default versions of etc.conf and home.conf. We also make sure that /var/{cache,spool} and /srv are writeable if they exist. (From OE-Core rev: a7c6129a7c9c0c7e1b729e16a60b2ca704af3f97) Signed-off-by: Joe Slater Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-core/volatile-binds/volatile-binds.bb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meta/recipes-core/volatile-binds/volatile-binds.bb b/meta/recipes-core/volatile-binds/volatile-binds.bb index fee7275e32..130ab55f05 100644 --- a/meta/recipes-core/volatile-binds/volatile-binds.bb +++ b/meta/recipes-core/volatile-binds/volatile-binds.bb @@ -17,6 +17,9 @@ REQUIRED_DISTRO_FEATURES = "systemd" VOLATILE_BINDS ?= "\ /var/volatile/lib /var/lib\n\ + /var/volatile/cache /var/cache\n\ + /var/volatile/spool /var/spool\n\ + /var/volatile/srv /srv\n\ " VOLATILE_BINDS[type] = "list" VOLATILE_BINDS[separator] = "\n" @@ -67,5 +70,11 @@ do_install () { for service in ${SYSTEMD_SERVICE_volatile-binds}; do install -m 0644 $service ${D}${systemd_unitdir}/system/ done + + # Suppress attempts to process some tmpfiles that are not temporary. + # + install -d ${D}${sysconfdir}/tmpfiles.d ${D}/var/cache + ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/etc.conf + ln -s /dev/null ${D}${sysconfdir}/tmpfiles.d/home.conf } do_install[dirs] = "${WORKDIR}" From 7391de7bf6bc96c6f21f4a23e7e2de421d2627dc Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Tue, 18 Apr 2017 19:57:05 +0000 Subject: [PATCH 037/129] logrotate: replace fedorahosted.org SRC_URI with github.com source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to github.com. Update the ${PN} to ${BPN} in order to pass the autobuilder mulitlib enable configuration. [YOCTO #11226] (From OE-Core rev: b935c1e9dd17afa85a9ffe213d5f94051f585529) Signed-off-by: Choong YinThong Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../logrotate/logrotate_3.9.1.bb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb index 5f1a601aeb..5bd338117e 100644 --- a/meta/recipes-extended/logrotate/logrotate_3.9.1.bb +++ b/meta/recipes-extended/logrotate/logrotate_3.9.1.bb @@ -1,6 +1,6 @@ SUMMARY = "Rotates, compresses, removes and mails system log files" SECTION = "console/utils" -HOMEPAGE = "https://fedorahosted.org/logrotate/" +HOMEPAGE = "https://github.com/logrotate/logrotate/issues" LICENSE = "GPLv2" # TODO: logrotate 3.8.8 adds autotools/automake support, update recipe to use it. @@ -10,14 +10,23 @@ DEPENDS="coreutils popt" LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760" -SRC_URI = "https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz \ +# When updating logrotate to latest upstream, SRC_URI should point to +# a proper release tarball from https://github.com/logrotate/logrotate/releases +# and we have to take the snapshot for now because there is no such +# tarball available for 3.9.1. + +S = "${WORKDIR}/${BPN}-r3-9-1" + +UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases" + +SRC_URI = "https://github.com/${BPN}/${BPN}/archive/r3-9-1.tar.gz \ file://act-as-mv-when-rotate.patch \ file://update-the-manual.patch \ file://disable-check-different-filesystems.patch \ " -SRC_URI[md5sum] = "4492b145b6d542e4a2f41e77fa199ab0" -SRC_URI[sha256sum] = "022769e3288c80981559a8421703c88e8438b447235e36dd3c8e97cd94c52545" +SRC_URI[md5sum] = "8572b7c2cf9ade09a8a8e10098500fb3" +SRC_URI[sha256sum] = "5bf8e478c428e7744fefa465118f8296e7e771c981fb6dffb7527856a0ea3617" PACKAGECONFIG ?= "\ ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ From 5476c5d9d8fc278faeff2fd8a33cf5582636a943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=ADaz?= Date: Fri, 7 Apr 2017 16:33:45 -0500 Subject: [PATCH 038/129] base-files: resize only serial tty's in profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Backported from master.] We don't want to run resize on non serial consoles. There's been an earlier attempt (6557787), so this builds upon that. The problem we're seeing is that if there is text buffered in the virtual console (like from a desperate user trying to enter login details), resize will get stuck while calling ioctl(tty, TCSETAW); Since serial consoles are named (not just numbered), this change limits resize's reach even further to run only on /dev/tty[A-z] (thus avoiding /dev/tty[0-9]). (From OE-Core rev: 00ff70dc6284a510e4fe3acfaae6b59663fd3141) Signed-off-by: Daniel Díaz Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-core/base-files/base-files/profile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/base-files/base-files/profile b/meta/recipes-core/base-files/base-files/profile index 7367fd1e29..c616616cee 100644 --- a/meta/recipes-core/base-files/base-files/profile +++ b/meta/recipes-core/base-files/base-files/profile @@ -26,7 +26,7 @@ if [ -x /usr/bin/resize ] && termpath="`tty`"; then # Make sure we are on a serial console (i.e. the device used starts with /dev/tty), # otherwise we confuse e.g. the eclipse launcher which tries do use ssh case "$termpath" in - /dev/tty*) resize >/dev/null + /dev/tty[A-z]*) resize >/dev/null esac fi From 1693b28967b35044e818f0b23627b5778a58045c Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Mon, 10 Apr 2017 18:58:34 -0700 Subject: [PATCH 039/129] binutils: Fix CVE-2017-6965 and CVE-2017-6966 Backport upstream commit to address vulnerabilities: CVE: CVE-2017-6965 [BZ 21137] -- https://sourceware.org/bugzilla/show_bug.cgi?id=21137 Fix readelf writing to illegal addresses whilst processing corrupt input files containing symbol-difference relocations. PR binutils/21137 * readelf.c (target_specific_reloc_handling): Add end parameter. Check for buffer overflow before writing relocated values. (apply_relocations): Pass end to target_specific_reloc_handling. CVE: CVE-2017-6966 [BZ 21139] -- https://sourceware.org/bugzilla/show_bug.cgi?id=21139 Fix read-after-free error in readelf when processing multiple, relocated sections in an MSP430 binary. PR binutils/21139 * readelf.c (target_specific_reloc_handling): Add num_syms parameter. Check for symbol table overflow before accessing symbol value. If reloc pointer is NULL, discard all saved state. (apply_relocations): Pass num_syms to target_specific_reloc_handling. Call target_specific_reloc_handling with a NULL reloc pointer after processing all of the relocs. (From OE-Core rev: 477afc5634698d6c5cdb6d7705a31d859495695d) Signed-off-by: Yuanjie Huang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../binutils/binutils-2.27.inc | 2 + .../binutils/binutils/CVE-2017-6965.patch | 127 +++++++++ .../binutils/binutils/CVE-2017-6966.patch | 240 ++++++++++++++++++ 3 files changed, 369 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-6965.patch create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-6966.patch diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index a7cdb6f1d4..f98fef9e02 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -39,6 +39,8 @@ SRC_URI = "\ file://0016-Fix-seg-fault-in-ARM-linker-when-trying-to-parse-a-b.patch \ file://0017-Fix-the-generation-of-alignment-frags-in-code-sectio.patch \ file://0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch \ + file://CVE-2017-6965.patch \ + file://CVE-2017-6966.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6965.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6965.patch new file mode 100644 index 0000000000..85f7f98fe0 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6965.patch @@ -0,0 +1,127 @@ +From 6f898c17b1d6f6a29a05ca6de31f0fc8f52cfbfe Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 13 Feb 2017 13:08:32 +0000 +Subject: [PATCH 1/2] Fix readelf writing to illegal addresses whilst + processing corrupt input files containing symbol-difference relocations. + + PR binutils/21137 + * readelf.c (target_specific_reloc_handling): Add end parameter. + Check for buffer overflow before writing relocated values. + (apply_relocations): Pass end to target_specific_reloc_handling. + +(cherry pick from commit 03f7786e2f440b9892b1c34a58fb26222ce1b493) +Upstream-Status: Backport [master] +CVE: CVE-2017-6965 + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 7 +++++++ + binutils/readelf.c | 30 +++++++++++++++++++++++++----- + 2 files changed, 32 insertions(+), 5 deletions(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index 995de87dc3..154b797a29 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -5,6 +5,13 @@ + Check for buffer overflow before writing relocated values. + (apply_relocations): Pass end to target_specific_reloc_handling. + ++2017-02-13 Nick Clifton ++ ++ PR binutils/21137 ++ * readelf.c (target_specific_reloc_handling): Add end parameter. ++ Check for buffer overflow before writing relocated values. ++ (apply_relocations): Pass end to target_specific_reloc_handling. ++ + 2016-08-03 Tristan Gingold + + * configure: Regenerate. +diff --git a/binutils/readelf.c b/binutils/readelf.c +index d31558c3b4..220671f76f 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -11345,6 +11345,7 @@ process_syminfo (FILE * file ATTRIBUTE_UNUSED) + static bfd_boolean + target_specific_reloc_handling (Elf_Internal_Rela * reloc, + unsigned char * start, ++ unsigned char * end, + Elf_Internal_Sym * symtab) + { + unsigned int reloc_type = get_reloc_type (reloc->r_info); +@@ -11384,13 +11385,19 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + handle_sym_diff: + if (saved_sym != NULL) + { ++ int reloc_size = reloc_type == 1 ? 4 : 2; + bfd_vma value; + + value = reloc->r_addend + + (symtab[get_reloc_symindex (reloc->r_info)].st_value + - saved_sym->st_value); + +- byte_put (start + reloc->r_offset, value, reloc_type == 1 ? 4 : 2); ++ if (start + reloc->r_offset + reloc_size >= end) ++ /* PR 21137 */ ++ error (_("MSP430 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + reloc_size, end); ++ else ++ byte_put (start + reloc->r_offset, value, reloc_size); + + saved_sym = NULL; + return TRUE; +@@ -11421,13 +11428,18 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + case 2: /* R_MN10300_16 */ + if (saved_sym != NULL) + { ++ int reloc_size = reloc_type == 1 ? 4 : 2; + bfd_vma value; + + value = reloc->r_addend + + (symtab[get_reloc_symindex (reloc->r_info)].st_value + - saved_sym->st_value); + +- byte_put (start + reloc->r_offset, value, reloc_type == 1 ? 4 : 2); ++ if (start + reloc->r_offset + reloc_size >= end) ++ error (_("MN10300 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + reloc_size, end); ++ else ++ byte_put (start + reloc->r_offset, value, reloc_size); + + saved_sym = NULL; + return TRUE; +@@ -11462,12 +11474,20 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + break; + + case 0x41: /* R_RL78_ABS32. */ +- byte_put (start + reloc->r_offset, value, 4); ++ if (start + reloc->r_offset + 4 >= end) ++ error (_("RL78 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + 2, end); ++ else ++ byte_put (start + reloc->r_offset, value, 4); + value = 0; + return TRUE; + + case 0x43: /* R_RL78_ABS16. */ +- byte_put (start + reloc->r_offset, value, 2); ++ if (start + reloc->r_offset + 2 >= end) ++ error (_("RL78 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + 2, end); ++ else ++ byte_put (start + reloc->r_offset, value, 2); + value = 0; + return TRUE; + +@@ -12074,7 +12094,7 @@ apply_relocations (void * file, + + reloc_type = get_reloc_type (rp->r_info); + +- if (target_specific_reloc_handling (rp, start, symtab)) ++ if (target_specific_reloc_handling (rp, start, end, symtab)) + continue; + else if (is_none_reloc (reloc_type)) + continue; +-- +2.11.0 + diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6966.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6966.patch new file mode 100644 index 0000000000..5e364ef69c --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6966.patch @@ -0,0 +1,240 @@ +From 310e2cdc0a46ef62602097f5c21c393571e76df4 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 13 Feb 2017 14:03:22 +0000 +Subject: [PATCH 2/2] Fix read-after-free error in readelf when processing + multiple, relocated sections in an MSP430 binary. + + PR binutils/21139 + * readelf.c (target_specific_reloc_handling): Add num_syms + parameter. Check for symbol table overflow before accessing + symbol value. If reloc pointer is NULL, discard all saved state. + (apply_relocations): Pass num_syms to target_specific_reloc_handling. + Call target_specific_reloc_handling with a NULL reloc pointer + after processing all of the relocs. + +(cherry pick from commit f84ce13b6708801ca1d6289b7c4003e2f5a6d7f9) +Upstream-Status: Backport [master] +CVE: CVE-2017-6966 + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 10 +++++ + binutils/readelf.c | 109 +++++++++++++++++++++++++++++++++++++++++------------ + 2 files changed, 94 insertions(+), 25 deletions(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index 154b797a29..aef0a51f19 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,5 +1,15 @@ + 2017-02-13 Nick Clifton + ++ PR binutils/21139 ++ * readelf.c (target_specific_reloc_handling): Add num_syms ++ parameter. Check for symbol table overflow before accessing ++ symbol value. If reloc pointer is NULL, discard all saved state. ++ (apply_relocations): Pass num_syms to target_specific_reloc_handling. ++ Call target_specific_reloc_handling with a NULL reloc pointer ++ after processing all of the relocs. ++ ++2017-02-13 Nick Clifton ++ + PR binutils/21137 + * readelf.c (target_specific_reloc_handling): Add end parameter. + Check for buffer overflow before writing relocated values. +diff --git a/binutils/readelf.c b/binutils/readelf.c +index 220671f76f..2b6cef1638 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -11340,15 +11340,27 @@ process_syminfo (FILE * file ATTRIBUTE_UNUSED) + + /* Check to see if the given reloc needs to be handled in a target specific + manner. If so then process the reloc and return TRUE otherwise return +- FALSE. */ ++ FALSE. ++ ++ If called with reloc == NULL, then this is a signal that reloc processing ++ for the current section has finished, and any saved state should be ++ discarded. */ + + static bfd_boolean + target_specific_reloc_handling (Elf_Internal_Rela * reloc, + unsigned char * start, + unsigned char * end, +- Elf_Internal_Sym * symtab) ++ Elf_Internal_Sym * symtab, ++ unsigned long num_syms) + { +- unsigned int reloc_type = get_reloc_type (reloc->r_info); ++ unsigned int reloc_type = 0; ++ unsigned long sym_index = 0; ++ ++ if (reloc) ++ { ++ reloc_type = get_reloc_type (reloc->r_info); ++ sym_index = get_reloc_symindex (reloc->r_info); ++ } + + switch (elf_header.e_machine) + { +@@ -11357,13 +11369,24 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + { + static Elf_Internal_Sym * saved_sym = NULL; + ++ if (reloc == NULL) ++ { ++ saved_sym = NULL; ++ return TRUE; ++ } ++ + switch (reloc_type) + { + case 10: /* R_MSP430_SYM_DIFF */ + if (uses_msp430x_relocs ()) + break; + case 21: /* R_MSP430X_SYM_DIFF */ +- saved_sym = symtab + get_reloc_symindex (reloc->r_info); ++ /* PR 21139. */ ++ if (sym_index >= num_syms) ++ error (_("MSP430 SYM_DIFF reloc contains invalid symbol index %lu\n"), ++ sym_index); ++ else ++ saved_sym = symtab + sym_index; + return TRUE; + + case 1: /* R_MSP430_32 or R_MSP430_ABS32 */ +@@ -11388,16 +11411,21 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + int reloc_size = reloc_type == 1 ? 4 : 2; + bfd_vma value; + +- value = reloc->r_addend +- + (symtab[get_reloc_symindex (reloc->r_info)].st_value +- - saved_sym->st_value); +- +- if (start + reloc->r_offset + reloc_size >= end) +- /* PR 21137 */ +- error (_("MSP430 sym diff reloc writes past end of section (%p vs %p)\n"), +- start + reloc->r_offset + reloc_size, end); ++ if (sym_index >= num_syms) ++ error (_("MSP430 reloc contains invalid symbol index %lu\n"), ++ sym_index); + else +- byte_put (start + reloc->r_offset, value, reloc_size); ++ { ++ value = reloc->r_addend + (symtab[sym_index].st_value ++ - saved_sym->st_value); ++ ++ if (start + reloc->r_offset + reloc_size >= end) ++ /* PR 21137 */ ++ error (_("MSP430 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + reloc_size, end); ++ else ++ byte_put (start + reloc->r_offset, value, reloc_size); ++ } + + saved_sym = NULL; + return TRUE; +@@ -11417,13 +11445,24 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + { + static Elf_Internal_Sym * saved_sym = NULL; + ++ if (reloc == NULL) ++ { ++ saved_sym = NULL; ++ return TRUE; ++ } ++ + switch (reloc_type) + { + case 34: /* R_MN10300_ALIGN */ + return TRUE; + case 33: /* R_MN10300_SYM_DIFF */ +- saved_sym = symtab + get_reloc_symindex (reloc->r_info); ++ if (sym_index >= num_syms) ++ error (_("MN10300_SYM_DIFF reloc contains invalid symbol index %lu\n"), ++ sym_index); ++ else ++ saved_sym = symtab + sym_index; + return TRUE; ++ + case 1: /* R_MN10300_32 */ + case 2: /* R_MN10300_16 */ + if (saved_sym != NULL) +@@ -11431,15 +11470,20 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + int reloc_size = reloc_type == 1 ? 4 : 2; + bfd_vma value; + +- value = reloc->r_addend +- + (symtab[get_reloc_symindex (reloc->r_info)].st_value +- - saved_sym->st_value); +- +- if (start + reloc->r_offset + reloc_size >= end) +- error (_("MN10300 sym diff reloc writes past end of section (%p vs %p)\n"), +- start + reloc->r_offset + reloc_size, end); ++ if (sym_index >= num_syms) ++ error (_("MN10300 reloc contains invalid symbol index %lu\n"), ++ sym_index); + else +- byte_put (start + reloc->r_offset, value, reloc_size); ++ { ++ value = reloc->r_addend + (symtab[sym_index].st_value ++ - saved_sym->st_value); ++ ++ if (start + reloc->r_offset + reloc_size >= end) ++ error (_("MN10300 sym diff reloc writes past end of section (%p vs %p)\n"), ++ start + reloc->r_offset + reloc_size, end); ++ else ++ byte_put (start + reloc->r_offset, value, reloc_size); ++ } + + saved_sym = NULL; + return TRUE; +@@ -11459,12 +11503,24 @@ target_specific_reloc_handling (Elf_Internal_Rela * reloc, + static bfd_vma saved_sym2 = 0; + static bfd_vma value; + ++ if (reloc == NULL) ++ { ++ saved_sym1 = saved_sym2 = 0; ++ return TRUE; ++ } ++ + switch (reloc_type) + { + case 0x80: /* R_RL78_SYM. */ + saved_sym1 = saved_sym2; +- saved_sym2 = symtab[get_reloc_symindex (reloc->r_info)].st_value; +- saved_sym2 += reloc->r_addend; ++ if (sym_index >= num_syms) ++ error (_("RL78_SYM reloc contains invalid symbol index %lu\n"), ++ sym_index); ++ else ++ { ++ saved_sym2 = symtab[sym_index].st_value; ++ saved_sym2 += reloc->r_addend; ++ } + return TRUE; + + case 0x83: /* R_RL78_OPsub. */ +@@ -12094,7 +12150,7 @@ apply_relocations (void * file, + + reloc_type = get_reloc_type (rp->r_info); + +- if (target_specific_reloc_handling (rp, start, end, symtab)) ++ if (target_specific_reloc_handling (rp, start, end, symtab, num_syms)) + continue; + else if (is_none_reloc (reloc_type)) + continue; +@@ -12190,6 +12246,9 @@ apply_relocations (void * file, + } + + free (symtab); ++ /* Let the target specific reloc processing code know that ++ we have finished with these relocs. */ ++ target_specific_reloc_handling (NULL, NULL, NULL, NULL, 0); + + if (relocs_return) + { +-- +2.11.0 + From 27258d249ef6c87771c47c4498ed32c1bdfe8cc6 Mon Sep 17 00:00:00 2001 From: Lukasz Nowak Date: Tue, 13 Dec 2016 16:19:28 +0000 Subject: [PATCH 040/129] busybox: allow libiproute to handle table ids larger than 255 These changes are required for compatibility with ConnMan, which by default uses table ids greater than 255. (From OE-Core rev: 8ab20681730a3cbd75ed0c7c208a30b437714915) Signed-off-by: Lukasz Nowak Signed-off-by: Ross Burton (cherry picked from commit e9114bdd8a83b88f59526780910c49e3092fdd57) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...ute-handle-table-ids-larger-than-255.patch | 134 ++++++++++++++++++ meta/recipes-core/busybox/busybox_1.24.1.bb | 1 + 2 files changed, 135 insertions(+) create mode 100644 meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch diff --git a/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch b/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch new file mode 100644 index 0000000000..aac5b4029b --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0001-libiproute-handle-table-ids-larger-than-255.patch @@ -0,0 +1,134 @@ +From b5a9234272e6084557224c73ab7737ed47f09848 Mon Sep 17 00:00:00 2001 +From: Lukasz Nowak +Date: Wed, 23 Nov 2016 12:48:21 +0000 +Subject: [PATCH v2] libiproute: handle table ids larger than 255 + +Linux kernel, starting from 2.6.19 allows ip table ids to have 32-bit values. +In order to preserve compatibility, the old 8-bit field: rtm_table is still +in use when table id is lower than 256. + +Add support for the 32-bit table id (RTA_TABLE attribute) in: +- ip route print +- ip route modify +- ip rule print +- ip rule modify + +Add printing of table ids to ip route. + +Changes are compatible with the mainline iproute2 utilities. + +These changes are required for compatibility with ConnMan, which by default +uses table ids greater than 255. + +Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2016-December/084989.html] + +Signed-off-by: Lukasz Nowak +--- + networking/libiproute/iproute.c | 24 ++++++++++++++++++++---- + networking/libiproute/iprule.c | 11 +++++++++-- + 2 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c +index 6ecd5f7..d5af498 100644 +--- a/networking/libiproute/iproute.c ++++ b/networking/libiproute/iproute.c +@@ -87,6 +87,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, + inet_prefix dst; + inet_prefix src; + int host_len = -1; ++ uint32_t tid; + + if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) { + fprintf(stderr, "Not a route: %08x %08x %08x\n", +@@ -99,6 +100,14 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, + if (len < 0) + bb_error_msg_and_die("wrong nlmsg len %d", len); + ++ memset(tb, 0, sizeof(tb)); ++ parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); ++ ++ if (tb[RTA_TABLE]) ++ tid = *(uint32_t *)RTA_DATA(tb[RTA_TABLE]); ++ else ++ tid = r->rtm_table; ++ + if (r->rtm_family == AF_INET6) + host_len = 128; + else if (r->rtm_family == AF_INET) +@@ -128,7 +137,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, + } + } + } else { +- if (G_filter.tb > 0 && G_filter.tb != r->rtm_table) { ++ if (G_filter.tb > 0 && G_filter.tb != tid) { + return 0; + } + } +@@ -157,10 +166,8 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, + return 0; + } + +- memset(tb, 0, sizeof(tb)); + memset(&src, 0, sizeof(src)); + memset(&dst, 0, sizeof(dst)); +- parse_rtattr(tb, RTA_MAX, RTM_RTA(r), len); + + if (tb[RTA_SRC]) { + src.bitlen = r->rtm_src_len; +@@ -283,6 +290,10 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, + if (tb[RTA_OIF]) { + printf("dev %s ", ll_index_to_name(*(int*)RTA_DATA(tb[RTA_OIF]))); + } ++#if ENABLE_FEATURE_IP_RULE ++ if (tid && tid != RT_TABLE_MAIN && !G_filter.tb) ++ printf("table %s ", rtnl_rttable_n2a(tid)); ++#endif + + /* Todo: parse & show "proto kernel", "scope link" here */ + +@@ -434,7 +445,12 @@ IF_FEATURE_IP_RULE(ARG_table,) + NEXT_ARG(); + if (rtnl_rttable_a2n(&tid, *argv)) + invarg(*argv, "table"); +- req.r.rtm_table = tid; ++ if (tid < 256) ++ req.r.rtm_table = tid; ++ else { ++ req.r.rtm_table = RT_TABLE_UNSPEC; ++ addattr32(&req.n, sizeof(req), RTA_TABLE, tid); ++ } + #endif + } else if (arg == ARG_dev || arg == ARG_oif) { + NEXT_ARG(); +diff --git a/networking/libiproute/iprule.c b/networking/libiproute/iprule.c +index 774a3e2..3fac7c5 100644 +--- a/networking/libiproute/iprule.c ++++ b/networking/libiproute/iprule.c +@@ -119,7 +119,9 @@ static int FAST_FUNC print_rule(const struct sockaddr_nl *who UNUSED_PARAM, + printf("iif %s ", (char*)RTA_DATA(tb[RTA_IIF])); + } + +- if (r->rtm_table) ++ if (tb[RTA_TABLE]) ++ printf("lookup %s ", rtnl_rttable_n2a(*(uint32_t*)RTA_DATA(tb[RTA_TABLE]))); ++ else if (r->rtm_table) + printf("lookup %s ", rtnl_rttable_n2a(r->rtm_table)); + + if (tb[RTA_FLOW]) { +@@ -259,7 +261,12 @@ static int iprule_modify(int cmd, char **argv) + NEXT_ARG(); + if (rtnl_rttable_a2n(&tid, *argv)) + invarg(*argv, "table ID"); +- req.r.rtm_table = tid; ++ if (tid < 256) ++ req.r.rtm_table = tid; ++ else { ++ req.r.rtm_table = RT_TABLE_UNSPEC; ++ addattr32(&req.n, sizeof(req), RTA_TABLE, tid); ++ } + table_ok = 1; + } else if (key == ARG_dev || + key == ARG_iif +-- +2.7.4 + diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index df0e131266..c35cba3222 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb @@ -53,6 +53,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://busybox-kbuild-race-fix-commit-d8e61bb.patch \ file://commit-applet_tables-fix-commit-0dddbc1.patch \ file://makefile-libbb-race.patch \ + file://0001-libiproute-handle-table-ids-larger-than-255.patch \ " SRC_URI_append_libc-musl = " file://musl.cfg " From 254336d09ba20d9139bbd0ef5720b43ac52fa671 Mon Sep 17 00:00:00 2001 From: Haiqing Bai Date: Wed, 8 Mar 2017 17:27:30 +0800 Subject: [PATCH 041/129] busybox: ifupdown:pass interface device name for ipv6 route command IPv6 routes need the device argument for link-local routes, or they cannot be used at all. E.g. "gateway fe80::def" seems to be used in some places, but kernel refuses to insert the route unless device name is explicitly specified in the route addition. (From OE-Core rev: 4d9fcf9f2fa573218cda3a133e0da34c4185838a) Signed-off-by: Haiqing Bai Signed-off-by: Ross Burton (cherry picked from commit 96ed437d57316153453bb5e170a4fd4f3a95883d) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...terface-device-name-for-ipv6-route-c.patch | 52 +++++++++++++++++++ meta/recipes-core/busybox/busybox_1.24.1.bb | 1 + 2 files changed, 53 insertions(+) create mode 100644 meta/recipes-core/busybox/busybox-1.24.1/ifupdown-pass-interface-device-name-for-ipv6-route-c.patch diff --git a/meta/recipes-core/busybox/busybox-1.24.1/ifupdown-pass-interface-device-name-for-ipv6-route-c.patch b/meta/recipes-core/busybox/busybox-1.24.1/ifupdown-pass-interface-device-name-for-ipv6-route-c.patch new file mode 100644 index 0000000000..5715378afc --- /dev/null +++ b/meta/recipes-core/busybox/busybox-1.24.1/ifupdown-pass-interface-device-name-for-ipv6-route-c.patch @@ -0,0 +1,52 @@ +From 06fcf98f6ca40dc6b823d7d6231a240a1794ef2d Mon Sep 17 00:00:00 2001 +From: Haiqing Bai +Date: Tue, 28 Feb 2017 10:40:37 +0800 +Subject: [PATCH] ifupdown: pass interface device name for ipv6 route commands +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +commit 028524317d8d0011ed38e86e507a06738a5b5a97 from upstream + +IPv6 routes need the device argument for link-local routes, or they +cannot be used at all. E.g. "gateway fe80::def" seems to be used in +some places, but kernel refuses to insert the route unless device +name is explicitly specified in the route addition. + +Signed-off-by: Timo Teräs +Signed-off-by: Denys Vlasenko + +Upstream-Status: Backport +Signed-off-by: Haiqing Bai +--- + networking/ifupdown.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/networking/ifupdown.c b/networking/ifupdown.c +index 17bc4e9..a00f68d 100644 +--- a/networking/ifupdown.c ++++ b/networking/ifupdown.c +@@ -394,8 +394,8 @@ static int FAST_FUNC static_up6(struct interface_defn_t *ifd, execfn *exec) + # if ENABLE_FEATURE_IFUPDOWN_IP + result = execute("ip addr add %address%/%netmask% dev %iface%[[ label %label%]]", ifd, exec); + result += execute("ip link set[[ mtu %mtu%]][[ addr %hwaddress%]] %iface% up", ifd, exec); +- /* Was: "[[ ip ....%gateway% ]]". Removed extra spaces w/o checking */ +- result += execute("[[ip route add ::/0 via %gateway%]][[ metric %metric%]]", ifd, exec); ++ /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ ++ result += execute("[[ip route add ::/0 via %gateway% dev %iface%]][[ metric %metric%]]", ifd, exec); + # else + result = execute("ifconfig %iface%[[ media %media%]][[ hw %hwaddress%]][[ mtu %mtu%]] up", ifd, exec); + result += execute("ifconfig %iface% add %address%/%netmask%", ifd, exec); +@@ -421,7 +421,8 @@ static int FAST_FUNC v4tunnel_up(struct interface_defn_t *ifd, execfn *exec) + "%endpoint%[[ local %local%]][[ ttl %ttl%]]", ifd, exec); + result += execute("ip link set %iface% up", ifd, exec); + result += execute("ip addr add %address%/%netmask% dev %iface%", ifd, exec); +- result += execute("[[ip route add ::/0 via %gateway%]]", ifd, exec); ++ /* Reportedly, IPv6 needs "dev %iface%", but IPv4 does not: */ ++ result += execute("[[ip route add ::/0 via %gateway% dev %iface%]]", ifd, exec); + return ((result == 4) ? 4 : 0); + } + +-- +1.9.1 + diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index c35cba3222..f6c759584f 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb @@ -54,6 +54,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://commit-applet_tables-fix-commit-0dddbc1.patch \ file://makefile-libbb-race.patch \ file://0001-libiproute-handle-table-ids-larger-than-255.patch \ + file://ifupdown-pass-interface-device-name-for-ipv6-route-c.patch \ " SRC_URI_append_libc-musl = " file://musl.cfg " From 094b64ea8b68c640590242a0fb062e587485a0b6 Mon Sep 17 00:00:00 2001 From: Andrej Valek Date: Thu, 6 Apr 2017 09:07:37 +0200 Subject: [PATCH 042/129] busybox: Security fix CVE-2016-6301 ntpd: NTP server denial of service flaw CVE: CVE-2016-6301 (From OE-Core rev: dafbf8a9e9ed068ecbf22cc816f9a6a3a2da7aa9) Signed-off-by: Andrej Valek Signed-off-by: Pascal Bach Signed-off-by: Richard Purdie (cherry picked from commit 301dc9df16cce1f4649f90af47159bc21be0de59) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../busybox/busybox/CVE-2016-6301.patch | 37 +++++++++++++++++++ meta/recipes-core/busybox/busybox_1.24.1.bb | 1 + 2 files changed, 38 insertions(+) create mode 100644 meta/recipes-core/busybox/busybox/CVE-2016-6301.patch diff --git a/meta/recipes-core/busybox/busybox/CVE-2016-6301.patch b/meta/recipes-core/busybox/busybox/CVE-2016-6301.patch new file mode 100644 index 0000000000..851bc20f79 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/CVE-2016-6301.patch @@ -0,0 +1,37 @@ +busybox1.24.1: Fix CVE-2016-6301 + +[No upstream tracking] -- https://bugzilla.redhat.com/show_bug.cgi?id=1363710 + +ntpd: NTP server denial of service flaw + +The busybox NTP implementation doesn't check the NTP mode of packets +received on the server port and responds to any packet with the right +size. This includes responses from another NTP server. An attacker can +send a packet with a spoofed source address in order to create an +infinite loop of responses between two busybox NTP servers. Adding +more packets to the loop increases the traffic between the servers +until one of them has a fully loaded CPU and/or network. + +Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=150dc7a2b483b8338a3e185c478b4b23ee884e71] +CVE: CVE-2016-6301 +Signed-off-by: Andrej Valek +Signed-off-by: Pascal Bach + +diff --git a/networking/ntpd.c b/networking/ntpd.c +index 9732c9b..0f6a55f 100644 +--- a/networking/ntpd.c ++++ b/networking/ntpd.c +@@ -1985,6 +1985,13 @@ recv_and_process_client_pkt(void /*int fd*/) + goto bail; + } + ++ /* Respond only to client and symmetric active packets */ ++ if ((msg.m_status & MODE_MASK) != MODE_CLIENT ++ && (msg.m_status & MODE_MASK) != MODE_SYM_ACT ++ ) { ++ goto bail; ++ } ++ + query_status = msg.m_status; + query_xmttime = msg.m_xmttime; + diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index f6c759584f..cb4568854c 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb @@ -47,6 +47,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://CVE-2016-2148.patch \ file://CVE-2016-2147.patch \ file://CVE-2016-2147_2.patch \ + file://CVE-2016-6301.patch \ file://ip_fix_problem_on_mips64_n64_big_endian_musl_systems.patch \ file://makefile-fix-backport.patch \ file://0001-sed-fix-sed-n-flushes-pattern-space-terminates-early.patch \ From 2de92f27682ba7986677c917969b6b3036080988 Mon Sep 17 00:00:00 2001 From: Martin Balik Date: Wed, 5 Apr 2017 12:38:57 +0200 Subject: [PATCH 043/129] busybox: Security fix BUG9071 (From OE-Core rev: 3842dc98a471530e23305d09669d7f4bdc05a532) Signed-off-by: Martin Balik Signed-off-by: Pascal Bach Signed-off-by: Richard Purdie (cherry picked from commit 0354a9b7adad27b012bcd6bb6cab54dfe0297bcd) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../busybox/BUG9071_buffer_overflow_arp.patch | 53 +++++++++++++++++++ meta/recipes-core/busybox/busybox_1.24.1.bb | 1 + 2 files changed, 54 insertions(+) create mode 100644 meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch diff --git a/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch b/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch new file mode 100644 index 0000000000..828694cbb9 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/BUG9071_buffer_overflow_arp.patch @@ -0,0 +1,53 @@ +busybox1.24.1: Fix busybox - (local) cmdline stack buffer overwrite + +[No upstream tracking] -- https://bugs.busybox.net/show_bug.cgi?id=9071 + +busybox - (local) cmdline stack buffer overwrite + +Busybox provides an `arp` applet which is missing an array bounds check for +command-line parameter `IFNAME`. It is therefore vulnerable to a command-line +based local stack buffer overwrite effectively allowing local users to write +past a 16 bytes fixed stack buffer. This leads to two scenarios, one (A) where +an IOCTL for GET_HW_ADDRESS (`SIOCGIFHWADDR`) fails and results in a corrupted +`va_list` being passed to `*printf()` and one (B) where an attacker might provide +valid params for the IOCTL and trick the program to proceed and result in a +`RET eip overwrite` eventually gaining code execution. + +Upstream-Status: Backport [https://git.busybox.net/busybox/commit/networking/arp.c?id=88e2b1cb626761b1924305b761a5dfc723613c4e] +BUG: BUG9071 +Signed-off-by: Martin Balik +Signed-off-by: Pascal Bach + +-- + +diff --git a/networking/arp.c b/networking/arp.c +index 0099aa5..87eb327 100644 +--- a/networking/arp.c ++++ b/networking/arp.c +@@ -176,7 +176,7 @@ static int arp_del(char **args) + if (flags == 0) + flags = 3; + +- strncpy(req.arp_dev, device, sizeof(req.arp_dev)); ++ strncpy_IFNAMSIZ(req.arp_dev, device); + + err = -1; + +@@ -217,7 +217,7 @@ static void arp_getdevhw(char *ifname, struct sockaddr *sa) + struct ifreq ifr; + const struct hwtype *xhw; + +- strcpy(ifr.ifr_name, ifname); ++ strncpy_IFNAMSIZ(ifr.ifr_name, ifname); + ioctl_or_perror_and_die(sockfd, SIOCGIFHWADDR, &ifr, + "can't get HW-Address for '%s'", ifname); + if (hw_set && (ifr.ifr_hwaddr.sa_family != hw->type)) { +@@ -330,7 +330,7 @@ static int arp_set(char **args) + /* Fill in the remainder of the request. */ + req.arp_flags = flags; + +- strncpy(req.arp_dev, device, sizeof(req.arp_dev)); ++ strncpy_IFNAMSIZ(req.arp_dev, device); + + /* Call the kernel. */ + if (option_mask32 & ARP_OPT_v) diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb index cb4568854c..400cdfe28f 100644 --- a/meta/recipes-core/busybox/busybox_1.24.1.bb +++ b/meta/recipes-core/busybox/busybox_1.24.1.bb @@ -56,6 +56,7 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://makefile-libbb-race.patch \ file://0001-libiproute-handle-table-ids-larger-than-255.patch \ file://ifupdown-pass-interface-device-name-for-ipv6-route-c.patch \ + file://BUG9071_buffer_overflow_arp.patch \ " SRC_URI_append_libc-musl = " file://musl.cfg " From 8f829dfb127760fea914218042e0bcf1ee42b9e7 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 9 Jan 2017 10:52:51 -0500 Subject: [PATCH 044/129] linux-yocto/4.4: update to v4.4.41 Integrating the korg -stable release. Changes are as follows: cdd86b972265 Linux 4.4.41 9f11a0ab6a96 net: mvpp2: fix dma unmapping of TX buffers for fragments d85727365859 sg_write()/bsg_write() is not fit to be called under KERNEL_DS 7fb5a936457d kconfig/nconf: Fix hang when editing symbol with a long prompt e321f384d8a5 target/user: Fix use-after-free of tcmu_cmds if they are expired e5de1c724c06 powerpc: Convert cmp to cmpd in idle enter sequence cadaba838f1b powerpc/ps3: Fix system hang with GCC 5 builds 8a2bcaae1bc7 nfs_write_end(): fix handling of short copies b66e3126569e libceph: verify authorize reply on connect edfe6a79f905 PCI: Check for PME in targeted sleep state 8db00756afbd Input: drv260x - fix input device's parent assignment 44685f03dd56 media: solo6x10: fix lockup by avoiding delayed register write 952a9f5af9f8 IB/cma: Fix a race condition in iboe_addr_get_sgid() b7f73ada92a3 IB/multicast: Check ib_find_pkey() return value 7b1369215616 IPoIB: Avoid reading an uninitialized member variable 0de381ca35b5 IB/mad: Fix an array index check e945df4c6bc2 fgraph: Handle a case where a tracer ignores set_graph_notrace 88e41441ccd4 platform/x86: asus-nb-wmi.c: Add X45U quirk 2ef502e860f1 ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using short jumps to it 19aa9c14989e kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF) 129e4323df37 KVM: PPC: Book3S HV: Don't lose hardware R/C bit updates in H_PROTECT ddf5718adfb8 KVM: PPC: Book3S HV: Save/restore XER in checkpointed register state 1c8841c9b7d2 md/raid5: limit request size according to implementation limits d78006d2345f sc16is7xx: Drop bogus use of IRQF_ONESHOT b988320dab53 s390/vmlogrdr: fix IUCV buffer allocation 656c9abd574b firmware: fix usermode helper fallback loading 429a533a3d9a ARC: mm: arc700: Don't assume 2 colours for aliasing VIPT dcache dbb67e1d585d scsi: avoid a permanent stop of the scsi device's request queue 565ae61d8995 scsi: zfcp: fix rport unblock race with LUN recovery 3b3739dfa69c scsi: zfcp: do not trace pure benign residual HBA responses at default level 1cc0f9488b91 scsi: zfcp: fix use-after-"free" in FC ingress path after TMF bccd78746f88 scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map 49ea06561154 scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset edf1169bbbaa vt: fix Scroll Lock LED trigger name f4f02a856a92 block: protect iterate_bdevs() against concurrent close abb78811e242 mei: request async autosuspend at the end of enumeration 1f9c91a37542 drivers/gpu/drm/ast: Fix infinite loop if read fails 970dc8cdec9c drm/gma500: Add compat ioctl 0e0b70f581fc drm/radeon: add additional pci revision to dpm workaround 62a272498dbe drm/radeon: Hide the HW cursor while it's out of bounds deac395e0ba8 drm/radeon: Also call cursor_move_locked when the cursor size changes cb8d63d885e9 drm/nouveau/i2c/gk110b,gm10x: use the correct implementation adea4a7b0f2b drm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex d32d4b3d7c9f drm/nouveau/ltc: protect clearing of comptags with mutex 3a2990e67b05 drm/nouveau/bios: require checksum to match for fast acpi shadow method a163451c80b0 drm/nouveau/kms: lvds panel strap moved again on maxwell 69e236e70ead ACPI / video: Add force_native quirk for HP Pavilion dv6 2c2375e40d28 ACPI / video: Add force_native quirk for Dell XPS 17 L702X 01b6089b5622 staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data 5283a7bedbcb staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask e692edec93c1 thermal: hwmon: Properly report critical temperature in sysfs 9d9541d44a26 clk: bcm2835: Avoid overwriting the div info when disabling a pll_div clk e01b04be3eb0 timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion 96ea1b9ea099 regulator: stw481x-vmmc: fix ages old enable error 842ec27cd3f2 mmc: sdhci: Fix recovery from tuning timeout dae7cb414834 ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards. b63929e8e130 cfg80211/mac80211: fix BSS leaks when abandoning assoc attempts 05f4183ab5a4 rtlwifi: Fix enter/exit power_save f5d90f434c9a ssb: Fix error routine when fallback SPROM fails a3edc7b2e537 Linux 4.4.40 7a2b4ee54b3f ppp: defer netns reference release for ppp channel 37de955c11b5 driver core: fix race between creating/querying glue dir and its cleanup f85a337b4066 xfs: set AGI buffer type in xlog_recover_clear_agi_bucket fdb17ddd0a49 arm/xen: Use alloc_percpu rather than __alloc_percpu 9397e79c4b2d xen/gntdev: Use VM_MIXEDMAP instead of VM_IO to avoid NUMA balancing 00a0de085d60 tpm xen: Remove bogus tpm_chip_unregister f93777c91544 kernel/debug/debug_core.c: more properly delay for secondary CPUs f2b8b3455b22 kernel/watchdog: use nmi registers snapshot in hardlockup handler 597f9c03b2d5 CIFS: Fix a possible memory corruption in push locks a9c69e152897 CIFS: Fix missing nls unload in smb2_reconnect() f0b715409cb9 CIFS: Fix a possible memory corruption during reconnect 6dcb01e78333 ASoC: intel: Fix crash at suspend/resume without card registration 701ec6e5cea7 dm space map metadata: fix 'struct sm_metadata' leak on failed create 85290a163b06 dm crypt: mark key as invalid until properly loaded 9188611f81e3 dm flakey: return -EINVAL on interval bounds error in flakey_ctr() f0898dc2852b blk-mq: Do not invoke .queue_rq() for a stopped queue c53af76d5de1 usb: gadget: composite: always set ep->mult to a sensible value b35f34f66943 exec: Ensure mm->user_ns contains the execed files 0812936b11ea fs: exec: apply CLOEXEC before changing dumpable task flags 14d8e5cae039 mm/vmscan.c: set correct defer count for shrinker ffef1630187b loop: return proper error from loop_queue_rq() 011ded975e34 f2fs: set ->owner for debugfs status file's file_operations 3460edfc70c2 ext4: do not perform data journaling when data is encrypted 36af7cd560b9 ext4: return -ENOMEM instead of success 519a30148e23 ext4: reject inodes with negative size f655b3575c47 ext4: add sanity checking to count_overhead() 3995881b0f72 ext4: fix in-superblock mount options processing 386588013810 ext4: use more strict checks for inodes_per_block on mount 7b74c351de1c ext4: fix stack memory corruption with 64k block size 26492d8a22b0 ext4: fix mballoc breakage with 64k block size 4b6050922fb8 crypto: caam - fix AEAD givenc descriptors 1c1f15f8ebfb ptrace: Capture the ptracer's creds not PT_PTRACE_CAP 03eed7afbc09 mm: Add a user_ns owner to mm_struct and fix ptrace permission checks d80411dea6a4 block_dev: don't test bdev->bd_contains when it is not stable 85cfbd9db2c6 btrfs: make file clone aware of fatal signals 323ffc03ddb2 Btrfs: don't BUG() during drop snapshot 107800061996 Btrfs: fix memory leak in do_walk_down 5a9b659edef6 Btrfs: don't leak reloc root nodes on error 8ca6845a58cd Btrfs: return gracefully from balance if fs tree is corrupted 78a587c608f9 Btrfs: bail out if block group has different mixed flag 25ee81e54620 Btrfs: fix memory leak in reading btree blocks 590202271ffd clk: ti: omap36xx: Work around sprz319 advisory 2.1 119b6658ce05 ALSA: hda: when comparing pin configurations, ignore assoc in addition to seq f0ea0ade046e ALSA: hda - Gate the mic jack on HP Z1 Gen3 AiO fa695bdc1741 ALSA: hda - fix headset-mic problem on a Dell laptop faff777fb456 ALSA: hda - ignore the assoc and seq when comparing pin configurations 518fca87c645 ALSA: hda/ca0132 - Add quirk for Alienware 15 R2 2016 29348065c339 ALSA: hiface: Fix M2Tech hiFace driver sampling rate change d0ba0f6a8291 ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_control_quirks cbb2a2563587 USB: UHCI: report non-PME wakeup signalling for Intel hardware 8ede2d7908aa usb: gadget: composite: correctly initialize ep->maxpacket c67c2ed829f3 usb: gadget: f_uac2: fix error handling at afunc_bind 747b31526369 usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices acca3cf0d62b USB: cdc-acm: add device id for GW Instek AFG-125 5d6a392b6d36 USB: serial: kl5kusb105: fix open error path 6a6e113cd928 USB: serial: option: add dlink dwm-158 17907f291779 USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041 1f5adadcd032 Btrfs: fix qgroup rescan worker initialization b5e715ed11ec btrfs: store and load values of stripes_min/stripes_max in balance status item 919b74ba5ed5 Btrfs: fix tree search logic when replaying directory entry deletes 0d619cf6f982 btrfs: limit async_work allocation and worker func duration a34f0e8a2f89 Linux 4.4.39 5d488dee9236 crypto: rsa - Add Makefile dependencies to fix parallel builds 1c0f4e0ebb79 hotplug: Make register and unregister notifier API symmetric 537e42d759ae batman-adv: Check for alloc errors when preparing TT local data f03531d09125 m68k: Fix ndelay() macro 55e15b2f44d7 arm64: futex.h: Add missing PAN toggling e29949ed3903 can: peak: fix bad memory access and free sequence 083021bdba1e can: raw: raw_setsockopt: limit number of can_filter that can be set 9a3baed9103b crypto: mcryptd - Check mcryptd algorithm compatibility c4db8a7d1e0c perf/x86: Fix full width counter, counter overflow c6a5bf4cda12 locking/rtmutex: Use READ_ONCE() in rt_mutex_owner() b27d9147f24a locking/rtmutex: Prevent dequeue vs. unlock race e286b6c16758 zram: restrict add/remove attributes to root only a0bd6aa097a4 parisc: Fix TLB related boot crash on SMP machines 605f315c5a83 parisc: Remove unnecessary TLB purges from flush_dcache_page_asm and flush_icache_page_asm db9598605768 parisc: Purge TLB before setting PTE 4bcea472de10 powerpc/eeh: Fix deadlock when PE frozen state can't be cleared c95b7f1fab0c Linux 4.4.38 52783ada69b4 esp6: Fix integrity verification when ESN are used 3bf28ce9c749 esp4: Fix integrity verification when ESN are used 2176ec1c82ea ipv4: Set skb->protocol properly for local output 25d8b7c105e1 ipv6: Set skb->protocol properly for local output d41fb2fbb28d Don't feed anything but regular iovec's to blk_rq_map_user_iov fd1aa12c6340 constify iov_iter_count() and iter_is_iovec() 899b60535a2a sparc64: fix compile warning section mismatch in find_node() ed7b60db00a1 sparc64: Fix find_node warning if numa node cannot be found 438e91da24fa sparc32: Fix inverted invalid_frame_pointer checks on sigreturns 06cdad2b6d92 net: ping: check minimum size on ICMP header length 77125815f058 net: avoid signed overflows for SO_{SND|RCV}BUFFORCE 6e682c528b3e geneve: avoid use-after-free of skb->data a89e2ff894bc sh_eth: remove unchecked interrupts for RZ/A1 c36a2a14f26d net: bcmgenet: Utilize correct struct device for all DMA operations 5a01eaf19858 packet: fix race condition in packet_set_ring 1a15519fdcdb net/dccp: fix use-after-free in dccp_invalid_packet baaf0c65bc8e netlink: Do not schedule work from sk_destruct d1ed9c1dba63 netlink: Call cb->done from a worker thread 6c42bd6a393c net/sched: pedit: make sure that offset is valid cfa7c16d4577 net, sched: respect rcu grace period on cls destruction 94de6f2ffb3d net: dsa: bcm_sf2: Ensure we re-negotiate EEE during after link change 56366fa0ad46 l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() aece024e38cb rtnetlink: fix FDB size computation 6ef59b986190 af_unix: conditionally use freezable blocking calls in read acf9504ae220 net: sky2: Fix shutdown crash 49695d1e3b81 ip6_tunnel: disable caching when the traffic class is inherited 2b54505c877f net: check dead netns for peernet2id_alloc() 790fd11f9ed6 virtio-net: add a missing synchronize_net() (From OE-Core rev: c3c66220630162c84ead895dc98c7d951b0e2e85) Signed-off-by: Bruce Ashfield Signed-off-by: Ross Burton (cherry picked from commit 2042e74352fcec84ac69645387273438794966f6) fixed up merge conflicts do to changes in master Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.4.bb | 6 +++--- .../linux/linux-yocto-tiny_4.4.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.4.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb index d6e9626c00..d5f86d9b31 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "61d7bf47fe27b7dfd9a73b0a6de2d78a29af8b74" -SRCREV_meta ?= "b846fc6436aa5d4c747d620e83dfda969854d10c" +SRCREV_machine ?= "6622c6471016005d5588aa4338ce57aced713dcd" +SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.36" +LINUX_VERSION ?= "4.4.41" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb index dfd947cf75..0baba1de53 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.4.36" +LINUX_VERSION ?= "4.4.41" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_meta ?= "b846fc6436aa5d4c747d620e83dfda969854d10c" +SRCREV_machine ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.4.bb b/meta/recipes-kernel/linux/linux-yocto_4.4.bb index 7d734ac423..5ac3f561a5 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.4.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "2859bb3c9e1bb307d9e4e03032fd8a529137552f" -SRCREV_machine_qemuarm64 ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_machine_qemumips ?= "3c4c23020da8a0596a64c8784c6d3a2dfa1ea324" -SRCREV_machine_qemuppc ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_machine_qemux86 ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_machine_qemux86-64 ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_machine_qemumips64 ?= "5d05923ecc402c127b92543ee44b890de5c53a7e" -SRCREV_machine ?= "35482df5d5ba0807eb8a7c40b554bd657e3f9987" -SRCREV_meta ?= "b846fc6436aa5d4c747d620e83dfda969854d10c" +SRCREV_machine_qemuarm ?= "60287c1951ca7063bc19597eb5cabf834e660cfb" +SRCREV_machine_qemuarm64 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_machine_qemumips ?= "143d659ae6d53623001e22c13a0286bd6d1723ca" +SRCREV_machine_qemuppc ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_machine_qemux86 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_machine_qemux86-64 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_machine_qemumips64 ?= "c74cc42106745bab08de6263b9320ac029f2cca9" +SRCREV_machine ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" +SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.36" +LINUX_VERSION ?= "4.4.41" PV = "${LINUX_VERSION}+git${SRCPV}" From 4b4f7aee6dee25f58f0354cdfbbb9a83ec7722ac Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 9 Jan 2017 10:37:13 -0500 Subject: [PATCH 045/129] linux-yocto/4.8: -stable update to v4.8.17 Updating to the korg 4.8.17 -stable release. Changes are as follows: 3d8f8d06abb3 Linux 4.8.17 adf363fd5ab9 drm/i915: skip the first 4k of stolen memory on everything >= gen8 000e612673da drm/i915: Initialize dev_priv->atomic_cdclk_freq at init time 22aba475d97b drm/i915: Fix cdclk vs. dev_cdclk mess when not recomputing things 294bb3402c76 drm/i915/dsi: Do not clear DPOUNIT_CLOCK_GATE_DISABLE from vlv_init_display_clock_gating 6a412ff3df87 drm/i915/dsi: Fix chv_exec_gpio disabling the GPIOs it is setting 4803ec2a74c4 net: mvpp2: fix dma unmapping of TX buffers for fragments 48f26edb689c sg_write()/bsg_write() is not fit to be called under KERNEL_DS d787c6b32c3f kconfig/nconf: Fix hang when editing symbol with a long prompt e141d1a21e31 target/user: Fix use-after-free of tcmu_cmds if they are expired 29f3d1127c4b libnvdimm, pfn: fix align attribute 3a4e4281b5cd powerpc/ps3: Fix system hang with GCC 5 builds e451d674bac5 powerpc/64e: Convert cmpi to cmpwi in head_64.S 0349fbebd984 SUNRPC: fix refcounting problems with auth_gss messages. c513ade4ca56 pNFS: Fix a deadlock between read resends and layoutreturn abb2903f1ac2 pNFS: Clear NFS_LAYOUT_RETURN_REQUESTED when invalidating the layout stateid f061c76c1d56 pNFS: Don't clear the layout stateid if a layout return is outstanding 7de1b81c27fd pNFS: On error, do not send LAYOUTGET until the LAYOUTRETURN has completed 8f5ff877bf19 nfs_write_end(): fix handling of short copies 1678adac85da libceph: verify authorize reply on connect 1f93d1a77b17 PCI: Check for PME in targeted sleep state c75bc2bde102 i40iw: Use correct src address in memcpy to rdma stats counters 7d0a6cf3e8c9 Input: drv260x - fix input device's parent assignment b7843712cbd2 v4l: tvp5150: Add missing break in set control handler 4963b1910090 media: solo6x10: fix lockup by avoiding delayed register write 88bfde25e60f s5p-mfc: fix failure path of s5p_mfc_alloc_memdev() c3fe33d185e0 mn88473: fix chip id check on probe 84b2f664409c mn88472: fix chip id check on probe 15d1d226eab4 IB/cma: Fix a race condition in iboe_addr_get_sgid() 7b3721aff59b IB/rxe: Fix a memory leak in rxe_qp_cleanup() 2a0aa77a54fb IB/multicast: Check ib_find_pkey() return value 37d4adba02d3 IPoIB: Avoid reading an uninitialized member variable f079fc11f28e IB/mad: Fix an array index check e661b5d4b94f fgraph: Handle a case where a tracer ignores set_graph_notrace b2758da04d73 platform/x86: asus-nb-wmi.c: Add X45U quirk f61152e3bbf0 ftrace/x86_32: Set ftrace_stub to weak to prevent gcc from using short jumps to it 8569aadeed3f vsock/virtio: fix src/dst cid format 576ea9e5e92e fsnotify: Fix possible use-after-free in inode iteration on umount 43983ce75e61 kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF) 9a5cf8c4b112 KVM: PPC: Book3S HV: Don't lose hardware R/C bit updates in H_PROTECT b751eb6e9d99 KVM: PPC: Book3S HV: Save/restore XER in checkpointed register state 0773e9248ae3 scsi: aacraid: remove wildcard for series 9 controllers b202064f0b3f md/raid5: limit request size according to implementation limits 47090341ec97 sc16is7xx: Drop bogus use of IRQF_ONESHOT c33e1abd2e31 arm64: KVM: pmu: Reset PMSELR_EL0.SEL to a sane value before entering the guest d3d61bb37afb s390/kexec: use node 0 when re-adding crash kernel memory 9652b62af49d s390/vmlogrdr: fix IUCV buffer allocation f356ab038e78 firmware: fix usermode helper fallback loading 5c98bf834d6f ARC: mm: arc700: Don't assume 2 colours for aliasing VIPT dcache cc328ce59a4a scsi: avoid a permanent stop of the scsi device's request queue 6d675dffd425 scsi: zfcp: fix rport unblock race with LUN recovery 057fe03d627e scsi: zfcp: do not trace pure benign residual HBA responses at default level 5cebfea8080c scsi: zfcp: fix use-after-"free" in FC ingress path after TMF de8a06c673ac iscsi-target: Return error if unable to add network portal 9c3928be0dba scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map dbd4e6c60b4f scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset 3863ab6d710d stm class: Fix device leak in open error path 698ac693dbb4 vt: fix Scroll Lock LED trigger name 6d8bb567102c block: protect iterate_bdevs() against concurrent close 2695afd5e9c2 mei: me: add lewisburg device ids 7be0a5f39d64 mei: request async autosuspend at the end of enumeration dfc3c8a0fa1b drivers/gpu/drm/ast: Fix infinite loop if read fails 0f95e4a58ecd drm/amdgpu: fix init save/restore list in gfx_v8.0 8bfa4f5e6395 drm/gma500: Add compat ioctl 10b598df92d9 drm/radeon/si: load the proper firmware on 0x87 oland boards cdb7aaaaecff drm/radeon: add additional pci revision to dpm workaround 1f884ec818a6 drm/radeon: Hide the HW cursor while it's out of bounds 6fb94229b2f6 drm/radeon: Also call cursor_move_locked when the cursor size changes 9c6fb7bf404d drm/nouveau/fifo/gf100-: protect channel preempt with subdev mutex 2a7a43772bff drm/nouveau/i2c/gk110b,gm10x: use the correct implementation 28d186430686 drm/nouveau/ttm: wait for bo fence to signal before unmapping vmas 82d9824d9446 drm/nouveau/ltc: protect clearing of comptags with mutex ce71868acee2 drm/nouveau/bios: require checksum to match for fast acpi shadow method 764e8e8af190 drm/nouveau/kms: lvds panel strap moved again on maxwell 00e1fb138ffa drm/nouveau/gr: fallback to legacy paths during firmware lookup fef542735a48 drm/amd/amdgpu: enable GUI idle INT after enabling CGCG bab520835f81 ACPI / video: Add force_native quirk for HP Pavilion dv6 b7eea51a3a5c ACPI / video: Add force_native quirk for Dell XPS 17 L702X ce8100660364 staging: comedi: ni_mio_common: fix E series ni_ai_insn_read() data 689d59259385 staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask 823c5c94f716 hv: acquire vmbus_connection.channel_mutex in vmbus_free_channels() 235394e1625c docs: sphinx-extensions: make rstFlatTable work with docutils 0.13 a26a016a4e2f thermal: hwmon: Properly report critical temperature in sysfs def2c87dc7ac clk: bcm2835: Avoid overwriting the div info when disabling a pll_div clk 2f885dafe704 arm64: tegra: Add VDD_GPU regulator to Jetson TX1 bd12562fceb4 gpio: chardev: Return error for seek operations 61d0b7139cf9 timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion 95d2a43e5a59 regulator: stw481x-vmmc: fix ages old enable error 52980ceb1832 mmc: sdhci: Fix recovery from tuning timeout 0ed0b2592437 ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards. d80ff7cb5d06 ath9k: fix ath9k_hw_gpio_get() to return 0 or 1 on success 42e76c596c93 cfg80211/mac80211: fix BSS leaks when abandoning assoc attempts d2546f653bb0 rtl8xxxu: Work around issue with 8192eu and 8723bu devices not reconnecting 2abcc023a460 perf/x86/intel/cstate: Prevent hotplug callback leak 7b9e1a16a1b0 perf/x86: Fix exclusion of BTS and LBR for Goldmont e24523a80c19 rtlwifi: Fix enter/exit power_save c9fce6ba9c09 ssb: Fix error routine when fallback SPROM fails c65ed08dcc04 Linux 4.8.16 645897231f96 driver core: fix race between creating/querying glue dir and its cleanup f199bdbaab37 Revert "netfilter: move nat hlist_head to nf_conn" 99d6d4e0c50c Revert "netfilter: nat: convert nat bysrc hash to rhashtable" 774225699b4d arm64: mark reserved memblock regions explicitly in iomem 587e89bd56c1 xfs: set AGI buffer type in xlog_recover_clear_agi_bucket 959e363eaf14 arm/xen: Use alloc_percpu rather than __alloc_percpu 6fbd3fb6c4df xen/gntdev: Use VM_MIXEDMAP instead of VM_IO to avoid NUMA balancing 883f12a20583 tpm xen: Remove bogus tpm_chip_unregister 8419f5215db3 kernel/debug/debug_core.c: more properly delay for secondary CPUs 63b33e0885d6 watchdog: qcom: fix kernel panic due to external abort on non-linefetch bf902ead61d8 watchdog: mei_wdt: request stop on reboot to prevent false positive event 2f826a72ea8b kernel/watchdog: use nmi registers snapshot in hardlockup handler bbf23f00d55e CIFS: Fix a possible memory corruption in push locks 9f1f5076149a CIFS: Fix missing nls unload in smb2_reconnect() ff04da387c10 CIFS: Fix a possible memory corruption during reconnect 6cb589c7529f ASoC: intel: Fix crash at suspend/resume without card registration 769c0922d4a6 dm space map metadata: fix 'struct sm_metadata' leak on failed create ab10ab0a2a3d dm raid: fix discard support regression 454b98d3f2b5 dm rq: fix a race condition in rq_completed() 26011e67339e dm crypt: mark key as invalid until properly loaded bd5fcd18c8c3 dm flakey: return -EINVAL on interval bounds error in flakey_ctr() 1ca66d6a19d2 dm table: an 'all_blk_mq' table must be loaded for a blk-mq DM device d948d3b1e416 dm table: fix 'all_blk_mq' inconsistency when an empty table is loaded 45f631113b36 blk-mq: Do not invoke .queue_rq() for a stopped queue e3742a15d6cd PM / OPP: Pass opp_table to dev_pm_opp_put_regulator() 8b63a922ac07 usb: gadget: composite: always set ep->mult to a sensible value d4f4b2e659f5 mm, page_alloc: keep pcp count and list contents in sync if struct page is corrupted 0927d281a2fc mm/vmscan.c: set correct defer count for shrinker 3e0ef1b8e0cc nvmet: Fix possible infinite loop triggered on hot namespace removal 6290a3bcd3c3 loop: return proper error from loop_queue_rq() bf0f02079039 f2fs: fix overflow due to condition check order 154d83a8384e f2fs: set ->owner for debugfs status file's file_operations 67e5239c8366 Revert "f2fs: use percpu_counter for # of dirty pages in inode" d06eaf28f1bb ext4: do not perform data journaling when data is encrypted e33673bef6f0 ext4: return -ENOMEM instead of success 3664877022ea ext4: reject inodes with negative size 1bfcffbb8801 ext4: add sanity checking to count_overhead() 9689eb99ce0f ext4: fix in-superblock mount options processing 52a9daa3d5c0 ext4: use more strict checks for inodes_per_block on mount 7505584356d2 ext4: fix stack memory corruption with 64k block size 86efd99f0ebe ext4: fix mballoc breakage with 64k block size 8022387d236a crypto: caam - fix AEAD givenc descriptors ade692b8f1f5 ptrace: Capture the ptracer's creds not PT_PTRACE_CAP 23d179acb363 vfs,mm: fix return value of read() at s_maxbytes e45692fa1aea mm: Add a user_ns owner to mm_struct and fix ptrace permission checks 04804d83d483 block_dev: don't test bdev->bd_contains when it is not stable 52d69727a441 fs: exec: apply CLOEXEC before changing dumpable task flags 781e976ac2c6 exec: Ensure mm->user_ns contains the execed files fc1d3e5f3cd0 btrfs: make file clone aware of fatal signals 8c59356c1232 Btrfs: fix incremental send failure caused by balance 02fffa116bda Btrfs: don't BUG() during drop snapshot 0f2e022db237 btrfs: fix a possible umount deadlock 65563ab7271b Btrfs: fix memory leak in do_walk_down 364b85c57d25 btrfs: clean the old superblocks before freeing the device 6a6e9276f3f5 Btrfs: don't leak reloc root nodes on error 4d3d9b59d963 Btrfs: return gracefully from balance if fs tree is corrupted a6522e487b2c Btrfs: bail out if block group has different mixed flag d7839adcb0e3 Btrfs: fix memory leak in reading btree blocks 1a087cd869c6 clk: ti: omap36xx: Work around sprz319 advisory 2.1 2b96c4b19e0a ALSA: hda: when comparing pin configurations, ignore assoc in addition to seq dc8144f49988 ALSA: hda - Gate the mic jack on HP Z1 Gen3 AiO 685c4db17890 ALSA: hda - fix headset-mic problem on a Dell laptop b757fc019fc9 ALSA: hda - ignore the assoc and seq when comparing pin configurations 38c6095f48fe ALSA: hda/ca0132 - Add quirk for Alienware 15 R2 2016 5496ec423449 ALSA: hiface: Fix M2Tech hiFace driver sampling rate change abf549a8b969 ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_control_quirks 6b0a56e9aaf3 usbip: vudc: fix: Clear already_seen flag also for ep0 a9143e58d3cc USB: UHCI: report non-PME wakeup signalling for Intel hardware 4422a26936ae usb: gadget: composite: correctly initialize ep->maxpacket be8f1c44177a usb: gadget: f_uac2: fix error handling at afunc_bind 79d5a30e37ab usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices e3dfbc8904b3 usb: dwc3: gadget: set PCM1 field of isochronous-first TRBs 269edaef820f USB: cdc-acm: add device id for GW Instek AFG-125 741523f3da82 USB: serial: kl5kusb105: fix open error path f34b7e027eeb USB: serial: option: add dlink dwm-158 e47e81c4e705 USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041 3aa3cb940878 Btrfs: fix qgroup rescan worker initialization 691ea6c7eb1e Btrfs: fix emptiness check for dirtied extent buffers at check_leaf() 0695d8b10a88 btrfs: store and load values of stripes_min/stripes_max in balance status item 80f7d2836e37 Btrfs: fix relocation incorrectly dropping data references f1b268d7a8e2 Btrfs: fix tree search logic when replaying directory entry deletes 65553a02a313 Btrfs: fix deadlock caused by fsync when logging directory entries 361e82137a2d Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty 562de9c7ce24 btrfs: limit async_work allocation and worker func duration f080d7094838 aoe: fix crash in page count manipulation 8bba2e2e62cb Linux 4.8.15 762c9bb16fce crypto: rsa - Add Makefile dependencies to fix parallel builds 014e5a7d9354 hotplug: Make register and unregister notifier API symmetric 3527ad05b46e batman-adv: Check for alloc errors when preparing TT local data 32ccd76788a5 m68k: Fix ndelay() macro 9fc7a4758608 ceph: don't set req->r_locked_dir in ceph_d_revalidate a05f493f8d4e ARM: dts: imx7d: fix LCDIF clock assignment 798c825fb006 ARM: dts: orion5x: fix number of sata port for linkstation ls-gl d271b9bec2d3 Revert "ACPI: Execute _PTS before system reboot" 3ee9f16cff18 can: peak: fix bad memory access and free sequence 212e0ff80970 can: raw: raw_setsockopt: limit number of can_filter that can be set bdb5ed2040f5 crypto: marvell - Don't corrupt state of an STD req for re-stepped ahash bfef274e4dae crypto: mcryptd - Check mcryptd algorithm compatibility 86bea59218a0 crypto: caam - fix pointer size for AArch64 boot loader, AArch32 kernel 666531ca650e crypto: marvell - Don't copy hash operation twice into the SRAM 04925ba9b944 acpi, nfit: fix bus vs dimm confusion in xlat_status 53ed7c2e8d02 acpi, nfit: validate ars_status output buffer size e04e2dace316 acpi, nfit, libnvdimm: fix / harden ars_status output length handling 483ac1487a9d acpi, nfit: fix extended status translations for ACPI DSMs 0525cebf8ef7 perf/x86: Fix full width counter, counter overflow eceab1fd7f9e vhost-vsock: fix orphan connection reset b0224f36735e sched/autogroup: Fix 64-bit kernel nice level adjustment 2a477999977c scsi: lpfc: fix oops/BUG in lpfc_sli_ringtxcmpl_put() ac65fe0bbdea device-dax: fix private mapping restriction, permit read-only 2386c6b188c5 locking/rtmutex: Use READ_ONCE() in rt_mutex_owner() 7b2347c8e803 locking/rtmutex: Prevent dequeue vs. unlock race bed4eef2e8fa zram: restrict add/remove attributes to root only 4fb7569c7370 parisc: Fix TLB related boot crash on SMP machines b81e5db49515 parisc: Remove unnecessary TLB purges from flush_dcache_page_asm and flush_icache_page_asm 7e8f68aa1833 parisc: Purge TLB before setting PTE 6e284445bab5 fuse: fix clearing suid, sgid for chown() e70d6d2d7383 powerpc/boot: Fix build failure in 32-bit boot wrapper a82ad493f045 powerpc/mm: Fix lazy icache flush on pre-POWER5 84b36287c72d powerpc/eeh: Fix deadlock when PE frozen state can't be cleared 7b8c57cad53a Linux 4.8.14 1670d1584701 esp6: Fix integrity verification when ESN are used b3e9d4982939 esp4: Fix integrity verification when ESN are used be5339492b29 flowcache: Increase threshold for refusing new allocations 3a116fa8c95d Revert: "ip6_tunnel: Update skb->protocol to ETH_P_IPV6 in ip6_tnl_xmit()" 686182870c6a ipv4: Set skb->protocol properly for local output e67bd82fb79d ipv6: Set skb->protocol properly for local output 22d94c326660 Don't feed anything but regular iovec's to blk_rq_map_user_iov e4a6c61c6b71 constify iov_iter_count() and iter_is_iovec() 907bc3181c9a sparc32: Fix inverted invalid_frame_pointer checks on sigreturns 360e257f8cf3 sparc64: fix compile warning section mismatch in find_node() 2f02dcb673a4 sparc64: Fix find_node warning if numa node cannot be found ad02ec7d37a2 ipv4: Drop suffix update from resize code 0b1c601d367f ipv4: Drop leaf from suffix pull/push functions cd8a6c0e95bf ipv4: Fix memory leak in exception case for splitting tries a8780378b39e ipv4: Restore fib_trie_flush_external function and fix call ordering 5ff5e5c06c25 net: ping: check minimum size on ICMP header length f818e5d86aef net: avoid signed overflows for SO_{SND|RCV}BUFFORCE bfecf9017f8b geneve: avoid use-after-free of skb->data 4daa2c73eb05 tipc: check minimum bearer MTU 1ff3209a21c8 sh_eth: remove unchecked interrupts for RZ/A1 bbf913d774b7 net: bcmgenet: Utilize correct struct device for all DMA operations accb7c99fc0f cdc_ether: Fix handling connection notification 34457543e203 ip6_offload: check segs for NULL in ipv6_gso_segment. cef222d40f2e packet: fix race condition in packet_set_ring 17941a9d6409 GSO: Reload iph after pskb_may_pull ff0d7874078d net/dccp: fix use-after-free in dccp_invalid_packet 023cd33ece37 net: macb: fix the RX queue reset in macb_rx() 25d9b4bb64ea netlink: Do not schedule work from sk_destruct f5dad3473d83 netlink: Call cb->done from a worker thread 360d6a23e79d net/sched: pedit: make sure that offset is valid aa239369bdfa net: dsa: fix unbalanced dsa_switch_tree reference counting 9a7479273949 net, sched: respect rcu grace period on cls destruction a9437ebc69f5 net: dsa: bcm_sf2: Ensure we re-negotiate EEE during after link change ddf053431efe udplite: call proper backlog handlers 7b0aa75be3ab ipv6: bump genid when the IFA_F_TENTATIVE flag is clear 58c8cc33de6c rtnl: fix the loop index update error in rtnl_dump_ifinfo() 84df56749f48 l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() 7f8b251a0985 rtnetlink: fix FDB size computation c39caa8f80c0 af_unix: conditionally use freezable blocking calls in read bdc5c63e4b38 net: sky2: Fix shutdown crash a75684ab7a12 ip6_tunnel: disable caching when the traffic class is inherited 1b079d5b9fc1 net: check dead netns for peernet2id_alloc() 65dfc8b4547f net: dsa: b53: Fix VLAN usage and how we treat CPU port f959eb507439 virtio-net: add a missing synchronize_net() 8070f33be6c4 gro_cells: mark napi struct as not busy poll candidates 55d64c0b3c15 Linux 4.8.13 a4edb1a2b045 arm64: suspend: Reconfigure PSTATE after resume from idle 6353400d9130 arm64: mm: Set PSTATE.PAN from the cpu_enable_pan() call b49b1ae6d341 arm64: cpufeature: Schedule enable() calls instead of calling them via IPI e4e77deda200 batman-adv: Detect missing primaryif during tp_send as error f106de5604dd clk: sunxi: Fix M factor computation for APB1 9e2d9e95094a perf/x86: Restore TASK_SIZE check on frame pointer ab34b429a01f drm/mediatek: fix null pointer dereference 43b5bb262711 pwm: Fix device reference leak 6c6947613979 KVM: use after free in kvm_ioctl_create_device() ff8b06b4efa6 arm64: dts: juno: fix cluster sleep state entry latency on all SoC versions f67b89acdfa1 drm/radeon: fix check for port PM availability 835bb5cd3653 drm/amdgpu: fix check for port PM availability 972d595824b6 drm/radeon: fix power state when port pm is unavailable (v2) be1b75edf20b drm/amdgpu: fix power state when port pm is unavailable bd78c077f8fe drm/i915: drop the struct_mutex when wedged or trying to reset 5dd86b6e5873 drm/i915: Don't touch NULL sg on i915_gem_object_get_pages_gtt() error 05abe7452b71 KVM: arm/arm64: vgic: Don't notify EOI for non-SPIs ca42bd35d308 mwifiex: printk() overflow with 32-byte SSIDs de9ba13ebfdb PCI: Set Read Completion Boundary to 128 iff Root Port supports it (_HPX) 4f4857148b4a PCI: Export pcie_find_root_port 27dce9bcad4d mm: workingset: fix NULL ptr in count_shadow_nodes 60e33689a06e rcu: Fix soft lockup for rcu_nocb_kthread b6f9e236b7ef Input: psmouse - disable automatic probing of BYD touchpads 6ca8ab7052c4 Input: change KEY_DATA from 0x275 to 0x277 600bec25b855 ovl: fix d_real() for stacked fs 5661a6926871 mm: fix false-positive WARN_ON() in truncate/invalidate for hugetlb 48b6b50a2ba5 kasan: update kasan_global for gcc 7 db04d354b7f1 zram: fix unbalanced idr management at hot removal 010020900006 thp: fix corner case of munlock() of PTE-mapped THPs 08fd95de5eee mm, thp: propagation of conditional compilation in khugepaged.c 76e59ecacd54 ARC: Don't use "+l" inline asm constraint b43fb9f6f162 ARC: mm: PAE40: Fix crash at munmap 8d1ee7b245ef scsi: libfc: fix seconds_since_last_reset miscalculation 10e2627377b0 scsi: hpsa: use bus '3' for legacy HBA devices e170c1003c02 libata-scsi: Fixup ata_gen_passthru_sense() (From OE-Core rev: e58e0ed459c18e2e8de63350e95a45307ce2b7c7) Signed-off-by: Bruce Ashfield Signed-off-by: Ross Burton (cherry picked from commit 9cd1850a0a8882796f89c65c073bc80f915f413f) fix merged conflicts do to changes in master Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.8.bb | 6 +++--- .../linux/linux-yocto-tiny_4.8.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.8.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb index d392a6de5e..cd7c4d6e9b 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "3bafd55e39da7fd7c5d483fdee5b72450df3caf0" -SRCREV_meta ?= "926c93ae07de2173b4f764d1da6996597a6d2b73" +SRCREV_machine ?= "8fddffd5588e14ad3bb5297dbc5b9c4a1047238c" +SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.12" +LINUX_VERSION ?= "4.8.17" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb index 15b03579d4..89b6016967 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.8.12" +LINUX_VERSION ?= "4.8.17" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "e274a507b23c23bf0dd6502d0c38fae731c11511" -SRCREV_meta ?= "926c93ae07de2173b4f764d1da6996597a6d2b73" +SRCREV_machine ?= "b62f29ac5c15d6333a13811db030d704b35ace8f" +SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.8.bb b/meta/recipes-kernel/linux/linux-yocto_4.8.bb index aedfe1b155..a81128a0b9 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.8.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "2bb25d9e29ff91d3266e6abe12c6c1a6b6508e98" -SRCREV_machine_qemuarm64 ?= "4b1b4bfb6cf27609b37eb44cd7fee700cd402123" -SRCREV_machine_qemumips ?= "d116a8bdd1d90fe3dde092f119a2dde1674b02c4" -SRCREV_machine_qemuppc ?= "ef0e5cfd16edcb52ec2e3d5abdcb97d8881b2c3d" -SRCREV_machine_qemux86 ?= "021b4aef55b44597587a1ce5879be642b3dca155" -SRCREV_machine_qemux86-64 ?= "021b4aef55b44597587a1ce5879be642b3dca155" -SRCREV_machine_qemumips64 ?= "1b20066b88c3abdde1f6c449b6562a516b4cce6d" -SRCREV_machine ?= "021b4aef55b44597587a1ce5879be642b3dca155" -SRCREV_meta ?= "926c93ae07de2173b4f764d1da6996597a6d2b73" +SRCREV_machine_qemuarm ?= "16f32b5197fbaec1dbf4f380015792ed47322f06" +SRCREV_machine_qemuarm64 ?= "38631cc4a8f89fb9547af9e44213971a5b360a36" +SRCREV_machine_qemumips ?= "bcbe7a7845e3061998a740f12e88a792f358393e" +SRCREV_machine_qemuppc ?= "4858eec374ee4b09e4428895141ad1ed26fb6d64" +SRCREV_machine_qemux86 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" +SRCREV_machine_qemux86-64 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" +SRCREV_machine_qemumips64 ?= "b90b544d7a5b004b635cf337b29e15294cb17553" +SRCREV_machine ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" +SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.12" +LINUX_VERSION ?= "4.8.17" PV = "${LINUX_VERSION}+git${SRCPV}" From c69d0d375638c81e9360b7f26e7ee9841f1f3790 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Mon, 9 Jan 2017 11:11:39 -0500 Subject: [PATCH 046/129] linux-yocto/4.1: update to v4.1.37 Integrating the -stable release. Changes are as follows: 35327468a79d Linux 4.1.37 c27edfb64bbf scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression 016d02981cce tipc: check minimum bearer MTU efcf38bd4020 net: ping: check minimum size on ICMP header length e29fdf045048 packet: fix race condition in packet_set_ring fabaaaa96d54 net: add recursion limit to GRO 7abf32087c1d Bluetooth: Fix potential NULL dereference in RFCOMM bind callback 74cd81c810b9 ptrace: being capable wrt a process requires mapped uids/gids 8165fc3eb28c scsi: arcmsr: Buffer overflow in arcmsr_iop_message_xfer() 1171afc4a34e mnt: Add a per mount namespace limit on the number of mounts 62fa696b7b43 posix_acl: Clear SGID bit when setting file permissions de42b9559d0c fs: Avoid premature clearing of capabilities cb8e1eef351b fs: Give dentry to inode_change_ok() instead of inode 2ee3ceeccd34 nfsd: Disable NFSv2 timestamp workaround for NFSv3+ 820bc4582ab9 fuse: Propagate dentry down to inode_change_ok() 89bc54c54027 xfs: Propagate dentry down to inode_change_ok() 1b364dc9edba xattr: Option to disable meta-data block cache 9a66bc6ee0f9 tcp: fix use after free in tcp_xmit_retransmit_queue() ebdb88b8e465 x86/kexec: add -fno-PIE 672612a21845 scripts/has-stack-protector: add -fno-PIE e06ded86d961 x86/init: Fix cr4_init_shadow() on CR4-less machines eec746939372 ARM: 8617/1: dma: fix dma_max_pfn() 58024f829d0b mm,ksm: fix endless looping in allocating memory when ksm enable d427d645ccf9 can: dev: fix deadlock reported after bus-off 791a92897274 cpuset: handle race between CPU hotplug and cpuset_hotplug_work 6b82b0601ac2 mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl e537a0977f3e drm/msm: fix use of copy_from_user() while holding spinlock b56eb9cdc5f1 bus: arm-ccn: Fix PMU handling of MN 7298a8bf4c63 bus: arm-ccn: Provide required event arguments (From OE-Core rev: f38c64c607373070982d52c40af545d37a7217ee) Signed-off-by: Bruce Ashfield Signed-off-by: Ross Burton (cherry picked from commit 592468a262cc01e4954be33b4281ffca84fea838) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.1.bb | 6 +++--- .../linux/linux-yocto-tiny_4.1.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.1.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb index de3582a7aa..112c02ce4d 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "f3ffbf4880a5103504a4e11c9427b0bdbf222939" -SRCREV_meta ?= "44719fa8f73fd7c444044ad3c04f5fc66f57b993" +SRCREV_machine ?= "109fa96e6ae89b0585e78186b374b57b9f37fcbb" +SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.1.36" +LINUX_VERSION ?= "4.1.37" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb index 80be144e4e..ed5a70b43c 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.1.36" +LINUX_VERSION ?= "4.1.37" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "fec49247816d7045aa8abe0047bcd4737af9a853" -SRCREV_meta ?= "44719fa8f73fd7c444044ad3c04f5fc66f57b993" +SRCREV_machine ?= "61d2bedf25deac15c19413ee1b057067657d97d3" +SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.1.bb b/meta/recipes-kernel/linux/linux-yocto_4.1.bb index b554877827..19f321721c 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.1.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "c8ab8bf2bdff3b355710065725f4e272bf0a5a5d" -SRCREV_machine_qemuarm64 ?= "fec49247816d7045aa8abe0047bcd4737af9a853" -SRCREV_machine_qemumips ?= "475a0182d9e940351a3fecaecb31e55effad45ad" -SRCREV_machine_qemuppc ?= "88a3e5a3a8f693d25b09b64cd2be5df783933f74" -SRCREV_machine_qemux86 ?= "fec49247816d7045aa8abe0047bcd4737af9a853" -SRCREV_machine_qemux86-64 ?= "fec49247816d7045aa8abe0047bcd4737af9a853" -SRCREV_machine_qemumips64 ?= "9ffd7155a07e7cfed2229b3a78d2278f3b56f13d" -SRCREV_machine ?= "fec49247816d7045aa8abe0047bcd4737af9a853" -SRCREV_meta ?= "44719fa8f73fd7c444044ad3c04f5fc66f57b993" +SRCREV_machine_qemuarm ?= "0ec64d1dadd3de6736b5b9acd5ffc7b3b9a22071" +SRCREV_machine_qemuarm64 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" +SRCREV_machine_qemumips ?= "8d5c7074354cef47bbc2e3aabd926a3409f02b12" +SRCREV_machine_qemuppc ?= "11c828d1e438aba1be93c4e19cb458f6391c3aa6" +SRCREV_machine_qemux86 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" +SRCREV_machine_qemux86-64 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" +SRCREV_machine_qemumips64 ?= "03a03f3543a050b8a83618ed25d408beaa099371" +SRCREV_machine ?= "61d2bedf25deac15c19413ee1b057067657d97d3" +SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.1.36" +LINUX_VERSION ?= "4.1.37" PV = "${LINUX_VERSION}+git${SRCPV}" From e309d144d7e95fe7d6a6edd4b013c7291bab735d Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Fri, 13 Jan 2017 16:06:05 -0500 Subject: [PATCH 047/129] linux-yocto/4.8: update to -rt10 Paul Gortmaker has updated 4.8 to the latest -rt release. This integrates those changes to standard/preempt-rt/*. As usual the branches are kept fast forward, and a clean copy of the patches can be found on standard/preempt-rt/rebase. (From OE-Core rev: f20ab66d2d012c535755af556d81412d5182cefd) Signed-off-by: Bruce Ashfield Signed-off-by: Ross Burton (cherry picked from commit 9b4a71785221e2b67180fe6047e2ba2ad83f6523) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb | 4 ++-- meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb | 2 +- meta/recipes-kernel/linux/linux-yocto_4.8.bb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb index cd7c4d6e9b..97adfddf8d 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb @@ -11,8 +11,8 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "8fddffd5588e14ad3bb5297dbc5b9c4a1047238c" -SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" +SRCREV_machine ?= "9c4f52cb2bafd9657c51cef2166db2b73a95aaa9" +SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb index 89b6016967..11b0dc9ea4 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb @@ -10,7 +10,7 @@ KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" SRCREV_machine ?= "b62f29ac5c15d6333a13811db030d704b35ace8f" -SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" +SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.8.bb b/meta/recipes-kernel/linux/linux-yocto_4.8.bb index a81128a0b9..0ebd071463 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.8.bb @@ -19,7 +19,7 @@ SRCREV_machine_qemux86 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" SRCREV_machine_qemux86-64 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" SRCREV_machine_qemumips64 ?= "b90b544d7a5b004b635cf337b29e15294cb17553" SRCREV_machine ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" -SRCREV_meta ?= "7b320e0a54be4b2d9bbaf4eb6165532e3954ad3e" +SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" From 15e0b3178f0b48a645e375a1523ef27352708d54 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 14 Feb 2017 16:14:17 -0500 Subject: [PATCH 048/129] linux-yocto/4.8: update to v4.8.18 Paul Gortmaker has started doing 4.8 -stable updates. This integrates his 4.8.18 queue from: git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux-4.8.y.git Change log is as follows: 28dda89acd7c Linux 4.8.18 936e79682048 tick/broadcast: Prevent NULL pointer dereference f22b03e15427 clocksource/dummy_timer: Move hotplug callback after the real timers 8f78db7e5df0 xfs: use GPF_NOFS when allocating btree cursors 1d818a81bac6 xfs: ignore leaf attr ichdr.count in verifier during log replay 62ef2c9c1d94 xfs: don't allow di_size with high bit set db28776559c7 xfs: error out if trying to add attrs and anextents > 0 fb70f2a64910 xfs: don't crash if reading a directory results in an unexpected hole ebff27d76e7e xfs: complain if we don't get nextents bmap records 14c3f0b270aa xfs: check for bogus values in btree block headers 31f0f90742a3 xfs: pass state not whichfork to trace_xfs_extlist 430a362685e9 xfs: Move AGI buffer type setting to xfs_read_agi 20aa52b53586 xfs: new inode extent list lookup helpers c7b75fcea4e6 xfs: fix unbalanced inode reclaim flush locking e89df591f833 xfs: check minimum block size for CRC filesystems b04a2c02f4d7 xfs: provide helper for counting extents from if_bytes f4e7f4cd52b1 xfs: don't BUG() on mixed direct and mapped I/O 49f159ae6e80 xfs: check return value of _trans_reserve_quota_nblks 23bb39fdbb96 xfs: don't call xfs_sb_quota_from_disk twice d3c7d2aa00d4 tpm_tis: Check return values from get_burstcount. 9fc58e555d78 drm/i915/gen9: fix the WM memory bandwidth WA for Y tiling cases 4f075608d2c4 drm/i915/gen9: unconditionally apply the memory bandwidth WA 55e9c9d00d70 drm/i915: disable PSR by default on HSW/BDW 2c266a9a3631 drm/radeon: Always store CRTC relative radeon_crtc->cursor_x/y values e4d1900e15db s390/topology: always use s390 specific sched_domain_topology_level b04e5322d8a4 powerpc/pci/rpadlpar: Fix device reference leaks 458e63f135d6 PCI: Enable access to non-standard VPD for Chelsio devices (cxgb3) 05a725c46f56 PCI: Support INTx masking on ConnectX-4 with firmware x.14.1100+ 8d12795b1eac PCI: Convert Mellanox broken INTx quirks to be for listed devices only 24af87eb2ffa PCI: Convert broken INTx masking quirks from HEADER to FINAL ec9f277f52e9 PCI: Add Mellanox device IDs 9e7c8ebc1316 staging: media: davinci_vpfe: unlock on error in vpfe_reqbufs() 8c6c73a692c9 f2fs: hide a maybe-uninitialized warning a91f2c1d4f45 f2fs: remove percpu_count due to performance regression 93634e1cc928 md: MD_RECOVERY_NEEDED is set for mddev->recovery 239b31c50bde crypto: arm64/aes-ce - fix for big endian a3141467e092 crypto: arm64/aes-xts-ce: fix for big endian 7c26ef18f05a crypto: arm64/sha1-ce - fix for big endian cb70151453a1 crypto: arm64/aes-neon - fix for big endian c1c451bea4af crypto: arm64/aes-ccm-ce: fix for big endian c4957563b255 crypto: arm/aes-ce - fix for big endian dcb0c4ebc7ad crypto: arm64/ghash-ce - fix for big endian d60ecc7f02a4 crypto: arm64/sha2-ce - fix for big endian f9315853c7c1 s390/crypto: unlock on error in prng_tdes_read() a76c795f53e7 mm, compaction: fix NR_ISOLATED_* stats for pfn based migration d3b82f9a9716 mm: khugepaged: fix radix tree node leak in shmem collapse error path ab533014582f mm: khugepaged: close use-after-free race during shmem collapsing c9777f749c4c mm/hugetlb.c: use the right pte val for compare in hugetlb_cow 0ff00251359e mmc: mmc_test: Uninitialized return value abe558647a0f PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend b90b6b8cce53 irqchip/bcm7038-l1: Implement irq_cpu_offline() callback d6229a05dd06 ima: fix memory leak in ima_release_policy 8cbe9b689467 sbp-target: Fix second argument of percpu_ida_alloc() fed8068fd1de target/iscsi: Fix double free in lio_target_tiqn_addtpg() ec92af68808e scsi: mvsas: fix command_active typo efe08cc6939b ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call a5a550bd0768 ASoC: cht_bsw_rt5645: Fix leftover kmalloc 3fcdecb0f9f6 iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped 22604a045edb iommu/vt-d: Fix pasid table size encoding f7dd8813279b iommu/amd: Fix the left value check of cmd buffer 9a134d29af48 iommu/amd: Missing error code in amd_iommu_init_device() 35a294dd5723 clk: renesas: mstp: Support 8-bit registers for r7s72100 8a7022b2ffad clk: imx31: fix rewritten input argument of mx31_clocks_init() 8b4940dd9224 clk: sunxi-ng: sun8i-h3: Set CLK_SET_RATE_PARENT for audio module clocks a13af6a13e68 clk: ti: dra7: fix "failed to lookup clock node gmac_gmii_ref_clk_div" boot message c54f34533601 clk: clk-wm831x: fix a logic error 36c3481984b5 clk: qcom: ipq806x: Fix board clk rates fdd91f12bebc hwmon: (g762) Fix overflows and crash seen when writing limit attributes 18d749bb756f hwmon: (nct7802) Fix overflows seen when writing into limit attributes 1e6b9473280a hwmon: (ds620) Fix overflows seen when writing temperature limits 0bc18f1d87d9 hwmon: (amc6821) sign extension temperature 4c8493cb90b9 hwmon: (scpi) Fix module autoload d618b1647e27 platform/x86: fujitsu-laptop: use brightness_set_blocking for LED-setting callbacks b803e5984015 x86/cpu: Probe CPUID leaf 6 even when cpuid_level == 6 1121b5f49eb7 debugfs: improve DEFINE_DEBUGFS_ATTRIBUTE for !CONFIG_DEBUG_FS f4b9eaba036c clk: renesas: cpg-mssr: Fix inverted debug check a25cb9b5744b efi/efivar_ssdt_load: Don't return success on allocation failure b36f676475bd cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected 40b0bbe612bb ath10k: use the right length of "background" 3e0f61361a82 nl80211: Use different attrs for BSSID and random MAC addr in scan req 3d04e6a06abc mac80211: fix tid_agg_rx NULL dereference f4ded840a335 drm/i915: tune down the fast link training vs boot fail 2ed2b3cc6ae3 drm/i915/dp: add lane_count check in intel_dp_check_link_status ac2370c93a40 usb: dwc3: gadget: always unmap EP0 requests 6039272a760e usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() 4f76ead23734 usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() 7acc87fae524 iio: accel: st_accel: fix LIS3LV02 reading and scaling d59378efa7ac staging: iio: ad7606: fix improper setting of oversampling pins 401316ef7253 mei: move write cb to completion on credentials failures 3ab87b8fd267 mei: bus: fix mei_cldev_enable KDoc c103d55bb7d7 USB: serial: io_ti: bind to interface after fw download d302588a910f ARM: dts: sun7i: bananapi-m1-plus: Enable USB PHY for USB host support 56dce131ec69 arm64: dts: hip06: Correct hardware pin number of usb node 0c03658a3e7b USB: phy: am335x-control: fix device and of_node leaks 518a4d8d533c ARM: dts: r8a7794: Correct hsusb parent clock 7780eb2fd54b usb: gadget: Fix second argument of percpu_ida_alloc() a3ff51875d83 USB: serial: kl5kusb105: abort on open exception path 5f8a0a2fd33b ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() fb106dc8b847 usb: musb: blackfin: add bfin_fifo_offset in bfin_ops 1bff22506598 usb: gadget: udc: core: fix return code of usb_gadget_probe_driver() c7c4ad7fce6d usb: hub: Move hub_port_disable() to fix warning if PM is disabled b7fb0479ecd6 usb: musb: Fix trying to free already-free IRQ 4 217c03eaf10c usb: dwc3: gadget: Fix full speed mode 7de3c659811a usb: dwc3: pci: Fix dr_mode misspelling 6fdac0047799 usb: dwc3: pci: add Intel Gemini Lake PCI ID 220d6521aac2 xhci: Fix race related to abort operation d3f3b0bd0756 xhci: Use delayed_work instead of timer for command timeout 0da62a5b5242 usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL 997d598c694f USB: serial: mos7720: fix parallel probe eb9e22ac9265 USB: serial: mos7720: fix parport use-after-free on probe errors c91243377c8d USB: serial: mos7720: fix use-after-free on probe errors b756fba5e563 USB: serial: mos7720: fix NULL-deref at open 8cc2ae8e130e USB: serial: mos7840: fix NULL-deref at open 68ab1ccfc085 USB: serial: kobil_sct: fix NULL-deref in write 37ca8378e77c USB: serial: cyberjack: fix NULL-deref at open fd435e99f5ed USB: serial: oti6858: fix NULL-deref at open 1653f66ba3fb USB: serial: io_edgeport: fix NULL-deref at open 73ec9d58b1c7 USB: serial: ti_usb_3410_5052: fix NULL-deref at open d1706b42d164 USB: serial: garmin_gps: fix memory leak on failed URB submit b653000d9b0c USB: serial: iuu_phoenix: fix NULL-deref at open 427bac51ce67 USB: serial: io_ti: fix I/O after disconnect 59f740cd834c USB: serial: io_ti: fix another NULL-deref at open 2ef82cf063c8 USB: serial: io_ti: fix NULL-deref at open 8d5f29b2d578 USB: serial: spcp8x5: fix NULL-deref at open e1fe8df45b74 USB: serial: keyspan_pda: verify endpoints at probe 10da95b6a2eb USB: serial: pl2303: fix NULL-deref at open e29498ba6e1f USB: serial: quatech2: fix sleep-while-atomic in close 05859d754d6f USB: serial: omninet: fix NULL-derefs at open and disconnect be17e1c916ce usb: return error code when platform_get_irq fails 0e9fc72194ce usb: xhci: hold lock over xhci_abort_cmd_ring() 527f810d8a86 xhci: Handle command completion and timeout race c18ca85fd6de usb: host: xhci: Fix possible wild pointer when handling abort command 67a7de5a2f35 usb: xhci: fix return value of xhci_setup_device() 775a2bec9cdf xhci: free xhci virtual devices with leaf nodes first 80c502e0ce6f usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake d3a9f7c7e8c4 usb: xhci: fix possible wild pointer 5ded28d83128 usb: gadget: composite: Test get_alt() presence instead of set_alt() 16718d267e09 USB: dummy-hcd: fix bug in stop_activity (handle ep0) 47acb8434892 USB: fix problems with duplicate endpoint addresses a45f34e820c6 USB: gadgetfs: fix checks of wTotalLength in config descriptors 27b4d04d1b87 USB: gadgetfs: fix use-after-free bug cd4da96b1bac USB: gadgetfs: fix unbounded memory allocation bug 1fa95887b663 usb: gadgetfs: restrict upper bound on device configuration size e4efa88511eb usb: storage: unusual_uas: Add JMicron JMS56x to unusual device 05ace125078d usb: musb: dsps: implement clear_ep_rxintr() callback 38caa4d8986e usb: musb: core: add clear_ep_rxintr() to musb_platform_ops 483c56831853 KVM: MIPS: Flush KVM entry code from icache globally 08aa895b61e1 KVM: MIPS: Don't clobber CP0_Status.UX d33b04df932e KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS e3843cdbf81a drm/i915: Force VDD off on the new power seqeuencer before starting to use it dbce182845b4 gcc-plugins: update gcc-common.h for gcc-7 970150316c04 mac80211: initialize fast-xmit 'info' later cf3b94f8fe70 ARM: davinci: da850: don't add emac clock to lookup table twice 391c21a9ab0a parisc: Mark cr16 clocksource unstable on SMP systems 684f6df20889 fscrypt: fix renaming and linking special files 6c55d3ad7fb3 ALSA: usb-audio: Fix irq/process data synchronization 3074297922e2 ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL 81a35981225c ALSA: hda - Fix up GPIO for ASUS ROG Ranger 576b9d7789d8 iio: bmi160: Fix time needed to sleep after command execution ad2a1ae984c6 iio: max44000: correct value in illuminance_integration_time_available ee8e4a73dbf6 iio: common: st_sensors: fix channel data parsing (From OE-Core rev: dc5cb390c5563c5d839c29cf3f85c2317f7cff64) Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie (cherry picked from commit 1a3daa89e28d58d35692cd2ae2af3e49c9f536fb) fix merge conflict do to changes in master Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.8.bb | 6 +++--- .../linux/linux-yocto-tiny_4.8.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.8.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb index 97adfddf8d..65f74b1516 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "9c4f52cb2bafd9657c51cef2166db2b73a95aaa9" -SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" +SRCREV_machine ?= "ffd0a071c2df55ecb2bb1f101465df93a81093b5" +SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.17" +LINUX_VERSION ?= "4.8.18" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb index 11b0dc9ea4..52e2b5233b 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.8.17" +LINUX_VERSION ?= "4.8.18" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "b62f29ac5c15d6333a13811db030d704b35ace8f" -SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" +SRCREV_machine ?= "db2e91ce904f32347ccf739de969b4216cbcaf92" +SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.8.bb b/meta/recipes-kernel/linux/linux-yocto_4.8.bb index 0ebd071463..a56ecdf23c 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.8.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "16f32b5197fbaec1dbf4f380015792ed47322f06" -SRCREV_machine_qemuarm64 ?= "38631cc4a8f89fb9547af9e44213971a5b360a36" -SRCREV_machine_qemumips ?= "bcbe7a7845e3061998a740f12e88a792f358393e" -SRCREV_machine_qemuppc ?= "4858eec374ee4b09e4428895141ad1ed26fb6d64" -SRCREV_machine_qemux86 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" -SRCREV_machine_qemux86-64 ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" -SRCREV_machine_qemumips64 ?= "b90b544d7a5b004b635cf337b29e15294cb17553" -SRCREV_machine ?= "9bcb4ea3fa107f1a8790c8c3408eb250e8d1d66e" -SRCREV_meta ?= "3edb4de355873d32da9307a011adea2542bd05a7" +SRCREV_machine_qemuarm ?= "c0123490bb9b454a43c3573e2573b491e0c09701" +SRCREV_machine_qemuarm64 ?= "304f750aa5be0bf66f70720d68f16865d912ff9f" +SRCREV_machine_qemumips ?= "aa15b7a291ca18d08fd640932efad673f6b278c3" +SRCREV_machine_qemuppc ?= "d2c3ea488fe179898ae853cb9565cb7ac62291c6" +SRCREV_machine_qemux86 ?= "c50f695341260d4757af64d809390610aae213e1" +SRCREV_machine_qemux86-64 ?= "c50f695341260d4757af64d809390610aae213e1" +SRCREV_machine_qemumips64 ?= "40a880b0f21aa09f3b52d68969339d80f9cc10ad" +SRCREV_machine ?= "c50f695341260d4757af64d809390610aae213e1" +SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.17" +LINUX_VERSION ?= "4.8.18" PV = "${LINUX_VERSION}+git${SRCPV}" From 4eb24dc6acc1407c4d1096524221a888c84bf332 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 14 Mar 2017 09:31:18 -0400 Subject: [PATCH 049/129] linux-yocto/4.1: update to v4.1.38 Updating to the korg 4.1.38 -stable release with the following changes: f40b3cc69de8 Linux 4.1.38 d8435bb5e8fb gro: Allow tunnel stacking in the case of FOU/GUE 066b300e5be4 tunnels: Don't apply GRO to multiple layers of encapsulation. b11e1542feca net: ipv4: Convert IP network timestamps to be y2038 safe 5023ae270216 ipip: Properly mark ipip GRO packets as encapsulated. 3e3267311e3b sg_write()/bsg_write() is not fit to be called under KERNEL_DS 363f1a90b7f3 fs: exec: apply CLOEXEC before changing dumpable task flags c63e64ae7665 IB/cma: Fix a race condition in iboe_addr_get_sgid() 6242668e855c Revert "ALSA: usb-audio: Fix race at stopping the stream" dd5035276792 kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF) 6fdb4af13f9f drivers/gpu/drm/ast: Fix infinite loop if read fails d1b9fb84c423 target/user: Fix use-after-free of tcmu_cmds if they are expired bbe48c2f932e kernel/debug/debug_core.c: more properly delay for secondary CPUs 1b51fce881b2 scsi: avoid a permanent stop of the scsi device's request queue f413092ea8e0 IB/multicast: Check ib_find_pkey() return value 8c84816cedcb IPoIB: Avoid reading an uninitialized member variable 5eba61298b74 block_dev: don't test bdev->bd_contains when it is not stable 25e9e2367457 btrfs: limit async_work allocation and worker func duration ced9b7a66a35 mm/vmscan.c: set correct defer count for shrinker a62e45871b7b Input: drv260x - fix input device's parent assignment e1589b27ffb9 libceph: verify authorize reply on connect ed21b94ebbf4 ALSA: hiface: Fix M2Tech hiFace driver sampling rate change f8c36e2b98b7 s390/vmlogrdr: fix IUCV buffer allocation 0848a2672eb3 kconfig/nconf: Fix hang when editing symbol with a long prompt 7b53fb41d447 SUNRPC: fix refcounting problems with auth_gss messages. 14927595fec9 ext4: return -ENOMEM instead of success 576cfe615feb nfs_write_end(): fix handling of short copies 77f3c11c13dd fgraph: Handle a case where a tracer ignores set_graph_notrace 29955c9a00d5 timekeeping_Force_unsigned_clocksource_to_nanoseconds_conversion 951f4b1f13a7 USB: serial: option: add dlink dwm-158 0c4f2f61d68f USB: serial: option: add support for Telit LE922A PIDs 0x1040, 0x1041 0a32f5b4f72d ALSA: usb-audio: Add QuickCam Communicate Deluxe/S7500 to volume_control_quirks 1d53a630766e dm space map metadata: fix 'struct sm_metadata' leak on failed create 67bcfac25cb8 arm/xen: Use alloc_percpu rather than __alloc_percpu d09b66f9e70b drm/radeon: add additional pci revision to dpm workaround e9631583d6c0 drm/radeon: Hide the HW cursor while it's out of bounds beeda93356ae drm/radeon: Always store CRTC relative radeon_crtc->cursor_x/y values 7198dbbaa242 drm/radeon: Also call cursor_move_locked when the cursor size changes 15a12fbbf365 CIFS: Fix a possible memory corruption during reconnect 51fce08b64ec CIFS: Fix a possible memory corruption in push locks 7f16769173df CIFS: Fix missing nls unload in smb2_reconnect() 0ee8faf89305 USB: cdc-acm: add device id for GW Instek AFG-125 a2080cc28041 mmc: sdhci: Fix recovery from tuning timeout 2a1dc36fdc71 ALSA: usb-audio: Fix race at stopping the stream 93f5b2b5d28b xfs: set AGI buffer type in xlog_recover_clear_agi_bucket 73e7d7aef06c block: protect iterate_bdevs() against concurrent close a6d0744b18ae ASoC: intel: Fix crash at suspend/resume without card registration 90604ed2f10c Btrfs: fix tree search logic when replaying directory entry deletes 575b6eddbf73 Btrfs: fix deadlock caused by fsync when logging directory entries 32a27da220fb powerpc/ps3: Fix system hang with GCC 5 builds 07340eaf0743 USB: serial: kl5kusb105: fix open error path b4fa7414cb79 thermal: hwmon: Properly report critical temperature in sysfs 3225aec938da md/raid5: limit request size according to implementation limits 93da0de16c94 firmware: fix usermode helper fallback loading d7a1bfa59593 xen/gntdev: Use VM_MIXEDMAP instead of VM_IO to avoid NUMA balancing 315419538d84 tpm xen: Remove bogus tpm_chip_unregister fee2ddaee775 f2fs: set ->owner for debugfs status file's file_operations f52d439916f0 ALSA: hda - fix headset-mic problem on a Dell laptop 506d7d521174 dm crypt: mark key as invalid until properly loaded 4a7036809383 KVM: PPC: Book3S HV: Don't lose hardware R/C bit updates in H_PROTECT ec05ce11c1e9 KVM: PPC: Book3S HV: Save/restore XER in checkpointed register state b1a758009739 ext4: add sanity checking to count_overhead() 31eb998aa42d ext4: use more strict checks for inodes_per_block on mount 526cfedac0b3 ext4: sanity check the block and cluster size at mount time c2404d06b82e usb: hub: Fix auto-remount of safely removed or ejected USB-3 devices 2861b336b594 ssb: Fix error routine when fallback SPROM fails 44ef406441e2 ath9k: Really fix LED polarity for some Mini PCI AR9220 MB92 cards. be733405b057 staging: comedi: ni_mio_common: fix M Series ni_ai_insn_read() data mask 9d45d2e79800 ext4: fix stack memory corruption with 64k block size d6ddc9cf431b ext4: fix mballoc breakage with 64k block size b3409ef1849b loop: return proper error from loop_queue_rq() 9e19c28455b3 crypto: caam - fix AEAD givenc descriptors 332086b806ac regulator: stw481x-vmmc: fix ages old enable error 9e4033f56d3d USB: UHCI: report non-PME wakeup signalling for Intel hardware 257cb82ee6d7 PCI: Check for PME in targeted sleep state 78ef3e710efd scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset 28a8e88f1d2f drm/gma500: Add compat ioctl 6ec54b062038 usb: gadget: composite: correctly initialize ep->maxpacket 33166482bf49 drm/i915: Unalias obj->phys_handle and obj->userptr d7633e23c7f6 drm/i915/gen9: fix the WaWmMemoryReadLatency implementation (From OE-Core rev: 96172bb6be3d4baf140b3b7db326930162103ab3) Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie (cherry picked from commit b60f1f2e0a5db22b466c8c812dea1716787c0d9a) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.1.bb | 6 +++--- .../linux/linux-yocto-tiny_4.1.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.1.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb index 112c02ce4d..0e413f006b 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.1.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "109fa96e6ae89b0585e78186b374b57b9f37fcbb" -SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" +SRCREV_machine ?= "f793c71d51277bdb14d6854c8cbcc09b4f5936b4" +SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.1.37" +LINUX_VERSION ?= "4.1.38" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb index ed5a70b43c..ce8aea628b 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.1.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.1.37" +LINUX_VERSION ?= "4.1.38" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "61d2bedf25deac15c19413ee1b057067657d97d3" -SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" +SRCREV_machine ?= "2ce56d130ddff67f43ec857cc51cd347666a0078" +SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.1.bb b/meta/recipes-kernel/linux/linux-yocto_4.1.bb index 19f321721c..bf7f266ee6 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.1.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.1.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "0ec64d1dadd3de6736b5b9acd5ffc7b3b9a22071" -SRCREV_machine_qemuarm64 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" -SRCREV_machine_qemumips ?= "8d5c7074354cef47bbc2e3aabd926a3409f02b12" -SRCREV_machine_qemuppc ?= "11c828d1e438aba1be93c4e19cb458f6391c3aa6" -SRCREV_machine_qemux86 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" -SRCREV_machine_qemux86-64 ?= "61d2bedf25deac15c19413ee1b057067657d97d3" -SRCREV_machine_qemumips64 ?= "03a03f3543a050b8a83618ed25d408beaa099371" -SRCREV_machine ?= "61d2bedf25deac15c19413ee1b057067657d97d3" -SRCREV_meta ?= "4de9b8f96c8dca0c55a496792a2ad4d2776e6657" +SRCREV_machine_qemuarm ?= "4d2c95e78cdc7d312b7ab231ce90dce317f45df9" +SRCREV_machine_qemuarm64 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078" +SRCREV_machine_qemumips ?= "81454f95166056a253c8950980e025ee243d8074" +SRCREV_machine_qemuppc ?= "42c41e606b70fd73a202f4146c0480f5624b0a0e" +SRCREV_machine_qemux86 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078" +SRCREV_machine_qemux86-64 ?= "2ce56d130ddff67f43ec857cc51cd347666a0078" +SRCREV_machine_qemumips64 ?= "8a481005da41f82d2a40bf8cb40334547160ab5b" +SRCREV_machine ?= "2ce56d130ddff67f43ec857cc51cd347666a0078" +SRCREV_meta ?= "7140ddb86e4b01529185e6d4a606001ad152b8f3" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.1.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.1;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.1.37" +LINUX_VERSION ?= "4.1.38" PV = "${LINUX_VERSION}+git${SRCPV}" From 18ae18f6ea02dbd9320f5852ae2d241648727d0d Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 14 Mar 2017 09:31:17 -0400 Subject: [PATCH 050/129] linux-yocto/4.4: update to v4.4.53 Updating from v4.4.41 to v4.4.53, with the following list of changes: 49616e715061 Linux 4.4.53 9cee69465035 scsi: lpfc: Correct WQ creation for pagesize 1d316060cad5 MIPS: IP22: Fix build error due to binutils 2.25 uselessnes. 4dd29050e46e MIPS: IP22: Reformat inline assembler code to modern standards. 15959b728d07 powerpc/xmon: Fix data-breakpoint afee78f03ee6 dmaengine: ipu: Make sure the interrupt routine checks all interrupts. 79a7ff1443bd bcma: use (get|put)_device when probing/removing device driver 5a1f03f1ee91 md linear: fix a race between linear_add() and linear_congested() 037cd23726b3 rtc: sun6i: Switch to the external oscillator ee360e99dae0 rtc: sun6i: Add some locking a0378b5bfc27 NFSv4: fix getacl ERANGE for some ACL buffer sizes 5d23e89065cd NFSv4: fix getacl head length estimation 52fb4bdcea4c NFSv4: Fix memory and state leak in _nfs4_open_and_get_state 3ee4f442e5b3 nfsd: special case truncates some more 6030493a3422 nfsd: minor nfsd_setattr cleanup 781e6a08381d rtlwifi: rtl8192c-common: Fix "BUG: KASAN: 6e10c33cb87a rtlwifi: Fix alignment issues 70a09029b7be gfs2: Add missing rcu locking for glock lookup 44dd30e04c1f rdma_cm: fail iwarp accepts w/o connection params 88326fe95f59 RDMA/core: Fix incorrect structure packing for booleans f414af249f1e Drivers: hv: util: Backup: Fix a rescind processing issue 9b45ab285388 Drivers: hv: util: Fcopy: Fix a rescind processing issue abaeda7f709a Drivers: hv: util: kvp: Fix a rescind processing issue 862d2b7d21d3 hv: init percpu_list in hv_synic_alloc() 374907e8d116 hv: allocate synic pages for all present CPUs 80190fcc48f6 usb: gadget: udc: fsl: Add missing complete function. 61e9e9bcfd7b usb: host: xhci: plat: check hcc_params after add hcd 900466a746f5 usb: musb: da8xx: Remove CPPI 3.0 quirk and methods 89eb5ed1536e w1: ds2490: USB transfer buffers need to be DMAable 1df66c452471 w1: don't leak refcount on slave attach failure in w1_attach_slave_device() 20bc8a897e48 can: usb_8dev: Fix memory leak of priv->cmd_msg_buffer 3584716db12a iio: pressure: mpl3115: do not rely on structure field ordering 2ab6b8c7172c iio: pressure: mpl115: do not rely on structure field ordering e83a28c521a6 arm/arm64: KVM: Enforce unconditional flush to PoC when mapping to stage-2 d4a8db66b946 fuse: add missing FR_FORCE 434ed4aff140 crypto: testmgr - Pad aes_ccm_enc_tv_template vector 7666ef1a36cc ath9k: use correct OTP register offsets for the AR9340 and AR9550 1aeced70f77d ath9k: fix race condition in enabling/disabling IRQs dc7bbf895e43 ath5k: drop bogus warning on drv_set_key with unsupported cipher 6af0acc0b69f target: Fix multi-session dynamic se_node_acl double free OOPs 4a3c526ced41 target: Obtain se_node_acl->acl_kref during get_initiator_node_acl da259399e487 samples/seccomp: fix 64-bit comparison macros 6ad4196f1952 ext4: return EROFS if device is r/o and journal replay is needed 9a79248c083d ext4: preserve the needs_recovery flag when the journal is aborted 6ec4583e9b03 ext4: fix inline data error paths 9d636818dbac ext4: fix data corruption in data=journal mode 8774c73cf696 ext4: trim allocation requests to group size a3068b3e8066 ext4: do not polute the extents cache while shifting extents 3daefdae5f8b ext4: Include forgotten start block on fallocate insert range cd3db55c64ae loop: fix LO_FLAGS_PARTSCAN hang 356d71df7398 block/loop: fix race between I/O and set_status 973f40f368f7 jbd2: don't leak modified metadata buffers on an aborted journal c0ef1f537a97 Fix: Disable sys_membarrier when nohz_full is enabled ea240cfed99b sd: get disk reference in sd_check_events() 33950b56d2c2 scsi: use 'scsi_device_from_queue()' for scsi_dh 2dc9a859eb89 scsi: aacraid: Reorder Adapter status check 18dbfcae65a3 scsi: storvsc: properly set residual data length on errors 80bccab34a57 scsi: storvsc: properly handle SRB_ERROR when sense message is present 5cdc8193ac38 scsi: storvsc: use tagged SRB requests if supported by the device 6a284310d5dd dm stats: fix a leaked s->histogram_boundaries array fdea1f972158 dm cache: fix corruption seen when using cache > 2TB f0ae01568e0c ipc/shm: Fix shmat mmap nil-page protection c5c893e7c44e mm: do not access page->mapping directly on page_endio 66f43a576879 mm: vmpressure: fix sending wrong events on underflow 612e4679b865 mm/page_alloc: fix nodes for reclaim in fast path 31dac0e870dd iommu/vt-d: Tylersburg isoch identity map check is done too late. 07852563dba6 iommu/vt-d: Fix some macros that are incorrectly specified in intel-iommu 5cc0cd0e3a5a regulator: Fix regulator_summary for deviceless consumers 272d60bfce0e staging: rtl: fix possible NULL pointer dereference 8c8f42c9a4a7 ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine cd585d3ba5c8 ALSA: hda - Add subwoofer support for Dell Inspiron 17 7000 Gaming 003aa343724f ALSA: seq: Fix link corruption by event error handling 70dbc00f7e11 ALSA: ctxfi: Fallback DMA mask to 32bit 9879f9d01a3c ALSA: timer: Reject user params with too small ticks b9bf1f0657c5 ALSA: hda - fix Lewisburg audio issue 1f4f37076d52 ALSA: hda/realtek - Cannot adjust speaker's volume on a Dell AIO 6b1d7b6f54c7 ARM: dts: at91: Enable DMA on sama5d2_xplained console be83ed085fcd ARM: dts: at91: Enable DMA on sama5d4_xplained console b401418c6cc3 ARM: at91: define LPDDR types f3a0b2004080 media: fix dm1105.c build error b0bde9f6a057 uvcvideo: Fix a wrong macro 5988e7320179 am437x-vpfe: always assign bpp variable ab7546e49100 MIPS: Handle microMIPS jumps in the same way as MIPS32/MIPS64 jumps cc387ae0898e MIPS: Calculate microMIPS ra properly when unwinding the stack d75d675a0552 MIPS: Fix is_jump_ins() handling of 16b microMIPS instructions 72a0cfae59b4 MIPS: Fix get_frame_info() handling of microMIPS function size 2998bf60d385 MIPS: Prevent unaligned accesses during stack unwinding 0d45490221a2 MIPS: Clear ISA bit correctly in get_frame_info() f1be0f5814a6 MIPS: Lantiq: Keep ethernet enabled during boot 093292b8f8f7 MIPS: OCTEON: Fix copy_from_user fault handling for large buffers b32e43cf3f74 MIPS: BCM47XX: Fix button inversion for Asus WL-500W 5636da7aba4d MIPS: Fix special case in 64 bit IP checksumming. faf6aa4b129d samples: move mic/mpssd example code from Documentation dd4534d88b93 Linux 4.4.52 c171caf7be28 kvm: vmx: ensure VMCS is current while enabling PML e0913cc300c7 Revert "usb: chipidea: imx: enable CI_HDRC_SET_NON_ZERO_TTHA" 151d4c0fb55b rtlwifi: rtl_usb: Fix for URB leaking when doing ifconfig up/down de5634875b60 block: fix double-free in the failure path of cgwb_bdi_init() 15696979d80f goldfish: Sanitize the broken interrupt handler d7f97304a485 x86/platform/goldfish: Prevent unconditional loading 67f47e57f9ca USB: serial: ark3116: fix register-accessor error handling b04a2ca5c4b3 USB: serial: opticon: fix CTS retrieval at open 06b1cf346a4d USB: serial: spcp8x5: fix modem-status handling 22034ee5dab8 USB: serial: ftdi_sio: fix line-status over-reporting cfad0817222d USB: serial: ftdi_sio: fix extreme low-latency setting af82872b65e0 USB: serial: ftdi_sio: fix modem-status error handling bcea8e993772 USB: serial: cp210x: add new IDs for GE Bx50v3 boards 1ae570ab1c06 USB: serial: mos7840: fix another NULL-deref at open 04fae8abfaef tty: serial: msm: Fix module autoload 49ed6307508e net: socket: fix recvmmsg not returning error from sock_error ce9ecb8d7f3c ip: fix IP_CHECKSUM handling 353dd7290025 irda: Fix lockdep annotations in hashbin_delete(). a95df078e866 dccp: fix freeing skb too early for IPV6_RECVPKTINFO fe41cfb48f2d packet: Do not call fanout_release from atomic contexts abd672deb170 packet: fix races in fanout_add() 2b3eb43342a0 net/llc: avoid BUG_ON() in skb_orphan() e8330cb5ae47 blk-mq: really fix plug list flushing for nomerge queues f0414c1f8bb7 rtc: interface: ignore expired timers when enqueuing new timers a82ac399bcf2 rtlwifi: rtl_usb: Fix missing entry in USB driver's private data f1924ac09c96 Linux 4.4.51 5a86b1150f6c mmc: core: fix multi-bit bus width without high-speed mode 6f26f0ba2435 bcache: Make gc wakeup sane, remove set_task_state() aee7d0412f17 ntb_transport: Pick an unused queue c6c6851adbaf NTB: ntb_transport: fix debugfs_remove_recursive efa061998d22 printk: use rcuidle console tracepoint 6787d3ecbef7 ARM: 8658/1: uaccess: fix zeroing of 64-bit get_user() e6394c7d1c19 futex: Move futex_init() to core_initcall 906bb56e3a12 drm/dp/mst: fix kernel oops when turning off secondary monitor b32128386bf8 drm/radeon: Use mode h/vdisplay fields to hide out of bounds HW cursor c6cbae45a57f Input: elan_i2c - add ELAN0605 to the ACPI table 65de8bfbbe20 Fix missing sanity check in /dev/sg 8107096d243d scsi: don't BUG_ON() empty DMA transfers d7b146c69229 fuse: fix use after free issue in fuse_dev_do_read() 385a592dc7ce siano: make it work again with CONFIG_VMAP_STACK f9400118b015 vfs: fix uninitialized flags in splice_to_pipe() c50b74d88661 Linux 4.4.50 b9dee56027ae l2tp: do not use udp_ioctl() afb4feb8bfef ping: fix a null pointer dereference 9117c897c9aa packet: round up linear to header len 58691e5b4f27 net: introduce device min_header_len 6f99825e7632 sit: fix a double free on error path a4226c7ebfb5 sctp: avoid BUG_ON on sctp_wait_for_sndbuf f46f344841ec mlx4: Invoke softirqs after napi_reschedule 0db25098cb6c macvtap: read vnet_hdr_size once 625bd9e43b3b tun: read vnet_hdr_sz once 82e9f6b90a0e tcp: avoid infinite loop in tcp_splice_read() 96ada0a978fa ipv6: tcp: add a missing tcp_v6_restore_cb() eaa3a58f4503 ip6_gre: fix ip6gre_err() invalid reads 13c3646dac70 netlabel: out of bound access in cipso_v4_validate() 2d9c2e011fd3 ipv4: keep skb->dst around in presence of IP options 22449a01baa5 net: use a work queue to defer net_disable_timestamp() work f3ece3b38437 tcp: fix 0 divide in __tcp_select_window() 3f5b5134ec7c ipv6: pointer math error in ip6_tnl_parse_tlv_enc_lim() 41e07a7e01d9 ipv6: fix ip6_tnl_parse_tlv_enc_lim() e6c654c9c092 can: Fix kernel panic at security_sock_rcv_skb 702c0ce9a7c7 Linux 4.4.49 5b0465dd4ad4 drm/i915: fix use-after-free in page_flip_completed() a44ca389a736 ALSA: seq: Don't handle loop timeout at snd_seq_pool_done() e5f20a3fd6db ALSA: seq: Fix race at creating a queue 010ada0cfcb9 xen-netfront: Delete rx_refill_timer in xennet_disconnect_backend() 1c0da0ac217b scsi: mpt3sas: disable ASPM for MPI2 controllers 4d6bdf7c73e7 scsi: aacraid: Fix INTx/MSI-x issue with older controllers 52e02d6bf304 scsi: zfcp: fix use-after-free by not tracing WKA port open/close on failed send f2d256a2d49f netvsc: Set maximum GSO size in the right place b9c29d45f980 mac80211: Fix adding of mesh vendor IEs 2f46791849be ARM: 8642/1: LPAE: catch pending imprecise abort on unmask 04ed4a9e21f5 target: Fix COMPARE_AND_WRITE ref leak for non GOOD status 0c863accadb0 target: Fix early transport_generic_handle_tmr abort scenario ee44e73832c2 target: Use correct SCSI status during EXTENDED_COPY exception 44d03b9280ed target: Don't BUG_ON during NodeACL dynamic -> explicit conversion fcc038db5959 ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write cc187c6200f8 hns: avoid stack overflow with CONFIG_KASAN 3b7ff5ed114f cpumask: use nr_cpumask_bits for parsing functions fd96835e205d Revert "x86/ioapic: Restore IO-APIC irq_chip retrigger callback" e72c13d93e9e selinux: fix off-by-one in setprocattr e871ea6bcf99 ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup 6a1bd9063246 Linux 4.4.48 87ebcc534d47 base/memory, hotplug: fix a kernel oops in show_valid_zones() 374d06699537 x86/irq: Make irq activate operations symmetric 94c0517fd0cb USB: serial: option: add device ID for HP lt2523 (Novatel E371) 9cf89ade1afd usb: gadget: f_fs: Assorted buffer overflow checks. e4c1e6648298 USB: Add quirk for WORLDE easykey.25 MIDI keyboard b4b3442e5032 USB: serial: pl2303: add ATEN device ID 244e7f00035d USB: serial: qcserial: add Dell DW5570 QDL f4f09b79a0c4 KVM: x86: do not save guest-unsupported XSAVE state 8b51676d6cd9 HID: wacom: Fix poor prox handling in 'wacom_pl_irq' b3c8c31ed24c percpu-refcount: fix reference leak during percpu-atomic transition 3a8e217851c9 mmc: sdhci: Ignore unexpected CARD_INT interrupts 85fb980acb01 can: bcm: fix hrtimer/tasklet termination in bcm op removal 4025ab36c81c mm, fs: check for fatal signals in do_generic_file_read() e86a8769579e mm/memory_hotplug.c: check start_pfn in test_pages_in_a_zone() 920bba109299 cifs: initialize file_info_lock 7aeb95ceb84b zswap: disable changing params if init fails 5dadebc67586 svcrpc: fix oops in absence of krb5 module 2b4e56fde91b NFSD: Fix a null reference case in find_or_create_lock_stateid() f584bb6df7a2 powerpc: Add missing error check to prom_find_boot_cpu() 9b993e2c3df6 powerpc/eeh: Fix wrong flag passed to eeh_unfreeze_pe() db18e92ceb8d libata: apply MAX_SEC_1024 to all CX1-JB*-HP devices 579a917538f1 ata: sata_mv:- Handle return value of devm_ioremap. d49d465d178f perf/core: Fix PERF_RECORD_MMAP2 prot/flags for anonymous memory 72bb4b549085 crypto: arm64/aes-blk - honour iv_out requirement in CBC and CTR modes ae7d33f53a56 crypto: api - Clear CRYPTO_ALG_DEAD bit before registering an alg c4305f00852c drm/nouveau/nv1a,nv1f/disp: fix memory clock rate retrieval 2a3797ef69c5 drm/nouveau/disp/gt215: Fix HDA ELD handling (thus, HDMI audio) on gt215 e21a3cad35bc ext4: validate s_first_meta_bg at mount time 62e546b2d3a0 PCI/ASPM: Handle PCI-to-PCIe bridges as roots of PCIe hierarchies 4686ea264f1d Linux 4.4.47 384e4bf0def9 net: dsa: Bring back device detaching in dsa_slave_suspend() 74a7c39ec627 qmi_wwan/cdc_ether: add device ID for HP lt2523 (Novatel E371) WWAN card 0492a033fb71 af_unix: move unix_mknod() out of bindlock e674c70bafe7 r8152: don't execute runtime suspend if the tx is not empty 980b9afd9ecc bridge: netlink: call br_changelink() during br_dev_newlink() 8f9e4ad8d7f3 tcp: initialize max window for a new fastopen socket 8051bf2890e9 ipv6: addrconf: Avoid addrconf_disable_change() using RCU read-side lock 8a066a87025e net: phy: bcm63xx: Utilize correct config_intr function 6fec199362c4 net: fix harmonize_features() vs NETIF_F_HIGHDMA 4f5e54bdd052 ax25: Fix segfault after sock connection timeout 062b7f35ff6c ravb: do not use zero-length alignment DMA descriptor 7d691d89eed0 openvswitch: maintain correct checksum state in conntrack actions b82981fb273d tcp: fix tcp_fastopen unaligned access complaints on sparc ec9e993f30f6 net: systemport: Decouple flow control from __bcm_sysport_tx_reclaim 40e7c725ab0f net: ipv4: fix table id in getroute response 2e84b8ce6fc3 net: lwtunnel: Handle lwtunnel_fill_encap failure 290db2cd517e mlxsw: pci: Fix EQE structure definition 811bb1b9d9ab mlxsw: switchx2: Fix memory leak at skb reallocation 9edb2d75d81b mlxsw: spectrum: Fix memory leak at skb reallocation 595ac452c451 r8152: fix the sw rx checksum is unavailable 6c1ed78cb074 Linux 4.4.46 d0721893214e mm, memcg: do not retry precharge charges 14b97492d6e1 platform/x86: intel_mid_powerbtn: Set IRQ_ONESHOT d430c37db796 pinctrl: broxton: Use correct PADCFGLOCK offset 5ddaf6804e24 s5k4ecgx: select CRC32 helper 5288474d2f48 IB/umem: Release pid in error and ODP flow e114e66eec3d IB/ipoib: move back IB LL address into the hard header 800a78f9e62b drm/i915: Don't leak edid in intel_crt_detect_ddc() d79e41188a1e SUNRPC: cleanup ida information when removing sunrpc module edef1086bf09 NFSv4.0: always send mode in SETATTR after EXCLUSIVE4 0f64f22c0686 nfs: Don't increment lock sequence ID after NFS4ERR_MOVED bde741e9cc23 parisc: Don't use BITS_PER_LONG in userspace-exported swab.h header acb63c8b576d ARC: [arcompact] handle unaligned access delay slot corner case 42ad7663677d ARC: udelay: fix inline assembler by adding LP_COUNT to clobber list bca1a95c9e20 can: ti_hecc: add missing prepare and unprepare of the clock 63fe33a78428 can: c_can_pci: fix null-pointer-deref in c_can_start() - set device pointer bae49e72f951 s390/ptrace: Preserve previous registers for short regset write 8637de3a318d RDMA/cma: Fix unknown symbol when CONFIG_IPV6 is not enabled d65032ab06f4 ISDN: eicon: silence misleading array-bounds warning d1b232c2ce53 sysctl: fix proc_doulongvec_ms_jiffies_minmax() f11e8bf8e99b mm/mempolicy.c: do not put mempolicy before using its nodemask c83ad9703e71 drm: Fix broken VT switch with video=1366x768 option 23bc4e136bca tile/ptrace: Preserve previous registers for short regset write 63db7c91a3c0 fbdev: color map copying bounds checking ef30573ef2b1 Linux 4.4.45 8323d0555fe3 arm64: avoid returning from bad_mode 6e65a4c698cf selftest/powerpc: Wrong PMC initialized in pmc56_overflow test a5291c1a9eae dmaengine: pl330: Fix runtime PM support for terminated transfers 238623ce487f ite-cir: initialize use_demodulator before using it b02d7a8219bc blackfin: check devm_pinctrl_get() for errors a4d2fa085b9a ARM: 8613/1: Fix the uaccess crash on PB11MPCore baa2610c4962 ARM: ux500: fix prcmu_is_cpu_in_wfi() calculation 68664ae14535 ARM: dts: imx6qdl-nitrogen6_max: fix sgtl5000 pinctrl init c55f8aaf4a19 arm64/ptrace: Reject attempts to set incomplete hardware breakpoint fields 4c87fc7f2059 arm64/ptrace: Avoid uninitialised struct padding in fpr_set() 03ee97d68d8b arm64/ptrace: Preserve previous registers for short regset write - 3 d8263f1753ce arm64/ptrace: Preserve previous registers for short regset write - 2 76e08d2966a9 arm64/ptrace: Preserve previous registers for short regset write 41a9abb0e06b ARM: dts: da850-evm: fix read access to SPI flash 62c3d36309d3 ceph: fix bad endianness handling in parse_reply_info_extra abfa5e8ae937 ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs 294b0aadc8c2 svcrdma: avoid duplicate dma unmapping during error recovery 098b62b757a4 clocksource/exynos_mct: Clear interrupt when cpu is shut down a07563c3cf05 ubifs: Fix journal replay wrt. xattr nodes 7ea1eb731453 qla2xxx: Fix crash due to null pointer access 86915782ff65 x86/ioapic: Restore IO-APIC irq_chip retrigger callback 212bab3c5b0b mtd: nand: xway: disable module support 80aeb7bf5ca0 ieee802154: atusb: do not use the stack for buffers to make them DMA able 8f6f508f70ff mmc: mxs-mmc: Fix additional cycles after transmission stop 75c60df15c85 HID: corsair: fix control-transfer error handling 0f37d20fdc70 HID: corsair: fix DMA buffers on stack 4740d1d7d429 PCI: Enumerate switches below PCI-to-PCIe bridges dc4e372f9a47 fuse: clear FR_PENDING flag when moving requests out of pending queue 6f3002c22087 svcrpc: don't leak contexts on PROC_DESTROY 3b434ca8592a x86/PCI: Ignore _CRS on Supermicro X8DTH-i/6/iF/6F 36672b8b99e2 tmpfs: clear S_ISGID when setting posix ACLs 39d7c9ce35a1 ARM: dts: imx31: fix AVIC base address d2e4968e3c0d ARM: dts: imx31: move CCM device node to AIPS2 bus devices 280d00a94293 ARM: dts: imx31: fix clock control module interrupts description 2ba399c693c0 perf scripting: Avoid leaking the scripting_context variable aa02f29e95f3 IB/IPoIB: Remove can't use GFP_NOIO warning ea470497eb31 IB/mlx4: When no DMFS for IPoIB, don't allow NET_IF QPs f1c9169478ca IB/mlx4: Fix port query for 56Gb Ethernet links c7a40c48f7a5 IB/mlx4: Fix out-of-range array index in destroy qp flow 1be54a4ec45a IB/mlx4: Set traffic class in AH 4ffb36efe22c IB/mlx5: Wait for all async command completions to complete 97085e2a386a ftrace/x86: Set ftrace_stub to weak to prevent gcc from using short jumps to it a7dd347a67c0 Linux 4.4.44 45611fb9e0af pinctrl: sh-pfc: Do not unconditionally support PIN_CONFIG_BIAS_DISABLE ef6eadbf7b16 powerpc/ibmebus: Fix device reference leaks in sysfs interface 488e7b2c5b6a powerpc/ibmebus: Fix further device reference leaks 4d1b5086f7e2 bus: vexpress-config: fix device reference leak 6e8210ad2585 blk-mq: Always schedule hctx->next_cpu ddf0c377bf82 ACPI / APEI: Fix NMI notification handling 4af7970b3593 block: cfq_cpd_alloc() should use @gfp 2c1dd423a567 cpufreq: powernv: Disable preemption while checking CPU throttling state 33ebdfe913fd NFSv4.1: nfs4_fl_prepare_ds must be careful about reporting success. 11804232d1ad NFS: Fix a performance regression in readdir 8ff851bf2240 pNFS: Fix race in pnfs_wait_on_layoutreturn 7aae6e3c0c52 pinctrl: meson: fix gpio request disabling other modes f0382c090a20 btrfs: fix error handling when run_delayed_extent_op fails 205e997acde7 btrfs: fix locking when we put back a delayed ref that's too new 68b97d287e28 x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option 0cf23324af1c USB: serial: ch341: fix modem-control and B0 handling 1d25a05642c8 USB: serial: ch341: fix resume after reset a1a0612b7dde drm/radeon: drop verde dpm quirks b9d6631395a1 sysctl: Drop reference added by grab_header in proc_sys_readdir ca81117b7432 sysrq: attach sysrq handler correctly for 32-bit kernel 075f493a974e tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx 4a6716f16517 mnt: Protect the mountpoint hashtable with mount_lock 836fd7c9e6e6 vme: Fix wrong pointer utilization in ca91cx42_slave_get d5fcd719e889 xhci: fix deadlock at host remove by running watchdog correctly ae76af251806 i2c: fix kernel memory disclosure in dev interface f64b9acc368c i2c: print correct device invalid address 085f4ebec797 Input: elants_i2c - avoid divide by 0 errors on bad touchscreen data 214a8e98e6bc USB: serial: ch341: fix open and resume after B0 802b4ef3b989 USB: serial: ch341: fix control-message error handling bc74606d8d80 USB: serial: ch341: fix open error handling e29f709c2f56 USB: serial: ch341: fix initial modem-control state 3ef5bc0b385f USB: serial: kl5kusb105: fix line-state error handling 4a1ecf37a59f nl80211: fix sched scan netlink socket owner destruction 9d3875c0c462 KVM: x86: Introduce segmented_write_std 3490e72ad6d0 KVM: x86: emulate FXSAVE and FXRSTOR d9c4c1e7c2cf KVM: x86: add asm_safe wrapper 4fa0090249fb KVM: x86: add Align16 instruction flag 1fc673d96f9d KVM: x86: flush pending lapic jump label updates on module unload 3d27cd4b2527 jump_labels: API for flushing deferred jump label updates 34a55c9d4a2d KVM: eventfd: fix NULL deref irqbypass consumer 816307c80d4d KVM: x86: fix emulation of "MOV SS, null selector" 1a46e6ecf896 mm/hugetlb.c: fix reservation race when freeing surplus pages 6bbb8ff3b68e ocfs2: fix crash caused by stale lvb with fsdlm plugin 70429b970bde mm: fix devm_memremap_pages crash, use mem_hotplug_{begin, done} 6de62ec07d2a selftests: do not require bash for the generated test 2deaeea23fbd selftests: do not require bash to run netsocktests testcase 2e2679a168fe Input: i8042 - add Pegatron touchpad to noloop table 51377793758a Input: xpad - use correct product id for x360w controllers d9ea51a9bea4 Linux 4.4.43 e21901d7a5eb mm/init: fix zone boundary creation e3f77bb158f9 ALSA: usb-audio: Add a quirk for Plantronics BT600 a1c81f839c6f spi: mvebu: fix baudrate calculation for armada variant dfd64d112a02 ARM: OMAP4+: Fix bad fallthrough for cpuidle 04dc1be104fe ARM: zynq: Reserve correct amount of non-DMA RAM bed280bbc995 powerpc: Fix build warning on 32-bit PPC fa48a1607580 ALSA: firewire-tascam: Fix to handle error from initialization of stream data a2f727149ee4 HID: hid-cypress: validate length of report 70e05a9f2f4f net: vrf: do not allow table id 0 c177d491a948 net: ipv4: Fix multipath selection with vrf 67b21973ecf4 gro: Disable frag0 optimization on IPv6 ext headers db7119eaacf4 gro: use min_t() in skb_gro_reset_offset() 5169043e9722 gro: Enter slow-path if there is no tailroom 0d3b9c2746d3 r8152: fix rx issue for runtime suspend c31a3c79928b r8152: split rtl8152_suspend function 807cac887d95 ipv4: Do not allow MAIN to be alias for new LOCAL w/ custom rules 0d431f94c181 igmp: Make igmp group member RFC 3376 compliant 14e8d568f14f drop_monitor: consider inserted data in genlmsg_end 81e7916476ca drop_monitor: add missing call to genlmsg_end 1ff0308f33ce net/mlx5: Avoid shadowing numa_node 18d971f84c84 net/mlx5: Check FW limitations on log_max_qp before setting it 3f2847608cb9 net: stmmac: Fix race between stmmac_drv_probe and stmmac_open 67bce5821c9a net, sched: fix soft lockup in tc_classify 58d0d7a45ef8 ipv6: handle -EFAULT from skb_copy_bits 6ac0b3810cdc net: vrf: Drop conntrack data after pass through VRF device on Tx 1e5298d4c82b ser_gigaset: return -ENOMEM on error instead of success 33c7b0f74c57 netvsc: reduce maximum GSO size 49c4446a2e13 Linux 4.4.42 adf640eaefac usb: gadget: composite: always set ep->mult to a sensible value f108b2de9cd0 Revert "usb: gadget: composite: always set ep->mult to a sensible value" 6053479cbbc5 tick/broadcast: Prevent NULL pointer dereference af817b3fc6e5 drm/radeon: Always store CRTC relative radeon_crtc->cursor_x/y values 9205be7fa632 cx23885-dvb: move initialization of a8293_pdata 6b59fb520123 net: vxge: avoid unused function warnings 8003ac65d0a5 net: ti: cpmac: Fix compiler warning due to type confusion becfb50c66cb cred/userns: define current_user_ns() as a function f5a636fd416f staging: comedi: dt282x: tidy up register bit defines 8f251525da14 powerpc/pci/rpadlpar: Fix device reference leaks ccd7bd29c2e6 md: MD_RECOVERY_NEEDED is set for mddev->recovery 1d3124821f3a crypto: arm64/aes-ce - fix for big endian 5b21c5489206 crypto: arm64/aes-xts-ce: fix for big endian abca9c2d2cab crypto: arm64/sha1-ce - fix for big endian 83f8a200af45 crypto: arm64/aes-neon - fix for big endian bd17e2d36615 crypto: arm64/aes-ccm-ce: fix for big endian bed5c78798e1 crypto: arm/aes-ce - fix for big endian 4c575a30db8c crypto: arm64/ghash-ce - fix for big endian 820c2ac4c9f4 crypto: arm64/sha2-ce - fix for big endian 6119edd2d87a s390/crypto: unlock on error in prng_tdes_read() 85baf9416b7e mmc: mmc_test: Uninitialized return value b0cb7f60998c PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend fc44d3d05478 irqchip/bcm7038-l1: Implement irq_cpu_offline() callback 69dc8473b750 target/iscsi: Fix double free in lio_target_tiqn_addtpg() e57c830c9041 scsi: mvsas: fix command_active typo 079c4b43e1fe ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call 83882724eb65 iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped 91bc81b9661c iommu/vt-d: Fix pasid table size encoding dc78a9e1b4f8 iommu/amd: Fix the left value check of cmd buffer b54dcc3b68ef iommu/amd: Missing error code in amd_iommu_init_device() 46105512474f clk: imx31: fix rewritten input argument of mx31_clocks_init() f371ee85268d clk: clk-wm831x: fix a logic error 92e993abb928 hwmon: (g762) Fix overflows and crash seen when writing limit attributes fd504f529160 hwmon: (nct7802) Fix overflows seen when writing into limit attributes 5e351caeaa96 hwmon: (ds620) Fix overflows seen when writing temperature limits fbab1832e7e8 hwmon: (amc6821) sign extension temperature 07c05622f63d hwmon: (scpi) Fix module autoload 9453d46a12ba cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected 8353a5deec10 ath10k: use the right length of "background" 56ef587b77fd stable-fixup: hotplug: fix unused function warning acb7df233b72 usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() ecd4ad9ab7e9 usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() efcd2e082f0f usb: dwc3: gadget: always unmap EP0 requests 7927c0314060 staging: iio: ad7606: fix improper setting of oversampling pins 3e4302f99aed mei: bus: fix mei_cldev_enable KDoc e94800df8c1f USB: serial: io_ti: bind to interface after fw download 1224bb23fe15 USB: phy: am335x-control: fix device and of_node leaks d36d0122ff51 ARM: dts: r8a7794: Correct hsusb parent clock de2cf4998a52 USB: serial: kl5kusb105: abort on open exception path f5531856c2c7 ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() d576c36a3e1f usb: musb: blackfin: add bfin_fifo_offset in bfin_ops e675483ee2f1 usb: hub: Move hub_port_disable() to fix warning if PM is disabled 02ef64ac647f usb: musb: Fix trying to free already-free IRQ 4 60dffc173220 usb: dwc3: pci: add Intel Gemini Lake PCI ID 59185ef00b46 xhci: Fix race related to abort operation ce737ba8e23e xhci: Use delayed_work instead of timer for command timeout b07b4fa72500 usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL 3e3f05182b39 USB: serial: mos7720: fix parallel probe 5c83e07c3c8b USB: serial: mos7720: fix parport use-after-free on probe errors 2f525ed5efb8 USB: serial: mos7720: fix use-after-free on probe errors f2e8b37a9970 USB: serial: mos7720: fix NULL-deref at open 857757872704 USB: serial: mos7840: fix NULL-deref at open 1b1fdc715807 USB: serial: kobil_sct: fix NULL-deref in write b60b91268cd0 USB: serial: cyberjack: fix NULL-deref at open b835f4cd6700 USB: serial: oti6858: fix NULL-deref at open 374250ed9b26 USB: serial: io_edgeport: fix NULL-deref at open ad4de3d91872 USB: serial: ti_usb_3410_5052: fix NULL-deref at open f0bdd7e0ccb2 USB: serial: garmin_gps: fix memory leak on failed URB submit e3d6a0da47e6 USB: serial: iuu_phoenix: fix NULL-deref at open 11743d704e51 USB: serial: io_ti: fix I/O after disconnect 7ef8807cce7d USB: serial: io_ti: fix another NULL-deref at open 33a5d0cc25f4 USB: serial: io_ti: fix NULL-deref at open 0243498813d2 USB: serial: spcp8x5: fix NULL-deref at open 65d107038ec6 USB: serial: keyspan_pda: verify endpoints at probe c6aa86222ec5 USB: serial: pl2303: fix NULL-deref at open 4e106709060f USB: serial: quatech2: fix sleep-while-atomic in close 7b5d7880019c USB: serial: omninet: fix NULL-derefs at open and disconnect d88f0f6c5ba0 usb: xhci: hold lock over xhci_abort_cmd_ring() f286c2513ba6 xhci: Handle command completion and timeout race 86bb666386ee usb: host: xhci: Fix possible wild pointer when handling abort command 3447b3772934 usb: xhci: fix return value of xhci_setup_device() 2d1b4fcba4a7 xhci: free xhci virtual devices with leaf nodes first b303a108541e usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake b4b404b99177 xhci: workaround for hosts missing CAS bit e224b8b7215f usb: xhci: fix possible wild pointer 438efb640e83 usb: dwc3: core: avoid Overflow events 96a21e702606 usb: gadget: composite: Test get_alt() presence instead of set_alt() bd4e78bbc93f USB: dummy-hcd: fix bug in stop_activity (handle ep0) 7cc00abef071 USB: fix problems with duplicate endpoint addresses f6ff9981743c USB: gadgetfs: fix checks of wTotalLength in config descriptors 74e36bffe645 USB: gadgetfs: fix use-after-free bug fe75330a27fc USB: gadgetfs: fix unbounded memory allocation bug 10a4380ea145 usb: gadgetfs: restrict upper bound on device configuration size 9cc601b40d76 usb: storage: unusual_uas: Add JMicron JMS56x to unusual device 96175db0a647 usb: musb: dsps: implement clear_ep_rxintr() callback 2a0e2a89cc41 usb: musb: core: add clear_ep_rxintr() to musb_platform_ops e72575d2d76e KVM: MIPS: Flush KVM entry code from icache globally 7b95f36fc6fa KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS 9b73f43fcef4 mac80211: initialize fast-xmit 'info' later 6e28a02f0e86 ARM: davinci: da850: don't add emac clock to lookup table twice bb1cacd88e07 ALSA: usb-audio: Fix irq/process data synchronization 16b968a1ca96 ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL b87483c27624 ALSA: hda - Fix up GPIO for ASUS ROG Ranger (From OE-Core rev: 70c124ae85360428aa6942c5efd527d6139ab7ec) Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie (cherry picked from commit bf00e5e265d3f878d2af36a48d597ce477bd6f4f) fixed merge conflicts Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.4.bb | 6 +++--- .../linux/linux-yocto-tiny_4.4.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.4.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb index d5f86d9b31..6cacc7a274 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "6622c6471016005d5588aa4338ce57aced713dcd" -SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" +SRCREV_machine ?= "15a97653eb794367a2b12bfeaf68f0104f8213e3" +SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.41" +LINUX_VERSION ?= "4.4.53" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb index 0baba1de53..35cc2b1b7a 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.4.41" +LINUX_VERSION ?= "4.4.53" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" +SRCREV_machine ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.4.bb b/meta/recipes-kernel/linux/linux-yocto_4.4.bb index 5ac3f561a5..70c3beecb3 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.4.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "60287c1951ca7063bc19597eb5cabf834e660cfb" -SRCREV_machine_qemuarm64 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_machine_qemumips ?= "143d659ae6d53623001e22c13a0286bd6d1723ca" -SRCREV_machine_qemuppc ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_machine_qemux86 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_machine_qemux86-64 ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_machine_qemumips64 ?= "c74cc42106745bab08de6263b9320ac029f2cca9" -SRCREV_machine ?= "ad8b1d659ddd2699ebf7d50ef9de8940b157bfc2" -SRCREV_meta ?= "78a26182e20c0a49c1adda63faa15ccd3f4ecb27" +SRCREV_machine_qemuarm ?= "96c11ef2a20975febadc839abaae3127731de642" +SRCREV_machine_qemuarm64 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_machine_qemumips ?= "e22a4ddcb6472ae6f258c16af1b38e8e5866c5eb" +SRCREV_machine_qemuppc ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_machine_qemux86 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_machine_qemux86-64 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_machine_qemumips64 ?= "ca07238310e9ef502adbb1416e9f327657886343" +SRCREV_machine ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" +SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.41" +LINUX_VERSION ?= "4.4.53" PV = "${LINUX_VERSION}+git${SRCPV}" From 22cd02a09d0af5365088c19ad18edc86e2d99610 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 28 Mar 2017 08:58:05 -0400 Subject: [PATCH 051/129] linux-yocto/4.4: update to v4.4.56 Integrating the korg release with the following shortlog: 0136bca4e0f6 Linux 4.4.56 99d403faba47 futex: Add missing error handling to FUTEX_REQUEUE_PI 44854c191e2c futex: Fix potential use-after-free in FUTEX_REQUEUE_PI 62f57041fbdf x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm 8e0ec20539f8 x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y 3a19419c50c6 fscrypto: lock inode while setting encryption policy fd74e8d258da fscrypt: fix renaming and linking special files c10ffe988f15 net sched actions: decrement module reference count after table flush. 676fe978525d dccp: fix memory leak during tear-down of unsuccessful connection request 4ab956b56133 dccp/tcp: fix routing redirect race 56f9b9502f2d bridge: drop netfilter fake rtable unconditionally aed728c38c48 ipv6: avoid write to a possibly cloned skb 5f8bc3856e28 ipv6: make ECMP route replacement less greedy b57955ea30e1 mpls: Send route delete notifications when router module is unloaded 710fbeb3f5c5 act_connmark: avoid crashing on malformed nlattrs with null parms 6c72458ab428 uapi: fix linux/packet_diag.h userspace compilation error e671f1cc588f vrf: Fix use-after-free in vrf_xmit d0ebde92fbeb dccp: fix use-after-free in dccp_feat_activate_values ec4d8692b76e net: fix socket refcounting in skb_complete_tx_timestamp() 9e7683301bee net: fix socket refcounting in skb_complete_wifi_ack() 2681a7853ad7 tcp: fix various issues for sockets morphing to listen state 9216632bf4a0 dccp: Unlock sock before calling sk_free() a70c32859704 net: net_enable_timestamp() can be called from irq contexts f331d6445a3e net: don't call strlen() on the user buffer in packet_bind_spkt() 2cd0afc64e33 l2tp: avoid use-after-free caused by l2tp_ip_backlog_recv 354f79125f12 ipv4: mask tos for input route f1b3aae1f1bf vti6: return GRE_KEY for vti6 51a219a1371e vxlan: correctly validate VXLAN ID against VXLAN_N_VID 0c0be310ba29 netlink: remove mmapped netlink support 28ec98bc2e4a Linux 4.4.55 1c5265be54d3 ext4: don't BUG when truncating encrypted inodes on the orphan list cd8ad4d9eb6d dm: flush queued bios when process blocks to avoid deadlock 66dd58f56eab nfit, libnvdimm: fix interleave set cookie calculation a084aeef5633 s390/kdump: Use "LINUX" ELF note name instead of "CORE" b0e85701a776 KVM: s390: Fix guest migration for huge guests resulting in panic 61fbad6a28fd mvsas: fix misleading indentation 72ca0ab30680 serial: samsung: Continue to work if DMA request fails 72bb2b96b856 USB: serial: io_ti: fix information leak in completion handler e71c7bad6844 USB: serial: io_ti: fix NULL-deref in interrupt callback 6498086195b9 USB: iowarrior: fix NULL-deref in write 179295c38d23 USB: iowarrior: fix NULL-deref at probe 54f11a9662b6 USB: serial: omninet: fix reference leaks at open 3cdc94638746 USB: serial: safe_serial: fix information leak in completion handler cf09c7d60ccc usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers 40c5634ffe3d usb: host: xhci-dbg: HCIVERSION should be a binary number 4a1a3bb70fb4 usb: gadget: function: f_fs: pass companion descriptor along 10af24856503 usb: dwc3: gadget: make Set Endpoint Configuration macros safe f47b97f2cdaa usb: gadget: dummy_hcd: clear usb_gadget region before registration 2ca39d130015 powerpc: Emulation support for load/store instructions on LE 074893495b72 tracing: Add #undef to fix compile error 127651058594 MIPS: Netlogic: Fix CP0_EBASE redefinition warnings 2e4aff2405af MIPS: DEC: Avoid la pseudo-instruction in delay slots 5fad17434465 mm: memcontrol: avoid unused function warning 5e45d834f762 cpmac: remove hopeless #warning 32883383f5e0 MIPS: ralink: Remove unused rt*_wdt_reset functions 4b91e7a2a9a7 MIPS: ralink: Cosmetic change to prom_init(). 3dc8f1e3a8f2 mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy d2a8d746ae95 MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change c018595d83a3 MIPS: ip22: Fix ip28 build for modern gcc 7a6a965f350e MIPS: Update ip27_defconfig for SCSI_DH change 8ed0fdcc0c11 MIPS: ip27: Disable qlge driver in defconfig adc48c710b7e MIPS: Update defconfigs for NF_CT_PROTO_DCCP/UDPLITE change e041ad066440 crypto: improve gcc optimization flags for serpent and wp512 a8cb5c02a20f USB: serial: digi_acceleport: fix OOB-event processing 4d95645f3dd5 USB: serial: digi_acceleport: fix OOB data sanity check (From OE-Core rev: 1b27f57fffb2ac7ffc22e294bda05b851cb2cf1c) Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie (cherry picked from commit aac3bd4b9a3a2dca42eff68beec1b075ae8e532a) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.4.bb | 6 +++--- .../linux/linux-yocto-tiny_4.4.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.4.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb index 6cacc7a274..d25b64227a 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "15a97653eb794367a2b12bfeaf68f0104f8213e3" -SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" +SRCREV_machine ?= "95f418b97f423e43d144884dc0bd6de207752ad0" +SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.53" +LINUX_VERSION ?= "4.4.56" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb index 35cc2b1b7a..fcc7e0438c 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.4.53" +LINUX_VERSION ?= "4.4.56" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" +SRCREV_machine ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.4.bb b/meta/recipes-kernel/linux/linux-yocto_4.4.bb index 70c3beecb3..e3153a783a 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.4.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "96c11ef2a20975febadc839abaae3127731de642" -SRCREV_machine_qemuarm64 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_machine_qemumips ?= "e22a4ddcb6472ae6f258c16af1b38e8e5866c5eb" -SRCREV_machine_qemuppc ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_machine_qemux86 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_machine_qemux86-64 ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_machine_qemumips64 ?= "ca07238310e9ef502adbb1416e9f327657886343" -SRCREV_machine ?= "cebe1ad56aebd89e0de29412e19433fb441bf13c" -SRCREV_meta ?= "864bc5736aa58c510713e7b76d205d5341377972" +SRCREV_machine_qemuarm ?= "01aaede0a243457a3557167d40488d89335d9e73" +SRCREV_machine_qemuarm64 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_machine_qemumips ?= "c7ac6707736e0e7b93d93428d805df356a9f3888" +SRCREV_machine_qemuppc ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_machine_qemux86 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_machine_qemux86-64 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_machine_qemumips64 ?= "6af68e1545ba85755591a1495c6d34b29ac61406" +SRCREV_machine ?= "2525fc844188708834929d119cecdc2f6ae3c88a" +SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.53" +LINUX_VERSION ?= "4.4.56" PV = "${LINUX_VERSION}+git${SRCPV}" From ec212b22207f443694691eb450f12cf087c09882 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 11 Apr 2017 23:46:29 -0400 Subject: [PATCH 052/129] linux-yocto/4.4: update to v4.4.60 Updating to the korg stable relase with the following shortlog summary: 8f8ee9706b0a Linux 4.4.60 84bd21a708b8 padata: avoid race in reordering 5cca175b6cda blk: Ensure users for current->bio_list can see the full list. 2cbd78f4239b blk: improve order of bio handling in generic_make_request() 063d30f187f5 power: reset: at91-poweroff: timely shutdown LPDDR memories 42462d23e60b KVM: kvm_io_bus_unregister_dev() should never fail 3a1246b46df5 rtc: s35390a: improve irq handling a55ae9d1937b rtc: s35390a: implement reset routine as suggested by the reference fdd4bc9313e5 rtc: s35390a: make sure all members in the output are set b3ed3864912e rtc: s35390a: fix reading out alarm 6280ac931a23 MIPS: Lantiq: Fix cascaded IRQ setup 47e2fe17d14d mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() ef55c3df5dbd drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags 3eb392056aeb KVM: x86: clear bus pointer when destroyed eac3ab3e6915 USB: fix linked-list corruption in rh_call_control() 0a1757cfa5ba tty/serial: atmel: fix TX path in atmel_console_write() 74b8fc017d76 tty/serial: atmel: fix race condition (TX+DMA) 566a8711a7dd ACPI: Do not create a platform_device for IOAPIC/IOxAPIC 3342857ac074 ACPI: Fix incompatibility with mcount-based function graph tracing ab48ab614b8c ASoC: atmel-classd: fix audio clock rate ce3dcfdbff04 ALSA: hda - fix a problem for lineout on a Dell AIO machine a90d7447e4a1 ALSA: seq: Fix race during FIFO resize 75a03869c93a scsi: libsas: fix ata xfer length a92f411914ca scsi: sg: check length passed to SG_NEXT_CMD_LEN 18639c4bad72 scsi: mpt3sas: fix hang on ata passthrough commands 1eed198ce16b xen/setup: Don't relocate p2m over existing one ba46d8fab00a libceph: force GFP_NOIO for socket allocations 61a4577c9a44 Linux 4.4.59 2bed5987692c sched/rt: Add a missing rescheduling point 7a5202190810 fscrypt: remove broken support for detecting keyring key revocation 573341eba9c4 metag/ptrace: Reject partial NT_METAG_RPIPE writes e441102d8c07 metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS 2d9bc3695012 metag/ptrace: Preserve previous registers for short regset write 962b95a88574 sparc/ptrace: Preserve previous registers for short regset write c8693666856c mips/ptrace: Preserve previous registers for short regset write e1dc8904b33b h8300/ptrace: Fix incorrect register transfer count 6e174bbd0631 c6x/ptrace: Remove useless PTRACE_SETREGSET implementation 800791e7e0fd pinctrl: qcom: Don't clear status bit on irq_unmask 927d04793f8a virtio_balloon: init 1st buffer in stats vq 22c9e7c092f6 xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder cce7e56dd73f xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window a9a76a3e318e xfrm: policy: init locks early 0a5766a6a73b Linux 4.4.58 f8a62dbc7902 crypto: algif_hash - avoid zero-sized array 540d6d756ff8 fbcon: Fix vc attr at deinit ac601978a2aa serial: 8250_pci: Detach low-level driver during PCI error recovery b8687d83b34c ACPI / blacklist: Make Dell Latitude 3350 ethernet work d3607fc2976e ACPI / blacklist: add _REV quirks for Dell Precision 5520 and 3520 4e2c66bb6658 uvcvideo: uvc_scan_fallback() for webcams with broken chain ce5494107946 s390/zcrypt: Introduce CEX6 toleration 7023f502c835 block: allow WRITE_SAME commands with the SG_IO ioctl 9fd9e1436380 vfio/spapr: Postpone allocation of userspace version of TCE table 4110080574ac PCI: Do any VF BAR updates before enabling the BARs bcbdcf48469b PCI: Ignore BAR updates on virtual functions d4f09ea7e35c PCI: Update BARs using property bits appropriate for type 131f7969048b PCI: Don't update VF BARs while VF memory space is enabled 40a85d68185f PCI: Decouple IORESOURCE_ROM_ENABLE and PCI_ROM_ADDRESS_ENABLE 1278c9f87f11 PCI: Add comments about ROM BAR updating cef498a2c75a PCI: Remove pci_resource_bar() and pci_iov_resource_bar() a87693ec42f2 PCI: Separate VF BAR updates from standard BAR updates e4ce31c0265d x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic ca7e3bdc9c7e igb: add i211 to i210 PHY workaround 4db313df4946 igb: Workaround for igb i210 firmware issue ec52364445a4 xen: do not re-use pirq number cached in pci device msi msg data 6d43e485e006 xfs: clear _XBF_PAGES from buffers when readahead page f154de03f416 USB: usbtmc: add missing endpoint sanity check 74c8dd066cc0 nl80211: fix dumpit error path RTNL deadlocks 7922c1becb36 xfs: fix up xfs_swap_extent_forks inline extent handling c4cf86f69597 xfs: don't allow di_size with high bit set 48da8f817b9d libceph: don't set weight to IN when OSD is destroyed 73dd1edf50a6 raid10: increment write counter after bio is split 175039632065 cpufreq: Restore policy min/max limits on CPU online e1af444e52ce ARM: dts: at91: sama5d2: add dma properties to UART nodes 2705b183263b ARM: at91: pm: cpu_idle: switch DDR to power-down mode 55b6c187cf9d iommu/vt-d: Fix NULL pointer dereference in device_to_iommu c856b66c8aac xen/acpi: upload PM state from init-domain to Xen 52e40a2fcc39 mmc: sdhci: Do not disable interrupts while waiting for clock 27d9bf096406 ext4: mark inode dirty after converting inline directory c7d1545c48ff parport: fix attempt to write duplicate procfiles 7413d1f8991e iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3 8f189e1d0eca iio: adc: ti_am335x_adc: fix fifo overrun recovery dcf879cb9ed3 mmc: ushc: fix NULL-deref at probe 2c251e568e1a uwb: hwa-rc: fix NULL-deref at probe 815321da2e26 uwb: i1480-dfu: fix NULL-deref at probe 14a2032287d4 usb: hub: Fix crash after failure to read BOS descriptor 47285be050ca usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer a7cb1fafe429 USB: wusbcore: fix NULL-deref at probe d6389d6abb8a USB: idmouse: fix NULL-deref at probe a7712869e2e7 USB: lvtest: fix NULL-deref at probe 73490abe249c USB: uss720: fix NULL-deref at probe 2c929ea720f9 usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk 8a8a8007871a usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval 19f0fe67b9d0 ACM gadget: fix endianness in notifications 9218793a39de USB: serial: qcserial: add Dell DW5811e 8f0f081647cc USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems 1ea551eec703 ALSA: hda - Adding a group of pin definition to fix headset problem ed00b613bbcb ALSA: ctxfi: Fix the incorrect check of dma_set_mask() call b55ffcb1bc8a ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() 549993001e7d Input: sur40 - validate number of endpoints before using them b3c4c0c470b5 Input: kbtab - validate number of endpoints before using them c05490638ddf Input: cm109 - validate number of endpoints before using them e916f1d6188e Input: yealink - validate number of endpoints before using them 0812c6855c89 Input: hanwang - validate number of endpoints before using them 6bed7c1e2b78 Input: ims-pcu - validate number of endpoints before using them a07d3669654a Input: iforce - validate number of endpoints before using them 5f9243e4fca6 Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 9ac7bd114e13 Input: elan_i2c - add ASUS EeeBook X205TA special touchpad fw afaed241928f tcp: initialize icsk_ack.lrcvtime at session start time 95aa915c2f04 socket, bpf: fix sk_filter use after free in sk_clone_lock 38dece41e5be ipv4: provide stronger user input validation in nl_fib_input() 85f00dac91a1 net: bcmgenet: remove bcmgenet_internal_phy_setup() fdcee7c1e2f8 net/mlx5e: Count LRO packets correctly 9d1894cba25c net/mlx5: Increase number of max QPs in default profile 610c6bcc5fcf net: unix: properly re-increment inflight counter of GC discarded candidates ae43f9360a21 amd-xgbe: Fix jumbo MTU processing on newer hardware f3126725228c net: properly release sk_frag.page 12f0bffc489d net: bcmgenet: Do not suspend PHY if Wake-on-LAN is enabled b362d6735156 net/openvswitch: Set the ipv6 source tunnel key address attribute correctly a5c3f390eb77 Linux 4.4.57 5fa513cb0721 ext4: fix fencepost in s_first_meta_bg validation d88b83e66bbf percpu: acquire pcpu_lock when updating pcpu_nr_empty_pop_pages e08f608ab428 gfs2: Avoid alignment hole in struct lm_lockname 4f47ca488256 isdn/gigaset: fix NULL-deref at probe d267ecbdfdb4 target: Fix VERIFY_16 handling in sbc_parse_cdb 246760c61d9c scsi: libiscsi: add lock around task lists to fix list corruption regression 82bd06aba880 scsi: lpfc: Add shutdown method for kexec 0a621633cdfa target/pscsi: Fix TYPE_TAPE + TYPE_MEDIMUM_CHANGER export 582f548924cd md/raid1/10: fix potential deadlock b24473976b98 powerpc/boot: Fix zImage TOC alignment 09875d1393d4 cpufreq: Fix and clean up show_cpuinfo_cur_freq() f02729f2ab87 perf/core: Fix event inheritance on fork() 4cb0c0b73d1c give up on gcc ilog2() constant optimizations 6052eb871217 kernek/fork.c: allocate idle task for a CPU always on its local node 6cc5b73d7969 hv_netvsc: use skb_get_hash() instead of a homegrown implementation cea050150323 tpm_tis: Use devm_free_irq not free_irq 13a26889cbc1 drm/amdgpu: add missing irq.h include 68ea3948ed3d s390/pci: fix use after free in dma_init 50730d7f361f KVM: PPC: Book3S PR: Fix illegal opcode emulation e2d9577854f5 xen/qspinlock: Don't kick CPU if IRQ is not initialized b1a0f744f8e6 Drivers: hv: avoid vfree() on crash 0a2512768f16 Drivers: hv: balloon: don't crash when memory is added in non-sorted order 3787a071d145 pinctrl: cherryview: Do not mask all interrupts in probe 962c66c74184 ACPI / video: skip evaluating _DOD when it does not exist 12e1a3cd11ea cxlflash: Increase cmd_per_lun for better throughput f8c07cbc2e72 crypto: mcryptd - Fix load failure 10659b8f5c60 crypto: cryptd - Assign statesize properly c78c3376ec67 crypto: ghash-clmulni - Fix load failure 45d9558837d4 USB: don't free bandwidth_mutex too early ac1a97d8a562 usb: core: hub: hub_port_init lock controller instead of bus (From OE-Core rev: 80712877c843139e1990a4e4360a48dba003a560) Signed-off-by: Bruce Ashfield Signed-off-by: Richard Purdie (cherry picked from commit 52a6823d4279d580a2b4bbfdc06234a903a17d93) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.4.bb | 6 +++--- .../linux/linux-yocto-tiny_4.4.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.4.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb index d25b64227a..1f73f0c75f 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.4.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "95f418b97f423e43d144884dc0bd6de207752ad0" -SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" +SRCREV_machine ?= "1af95315c6ab3672c8c7191873ef041a6c29ad70" +SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.56" +LINUX_VERSION ?= "4.4.60" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb index fcc7e0438c..04f719c5d0 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.4.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.4.56" +LINUX_VERSION ?= "4.4.60" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" +SRCREV_machine ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.4.bb b/meta/recipes-kernel/linux/linux-yocto_4.4.bb index e3153a783a..d0eed65594 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.4.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "01aaede0a243457a3557167d40488d89335d9e73" -SRCREV_machine_qemuarm64 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_machine_qemumips ?= "c7ac6707736e0e7b93d93428d805df356a9f3888" -SRCREV_machine_qemuppc ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_machine_qemux86 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_machine_qemux86-64 ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_machine_qemumips64 ?= "6af68e1545ba85755591a1495c6d34b29ac61406" -SRCREV_machine ?= "2525fc844188708834929d119cecdc2f6ae3c88a" -SRCREV_meta ?= "271b0c8d5128f0cb18ed413cc59f683132ff8e3f" +SRCREV_machine_qemuarm ?= "7d2a3c70d62f1e7f4eba571c49ff299db2bb3829" +SRCREV_machine_qemuarm64 ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_machine_qemumips ?= "6100965a51cf6b99f57cf8234aa982beb79455c9" +SRCREV_machine_qemuppc ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_machine_qemux86 ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_machine_qemux86-64 ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_machine_qemumips64 ?= "522e709fd7088e1a55e7a4708b1a07caa2ca4336" +SRCREV_machine ?= "0298d3765a5c474ff5776284d49111276510d4b4" +SRCREV_meta ?= "d6733af2080f8c0775569adc0826eb0c8954fc5e" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.4.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.4;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.4.56" +LINUX_VERSION ?= "4.4.60" PV = "${LINUX_VERSION}+git${SRCPV}" From 5b46dfb4fef2d6acb56f257ab04602b4ac62a425 Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Tue, 11 Apr 2017 13:55:21 +0300 Subject: [PATCH 053/129] mkfontdir: Remove x11 requirement for -native Make sure we can build native tools without "x11" in features. (From OE-Core rev: efeb161baf06ed0602f47ddcc71d53703972e759) Signed-off-by: Jussi Kukkonen Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb b/meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb index a453e24876..737bc9de48 100644 --- a/meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb +++ b/meta/recipes-graphics/xorg-app/mkfontdir_1.0.7.bb @@ -11,6 +11,9 @@ files." PE = "1" PR = "${INC_PR}.0" +DEPENDS = "util-macros-native" +REQUIRED_DISTRO_FEATURES_class-native = "" + RDEPENDS_${PN} += "mkfontscale" RDEPENDS_${PN}_class-native += "mkfontscale-native" From 293288ef1c7cb46fd9e69817d2585c4753af9a6e Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Tue, 11 Apr 2017 13:55:22 +0300 Subject: [PATCH 054/129] mkfontscale: Remove x11 requirement for -native Make sure we can build native tools without "x11" feature. (From OE-Core rev: e3aa3ae25cdf2523cd510c97aeabde46b24cbc08) Signed-off-by: Jussi Kukkonen Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb b/meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb index 31cf186767..d1aa9b3615 100644 --- a/meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb +++ b/meta/recipes-graphics/xorg-app/mkfontscale_1.1.2.bb @@ -10,6 +10,8 @@ is used by the mkfontdir program." DEPENDS = "util-macros-native zlib libfontenc freetype xproto" +REQUIRED_DISTRO_FEATURES_class-native = "" + BBCLASSEXTEND = "native" LIC_FILES_CHKSUM = "file://COPYING;md5=2e0d129d05305176d1a790e0ac1acb7f" From c90540df8b72bf9fe342bb39b3029ede39be2aeb Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Tue, 11 Apr 2017 13:55:23 +0300 Subject: [PATCH 055/129] xorg-font-common.inc: Remove x11 requirement for -native (From OE-Core rev: 1c6f6b014c2fca7bad93ce3b770721fd770bb006) Signed-off-by: Jussi Kukkonen Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-graphics/xorg-font/xorg-font-common.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/recipes-graphics/xorg-font/xorg-font-common.inc b/meta/recipes-graphics/xorg-font/xorg-font-common.inc index d5267f59a2..da20ab9b56 100644 --- a/meta/recipes-graphics/xorg-font/xorg-font-common.inc +++ b/meta/recipes-graphics/xorg-font/xorg-font-common.inc @@ -18,6 +18,7 @@ inherit autotools pkgconfig distro_features_check # The mkfontscale-native requires x11 in DISTRO_FEATURES REQUIRED_DISTRO_FEATURES = "x11" +REQUIRED_DISTRO_FEATURES_class-native = "" EXTRA_OEMAKE += "FCCACHE=/bin/true UTIL_DIR=${STAGING_DIR_TARGET}\$\(MAPFILES_PATH\)" From b37b775e775ce162c268ec95d62fee8dd5caf81c Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Tue, 28 Mar 2017 19:38:34 -0700 Subject: [PATCH 056/129] glibc: Fix use after free in pthread_create() [BZ 20116] -- https://sourceware.org/bugzilla/show_bug.cgi?id=20116 The commit documents the ownership rules around 'struct pthread' and when a thread can read or write to the descriptor. With those ownership rules in place it becomes obvious that pd->stopped_start should not be touched in several of the paths during thread startup, particularly so for detached threads. In the case of detached threads, between the time the thread is created by the OS kernel and the creating thread checks pd->stopped_start, the detached thread might have already exited and the memory for pd unmapped. As a regression test we add a simple test which exercises this exact case by quickly creating detached threads with large enough stacks to ensure the thread stack cache is bypassed and the stacks are unmapped. Before the fix the testcase segfaults, after the fix it works correctly and completes without issue. For a detailed discussion see: https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html (cherry-picked from commit f8bf15febcaf137bbec5a61101e88cd5a9d56ca8) (From OE-Core rev: eaa844b6ce75d68f952de67ea5145a54a1968171) Signed-off-by: Yuanjie Huang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...Fix-use-after-free-in-pthread_create.patch | 668 ++++++++++++++++++ meta/recipes-core/glibc/glibc_2.24.bb | 1 + 2 files changed, 669 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch diff --git a/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch b/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch new file mode 100644 index 0000000000..66f1fcd0f0 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch @@ -0,0 +1,668 @@ +From e7ba24f05d86acf7072e066ea6d7b235a106688c Mon Sep 17 00:00:00 2001 +From: Carlos O'Donell +Date: Sat, 28 Jan 2017 19:13:34 -0500 +Subject: [PATCH] Bug 20116: Fix use after free in pthread_create() + +The commit documents the ownership rules around 'struct pthread' and +when a thread can read or write to the descriptor. With those ownership +rules in place it becomes obvious that pd->stopped_start should not be +touched in several of the paths during thread startup, particularly so +for detached threads. In the case of detached threads, between the time +the thread is created by the OS kernel and the creating thread checks +pd->stopped_start, the detached thread might have already exited and the +memory for pd unmapped. As a regression test we add a simple test which +exercises this exact case by quickly creating detached threads with +large enough stacks to ensure the thread stack cache is bypassed and the +stacks are unmapped. Before the fix the testcase segfaults, after the +fix it works correctly and completes without issue. + +For a detailed discussion see: +https://www.sourceware.org/ml/libc-alpha/2017-01/msg00505.html + +(cherry-picked from commit f8bf15febcaf137bbec5a61101e88cd5a9d56ca8) + +Upstream-Status: Backport [master] +Signed-off-by: Yuanjie Huang +--- + ChangeLog | 23 ++++ + nptl/Makefile | 3 +- + nptl/createthread.c | 10 +- + nptl/pthread_create.c | 207 +++++++++++++++++++++++++++------ + nptl/pthread_getschedparam.c | 1 + + nptl/pthread_setschedparam.c | 1 + + nptl/pthread_setschedprio.c | 1 + + nptl/tpp.c | 2 + + nptl/tst-create-detached.c | 137 ++++++++++++++++++++++ + sysdeps/nacl/createthread.c | 10 +- + sysdeps/unix/sysv/linux/createthread.c | 16 ++- + 11 files changed, 356 insertions(+), 55 deletions(-) + create mode 100644 nptl/tst-create-detached.c + +diff --git a/ChangeLog b/ChangeLog +index 84ae7a7af8..0fbda9020e 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,26 @@ ++2016-01-28 Carlos O'Donell ++ Alexey Makhalov ++ Florian Weimer ++ ++ [BZ #20116] ++ * nptl/pthread_create.c: Document concurrency notes. ++ Enhance thread creation notes. ++ (create_thread): Use bool *stopped_start. ++ (START_THREAD_DEFN): Comment ownership of PD. ++ (__pthread_create_2_1): Add local bool stopped_start and use ++ that instead of pd->stopped_start where appropriate. ++ * nptl/createthread.c (create_thread): Use bool *stopped_start. ++ * sysdeps/nacl/createthread.c (create_thread): Use bool *stopped_start. ++ * sysdeps/unix/sysv/linux/createthread.c (create_thread): Likewise. ++ * nptl/tst-create-detached.c: New file. ++ * nptl/Makefile (tests): Add tst-create-detached. ++ * nptl/pthread_getschedparam.c (__pthread_getschedparam): ++ Reference the enhanced thread creation notes. ++ * nptl/pthread_setschedparam.c (__pthread_setschedparam): Likewise. ++ * nptl/pthread_setschedprio.c (pthread_setschedprio): Likewise. ++ * nptl/tpp.c (__pthread_tpp_change_priority): Likewise. ++ (__pthread_current_priority): Likewise. ++ + 2016-08-04 Carlos O'Donell + + * po/de.po: Update from Translation Project. +diff --git a/nptl/Makefile b/nptl/Makefile +index 0d8aadebed..7dec4edb53 100644 +--- a/nptl/Makefile ++++ b/nptl/Makefile +@@ -290,7 +290,8 @@ tests = tst-typesizes \ + tst-initializers1 $(addprefix tst-initializers1-,\ + c89 gnu89 c99 gnu99 c11 gnu11) \ + tst-bad-schedattr \ +- tst-thread_local1 tst-mutex-errorcheck tst-robust10 ++ tst-thread_local1 tst-mutex-errorcheck tst-robust10 \ ++ tst-create-detached \ + xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \ + tst-mutexpp1 tst-mutexpp6 tst-mutexpp10 + test-srcs = tst-oddstacklimit +diff --git a/nptl/createthread.c b/nptl/createthread.c +index ba2f9c7167..328f85865d 100644 +--- a/nptl/createthread.c ++++ b/nptl/createthread.c +@@ -25,16 +25,14 @@ + + static int + create_thread (struct pthread *pd, const struct pthread_attr *attr, +- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) ++ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) + { + /* If the implementation needs to do some tweaks to the thread after + it has been created at the OS level, it can set STOPPED_START here. */ + +- pd->stopped_start = stopped_start; +- if (__glibc_unlikely (stopped_start)) +- /* We make sure the thread does not run far by forcing it to get a +- lock. We lock it here too so that the new thread cannot continue +- until we tell it to. */ ++ pd->stopped_start = *stopped_start; ++ if (__glibc_unlikely (*stopped_start)) ++ /* See CONCURRENCY NOTES in nptl/pthread_create.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + return ENOSYS; +diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c +index a834063ad5..44b17bec86 100644 +--- a/nptl/pthread_create.c ++++ b/nptl/pthread_create.c +@@ -54,25 +54,141 @@ unsigned int __nptl_nthreads = 1; + /* Code to allocate and deallocate a stack. */ + #include "allocatestack.c" + +-/* createthread.c defines this function, and two macros: ++/* CONCURRENCY NOTES: ++ ++ Understanding who is the owner of the 'struct pthread' or 'PD' ++ (refers to the value of the 'struct pthread *pd' function argument) ++ is critically important in determining exactly which operations are ++ allowed and which are not and when, particularly when it comes to the ++ implementation of pthread_create, pthread_join, pthread_detach, and ++ other functions which all operate on PD. ++ ++ The owner of PD is responsible for freeing the final resources ++ associated with PD, and may examine the memory underlying PD at any ++ point in time until it frees it back to the OS or to reuse by the ++ runtime. ++ ++ The thread which calls pthread_create is called the creating thread. ++ The creating thread begins as the owner of PD. ++ ++ During startup the new thread may examine PD in coordination with the ++ owner thread (which may be itself). ++ ++ The four cases of ownership transfer are: ++ ++ (1) Ownership of PD is released to the process (all threads may use it) ++ after the new thread starts in a joinable state ++ i.e. pthread_create returns a usable pthread_t. ++ ++ (2) Ownership of PD is released to the new thread starting in a detached ++ state. ++ ++ (3) Ownership of PD is dynamically released to a running thread via ++ pthread_detach. ++ ++ (4) Ownership of PD is acquired by the thread which calls pthread_join. ++ ++ Implementation notes: ++ ++ The PD->stopped_start and thread_ran variables are used to determine ++ exactly which of the four ownership states we are in and therefore ++ what actions can be taken. For example after (2) we cannot read or ++ write from PD anymore since the thread may no longer exist and the ++ memory may be unmapped. The most complicated cases happen during ++ thread startup: ++ ++ (a) If the created thread is in a detached (PTHREAD_CREATE_DETACHED), ++ or joinable (default PTHREAD_CREATE_JOINABLE) state and ++ STOPPED_START is true, then the creating thread has ownership of ++ PD until the PD->lock is released by pthread_create. If any ++ errors occur we are in states (c), (d), or (e) below. ++ ++ (b) If the created thread is in a detached state ++ (PTHREAD_CREATED_DETACHED), and STOPPED_START is false, then the ++ creating thread has ownership of PD until it invokes the OS ++ kernel's thread creation routine. If this routine returns ++ without error, then the created thread owns PD; otherwise, see ++ (c) and (e) below. ++ ++ (c) If the detached thread setup failed and THREAD_RAN is true, then ++ the creating thread releases ownership to the new thread by ++ sending a cancellation signal. All threads set THREAD_RAN to ++ true as quickly as possible after returning from the OS kernel's ++ thread creation routine. ++ ++ (d) If the joinable thread setup failed and THREAD_RAN is true, then ++ then the creating thread retains ownership of PD and must cleanup ++ state. Ownership cannot be released to the process via the ++ return of pthread_create since a non-zero result entails PD is ++ undefined and therefore cannot be joined to free the resources. ++ We privately call pthread_join on the thread to finish handling ++ the resource shutdown (Or at least we should, see bug 19511). ++ ++ (e) If the thread creation failed and THREAD_RAN is false, then the ++ creating thread retains ownership of PD and must cleanup state. ++ No waiting for the new thread is required because it never ++ started. ++ ++ The nptl_db interface: ++ ++ The interface with nptl_db requires that we enqueue PD into a linked ++ list and then call a function which the debugger will trap. The PD ++ will then be dequeued and control returned to the thread. The caller ++ at the time must have ownership of PD and such ownership remains ++ after control returns to thread. The enqueued PD is removed from the ++ linked list by the nptl_db callback td_thr_event_getmsg. The debugger ++ must ensure that the thread does not resume execution, otherwise ++ ownership of PD may be lost and examining PD will not be possible. ++ ++ Note that the GNU Debugger as of (December 10th 2015) commit ++ c2c2a31fdb228d41ce3db62b268efea04bd39c18 no longer uses ++ td_thr_event_getmsg and several other related nptl_db interfaces. The ++ principal reason for this is that nptl_db does not support non-stop ++ mode where other threads can run concurrently and modify runtime ++ structures currently in use by the debugger and the nptl_db ++ interface. ++ ++ Axioms: ++ ++ * The create_thread function can never set stopped_start to false. ++ * The created thread can read stopped_start but never write to it. ++ * The variable thread_ran is set some time after the OS thread ++ creation routine returns, how much time after the thread is created ++ is unspecified, but it should be as quickly as possible. ++ ++*/ ++ ++/* CREATE THREAD NOTES: ++ ++ createthread.c defines the create_thread function, and two macros: + START_THREAD_DEFN and START_THREAD_SELF (see below). + +- create_thread is obliged to initialize PD->stopped_start. It +- should be true if the STOPPED_START parameter is true, or if +- create_thread needs the new thread to synchronize at startup for +- some other implementation reason. If PD->stopped_start will be +- true, then create_thread is obliged to perform the operation +- "lll_lock (PD->lock, LLL_PRIVATE)" before starting the thread. ++ create_thread must initialize PD->stopped_start. It should be true ++ if the STOPPED_START parameter is true, or if create_thread needs the ++ new thread to synchronize at startup for some other implementation ++ reason. If STOPPED_START will be true, then create_thread is obliged ++ to lock PD->lock before starting the thread. Then pthread_create ++ unlocks PD->lock which synchronizes-with START_THREAD_DEFN in the ++ child thread which does an acquire/release of PD->lock as the last ++ action before calling the user entry point. The goal of all of this ++ is to ensure that the required initial thread attributes are applied ++ (by the creating thread) before the new thread runs user code. Note ++ that the the functions pthread_getschedparam, pthread_setschedparam, ++ pthread_setschedprio, __pthread_tpp_change_priority, and ++ __pthread_current_priority reuse the same lock, PD->lock, for a ++ similar purpose e.g. synchronizing the setting of similar thread ++ attributes. These functions are never called before the thread is ++ created, so don't participate in startup syncronization, but given ++ that the lock is present already and in the unlocked state, reusing ++ it saves space. + + The return value is zero for success or an errno code for failure. + If the return value is ENOMEM, that will be translated to EAGAIN, + so create_thread need not do that. On failure, *THREAD_RAN should + be set to true iff the thread actually started up and then got +- cancelled before calling user code (*PD->start_routine), in which +- case it is responsible for doing its own cleanup. */ +- ++ canceled before calling user code (*PD->start_routine). */ + static int create_thread (struct pthread *pd, const struct pthread_attr *attr, +- bool stopped_start, STACK_VARIABLES_PARMS, ++ bool *stopped_start, STACK_VARIABLES_PARMS, + bool *thread_ran); + + #include +@@ -314,12 +430,19 @@ START_THREAD_DEFN + /* Store the new cleanup handler info. */ + THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf); + ++ /* We are either in (a) or (b), and in either case we either own ++ PD already (2) or are about to own PD (1), and so our only ++ restriction would be that we can't free PD until we know we ++ have ownership (see CONCURRENCY NOTES above). */ + if (__glibc_unlikely (pd->stopped_start)) + { + int oldtype = CANCEL_ASYNC (); + + /* Get the lock the parent locked to force synchronization. */ + lll_lock (pd->lock, LLL_PRIVATE); ++ ++ /* We have ownership of PD now. */ ++ + /* And give it up right away. */ + lll_unlock (pd->lock, LLL_PRIVATE); + +@@ -378,7 +501,8 @@ START_THREAD_DEFN + pd, pd->nextevent)); + } + +- /* Now call the function to signal the event. */ ++ /* Now call the function which signals the event. See ++ CONCURRENCY NOTES for the nptl_db interface comments. */ + __nptl_death_event (); + } + } +@@ -642,19 +766,28 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, + that cares whether the thread count is correct. */ + atomic_increment (&__nptl_nthreads); + +- bool thread_ran = false; ++ /* Our local value of stopped_start and thread_ran can be accessed at ++ any time. The PD->stopped_start may only be accessed if we have ++ ownership of PD (see CONCURRENCY NOTES above). */ ++ bool stopped_start = false; bool thread_ran = false; + + /* Start the thread. */ + if (__glibc_unlikely (report_thread_creation (pd))) + { +- /* Create the thread. We always create the thread stopped +- so that it does not get far before we tell the debugger. */ +- retval = create_thread (pd, iattr, true, STACK_VARIABLES_ARGS, +- &thread_ran); ++ stopped_start = true; ++ ++ /* We always create the thread stopped at startup so we can ++ notify the debugger. */ ++ retval = create_thread (pd, iattr, &stopped_start, ++ STACK_VARIABLES_ARGS, &thread_ran); + if (retval == 0) + { +- /* create_thread should have set this so that the logic below can +- test it. */ ++ /* We retain ownership of PD until (a) (see CONCURRENCY NOTES ++ above). */ ++ ++ /* Assert stopped_start is true in both our local copy and the ++ PD copy. */ ++ assert (stopped_start); + assert (pd->stopped_start); + + /* Now fill in the information about the new thread in +@@ -671,26 +804,30 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, + pd, pd->nextevent) + != 0); + +- /* Now call the function which signals the event. */ ++ /* Now call the function which signals the event. See ++ CONCURRENCY NOTES for the nptl_db interface comments. */ + __nptl_create_event (); + } + } + else +- retval = create_thread (pd, iattr, false, STACK_VARIABLES_ARGS, +- &thread_ran); ++ retval = create_thread (pd, iattr, &stopped_start, ++ STACK_VARIABLES_ARGS, &thread_ran); + + if (__glibc_unlikely (retval != 0)) + { +- /* If thread creation "failed", that might mean that the thread got +- created and ran a little--short of running user code--but then +- create_thread cancelled it. In that case, the thread will do all +- its own cleanup just like a normal thread exit after a successful +- creation would do. */ +- + if (thread_ran) +- assert (pd->stopped_start); ++ /* State (c) or (d) and we may not have PD ownership (see ++ CONCURRENCY NOTES above). We can assert that STOPPED_START ++ must have been true because thread creation didn't fail, but ++ thread attribute setting did. */ ++ /* See bug 19511 which explains why doing nothing here is a ++ resource leak for a joinable thread. */ ++ assert (stopped_start); + else + { ++ /* State (e) and we have ownership of PD (see CONCURRENCY ++ NOTES above). */ ++ + /* Oops, we lied for a second. */ + atomic_decrement (&__nptl_nthreads); + +@@ -710,10 +847,14 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr, + } + else + { +- if (pd->stopped_start) +- /* The thread blocked on this lock either because we're doing TD_CREATE +- event reporting, or for some other reason that create_thread chose. +- Now let it run free. */ ++ /* We don't know if we have PD ownership. Once we check the local ++ stopped_start we'll know if we're in state (a) or (b) (see ++ CONCURRENCY NOTES above). */ ++ if (stopped_start) ++ /* State (a), we own PD. The thread blocked on this lock either ++ because we're doing TD_CREATE event reporting, or for some ++ other reason that create_thread chose. Now let it run ++ free. */ + lll_unlock (pd->lock, LLL_PRIVATE); + + /* We now have for sure more than one thread. The main thread might +diff --git a/nptl/pthread_getschedparam.c b/nptl/pthread_getschedparam.c +index b887881baf..de71171a08 100644 +--- a/nptl/pthread_getschedparam.c ++++ b/nptl/pthread_getschedparam.c +@@ -35,6 +35,7 @@ __pthread_getschedparam (pthread_t threadid, int *policy, + + int result = 0; + ++ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + /* The library is responsible for maintaining the values at all +diff --git a/nptl/pthread_setschedparam.c b/nptl/pthread_setschedparam.c +index dfb52b9dbf..dcb520f1c8 100644 +--- a/nptl/pthread_setschedparam.c ++++ b/nptl/pthread_setschedparam.c +@@ -36,6 +36,7 @@ __pthread_setschedparam (pthread_t threadid, int policy, + + int result = 0; + ++ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + struct sched_param p; +diff --git a/nptl/pthread_setschedprio.c b/nptl/pthread_setschedprio.c +index cefc6481d6..8134b50560 100644 +--- a/nptl/pthread_setschedprio.c ++++ b/nptl/pthread_setschedprio.c +@@ -38,6 +38,7 @@ pthread_setschedprio (pthread_t threadid, int prio) + struct sched_param param; + param.sched_priority = prio; + ++ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + /* If the thread should have higher priority because of some +diff --git a/nptl/tpp.c b/nptl/tpp.c +index e175bf4d53..223bd6bbee 100644 +--- a/nptl/tpp.c ++++ b/nptl/tpp.c +@@ -114,6 +114,7 @@ __pthread_tpp_change_priority (int previous_prio, int new_prio) + if (priomax == newpriomax) + return 0; + ++ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */ + lll_lock (self->lock, LLL_PRIVATE); + + tpp->priomax = newpriomax; +@@ -165,6 +166,7 @@ __pthread_current_priority (void) + + int result = 0; + ++ /* See CREATE THREAD NOTES in nptl/pthread_create.c. */ + lll_lock (self->lock, LLL_PRIVATE); + + if ((self->flags & ATTR_FLAG_SCHED_SET) == 0) +diff --git a/nptl/tst-create-detached.c b/nptl/tst-create-detached.c +new file mode 100644 +index 0000000000..ea93e441c7 +--- /dev/null ++++ b/nptl/tst-create-detached.c +@@ -0,0 +1,137 @@ ++/* Bug 20116: Test rapid creation of detached threads. ++ Copyright (C) 2017 Free Software Foundation, Inc. ++ 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; see the file COPYING.LIB. If ++ not, see . */ ++ ++/* The goal of the test is to trigger a failure if the parent touches ++ any part of the thread descriptor after the detached thread has ++ exited. We test this by creating many detached threads with large ++ stacks. The stacks quickly fill the the stack cache and subsequent ++ threads will start to cause the thread stacks to be immediately ++ unmapped to satisfy the stack cache max. With the stacks being ++ unmapped the parent's read of any part of the thread descriptor will ++ trigger a segfault. That segfault is what we are trying to cause, ++ since any segfault is a defect in the implementation. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Number of threads to create. */ ++enum { threads_to_create = 100000 }; ++ ++/* Number of threads which should spawn other threads. */ ++enum { creator_threads = 2 }; ++ ++/* Counter of threads created so far. This is incremented by all the ++ running creator threads. */ ++static unsigned threads_created; ++ ++/* Thread callback which does nothing, so that the thread exits ++ immediatedly. */ ++static void * ++do_nothing (void *arg) ++{ ++ return NULL; ++} ++ ++/* Attribute indicating that the thread should be created in a detached ++ fashion. */ ++static pthread_attr_t detached; ++ ++/* Barrier to synchronize initialization. */ ++static pthread_barrier_t barrier; ++ ++static void * ++creator_thread (void *arg) ++{ ++ int ret; ++ xpthread_barrier_wait (&barrier); ++ ++ while (true) ++ { ++ pthread_t thr; ++ /* Thread creation will fail if the kernel does not free old ++ threads quickly enough, so we do not report errors. */ ++ ret = pthread_create (&thr, &detached, do_nothing, NULL); ++ if (ret == 0 && __atomic_add_fetch (&threads_created, 1, __ATOMIC_SEQ_CST) ++ >= threads_to_create) ++ break; ++ } ++ ++ return NULL; ++} ++ ++static int ++do_test (void) ++{ ++ /* Limit the size of the process, so that memory allocation will ++ fail without impacting the entire system. */ ++ { ++ struct rlimit limit; ++ if (getrlimit (RLIMIT_AS, &limit) != 0) ++ { ++ printf ("FAIL: getrlimit (RLIMIT_AS) failed: %m\n"); ++ return 1; ++ } ++ /* This limit, 800MB, is just a heuristic. Any value can be ++ picked. */ ++ long target = 800 * 1024 * 1024; ++ if (limit.rlim_cur == RLIM_INFINITY || limit.rlim_cur > target) ++ { ++ limit.rlim_cur = target; ++ if (setrlimit (RLIMIT_AS, &limit) != 0) ++ { ++ printf ("FAIL: setrlimit (RLIMIT_AS) failed: %m\n"); ++ return 1; ++ } ++ } ++ } ++ ++ xpthread_attr_init (&detached); ++ ++ xpthread_attr_setdetachstate (&detached, PTHREAD_CREATE_DETACHED); ++ ++ /* A large thread stack seems beneficial for reproducing a race ++ condition in detached thread creation. The goal is to reach the ++ limit of the runtime thread stack cache such that the detached ++ thread's stack is unmapped after exit and causes a segfault when ++ the parent reads the thread descriptor data stored on the the ++ unmapped stack. */ ++ xpthread_attr_setstacksize (&detached, 16 * 1024 * 1024); ++ ++ xpthread_barrier_init (&barrier, NULL, creator_threads); ++ ++ pthread_t threads[creator_threads]; ++ ++ for (int i = 0; i < creator_threads; ++i) ++ threads[i] = xpthread_create (NULL, creator_thread, NULL); ++ ++ for (int i = 0; i < creator_threads; ++i) ++ xpthread_join (threads[i]); ++ ++ xpthread_attr_destroy (&detached); ++ ++ xpthread_barrier_destroy (&barrier); ++ ++ return 0; ++} ++ ++#include +diff --git a/sysdeps/nacl/createthread.c b/sysdeps/nacl/createthread.c +index 7b571c34e2..5465558cc1 100644 +--- a/sysdeps/nacl/createthread.c ++++ b/sysdeps/nacl/createthread.c +@@ -32,15 +32,13 @@ static void start_thread (void) __attribute__ ((noreturn)); + + static int + create_thread (struct pthread *pd, const struct pthread_attr *attr, +- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) ++ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) + { + pd->tid = __nacl_get_tid (pd); + +- pd->stopped_start = stopped_start; +- if (__glibc_unlikely (stopped_start)) +- /* We make sure the thread does not run far by forcing it to get a +- lock. We lock it here too so that the new thread cannot continue +- until we tell it to. */ ++ pd->stopped_start = *stopped_start; ++ if (__glibc_unlikely (*stopped_start)) ++ /* See CONCURRENCY NOTES in nptl/pthread_create.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + TLS_DEFINE_INIT_TP (tp, pd); +diff --git a/sysdeps/unix/sysv/linux/createthread.c b/sysdeps/unix/sysv/linux/createthread.c +index 6d32cece48..66ddae61d4 100644 +--- a/sysdeps/unix/sysv/linux/createthread.c ++++ b/sysdeps/unix/sysv/linux/createthread.c +@@ -46,7 +46,7 @@ static int start_thread (void *arg) __attribute__ ((noreturn)); + + static int + create_thread (struct pthread *pd, const struct pthread_attr *attr, +- bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) ++ bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran) + { + /* Determine whether the newly created threads has to be started + stopped since we have to set the scheduling parameters or set the +@@ -54,13 +54,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, + if (attr != NULL + && (__glibc_unlikely (attr->cpuset != NULL) + || __glibc_unlikely ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0))) +- stopped_start = true; ++ *stopped_start = true; + +- pd->stopped_start = stopped_start; +- if (__glibc_unlikely (stopped_start)) +- /* We make sure the thread does not run far by forcing it to get a +- lock. We lock it here too so that the new thread cannot continue +- until we tell it to. */ ++ pd->stopped_start = *stopped_start; ++ if (__glibc_unlikely (*stopped_start)) ++ /* See CONCURRENCY NOTES in nptl/pthread_creat.c. */ + lll_lock (pd->lock, LLL_PRIVATE); + + /* We rely heavily on various flags the CLONE function understands: +@@ -117,7 +115,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, + /* Set the affinity mask if necessary. */ + if (attr->cpuset != NULL) + { +- assert (stopped_start); ++ assert (*stopped_start); + + res = INTERNAL_SYSCALL (sched_setaffinity, err, 3, pd->tid, + attr->cpusetsize, attr->cpuset); +@@ -140,7 +138,7 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, + /* Set the scheduling parameters. */ + if ((attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0) + { +- assert (stopped_start); ++ assert (*stopped_start); + + res = INTERNAL_SYSCALL (sched_setscheduler, err, 3, pd->tid, + pd->schedpolicy, &pd->schedparam); +-- +2.11.0 + diff --git a/meta/recipes-core/glibc/glibc_2.24.bb b/meta/recipes-core/glibc/glibc_2.24.bb index f5a21b258d..b60b692723 100644 --- a/meta/recipes-core/glibc/glibc_2.24.bb +++ b/meta/recipes-core/glibc/glibc_2.24.bb @@ -37,6 +37,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0024-eglibc-Forward-port-cross-locale-generation-support.patch \ file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \ file://0026-build_local_scope.patch \ + file://0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch \ " SRC_URI += "\ From 1e26fcb8bbcec01c75e343542b560ca652c32788 Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Thu, 13 Apr 2017 13:48:12 +0800 Subject: [PATCH 057/129] bind: Security fix CVE-2016-8864 CVE-2016-8864: named in ISC BIND 9.x before 9.9.9-P4, 9.10.x before 9.10.4-P4, and 9.11.x before 9.11.0-P1 allows remote attackers to cause a denial of service (assertion failure and daemon exit) via a DNAME record in the answer section of a response to a recursive query, related to db.c and resolver.c. External References: https://nvd.nist.gov/vuln/detail/CVE-2016-8864 Patch from: https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=commit;h=c1d0599a246f646d1c22018f8fa09459270a44b8 (From OE-Core rev: c06f3a5993c7d63d91840c2a4d5b621e946ef78f) (From OE-Core rev: 6c1969bf82f36650c696c9fd7f0aa35d60dc4214) Signed-off-by: Yi Zhao Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../bind/bind/CVE-2016-8864.patch | 219 ++++++++++++++++++ .../bind/bind_9.10.3-P3.bb | 1 + 2 files changed, 220 insertions(+) create mode 100644 meta/recipes-connectivity/bind/bind/CVE-2016-8864.patch diff --git a/meta/recipes-connectivity/bind/bind/CVE-2016-8864.patch b/meta/recipes-connectivity/bind/bind/CVE-2016-8864.patch new file mode 100644 index 0000000000..b52d6800ff --- /dev/null +++ b/meta/recipes-connectivity/bind/bind/CVE-2016-8864.patch @@ -0,0 +1,219 @@ +From c1d0599a246f646d1c22018f8fa09459270a44b8 Mon Sep 17 00:00:00 2001 +From: Mark Andrews +Date: Fri, 21 Oct 2016 14:55:10 +1100 +Subject: [PATCH] 4489. [security] It was possible to trigger assertions when + processing a response. (CVE-2016-8864) [RT #43465] + +(cherry picked from commit bd6f27f5c353133b563fe69100b2f168c129f3ca) + +Upstream-Status: Backport +[https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=commit;h=c1d0599a246f646d1c22018f8fa09459270a44b8] + +CVE: CVE-2016-8864 + +Signed-off-by: Yi Zhao +--- + CHANGES | 3 +++ + lib/dns/resolver.c | 69 +++++++++++++++++++++++++++++++++++++----------------- + 2 files changed, 50 insertions(+), 22 deletions(-) + +diff --git a/CHANGES b/CHANGES +index 5c8c61a..41cfce5 100644 +--- a/CHANGES ++++ b/CHANGES +@@ -1,3 +1,6 @@ ++4489. [security] It was possible to trigger assertions when processing ++ a response. (CVE-2016-8864) [RT #43465] ++ + 4467. [security] It was possible to trigger an assertion when + rendering a message. (CVE-2016-2776) [RT #43139] + +diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c +index ba1ae23..13c8b44 100644 +--- a/lib/dns/resolver.c ++++ b/lib/dns/resolver.c +@@ -612,7 +612,9 @@ valcreate(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, dns_name_t *name, + valarg->addrinfo = addrinfo; + + if (!ISC_LIST_EMPTY(fctx->validators)) +- INSIST((valoptions & DNS_VALIDATOR_DEFER) != 0); ++ valoptions |= DNS_VALIDATOR_DEFER; ++ else ++ valoptions &= ~DNS_VALIDATOR_DEFER; + + result = dns_validator_create(fctx->res->view, name, type, rdataset, + sigrdataset, fctx->rmessage, +@@ -5526,13 +5528,6 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, + rdataset, + sigrdataset, + valoptions, task); +- /* +- * Defer any further validations. +- * This prevents multiple validators +- * from manipulating fctx->rmessage +- * simultaneously. +- */ +- valoptions |= DNS_VALIDATOR_DEFER; + } + } else if (CHAINING(rdataset)) { + if (rdataset->type == dns_rdatatype_cname) +@@ -5647,6 +5642,11 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_adbaddrinfo_t *addrinfo, + eresult == DNS_R_NCACHENXRRSET); + } + event->result = eresult; ++ if (adbp != NULL && *adbp != NULL) { ++ if (anodep != NULL && *anodep != NULL) ++ dns_db_detachnode(*adbp, anodep); ++ dns_db_detach(adbp); ++ } + dns_db_attach(fctx->cache, adbp); + dns_db_transfernode(fctx->cache, &node, anodep); + clone_results(fctx); +@@ -5897,6 +5897,11 @@ ncache_message(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo, + fctx->attributes |= FCTX_ATTR_HAVEANSWER; + if (event != NULL) { + event->result = eresult; ++ if (adbp != NULL && *adbp != NULL) { ++ if (anodep != NULL && *anodep != NULL) ++ dns_db_detachnode(*adbp, anodep); ++ dns_db_detach(adbp); ++ } + dns_db_attach(fctx->cache, adbp); + dns_db_transfernode(fctx->cache, &node, anodep); + clone_results(fctx); +@@ -6718,13 +6723,15 @@ static isc_result_t + answer_response(fetchctx_t *fctx) { + isc_result_t result; + dns_message_t *message; +- dns_name_t *name, *dname, *qname, tname, *ns_name; ++ dns_name_t *name, *dname = NULL, *qname, *dqname, tname, *ns_name; ++ dns_name_t *cname = NULL; + dns_rdataset_t *rdataset, *ns_rdataset; + isc_boolean_t done, external, chaining, aa, found, want_chaining; +- isc_boolean_t have_answer, found_cname, found_type, wanted_chaining; ++ isc_boolean_t have_answer, found_cname, found_dname, found_type; ++ isc_boolean_t wanted_chaining; + unsigned int aflag; + dns_rdatatype_t type; +- dns_fixedname_t fdname, fqname; ++ dns_fixedname_t fdname, fqname, fqdname; + dns_view_t *view; + + FCTXTRACE("answer_response"); +@@ -6738,6 +6745,7 @@ answer_response(fetchctx_t *fctx) { + + done = ISC_FALSE; + found_cname = ISC_FALSE; ++ found_dname = ISC_FALSE; + found_type = ISC_FALSE; + chaining = ISC_FALSE; + have_answer = ISC_FALSE; +@@ -6747,12 +6755,13 @@ answer_response(fetchctx_t *fctx) { + aa = ISC_TRUE; + else + aa = ISC_FALSE; +- qname = &fctx->name; ++ dqname = qname = &fctx->name; + type = fctx->type; + view = fctx->res->view; ++ dns_fixedname_init(&fqdname); + result = dns_message_firstname(message, DNS_SECTION_ANSWER); + while (!done && result == ISC_R_SUCCESS) { +- dns_namereln_t namereln; ++ dns_namereln_t namereln, dnamereln; + int order; + unsigned int nlabels; + +@@ -6760,6 +6769,8 @@ answer_response(fetchctx_t *fctx) { + dns_message_currentname(message, DNS_SECTION_ANSWER, &name); + external = ISC_TF(!dns_name_issubdomain(name, &fctx->domain)); + namereln = dns_name_fullcompare(qname, name, &order, &nlabels); ++ dnamereln = dns_name_fullcompare(dqname, name, &order, ++ &nlabels); + if (namereln == dns_namereln_equal) { + wanted_chaining = ISC_FALSE; + for (rdataset = ISC_LIST_HEAD(name->list); +@@ -6854,7 +6865,7 @@ answer_response(fetchctx_t *fctx) { + } + } else if (rdataset->type == dns_rdatatype_rrsig + && rdataset->covers == +- dns_rdatatype_cname ++ dns_rdatatype_cname + && !found_type) { + /* + * We're looking for something else, +@@ -6884,11 +6895,18 @@ answer_response(fetchctx_t *fctx) { + * a CNAME or DNAME). + */ + INSIST(!external); +- if (aflag == +- DNS_RDATASETATTR_ANSWER) { ++ if ((rdataset->type != ++ dns_rdatatype_cname) || ++ !found_dname || ++ (aflag == ++ DNS_RDATASETATTR_ANSWER)) ++ { + have_answer = ISC_TRUE; ++ if (rdataset->type == ++ dns_rdatatype_cname) ++ cname = name; + name->attributes |= +- DNS_NAMEATTR_ANSWER; ++ DNS_NAMEATTR_ANSWER; + } + rdataset->attributes |= aflag; + if (aa) +@@ -6982,11 +7000,11 @@ answer_response(fetchctx_t *fctx) { + return (DNS_R_FORMERR); + } + +- if (namereln != dns_namereln_subdomain) { ++ if (dnamereln != dns_namereln_subdomain) { + char qbuf[DNS_NAME_FORMATSIZE]; + char obuf[DNS_NAME_FORMATSIZE]; + +- dns_name_format(qname, qbuf, ++ dns_name_format(dqname, qbuf, + sizeof(qbuf)); + dns_name_format(name, obuf, + sizeof(obuf)); +@@ -7001,7 +7019,7 @@ answer_response(fetchctx_t *fctx) { + want_chaining = ISC_TRUE; + POST(want_chaining); + aflag = DNS_RDATASETATTR_ANSWER; +- result = dname_target(rdataset, qname, ++ result = dname_target(rdataset, dqname, + nlabels, &fdname); + if (result == ISC_R_NOSPACE) { + /* +@@ -7018,10 +7036,13 @@ answer_response(fetchctx_t *fctx) { + + dname = dns_fixedname_name(&fdname); + if (!is_answertarget_allowed(view, +- qname, rdataset->type, +- dname, &fctx->domain)) { ++ dqname, rdataset->type, ++ dname, &fctx->domain)) ++ { + return (DNS_R_SERVFAIL); + } ++ dqname = dns_fixedname_name(&fqdname); ++ dns_name_copy(dname, dqname, NULL); + } else { + /* + * We've found a signature that +@@ -7046,6 +7067,10 @@ answer_response(fetchctx_t *fctx) { + INSIST(!external); + if (aflag == DNS_RDATASETATTR_ANSWER) { + have_answer = ISC_TRUE; ++ found_dname = ISC_TRUE; ++ if (cname != NULL) ++ cname->attributes &= ++ ~DNS_NAMEATTR_ANSWER; + name->attributes |= + DNS_NAMEATTR_ANSWER; + } +-- +2.7.4 + diff --git a/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb b/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb index 4e2e856b72..fa45809980 100644 --- a/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb +++ b/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb @@ -27,6 +27,7 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \ file://CVE-2016-2088.patch \ file://CVE-2016-2775.patch \ file://CVE-2016-2776.patch \ + file://CVE-2016-8864.patch \ " SRC_URI[md5sum] = "bcf7e772b616f7259420a3edc5df350a" From 01c4b5499d442ceb3e35b33dfa7f39c25e471121 Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Thu, 13 Apr 2017 13:48:13 +0800 Subject: [PATCH 058/129] bind: Security fix CVE-2016-6170 CVE-2016-6170: ISC BIND through 9.9.9-P1, 9.10.x through 9.10.4-P1, and 9.11.x through 9.11.0b1 allows primary DNS servers to cause a denial of service (secondary DNS server crash) via a large AXFR response, and possibly allows IXFR servers to cause a denial of service (IXFR client crash) via a large IXFR response and allows remote authenticated users to cause a denial of service (primary DNS server crash) via a large UPDATE message. External References: https://nvd.nist.gov/vuln/detail/CVE-2016-6170 Patch from: https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=commit;h=1bbcfe2fc84f57b1e4e075fb3bc2a1dd0a3a851f (From OE-Core rev: 14abd767349bc868ca59838f1af3aaf17dfe4350) (From OE-Core rev: 1d7829ce5e125d9c416ebd66e9363e78f8f5ae1c) Signed-off-by: Yi Zhao Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../bind/bind/CVE-2016-6170.patch | 1090 +++++++++++++++++ .../bind/bind_9.10.3-P3.bb | 1 + 2 files changed, 1091 insertions(+) create mode 100644 meta/recipes-connectivity/bind/bind/CVE-2016-6170.patch diff --git a/meta/recipes-connectivity/bind/bind/CVE-2016-6170.patch b/meta/recipes-connectivity/bind/bind/CVE-2016-6170.patch new file mode 100644 index 0000000000..75bc211cb6 --- /dev/null +++ b/meta/recipes-connectivity/bind/bind/CVE-2016-6170.patch @@ -0,0 +1,1090 @@ +From 1bbcfe2fc84f57b1e4e075fb3bc2a1dd0a3a851f Mon Sep 17 00:00:00 2001 +From: Mark Andrews +Date: Wed, 2 Nov 2016 17:31:27 +1100 +Subject: [PATCH] 4504. [security] Allow the maximum number of records in a + zone to be specified. This provides a control for issues raised in + CVE-2016-6170. [RT #42143] + +(cherry picked from commit 5f8412a4cb5ee14a0e8cddd4107854b40ee3291e) + +Upstream-Status: Backport +[https://source.isc.org/cgi-bin/gitweb.cgi?p=bind9.git;a=commit;h=1bbcfe2fc84f57b1e4e075fb3bc2a1dd0a3a851f] + +CVE: CVE-2016-6170 + +Signed-off-by: Yi Zhao +--- + CHANGES | 4 + + bin/named/config.c | 1 + + bin/named/named.conf.docbook | 3 + + bin/named/update.c | 16 +++ + bin/named/zoneconf.c | 7 ++ + bin/tests/system/nsupdate/clean.sh | 1 + + bin/tests/system/nsupdate/ns3/named.conf | 7 ++ + bin/tests/system/nsupdate/ns3/too-big.test.db.in | 10 ++ + bin/tests/system/nsupdate/setup.sh | 2 + + bin/tests/system/nsupdate/tests.sh | 15 +++ + bin/tests/system/xfer/clean.sh | 1 + + bin/tests/system/xfer/ns1/axfr-too-big.db | 10 ++ + bin/tests/system/xfer/ns1/ixfr-too-big.db.in | 13 +++ + bin/tests/system/xfer/ns1/named.conf | 11 ++ + bin/tests/system/xfer/ns6/named.conf | 14 +++ + bin/tests/system/xfer/setup.sh | 2 + + bin/tests/system/xfer/tests.sh | 26 +++++ + doc/arm/Bv9ARM-book.xml | 21 ++++ + doc/arm/notes.xml | 9 ++ + lib/bind9/check.c | 2 + + lib/dns/db.c | 13 +++ + lib/dns/ecdb.c | 3 +- + lib/dns/include/dns/db.h | 20 ++++ + lib/dns/include/dns/rdataslab.h | 13 +++ + lib/dns/include/dns/result.h | 6 +- + lib/dns/include/dns/zone.h | 28 ++++- + lib/dns/rbtdb.c | 127 +++++++++++++++++++++-- + lib/dns/rdataslab.c | 13 +++ + lib/dns/result.c | 9 +- + lib/dns/sdb.c | 3 +- + lib/dns/sdlz.c | 3 +- + lib/dns/xfrin.c | 22 +++- + lib/dns/zone.c | 23 +++- + lib/isccfg/namedconf.c | 1 + + 34 files changed, 444 insertions(+), 15 deletions(-) + create mode 100644 bin/tests/system/nsupdate/ns3/too-big.test.db.in + create mode 100644 bin/tests/system/xfer/ns1/axfr-too-big.db + create mode 100644 bin/tests/system/xfer/ns1/ixfr-too-big.db.in + +diff --git a/CHANGES b/CHANGES +index 41cfce5..97d2e60 100644 +--- a/CHANGES ++++ b/CHANGES +@@ -1,3 +1,7 @@ ++4504. [security] Allow the maximum number of records in a zone to ++ be specified. This provides a control for issues ++ raised in CVE-2016-6170. [RT #42143] ++ + 4489. [security] It was possible to trigger assertions when processing + a response. (CVE-2016-8864) [RT #43465] + +diff --git a/bin/named/config.c b/bin/named/config.c +index f06348c..c24e334 100644 +--- a/bin/named/config.c ++++ b/bin/named/config.c +@@ -209,6 +209,7 @@ options {\n\ + max-transfer-time-out 120;\n\ + max-transfer-idle-in 60;\n\ + max-transfer-idle-out 60;\n\ ++ max-records 0;\n\ + max-retry-time 1209600; /* 2 weeks */\n\ + min-retry-time 500;\n\ + max-refresh-time 2419200; /* 4 weeks */\n\ +diff --git a/bin/named/named.conf.docbook b/bin/named/named.conf.docbook +index 4c99a61..c2d173a 100644 +--- a/bin/named/named.conf.docbook ++++ b/bin/named/named.conf.docbook +@@ -338,6 +338,7 @@ options { + }; + + max-journal-size size_no_default; ++ max-records integer; + max-transfer-time-in integer; + max-transfer-time-out integer; + max-transfer-idle-in integer; +@@ -527,6 +528,7 @@ view string optional_class + }; + + max-journal-size size_no_default; ++ max-records integer; + max-transfer-time-in integer; + max-transfer-time-out integer; + max-transfer-idle-in integer; +@@ -624,6 +626,7 @@ zone string optional_class + }; + + max-journal-size size_no_default; ++ max-records integer; + max-transfer-time-in integer; + max-transfer-time-out integer; + max-transfer-idle-in integer; +diff --git a/bin/named/update.c b/bin/named/update.c +index 83b1a05..cc2a611 100644 +--- a/bin/named/update.c ++++ b/bin/named/update.c +@@ -2455,6 +2455,8 @@ update_action(isc_task_t *task, isc_event_t *event) { + isc_boolean_t had_dnskey; + dns_rdatatype_t privatetype = dns_zone_getprivatetype(zone); + dns_ttl_t maxttl = 0; ++ isc_uint32_t maxrecords; ++ isc_uint64_t records; + + INSIST(event->ev_type == DNS_EVENT_UPDATE); + +@@ -3138,6 +3140,20 @@ update_action(isc_task_t *task, isc_event_t *event) { + } + } + ++ maxrecords = dns_zone_getmaxrecords(zone); ++ if (maxrecords != 0U) { ++ result = dns_db_getsize(db, ver, &records, NULL); ++ if (result == ISC_R_SUCCESS && records > maxrecords) { ++ update_log(client, zone, ISC_LOG_ERROR, ++ "records in zone (%" ++ ISC_PRINT_QUADFORMAT ++ "u) exceeds max-records (%u)", ++ records, maxrecords); ++ result = DNS_R_TOOMANYRECORDS; ++ goto failure; ++ } ++ } ++ + journalfile = dns_zone_getjournal(zone); + if (journalfile != NULL) { + update_log(client, zone, LOGLEVEL_DEBUG, +diff --git a/bin/named/zoneconf.c b/bin/named/zoneconf.c +index 4ee3dfe..14dd8ce 100644 +--- a/bin/named/zoneconf.c ++++ b/bin/named/zoneconf.c +@@ -978,6 +978,13 @@ ns_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig, + dns_zone_setmaxttl(raw, maxttl); + } + ++ obj = NULL; ++ result = ns_config_get(maps, "max-records", &obj); ++ INSIST(result == ISC_R_SUCCESS && obj != NULL); ++ dns_zone_setmaxrecords(mayberaw, cfg_obj_asuint32(obj)); ++ if (zone != mayberaw) ++ dns_zone_setmaxrecords(zone, 0); ++ + if (raw != NULL && filename != NULL) { + #define SIGNED ".signed" + size_t signedlen = strlen(filename) + sizeof(SIGNED); +diff --git a/bin/tests/system/nsupdate/clean.sh b/bin/tests/system/nsupdate/clean.sh +index aaefc02..ea25545 100644 +--- a/bin/tests/system/nsupdate/clean.sh ++++ b/bin/tests/system/nsupdate/clean.sh +@@ -32,6 +32,7 @@ rm -f ns3/example.db.jnl ns3/example.db + rm -f ns3/nsec3param.test.db.signed.jnl ns3/nsec3param.test.db ns3/nsec3param.test.db.signed ns3/dsset-nsec3param.test. + rm -f ns3/dnskey.test.db.signed.jnl ns3/dnskey.test.db ns3/dnskey.test.db.signed ns3/dsset-dnskey.test. + rm -f ns3/K* ++rm -f ns3/too-big.test.db + rm -f dig.out.* + rm -f jp.out.ns3.* + rm -f Kxxx.* +diff --git a/bin/tests/system/nsupdate/ns3/named.conf b/bin/tests/system/nsupdate/ns3/named.conf +index 2abd522..68ff27a 100644 +--- a/bin/tests/system/nsupdate/ns3/named.conf ++++ b/bin/tests/system/nsupdate/ns3/named.conf +@@ -60,3 +60,10 @@ zone "dnskey.test" { + allow-update { any; }; + file "dnskey.test.db.signed"; + }; ++ ++zone "too-big.test" { ++ type master; ++ allow-update { any; }; ++ max-records 3; ++ file "too-big.test.db"; ++}; +diff --git a/bin/tests/system/nsupdate/ns3/too-big.test.db.in b/bin/tests/system/nsupdate/ns3/too-big.test.db.in +new file mode 100644 +index 0000000..7ff1e4a +--- /dev/null ++++ b/bin/tests/system/nsupdate/ns3/too-big.test.db.in +@@ -0,0 +1,10 @@ ++; Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") ++; ++; This Source Code Form is subject to the terms of the Mozilla Public ++; License, v. 2.0. If a copy of the MPL was not distributed with this ++; file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ ++$TTL 10 ++too-big.test. IN SOA too-big.test. hostmaster.too-big.test. 1 3600 900 2419200 3600 ++too-big.test. IN NS too-big.test. ++too-big.test. IN A 10.53.0.3 +diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh +index 828255e..43c4094 100644 +--- a/bin/tests/system/nsupdate/setup.sh ++++ b/bin/tests/system/nsupdate/setup.sh +@@ -27,12 +27,14 @@ test -r $RANDFILE || $GENRANDOM 400 $RANDFILE + rm -f ns1/*.jnl ns1/example.db ns2/*.jnl ns2/example.bk + rm -f ns2/update.bk ns2/update.alt.bk + rm -f ns3/example.db.jnl ++rm -f ns3/too-big.test.db.jnl + + cp -f ns1/example1.db ns1/example.db + sed 's/example.nil/other.nil/g' ns1/example1.db > ns1/other.db + sed 's/example.nil/unixtime.nil/g' ns1/example1.db > ns1/unixtime.db + sed 's/example.nil/keytests.nil/g' ns1/example1.db > ns1/keytests.db + cp -f ns3/example.db.in ns3/example.db ++cp -f ns3/too-big.test.db.in ns3/too-big.test.db + + # update_test.pl has its own zone file because it + # requires a specific NS record set. +diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh +index 78d501e..0a6bbd3 100755 +--- a/bin/tests/system/nsupdate/tests.sh ++++ b/bin/tests/system/nsupdate/tests.sh +@@ -581,5 +581,20 @@ if [ $ret -ne 0 ]; then + status=1 + fi + ++n=`expr $n + 1` ++echo "I:check that adding too many records is blocked ($n)" ++ret=0 ++$NSUPDATE -v << EOF > nsupdate.out-$n 2>&1 && ret=1 ++server 10.53.0.3 5300 ++zone too-big.test. ++update add r1.too-big.test 3600 IN TXT r1.too-big.test ++send ++EOF ++grep "update failed: SERVFAIL" nsupdate.out-$n > /dev/null || ret=1 ++DIG +tcp @10.53.0.3 -p 5300 r1.too-big.test TXT > dig.out.ns3.test$n ++grep "status: NXDOMAIN" dig.out.ns3.test$n > /dev/null || ret=1 ++grep "records in zone (4) exceeds max-records (3)" ns3/named.run > /dev/null || ret=1 ++[ $ret = 0 ] || { echo I:failed; status=1; } ++ + echo "I:exit status: $status" + exit $status +diff --git a/bin/tests/system/xfer/clean.sh b/bin/tests/system/xfer/clean.sh +index 48aa159..da62a33 100644 +--- a/bin/tests/system/xfer/clean.sh ++++ b/bin/tests/system/xfer/clean.sh +@@ -36,3 +36,4 @@ rm -f ns7/*.db ns7/*.bk ns7/*.jnl + rm -f */named.memstats + rm -f */named.run + rm -f */ans.run ++rm -f ns1/ixfr-too-big.db ns1/ixfr-too-big.db.jnl +diff --git a/bin/tests/system/xfer/ns1/axfr-too-big.db b/bin/tests/system/xfer/ns1/axfr-too-big.db +new file mode 100644 +index 0000000..d43760d +--- /dev/null ++++ b/bin/tests/system/xfer/ns1/axfr-too-big.db +@@ -0,0 +1,10 @@ ++; Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") ++; ++; This Source Code Form is subject to the terms of the Mozilla Public ++; License, v. 2.0. If a copy of the MPL was not distributed with this ++; file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ ++$TTL 3600 ++@ IN SOA . . 0 0 0 0 0 ++@ IN NS . ++$GENERATE 1-29 host$ A 1.2.3.$ +diff --git a/bin/tests/system/xfer/ns1/ixfr-too-big.db.in b/bin/tests/system/xfer/ns1/ixfr-too-big.db.in +new file mode 100644 +index 0000000..318bb77 +--- /dev/null ++++ b/bin/tests/system/xfer/ns1/ixfr-too-big.db.in +@@ -0,0 +1,13 @@ ++; Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") ++; ++; This Source Code Form is subject to the terms of the Mozilla Public ++; License, v. 2.0. If a copy of the MPL was not distributed with this ++; file, You can obtain one at http://mozilla.org/MPL/2.0/. ++ ++$TTL 3600 ++@ IN SOA . . 0 0 0 0 0 ++@ IN NS ns1 ++@ IN NS ns6 ++ns1 IN A 10.53.0.1 ++ns6 IN A 10.53.0.6 ++$GENERATE 1-25 host$ A 1.2.3.$ +diff --git a/bin/tests/system/xfer/ns1/named.conf b/bin/tests/system/xfer/ns1/named.conf +index 07dad85..1d29292 100644 +--- a/bin/tests/system/xfer/ns1/named.conf ++++ b/bin/tests/system/xfer/ns1/named.conf +@@ -44,3 +44,14 @@ zone "slave" { + type master; + file "slave.db"; + }; ++ ++zone "axfr-too-big" { ++ type master; ++ file "axfr-too-big.db"; ++}; ++ ++zone "ixfr-too-big" { ++ type master; ++ allow-update { any; }; ++ file "ixfr-too-big.db"; ++}; +diff --git a/bin/tests/system/xfer/ns6/named.conf b/bin/tests/system/xfer/ns6/named.conf +index c9421b1..a12a92c 100644 +--- a/bin/tests/system/xfer/ns6/named.conf ++++ b/bin/tests/system/xfer/ns6/named.conf +@@ -52,3 +52,17 @@ zone "slave" { + masters { 10.53.0.1; }; + file "slave.bk"; + }; ++ ++zone "axfr-too-big" { ++ type slave; ++ max-records 30; ++ masters { 10.53.0.1; }; ++ file "axfr-too-big.bk"; ++}; ++ ++zone "ixfr-too-big" { ++ type slave; ++ max-records 30; ++ masters { 10.53.0.1; }; ++ file "ixfr-too-big.bk"; ++}; +diff --git a/bin/tests/system/xfer/setup.sh b/bin/tests/system/xfer/setup.sh +index 56ca901..c55abf8 100644 +--- a/bin/tests/system/xfer/setup.sh ++++ b/bin/tests/system/xfer/setup.sh +@@ -33,3 +33,5 @@ cp -f ns4/named.conf.base ns4/named.conf + + cp ns2/slave.db.in ns2/slave.db + touch -t 200101010000 ns2/slave.db ++ ++cp -f ns1/ixfr-too-big.db.in ns1/ixfr-too-big.db +diff --git a/bin/tests/system/xfer/tests.sh b/bin/tests/system/xfer/tests.sh +index 67b2a1a..fe33f0a 100644 +--- a/bin/tests/system/xfer/tests.sh ++++ b/bin/tests/system/xfer/tests.sh +@@ -368,5 +368,31 @@ $DIGCMD nil. TXT | grep 'incorrect key AXFR' >/dev/null && { + status=1 + } + ++n=`expr $n + 1` ++echo "I:test that a zone with too many records is rejected (AXFR) ($n)" ++tmp=0 ++grep "'axfr-too-big/IN'.*: too many records" ns6/named.run >/dev/null || tmp=1 ++if test $tmp != 0 ; then echo "I:failed"; fi ++status=`expr $status + $tmp` ++ ++n=`expr $n + 1` ++echo "I:test that a zone with too many records is rejected (IXFR) ($n)" ++tmp=0 ++grep "'ixfr-too-big./IN.*: too many records" ns6/named.run >/dev/null && tmp=1 ++$NSUPDATE << EOF ++zone ixfr-too-big ++server 10.53.0.1 5300 ++update add the-31st-record.ixfr-too-big 0 TXT this is it ++send ++EOF ++for i in 1 2 3 4 5 6 7 8 ++do ++ grep "'ixfr-too-big/IN'.*: too many records" ns6/named.run >/dev/null && break ++ sleep 1 ++done ++grep "'ixfr-too-big/IN'.*: too many records" ns6/named.run >/dev/null || tmp=1 ++if test $tmp != 0 ; then echo "I:failed"; fi ++status=`expr $status + $tmp` ++ + echo "I:exit status: $status" + exit $status +diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml +index 848b582..0369505 100644 +--- a/doc/arm/Bv9ARM-book.xml ++++ b/doc/arm/Bv9ARM-book.xml +@@ -4858,6 +4858,7 @@ badresp:1,adberr:0,findfail:0,valfail:0] + use-queryport-pool yes_or_no; + queryport-pool-ports number; + queryport-pool-updateinterval number; ++ max-records number; + max-transfer-time-in number; + max-transfer-time-out number; + max-transfer-idle-in number; +@@ -8164,6 +8165,16 @@ avoid-v6-udp-ports { 40000; range 50000 60000; }; + + + ++ max-records ++ ++ ++ The maximum number of records permitted in a zone. ++ The default is zero which means unlimited. ++ ++ ++ ++ ++ + host-statistics-max + + +@@ -12056,6 +12067,16 @@ zone zone_name class + + ++ max-records ++ ++ ++ See the description of ++ max-records in . ++ ++ ++ ++ ++ + max-transfer-time-in + + +diff --git a/doc/arm/notes.xml b/doc/arm/notes.xml +index 095eb5b..36495e7 100644 +--- a/doc/arm/notes.xml ++++ b/doc/arm/notes.xml +@@ -52,6 +52,15 @@ + + + ++ Added the ability to specify the maximum number of records ++ permitted in a zone (max-records #;). This provides a mechanism ++ to block overly large zone transfers, which is a potential risk ++ with slave zones from other parties, as described in CVE-2016-6170. ++ [RT #42143] ++ ++ ++ ++ + Duplicate EDNS COOKIE options in a response could trigger + an assertion failure. This flaw is disclosed in CVE-2016-2088. + [RT #41809] +diff --git a/lib/bind9/check.c b/lib/bind9/check.c +index b8c05dd..edb7534 100644 +--- a/lib/bind9/check.c ++++ b/lib/bind9/check.c +@@ -1510,6 +1510,8 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, + REDIRECTZONE }, + { "masters", SLAVEZONE | STUBZONE | REDIRECTZONE }, + { "max-ixfr-log-size", MASTERZONE | SLAVEZONE | STREDIRECTZONE }, ++ { "max-records", MASTERZONE | SLAVEZONE | STUBZONE | STREDIRECTZONE | ++ STATICSTUBZONE | REDIRECTZONE }, + { "max-refresh-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "max-retry-time", SLAVEZONE | STUBZONE | STREDIRECTZONE }, + { "max-transfer-idle-in", SLAVEZONE | STUBZONE | STREDIRECTZONE }, +diff --git a/lib/dns/db.c b/lib/dns/db.c +index 7e4f357..ced94a5 100644 +--- a/lib/dns/db.c ++++ b/lib/dns/db.c +@@ -999,6 +999,19 @@ dns_db_getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, + } + + isc_result_t ++dns_db_getsize(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records, ++ isc_uint64_t *bytes) ++{ ++ REQUIRE(DNS_DB_VALID(db)); ++ REQUIRE(dns_db_iszone(db) == ISC_TRUE); ++ ++ if (db->methods->getsize != NULL) ++ return ((db->methods->getsize)(db, version, records, bytes)); ++ ++ return (ISC_R_NOTFOUND); ++} ++ ++isc_result_t + dns_db_setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, + isc_stdtime_t resign) + { +diff --git a/lib/dns/ecdb.c b/lib/dns/ecdb.c +index 553a339..b5d04d2 100644 +--- a/lib/dns/ecdb.c ++++ b/lib/dns/ecdb.c +@@ -587,7 +587,8 @@ static dns_dbmethods_t ecdb_methods = { + NULL, /* findnodeext */ + NULL, /* findext */ + NULL, /* setcachestats */ +- NULL /* hashsize */ ++ NULL, /* hashsize */ ++ NULL /* getsize */ + }; + + static isc_result_t +diff --git a/lib/dns/include/dns/db.h b/lib/dns/include/dns/db.h +index a4a4482..aff42d6 100644 +--- a/lib/dns/include/dns/db.h ++++ b/lib/dns/include/dns/db.h +@@ -195,6 +195,8 @@ typedef struct dns_dbmethods { + dns_rdataset_t *sigrdataset); + isc_result_t (*setcachestats)(dns_db_t *db, isc_stats_t *stats); + unsigned int (*hashsize)(dns_db_t *db); ++ isc_result_t (*getsize)(dns_db_t *db, dns_dbversion_t *version, ++ isc_uint64_t *records, isc_uint64_t *bytes); + } dns_dbmethods_t; + + typedef isc_result_t +@@ -1485,6 +1487,24 @@ dns_db_getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, + */ + + isc_result_t ++dns_db_getsize(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records, ++ isc_uint64_t *bytes); ++/*%< ++ * Get the number of records in the given version of the database as well ++ * as the number bytes used to store those records. ++ * ++ * Requires: ++ * \li 'db' is a valid zone database. ++ * \li 'version' is NULL or a valid version. ++ * \li 'records' is NULL or a pointer to return the record count in. ++ * \li 'bytes' is NULL or a pointer to return the byte count in. ++ * ++ * Returns: ++ * \li #ISC_R_SUCCESS ++ * \li #ISC_R_NOTIMPLEMENTED ++ */ ++ ++isc_result_t + dns_db_findnsec3node(dns_db_t *db, dns_name_t *name, + isc_boolean_t create, dns_dbnode_t **nodep); + /*%< +diff --git a/lib/dns/include/dns/rdataslab.h b/lib/dns/include/dns/rdataslab.h +index 3ac44b8..2e1e759 100644 +--- a/lib/dns/include/dns/rdataslab.h ++++ b/lib/dns/include/dns/rdataslab.h +@@ -104,6 +104,7 @@ dns_rdataslab_tordataset(unsigned char *slab, unsigned int reservelen, + * Ensures: + *\li 'rdataset' is associated and points to a valid rdataest. + */ ++ + unsigned int + dns_rdataslab_size(unsigned char *slab, unsigned int reservelen); + /*%< +@@ -116,6 +117,18 @@ dns_rdataslab_size(unsigned char *slab, unsigned int reservelen); + *\li The number of bytes in the slab, including the reservelen. + */ + ++unsigned int ++dns_rdataslab_count(unsigned char *slab, unsigned int reservelen); ++/*%< ++ * Return the number of records in the rdataslab ++ * ++ * Requires: ++ *\li 'slab' points to a slab. ++ * ++ * Returns: ++ *\li The number of records in the slab. ++ */ ++ + isc_result_t + dns_rdataslab_merge(unsigned char *oslab, unsigned char *nslab, + unsigned int reservelen, isc_mem_t *mctx, +diff --git a/lib/dns/include/dns/result.h b/lib/dns/include/dns/result.h +index 7d11c2b..93d1fd5 100644 +--- a/lib/dns/include/dns/result.h ++++ b/lib/dns/include/dns/result.h +@@ -157,8 +157,12 @@ + #define DNS_R_BADCDS (ISC_RESULTCLASS_DNS + 111) + #define DNS_R_BADCDNSKEY (ISC_RESULTCLASS_DNS + 112) + #define DNS_R_OPTERR (ISC_RESULTCLASS_DNS + 113) ++#define DNS_R_BADDNSTAP (ISC_RESULTCLASS_DNS + 114) ++#define DNS_R_BADTSIG (ISC_RESULTCLASS_DNS + 115) ++#define DNS_R_BADSIG0 (ISC_RESULTCLASS_DNS + 116) ++#define DNS_R_TOOMANYRECORDS (ISC_RESULTCLASS_DNS + 117) + +-#define DNS_R_NRESULTS 114 /*%< Number of results */ ++#define DNS_R_NRESULTS 118 /*%< Number of results */ + + /* + * DNS wire format rcodes. +diff --git a/lib/dns/include/dns/zone.h b/lib/dns/include/dns/zone.h +index a9367f1..227540b 100644 +--- a/lib/dns/include/dns/zone.h ++++ b/lib/dns/include/dns/zone.h +@@ -296,6 +296,32 @@ dns_zone_getfile(dns_zone_t *zone); + */ + + void ++dns_zone_setmaxrecords(dns_zone_t *zone, isc_uint32_t records); ++/*%< ++ * Sets the maximim number of records permitted in a zone. ++ * 0 implies unlimited. ++ * ++ * Requires: ++ *\li 'zone' to be valid initialised zone. ++ * ++ * Returns: ++ *\li void ++ */ ++ ++isc_uint32_t ++dns_zone_getmaxrecords(dns_zone_t *zone); ++/*%< ++ * Gets the maximim number of records permitted in a zone. ++ * 0 implies unlimited. ++ * ++ * Requires: ++ *\li 'zone' to be valid initialised zone. ++ * ++ * Returns: ++ *\li isc_uint32_t maxrecords. ++ */ ++ ++void + dns_zone_setmaxttl(dns_zone_t *zone, isc_uint32_t maxttl); + /*%< + * Sets the max ttl of the zone. +@@ -316,7 +342,7 @@ dns_zone_getmaxttl(dns_zone_t *zone); + *\li 'zone' to be valid initialised zone. + * + * Returns: +- *\li isc_uint32_t maxttl. ++ *\li dns_ttl_t maxttl. + */ + + isc_result_t +diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c +index 62becfc..72d722f 100644 +--- a/lib/dns/rbtdb.c ++++ b/lib/dns/rbtdb.c +@@ -209,6 +209,7 @@ typedef isc_uint64_t rbtdb_serial_t; + #define free_rbtdb_callback free_rbtdb_callback64 + #define free_rdataset free_rdataset64 + #define getnsec3parameters getnsec3parameters64 ++#define getsize getsize64 + #define getoriginnode getoriginnode64 + #define getrrsetstats getrrsetstats64 + #define getsigningtime getsigningtime64 +@@ -589,6 +590,13 @@ typedef struct rbtdb_version { + isc_uint16_t iterations; + isc_uint8_t salt_length; + unsigned char salt[DNS_NSEC3_SALTSIZE]; ++ ++ /* ++ * records and bytes are covered by rwlock. ++ */ ++ isc_rwlock_t rwlock; ++ isc_uint64_t records; ++ isc_uint64_t bytes; + } rbtdb_version_t; + + typedef ISC_LIST(rbtdb_version_t) rbtdb_versionlist_t; +@@ -1130,6 +1138,7 @@ free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { + INSIST(refs == 0); + UNLINK(rbtdb->open_versions, rbtdb->current_version, link); + isc_refcount_destroy(&rbtdb->current_version->references); ++ isc_rwlock_destroy(&rbtdb->current_version->rwlock); + isc_mem_put(rbtdb->common.mctx, rbtdb->current_version, + sizeof(rbtdb_version_t)); + } +@@ -1383,6 +1392,7 @@ allocate_version(isc_mem_t *mctx, rbtdb_serial_t serial, + + static isc_result_t + newversion(dns_db_t *db, dns_dbversion_t **versionp) { ++ isc_result_t result; + dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; + rbtdb_version_t *version; + +@@ -1415,13 +1425,28 @@ newversion(dns_db_t *db, dns_dbversion_t **versionp) { + version->salt_length = 0; + memset(version->salt, 0, sizeof(version->salt)); + } +- rbtdb->next_serial++; +- rbtdb->future_version = version; +- } ++ result = isc_rwlock_init(&version->rwlock, 0, 0); ++ if (result != ISC_R_SUCCESS) { ++ isc_refcount_destroy(&version->references); ++ isc_mem_put(rbtdb->common.mctx, version, ++ sizeof(*version)); ++ version = NULL; ++ } else { ++ RWLOCK(&rbtdb->current_version->rwlock, ++ isc_rwlocktype_read); ++ version->records = rbtdb->current_version->records; ++ version->bytes = rbtdb->current_version->bytes; ++ RWUNLOCK(&rbtdb->current_version->rwlock, ++ isc_rwlocktype_read); ++ rbtdb->next_serial++; ++ rbtdb->future_version = version; ++ } ++ } else ++ result = ISC_R_NOMEMORY; + RBTDB_UNLOCK(&rbtdb->lock, isc_rwlocktype_write); + + if (version == NULL) +- return (ISC_R_NOMEMORY); ++ return (result); + + *versionp = version; + +@@ -2681,6 +2706,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, isc_boolean_t commit) { + + if (cleanup_version != NULL) { + INSIST(EMPTY(cleanup_version->changed_list)); ++ isc_rwlock_destroy(&cleanup_version->rwlock); + isc_mem_put(rbtdb->common.mctx, cleanup_version, + sizeof(*cleanup_version)); + } +@@ -6254,6 +6280,26 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, + else + rbtnode->data = newheader; + newheader->next = topheader->next; ++ if (rbtversion != NULL) ++ RWLOCK(&rbtversion->rwlock, isc_rwlocktype_write); ++ if (rbtversion != NULL && !header_nx) { ++ rbtversion->records -= ++ dns_rdataslab_count((unsigned char *)header, ++ sizeof(*header)); ++ rbtversion->bytes -= ++ dns_rdataslab_size((unsigned char *)header, ++ sizeof(*header)); ++ } ++ if (rbtversion != NULL && !newheader_nx) { ++ rbtversion->records += ++ dns_rdataslab_count((unsigned char *)newheader, ++ sizeof(*newheader)); ++ rbtversion->bytes += ++ dns_rdataslab_size((unsigned char *)newheader, ++ sizeof(*newheader)); ++ } ++ if (rbtversion != NULL) ++ RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); + if (loading) { + /* + * There are no other references to 'header' when +@@ -6355,6 +6401,16 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, + newheader->down = NULL; + rbtnode->data = newheader; + } ++ if (rbtversion != NULL && !newheader_nx) { ++ RWLOCK(&rbtversion->rwlock, isc_rwlocktype_write); ++ rbtversion->records += ++ dns_rdataslab_count((unsigned char *)newheader, ++ sizeof(*newheader)); ++ rbtversion->bytes += ++ dns_rdataslab_size((unsigned char *)newheader, ++ sizeof(*newheader)); ++ RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_write); ++ } + idx = newheader->node->locknum; + if (IS_CACHE(rbtdb)) { + ISC_LIST_PREPEND(rbtdb->rdatasets[idx], +@@ -6811,6 +6867,12 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, + */ + newheader->additional_auth = NULL; + newheader->additional_glue = NULL; ++ rbtversion->records += ++ dns_rdataslab_count((unsigned char *)newheader, ++ sizeof(*newheader)); ++ rbtversion->bytes += ++ dns_rdataslab_size((unsigned char *)newheader, ++ sizeof(*newheader)); + } else if (result == DNS_R_NXRRSET) { + /* + * This subtraction would remove all of the rdata; +@@ -6846,6 +6908,12 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, + * topheader. + */ + INSIST(rbtversion->serial >= topheader->serial); ++ rbtversion->records -= ++ dns_rdataslab_count((unsigned char *)header, ++ sizeof(*header)); ++ rbtversion->bytes -= ++ dns_rdataslab_size((unsigned char *)header, ++ sizeof(*header)); + if (topheader_prev != NULL) + topheader_prev->next = newheader; + else +@@ -7172,6 +7240,7 @@ rbt_datafixer(dns_rbtnode_t *rbtnode, void *base, size_t filesize, + unsigned char *limit = ((unsigned char *) base) + filesize; + unsigned char *p; + size_t size; ++ unsigned int count; + + REQUIRE(rbtnode != NULL); + +@@ -7179,6 +7248,9 @@ rbt_datafixer(dns_rbtnode_t *rbtnode, void *base, size_t filesize, + p = (unsigned char *) header; + + size = dns_rdataslab_size(p, sizeof(*header)); ++ count = dns_rdataslab_count(p, sizeof(*header));; ++ rbtdb->current_version->records += count; ++ rbtdb->current_version->bytes += size; + isc_crc64_update(crc, p, size); + #ifdef DEBUG + hexdump("hashing header", p, sizeof(rdatasetheader_t)); +@@ -7777,6 +7849,33 @@ getnsec3parameters(dns_db_t *db, dns_dbversion_t *version, dns_hash_t *hash, + } + + static isc_result_t ++getsize(dns_db_t *db, dns_dbversion_t *version, isc_uint64_t *records, ++ isc_uint64_t *bytes) ++{ ++ dns_rbtdb_t *rbtdb; ++ isc_result_t result = ISC_R_SUCCESS; ++ rbtdb_version_t *rbtversion = version; ++ ++ rbtdb = (dns_rbtdb_t *)db; ++ ++ REQUIRE(VALID_RBTDB(rbtdb)); ++ INSIST(rbtversion == NULL || rbtversion->rbtdb == rbtdb); ++ ++ if (rbtversion == NULL) ++ rbtversion = rbtdb->current_version; ++ ++ RWLOCK(&rbtversion->rwlock, isc_rwlocktype_read); ++ if (records != NULL) ++ *records = rbtversion->records; ++ ++ if (bytes != NULL) ++ *bytes = rbtversion->bytes; ++ RWUNLOCK(&rbtversion->rwlock, isc_rwlocktype_read); ++ ++ return (result); ++} ++ ++static isc_result_t + setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign) { + dns_rbtdb_t *rbtdb = (dns_rbtdb_t *)db; + isc_stdtime_t oldresign; +@@ -7972,7 +8071,8 @@ static dns_dbmethods_t zone_methods = { + NULL, + NULL, + NULL, +- hashsize ++ hashsize, ++ getsize + }; + + static dns_dbmethods_t cache_methods = { +@@ -8018,7 +8118,8 @@ static dns_dbmethods_t cache_methods = { + NULL, + NULL, + setcachestats, +- hashsize ++ hashsize, ++ NULL + }; + + isc_result_t +@@ -8310,6 +8411,20 @@ dns_rbtdb_create + rbtdb->current_version->salt_length = 0; + memset(rbtdb->current_version->salt, 0, + sizeof(rbtdb->current_version->salt)); ++ result = isc_rwlock_init(&rbtdb->current_version->rwlock, 0, 0); ++ if (result != ISC_R_SUCCESS) { ++ isc_refcount_destroy(&rbtdb->current_version->references); ++ isc_mem_put(mctx, rbtdb->current_version, ++ sizeof(*rbtdb->current_version)); ++ rbtdb->current_version = NULL; ++ isc_refcount_decrement(&rbtdb->references, NULL); ++ isc_refcount_destroy(&rbtdb->references); ++ free_rbtdb(rbtdb, ISC_FALSE, NULL); ++ return (result); ++ } ++ ++ rbtdb->current_version->records = 0; ++ rbtdb->current_version->bytes = 0; + rbtdb->future_version = NULL; + ISC_LIST_INIT(rbtdb->open_versions); + /* +diff --git a/lib/dns/rdataslab.c b/lib/dns/rdataslab.c +index e29dc84..63e3728 100644 +--- a/lib/dns/rdataslab.c ++++ b/lib/dns/rdataslab.c +@@ -523,6 +523,19 @@ dns_rdataslab_size(unsigned char *slab, unsigned int reservelen) { + return ((unsigned int)(current - slab)); + } + ++unsigned int ++dns_rdataslab_count(unsigned char *slab, unsigned int reservelen) { ++ unsigned int count; ++ unsigned char *current; ++ ++ REQUIRE(slab != NULL); ++ ++ current = slab + reservelen; ++ count = *current++ * 256; ++ count += *current++; ++ return (count); ++} ++ + /* + * Make the dns_rdata_t 'rdata' refer to the slab item + * beginning at '*current', which is part of a slab of type +diff --git a/lib/dns/result.c b/lib/dns/result.c +index 7be4f57..a621909 100644 +--- a/lib/dns/result.c ++++ b/lib/dns/result.c +@@ -167,11 +167,16 @@ static const char *text[DNS_R_NRESULTS] = { + "covered by negative trust anchor", /*%< 110 DNS_R_NTACOVERED */ + "bad CDS", /*%< 111 DNS_R_BADCSD */ + "bad CDNSKEY", /*%< 112 DNS_R_BADCDNSKEY */ +- "malformed OPT option" /*%< 113 DNS_R_OPTERR */ ++ "malformed OPT option", /*%< 113 DNS_R_OPTERR */ ++ "malformed DNSTAP data", /*%< 114 DNS_R_BADDNSTAP */ ++ ++ "TSIG in wrong location", /*%< 115 DNS_R_BADTSIG */ ++ "SIG(0) in wrong location", /*%< 116 DNS_R_BADSIG0 */ ++ "too many records", /*%< 117 DNS_R_TOOMANYRECORDS */ + }; + + static const char *rcode_text[DNS_R_NRCODERESULTS] = { +- "NOERROR", /*%< 0 DNS_R_NOEROR */ ++ "NOERROR", /*%< 0 DNS_R_NOERROR */ + "FORMERR", /*%< 1 DNS_R_FORMERR */ + "SERVFAIL", /*%< 2 DNS_R_SERVFAIL */ + "NXDOMAIN", /*%< 3 DNS_R_NXDOMAIN */ +diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c +index abfeeb0..19397e0 100644 +--- a/lib/dns/sdb.c ++++ b/lib/dns/sdb.c +@@ -1298,7 +1298,8 @@ static dns_dbmethods_t sdb_methods = { + findnodeext, + findext, + NULL, /* setcachestats */ +- NULL /* hashsize */ ++ NULL, /* hashsize */ ++ NULL /* getsize */ + }; + + static isc_result_t +diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c +index b1198a4..0e3163d 100644 +--- a/lib/dns/sdlz.c ++++ b/lib/dns/sdlz.c +@@ -1269,7 +1269,8 @@ static dns_dbmethods_t sdlzdb_methods = { + findnodeext, + findext, + NULL, /* setcachestats */ +- NULL /* hashsize */ ++ NULL, /* hashsize */ ++ NULL /* getsize */ + }; + + /* +diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c +index 2a6c1b4..ac566e1 100644 +--- a/lib/dns/xfrin.c ++++ b/lib/dns/xfrin.c +@@ -149,6 +149,9 @@ struct dns_xfrin_ctx { + unsigned int nrecs; /*%< Number of records recvd */ + isc_uint64_t nbytes; /*%< Number of bytes received */ + ++ unsigned int maxrecords; /*%< The maximum number of ++ records set for the zone */ ++ + isc_time_t start; /*%< Start time of the transfer */ + isc_time_t end; /*%< End time of the transfer */ + +@@ -309,10 +312,18 @@ axfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op, + static isc_result_t + axfr_apply(dns_xfrin_ctx_t *xfr) { + isc_result_t result; ++ isc_uint64_t records; + + CHECK(dns_diff_load(&xfr->diff, xfr->axfr.add, xfr->axfr.add_private)); + xfr->difflen = 0; + dns_diff_clear(&xfr->diff); ++ if (xfr->maxrecords != 0U) { ++ result = dns_db_getsize(xfr->db, xfr->ver, &records, NULL); ++ if (result == ISC_R_SUCCESS && records > xfr->maxrecords) { ++ result = DNS_R_TOOMANYRECORDS; ++ goto failure; ++ } ++ } + result = ISC_R_SUCCESS; + failure: + return (result); +@@ -396,6 +407,7 @@ ixfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op, + static isc_result_t + ixfr_apply(dns_xfrin_ctx_t *xfr) { + isc_result_t result; ++ isc_uint64_t records; + + if (xfr->ver == NULL) { + CHECK(dns_db_newversion(xfr->db, &xfr->ver)); +@@ -403,6 +415,13 @@ ixfr_apply(dns_xfrin_ctx_t *xfr) { + CHECK(dns_journal_begin_transaction(xfr->ixfr.journal)); + } + CHECK(dns_diff_apply(&xfr->diff, xfr->db, xfr->ver)); ++ if (xfr->maxrecords != 0U) { ++ result = dns_db_getsize(xfr->db, xfr->ver, &records, NULL); ++ if (result == ISC_R_SUCCESS && records > xfr->maxrecords) { ++ result = DNS_R_TOOMANYRECORDS; ++ goto failure; ++ } ++ } + if (xfr->ixfr.journal != NULL) { + result = dns_journal_writediff(xfr->ixfr.journal, &xfr->diff); + if (result != ISC_R_SUCCESS) +@@ -759,7 +778,7 @@ xfrin_reset(dns_xfrin_ctx_t *xfr) { + + static void + xfrin_fail(dns_xfrin_ctx_t *xfr, isc_result_t result, const char *msg) { +- if (result != DNS_R_UPTODATE) { ++ if (result != DNS_R_UPTODATE && result != DNS_R_TOOMANYRECORDS) { + xfrin_log(xfr, ISC_LOG_ERROR, "%s: %s", + msg, isc_result_totext(result)); + if (xfr->is_ixfr) +@@ -852,6 +871,7 @@ xfrin_create(isc_mem_t *mctx, + xfr->nmsg = 0; + xfr->nrecs = 0; + xfr->nbytes = 0; ++ xfr->maxrecords = dns_zone_getmaxrecords(zone); + isc_time_now(&xfr->start); + + xfr->tsigkey = NULL; +diff --git a/lib/dns/zone.c b/lib/dns/zone.c +index 90e558d..2b0d8e4 100644 +--- a/lib/dns/zone.c ++++ b/lib/dns/zone.c +@@ -253,6 +253,8 @@ struct dns_zone { + isc_uint32_t maxretry; + isc_uint32_t minretry; + ++ isc_uint32_t maxrecords; ++ + isc_sockaddr_t *masters; + isc_dscp_t *masterdscps; + dns_name_t **masterkeynames; +@@ -10088,6 +10090,20 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, isc_uint32_t val) { + zone->maxretry = val; + } + ++isc_uint32_t ++dns_zone_getmaxrecords(dns_zone_t *zone) { ++ REQUIRE(DNS_ZONE_VALID(zone)); ++ ++ return (zone->maxrecords); ++} ++ ++void ++dns_zone_setmaxrecords(dns_zone_t *zone, isc_uint32_t val) { ++ REQUIRE(DNS_ZONE_VALID(zone)); ++ ++ zone->maxrecords = val; ++} ++ + static isc_boolean_t + notify_isqueued(dns_zone_t *zone, unsigned int flags, dns_name_t *name, + isc_sockaddr_t *addr, dns_tsigkey_t *key) +@@ -14431,7 +14447,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { + DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_SOABEFOREAXFR); + + TIME_NOW(&now); +- switch (result) { ++ switch (xfrresult) { + case ISC_R_SUCCESS: + DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY); + /*FALLTHROUGH*/ +@@ -14558,6 +14574,11 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) { + DNS_ZONE_SETFLAG(zone, DNS_ZONEFLAG_NOIXFR); + goto same_master; + ++ case DNS_R_TOOMANYRECORDS: ++ DNS_ZONE_JITTER_ADD(&now, zone->refresh, &zone->refreshtime); ++ inc_stats(zone, dns_zonestatscounter_xfrfail); ++ break; ++ + default: + next_master: + /* +diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c +index 780ab46..e7ff1cc 100644 +--- a/lib/isccfg/namedconf.c ++++ b/lib/isccfg/namedconf.c +@@ -1679,6 +1679,7 @@ zone_clauses[] = { + { "masterfile-format", &cfg_type_masterformat, 0 }, + { "max-ixfr-log-size", &cfg_type_size, CFG_CLAUSEFLAG_OBSOLETE }, + { "max-journal-size", &cfg_type_sizenodefault, 0 }, ++ { "max-records", &cfg_type_uint32, 0 }, + { "max-refresh-time", &cfg_type_uint32, 0 }, + { "max-retry-time", &cfg_type_uint32, 0 }, + { "max-transfer-idle-in", &cfg_type_uint32, 0 }, +-- +2.7.4 + diff --git a/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb b/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb index fa45809980..8160625282 100644 --- a/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb +++ b/meta/recipes-connectivity/bind/bind_9.10.3-P3.bb @@ -28,6 +28,7 @@ SRC_URI = "ftp://ftp.isc.org/isc/bind9/${PV}/${BPN}-${PV}.tar.gz \ file://CVE-2016-2775.patch \ file://CVE-2016-2776.patch \ file://CVE-2016-8864.patch \ + file://CVE-2016-6170.patch \ " SRC_URI[md5sum] = "bcf7e772b616f7259420a3edc5df350a" From 3b12b433c0abd4d28eab7412f3efa6fc747759ea Mon Sep 17 00:00:00 2001 From: Catalin Enache Date: Fri, 14 Apr 2017 11:43:32 +0300 Subject: [PATCH 059/129] libxml2: CVE-2016-9318 libxml2 2.9.4 and earlier, as used in XMLSec 1.2.23 and earlier and other products, does not offer a flag directly indicating that the current document may be read but other files may not be opened, which makes it easier for remote attackers to conduct XML External Entity (XXE) attacks via a crafted document. Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-9318 Upstream patch: https://git.gnome.org/browse/libxml2/commit/?id=2304078555896cf1638c628f50326aeef6f0e0d0 (From OE-Core rev: 0dd44c00e3b2fbc3befc3f361624a3a60161d979) (From OE-Core rev: 53c39f29578a4468e7f64a7403e77c28d951de6a) Signed-off-by: Catalin Enache Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../libxml/libxml2/CVE-2016-9318.patch | 207 ++++++++++++++++++ meta/recipes-core/libxml/libxml2_2.9.4.bb | 1 + 2 files changed, 208 insertions(+) create mode 100644 meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch diff --git a/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch b/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch new file mode 100644 index 0000000000..3581ab83df --- /dev/null +++ b/meta/recipes-core/libxml/libxml2/CVE-2016-9318.patch @@ -0,0 +1,207 @@ +From 7fa1cd31552d52d50a9101f07c816ff6dd2d9f19 Mon Sep 17 00:00:00 2001 +From: Doran Moppert +Date: Fri, 7 Apr 2017 16:45:56 +0200 +Subject: [PATCH] Add an XML_PARSE_NOXXE flag to block all entities loading + even local + +For https://bugzilla.gnome.org/show_bug.cgi?id=772726 + +* include/libxml/parser.h: Add a new parser flag XML_PARSE_NOXXE +* elfgcchack.h, xmlIO.h, xmlIO.c: associated loading routine +* include/libxml/xmlerror.h: new error raised +* xmllint.c: adds --noxxe flag to activate the option + +Upstream-Status: Backport +CVE: CVE-2016-9318 + +Signed-off-by: Catalin Enache +--- + elfgcchack.h | 10 ++++++++++ + include/libxml/parser.h | 3 ++- + include/libxml/xmlIO.h | 8 ++++++++ + include/libxml/xmlerror.h | 1 + + parser.c | 4 ++++ + xmlIO.c | 40 +++++++++++++++++++++++++++++++++++----- + xmllint.c | 5 +++++ + 7 files changed, 65 insertions(+), 6 deletions(-) + +diff --git a/elfgcchack.h b/elfgcchack.h +index 8c52884..1b81dcd 100644 +--- a/elfgcchack.h ++++ b/elfgcchack.h +@@ -6547,6 +6547,16 @@ extern __typeof (xmlNoNetExternalEntityLoader) xmlNoNetExternalEntityLoader__int + #endif + #endif + ++#ifdef bottom_xmlIO ++#undef xmlNoXxeExternalEntityLoader ++extern __typeof (xmlNoXxeExternalEntityLoader) xmlNoXxeExternalEntityLoader __attribute((alias("xmlNoXxeExternalEntityLoader__internal_alias"))); ++#else ++#ifndef xmlNoXxeExternalEntityLoader ++extern __typeof (xmlNoXxeExternalEntityLoader) xmlNoXxeExternalEntityLoader__internal_alias __attribute((visibility("hidden"))); ++#define xmlNoXxeExternalEntityLoader xmlNoXxeExternalEntityLoader__internal_alias ++#endif ++#endif ++ + #ifdef bottom_tree + #undef xmlNodeAddContent + extern __typeof (xmlNodeAddContent) xmlNodeAddContent __attribute((alias("xmlNodeAddContent__internal_alias"))); +diff --git a/include/libxml/parser.h b/include/libxml/parser.h +index 47fbec0..63ca1b9 100644 +--- a/include/libxml/parser.h ++++ b/include/libxml/parser.h +@@ -1111,7 +1111,8 @@ typedef enum { + XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */ + XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */ + XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */ +- XML_PARSE_BIG_LINES = 1<<22 /* Store big lines numbers in text PSVI field */ ++ XML_PARSE_BIG_LINES = 1<<22,/* Store big lines numbers in text PSVI field */ ++ XML_PARSE_NOXXE = 1<<23 /* Forbid any external entity loading */ + } xmlParserOption; + + XMLPUBFUN void XMLCALL +diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h +index 3e41744..8d3fdef 100644 +--- a/include/libxml/xmlIO.h ++++ b/include/libxml/xmlIO.h +@@ -300,6 +300,14 @@ XMLPUBFUN xmlParserInputPtr XMLCALL + xmlParserCtxtPtr ctxt); + + /* ++ * A predefined entity loader external entity expansion ++ */ ++XMLPUBFUN xmlParserInputPtr XMLCALL ++ xmlNoXxeExternalEntityLoader (const char *URL, ++ const char *ID, ++ xmlParserCtxtPtr ctxt); ++ ++/* + * xmlNormalizeWindowsPath is obsolete, don't use it. + * Check xmlCanonicPath in uri.h for a better alternative. + */ +diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h +index 037c16d..3036062 100644 +--- a/include/libxml/xmlerror.h ++++ b/include/libxml/xmlerror.h +@@ -470,6 +470,7 @@ typedef enum { + XML_IO_EADDRINUSE, /* 1554 */ + XML_IO_EALREADY, /* 1555 */ + XML_IO_EAFNOSUPPORT, /* 1556 */ ++ XML_IO_ILLEGAL_XXE, /* 1557 */ + XML_XINCLUDE_RECURSION=1600, + XML_XINCLUDE_PARSE_VALUE, /* 1601 */ + XML_XINCLUDE_ENTITY_DEF_MISMATCH, /* 1602 */ +diff --git a/parser.c b/parser.c +index 53a6b7f..609a270 100644 +--- a/parser.c ++++ b/parser.c +@@ -15350,6 +15350,10 @@ xmlCtxtUseOptionsInternal(xmlParserCtxtPtr ctxt, int options, const char *encodi + ctxt->options |= XML_PARSE_NONET; + options -= XML_PARSE_NONET; + } ++ if (options & XML_PARSE_NOXXE) { ++ ctxt->options |= XML_PARSE_NOXXE; ++ options -= XML_PARSE_NOXXE; ++ } + if (options & XML_PARSE_COMPACT) { + ctxt->options |= XML_PARSE_COMPACT; + options -= XML_PARSE_COMPACT; +diff --git a/xmlIO.c b/xmlIO.c +index 1a79c09..304f822 100644 +--- a/xmlIO.c ++++ b/xmlIO.c +@@ -210,6 +210,7 @@ static const char *IOerr[] = { + "adddress in use", /* EADDRINUSE */ + "already in use", /* EALREADY */ + "unknown address familly", /* EAFNOSUPPORT */ ++ "Attempt to load external entity %s", /* XML_IO_ILLEGAL_XXE */ + }; + + #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) +@@ -4053,13 +4054,22 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID, + xmlGenericError(xmlGenericErrorContext, + "xmlDefaultExternalEntityLoader(%s, xxx)\n", URL); + #endif +- if ((ctxt != NULL) && (ctxt->options & XML_PARSE_NONET)) { ++ if (ctxt != NULL) { + int options = ctxt->options; + +- ctxt->options -= XML_PARSE_NONET; +- ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); +- ctxt->options = options; +- return(ret); ++ if (options & XML_PARSE_NOXXE) { ++ ctxt->options -= XML_PARSE_NOXXE; ++ ret = xmlNoXxeExternalEntityLoader(URL, ID, ctxt); ++ ctxt->options = options; ++ return(ret); ++ } ++ ++ if (options & XML_PARSE_NONET) { ++ ctxt->options -= XML_PARSE_NONET; ++ ret = xmlNoNetExternalEntityLoader(URL, ID, ctxt); ++ ctxt->options = options; ++ return(ret); ++ } + } + #ifdef LIBXML_CATALOG_ENABLED + resource = xmlResolveResourceFromCatalog(URL, ID, ctxt); +@@ -4160,6 +4170,13 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID, + xmlParserInputPtr input = NULL; + xmlChar *resource = NULL; + ++ if (ctxt == NULL) { ++ return(NULL); ++ } ++ if (ctxt->input_id == 1) { ++ return xmlDefaultExternalEntityLoader((const char *) URL, ID, ctxt); ++ } ++ + #ifdef LIBXML_CATALOG_ENABLED + resource = xmlResolveResourceFromCatalog(URL, ID, ctxt); + #endif +@@ -4182,5 +4199,18 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID, + return(input); + } + ++xmlParserInputPtr ++xmlNoXxeExternalEntityLoader(const char *URL, const char *ID, ++ xmlParserCtxtPtr ctxt) { ++ if (ctxt == NULL) { ++ return(NULL); ++ } ++ if (ctxt->input_id == 1) { ++ return xmlDefaultExternalEntityLoader((const char *) URL, ID, ctxt); ++ } ++ xmlIOErr(XML_IO_ILLEGAL_XXE, (const char *) URL); ++ return(NULL); ++} ++ + #define bottom_xmlIO + #include "elfgcchack.h" +diff --git a/xmllint.c b/xmllint.c +index 67f7adb..d9368c1 100644 +--- a/xmllint.c ++++ b/xmllint.c +@@ -3019,6 +3019,7 @@ static void usage(const char *name) { + printf("\t--path 'paths': provide a set of paths for resources\n"); + printf("\t--load-trace : print trace of all external entities loaded\n"); + printf("\t--nonet : refuse to fetch DTDs or entities over network\n"); ++ printf("\t--noxxe : forbid any external entity loading\n"); + printf("\t--nocompact : do not generate compact text nodes\n"); + printf("\t--htmlout : output results as HTML\n"); + printf("\t--nowrap : do not put HTML doc wrapper\n"); +@@ -3461,6 +3462,10 @@ main(int argc, char **argv) { + (!strcmp(argv[i], "--nonet"))) { + options |= XML_PARSE_NONET; + xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader); ++ } else if ((!strcmp(argv[i], "-noxxe")) || ++ (!strcmp(argv[i], "--noxxe"))) { ++ options |= XML_PARSE_NOXXE; ++ xmlSetExternalEntityLoader(xmlNoXxeExternalEntityLoader); + } else if ((!strcmp(argv[i], "-nocompact")) || + (!strcmp(argv[i], "--nocompact"))) { + options &= ~XML_PARSE_COMPACT; +-- +2.10.2 + diff --git a/meta/recipes-core/libxml/libxml2_2.9.4.bb b/meta/recipes-core/libxml/libxml2_2.9.4.bb index ba08c9c994..c2c3c9326b 100644 --- a/meta/recipes-core/libxml/libxml2_2.9.4.bb +++ b/meta/recipes-core/libxml/libxml2_2.9.4.bb @@ -23,6 +23,7 @@ SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \ file://libxml2-CVE-2016-5131.patch \ file://libxml2-CVE-2016-4658.patch \ file://libxml2-fix_NULL_pointer_derefs.patch \ + file://CVE-2016-9318.patch \ " SRC_URI[libtar.md5sum] = "ae249165c173b1ff386ee8ad676815f5" From 0c5ab30a30bfa6c1f13d758339207083b6a281e7 Mon Sep 17 00:00:00 2001 From: Catalin Enache Date: Wed, 5 Apr 2017 15:06:51 +0300 Subject: [PATCH 060/129] ghostscript: CVE-2017-7207 The mem_get_bits_rectangle function in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (NULL pointer dereference) via a crafted PostScript document. Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-7207 Upstream patch: http://git.ghostscript.com/?p=ghostpdl.git;h=309eca4e0a31ea70dcc844812691439312dad091 (From OE-Core rev: 0f22a27c2abd2f2dd9119681f139dd85dcb6479d) (From OE-Core rev: 3497bb564fa3bb1d6b938630cd660ee77bec5ab7) Signed-off-by: Catalin Enache Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../ghostscript/CVE-2017-7207.patch | 39 +++++++++++++++++++ .../ghostscript/ghostscript_9.19.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7207.patch diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7207.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7207.patch new file mode 100644 index 0000000000..a05dc02c6c --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-7207.patch @@ -0,0 +1,39 @@ +From 0e88bee1304993668fede72498d656a2dd33a35e Mon Sep 17 00:00:00 2001 +From: Ken Sharp +Date: Mon, 20 Mar 2017 09:34:11 +0000 +Subject: [PATCH] Ensure a device has raster memory, before trying to read it. + +Bug #697676 "Null pointer dereference in mem_get_bits_rectangle()" + +This is only possible by abusing/mis-using Ghostscript-specific +language extensions, so cannot happen in a general PostScript program. + +Nevertheless, Ghostscript should not crash. So this commit checks the +memory device to see if raster memory has been allocated, before trying +to read from it. + +Upstream-Status: Backport +CVE: CVE-2017-7207 + +Author: Ken Sharp +Signed-off-by: Catalin Enache +--- + base/gdevmem.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/base/gdevmem.c b/base/gdevmem.c +index 41108ba..183f96d 100644 +--- a/base/gdevmem.c ++++ b/base/gdevmem.c +@@ -605,6 +605,8 @@ mem_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect, + GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE; + return_error(gs_error_rangecheck); + } ++ if (mdev->line_ptrs == 0x00) ++ return_error(gs_error_rangecheck); + if ((w <= 0) | (h <= 0)) { + if ((w | h) < 0) + return_error(gs_error_rangecheck); +-- +2.10.2 + diff --git a/meta/recipes-extended/ghostscript/ghostscript_9.19.bb b/meta/recipes-extended/ghostscript/ghostscript_9.19.bb index fe2016b15a..5b348a583e 100644 --- a/meta/recipes-extended/ghostscript/ghostscript_9.19.bb +++ b/meta/recipes-extended/ghostscript/ghostscript_9.19.bb @@ -30,6 +30,7 @@ SRC_URI = "${SRC_URI_BASE} \ file://ghostscript-9.02-genarch.patch \ file://objarch.h \ file://cups-no-gcrypt.patch \ + file://CVE-2017-7207.patch \ " SRC_URI_class-native = "${SRC_URI_BASE} \ From 1fb5079557730f3a4c8693bbf570b93d1666190b Mon Sep 17 00:00:00 2001 From: Catalin Enache Date: Fri, 21 Apr 2017 15:04:17 +0300 Subject: [PATCH 061/129] ghostscript : CVE-2016-10219, CVE-2016-10220, CVE-2017-5951 The intersect function in base/gxfill.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (divide-by-zero error and application crash) via a crafted file. The gs_makewordimagedevice function in base/gsdevmem.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted file that is mishandled in the PDF Transparency module. The mem_get_bits_rectangle function in base/gdevmem.c in Artifex Software, Inc. Ghostscript 9.20 allows remote attackers to cause a denial of service (NULL pointer dereference and application crash) via a crafted file. References: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10219 http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10220 http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5951 Upstream patches: http://git.ghostscript.com/?p=ghostpdl.git;h=4bef1a1d32e29b68855616020dbff574b9cda08f http://git.ghostscript.com/?p=ghostpdl.git;h=daf85701dab05f17e924a48a81edc9195b4a04e8 http://git.ghostscript.com/?p=ghostpdl.git;h=bfa6b2ecbe48edc69a7d9d22a12419aed25960b8 (From OE-Core rev: 6679a4d4379f6f18554ed0042546cce94d5d0b19) (From OE-Core rev: 55fa8b210139509859258c0ee11b3534f10fa509) Signed-off-by: Catalin Enache Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../ghostscript/CVE-2016-10219.patch | 49 +++++++++++++++++ .../ghostscript/CVE-2016-10220.patch | 55 +++++++++++++++++++ .../ghostscript/CVE-2017-5951.patch | 44 +++++++++++++++ .../ghostscript/ghostscript_9.19.bb | 3 + 4 files changed, 151 insertions(+) create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch create mode 100644 meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch new file mode 100644 index 0000000000..574abe0e42 --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10219.patch @@ -0,0 +1,49 @@ +From 4bef1a1d32e29b68855616020dbff574b9cda08f Mon Sep 17 00:00:00 2001 +From: Robin Watts +Date: Thu, 29 Dec 2016 15:57:43 +0000 +Subject: [PATCH] Bug 697453: Avoid divide by 0 in scan conversion code. + +Arithmetic overflow due to extreme values in the scan conversion +code can cause a division by 0. + +Avoid this with a simple extra check. + + dx_old=cf814d81 + endp->x_next=b0e859b9 + alp->x_next=8069a73a + +leads to dx_den = 0 + +Upstream-Status: Backport +CVE: CVE-2016-10219 + +Signed-off-by: Catalin Enache +--- + base/gxfill.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/base/gxfill.c b/base/gxfill.c +index 99196c0..2f81bb0 100644 +--- a/base/gxfill.c ++++ b/base/gxfill.c +@@ -1741,7 +1741,7 @@ intersect(active_line *endp, active_line *alp, fixed y, fixed y1, fixed *p_y_new + fixed dx_old = alp->x_current - endp->x_current; + fixed dx_den = dx_old + endp->x_next - alp->x_next; + +- if (dx_den <= dx_old) ++ if (dx_den <= dx_old || dx_den == 0) + return false; /* Intersection isn't possible. */ + dy = y1 - y; + if_debug3('F', "[F]cross: dy=%g, dx_old=%g, dx_new=%g\n", +@@ -1750,7 +1750,7 @@ intersect(active_line *endp, active_line *alp, fixed y, fixed y1, fixed *p_y_new + /* Do the computation in single precision */ + /* if the values are small enough. */ + y_new = +- ((dy | dx_old) < 1L << (size_of(fixed) * 4 - 1) ? ++ (((ufixed)(dy | dx_old)) < (1L << (size_of(fixed) * 4 - 1)) ? + dy * dx_old / dx_den : + (INCR_EXPR(mq_cross), fixed_mult_quo(dy, dx_old, dx_den))) + + y; +-- +2.10.2 + diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch new file mode 100644 index 0000000000..5e1e8ba10c --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2016-10220.patch @@ -0,0 +1,55 @@ +From daf85701dab05f17e924a48a81edc9195b4a04e8 Mon Sep 17 00:00:00 2001 +From: Ken Sharp +Date: Wed, 21 Dec 2016 16:54:14 +0000 +Subject: [PATCH] fix crash with bad data supplied to makeimagedevice + +Bug #697450 "Null pointer dereference in gx_device_finalize()" + +The problem here is that the code to finalise a device unconditionally +frees the icc_struct member of the device structure. However this +particular (weird) device is not setup as a normal device, probably +because its very, very ancient. Its possible for the initialisation +of the device to abort with an error before calling gs_make_mem_device() +which is where the icc_struct member gets allocated (or set to NULL). + +If that happens, then the cleanup code tries to free the device, which +calls finalize() which tries to free a garbage pointer. + +Setting the device memory to 0x00 after we allocate it means that the +icc_struct member will be NULL< and our memory manager allows for that +happily enough, which avoids the problem. + +Upstream-Status: Backport +CVE: CVE-2016-10220 + +Signed-off-by: Catalin Enache +--- + base/gsdevmem.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/base/gsdevmem.c b/base/gsdevmem.c +index 97b9cf4..fe75bcc 100644 +--- a/base/gsdevmem.c ++++ b/base/gsdevmem.c +@@ -225,6 +225,18 @@ gs_makewordimagedevice(gx_device ** pnew_dev, const gs_matrix * pmat, + + if (pnew == 0) + return_error(gs_error_VMerror); ++ ++ /* Bug #697450 "Null pointer dereference in gx_device_finalize()" ++ * If we have incorrect data passed to gs_initialise_wordimagedevice() then the ++ * initialisation will fail, crucially it will fail *before* it calls ++ * gs_make_mem_device() which initialises the device. This means that the ++ * icc_struct member will be uninitialsed, but the device finalise method ++ * will unconditionally free that memory. Since its a garbage pointer, bad things happen. ++ * Apparently we do still need makeimagedevice to be available from ++ * PostScript, so in here just zero the device memory, which means that ++ * the finalise routine won't have a problem. ++ */ ++ memset(pnew, 0x00, st_device_memory.ssize); + code = gs_initialize_wordimagedevice(pnew, pmat, width, height, + colors, num_colors, word_oriented, + page_device, mem); +-- +2.10.2 + diff --git a/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch new file mode 100644 index 0000000000..62cc1342ad --- /dev/null +++ b/meta/recipes-extended/ghostscript/ghostscript/CVE-2017-5951.patch @@ -0,0 +1,44 @@ +From bfa6b2ecbe48edc69a7d9d22a12419aed25960b8 Mon Sep 17 00:00:00 2001 +From: Chris Liddell +Date: Thu, 6 Apr 2017 16:44:54 +0100 +Subject: [PATCH] Bug 697548: use the correct param list enumerator + +When we encountered dictionary in a ref_param_list, we were using the enumerator +for the "parent" param_list, rather than the enumerator for the param_list +we just created for the dictionary. That parent was usually the stack +list enumerator, and caused a segfault. + +Using the correct enumerator works better. + +Upstream-Status: Backport +CVE: CVE-2017-5951 + +Signed-off-by: Catalin Enache +--- + psi/iparam.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/psi/iparam.c b/psi/iparam.c +index 4e63b6d..b2fa85f 100644 +--- a/psi/iparam.c ++++ b/psi/iparam.c +@@ -770,12 +770,13 @@ ref_param_read_typed(gs_param_list * plist, gs_param_name pkey, + gs_param_enumerator_t enumr; + gs_param_key_t key; + ref_type keytype; ++ dict_param_list *dlist = (dict_param_list *) pvalue->value.d.list; + + param_init_enumerator(&enumr); +- if (!(*((iparam_list *) plist)->enumerate) +- ((iparam_list *) pvalue->value.d.list, &enumr, &key, &keytype) ++ if (!(*(dlist->enumerate)) ++ ((iparam_list *) dlist, &enumr, &key, &keytype) + && keytype == t_integer) { +- ((dict_param_list *) pvalue->value.d.list)->int_keys = 1; ++ dlist->int_keys = 1; + pvalue->type = gs_param_type_dict_int_keys; + } + } +-- +2.10.2 + diff --git a/meta/recipes-extended/ghostscript/ghostscript_9.19.bb b/meta/recipes-extended/ghostscript/ghostscript_9.19.bb index 5b348a583e..ab58157cde 100644 --- a/meta/recipes-extended/ghostscript/ghostscript_9.19.bb +++ b/meta/recipes-extended/ghostscript/ghostscript_9.19.bb @@ -31,6 +31,9 @@ SRC_URI = "${SRC_URI_BASE} \ file://objarch.h \ file://cups-no-gcrypt.patch \ file://CVE-2017-7207.patch \ + file://CVE-2016-10219.patch \ + file://CVE-2016-10220.patch \ + file://CVE-2017-5951.patch \ " SRC_URI_class-native = "${SRC_URI_BASE} \ From 78890ea22750804e3e9113e76f7ca3d7234c8342 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Fri, 12 May 2017 12:05:48 -0700 Subject: [PATCH 062/129] documentation: Prepared for YP 2.2.2 release of the manuals Changes include: * poky.ent - changing variables for 2.2.2 * mega-manual.sed - updated "2.2.1" to "2.2.2" for links * *.xml - Changed all the manual revision tables to say "June 2017" for now. (From yocto-docs rev: 9f3d983b754398b383b754df74d09fa17911137f) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/bsp-guide/bsp-guide.xml | 5 +++ documentation/dev-manual/dev-manual.xml | 5 +++ documentation/kernel-dev/kernel-dev.xml | 5 +++ documentation/mega-manual/mega-manual.xml | 5 +++ documentation/poky.ent | 8 ++-- .../profile-manual/profile-manual.xml | 5 +++ documentation/ref-manual/ref-manual.xml | 5 +++ documentation/sdk-manual/sdk-manual.xml | 5 +++ .../toaster-manual/toaster-manual.xml | 5 +++ documentation/tools/mega-manual.sed | 40 +++++++++---------- 10 files changed, 64 insertions(+), 24 deletions(-) diff --git a/documentation/bsp-guide/bsp-guide.xml b/documentation/bsp-guide/bsp-guide.xml index 362196fbdb..bf6a6f8710 100644 --- a/documentation/bsp-guide/bsp-guide.xml +++ b/documentation/bsp-guide/bsp-guide.xml @@ -118,6 +118,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/dev-manual/dev-manual.xml b/documentation/dev-manual/dev-manual.xml index 30f9342d76..2ce1652fc4 100644 --- a/documentation/dev-manual/dev-manual.xml +++ b/documentation/dev-manual/dev-manual.xml @@ -96,6 +96,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/kernel-dev/kernel-dev.xml b/documentation/kernel-dev/kernel-dev.xml index c60fd8dc62..b96acd6f0c 100644 --- a/documentation/kernel-dev/kernel-dev.xml +++ b/documentation/kernel-dev/kernel-dev.xml @@ -81,6 +81,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/mega-manual/mega-manual.xml b/documentation/mega-manual/mega-manual.xml index 501ff5faf2..157feac311 100644 --- a/documentation/mega-manual/mega-manual.xml +++ b/documentation/mega-manual/mega-manual.xml @@ -65,6 +65,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/poky.ent b/documentation/poky.ent index 506aa64c10..3756927305 100644 --- a/documentation/poky.ent +++ b/documentation/poky.ent @@ -1,10 +1,10 @@ - - + + - + - + diff --git a/documentation/profile-manual/profile-manual.xml b/documentation/profile-manual/profile-manual.xml index cd480a74cd..a88934f6e6 100644 --- a/documentation/profile-manual/profile-manual.xml +++ b/documentation/profile-manual/profile-manual.xml @@ -81,6 +81,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/ref-manual/ref-manual.xml b/documentation/ref-manual/ref-manual.xml index 0fb0d1c027..47f64769c0 100644 --- a/documentation/ref-manual/ref-manual.xml +++ b/documentation/ref-manual/ref-manual.xml @@ -112,6 +112,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/sdk-manual/sdk-manual.xml b/documentation/sdk-manual/sdk-manual.xml index 277b52b4b0..c322189689 100644 --- a/documentation/sdk-manual/sdk-manual.xml +++ b/documentation/sdk-manual/sdk-manual.xml @@ -46,6 +46,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/toaster-manual/toaster-manual.xml b/documentation/toaster-manual/toaster-manual.xml index fd2c581f6e..05efb1f3a1 100644 --- a/documentation/toaster-manual/toaster-manual.xml +++ b/documentation/toaster-manual/toaster-manual.xml @@ -56,6 +56,11 @@ January 2017 Released with the Yocto Project 2.2.1 Release. + + 2.2.2 + June 2017 + Released with the Yocto Project 2.2.2 Release. + diff --git a/documentation/tools/mega-manual.sed b/documentation/tools/mega-manual.sed index 74fc4af6c2..8aea1ced8f 100644 --- a/documentation/tools/mega-manual.sed +++ b/documentation/tools/mega-manual.sed @@ -2,32 +2,32 @@ # This style is for manual folders like "yocto-project-qs" and "poky-ref-manual". # This is the old way that did it. Can't do that now that we have "bitbake-user-manual" strings # in the mega-manual. -# s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/[a-z]*-[a-z]*-[a-z]*\/[a-z]*-[a-z]*-[a-z]*.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/yocto-project-qs\/yocto-project-qs.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/poky-ref-manual\/poky-ref-manual.html#/\"link\" href=\"#/g +# s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/[a-z]*-[a-z]*-[a-z]*\/[a-z]*-[a-z]*-[a-z]*.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/yocto-project-qs\/yocto-project-qs.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/poky-ref-manual\/poky-ref-manual.html#/\"link\" href=\"#/g # Processes all other manuals (- style) except for the BitBake User Manual because # it is not included in the mega-manual. # This style is for manual folders that use two word, which is the standard now (e.g. "ref-manual"). # This was the one-liner that worked before we introduced the BitBake User Manual, which is # not in the mega-manual. -# s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/[a-z]*-[a-z]*\/[a-z]*-[a-z]*.html#/\"link\" href=\"#/g +# s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/[a-z]*-[a-z]*\/[a-z]*-[a-z]*.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/sdk-manual\/sdk-manual.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/bsp-guide\/bsp-guide.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/dev-manual\/dev-manual.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/kernel-dev\/kernel-dev.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/profile-manual\/profile-manual.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/ref-manual\/ref-manual.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/toaster-manual\/toaster-manual.html#/\"link\" href=\"#/g -s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.1\/yocto-project-qs\/yocto-project-qs.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/sdk-manual\/sdk-manual.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/bsp-guide\/bsp-guide.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/dev-manual\/dev-manual.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/kernel-dev\/kernel-dev.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/profile-manual\/profile-manual.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/ref-manual\/ref-manual.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/toaster-manual\/toaster-manual.html#/\"link\" href=\"#/g +s/\"ulink\" href=\"http:\/\/www.yoctoproject.org\/docs\/2.2.2\/yocto-project-qs\/yocto-project-qs.html#/\"link\" href=\"#/g # Process cases where just an external manual is referenced without an id anchor -s/Yocto Project Quick Start<\/a>/Yocto Project Quick Start/g -s/Yocto Project Development Manual<\/a>/Yocto Project Development Manual/g -s/Yocto Project Software Development Kit (SDK) Developer's Guide<\/a>/Yocto Project Software Development Kit (SDK) Developer's Guide/g -s/Yocto Project Board Support Package (BSP) Developer's Guide<\/a>/Yocto Project Board Support Package (BSP) Developer's Guide/g -s/Yocto Project Profiling and Tracing Manual<\/a>/Yocto Project Profiling and Tracing Manual/g -s/Yocto Project Linux Kernel Development Manual<\/a>/Yocto Project Linux Kernel Development Manual/g -s/Yocto Project Reference Manual<\/a>/Yocto Project Reference Manual/g -s/Toaster User Manual<\/a>/Toaster User Manual/g +s/Yocto Project Quick Start<\/a>/Yocto Project Quick Start/g +s/Yocto Project Development Manual<\/a>/Yocto Project Development Manual/g +s/Yocto Project Software Development Kit (SDK) Developer's Guide<\/a>/Yocto Project Software Development Kit (SDK) Developer's Guide/g +s/Yocto Project Board Support Package (BSP) Developer's Guide<\/a>/Yocto Project Board Support Package (BSP) Developer's Guide/g +s/Yocto Project Profiling and Tracing Manual<\/a>/Yocto Project Profiling and Tracing Manual/g +s/Yocto Project Linux Kernel Development Manual<\/a>/Yocto Project Linux Kernel Development Manual/g +s/Yocto Project Reference Manual<\/a>/Yocto Project Reference Manual/g +s/Toaster User Manual<\/a>/Toaster User Manual/g From e7f948f28a56483cf6d1e4a9afda98a373869c15 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Thu, 25 May 2017 12:16:52 +0100 Subject: [PATCH 063/129] selftest: do not perform a full build in test_continue This was fetching and building the toolchain and everything else against empty download dir and sstate cache, and so was enormously slow. The test does not need that, it only checks that one fetch task fails and another succeeds when using bitbake's -k option. (From OE-Core rev: 6c69b5edc5711d2e5304a931e43eba562a095191) Signed-off-by: Alexander Kanavin Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/bbtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py index baae1e0e54..c9802a416b 100644 --- a/meta/lib/oeqa/selftest/bbtests.py +++ b/meta/lib/oeqa/selftest/bbtests.py @@ -221,7 +221,7 @@ def test_continue(self): self.track_for_cleanup(os.path.join(self.builddir, "download-selftest")) self.write_recipeinc('man',"\ndo_fail_task () {\nexit 1 \n}\n\naddtask do_fail_task before do_fetch\n" ) runCmd('bitbake -c cleanall man xcursor-transparent-theme') - result = runCmd('bitbake man xcursor-transparent-theme -k', ignore_status=True) + result = runCmd('bitbake -c unpack -k man xcursor-transparent-theme', ignore_status=True) errorpos = result.output.find('ERROR: Function failed: do_fail_task') manver = re.search("NOTE: recipe xcursor-transparent-theme-(.*?): task do_unpack: Started", result.output) continuepos = result.output.find('NOTE: recipe xcursor-transparent-theme-%s: task do_unpack: Started' % manver.group(1)) From 00966fd90d8c79a1cac80224b106da813f68f317 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 25 May 2017 12:16:50 +0100 Subject: [PATCH 064/129] insane: remove broken unsafe-references-in-binaries test This test aims to detect binaries in /bin which link to libraries in /usr/lib, for the case where the user has /usr on a separate filesystem to /. However it doesn't scan both image/ and the sysroot, so if a binary in /bin links to a library in /usr/lib that was built by the same recipe then it will error out. This test isn't enabled by default, and because of this serious bug I suspect nobody else is enabling it either. As /usr being on a separate partition to / is a very rare configuration these days I think we should delete the test: if someone cares sufficiently they should write a test that actually works. (From OE-Core rev: a6af5bbf3dad6f0951c67a0aae13ef86a8906893) (From OE-Core rev: 2f5b5685f75fc63489b628b540fcdd4c7cb27096) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/insane.bbclass | 41 ------------------------------------- 1 file changed, 41 deletions(-) diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 5ddb87b3f7..e541c72c2d 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass @@ -405,47 +405,6 @@ def package_qa_check_perm(path,name,d, elf, messages): """ return -QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries" -def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages): - """ - Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix - """ - if unsafe_references_skippable(path, name, d): - return - - if elf: - import subprocess as sub - pn = d.getVar('PN', True) - - exec_prefix = d.getVar('exec_prefix', True) - sysroot_path = d.getVar('STAGING_DIR_TARGET', True) - sysroot_path_usr = sysroot_path + exec_prefix - - try: - ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read().decode("utf-8") - except bb.process.CmdError: - error_msg = pn + ": prelink-rtld aborted when processing %s" % path - package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) - return False - - if sysroot_path_usr in ldd_output: - ldd_output = ldd_output.replace(sysroot_path, "") - - pkgdest = d.getVar('PKGDEST', True) - packages = d.getVar('PACKAGES', True) - - for package in packages.split(): - short_path = path.replace('%s/%s' % (pkgdest, package), "", 1) - if (short_path != path): - break - - base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix) - for line in ldd_output.split('\n'): - if exec_prefix in line: - error_msg = "%s: %s" % (base_err, line.strip()) - package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) - - return False QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): From c2ade72828822410644530966a8c526f52b1af9b Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 25 May 2017 12:16:51 +0100 Subject: [PATCH 065/129] oeqa/selftest: remove test_sanity_unsafe_binary_references This test was attempting to exercise a broken test, for some reason this broke with patches under review but investigation revealed that the test itself is broken. The test has been removed, so there's no need to test it. (From OE-Core rev: 4f5f552cd6601ba244ef4efc782616bc477e1340) (From OE-Core rev: 0b9bb6d9ec4e030ab64bac73680df4657cb7d066) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/buildoptions.py | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py index 9487898b07..09657ec189 100644 --- a/meta/lib/oeqa/selftest/buildoptions.py +++ b/meta/lib/oeqa/selftest/buildoptions.py @@ -110,25 +110,6 @@ def test_sanity_unsafe_script_references(self): line = self.getline(res, "QA Issue: gzip") self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) - @testcase(1434) - def test_sanity_unsafe_binary_references(self): - self.write_config('WARN_QA_append = " unsafe-references-in-binaries"') - - bitbake("-ccleansstate nfs-utils") - #res = bitbake("nfs-utils") - # FIXME when nfs-utils passes this test - #line = self.getline(res, "QA Issue: nfs-utils") - #self.assertFalse(line, "WARNING: QA Issue: nfs-utils message is present in bitbake's output and shouldn't be: %s" % res.output) - -# self.append_config(""" -#do_install_append_pn-nfs-utils () { -# echo "\n${bindir}/test" >> ${D}${base_sbindir}/osd_login -#} -#""") - res = bitbake("nfs-utils") - line = self.getline(res, "QA Issue: nfs-utils") - self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output) - @testcase(1421) def test_layer_without_git_dir(self): """ From 8bbf2e6903fa3677a8721891eaf18c7044b0ce90 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 25 May 2017 17:40:39 +0100 Subject: [PATCH 066/129] poky: Update distro version to 2.2.2 (From meta-yocto rev: 6ef1a11d63f08771668c8d52c7359a35b104e2f1) Signed-off-by: Richard Purdie --- meta-poky/conf/distro/poky.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-poky/conf/distro/poky.conf b/meta-poky/conf/distro/poky.conf index ec1cd9eefd..aca38c3d6a 100644 --- a/meta-poky/conf/distro/poky.conf +++ b/meta-poky/conf/distro/poky.conf @@ -1,6 +1,6 @@ DISTRO = "poky" DISTRO_NAME = "Poky (Yocto Project Reference Distro)" -DISTRO_VERSION = "2.2.1" +DISTRO_VERSION = "2.2.2" DISTRO_CODENAME = "morty" SDK_VENDOR = "-pokysdk" SDK_VERSION := "${@'${DISTRO_VERSION}'.replace('snapshot-${DATE}','snapshot')}" From 3e5a09491d3cf80dce20a3c75b7ddee7a4f97c65 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 25 May 2017 17:40:53 +0100 Subject: [PATCH 067/129] build-appliance-image: Update to morty head revision (From OE-Core rev: ce06f3a0c9859df1f897583659f836234c47d2d7) Signed-off-by: Richard Purdie --- meta/recipes-core/images/build-appliance-image_15.0.0.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb index 554b7b5c8a..4515f0e8de 100644 --- a/meta/recipes-core/images/build-appliance-image_15.0.0.bb +++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb @@ -22,7 +22,7 @@ IMAGE_FSTYPES = "vmdk" inherit core-image module-base -SRCREV ?= "8ba5b9eae34bbab537954ccee1726c7ee7a82750" +SRCREV ?= "8bbf2e6903fa3677a8721891eaf18c7044b0ce90" SRC_URI = "git://git.yoctoproject.org/poky;branch=morty \ file://Yocto_Build_Appliance.vmx \ file://Yocto_Build_Appliance.vmxf \ From 078915fbf5180ebb76891737c73cdc3b20a2bfca Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 15 Mar 2017 13:48:06 +0000 Subject: [PATCH 068/129] selftest: Disable SSTATE_MIRRORS for sstate signing test Building ed into an sstate mirror, then leaving it enabled for oe-selftest -r signing.Signing.test_signing_sstate_archive results in: NOTE: recipe ed-1.14.1-r0: task do_populate_lic_setscene: Started WARNING: ed-1.14.1-r0 do_populate_lic_setscene: Failed to fetch URL file://29/sstate:ed::1.14.1:r0::3:290bbc39f3b25cc27028dafce4b5aa48_populate_lic.tgz.sig;downloadfilename=29/sstate:ed::1.14.1:r0::3:290bbc39f3b25cc27028dafce4b5aa48_populate_lic.tgz.sig, attempting MIRRORS if available ERROR: ed-1.14.1-r0 do_populate_lic_setscene: Fetcher failure: Unable to find file file://29/sstate:ed::1.14.1:r0::3:290bbc39f3b25cc27028dafce4b5aa48_populate_lic.tgz.sig;downloadfilename=29/sstate:ed::1.14.1:r0::3:290bbc39f3b25cc27028dafce4b5aa48_populate_lic.tgz.sig anywhere. The paths that were searched were: /media/build1/poky/build/test-sstate /media/build1/poky/build/test-sstate WARNING: ed-1.14.1-r0 do_populate_lic_setscene: Cannot verify signature on sstate package /media/build1/poky/build/test-sstate/29/sstate:ed::1.14.1:r0::3:290bbc39f3b25cc27028dafce4b5aa48_populate_lic.tgz NOTE: recipe ed-1.14.1-r0: task do_populate_lic_setscene: Succeeded so we need to disable SSTATE_MIRRORS for this test. (From OE-Core rev: 2ce9962851fe58c099599679340fd87e90f426ec) (From OE-Core rev: 9bb708cf31850f5a3e53660ee9ea5a9ba7615e43) Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/signing.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py index 4c12d6d940..bd0879d8d0 100644 --- a/meta/lib/oeqa/selftest/signing.py +++ b/meta/lib/oeqa/selftest/signing.py @@ -112,6 +112,8 @@ def test_signing_sstate_archive(self): feature += 'SSTATE_VERIFY_SIG ?= "1"\n' feature += 'GPG_PATH = "%s"\n' % self.gpg_dir feature += 'SSTATE_DIR = "%s"\n' % sstatedir + # Any mirror might have partial sstate without .sig files, triggering failures + feature += 'SSTATE_MIRRORS_forcevariable = ""\n' self.write_config(feature) From 48a8c893ade7bb2dd1319b9c00095a86fa100ca4 Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Tue, 21 Feb 2017 14:33:07 +0000 Subject: [PATCH 069/129] selftest: Avoid sstate corruption by calling cleansstate Currently selftest doesn't use sstates because some tests clean sstate cache; using sstates would give a performance boost instead of building everything from scratch. With this sstates are not corrupted using different methods depending on tests: devtool: These tests needed to delete the cache so SSTATE_DIR as SSTATE_MIRRORS and set a temporal SSTATE_DIR. sstatetests: This module already used a temporal SSTATE_DIR, so just set up the SSTATE_MIRRORS. Rest: Removed cleansstate, some of them required to force a certain task, others were just removed or changed for another task. [YOCTO #10929] (From OE-Core rev: 62c61087a10cc3b26fbff32c9e2efd1704a39724) (From OE-Core rev: 44ca8b1c23e4b2cf470e9be42705e3cca23b7f85) Signed-off-by: Mariano Lopez Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/bbtests.py | 6 ++---- meta/lib/oeqa/selftest/buildoptions.py | 18 ++++++++---------- meta/lib/oeqa/selftest/devtool.py | 18 +++++++++++++++++- meta/lib/oeqa/selftest/oescripts.py | 8 ++------ meta/lib/oeqa/selftest/prservice.py | 3 --- meta/lib/oeqa/selftest/recipetool.py | 5 ----- meta/lib/oeqa/selftest/signing.py | 8 ++++---- meta/lib/oeqa/selftest/sstatetests.py | 6 +++--- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/meta/lib/oeqa/selftest/bbtests.py b/meta/lib/oeqa/selftest/bbtests.py index c9802a416b..4ce935fc1d 100644 --- a/meta/lib/oeqa/selftest/bbtests.py +++ b/meta/lib/oeqa/selftest/bbtests.py @@ -37,7 +37,6 @@ def test_event_handler(self): @testcase(103) def test_local_sstate(self): - bitbake('m4-native -ccleansstate') bitbake('m4-native') bitbake('m4-native -cclean') result = bitbake('m4-native') @@ -83,8 +82,8 @@ def test_force_task_1(self): pkgsplit_dir = get_bb_var('PKGDEST', test_recipe) man_dir = get_bb_var('mandir', test_recipe) - bitbake('-c cleansstate %s' % test_recipe) - bitbake(test_recipe) + bitbake('-c clean %s' % test_recipe) + bitbake('-c package -f %s' % test_recipe) self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) man_file = os.path.join(image_dir + man_dir, 'man3/zlib.3') @@ -103,7 +102,6 @@ def test_force_task_2(self): # test 2 from bug 5875 test_recipe = 'zlib' - bitbake('-c cleansstate %s' % test_recipe) bitbake(test_recipe) self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py index 09657ec189..47549550c7 100644 --- a/meta/lib/oeqa/selftest/buildoptions.py +++ b/meta/lib/oeqa/selftest/buildoptions.py @@ -35,9 +35,8 @@ def test_ccache_tool(self): bitbake("ccache-native") self.assertTrue(os.path.isfile(os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'), "ccache")), msg = "No ccache found under %s" % str(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'))) self.write_config('INHERIT += "ccache"') - bitbake("m4 -c cleansstate") - bitbake("m4 -c compile") - self.addCleanup(bitbake, 'ccache-native -ccleansstate') + self.add_command_to_tearDown('bitbake -c clean m4') + bitbake("m4 -f -c compile") res = runCmd("grep ccache %s" % (os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")), ignore_status=True) self.assertEqual(0, res.status, msg="No match for ccache in m4 log.do_compile. For further details: %s" % os.path.join(get_bb_var("WORKDIR","m4"),"temp/log.do_compile")) @@ -71,14 +70,14 @@ def getline(self, res, line): @testcase(927) def test_options_warnqa_errorqa_switch(self): - bitbake("xcursor-transparent-theme -ccleansstate") self.write_config("INHERIT_remove = \"report-error\"") if "packages-list" not in get_bb_var("ERROR_QA"): self.append_config("ERROR_QA_append = \" packages-list\"") self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') - res = bitbake("xcursor-transparent-theme", ignore_status=True) + self.add_command_to_tearDown('bitbake -c clean xcursor-transparent-theme') + res = bitbake("xcursor-transparent-theme -f -c package", ignore_status=True) self.delete_recipeinc('xcursor-transparent-theme') line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) @@ -86,8 +85,7 @@ def test_options_warnqa_errorqa_switch(self): self.write_recipeinc('xcursor-transparent-theme', 'PACKAGES += \"${PN}-dbg\"') self.append_config('ERROR_QA_remove = "packages-list"') self.append_config('WARN_QA_append = " packages-list"') - bitbake("xcursor-transparent-theme -ccleansstate") - res = bitbake("xcursor-transparent-theme") + res = bitbake("xcursor-transparent-theme -f -c package") self.delete_recipeinc('xcursor-transparent-theme') line = self.getline(res, "QA Issue: xcursor-transparent-theme-dbg is listed in PACKAGES multiple times, this leads to packaging errors.") self.assertTrue(line and line.startswith("WARNING:"), msg=res.output) @@ -96,8 +94,8 @@ def test_options_warnqa_errorqa_switch(self): def test_sanity_unsafe_script_references(self): self.write_config('WARN_QA_append = " unsafe-references-in-scripts"') - bitbake("-ccleansstate gzip") - res = bitbake("gzip") + self.add_command_to_tearDown('bitbake -c clean gzip') + res = bitbake("gzip -f -c package_qa") line = self.getline(res, "QA Issue: gzip") self.assertFalse(line, "WARNING: QA Issue: gzip message is present in bitbake's output and shouldn't be: %s" % res.output) @@ -106,7 +104,7 @@ def test_sanity_unsafe_script_references(self): echo "\n${bindir}/test" >> ${D}${bindir}/zcat } """) - res = bitbake("gzip") + res = bitbake("gzip -f -c package_qa") line = self.getline(res, "QA Issue: gzip") self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py index e992dcf771..302ec5d42e 100644 --- a/meta/lib/oeqa/selftest/devtool.py +++ b/meta/lib/oeqa/selftest/devtool.py @@ -9,7 +9,8 @@ import oeqa.utils.ftools as ftools from oeqa.selftest.base import oeSelfTest -from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer, runqemu, get_test_layer +from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer +from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer from oeqa.utils.decorators import testcase class DevtoolBase(oeSelfTest): @@ -114,6 +115,20 @@ def _process_ls_output(self, output): class DevtoolTests(DevtoolBase): + @classmethod + def setUpClass(cls): + bb_vars = get_bb_vars(['TOPDIR', 'SSTATE_DIR']) + cls.original_sstate = bb_vars['SSTATE_DIR'] + cls.devtool_sstate = os.path.join(bb_vars['TOPDIR'], 'sstate_devtool') + cls.sstate_conf = 'SSTATE_DIR = "%s"\n' % cls.devtool_sstate + cls.sstate_conf += ('SSTATE_MIRRORS += "file://.* file:///%s/PATH"\n' + % cls.original_sstate) + + @classmethod + def tearDownClass(cls): + cls.log.debug('Deleting devtool sstate cache on %s' % cls.devtool_sstate) + runCmd('rm -rf %s' % cls.devtool_sstate) + def setUp(self): """Test case setup function""" super(DevtoolTests, self).setUp() @@ -121,6 +136,7 @@ def setUp(self): self.assertTrue(not os.path.exists(self.workspacedir), 'This test cannot be run with a workspace directory ' 'under the build directory') + self.append_config(self.sstate_conf) def _check_src_repo(self, repo_dir): """Check srctree git repository""" diff --git a/meta/lib/oeqa/selftest/oescripts.py b/meta/lib/oeqa/selftest/oescripts.py index 31cd50809c..28345dc6a2 100644 --- a/meta/lib/oeqa/selftest/oescripts.py +++ b/meta/lib/oeqa/selftest/oescripts.py @@ -17,12 +17,8 @@ def test_cleanup_workdir(self): path = os.path.dirname(get_bb_var('WORKDIR', 'gzip')) old_version_recipe = os.path.join(get_bb_var('COREBASE'), 'meta/recipes-extended/gzip/gzip_1.3.12.bb') old_version = '1.3.12' - bitbake("-ccleansstate gzip") - bitbake("-ccleansstate -b %s" % old_version_recipe) - if os.path.exists(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)): - shutil.rmtree(get_bb_var('WORKDIR', "-b %s" % old_version_recipe)) - if os.path.exists(get_bb_var('WORKDIR', 'gzip')): - shutil.rmtree(get_bb_var('WORKDIR', 'gzip')) + bitbake("-c clean gzip") + bitbake("-c clean -b %s" % old_version_recipe) if os.path.exists(path): initial_contents = os.listdir(path) diff --git a/meta/lib/oeqa/selftest/prservice.py b/meta/lib/oeqa/selftest/prservice.py index 1b9a510fd4..0b2dfe6494 100644 --- a/meta/lib/oeqa/selftest/prservice.py +++ b/meta/lib/oeqa/selftest/prservice.py @@ -37,7 +37,6 @@ def get_task_stamp(self, package_name, recipe_task): def increment_package_pr(self, package_name): inc_data = "do_package_append() {\n bb.build.exec_func('do_test_prserv', d)\n}\ndo_test_prserv() {\necho \"The current date is: %s\"\n}" % datetime.datetime.now() self.write_recipeinc(package_name, inc_data) - bitbake("-ccleansstate %s" % package_name) res = bitbake(package_name, ignore_status=True) self.delete_recipeinc(package_name) self.assertEqual(res.status, 0, msg=res.output) @@ -60,7 +59,6 @@ def run_test_pr_service(self, package_name, package_type='rpm', track_task='do_p pr_2 = self.get_pr_version(package_name) stamp_2 = self.get_task_stamp(package_name, track_task) - bitbake("-ccleansstate %s" % package_name) self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") self.assertTrue(stamp_1 != stamp_2, "Different pkg rev. but same stamp: %s" % stamp_1) @@ -86,7 +84,6 @@ def run_test_pr_export_import(self, package_name, replace_current_db=True): self.increment_package_pr(package_name) pr_2 = self.get_pr_version(package_name) - bitbake("-ccleansstate %s" % package_name) self.assertTrue(pr_2 - pr_1 == 1, "Step between same pkg. revision is greater than 1") @testcase(930) diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py index db1f8deeb0..93e75a588e 100644 --- a/meta/lib/oeqa/selftest/recipetool.py +++ b/meta/lib/oeqa/selftest/recipetool.py @@ -71,11 +71,6 @@ def setUpClass(cls): logger.info('Running bitbake to generate pkgdata') bitbake('-c packagedata base-files coreutils busybox selftest-recipetool-appendfile') - @classmethod - def tearDownClass(cls): - # Shouldn't leave any traces of this artificial recipe behind - bitbake('-c cleansstate selftest-recipetool-appendfile') - def _try_recipetool_appendfile(self, testrecipe, destfile, newfile, options, expectedlines, expectedfiles): cmd = 'recipetool appendfile %s %s %s %s' % (self.templayerdir, destfile, newfile, options) return self._try_recipetool_appendcmd(cmd, testrecipe, expectedfiles, expectedlines) diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py index bd0879d8d0..606bfd3e99 100644 --- a/meta/lib/oeqa/selftest/signing.py +++ b/meta/lib/oeqa/selftest/signing.py @@ -54,8 +54,9 @@ def test_signing_packages(self): self.write_config(feature) - bitbake('-c cleansstate %s' % test_recipe) - bitbake(test_recipe) + bitbake('-c clean %s' % test_recipe) + bitbake('-f -c package_write_rpm %s' % test_recipe) + self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) pkgdatadir = get_bb_var('PKGDATA_DIR', test_recipe) @@ -98,7 +99,6 @@ def test_signing_sstate_archive(self): sstatedir = os.path.join(builddir, 'test-sstate') self.add_command_to_tearDown('bitbake -c clean %s' % test_recipe) - self.add_command_to_tearDown('bitbake -c cleansstate %s' % test_recipe) self.add_command_to_tearDown('rm -rf %s' % sstatedir) # Determine the pub key signature @@ -117,7 +117,7 @@ def test_signing_sstate_archive(self): self.write_config(feature) - bitbake('-c cleansstate %s' % test_recipe) + bitbake('-c clean %s' % test_recipe) bitbake(test_recipe) recipe_sig = glob.glob(sstatedir + '/*/*:ed:*_package.tgz.sig') diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py index 6642539ebf..f99d74684e 100644 --- a/meta/lib/oeqa/selftest/sstatetests.py +++ b/meta/lib/oeqa/selftest/sstatetests.py @@ -16,7 +16,7 @@ class SStateTests(SStateBase): # Test sstate files creation and their location def run_test_sstate_creation(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True, should_pass=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) if self.temp_sstate_location: bitbake(['-cclean'] + targets) @@ -60,7 +60,7 @@ def test_sstate_creation_distro_nonspecific_fail(self): # Test the sstate files deletion part of the do_cleansstate task def run_test_cleansstate_task(self, targets, distro_specific=True, distro_nonspecific=True, temp_sstate_location=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) bitbake(['-ccleansstate'] + targets) @@ -92,7 +92,7 @@ def test_cleansstate_task_distro_specific(self): # Test rebuilding of distro-specific sstate files def run_test_rebuild_distro_specific_sstate(self, targets, temp_sstate_location=True): - self.config_sstate(temp_sstate_location) + self.config_sstate(temp_sstate_location, [self.sstate_path]) bitbake(['-ccleansstate'] + targets) From e92165f5cea1c345672dd866df6a44d1cd8b97ce Mon Sep 17 00:00:00 2001 From: Chang Rebecca Swee Fun Date: Fri, 26 May 2017 15:32:46 +0800 Subject: [PATCH 070/129] cryptodev-linux: update SRC_URI Gna! project announced that the download site from gna.org HTTP server will soon be closing down. We have verified that the site is no longer accessible without network proxy cache. We need to update SRC_URI to point to new alternative (nwl.cc HTTP server) in order to avoid fetcher issues in future. [YOCTO #11575] (From OE-Core rev: eaf1f56a865f8b71ef3ff4e3108b77fcc690d151) Signed-off-by: Chang Rebecca Swee Fun Signed-off-by: Richard Purdie --- meta/recipes-kernel/cryptodev/cryptodev.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-kernel/cryptodev/cryptodev.inc b/meta/recipes-kernel/cryptodev/cryptodev.inc index 160ab30840..22c6977eff 100644 --- a/meta/recipes-kernel/cryptodev/cryptodev.inc +++ b/meta/recipes-kernel/cryptodev/cryptodev.inc @@ -3,7 +3,7 @@ HOMEPAGE = "http://cryptodev-linux.org/" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -SRC_URI = "http://download.gna.org/cryptodev-linux/cryptodev-linux-${PV}.tar.gz \ +SRC_URI = "http://nwl.cc/pub/cryptodev-linux/cryptodev-linux-${PV}.tar.gz \ file://06d6b560c6e45dc317dae47c74706fa43f4a31d8.patch \ file://cb186f682679383e8b5806240927903730ce85d9.patch" From d05941ae4567def4a288894717e5f550da246107 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 29 May 2017 00:21:05 +0100 Subject: [PATCH 071/129] build-appliance-image: Update to morty head revision (From OE-Core rev: 8daed12b4327e4c362a7af4ddc38e7a9cea2c939) Signed-off-by: Richard Purdie --- meta/recipes-core/images/build-appliance-image_15.0.0.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb index 4515f0e8de..0803ddb65a 100644 --- a/meta/recipes-core/images/build-appliance-image_15.0.0.bb +++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb @@ -22,7 +22,7 @@ IMAGE_FSTYPES = "vmdk" inherit core-image module-base -SRCREV ?= "8bbf2e6903fa3677a8721891eaf18c7044b0ce90" +SRCREV ?= "e92165f5cea1c345672dd866df6a44d1cd8b97ce" SRC_URI = "git://git.yoctoproject.org/poky;branch=morty \ file://Yocto_Build_Appliance.vmx \ file://Yocto_Build_Appliance.vmxf \ From 21aa71dbaaea0aaf84329c0181dfac91f6830573 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Thu, 1 Jun 2017 13:24:05 +0100 Subject: [PATCH 072/129] perf: add perf-feature for systemtap Based on OE-Core rev: 8aafed5f4757550f2ff688e1b8981e5e8e6e3428 if systemtap isn't disabled it's possible to race with systemtap headers being present during autodetection and disappearing during the build: tests/sdt.c:14:21: fatal error: sys/sdt.h: No such file or directory #include (From OE-Core rev: b206497bf2a68b1b009ae5a6b1c5a29df3966443) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- meta/recipes-kernel/perf/perf.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb index 471023d077..03ae4464ec 100644 --- a/meta/recipes-kernel/perf/perf.bb +++ b/meta/recipes-kernel/perf/perf.bb @@ -66,6 +66,7 @@ SCRIPTING_DEFINES = "${@perf_feature_enabled('perf-scripting', '', 'NO_LIBPERL=1 TUI_DEFINES = "${@perf_feature_enabled('perf-tui', '', 'NO_NEWT=1',d)}" LIBUNWIND_DEFINES = "${@perf_feature_enabled('perf-libunwind', '', 'NO_LIBUNWIND=1 NO_LIBDW_DWARF_UNWIND=1',d)}" LIBNUMA_DEFINES = "${@perf_feature_enabled('perf-libnuma', '', 'NO_LIBNUMA=1',d)}" +SYSTEMTAP_DEFINES = "${@perf_feature_enabled('perf-systemtap', '', 'NO_SDT=1', d)}" # The LDFLAGS is required or some old kernels fails due missing # symbols and this is preferred than requiring patches to every old @@ -83,7 +84,7 @@ EXTRA_OEMAKE = '\ EXTRA_CFLAGS="-ldw" \ perfexecdir=${libexecdir} \ NO_GTK2=1 ${TUI_DEFINES} NO_DWARF=1 ${LIBUNWIND_DEFINES} \ - ${SCRIPTING_DEFINES} ${LIBNUMA_DEFINES} \ + ${SCRIPTING_DEFINES} ${LIBNUMA_DEFINES} ${SYSTEMTAP_DEFINES} \ ' EXTRA_OEMAKE += "\ From b6a1004c73820cff833f2b6f09d2432706f5447a Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Tue, 4 Apr 2017 02:29:07 -0700 Subject: [PATCH 073/129] selftest/recipetool: replace fedorahosted.org SRC_URI with github.com source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to github.com. [YOCTO #11226] (From OE-Core rev: 9b3c9193d4a04061e64e43d55782a4d73ee166ad) (From OE-Core rev: c9c0528d7f298dae4f543ab4006057022abe71e5) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/recipetool.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py index 93e75a588e..c3d618ff85 100644 --- a/meta/lib/oeqa/selftest/recipetool.py +++ b/meta/lib/oeqa/selftest/recipetool.py @@ -364,15 +364,15 @@ def test_recipetool_create(self): tempsrc = os.path.join(self.tempdir, 'srctree') os.makedirs(tempsrc) recipefile = os.path.join(self.tempdir, 'logrotate_3.8.7.bb') - srcuri = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-3.8.7.tar.gz' + srcuri = 'https://github.com/logrotate/logrotate/archive/r3-8-7.tar.gz' result = runCmd('recipetool create -o %s %s -x %s' % (recipefile, srcuri, tempsrc)) self.assertTrue(os.path.isfile(recipefile)) checkvars = {} checkvars['LICENSE'] = 'GPLv2' checkvars['LIC_FILES_CHKSUM'] = 'file://COPYING;md5=18810669f13b87348459e611d31ab760' - checkvars['SRC_URI'] = 'https://fedorahosted.org/releases/l/o/logrotate/logrotate-${PV}.tar.gz' - checkvars['SRC_URI[md5sum]'] = '99e08503ef24c3e2e3ff74cc5f3be213' - checkvars['SRC_URI[sha256sum]'] = 'f6ba691f40e30e640efa2752c1f9499a3f9738257660994de70a45fe00d12b64' + checkvars['SRC_URI'] = 'https://github.com/logrotate/logrotate/archive/r3-8-7.tar.gz' + checkvars['SRC_URI[md5sum]'] = '6b1aa0e0d07eda3c9a2526520850397a' + checkvars['SRC_URI[sha256sum]'] = 'dece4bfeb9d8374a0ecafa34be139b5a697db5c926dcc69a9b8715431a22e733' self._test_recipe_contents(recipefile, checkvars, []) @testcase(1194) From 96bdd99f361904082e43efc09951cbedfcf093c4 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Tue, 4 Apr 2017 02:29:13 -0700 Subject: [PATCH 074/129] chkconfig: replace fedorahosted.org SRC_URI with github.com source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to github.com. [YOCTO #11226] (From OE-Core rev: 0fb5427937576fe46d463b9c9953d0bcdc1f256a) (From OE-Core rev: 5d57ccab9720f6c75cfefdf0cb153007d79beb2e) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb index e8390264ce..2f1f6c0264 100644 --- a/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb +++ b/meta/recipes-extended/chkconfig/chkconfig_1.3.58.bb @@ -6,7 +6,7 @@ of the drudgery of manually editing the symbolic links." RECIPE_NO_UPDATE_REASON = "Version 1.5 requires selinux" -HOMEPAGE = "http://fedorahosted.org/releases/c/h/chkconfig" +HOMEPAGE = "https://github.com/fedora-sysv" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=5574c6965ae5f583e55880e397fbb018" @@ -16,12 +16,16 @@ PROVIDES += "virtual/update-alternatives" PR = "r7" -SRC_URI = "http://fedorahosted.org/releases/c/h/chkconfig/${BPN}-${PV}.tar.bz2 \ +S = "${WORKDIR}/${BPN}-${BPN}-${PV}" + +UPSTREAM_CHECK_URI = "https://github.com/fedora-sysv/${BPN}/releases" + +SRC_URI = "https://github.com/fedora-sysv/chkconfig/archive/chkconfig-${PV}.tar.gz \ file://replace_caddr_t.patch \ " -SRC_URI[md5sum] = "c2039ca67f2749fe0c06ef7c6f8ee246" -SRC_URI[sha256sum] = "18b497d25b2cada955c72810e45fcad8280d105f17cf45e2970f18271211de68" +SRC_URI[md5sum] = "3f51ac38a234be5278b3a2d9705eda5e" +SRC_URI[sha256sum] = "bf1e81f0d7cc999b536c9fe7877abf584a4082fd03c9d2597b6f090966579b40" inherit gettext From 7ff5544bf3fc31bd366a8fd5b3722b144f670479 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Sun, 2 Apr 2017 19:51:47 -0700 Subject: [PATCH 075/129] cronie: replace fedorahosted.org SRC_URI with github.com source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to github.com. [YOCTO #11226] (From OE-Core rev: b0703175ed650d89870309e4065cda917199ac93) (From OE-Core rev: a34ca1b1ee4c6e39a7fbc10fc9fc7aebfdbe8abc) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-extended/cronie/cronie_1.5.1.bb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meta/recipes-extended/cronie/cronie_1.5.1.bb b/meta/recipes-extended/cronie/cronie_1.5.1.bb index 99b2bb5c83..6d46629ee6 100644 --- a/meta/recipes-extended/cronie/cronie_1.5.1.bb +++ b/meta/recipes-extended/cronie/cronie_1.5.1.bb @@ -3,7 +3,7 @@ DESCRIPTION = "Cronie contains the standard UNIX daemon crond that runs \ specified programs at scheduled times and related tools. It is based on the \ original cron and has security and configuration enhancements like the \ ability to use pam and SELinux." -HOMEPAGE = "https://fedorahosted.org/cronie/" +HOMEPAGE = "https://github.com/cronie-crond/cronie/" BUGTRACKER = "https://bugzilla.redhat.com" # Internet Systems Consortium License @@ -14,7 +14,9 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=dd2a592170760e1386c769e1043b3722 \ SECTION = "utils" -SRC_URI = "https://fedorahosted.org/releases/c/r/cronie/cronie-${PV}.tar.gz \ +UPSTREAM_CHECK_URI = "https://github.com/cronie-crond/${BPN}/releases/" + +SRC_URI = "https://github.com/cronie-crond/cronie/releases/download/cronie-${PV}/cronie-${PV}.tar.gz \ file://crond.init \ file://crontab \ file://crond.service \ From a55be634373fc213b603e5d276e2cab2e18dd8b9 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Sun, 2 Apr 2017 19:51:45 -0700 Subject: [PATCH 076/129] liberation-fonts: replace fedorahosted.org SRC_URI with pagure.io source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to pagure.io. pagure.io is a replacement for fedorahosted. [YOCTO #11226] (From OE-Core rev: 441ad240db4ce64d854e263e14dc6a1752aed956) (From OE-Core rev: 516d55d3550d86c7458d20cea1adca7dc30ab66b) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb b/meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb index bda82e7efc..74212e7e5e 100644 --- a/meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb +++ b/meta/recipes-graphics/ttf-fonts/liberation-fonts_1.04.bb @@ -2,7 +2,7 @@ SUMMARY = "Liberation(tm) Fonts" DESCRIPTION = "The Liberation(tm) Fonts is a font family originally \ created by Ascender(c) which aims at metric compatibility with \ Arial, Times New Roman, Courier New." -HOMEPAGE = "https://fedorahosted.org/liberation-fonts/" +HOMEPAGE = "https://releases.pagure.org/liberation-fonts/" BUGTRACKER = "https://bugzilla.redhat.com/" RECIPE_NO_UPDATE_REASON = "2.x depends on fontforge package, which is not yet provided in oe-core" @@ -17,7 +17,7 @@ inherit allarch fontcache FONT_PACKAGES = "${PN}" -SRC_URI = "https://fedorahosted.org/releases/l/i/liberation-fonts/liberation-fonts-${PV}.tar.gz \ +SRC_URI = "https://releases.pagure.org/liberation-fonts/liberation-fonts-${PV}.tar.gz \ file://30-liberation-aliases.conf" SRC_URI[md5sum] = "4846797ef0fc70b0cbaede2514677c58" From f7c6d8da56f20837ced6f7d324f5c5179da6a159 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Sun, 2 Apr 2017 19:51:42 -0700 Subject: [PATCH 077/129] libuser: replace fedorahosted.org SRC_URI with pagure.io source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to pagure.io. pagure.io is a replacement for fedorahosted. [YOCTO #11226] (From OE-Core rev: bbe3cde5fc2102fd84ba065ed14f2732bcd0d420) (From OE-Core rev: 34312ac6edf13dc3e3d8f31b2a07df9044a9a8aa) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-extended/libuser/libuser_0.62.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/recipes-extended/libuser/libuser_0.62.bb b/meta/recipes-extended/libuser/libuser_0.62.bb index 3d0b516aba..07028d55a4 100644 --- a/meta/recipes-extended/libuser/libuser_0.62.bb +++ b/meta/recipes-extended/libuser/libuser_0.62.bb @@ -1,8 +1,8 @@ SUMMARY = "user and group account administration library" DESCRIPTION = "The libuser library implements a standardized interface for manipulating and administering user \ and group accounts" -HOMEPAGE = "https://fedorahosted.org/libuser/" -BUGTRACKER = "https://fedorahosted.org/libuser/newticket" +HOMEPAGE = "https://pagure.io/libuser" +BUGTRACKER = "https://pagure.io/libuser/issues" LICENSE = "LGPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ @@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2 \ SECTION = "base" -SRC_URI = "https://fedorahosted.org/releases/l/i/libuser/libuser-${PV}.tar.xz \ +SRC_URI = "https://releases.pagure.org/libuser/libuser-${PV}.tar.xz \ file://0001-Check-for-issetugid.patch \ file://0002-remove-unused-execinfo.h.patch \ file://0001-modules-files.c-parse_field-fix-string-formating-in-.patch \ From 61b729a3a8d8fbf6316228fff5ca6c00ca7bf452 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Sun, 2 Apr 2017 19:51:41 -0700 Subject: [PATCH 078/129] xmlto: replace fedorahosted.org SRC_URI with pagure.io source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to pagure.io. pagure.io is a replacement for fedorahosted. [YOCTO #11226] (From OE-Core rev: 79ae1e98a7c3fd4c732ea4cd0b3099d4e319a111) (From OE-Core rev: 6785157e7b30ca112ec5c65487a9e7e65b9dd5de) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-devtools/xmlto/xmlto_0.0.28.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb index aaaeb6eb2f..6072a7b1bd 100644 --- a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb +++ b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb @@ -1,11 +1,11 @@ SUMMARY = "A shell-script tool for converting XML files to various formats" -HOMEPAGE = "https://fedorahosted.org/xmlto/" +HOMEPAGE = "https://releases.pagure.org/xmlto/" SECTION = "docs/xmlto" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" -SRC_URI = "https://fedorahosted.org/releases/x/m/xmlto/xmlto-${PV}.tar.gz \ +SRC_URI = "https://releases.pagure.org/xmlto/xmlto-${PV}.tar.gz \ file://configure.in-drop-the-test-of-xmllint-and-xsltproc.patch \ file://catalog.xml \ " From 3643da7804f343ed070c2b67641c7c5a2641a084 Mon Sep 17 00:00:00 2001 From: Choong YinThong Date: Sun, 2 Apr 2017 19:51:44 -0700 Subject: [PATCH 079/129] libnewt: replace fedorahosted.org SRC_URI with pagure.io source fedorahosted.org was retired on March 1st, 2017. This is to update the SRC_URI to point to pagure.io. pagure.io is a replacement for fedorahosted. [YOCTO #11226] (From OE-Core rev: b85905bc8b845c9da7d2a086ea239ec00d5142e3) (From OE-Core rev: 8ae35a4391bd0313cdc8091140fa8c8648122161) Signed-off-by: Choong YinThong Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/recipes-extended/newt/libnewt_0.52.19.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-extended/newt/libnewt_0.52.19.bb b/meta/recipes-extended/newt/libnewt_0.52.19.bb index a26ce1fbe7..de76ce20c4 100644 --- a/meta/recipes-extended/newt/libnewt_0.52.19.bb +++ b/meta/recipes-extended/newt/libnewt_0.52.19.bb @@ -8,7 +8,7 @@ shared library needed by programs built with newt, as well as a \ /usr/bin/dialog replacement called whiptail. Newt is based on the \ slang library." -HOMEPAGE = "https://fedorahosted.org/newt/" +HOMEPAGE = "https://releases.pagure.org/newt/" SECTION = "libs" LICENSE = "LGPLv2" @@ -17,7 +17,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" # slang needs to be >= 2.2 DEPENDS = "slang popt" -SRC_URI = "https://fedorahosted.org/releases/n/e/newt/newt-${PV}.tar.gz \ +SRC_URI = "https://releases.pagure.org/newt/newt-${PV}.tar.gz \ file://fix_SHAREDDIR.patch \ file://cross_ar.patch \ file://Makefile.in-Add-tinfo-library-to-the-linking-librari.patch \ From 4a48386e917e29df4737c8467b8027b4e9a8b555 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 5 Jun 2017 16:50:02 +0100 Subject: [PATCH 080/129] elfutils: update homepage and upstream souce In git://sourceware.org/git/elfutils.git: ---------------- commit 1700fd25e6caf26663af2bd994d1d99fab9df59f Author: Mark Wielaard Date: Sat Dec 24 22:31:41 2016 +0100 http://elfutils.org/ is now hosted at http://sourceware.org/elfutils/ fedorahosted used to be our home, but we are now hosted at sourceware. Change the elfutils project home to http://elfutils.org/ Point hosted services (email, release, git, bug tracker and web pages) to https://sourceware.org/elfutils/ Move design notes from README to NOTES. Add URLs for home, releases, bugs, git and mailinglist to README. Make the --version output of all tools the same by using a common print_version function and update the publicly shown copyright holder to the elfutils developers. Signed-off-by: Mark Wielaard ------------------ Based on a patch from Hongxu Jia (From OE-Core rev: 4ee8ad29e0eb3584eb8c6e1ba21a5a18d7a59714) Signed-off-by: Richard Purdie --- meta/recipes-devtools/elfutils/elfutils_0.148.bb | 3 +-- meta/recipes-devtools/elfutils/elfutils_0.166.bb | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/meta/recipes-devtools/elfutils/elfutils_0.148.bb b/meta/recipes-devtools/elfutils/elfutils_0.148.bb index 6080c179fa..d18b732fe2 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.148.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.148.bb @@ -8,8 +8,7 @@ DEPENDS = "libtool bzip2 zlib virtual/libintl" PR = "r11" -SRC_URI = "https://fedorahosted.org/releases/e/l/${BPN}/${BP}.tar.bz2" - +SRC_URI = "ftp://sourceware.org/pub/elfutils/${PV}/${BP}.tar.bz2" SRC_URI[md5sum] = "a0bed1130135f17ad27533b0034dba8d" SRC_URI[sha256sum] = "8aebfa4a745db21cf5429c9541fe482729b62efc7e53e9110151b4169fe887da" diff --git a/meta/recipes-devtools/elfutils/elfutils_0.166.bb b/meta/recipes-devtools/elfutils/elfutils_0.166.bb index 5c436d3864..5d934281b3 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.166.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.166.bb @@ -1,12 +1,12 @@ SUMMARY = "Utilities and libraries for handling compiled object files" -HOMEPAGE = "https://fedorahosted.org/elfutils" +HOMEPAGE = "https://sourceware.org/elfutils" SECTION = "base" LICENSE = "(GPLv3 & Elfutils-Exception)" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" DEPENDS = "libtool bzip2 zlib virtual/libintl" DEPENDS_append_libc-musl = " argp-standalone fts " -SRC_URI = "https://fedorahosted.org/releases/e/l/elfutils/${PV}/${BP}.tar.bz2" +SRC_URI = "ftp://sourceware.org/pub/elfutils/${PV}/${BP}.tar.bz2" SRC_URI[md5sum] = "d4e462b7891915dc5326bccefa2024ff" SRC_URI[sha256sum] = "3c056914c8a438b210be0d790463b960fc79d234c3f05ce707cbff80e94cba30" From 8a96509017580f02b3cd9d27d03f6e061ea4175d Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 5 Jun 2017 17:30:42 +0100 Subject: [PATCH 081/129] oeqa/selftest: lock down Meson git revision for reliability The test_recipetool_create_github test fetches HEAD of the repository so upstream changes can (and do) break the test. Avoid these problems by passing the rev= argument in the URL to lock the checkout to the same version that is fetched in the github_tarball test. Also pass the commands to runCmd() as a list instead of a string, the semicolon in the URL needs more quotes if the shell is involved and passing a list bypasses the shell entirely. (From OE-Core rev: cbb5961d3db27f81967345a73267920f2623ccac) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/recipetool.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py index c3d618ff85..9b669248f6 100644 --- a/meta/lib/oeqa/selftest/recipetool.py +++ b/meta/lib/oeqa/selftest/recipetool.py @@ -442,8 +442,8 @@ def test_recipetool_create_github(self): temprecipe = os.path.join(self.tempdir, 'recipe') os.makedirs(temprecipe) recipefile = os.path.join(temprecipe, 'meson_git.bb') - srcuri = 'https://github.com/mesonbuild/meson' - result = runCmd('recipetool create -o %s %s' % (temprecipe, srcuri)) + srcuri = 'https://github.com/mesonbuild/meson;rev=0.32.0' + result = runCmd(['recipetool', 'create', '-o', temprecipe, srcuri]) self.assertTrue(os.path.isfile(recipefile)) checkvars = {} checkvars['LICENSE'] = set(['Apache-2.0']) From 47fc2d6139dbe34fcd752b3e91de59c25a9aa03d Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Thu, 13 Apr 2017 00:00:18 +0300 Subject: [PATCH 082/129] sstate.bbclass: check if mirror directory is writable Commit 51edde653707e7a3cd2186082458f01f32cd1996 makes a wrong assumption that SSTATE_MIRRORS have write permissions. A mirror is by definition outside of it's user control. In my use case it happens I does not have permissions to update the access time of the dereferenced symbolic-link file. Checked if file is writable before changing its atime. Thanks to Paulo Neves for the patch. [YOCTO #11307] (From OE-Core rev: 112ae104287ad4078a9fa90fb2a42f4c814ef824) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- meta/classes/sstate.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 4fdfcc83ec..e2bc7355b4 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass @@ -725,7 +725,7 @@ python sstate_sign_package () { sstate_unpack_package () { tar -xvzf ${SSTATE_PKG} # update .siginfo atime on local/NFS mirror - [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo + [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo # Use "! -w ||" to return true for read only files [ ! -w ${SSTATE_PKG} ] || touch --no-dereference ${SSTATE_PKG} [ ! -w ${SSTATE_PKG}.sig ] || [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig From e707865a6ac2ffc729c929df580cc3ba30cef484 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Mon, 12 Jun 2017 09:25:05 -0700 Subject: [PATCH 083/129] yocto-project-qs, poky.ent: Fixed pip3 and pexpect package names Fixes [YOCTO #11578] The package names "pip3" and "pexpect" do not exist for Ubuntu and Debian. They need to be "python3-pip3" and "python3-pexpect". I changed them in the poky.ent file and did some reformatting so the install lines appear nice. I updated the other distributions as well. (From yocto-docs rev: 43c92b88c40815d906cfc5fabb3190b0aa4778c7) Signed-off-by: Scott Rifenbark Signed-off-by: Richard Purdie --- documentation/poky.ent | 9 +++++---- documentation/yocto-project-qs/yocto-project-qs.xml | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/documentation/poky.ent b/documentation/poky.ent index 3756927305..364020792a 100644 --- a/documentation/poky.ent +++ b/documentation/poky.ent @@ -61,14 +61,15 @@ + build-essential chrpath socat cpio python python3 python3-pip python3-pexpect"> + findutils which file cpio python python3-pip python3-pexpect"> + diffstat makeinfo python-curses patch socat python3 python3-curses tar python3-pip \ + python3-pexpect"> + perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue python3-pip python3-pexpect"> diff --git a/documentation/yocto-project-qs/yocto-project-qs.xml b/documentation/yocto-project-qs/yocto-project-qs.xml index 7f3d1896c1..950a4ff8be 100644 --- a/documentation/yocto-project-qs/yocto-project-qs.xml +++ b/documentation/yocto-project-qs/yocto-project-qs.xml @@ -302,7 +302,8 @@ Ubuntu and Debian - $ sudo apt-get install &UBUNTU_HOST_PACKAGES_ESSENTIAL; libsdl1.2-dev xterm + $ sudo apt-get install &UBUNTU_HOST_PACKAGES_ESSENTIAL; \ + libsdl1.2-dev xterm Fedora @@ -318,7 +319,8 @@ CentOS - $ sudo yum install &CENTOS_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm + $ sudo yum install &CENTOS_HOST_PACKAGES_ESSENTIAL; \ + SDL-devel xterm CentOS 6.x users need to ensure that the required From cf781e2f9b406075d97d363443eba4a74171a8c0 Mon Sep 17 00:00:00 2001 From: Leonardo Sandoval Date: Mon, 12 Jun 2017 14:40:08 -0700 Subject: [PATCH 084/129] scripts/lib/bsp/kernel.py: force patching when branch is machine branch is re-use When a branch is re-used, the kernel tools turns off any patch pushing unless 'mark patching' is explicitly set. [YOCTO #10674] (From meta-yocto rev: 4f3cd59d76e3d8a43a4460528082c0086bdbba41) Signed-off-by: Leonardo Sandoval Signed-off-by: Richard Purdie --- scripts/lib/bsp/kernel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py index a3ee325a8f..32cab3b642 100644 --- a/scripts/lib/bsp/kernel.py +++ b/scripts/lib/bsp/kernel.py @@ -331,6 +331,7 @@ def write_patch_items(scripts_path, machine, patch_items): patch list [${machine}-user-patches.scc]. """ f = open_user_file(scripts_path, machine, machine+"-user-patches.scc", "w") + f.write("mark patching start\n") for item in patch_items: f.write("patch " + item + "\n") f.close() From b4cf48ecee9e2c0fd4aad96911aecd1b805cfa5a Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 16 Jun 2017 09:42:30 +0100 Subject: [PATCH 085/129] package_ipk: Clean up Source entry in ipk packages There is the potential for sensitive information to leak through the urls there and removing it brings this into the behavior of the other package backends since filtering it is likely error prone. Since ipks don't appear to be generated at all if we don't set this, set the field to the recipe name used (basename only, no paths). This avoids information leaking. We may want to drop the field if opkg can allow that at a future point but the recipe name is a suitable identifier for now. Reported-by: Andrej Valek (From OE-Core rev: 4c353eeff45f91533f22392f129bc5a477ee5207) Signed-off-by: Richard Purdie --- meta/classes/package_ipk.bbclass | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index eb00932336..e7e7d4929b 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -48,6 +48,8 @@ python do_package_ipk () { if os.path.exists(p): bb.utils.prunedir(p) + recipesource = os.path.basename(d.getVar('FILE', True)) + for pkg in packages.split(): localdata = bb.data.createCopy(d) root = "%s/%s" % (pkgdest, pkg) @@ -212,10 +214,7 @@ python do_package_ipk () { ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces)) if rconflicts: ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts)) - src_uri = localdata.getVar("SRC_URI", True).strip() or "None" - if src_uri: - src_uri = re.sub("\s+", " ", src_uri) - ctrlfile.write("Source: %s\n" % " ".join(src_uri.split())) + ctrlfile.write("Source: %s\n" % recipesource) ctrlfile.close() for script in ["preinst", "postinst", "prerm", "postrm"]: From a992a31803f31d756f2ea01142b7241e14db7ddc Mon Sep 17 00:00:00 2001 From: Changhyeok Bae Date: Tue, 20 Jun 2017 16:22:41 -0700 Subject: [PATCH 086/129] ref-manual: uClibc Replaced by musl from Yocto 2.2 (From yocto-docs rev: e131c26ee1ab268679f7762dbe26760bd859e0e5) Signed-off-by: Kristi Rifenbark Signed-off-by: Richard Purdie --- documentation/ref-manual/ref-variables.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml index a696ee4e66..807e24251f 100644 --- a/documentation/ref-manual/ref-variables.xml +++ b/documentation/ref-manual/ref-variables.xml @@ -4892,9 +4892,9 @@ is normally the same as the TARGET_OS. The variable can be set to "linux" for glibc-based systems and - to "linux-uclibc" for uclibc. + to "linux-musl" for musl. For ARM/EABI targets, there are also "linux-gnueabi" and - "linux-uclibc-gnueabi" values possible. + "linux-musleabi" values possible. @@ -13770,9 +13770,9 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" Specifies the target's operating system. The variable can be set to "linux" for glibc-based systems and - to "linux-uclibc" for uclibc. + to "linux-musl" for musl. For ARM/EABI targets, there are also "linux-gnueabi" and - "linux-uclibc-gnueabi" values possible. + "linux-musleabi" values possible. @@ -13901,7 +13901,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" TCLIBC - TCLIBC[doc] = "Specifies GNU standard C library (libc) variant to use during the build process. You can select 'glibc' or 'uclibc'." + TCLIBC[doc] = "Specifies GNU standard C library (libc) variant to use during the build process. You can select 'glibc' or 'musl'." @@ -13913,7 +13913,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" - You can select "glibc" or "uclibc". + You can select "glibc" or "musl". @@ -13952,7 +13952,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" TCLIBC, which controls the variant of the GNU standard C library (libc) used during the build process: - glibc or uclibc. + glibc or musl. From d4b41223d39f89e3e9f1217d92759adccc8bde2a Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 14 Mar 2017 01:45:45 -0700 Subject: [PATCH 087/129] oe/path.py: fix for "Argument list too long" Issue: LIN9-1648 Fixed when len(TMPDIR) = 410: $ bitbake core-image-sato-sdk [snip] Subprocess output: /bin/sh: /bin/cp: Argument list too long ERROR: core-image-sato-sdk-1.0-r0 do_rootfs: Function failed: do_rootfs [snip] This is because "copyhardlinktree(src, dst)" does "cp -afl src/* dst", while src/* is expanded to "src/file1 src/file2, src/file3..." which causes the "Argument list too long", use ./* as src and change cwd in subprocess.check_output() to fix the problem. (From OE-Core rev: a3dc93eb25fba32109edd1db6e8766074fb52e4b) (From OE-Core rev: befda6ce3fd916ab04c035d1d82ed173759f7f09) Signed-off-by: Robert Yang Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oe/path.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index 06a5af2659..ed7fd1eef0 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py @@ -83,12 +83,14 @@ def copyhardlinktree(src, dst): if os.path.isdir(src): import glob if len(glob.glob('%s/.??*' % src)) > 0: - source = '%s/.??* ' % src - source = source + '%s/*' % src + source = './.??* ' + source += './*' + s_dir = src else: source = src - cmd = 'cp -afl --preserve=xattr %s %s' % (source, dst) - subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) + s_dir = os.getcwd() + cmd = 'cp -afl --preserve=xattr %s %s' % (source, os.path.realpath(dst)) + subprocess.check_output(cmd, shell=True, cwd=s_dir, stderr=subprocess.STDOUT) else: copytree(src, dst) From fd7f2d644a94bbb951c0bed11af7deb35f1cfb22 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 29 May 2017 11:10:18 +0100 Subject: [PATCH 088/129] bitbake: siggen: Make calc_taskhash match get_taskhash for file checksums The code in these two functions is meant to be equivlanet in behaviour but isn't. Add in code to ensure files that don't exist are handled consistently by both functions. Users did report being able to generate tracebacks otherwise. (Bitbake rev: df69c0257aaa9f4e2f4a20d130b7bc0ce2ca0848) Signed-off-by: Richard Purdie --- bitbake/lib/bb/siggen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py index 40085b9c54..542bbb9d13 100644 --- a/bitbake/lib/bb/siggen.py +++ b/bitbake/lib/bb/siggen.py @@ -564,7 +564,8 @@ def calc_taskhash(sigdata): data = data + sigdata['runtaskhashes'][dep] for c in sigdata['file_checksum_values']: - data = data + c[1] + if c[1]: + data = data + c[1] if 'taint' in sigdata: if 'nostamp:' in sigdata['taint']: From bbe268e060d9e5a2e37514eaf078de5147c15d58 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 18 Jul 2017 23:07:34 +0100 Subject: [PATCH 089/129] libgcrypt: fix CVE-2017-9526 In libgcrypt before 1.7.7, an attacker who learns the EdDSA session key (from side-channel observation during the signing process) can easily recover the long-term secret key. 1.7.7 makes a cipher/ecc-eddsa.c change to store this session key in secure memory, to ensure that constant-time point operations are used in the MPI library. (From OE-Core rev: 04d7a4adafa09f9f3012c355f4f2f9728cb0b166) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- ...e-EdDSA-session-key-in-secure-memory.patch | 39 +++++++++++++++++++ meta/recipes-support/libgcrypt/libgcrypt.inc | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch diff --git a/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch b/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch new file mode 100644 index 0000000000..f6c4ca76f3 --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch @@ -0,0 +1,39 @@ +CVE: CVE-2017-9526 +Upstream-Status: Backport +Signed-off-by: Ross Burton + +From b3cab278eb9c2ceda79f980bc26460d97f260041 Mon Sep 17 00:00:00 2001 +From: Jo Van Bulck +Date: Thu, 19 Jan 2017 17:00:15 +0100 +Subject: [PATCH] ecc: Store EdDSA session key in secure memory. + +* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): use mpi_snew to allocate +session key. +-- + +An attacker who learns the EdDSA session key from side-channel +observation during the signing process, can easily revover the long- +term secret key. Storing the session key in secure memory ensures that +constant time point operations are used in the MPI library. + +Signed-off-by: Jo Van Bulck +--- + cipher/ecc-eddsa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c +index f91f8489..813e030d 100644 +--- a/cipher/ecc-eddsa.c ++++ b/cipher/ecc-eddsa.c +@@ -603,7 +603,7 @@ _gcry_ecc_eddsa_sign (gcry_mpi_t input, ECC_secret_key *skey, + a = mpi_snew (0); + x = mpi_new (0); + y = mpi_new (0); +- r = mpi_new (0); ++ r = mpi_snew (0); + ctx = _gcry_mpi_ec_p_internal_new (skey->E.model, skey->E.dialect, 0, + skey->E.p, skey->E.a, skey->E.b); + b = (ctx->nbits+7)/8; +-- +2.11.0 + diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc index 15805cd436..7c4c0e83b5 100644 --- a/meta/recipes-support/libgcrypt/libgcrypt.inc +++ b/meta/recipes-support/libgcrypt/libgcrypt.inc @@ -20,6 +20,7 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.gz \ file://libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \ file://fix-ICE-failure-on-mips-with-option-O-and-g.patch \ file://fix-undefined-reference-to-pthread.patch \ + file://0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch \ " BINCONFIG = "${bindir}/libgcrypt-config" From 2e132efa2f985f72c3b6c5402747d0b0e1fc540a Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Tue, 18 Jul 2017 23:07:35 +0100 Subject: [PATCH 090/129] libgcrypt: fix CVE-2017-7526 Fixes CVE-2017-7526, 'flush+reload side-channel attack on RSA secret keys dubbed "Sliding right into disaster"'. (From OE-Core rev: e3911133ee9aad7cc3ae89faea80a097f6614fab) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- .../libgcrypt/files/CVE-2017-7526.patch | 455 ++++++++++++++++++ meta/recipes-support/libgcrypt/libgcrypt.inc | 1 + 2 files changed, 456 insertions(+) create mode 100644 meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch diff --git a/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch b/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch new file mode 100644 index 0000000000..7180e7af2c --- /dev/null +++ b/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch @@ -0,0 +1,455 @@ +Flush+reload side-channel attack on RSA secret keys dubbed "Sliding right +into disaster". + +CVE: CVE-2017-7526 +Upstream-Status: Backport +Signed-off-by: Ross Burton + +From 56bd068335500207dea2cece9cc662bcd9658951 Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Tue, 4 Apr 2017 17:38:05 +0900 +Subject: [PATCH 1/5] mpi: Simplify mpi_powm. + +* mpi/mpi-pow.c (_gcry_mpi_powm): Simplify the loop. + +-- + +This fix is not a solution for the problem reported (yet). The +problem is that the current algorithm of _gcry_mpi_powm depends on +exponent and some information leaks is possible. + +Reported-by: Andreas Zankl +Signed-off-by: NIIBE Yutaka + +(backport from master commit: +719468e53133d3bdf12156c5bfdea2bf15f9f6f1) + +Signed-off-by: Ross Burton +--- + mpi/mpi-pow.c | 105 +++++++++++++++++----------------------------------------- + 1 file changed, 30 insertions(+), 75 deletions(-) + +diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c +index a780ebd1..7b3dc318 100644 +--- a/mpi/mpi-pow.c ++++ b/mpi/mpi-pow.c +@@ -609,12 +609,8 @@ _gcry_mpi_powm (gcry_mpi_t res, + if (e == 0) + { + j += c; +- i--; +- if ( i < 0 ) +- { +- c = 0; +- break; +- } ++ if ( --i < 0 ) ++ break; + + e = ep[i]; + c = BITS_PER_MPI_LIMB; +@@ -629,38 +625,33 @@ _gcry_mpi_powm (gcry_mpi_t res, + c -= c0; + j += c0; + ++ e0 = (e >> (BITS_PER_MPI_LIMB - W)); + if (c >= W) +- { +- e0 = (e >> (BITS_PER_MPI_LIMB - W)); +- e = (e << W); +- c -= W; +- } ++ c0 = 0; + else + { +- i--; +- if ( i < 0 ) ++ if ( --i < 0 ) + { +- e = (e >> (BITS_PER_MPI_LIMB - c)); +- break; ++ e0 = (e >> (BITS_PER_MPI_LIMB - c)); ++ j += c - W; ++ goto last_step; ++ } ++ else ++ { ++ c0 = c; ++ e = ep[i]; ++ c = BITS_PER_MPI_LIMB; ++ e0 |= (e >> (BITS_PER_MPI_LIMB - (W - c0))); + } +- +- c0 = c; +- e0 = (e >> (BITS_PER_MPI_LIMB - W)) +- | (ep[i] >> (BITS_PER_MPI_LIMB - W + c0)); +- e = (ep[i] << (W - c0)); +- c = BITS_PER_MPI_LIMB - W + c0; + } + ++ e = e << (W - c0); ++ c -= (W - c0); ++ ++ last_step: + count_trailing_zeros (c0, e0); + e0 = (e0 >> c0) >> 1; + +- for (j += W - c0; j; j--) +- { +- mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); +- tp = rp; rp = xp; xp = tp; +- rsize = xsize; +- } +- + /* + * base_u <= precomp[e0] + * base_u_size <= precomp_size[e0] +@@ -677,25 +668,23 @@ _gcry_mpi_powm (gcry_mpi_t res, + u.d = precomp[k]; + + mpi_set_cond (&w, &u, k == e0); +- base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == e0)) ); ++ base_u_size |= ( precomp_size[k] & ((mpi_size_t)0 - (k == e0)) ); + } + +- mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, +- mp, msize, &karactx); +- tp = rp; rp = xp; xp = tp; +- rsize = xsize; ++ for (j += W - c0; j >= 0; j--) ++ { ++ mul_mod (xp, &xsize, rp, rsize, ++ j == 0 ? base_u : rp, j == 0 ? base_u_size : rsize, ++ mp, msize, &karactx); ++ tp = rp; rp = xp; xp = tp; ++ rsize = xsize; ++ } + + j = c0; ++ if ( i < 0 ) ++ break; + } + +- if (c != 0) +- { +- j += c; +- count_trailing_zeros (c, e); +- e = (e >> c); +- j -= c; +- } +- + while (j--) + { + mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); +@@ -703,40 +692,6 @@ _gcry_mpi_powm (gcry_mpi_t res, + rsize = xsize; + } + +- if (e != 0) +- { +- /* +- * base_u <= precomp[(e>>1)] +- * base_u_size <= precomp_size[(e>>1)] +- */ +- base_u_size = 0; +- for (k = 0; k < (1<< (W - 1)); k++) +- { +- struct gcry_mpi w, u; +- w.alloced = w.nlimbs = precomp_size[k]; +- u.alloced = u.nlimbs = precomp_size[k]; +- w.sign = u.sign = 0; +- w.flags = u.flags = 0; +- w.d = base_u; +- u.d = precomp[k]; +- +- mpi_set_cond (&w, &u, k == (e>>1)); +- base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == (e>>1))) ); +- } +- +- mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, +- mp, msize, &karactx); +- tp = rp; rp = xp; xp = tp; +- rsize = xsize; +- +- for (; c; c--) +- { +- mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx); +- tp = rp; rp = xp; xp = tp; +- rsize = xsize; +- } +- } +- + /* We shifted MOD, the modulo reduction argument, left + MOD_SHIFT_CNT steps. Adjust the result by reducing it with the + original MOD. +-- +2.11.0 + + +From 6e237c8c48d257dc315e364791d284c6bf3fa703 Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Sat, 24 Jun 2017 20:46:20 +0900 +Subject: [PATCH 2/5] Same computation for square and multiply. + +* mpi/mpi-pow.c (_gcry_mpi_powm): Compare msize for max_u_size. Move +the assignment to base_u into the loop. Copy content refered by RP to +BASE_U except the last of the loop. + +-- + +Signed-off-by: NIIBE Yutaka +(backport from master commit: +78130828e9a140a9de4dafadbc844dbb64cb709a) + +Signed-off-by: Ross Burton +--- + mpi/mpi-pow.c | 50 +++++++++++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 21 deletions(-) + +diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c +index 7b3dc318..3cba6903 100644 +--- a/mpi/mpi-pow.c ++++ b/mpi/mpi-pow.c +@@ -573,6 +573,8 @@ _gcry_mpi_powm (gcry_mpi_t res, + MPN_COPY (precomp[i], rp, rsize); + } + ++ if (msize > max_u_size) ++ max_u_size = msize; + base_u = mpi_alloc_limb_space (max_u_size, esec); + MPN_ZERO (base_u, max_u_size); + +@@ -619,6 +621,10 @@ _gcry_mpi_powm (gcry_mpi_t res, + { + int c0; + mpi_limb_t e0; ++ struct gcry_mpi w, u; ++ w.sign = u.sign = 0; ++ w.flags = u.flags = 0; ++ w.d = base_u; + + count_leading_zeros (c0, e); + e = (e << c0); +@@ -652,29 +658,31 @@ _gcry_mpi_powm (gcry_mpi_t res, + count_trailing_zeros (c0, e0); + e0 = (e0 >> c0) >> 1; + +- /* +- * base_u <= precomp[e0] +- * base_u_size <= precomp_size[e0] +- */ +- base_u_size = 0; +- for (k = 0; k < (1<< (W - 1)); k++) +- { +- struct gcry_mpi w, u; +- w.alloced = w.nlimbs = precomp_size[k]; +- u.alloced = u.nlimbs = precomp_size[k]; +- w.sign = u.sign = 0; +- w.flags = u.flags = 0; +- w.d = base_u; +- u.d = precomp[k]; +- +- mpi_set_cond (&w, &u, k == e0); +- base_u_size |= ( precomp_size[k] & ((mpi_size_t)0 - (k == e0)) ); +- } +- + for (j += W - c0; j >= 0; j--) + { +- mul_mod (xp, &xsize, rp, rsize, +- j == 0 ? base_u : rp, j == 0 ? base_u_size : rsize, ++ ++ /* ++ * base_u <= precomp[e0] ++ * base_u_size <= precomp_size[e0] ++ */ ++ base_u_size = 0; ++ for (k = 0; k < (1<< (W - 1)); k++) ++ { ++ w.alloced = w.nlimbs = precomp_size[k]; ++ u.alloced = u.nlimbs = precomp_size[k]; ++ u.d = precomp[k]; ++ ++ mpi_set_cond (&w, &u, k == e0); ++ base_u_size |= ( precomp_size[k] & (0UL - (k == e0)) ); ++ } ++ ++ w.alloced = w.nlimbs = rsize; ++ u.alloced = u.nlimbs = rsize; ++ u.d = rp; ++ mpi_set_cond (&w, &u, j != 0); ++ base_u_size ^= ((base_u_size ^ rsize) & (0UL - (j != 0))); ++ ++ mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size, + mp, msize, &karactx); + tp = rp; rp = xp; xp = tp; + rsize = xsize; +-- +2.11.0 + + +From bf059348dafc1b8d29e07b9426d870ead853db84 Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Thu, 29 Jun 2017 11:48:44 +0900 +Subject: [PATCH 3/5] rsa: Add exponent blinding. + +* cipher/rsa.c (secret): Blind secret D with randomized nonce R for +mpi_powm computation. + +-- + +Co-authored-by: Werner Koch +Signed-off-by: NIIBE Yutaka + +The paper describing attack: https://eprint.iacr.org/2017/627 + +Sliding right into disaster: Left-to-right sliding windows leak +by Daniel J. Bernstein and Joachim Breitner and Daniel Genkin and +Leon Groot Bruinderink and Nadia Heninger and Tanja Lange and +Christine van Vredendaal and Yuval Yarom + + It is well known that constant-time implementations of modular + exponentiation cannot use sliding windows. However, software + libraries such as Libgcrypt, used by GnuPG, continue to use sliding + windows. It is widely believed that, even if the complete pattern of + squarings and multiplications is observed through a side-channel + attack, the number of exponent bits leaked is not sufficient to + carry out a full key-recovery attack against RSA. Specifically, + 4-bit sliding windows leak only 40% of the bits, and 5-bit sliding + windows leak only 33% of the bits. + + In this paper we demonstrate a complete break of RSA-1024 as + implemented in Libgcrypt. Our attack makes essential use of the fact + that Libgcrypt uses the left-to-right method for computing the + sliding-window expansion. We show for the first time that the + direction of the encoding matters: the pattern of squarings and + multiplications in left-to-right sliding windows leaks significantly + more information about exponent bits than for right-to-left. We show + how to incorporate this additional information into the + Heninger-Shacham algorithm for partial key reconstruction, and use + it to obtain very efficient full key recovery for RSA-1024. We also + provide strong evidence that the same attack works for RSA-2048 with + only moderately more computation. + +Exponent blinding is a kind of workaround to add noise. Signal (leak) +is still there for non-constant-time implementation. + +(backported from master commit: +8725c99ffa41778f382ca97233183bcd687bb0ce) + +Signed-off-by: Ross Burton +--- + cipher/rsa.c | 32 +++++++++++++++++++++++++------- + 1 file changed, 25 insertions(+), 7 deletions(-) + +diff --git a/cipher/rsa.c b/cipher/rsa.c +index b6c73741..25e29b5c 100644 +--- a/cipher/rsa.c ++++ b/cipher/rsa.c +@@ -1021,15 +1021,33 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey ) + gcry_mpi_t m1 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); + gcry_mpi_t m2 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); + gcry_mpi_t h = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 ); +- +- /* m1 = c ^ (d mod (p-1)) mod p */ ++ gcry_mpi_t D_blind = mpi_alloc_secure ( mpi_get_nlimbs(skey->n) + 1 ); ++ gcry_mpi_t r; ++ unsigned int r_nbits; ++ ++ r_nbits = mpi_get_nbits (skey->p) / 4; ++ if (r_nbits < 96) ++ r_nbits = 96; ++ r = mpi_alloc_secure ((r_nbits + BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB); ++ ++ /* d_blind = (d mod (p-1)) + (p-1) * r */ ++ /* m1 = c ^ d_blind mod p */ ++ _gcry_mpi_randomize (r, r_nbits, GCRY_WEAK_RANDOM); ++ mpi_set_highbit (r, r_nbits - 1); + mpi_sub_ui( h, skey->p, 1 ); +- mpi_fdiv_r( h, skey->d, h ); +- mpi_powm( m1, input, h, skey->p ); +- /* m2 = c ^ (d mod (q-1)) mod q */ ++ mpi_mul ( D_blind, h, r ); ++ mpi_fdiv_r ( h, skey->d, h ); ++ mpi_add ( D_blind, D_blind, h ); ++ mpi_powm( m1, input, D_blind, skey->p ); ++ /* d_blind = (d mod (q-1)) + (q-1) * r */ ++ /* m2 = c ^ d_blind mod q */ ++ _gcry_mpi_randomize (r, r_nbits, GCRY_WEAK_RANDOM); ++ mpi_set_highbit (r, r_nbits - 1); + mpi_sub_ui( h, skey->q, 1 ); +- mpi_fdiv_r( h, skey->d, h ); +- mpi_powm( m2, input, h, skey->q ); ++ mpi_mul ( D_blind, h, r ); ++ mpi_fdiv_r ( h, skey->d, h ); ++ mpi_add ( D_blind, D_blind, h ); ++ mpi_powm( m2, input, D_blind, skey->q ); + /* h = u * ( m2 - m1 ) mod q */ + mpi_sub( h, m2, m1 ); + if ( mpi_has_sign ( h ) ) +-- +2.11.0 + + +From 09b9df2675a24e679b7944352ad6385e9e68474f Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Thu, 29 Jun 2017 12:36:27 +0900 +Subject: [PATCH 4/5] rsa: Fix exponent blinding. + +* cipher/rsa.c (secret): Free D_BLIND. + +-- + +Fixes-commit: a9f612def801c8145d551d995475e5d51a4c988c +Signed-off-by: NIIBE Yutaka +Signed-off-by: Ross Burton +--- + cipher/rsa.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cipher/rsa.c b/cipher/rsa.c +index 25e29b5c..33f92ebd 100644 +--- a/cipher/rsa.c ++++ b/cipher/rsa.c +@@ -1057,6 +1057,7 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey ) + mpi_mul ( h, h, skey->p ); + mpi_add ( output, m1, h ); + ++ mpi_free ( D_blind ); + mpi_free ( h ); + mpi_free ( m1 ); + mpi_free ( m2 ); +-- +2.11.0 + + +From 1323fdcf6f2f9fd1da8c5adf396650f15a2a1260 Mon Sep 17 00:00:00 2001 +From: NIIBE Yutaka +Date: Thu, 29 Jun 2017 12:40:19 +0900 +Subject: [PATCH 5/5] rsa: More fix. + +* cipher/rsa.c (secret): Free R. + +-- + +Fixes-commit: a9f612def801c8145d551d995475e5d51a4c988c +Signed-off-by: NIIBE Yutaka +Signed-off-by: Ross Burton +--- + cipher/rsa.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/cipher/rsa.c b/cipher/rsa.c +index 33f92ebd..8d8d157b 100644 +--- a/cipher/rsa.c ++++ b/cipher/rsa.c +@@ -1057,6 +1057,7 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey ) + mpi_mul ( h, h, skey->p ); + mpi_add ( output, m1, h ); + ++ mpi_free ( r ); + mpi_free ( D_blind ); + mpi_free ( h ); + mpi_free ( m1 ); +-- +2.11.0 + diff --git a/meta/recipes-support/libgcrypt/libgcrypt.inc b/meta/recipes-support/libgcrypt/libgcrypt.inc index 7c4c0e83b5..00870e3d27 100644 --- a/meta/recipes-support/libgcrypt/libgcrypt.inc +++ b/meta/recipes-support/libgcrypt/libgcrypt.inc @@ -21,6 +21,7 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.gz \ file://fix-ICE-failure-on-mips-with-option-O-and-g.patch \ file://fix-undefined-reference-to-pthread.patch \ file://0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch \ + file://CVE-2017-7526.patch \ " BINCONFIG = "${bindir}/libgcrypt-config" From 7d5822bf4cb2089687c3c9a908cf4a4ef4e9a53a Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 18 Nov 2016 16:23:22 +0100 Subject: [PATCH 091/129] bitbake: codeparser.py: support deeply nested tokens For shell constructs like echo hello & wait $! the process_tokens() method ended up with a situation where "token" in the "name, value = token" assignment was a list of tuples and not the expected tuple, causing the assignment to fail. There were already two for loops (one in _parse_shell(), one in process_tokens()) which iterated over token lists. Apparently the actual nesting can also be deeper. Now there is just one such loop in process_token_list() which calls itself recursively when it detects that a list entry is another list. As a side effect (improvement?!) of the loop removal in _parse_shell(), the local function definitions in process_tokens() get executed less often. Fixes: [YOCTO #10668] (Bitbake rev: 887ea6d25cee5114365dfbf1130603599e13ee80) Signed-off-by: Patrick Ohly Signed-off-by: Richard Purdie --- bitbake/lib/bb/codeparser.py | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index 25938d6586..5d2d44065a 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py @@ -342,8 +342,7 @@ def _parse_shell(self, value): except pyshlex.NeedMore: raise sherrors.ShellSyntaxError("Unexpected EOF") - for token in tokens: - self.process_tokens(token) + self.process_tokens(tokens) def process_tokens(self, tokens): """Process a supplied portion of the syntax tree as returned by @@ -389,18 +388,24 @@ def simple_command(value): "case_clause": case_clause, } - for token in tokens: - name, value = token - try: - more_tokens, words = token_handlers[name](value) - except KeyError: - raise NotImplementedError("Unsupported token type " + name) + def process_token_list(tokens): + for token in tokens: + if isinstance(token, list): + process_token_list(token) + continue + name, value = token + try: + more_tokens, words = token_handlers[name](value) + except KeyError: + raise NotImplementedError("Unsupported token type " + name) + + if more_tokens: + self.process_tokens(more_tokens) - if more_tokens: - self.process_tokens(more_tokens) + if words: + self.process_words(words) - if words: - self.process_words(words) + process_token_list(tokens) def process_words(self, words): """Process a set of 'words' in pyshyacc parlance, which includes From 88ad6d975e5965b54b97fced8323a55c39d8a9f1 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 30 Mar 2017 11:42:59 +0100 Subject: [PATCH 092/129] bitbake: wget: Fix handling of urls with user/password URL decoding was improved in the core a while ago and this looks like a leftover from those times which caused urls needing a user/password to fail. Use the parameters from the core instead of the broken split implementation. [YOCTO #11262] (Bitbake rev: 32a249cf33f79b579a2cf6224c7d23cdb20d376f) Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/wget.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index ecb946aa81..23d48acb07 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -108,9 +108,8 @@ def download(self, ud, d): bb.utils.mkdirhier(os.path.dirname(dldir + os.sep + ud.localfile)) fetchcmd += " -O " + dldir + os.sep + ud.localfile - if ud.user: - up = ud.user.split(":") - fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (up[0],up[1]) + if ud.user and ud.pswd: + fetchcmd += " --user=%s --password=%s --auth-no-challenge" % (ud.user, ud.pswd) uri = ud.url.split(";")[0] if os.path.exists(ud.localpath): From 4812871780ba0765b237bf482d10a39d4a0dccfe Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Thu, 8 Jun 2017 14:39:41 -0400 Subject: [PATCH 093/129] linux-yocto/4.8: update to 4.8.24 Integration the -stable updates to 4.8, which comprise the following commits: ae51b3b4efe6 Linux 4.8.24 accb950219c0 nvme/pci: Disable on removal when disconnected 995be68699ef padata: avoid race in reordering bea2fdcc6d3e blk: improve order of bio handling in generic_make_request() 26690f5a8bdf mm: workingset: fix premature shadow node shrinking with cgroups f52ade55d6e9 MIPS: Lantiq: Fix cascaded IRQ setup feae78cdcaef ARM: dts: BCM5301X: Correct GIC_PPI interrupt flags e36a1a1a9695 ARM: BCM5301X: Add back handler ignoring external imprecise aborts 26fbe60844a9 mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() d15202219abe mm: rmap: fix huge file mmap accounting in the memcg stats 72f38e33793c x86/mce: Fix copy/paste error in exception table entries 9e08a6f8e64e x86/mm/KASLR: Exclude EFI region from KASLR VA space randomization 100aa553e31b x86/mm/64: Enable KASLR for vmemmap memory region 2e5c45495433 drm/etnaviv: (re-)protect fence allocation with GPU mutex 7f160b149090 drm/vc4: Allocate the right amount of space for boot-time CRTC state. 38cdfd6153cf drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags ccd0fc5589ca KVM: kvm_io_bus_unregister_dev() should never fail 332e2ac55d3b KVM: x86: clear bus pointer when destroyed fcbdbe1290d6 serial: mxs-auart: Fix baudrate calculation 3b7bb3391f62 USB: fix linked-list corruption in rh_call_control() 5f004babfd46 tty/serial: atmel: fix race condition (TX+DMA) 4509ea7b4349 ACPI: Do not create a platform_device for IOAPIC/IOxAPIC 12fddf4d255f ACPI: Fix incompatibility with mcount-based function graph tracing 8805bbdea121 nfsd: map the ENOKEY to nfserr_perm for avoiding warning 1fa18f8fad45 mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection 3a0df02f0387 mmc: sdhci: Disable runtime pm when the sdio_irq is enabled d742580939f5 ASoC: Intel: Skylake: fix invalid memory access due to wrong reference of pointer 726514355250 ASoC: atmel-classd: fix audio clock rate 0dd77376bd45 ALSA: hda - fix a problem for lineout on a Dell AIO machine 12788ff3a917 ALSA: seq: Fix race during FIFO resize 5ccedc21345f PCI: iproc: Save host bridge window resource in struct iproc_pcie 61b133e83718 scsi: scsi_dh_alua: Ensure that alua_activate() calls the completion function ae4a71a0b8b4 scsi: scsi_dh_alua: Check scsi_device_get() return value 1b82bcc866c3 scsi: libsas: fix ata xfer length 0b9b5b603f27 scsi: sg: check length passed to SG_NEXT_CMD_LEN 8b02a4b8e3b3 xfs: Use xfs_icluster_size_fsb() to calculate inode alignment mask a8eded7e1484 xfs: tune down agno asserts in the bmap code 7650b45a6dd8 xfs: Use xfs_icluster_size_fsb() to calculate inode chunk alignment e9d4a4b55c86 xfs: don't reserve blocks for right shift transactions 81f456210999 xfs: split indlen reservations fairly when under reserved 842c9d864561 xfs: handle indlen shortage on delalloc extent merge f90db61ed148 xfs: don't fail xfs_extent_busy allocation 590e612677e2 xfs: reset b_first_retry_time when clear the retry status of xfs_buf_t c493142b3a2c xfs: verify free block header fields 4dda58920fb9 xfs: check for obviously bad level values in the bmbt root 0faf06ef8b24 xfs: filter out obviously bad btree pointers 6974d828ce0c xfs: fail _dir_open when readahead fails 365ec079aeeb xfs: fix toctou race when locking an inode to access the data map 06a1dbe68823 xfs: fix eofblocks race with file extending async dio writes fc1ff6abfb5d xfs: pull up iolock from xfs_free_eofblocks() 2de02a1aa708 xen/setup: Don't relocate p2m over existing one bd37e332bc35 libceph: force GFP_NOIO for socket allocations 14d57fe1fcd3 sched/rt: Add a missing rescheduling point 461aa14a19df metag/ptrace: Reject partial NT_METAG_RPIPE writes 35d078d3b1f5 metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS 9519f4083b0d metag/ptrace: Preserve previous registers for short regset write b2d2e181ebe4 sparc/ptrace: Preserve previous registers for short regset write 0a89a38ebbae mips/ptrace: Preserve previous registers for short regset write a303cc3a707b h8300/ptrace: Fix incorrect register transfer count 576d881764eb c6x/ptrace: Remove useless PTRACE_SETREGSET implementation 1661ca89ebd1 pinctrl: qcom: Don't clear status bit on irq_unmask 5c52be1e1c55 virtio_balloon: init 1st buffer in stats vq 171bd47e04fa KVM: x86: cleanup the page tracking SRCU instance 37c063abc015 xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder f5e8896582a0 xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window ef704417015e xfrm: policy: init locks early 54b82b92b678 crypto: algif_hash - avoid zero-sized array 35a836ab3d9b fbcon: Fix vc attr at deinit d64422cfc106 drm: reference count event->completion 5b8d397ea73a drm/bridge: analogix dp: Fix runtime PM state on driver bind 409d2330bd85 libceph: don't set weight to IN when OSD is destroyed cb7f50af5964 Drivers: hv: vmbus: Don't leak channel ids 7d63e96a483f intel_th: Don't leak module refcount on failure to activate bca70ad00096 blk-mq: don't complete un-started request in timeout handler 7ca7701e2615 cgroup, net_cls: iterate the fds of only the tasks which are being migrated c3accccd8ebe cpufreq: Restore policy min/max limits on CPU online 42ec5a5b3f7a arm64: kaslr: Fix up the kernel image alignment b74685fc49ce ARM: at91: pm: cpu_idle: switch DDR to power-down mode cba43efed603 Revert "ARM: at91/dt: sama5d2: Use new compatible for ohci node" a54b0f345230 xen/acpi: upload PM state from init-domain to Xen 3700c9549893 crypto: ccp - Assign DMA commands to the channel's CCP c05851c95c30 clk: sunxi-ng: mp: Adjust parent rate for pre-dividers 298b4bcbee9e mmc: sdhci: Do not disable interrupts while waiting for clock d3bde483cd4e mmc: sdhci-of-arasan: fix incorrect timeout clock 1a0c2899c1fc mmc: sdhci-of-at91: Support external regulators 512b6b14b972 mmc: sdhci: Rename sdhci_set_power() to sdhci_set_power_noreg() fcc465466352 powerpc/64s: Fix idle wakeup potential to clobber registers e31490f131bd ext4: lock the xattr block before checksuming it 9515b8a3e59d ext4: mark inode dirty after converting inline directory ee78dd996a48 parport: fix attempt to write duplicate procfiles 7aa1f90f7bc9 iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3 46ed5a6a0317 iio: sw-device: Fix config group initialization 4fd6237dcb15 iio: adc: ti_am335x_adc: fix fifo overrun recovery 10481fe5bcc5 mmc: ushc: fix NULL-deref at probe b18275c8ca06 uwb: hwa-rc: fix NULL-deref at probe 90f875db3d83 uwb: i1480-dfu: fix NULL-deref at probe fedb7364f161 USB: usbtmc: fix probe error path 19ab12977470 USB: usbtmc: add missing endpoint sanity check d2f6089a604a usb: hub: Fix crash after failure to read BOS descriptor 4fe7f56d5936 usb: musb: cppi41: don't check early-TX-interrupt for Isoch transfer c314f1d496b3 USB: wusbcore: fix NULL-deref at probe 67ca7e6fbefe USB: idmouse: fix NULL-deref at probe 979ce26d7e67 USB: lvtest: fix NULL-deref at probe bc5daa8fcb39 USB: uss720: fix NULL-deref at probe 778e23f6cd77 usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk 8d38a9d16950 usb: gadget: f_uvc: Fix SuperSpeed companion descriptor's wBytesPerInterval ac5c5689dd1e ACM gadget: fix endianness in notifications 8e39a4d96fa0 USB: serial: qcserial: add Dell DW5811e d3e557a5e277 USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems 0ff11fc75667 ALSA: hda - Adding a group of pin definition to fix headset problem 73ac94f75f27 ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() ed79a62ce3b5 Input: sur40 - validate number of endpoints before using them 9f4a9350c962 Input: kbtab - validate number of endpoints before using them 535ecfd9ce37 Input: cm109 - validate number of endpoints before using them d4d90cc1939b Input: yealink - validate number of endpoints before using them 6cd3c938420d Input: hanwang - validate number of endpoints before using them 114ea08f2b53 Input: ims-pcu - validate number of endpoints before using them 8e536247967f Input: iforce - validate number of endpoints before using them d8e9da7cf4d2 Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 d7bd4ff902d4 Input: elan_i2c - add ASUS EeeBook X205TA special touchpad fw 15cbc365f36f tcp: initialize icsk_ack.lrcvtime at session start time 8d816936cb47 socket, bpf: fix sk_filter use after free in sk_clone_lock 599dca4e637a ipv4: provide stronger user input validation in nl_fib_input() 4dce5676bf12 net: bcmgenet: remove bcmgenet_internal_phy_setup() e54a886d9c7e ipv6: make sure to initialize sockc.tsflags before first use de7b203e7a07 net/mlx5e: Count LRO packets correctly 7e3b2755ae57 net/mlx5e: Count GSO packets correctly 0bb7b7ed9983 net/mlx5: Increase number of max QPs in default profile de1454d45e43 net/mlx5: Add missing entries for set/query rate limit commands aea1c1b15494 net: vrf: Reset rt6i_idev in local dst after put 30467a2d6a10 qmi_wwan: add Dell DW5811e 74a4f76fd1ac net: unix: properly re-increment inflight counter of GC discarded candidates b4927d54c638 openvswitch: Add missing case OVS_TUNNEL_KEY_ATTR_PAD d98fc268e284 amd-xgbe: Fix jumbo MTU processing on newer hardware 4ceda29faefa net: properly release sk_frag.page 42603fb986e2 net: bcmgenet: Do not suspend PHY if Wake-on-LAN is enabled 40dbeb5b15df net/openvswitch: Set the ipv6 source tunnel key address attribute correctly 81ecfc287d5a cgroup/pids: remove spurious suspicious RCU usage warning b488f503b905 percpu: acquire pcpu_lock when updating pcpu_nr_empty_pop_pages 1924ae622fd9 gfs2: Avoid alignment hole in struct lm_lockname e279f259f3e2 isdn/gigaset: fix NULL-deref at probe 0907a6cf5831 target: Fix VERIFY_16 handling in sbc_parse_cdb 6d71fefbf405 scsi: libiscsi: add lock around task lists to fix list corruption regression 4835fd5ad7aa scsi: lpfc: Add shutdown method for kexec 93ecb4c0e2cf target/pscsi: Fix TYPE_TAPE + TYPE_MEDIMUM_CHANGER export e5660310dac8 powerpc/boot: Fix zImage TOC alignment 8ce12dd199ac cpufreq: Fix and clean up show_cpuinfo_cur_freq() 4d5c2d2099a8 perf/core: Fix event inheritance on fork() f7b9504c680d perf/core: Fix use-after-free in perf_release() 848b0d18a847 parisc: Optimize flush_kernel_vmap_range and invalidate_kernel_vmap_range fbb1e639d3e1 qla2xxx: Fix request queue corruption. 60d674590d02 qla2xxx: Fix memory leak for abts processing e5e1af16aeae give up on gcc ilog2() constant optimizations 2401ecb47c7f drm/vc4: Use runtime autosuspend to avoid thrashing V3D power state. c495444e18c6 drm/vc4: Fix termination of the initial scan for branch targets. 97b74d794fa3 Linux 4.8.23 5d2e054aa127 crypto: powerpc - Fix initialisation of crc32c context 30eacf198cab locking/rwsem: Fix down_write_killable() for CONFIG_RWSEM_GENERIC_SPINLOCK=y 6ceef14519cd futex: Add missing error handling to FUTEX_REQUEUE_PI 0596ef2a1984 futex: Fix potential use-after-free in FUTEX_REQUEUE_PI e0421c6f49b0 x86/perf: Fix CR4.PCE propagation to use active_mm instead of mm b88efae3588c x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y 429bf916381e x86/tsc: Fix ART for TSC_KNOWN_FREQ 5eb6ff068525 drm/vc4: Fix ->clock_select setting for the VEC encoder 4a3f522f63ab drm/vc4: Fix race between page flip completion event and clean-up 02c5256b110c clk: bcm2835: Fix ->fixed_divider of pllh_aux d5dd232fc11e usb: gadget: udc: atmel: remove memory leak e85561f6aca8 serial: 8250_pci: Detach low-level driver during PCI error recovery 54c73832c576 ACPI / blacklist: Make Dell Latitude 3350 ethernet work f92b80712355 ACPI / blacklist: add _REV quirks for Dell Precision 5520 and 3520 990db74c5c87 slub: move synchronize_sched out of slab_mutex on shrink 06e966ded31e [media] uvcvideo: uvc_scan_fallback() for webcams with broken chain e30814bb2038 s390/zcrypt: Introduce CEX6 toleration c73c813f59ed block: allow WRITE_SAME commands with the SG_IO ioctl bb64e9763f59 drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes 3c5d63c13311 drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user 49e8233a2726 drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices 275ff35915b3 vfio/spapr: Postpone default window creation a6cc475b194a vfio/spapr: Add a helper to create default DMA window 95045ae80bba powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown 789e7eac7ee0 vfio/spapr: Reference mm in tce_container 28a412c87e63 powerpc/iommu: Stop using @current in mm_iommu_xxx 605c802e3cb9 powerpc/iommu: Pass mm_struct to init/cleanup helpers c70e411994d8 vfio/spapr: Postpone allocation of userspace version of TCE table 89b9c28ca6d7 Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw() (v2) ea35dd4dc3d5 PCI: Do any VF BAR updates before enabling the BARs ddb11bb30cbc PCI: Ignore BAR updates on virtual functions bfaf6ec96d7f PCI: Update BARs using property bits appropriate for type c09761e3af3f PCI: Don't update VF BARs while VF memory space is enabled f49fdb5fb9aa PCI: Decouple IORESOURCE_ROM_ENABLE and PCI_ROM_ADDRESS_ENABLE 4453d0980e47 PCI: Add comments about ROM BAR updating e9026b999d64 PCI: Remove pci_resource_bar() and pci_iov_resource_bar() bf5194f0e771 PCI: Separate VF BAR updates from standard BAR updates 4c25b4da1978 x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic f86de0bf6845 scsi: ibmvscsis: Synchronize cmds at remove time 03780edbb14b scsi: ibmvscsis: Synchronize cmds at tpg_enable_store time 6e76f14e8da7 scsi: ibmvscsis: Rearrange functions for future patches 87e714992008 scsi: ibmvscsis: Clean up properly if target_submit_cmd/tmr fails 26d9e831807f scsi: ibmvscsis: Return correct partition name/# to client 017f9415d242 scsi: ibmvscsis: Issues from Dan Carpenter/Smatch 1a865ae47435 igb: add i211 to i210 PHY workaround 7af86b0c55e3 igb: Workaround for igb i210 firmware issue 15fdb8c2a904 xen: do not re-use pirq number cached in pci device msi msg data 4af906f27c02 dmaengine: iota: ioat_alloc_chan_resources should not perform sleeping allocations. 7815d4127881 dccp: fix memory leak during tear-down of unsuccessful connection request 348714c022b1 tun: fix premature POLLOUT notification on tun devices a1bc0a9f122e dccp/tcp: fix routing redirect race 0a787971aa5b bridge: drop netfilter fake rtable unconditionally ee1d5c66f7d9 ipv6: avoid write to a possibly cloned skb 81ed14c04c32 ipv6: make ECMP route replacement less greedy 0949ba4922e5 mpls: Do not decrement alive counter for unregister events 76aaba0ce52e mpls: Send route delete notifications when router module is unloaded 48325fbb1d05 act_connmark: avoid crashing on malformed nlattrs with null parms 4331398f440e uapi: fix linux/packet_diag.h userspace compilation error f5f6f5529468 net/tunnel: set inner protocol in network gro hooks 2a00f4bf0780 vrf: Fix use-after-free in vrf_xmit 61e3a5db6e7d dccp: fix use-after-free in dccp_feat_activate_values 39ff72664911 net: fix socket refcounting in skb_complete_tx_timestamp() 9d88ea01fe88 net: fix socket refcounting in skb_complete_wifi_ack() 65f7a3f9b6c0 tcp: fix various issues for sockets morphing to listen state 5531ae9e101d dccp: Unlock sock before calling sk_free() beb7cb3c2a3d ipv6: orphan skbs in reassembly unit 728edccaedbf net: net_enable_timestamp() can be called from irq contexts e9f82ae95dcc net: don't call strlen() on the user buffer in packet_bind_spkt() b0c360a043c0 tcp/dccp: block BH for SYN processing b64d0db77b52 mlxsw: spectrum_router: Avoid potential packets loss 8e1715480d7c l2tp: avoid use-after-free caused by l2tp_ip_backlog_recv 44797e4d24c0 net sched actions: decrement module reference count after table flush. 9c1294eeb41e ipv4: mask tos for input route 368d2236b926 vxlan: don't allow overwrite of config src addr 9ead713bc6ac vti6: return GRE_KEY for vti6 a305478b6e7d vxlan: correctly validate VXLAN ID against VXLAN_N_VID bc68673783c7 net/mlx5e: Fix wrong CQE decompression 4e8f4987b785 IB/mlx5: Verify that Q counters are supported f0d5cfb83dcb ext4: don't BUG when truncating encrypted inodes on the orphan list 9ac44a73a4c5 [media] rc: raw decoder for keymap protocol is not loaded on register 56174559c310 dm: flush queued bios when process blocks to avoid deadlock 875142c6e879 KVM: arm/arm64: Let vcpu thread modify its own active state 220f66f1f4d8 KVM: s390: Fix guest migration for huge guests resulting in panic 3dd1f5f0b22c serial: samsung: Continue to work if DMA request fails 2a7c66c1a7c0 USB: serial: io_ti: fix information leak in completion handler 71f396d687e9 USB: serial: io_ti: fix NULL-deref in interrupt callback d9682fbb1252 USB: iowarrior: fix NULL-deref in write e1affee35832 USB: iowarrior: fix NULL-deref at probe 07c5918e96e7 USB: serial: omninet: fix reference leaks at open 782317bc4eba USB: serial: safe_serial: fix information leak in completion handler 15b553818e00 usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers e5df1d8231d8 usb: host: xhci-dbg: HCIVERSION should be a binary number a03e4fb73679 usb: gadget: function: f_fs: pass companion descriptor along bf600df6aa66 usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox() 40b091328f1c usb: dwc3: gadget: make Set Endpoint Configuration macros safe 7ab8263169d2 usb: gadget: dummy_hcd: clear usb_gadget region before registration 0a9e57a61494 PCI: Prevent VPD access for QLogic ISP2722 0c925288d9e2 powerpc/xics: Work around limitations of OPAL XICS priority handling e7ef86271857 powerpc: Emulation support for load/store instructions on LE 88cb0342bbc9 i2c: add missing of_node_put in i2c_mux_del_adapters 49817d5f81a0 efi/arm: Fix boot crash with CONFIG_CPUMASK_OFFSTACK=y b463b3b26bf5 tracing: Add #undef to fix compile error 03a9b9c5eb0f cpmac: remove hopeless #warning 9e7e1616fb69 MIPS: ralink: Remove unused rt*_wdt_reset functions 774bd1f0f2e0 MIPS: ralink: Cosmetic change to prom_init(). 1ec4e1a6c373 mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy e6c4a646d490 MIPS: Update lemote2f_defconfig for CPU_FREQ_STAT change b70dce737466 MIPS: ip22: Fix ip28 build for modern gcc c5f71770663f MIPS: Update ip27_defconfig for SCSI_DH change 4baa71bf6ca0 MIPS: ip27: Disable qlge driver in defconfig 810c65dcf036 crypto: improve gcc optimization flags for serpent and wp512 4b256e46c8e3 USB: serial: digi_acceleport: fix OOB data sanity check b88d9bf6ce41 fat: fix using uninitialized fields of fat_inode/fsinfo_inode bd390a837bf2 mm: do not call mem_cgroup_free() from within mem_cgroup_alloc() bc83fdbb1b88 thp: fix another corner case of munlock() vs. THPs 6f3effcbddd2 x86/tlb: Fix tlb flushing when lguest clears PGE 52f93fd5358e x86, mm: fix gup_pte_range() vs DAX mappings ab0eea711de5 libceph: use BUG() instead of BUG_ON(1) 6dd79e33d04d drm/i915: Fix not finding the VBT when it overlaps with OPREGION_ASLE_EXT 267b0207162b drm: Cancel drm_fb_helper_dirty_work on unload 60a94aca40ff drm/i915/gvt: Disable access to stolen memory as a guest 076bb9ce1a9f drm/atomic: fix an error code in mode_fixup() a6d98a3a3c5c drm/imx: imx-tve: Do not set the regulator voltage 3036e519c3f8 drm/ttm: Make sure BOs being swapped out are cacheable 8c52d5581851 drm/edid: Add EDID_QUIRK_FORCE_8BPC quirk for Rotel RSX-1058 b4f89786c979 drm/ast: Fix AST2400 POST failure without BMC FW or VBIOS 23c1fdaced81 drm/ast: Call open_key before enable_mmio in POST code cb624df381a6 drm/ast: Fix test for VGA enabled 8b6e3ca35b51 drm/amdgpu: add more cases to DCE11 possible crtc mask setup 77a708d95727 mac80211: use driver-indicated transmitter STA only for data frames 72aaf6d71167 mac80211: don't handle filtered frames within a BA session 680c812d7bdc mac80211: don't reorder frames with SN smaller than SSN e9d8c725c29b mac80211: flush delayed work when entering suspend 9a7a9c5c88b2 xtensa: move parse_tag_fdt out of #ifdef CONFIG_BLK_DEV_INITRD b389c603b09e pwm: pca9685: Fix period change with same duty cycle 711e95e9a7d4 nlm: Ensure callback code also checks that the files match 29f3a5545183 target: Fix NULL dereference during LUN lookup + active I/O shutdown f82148e9ffd3 pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot() 1d53d522e4d1 ceph: remove req from unsafe list when unregistering it a0e963dbeecc ktest: Fix child exit code processing d8e905726d90 memory/atmel-ebi: Fix ns <-> cycles conversions aef2ccf1d832 orangefs: Use RCU for destroy_inode f0453d44086f fs: Better permission checking for submounts eef4fcd21313 IB/srp: Fix race conditions related to task management 24960d72feeb IB/srp: Avoid that duplicate responses trigger a kernel bug f3572a0ce31f IB/SRP: Avoid using IB_MR_TYPE_SG_GAPS 63129c2502c1 IB/mlx5: Fix out-of-bound access f54cae186e6e IB/ipoib: Fix deadlock between rmmod and set_mode 77563b9714b9 mnt: Tuck mounts under others instead of creating shadow/side mounts. 521cf3b70359 brcmfmac: fix incorrect event channel deduction 55730c566d11 cxl: Prevent read/write to AFU config space while AFU not configured 3c20ea7dd380 net: mvpp2: fix DMA address calculation in mvpp2_txq_inc_put() 7006fe7139f6 s390: use correct input data address for setup_randomness e936795084d3 s390: make setup_randomness work bb318913c8ab s390: TASK_SIZE for kernel threads 64deb4069c4b s390/chsc: Add exception handler for CHSC instruction a35d74c9c4a0 s390/kdump: Use "LINUX" ELF note name instead of "CORE" b3e8ded18f8e s390/dcssblk: fix device size calculation in dcssblk_direct_access() e1b323f8b65e s390/qdio: clear DSCI prior to scanning multiple input queues 7d9a72f5eb8c Bluetooth: Add another AR3012 04ca:3018 device 7f422c5aec89 KVM: VMX: use correct vmcs_read/write for guest segment selector/base 61157eabc44e KVM: s390: Disable dirty log retrieval for UCONTROL guests d44d2ea64003 serial: 8250_pci: Add MKS Tenta SCOM-0800 and SCOM-0801 cards eaae8c8005c1 tty: n_hdlc: get rid of racy n_hdlc.tbuf (From OE-Core rev: 78ae0bb02175e601ca99387855a743a37294dee2) Signed-off-by: Bruce Ashfield Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../linux/linux-yocto-rt_4.8.bb | 6 +++--- .../linux/linux-yocto-tiny_4.8.bb | 6 +++--- meta/recipes-kernel/linux/linux-yocto_4.8.bb | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb index 65f74b1516..e65bc18e65 100644 --- a/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.8.bb @@ -11,13 +11,13 @@ python () { raise bb.parse.SkipPackage("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it") } -SRCREV_machine ?= "ffd0a071c2df55ecb2bb1f101465df93a81093b5" -SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" +SRCREV_machine ?= "7f56c6365d0d677d5fe6ca73f1b2ab6640b523a3" +SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;branch=${KBRANCH};name=machine \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.18" +LINUX_VERSION ?= "4.8.24" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb index 52e2b5233b..a0aa085be3 100644 --- a/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto-tiny_4.8.bb @@ -4,13 +4,13 @@ KCONFIG_MODE = "--allnoconfig" require recipes-kernel/linux/linux-yocto.inc -LINUX_VERSION ?= "4.8.18" +LINUX_VERSION ?= "4.8.24" KMETA = "kernel-meta" KCONF_BSP_AUDIT_LEVEL = "2" -SRCREV_machine ?= "db2e91ce904f32347ccf739de969b4216cbcaf92" -SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" +SRCREV_machine ?= "6a134d2553b9c25ce8acb67b807fe0feb1b01430" +SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07" PV = "${LINUX_VERSION}+git${SRCPV}" diff --git a/meta/recipes-kernel/linux/linux-yocto_4.8.bb b/meta/recipes-kernel/linux/linux-yocto_4.8.bb index a56ecdf23c..bfd52d24ee 100644 --- a/meta/recipes-kernel/linux/linux-yocto_4.8.bb +++ b/meta/recipes-kernel/linux/linux-yocto_4.8.bb @@ -11,20 +11,20 @@ KBRANCH_qemux86 ?= "standard/base" KBRANCH_qemux86-64 ?= "standard/base" KBRANCH_qemumips64 ?= "standard/mti-malta64" -SRCREV_machine_qemuarm ?= "c0123490bb9b454a43c3573e2573b491e0c09701" -SRCREV_machine_qemuarm64 ?= "304f750aa5be0bf66f70720d68f16865d912ff9f" -SRCREV_machine_qemumips ?= "aa15b7a291ca18d08fd640932efad673f6b278c3" -SRCREV_machine_qemuppc ?= "d2c3ea488fe179898ae853cb9565cb7ac62291c6" -SRCREV_machine_qemux86 ?= "c50f695341260d4757af64d809390610aae213e1" -SRCREV_machine_qemux86-64 ?= "c50f695341260d4757af64d809390610aae213e1" -SRCREV_machine_qemumips64 ?= "40a880b0f21aa09f3b52d68969339d80f9cc10ad" -SRCREV_machine ?= "c50f695341260d4757af64d809390610aae213e1" -SRCREV_meta ?= "c19322afb12490d9f5ad0182339bff2fe13e778b" +SRCREV_machine_qemuarm ?= "f25e3a184bf0ac7b12ec9c98d71439f4ac911974" +SRCREV_machine_qemuarm64 ?= "b9c5f19c82c717b014eab5dc404b9489badbfc8f" +SRCREV_machine_qemumips ?= "79e11192ca2c1acc714214c2125a8c0296c00413" +SRCREV_machine_qemuppc ?= "7a688297cc810a614f0329371d1389e550a98504" +SRCREV_machine_qemux86 ?= "f6329fd2875778192c03e08be02730180cb0dc71" +SRCREV_machine_qemux86-64 ?= "f6329fd2875778192c03e08be02730180cb0dc71" +SRCREV_machine_qemumips64 ?= "d619311dd8ea9ee95d80d937f08fb2c70c1dc50c" +SRCREV_machine ?= "f6329fd2875778192c03e08be02730180cb0dc71" +SRCREV_meta ?= "c84532b6475fd78b878507a481e2c04714341c07" SRC_URI = "git://git.yoctoproject.org/linux-yocto-4.8.git;name=machine;branch=${KBRANCH}; \ git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-4.8;destsuffix=${KMETA}" -LINUX_VERSION ?= "4.8.18" +LINUX_VERSION ?= "4.8.24" PV = "${LINUX_VERSION}+git${SRCPV}" From 0d91032b846d27d9474f42ba4a354bb7615cfc56 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Fri, 24 Feb 2017 18:02:03 +0200 Subject: [PATCH 094/129] systemtap: update to 3.1 Removed patches are in upstream. Rebase monitor-option.patch and no-msgfmt-check.patch Add support for python 3 probes (this necessitates the 0001-Do-not-let-configure-write-a-python-location-into-th.patch and the Add 0001-Install-python-modules-to-correct-library-dir.patch to install python modules to correct destination). Add perl to RDEPENDS to fix a QA warning about one of the installed files. (From OE-Core rev: e3bccfba499565ea13f154a11dadcab48ef5e0ab) (From OE-Core rev: 74f390351bdf5b8749cba6e2345ef14d3ff9f077) Signed-off-by: Alexander Kanavin Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...gure-write-a-python-location-into-th.patch | 25 +++++++++++ ...ython-modules-to-correct-library-dir.patch | 36 ++++++++++++++++ .../systemtap/fix-monitor-linking.patch | 41 ------------------- .../systemtap/systemtap/monitor-option.patch | 26 ++++++++---- .../systemtap/systemtap/no-msgfmt-check.patch | 22 +++++++++- .../systemtap/obsolete_automake_macros.patch | 15 ------- .../recipes-kernel/systemtap/systemtap_git.bb | 9 ++-- .../systemtap/systemtap_git.inc | 8 ++-- 8 files changed, 109 insertions(+), 73 deletions(-) create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-Do-not-let-configure-write-a-python-location-into-th.patch create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch delete mode 100644 meta/recipes-kernel/systemtap/systemtap/fix-monitor-linking.patch delete mode 100644 meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Do-not-let-configure-write-a-python-location-into-th.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Do-not-let-configure-write-a-python-location-into-th.patch new file mode 100644 index 0000000000..742b1187fc --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-Do-not-let-configure-write-a-python-location-into-th.patch @@ -0,0 +1,25 @@ +From ab29615ed6c2e779b472903564dc683dc1015de7 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Wed, 22 Feb 2017 13:37:33 +0200 +Subject: [PATCH] Do not let configure write a python location into the dtrace + binary + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin +--- + dtrace.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dtrace.in b/dtrace.in +index 5e1cf8079..a24229cbc 100644 +--- a/dtrace.in ++++ b/dtrace.in +@@ -1,4 +1,4 @@ +-#!@preferred_python@ ++#!/usr/bin/python3 + # vim: et sta sts=4 sw=4 ts=8 + + # This handles the systemtap equivalent of +-- +2.11.0 + diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch new file mode 100644 index 0000000000..528864cc93 --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-Install-python-modules-to-correct-library-dir.patch @@ -0,0 +1,36 @@ +From 2ada22f05460223924efe54080cb4419e2b4c276 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Fri, 24 Feb 2017 17:53:02 +0200 +Subject: [PATCH] Install python modules to correct library dir. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin +--- + python/Makefile.am | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/python/Makefile.am b/python/Makefile.am +index a254480f9..efe9f3c01 100644 +--- a/python/Makefile.am ++++ b/python/Makefile.am +@@ -47,7 +47,7 @@ install-exec-local: + if HAVE_PYTHON2_PROBES + (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON) setup.py build \ + --build-base $(shell readlink -f $(builddir))/py2build \ +- install --prefix $(DESTDIR)$(prefix) \ ++ install --prefix $(DESTDIR)$(prefix) --install-lib=$(DESTDIR)${pythondir} \ + --single-version-externally-managed \ + --record $(shell readlink -f $(builddir))/py2build/install_files.txt \ + --verbose) +@@ -55,7 +55,7 @@ endif + if HAVE_PYTHON3_PROBES + (cd $(srcdir); CFLAGS="$(AM_CPPFLAGS)" $(PYTHON3) setup.py build \ + --build-base $(shell readlink -f $(builddir))/py3build \ +- install --prefix $(DESTDIR)$(prefix) \ ++ install --prefix $(DESTDIR)$(prefix) --install-lib=$(DESTDIR)${python3dir} \ + --single-version-externally-managed \ + --record $(shell readlink -f $(builddir))/py3build/install_files.txt \ + --verbose) +-- +2.11.0 + diff --git a/meta/recipes-kernel/systemtap/systemtap/fix-monitor-linking.patch b/meta/recipes-kernel/systemtap/systemtap/fix-monitor-linking.patch deleted file mode 100644 index 2bf0742a1d..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/fix-monitor-linking.patch +++ /dev/null @@ -1,41 +0,0 @@ -Upstream-Status: Submitted -Signed-off-by: Ross Burton - -From d940aa0079c253b958cf9158e9ec7922ecf464f9 Mon Sep 17 00:00:00 2001 -From: Ross Burton -Date: Wed, 9 Nov 2016 00:00:48 +0000 -Subject: [PATCH] staprun: fix linking if monitor is enabled - -If the monitor is enabled, monitor.c needs to link against json-c and ncurses. -Instead of adding these linker flags to AM_CFLAGS (global CC flags) add them to -stapio_LDADD. - -Apart from being the "right" thing to do, this fixes build failures on systems -such as current Ubuntu (which defaults to using --as-needed and similar) where -link order is important. ---- - staprun/Makefile.am | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/staprun/Makefile.am b/staprun/Makefile.am -index 63d4088..66b3e21 100644 ---- a/staprun/Makefile.am -+++ b/staprun/Makefile.am -@@ -42,12 +42,11 @@ staprun_CXXFLAGS += $(nss_CFLAGS) - staprun_LDADD += $(nss_LIBS) - endif - --if HAVE_MONITOR_LIBS --AM_CFLAGS += $(jsonc_LIBS) $(ncurses_LIBS) --endif -- - stapio_SOURCES = stapio.c mainloop.c common.c ctl.c relay.c relay_old.c monitor.c - stapio_LDADD = libstrfloctime.a -lpthread -+if HAVE_MONITOR_LIBS -+stapio_LDADD += $(jsonc_LIBS) $(ncurses_LIBS) -+endif - - man_MANS = staprun.8 - --- -2.8.1 diff --git a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch b/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch index 7d43a79e21..b7ee0701b1 100644 --- a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch +++ b/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch @@ -1,21 +1,30 @@ +From 93fc4744fedf6fc593ee656968da97f7b1862ada Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 4 Oct 2016 16:37:53 +0100 +Subject: [PATCH 4/6] systemtap: rationalise dependencies + Add an option to explicitly disable the monitor (and therefore the dependency on json-c and ncurses). Upstream-Status: Pending Signed-off-by: Ross Burton +--- + configure.ac | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + diff --git a/configure.ac b/configure.ac -index cd781a2..e56079a 100644 +index 6bd0c5fc4..2ea9b3cbf 100644 --- a/configure.ac +++ b/configure.ac -@@ -570,13 +574,16 @@ dnl See if we have enough libraries and tools to build the virt server - fi - AM_CONDITIONAL([BUILD_VIRT], [test "${have_libvirt}" == "yes" -a "${have_libxml2}" == "yes" -a "$enable_virt" != "no"]) - +@@ -752,13 +752,16 @@ dnl We want either (or both) python probe support. + AM_CONDITIONAL([HAVE_PYTHON_PROBES], + [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"]) + +AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor],[Disable monitor])) +if test "$enable_monitor" != "no"; then dnl Check for presence of json-c and ncurses for use in monitor mode - PKG_CHECK_MODULES([jsonc], [json-c], [have_jsonc=yes], [have_jsonc=no]) + PKG_CHECK_MODULES([jsonc], [json-c >= 0.12], [have_jsonc=yes], [have_jsonc=no]) PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no]) -AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"]) if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then @@ -23,6 +32,9 @@ index cd781a2..e56079a 100644 fi +fi +AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes" -a "$enable_monitor" != "no"]) - + AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ old_CFLAGS="$CFLAGS" +-- +2.11.0 + diff --git a/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch b/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch index 471e62c56b..2c860b19e5 100644 --- a/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch +++ b/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch @@ -1,15 +1,33 @@ +From 43f1b04449bb1cf7e0092263f1c2a25f3fca08ef Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Tue, 8 Nov 2016 23:07:41 +0000 +Subject: [PATCH 5/6] systemtap: remove explicit msgfmt check + There is no need to explicitly check that msgfmt was found as the gettext macros handle this for us if NLS is enabled. Upstream-Status: Pending Signed-off-by: Ross Burton +--- + configure.ac | 4 ---- + 1 file changed, 4 deletions(-) + diff --git a/configure.ac b/configure.ac -index e56079a..284bbe0 100644 +index 2ea9b3cbf..95417f59c 100644 --- a/configure.ac +++ b/configure.ac -@@ -39,4 +38,0 @@ AM_GNU_GETTEXT_VERSION([0.19.4]) +@@ -36,10 +36,6 @@ AC_CHECK_FUNCS(openat) + AM_GNU_GETTEXT(external) + AM_GNU_GETTEXT_VERSION([0.19.4]) + -if test "x$GMSGFMT" = "x:"; then - AC_MSG_ERROR([missing gnu /usr/bin/msgfmt]) -fi - + # We want the 'PYTHON' varible to be python version 2. We also want + # our custom 'PYTHON3' varible to be python version 3. + # +-- +2.11.0 + diff --git a/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch b/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch deleted file mode 100644 index 988cda4f0c..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/obsolete_automake_macros.patch +++ /dev/null @@ -1,15 +0,0 @@ -Upstream-Status: Pending - -Signed-off-by: Marko Lindqvist -Index: git/configure.ac -=================================================================== ---- git.orig/configure.ac -+++ git/configure.ac -@@ -19,7 +19,6 @@ AC_PROG_LN_S - AC_PROG_CC - AC_PROG_CXX - AC_PROG_CPP --AM_PROG_CC_STDC - AM_PROG_CC_C_O - AC_PROG_RANLIB - AC_OBJEXT diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb index 43bf69e877..fed368a38b 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.bb +++ b/meta/recipes-kernel/systemtap/systemtap_git.bb @@ -4,12 +4,12 @@ require systemtap_git.inc DEPENDS = "boost elfutils" -RDEPENDS_${PN} += "python3-core bash" +RDEPENDS_${PN} += "python3-core bash perl" EXTRA_OECONF += "--with-libelf=${STAGING_DIR_TARGET} --without-rpm \ --without-nss --without-avahi --without-dyninst \ --disable-server --disable-grapher --enable-prologues \ - --with-python3 \ + --with-python3 --without-python2-probes \ ac_cv_prog_have_javac=no \ ac_cv_prog_have_jar=no " @@ -17,11 +17,12 @@ STAP_DOCS ?= "--disable-docs --disable-publican --disable-refdocs" EXTRA_OECONF += "${STAP_DOCS} " -PACKAGECONFIG ??= "sqlite monitor" +PACKAGECONFIG ??= "sqlite monitor python3-probes" PACKAGECONFIG[libvirt] = "--enable-libvirt,--disable-libvirt,libvirt" PACKAGECONFIG[sqlite] = "--enable-sqlite,--disable-sqlite,sqlite3" PACKAGECONFIG[monitor] = "--enable-monitor,--disable-monitor,ncurses json-c" +PACKAGECONFIG[python3-probes] = "--with-python3-probes,--without-python3-probes,python3-setuptools-native" -inherit autotools gettext pkgconfig +inherit autotools gettext pkgconfig distutils3-base BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc index a0f0e6859a..c9612308a5 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.inc +++ b/meta/recipes-kernel/systemtap/systemtap_git.inc @@ -1,16 +1,16 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" -SRCREV = "616ec7a0b916df7785d911b824c3df6eb022b213" -PV = "3.0" +SRCREV = "b8ea350dc13adb6190d9044a5b80110a4c441270" +PV = "3.1" SRC_URI = "git://sourceware.org/git/systemtap.git \ - file://obsolete_automake_macros.patch \ file://system_map_location.patch \ file://configure-allow-to-disable-libvirt.patch \ file://x32_abi_time.patch \ file://monitor-option.patch \ file://no-msgfmt-check.patch \ - file://fix-monitor-linking.patch \ + file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ + file://0001-Install-python-modules-to-correct-library-dir.patch \ " # systemtap doesn't support mips From 604b2b2c6c0a9c09098fccf958c94ea7ba8b082b Mon Sep 17 00:00:00 2001 From: Saul Wold Date: Tue, 7 Mar 2017 12:12:09 -0800 Subject: [PATCH 095/129] systemtap: Add patch to remove quotes This fixes the -I include lines that are getting passed to the kernel macros [YOCTO #10990] (From OE-Core rev: b4d2f41a474c111e5fc64cae635d851386d860ba) (From OE-Core rev: d767d24edb32f2a4303579371df2e526cdbf5c04) Signed-off-by: Saul Wold Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...-remove-quotes-around-I-include-line.patch | 38 +++++++++++++++++++ .../systemtap/systemtap_git.inc | 1 + 2 files changed, 39 insertions(+) create mode 100644 meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch b/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch new file mode 100644 index 0000000000..7996fdde73 --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch @@ -0,0 +1,38 @@ +From 75c4aec6de3a615909f3283eac585760de101b8c Mon Sep 17 00:00:00 2001 +From: Saul Wold +Date: Tue, 7 Mar 2017 10:46:12 -0800 +Subject: [PATCH] buildrun: remove quotes around -I include line + +By having the quotes, the kernel Makefile addtree macro adds the +kernel $srctree directory as a prefix and causes compilation failures. +Removing the quotes resolves the issue. + +This is trimmed from the verbose output of the GCC command line +Before: + -I/srv/sdb/builds/4.9/tmp/work-shared/qemux86-64/kernel-source/"/srv/sdb/releases/jethro/builds/4.1/tmp/sysroots/x86_64-linux/usr/share/systemtap/runtime" + +After: + -I/srv/sdb/builds/4.9/tmp/sysroots/x86_64-linux/usr/share/systemtap/runtime + +Upstream-Status: Pending +Signed-off-by: Saul Wold +--- + buildrun.cxx | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/buildrun.cxx b/buildrun.cxx +index aaea64c..8a8ee9f 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -495,7 +495,7 @@ compile_pass (systemtap_session& s) + #if CHECK_POINTER_ARITH_PR5947 + o << "EXTRA_CFLAGS += -Wpointer-arith" << endl; + #endif +- o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl; ++ o << "EXTRA_CFLAGS += -I" << s.runtime_path << endl; + // XXX: this may help ppc toc overflow + // o << "CFLAGS := $(subst -Os,-O2,$(CFLAGS)) -fminimal-toc" << endl; + o << "obj-m := " << s.module_name << ".o" << endl; +-- +2.7.4 + diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc index c9612308a5..a6aedd38a6 100644 --- a/meta/recipes-kernel/systemtap/systemtap_git.inc +++ b/meta/recipes-kernel/systemtap/systemtap_git.inc @@ -11,6 +11,7 @@ SRC_URI = "git://sourceware.org/git/systemtap.git \ file://no-msgfmt-check.patch \ file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ file://0001-Install-python-modules-to-correct-library-dir.patch \ + file://0001-buildrun-remove-quotes-around-I-include-line.patch \ " # systemtap doesn't support mips From e6a1c94eef5fd6ce74806fe6bd64a05941add9cb Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Wed, 5 Apr 2017 14:48:57 +0200 Subject: [PATCH 096/129] e2fsprogs: Fix wrong error code after optimization fsck.ext will return an error code of 1 if a file systems was checked and successfully repaired. Even when an optimization was performed it will return this error code. This patch will change the error code to 0 if only optimizations had changed the file systems. The reason for this patch is a question I asked at the ext4 ML: http://www.spinics.net/lists/linux-ext4/msg55700.html Backport from git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git Based on commit bf9f3b6d5b10d19218b4ed904c12b22e36ec57dd (From OE-Core rev: 34ccb6b66162400c3a3164cbdcca02fc1b42c92b) Signed-off-by: Daniel Schultz Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...-exit-status-0-if-no-errors-were-fix.patch | 285 ++++++++++++++++++ .../e2fsprogs/e2fsprogs_1.43.bb | 1 + 2 files changed, 286 insertions(+) create mode 100644 meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch new file mode 100644 index 0000000000..44f3888b1c --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch @@ -0,0 +1,285 @@ +From b9bb77a0dd712f06b262a12766972b99cd801269 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Thu, 16 Feb 2017 22:02:35 -0500 +Subject: [PATCH] e2fsck: exit with exit status 0 if no errors were fixed + +Previously, e2fsck would exit with a status code of 1 even though the +only changes that it made to the file system were various +optimziations and not fixing file system corruption. Since the man +page states that an exit status of 1 means "file system errors +corrupted", fix e2fsck to return an exit status of 0. + +Upstream-Status: Backport + +Signed-off-by: Theodore Ts'o +Signed-off-by: Daniel Schultz + +Conflicts: + e2fsck/e2fsck.conf.5.in +--- + e2fsck/e2fsck.conf.5.in | 34 +++++++++++++++++++++++++++++ + e2fsck/journal.c | 1 + + e2fsck/problem.c | 8 ++++--- + e2fsck/problemP.h | 1 + + e2fsck/unix.c | 20 +++++++++++++---- + tests/f_collapse_extent_tree/expect.1 | 2 +- + tests/f_compress_extent_tree_level/expect.1 | 2 +- + tests/f_convert_bmap/expect.1 | 2 +- + tests/f_convert_bmap_and_extent/expect.1 | 2 +- + tests/f_extent_htree/expect.1 | 2 +- + tests/f_jnl_errno/expect.1 | 2 +- + tests/f_journal/expect.1 | 2 +- + tests/f_orphan/expect.1 | 2 +- + tests/f_orphan_extents_inode/expect.1 | 2 +- + tests/f_rehash_dir/expect.1 | 2 +- + tests/f_unsorted_EAs/expect.1 | 2 +- + 16 files changed, 68 insertions(+), 18 deletions(-) + +diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in +index 1f80a04..6a205ce 100644 +--- a/e2fsck/e2fsck.conf.5.in ++++ b/e2fsck/e2fsck.conf.5.in +@@ -326,6 +326,40 @@ defaults to true. + This relation controls whether or not the scratch file directory is used + instead of an in-memory data structure when tracking inode counts. It + defaults to true. ++.TP ++.I not_a_fix ++This boolean option, it set to true, marks the problem as ++one where if the user gives permission to make the requested change, ++it does not mean that the file system had a problem which has since ++been fixed. This is used for requests to optimize the file system's ++data structure, such as pruning an extent tree. ++@TDB_MAN_COMMENT@.SH THE [scratch_files] STANZA ++@TDB_MAN_COMMENT@The following relations are defined in the ++@TDB_MAN_COMMENT@.I [scratch_files] ++@TDB_MAN_COMMENT@stanza. ++@TDB_MAN_COMMENT@.TP ++@TDB_MAN_COMMENT@.I directory ++@TDB_MAN_COMMENT@If the directory named by this relation exists and is ++@TDB_MAN_COMMENT@writeable, then e2fsck will attempt to use this ++@TDB_MAN_COMMENT@directory to store scratch files instead of using ++@TDB_MAN_COMMENT@in-memory data structures. ++@TDB_MAN_COMMENT@.TP ++@TDB_MAN_COMMENT@.I numdirs_threshold ++@TDB_MAN_COMMENT@If this relation is set, then in-memory data structures ++@TDB_MAN_COMMENT@be used if the number of directories in the filesystem ++@TDB_MAN_COMMENT@are fewer than amount specified. ++@TDB_MAN_COMMENT@.TP ++@TDB_MAN_COMMENT@.I dirinfo ++@TDB_MAN_COMMENT@This relation controls whether or not the scratch file ++@TDB_MAN_COMMENT@directory is used instead of an in-memory data ++@TDB_MAN_COMMENT@structure for directory information. It defaults to ++@TDB_MAN_COMMENT@true. ++@TDB_MAN_COMMENT@.TP ++@TDB_MAN_COMMENT@.I icount ++@TDB_MAN_COMMENT@This relation controls whether or not the scratch file ++@TDB_MAN_COMMENT@directory is used instead of an in-memory data ++@TDB_MAN_COMMENT@structure when tracking inode counts. It defaults to ++@TDB_MAN_COMMENT@true. + .SH LOGGING + E2fsck has the facility to save the information from an e2fsck run in a + directory so that a system administrator can review its output at their +diff --git a/e2fsck/journal.c b/e2fsck/journal.c +index c8ac57d..b4cf329 100644 +--- a/e2fsck/journal.c ++++ b/e2fsck/journal.c +@@ -572,6 +572,7 @@ static void clear_v2_journal_fields(journal_t *journal) + if (!fix_problem(ctx, PR_0_CLEAR_V2_JOURNAL, &pctx)) + return; + ++ ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; + memset(((char *) journal->j_superblock) + V1_SB_SIZE, 0, + ctx->fs->blocksize-V1_SB_SIZE); + mark_buffer_dirty(journal->j_sb_buffer); +diff --git a/e2fsck/problem.c b/e2fsck/problem.c +index 1e645e4..2b01ffc 100644 +--- a/e2fsck/problem.c ++++ b/e2fsck/problem.c +@@ -1261,12 +1261,12 @@ static struct e2fsck_problem problem_table[] = { + /* Inode extent tree could be shorter */ + { PR_1E_CAN_COLLAPSE_EXTENT_TREE, + N_("@i %i @x tree (at level %b) could be shorter. "), +- PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, ++ PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, + + /* Inode extent tree could be narrower */ + { PR_1E_CAN_NARROW_EXTENT_TREE, + N_("@i %i @x tree (at level %b) could be narrower. "), +- PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK }, ++ PROMPT_FIX, PR_NO_OK | PR_PREEN_NO | PR_PREEN_OK | PR_NOT_A_FIX }, + + /* Pass 2 errors */ + +@@ -2146,6 +2146,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) + reconfigure_bool(ctx, ptr, key, PR_NO_NOMSG, "no_nomsg"); + reconfigure_bool(ctx, ptr, key, PR_PREEN_NOHDR, "preen_noheader"); + reconfigure_bool(ctx, ptr, key, PR_FORCE_NO, "force_no"); ++ reconfigure_bool(ctx, ptr, key, PR_NOT_A_FIX, "not_a_fix"); + profile_get_integer(ctx->profile, "options", + "max_count_problems", 0, 0, + &ptr->max_count); +@@ -2263,7 +2264,8 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx) + if (ptr->flags & PR_AFTER_CODE) + answer = fix_problem(ctx, ptr->second_code, pctx); + +- if (answer && (ptr->prompt != PROMPT_NONE)) ++ if (answer && (ptr->prompt != PROMPT_NONE) && ++ !(ptr->flags & PR_NOT_A_FIX)) + ctx->flags |= E2F_FLAG_PROBLEMS_FIXED; + + return answer; +diff --git a/e2fsck/problemP.h b/e2fsck/problemP.h +index 7944cd6..63bb8df 100644 +--- a/e2fsck/problemP.h ++++ b/e2fsck/problemP.h +@@ -44,3 +44,4 @@ struct latch_descr { + #define PR_CONFIG 0x080000 /* This problem has been customized + from the config file */ + #define PR_FORCE_NO 0x100000 /* Force the answer to be no */ ++#define PR_NOT_A_FIX 0x200000 /* Yes doesn't mean a problem was fixed */ +diff --git a/e2fsck/unix.c b/e2fsck/unix.c +index 004a6e5..d33d7fd 100644 +--- a/e2fsck/unix.c ++++ b/e2fsck/unix.c +@@ -1896,11 +1896,23 @@ no_journal: + fix_problem(ctx, PR_6_IO_FLUSH, &pctx); + + if (was_changed) { +- exit_value |= FSCK_NONDESTRUCT; +- if (!(ctx->options & E2F_OPT_PREEN)) +- log_out(ctx, _("\n%s: ***** FILE SYSTEM WAS " +- "MODIFIED *****\n"), ++ int fs_fixed = (ctx->flags & E2F_FLAG_PROBLEMS_FIXED); ++ ++ if (fs_fixed) ++ exit_value |= FSCK_NONDESTRUCT; ++ if (!(ctx->options & E2F_OPT_PREEN)) { ++#if 0 /* Do this later; it breaks too many tests' golden outputs */ ++ log_out(ctx, fs_fixed ? ++ _("\n%s: ***** FILE SYSTEM ERRORS " ++ "CORRECTED *****\n") : ++ _("%s: File system was modified.\n"), + ctx->device_name); ++#else ++ log_out(ctx, ++ _("\n%s: ***** FILE SYSTEM WAS MODIFIED *****\n"), ++ ctx->device_name); ++#endif ++ } + if (ctx->mount_flags & EXT2_MF_ISROOT) { + log_out(ctx, _("%s: ***** REBOOT SYSTEM *****\n"), + ctx->device_name); +diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1 +index e2eb65e..8165a58 100644 +--- a/tests/f_collapse_extent_tree/expect.1 ++++ b/tests/f_collapse_extent_tree/expect.1 +@@ -13,4 +13,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_compress_extent_tree_level/expect.1 b/tests/f_compress_extent_tree_level/expect.1 +index a359c99..dd33f63 100644 +--- a/tests/f_compress_extent_tree_level/expect.1 ++++ b/tests/f_compress_extent_tree_level/expect.1 +@@ -20,4 +20,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1 +index 7d2ca86..c387962 100644 +--- a/tests/f_convert_bmap/expect.1 ++++ b/tests/f_convert_bmap/expect.1 +@@ -23,4 +23,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_convert_bmap_and_extent/expect.1 b/tests/f_convert_bmap_and_extent/expect.1 +index 7af91aa..c86c571 100644 +--- a/tests/f_convert_bmap_and_extent/expect.1 ++++ b/tests/f_convert_bmap_and_extent/expect.1 +@@ -30,4 +30,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_extent_htree/expect.1 b/tests/f_extent_htree/expect.1 +index 223ca69..ea48405 100644 +--- a/tests/f_extent_htree/expect.1 ++++ b/tests/f_extent_htree/expect.1 +@@ -26,4 +26,4 @@ test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + 0 sockets + ------------ + 343 files +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_jnl_errno/expect.1 b/tests/f_jnl_errno/expect.1 +index c572951..4134234 100644 +--- a/tests/f_jnl_errno/expect.1 ++++ b/tests/f_jnl_errno/expect.1 +@@ -6,4 +6,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 11/2048 files (9.1% non-contiguous), 1330/8192 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_journal/expect.1 b/tests/f_journal/expect.1 +index a202c80..0a18654 100644 +--- a/tests/f_journal/expect.1 ++++ b/tests/f_journal/expect.1 +@@ -59,4 +59,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 53/2048 files (1.9% non-contiguous), 1409/8192 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_orphan/expect.1 b/tests/f_orphan/expect.1 +index eddc1f8..087ebee 100644 +--- a/tests/f_orphan/expect.1 ++++ b/tests/f_orphan/expect.1 +@@ -11,4 +11,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/2048 files (0.0% non-contiguous), 1303/8192 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_orphan_extents_inode/expect.1 b/tests/f_orphan_extents_inode/expect.1 +index 2eaab78..5d713b3 100644 +--- a/tests/f_orphan_extents_inode/expect.1 ++++ b/tests/f_orphan_extents_inode/expect.1 +@@ -7,4 +7,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/16 files (0.0% non-contiguous), 21/100 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_rehash_dir/expect.1 b/tests/f_rehash_dir/expect.1 +index 6076765..c1449ba 100644 +--- a/tests/f_rehash_dir/expect.1 ++++ b/tests/f_rehash_dir/expect.1 +@@ -7,4 +7,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 105/2048 files (2.9% non-contiguous), 336/512 blocks +-Exit status is 1 ++Exit status is 0 +diff --git a/tests/f_unsorted_EAs/expect.1 b/tests/f_unsorted_EAs/expect.1 +index 7d588d7..64b9045 100644 +--- a/tests/f_unsorted_EAs/expect.1 ++++ b/tests/f_unsorted_EAs/expect.1 +@@ -8,4 +8,4 @@ Pass 5: Checking group summary information + + test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** + test_filesys: 12/2048 files (0.0% non-contiguous), 1294/2048 blocks +-Exit status is 1 ++Exit status is 0 +-- +1.9.1 + diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb index 5e30ec90b0..dcfb564a4b 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb @@ -10,6 +10,7 @@ SRC_URI += "file://acinclude.m4 \ file://mkdir.patch \ file://Revert-mke2fs-enable-the-metadata_csum-and-64bit-fea.patch \ file://mkdir_p.patch \ + file://0001-e2fsck-exit-with-exit-status-0-if-no-errors-were-fix.patch \ " SRC_URI_append_class-native = " file://e2fsprogs-fix-missing-check-for-permission-denied.patch" From af43028b3ea3fae62f3381ea7753468cfc9d8955 Mon Sep 17 00:00:00 2001 From: Daniel Schultz Date: Mon, 3 Apr 2017 09:47:55 +0200 Subject: [PATCH 097/129] wic: partition: Run fsck on EXT file systems Mkfs may create EXT file systems which can only be optimized by fsck and not by itself, e.g. directory optimization (in Pass 3A). To prevent those optimizations during runtime, it will be performed after the creation of an EXT file system. (From OE-Core rev: b8af7c10637c14b2c226fb7063b736755ee46802) Signed-off-by: Daniel Schultz Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/lib/wic/partition.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 3b3bd2d78f..ec3aa6622c 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -239,6 +239,9 @@ def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir, (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir) exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + mkfs_cmd = "fsck.%s -pvfD %s || [ $? -le 3 ]" % (self.fstype, rootfs) + exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo) + def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo): """ From 63eab150b2dde8c91beb446e9a1a6399dc0984ac Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Fri, 7 Apr 2017 14:38:13 +1200 Subject: [PATCH 098/129] packagegroup-core-standalone-sdk-target: add libssp If you want to be able to use -fstack-protector then you need the runtime support - you can either write this yourself or use libssp supplied with GCC. If you're using GCC then it seems likely that you'd just be using libssp, so include in the SDK by default; however use RRECOMMENDS just in case it's been disabled or you aren't using GCC. (From OE-Core rev: 6c990655e35bb3a14d59555662ec5802c9980028) (From OE-Core rev: 69b5643ec66e1495c9d805736d8765a06f67416c) Signed-off-by: Paul Eggleton Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../packagegroups/packagegroup-core-standalone-sdk-target.bb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb index 274e11a8b0..43fc599c73 100644 --- a/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb +++ b/meta/recipes-core/packagegroups/packagegroup-core-standalone-sdk-target.bb @@ -12,3 +12,8 @@ RDEPENDS_${PN} = "\ libstdc++-dev \ ${LIBC_DEPENDENCIES} \ " + +RRECOMMENDS_${PN} = "\ + libssp \ + libssp-dev \ + " From 6131129c0ad6d2f679a7580c6ccbfd0989ea4f6a Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 10 May 2017 11:37:05 +0200 Subject: [PATCH 099/129] openssl-native: Compile with -fPIC Fixes | /usr/bin/ld: libcrypto.a(sha1-x86_64.o): relocation R_X86_64_PC32 against undefined symbol `OPENSSL_ia32cap_P' can not be used when making a shared object; recompile with -fPIC | /usr/bin/ld: final link failed: Bad value (From OE-Core rev: 9e6a0da06aa832fbce06326622744b2a5ab9c091) Signed-off-by: Khem Raj (cherry picked from commit 0a19e72081771fca8ed94fb2a2a8996fd3dce00c) Signed-off-by: Mirza Krak Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-connectivity/openssl/openssl_1.0.2j.bb | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/recipes-connectivity/openssl/openssl_1.0.2j.bb b/meta/recipes-connectivity/openssl/openssl_1.0.2j.bb index 9a7cdedd05..b6fb126349 100644 --- a/meta/recipes-connectivity/openssl/openssl_1.0.2j.bb +++ b/meta/recipes-connectivity/openssl/openssl_1.0.2j.bb @@ -5,6 +5,7 @@ require openssl.inc DEPENDS += "cryptodev-linux" CFLAG += "-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS" +CFLAG_append_class-native = " -fPIC" LIC_FILES_CHKSUM = "file://LICENSE;md5=27ffa5d74bb5a337056c14b2ef93fbf6" From c7e48934c9560a507c7899a77bf02941ef52aec7 Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Wed, 31 May 2017 01:37:57 -0700 Subject: [PATCH 100/129] binutils: fix CVE-2017-6969 in readelf CVE: CVE-2017-6969 [BZ 21156] -- https://sourceware.org/bugzilla/show_bug.cgi?id=21156 PR binutils/21156: Fix illegal memory accesses in readelf when ing a corrupt binary. PR binutils/21156: Fix another memory access error in readelf when parsing a corrupt binary. (From OE-Core rev: 565d4b9432c898e4483f392a91f4b4aaebb4b184) Signed-off-by: Yuanjie Huang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../binutils/binutils-2.27.inc | 2 + .../binutils/binutils/CVE-2017-6969.patch | 56 ++++++++ .../binutils/binutils/CVE-2017-6969_2.patch | 122 ++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index f98fef9e02..d32ce25dd5 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -41,6 +41,8 @@ SRC_URI = "\ file://0001-ppc-apuinfo-for-spe-parsed-incorrectly.patch \ file://CVE-2017-6965.patch \ file://CVE-2017-6966.patch \ + file://CVE-2017-6969.patch \ + file://CVE-2017-6969_2.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch new file mode 100644 index 0000000000..3d036c4cf6 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969.patch @@ -0,0 +1,56 @@ +From 489246368e2c49a795ad5ecbc8895cbc854292fa Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Fri, 17 Feb 2017 15:59:45 +0000 +Subject: Fix illegal memory accesses in readelf when parsing a corrupt binary. + + PR binutils/21156 + * readelf.c (find_section_in_set): Test for invalid section + indicies. + +CVE: CVE-2017-6969 +Upstream-Status: Backport [master] + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 6 ++++++ + binutils/readelf.c | 10 ++++++++-- + 2 files changed, 14 insertions(+), 2 deletions(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index a70bdb7a7b..dbf8eb079e 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,3 +1,9 @@ ++2017-02-17 Nick Clifton ++ ++ PR binutils/21156 ++ * readelf.c (find_section_in_set): Test for invalid section ++ indicies. ++ + 2016-08-03 Tristan Gingold + + * configure: Regenerate. +diff --git a/binutils/readelf.c b/binutils/readelf.c +index d31558c3b4..7f7365dbc5 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -674,8 +674,14 @@ find_section_in_set (const char * name, unsigned int * set) + if (set != NULL) + { + while ((i = *set++) > 0) +- if (streq (SECTION_NAME (section_headers + i), name)) +- return section_headers + i; ++ { ++ /* See PR 21156 for a reproducer. */ ++ if (i >= elf_header.e_shnum) ++ continue; /* FIXME: Should we issue an error message ? */ ++ ++ if (streq (SECTION_NAME (section_headers + i), name)) ++ return section_headers + i; ++ } + } + + return find_section (name); +-- +2.11.0 + diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch new file mode 100644 index 0000000000..491c7086ee --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-6969_2.patch @@ -0,0 +1,122 @@ +From 59fcd64fe65a89fb0acaf5463840310701189375 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 20 Feb 2017 14:40:39 +0000 +Subject: Fix another memory access error in readelf when parsing a corrupt + binary. + + PR binutils/21156 + * dwarf.c (cu_tu_indexes_read): Move into... + (load_cu_tu_indexes): ... here. Change the variable into + tri-state. Change the function into boolean, returning + false if the indicies could not be loaded. + (find_cu_tu_set): Return NULL if the indicies could not be + loaded. + +CVE: CVE-2017-6969 +Upstream-Status: Backport [master] + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 10 ++++++++++ + binutils/dwarf.c | 34 ++++++++++++++++++++-------------- + 2 files changed, 30 insertions(+), 14 deletions(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index dbf8eb079e..55d2f8ba40 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,3 +1,13 @@ ++2017-02-20 Nick Clifton ++ ++ PR binutils/21156 ++ * dwarf.c (cu_tu_indexes_read): Move into... ++ (load_cu_tu_indexes): ... here. Change the variable into ++ tri-state. Change the function into boolean, returning ++ false if the indicies could not be loaded. ++ (find_cu_tu_set): Return NULL if the indicies could not be ++ loaded. ++ + 2017-02-17 Nick Clifton + + PR binutils/21156 +diff --git a/binutils/dwarf.c b/binutils/dwarf.c +index 282e069958..a23267feb6 100644 +--- a/binutils/dwarf.c ++++ b/binutils/dwarf.c +@@ -76,7 +76,6 @@ int dwarf_check = 0; + as a zero-terminated list of section indexes comprising one set of debug + sections from a .dwo file. */ + +-static int cu_tu_indexes_read = 0; + static unsigned int *shndx_pool = NULL; + static unsigned int shndx_pool_size = 0; + static unsigned int shndx_pool_used = 0; +@@ -99,7 +98,7 @@ static int tu_count = 0; + static struct cu_tu_set *cu_sets = NULL; + static struct cu_tu_set *tu_sets = NULL; + +-static void load_cu_tu_indexes (void *file); ++static bfd_boolean load_cu_tu_indexes (void *); + + /* Values for do_debug_lines. */ + #define FLAG_DEBUG_LINES_RAW 1 +@@ -2713,7 +2712,7 @@ load_debug_info (void * file) + return num_debug_info_entries; + + /* If this is a DWARF package file, load the CU and TU indexes. */ +- load_cu_tu_indexes (file); ++ (void) load_cu_tu_indexes (file); + + if (load_debug_section (info, file) + && process_debug_info (&debug_displays [info].section, file, abbrev, 1, 0)) +@@ -7302,21 +7301,27 @@ process_cu_tu_index (struct dwarf_section *section, int do_display) + section sets that we can use to associate a .debug_info.dwo section + with its associated .debug_abbrev.dwo section in a .dwp file. */ + +-static void ++static bfd_boolean + load_cu_tu_indexes (void *file) + { ++ static int cu_tu_indexes_read = -1; /* Tri-state variable. */ ++ + /* If we have already loaded (or tried to load) the CU and TU indexes + then do not bother to repeat the task. */ +- if (cu_tu_indexes_read) +- return; +- +- if (load_debug_section (dwp_cu_index, file)) +- process_cu_tu_index (&debug_displays [dwp_cu_index].section, 0); +- +- if (load_debug_section (dwp_tu_index, file)) +- process_cu_tu_index (&debug_displays [dwp_tu_index].section, 0); ++ if (cu_tu_indexes_read == -1) ++ { ++ cu_tu_indexes_read = TRUE; ++ ++ if (load_debug_section (dwp_cu_index, file)) ++ if (! process_cu_tu_index (&debug_displays [dwp_cu_index].section, 0)) ++ cu_tu_indexes_read = FALSE; ++ ++ if (load_debug_section (dwp_tu_index, file)) ++ if (! process_cu_tu_index (&debug_displays [dwp_tu_index].section, 0)) ++ cu_tu_indexes_read = FALSE; ++ } + +- cu_tu_indexes_read = 1; ++ return (bfd_boolean) cu_tu_indexes_read; + } + + /* Find the set of sections that includes section SHNDX. */ +@@ -7326,7 +7331,8 @@ find_cu_tu_set (void *file, unsigned int shndx) + { + unsigned int i; + +- load_cu_tu_indexes (file); ++ if (! load_cu_tu_indexes (file)) ++ return NULL; + + /* Find SHNDX in the shndx pool. */ + for (i = 0; i < shndx_pool_used; i++) +-- +2.11.0 + From 5d6e240db6b0448e77248f7f110449bce9d97667 Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Wed, 31 May 2017 01:37:58 -0700 Subject: [PATCH 101/129] binutils: fix CVE-2017-7209 in readelf CVE: CVE-2017-7209 [BZ 21135] -- https://sourceware.org/bugzilla/show_bug.cgi?id=21135 PR binutils/21135: Fix invalid read of section contents whilst processing a corrupt binary. (From OE-Core rev: fd7a91e2a6db1fb806c57c137f72efcffbf1f26b) Signed-off-by: Yuanjie Huang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../binutils/binutils-2.27.inc | 1 + .../binutils/binutils/CVE-2017-7209.patch | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-7209.patch diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index d32ce25dd5..5dca05e898 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -43,6 +43,7 @@ SRC_URI = "\ file://CVE-2017-6966.patch \ file://CVE-2017-6969.patch \ file://CVE-2017-6969_2.patch \ + file://CVE-2017-7209.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-7209.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-7209.patch new file mode 100644 index 0000000000..336d72cfe0 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-7209.patch @@ -0,0 +1,63 @@ +From 6e5e9d96b5bd7dc3147db9917d6a7a20682915cc Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Mon, 13 Feb 2017 15:04:37 +0000 +Subject: Fix invalid read of section contents whilst processing a corrupt + binary. + + PR binutils/21135 + * readelf.c (dump_section_as_bytes): Handle the case where + uncompress_section_contents returns false. + +CVE: CVE-2017-7209 +Upstream-Status: Backport[master] + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 6 ++++++ + binutils/readelf.c | 16 ++++++++++++---- + 2 files changed, 18 insertions(+), 4 deletions(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index 55d2f8ba40..c4d8e60eca 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,3 +1,9 @@ ++2017-02-13 Nick Clifton ++ ++ PR binutils/21135 ++ * readelf.c (dump_section_as_bytes): Handle the case where ++ uncompress_section_contents returns false. ++ + 2017-02-20 Nick Clifton + + PR binutils/21156 +diff --git a/binutils/readelf.c b/binutils/readelf.c +index 7f7365dbc5..bc4e92fa81 100644 +--- a/binutils/readelf.c ++++ b/binutils/readelf.c +@@ -12473,10 +12473,18 @@ dump_section_as_bytes (Elf_Internal_Shdr * section, + new_size -= 12; + } + +- if (uncompressed_size +- && uncompress_section_contents (& start, uncompressed_size, +- & new_size)) +- section_size = new_size; ++ if (uncompressed_size) ++ { ++ if (uncompress_section_contents (& start, uncompressed_size, ++ & new_size)) ++ section_size = new_size; ++ else ++ { ++ error (_("Unable to decompress section %s\n"), ++ printable_section_name (section)); ++ return; ++ } ++ } + } + + if (relocate) +-- +2.11.0 + From 1188ce3e3fb6f70d9d5536e4d0e4a6ced651d8f0 Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Wed, 31 May 2017 01:37:59 -0700 Subject: [PATCH 102/129] binutils: fix CVE-2017-7210 CVE: CVE-2017-7210 [BZ 21157] -- https://sourceware.org/bugzilla/show_bug.cgi?id=21157 PR binutils/21157: Fix handling of corrupt STABS enum type strings. (From OE-Core rev: 066a7acc4c19a4ef3428d0a7c695a2b08f45bc14) Signed-off-by: Yuanjie Huang Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../binutils/binutils-2.27.inc | 1 + .../binutils/binutils/CVE-2017-7210.patch | 71 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-7210.patch diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index 5dca05e898..0936d974d4 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -44,6 +44,7 @@ SRC_URI = "\ file://CVE-2017-6969.patch \ file://CVE-2017-6969_2.patch \ file://CVE-2017-7209.patch \ + file://CVE-2017-7210.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-7210.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-7210.patch new file mode 100644 index 0000000000..211d2bfd80 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-7210.patch @@ -0,0 +1,71 @@ +From 80958b04c91edcd41c42807225a7ad1b2a4ce0e6 Mon Sep 17 00:00:00 2001 +From: Nick Clifton +Date: Tue, 14 Feb 2017 14:07:29 +0000 +Subject: Fix handling of corrupt STABS enum type strings. + + PR binutils/21157 + * stabs.c (parse_stab_enum_type): Check for corrupt NAME:VALUE + pairs. + (parse_number): Exit early if passed an empty string. + +CVE: CVE-2017-7210 +Upstream-Status: Backport [master] + +Signed-off-by: Yuanjie Huang +--- + binutils/ChangeLog | 7 +++++++ + binutils/stabs.c | 14 +++++++++++++- + 2 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/binutils/ChangeLog b/binutils/ChangeLog +index c4d8e60eca..2bae9ec587 100644 +--- a/binutils/ChangeLog ++++ b/binutils/ChangeLog +@@ -1,3 +1,10 @@ ++2017-02-14 Nick Clifton ++ ++ PR binutils/21157 ++ * stabs.c (parse_stab_enum_type): Check for corrupt NAME:VALUE ++ pairs. ++ (parse_number): Exit early if passed an empty string. ++ + 2017-02-13 Nick Clifton + + PR binutils/21135 +diff --git a/binutils/stabs.c b/binutils/stabs.c +index aebde7afe9..c425afe98e 100644 +--- a/binutils/stabs.c ++++ b/binutils/stabs.c +@@ -232,6 +232,10 @@ parse_number (const char **pp, bfd_boolean *poverflow) + + orig = *pp; + ++ /* Stop early if we are passed an empty string. */ ++ if (*orig == 0) ++ return (bfd_vma) 0; ++ + errno = 0; + ul = strtoul (*pp, (char **) pp, 0); + if (ul + 1 != 0 || errno == 0) +@@ -1975,9 +1979,17 @@ parse_stab_enum_type (void *dhandle, const char **pp) + bfd_signed_vma val; + + p = *pp; +- while (*p != ':') ++ while (*p != ':' && *p != 0) + ++p; + ++ if (*p == 0) ++ { ++ bad_stab (orig); ++ free (names); ++ free (values); ++ return DEBUG_TYPE_NULL; ++ } ++ + name = savestring (*pp, p - *pp); + + *pp = p + 1; +-- +2.11.0 + From 5f7d84821f7c53ce2250861c5e08da9eac928993 Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Wed, 7 Jun 2017 14:46:21 -0400 Subject: [PATCH 103/129] gcc-6.2: backport fix of check for empty string in ubsan.c Building gcc-cross-initial with GCC7 on the host fails due to the comparison of a pointer to an integer in ubsan_use_new_style_p, which is forbidden by ISO C++: ubsan.c:1474:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] || xloc.file == '\0' || xloc.file[0] == '\xff' Backport the fix from upstream GCC to enable the build with GCC 7 (From OE-Core rev: 7a7fcbab0365b9501c737dbc02715be14dda72a3) (From OE-Core rev: ad685600d52b2e8b6f4cdbf46baa9f14b51565dd) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie Signed-off-by: Cody P Schafer Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-devtools/gcc/gcc-6.2.inc | 5 ++-- .../ubsan-fix-check-empty-string.patch | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-devtools/gcc/gcc-6.2/ubsan-fix-check-empty-string.patch diff --git a/meta/recipes-devtools/gcc/gcc-6.2.inc b/meta/recipes-devtools/gcc/gcc-6.2.inc index b118995e1d..39ae653805 100644 --- a/meta/recipes-devtools/gcc/gcc-6.2.inc +++ b/meta/recipes-devtools/gcc/gcc-6.2.inc @@ -80,8 +80,9 @@ SRC_URI = "\ file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \ ${BACKPORTS} \ " -BACKPORTS = "" - +BACKPORTS = "\ + file://ubsan-fix-check-empty-string.patch \ +" SRC_URI[md5sum] = "9768625159663b300ae4de2f4745fcc4" SRC_URI[sha256sum] = "9944589fc722d3e66308c0ce5257788ebd7872982a718aa2516123940671b7c5" diff --git a/meta/recipes-devtools/gcc/gcc-6.2/ubsan-fix-check-empty-string.patch b/meta/recipes-devtools/gcc/gcc-6.2/ubsan-fix-check-empty-string.patch new file mode 100644 index 0000000000..c0127198e0 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-6.2/ubsan-fix-check-empty-string.patch @@ -0,0 +1,28 @@ +From 8db2cf6353c13f2a84cbe49b689654897906c499 Mon Sep 17 00:00:00 2001 +From: kyukhin +Date: Sat, 3 Sep 2016 10:57:05 +0000 +Subject: [PATCH] gcc/ * ubsan.c (ubsan_use_new_style_p): Fix check for empty + string. + +git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239971 138bc75d-0d04-0410-961f-82ee72b054a4 + +Upstream-Status: Backport +Signed-off-by: Joshua Lock + +--- + gcc/ubsan.c | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +Index: gcc-6.3.0/gcc/ubsan.c +=================================================================== +--- gcc-6.3.0.orig/gcc/ubsan.c ++++ gcc-6.3.0/gcc/ubsan.c +@@ -1471,7 +1471,7 @@ ubsan_use_new_style_p (location_t loc) + + expanded_location xloc = expand_location (loc); + if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0 +- || xloc.file == '\0' || xloc.file[0] == '\xff' ++ || xloc.file[0] == '\0' || xloc.file[0] == '\xff' + || xloc.file[1] == '\xff') + return false; + From 72084f751303405416938c776f6c1bf5b8842536 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Wed, 7 Jun 2017 16:36:44 -0400 Subject: [PATCH 104/129] elfutils: fix building elfutils-native with GCC7 This is heavily based on the oe-core master commit with the same subject, but includes a backport of upstream's fix for the fallthrough warnings rebased to 0.166 (the oe-core patch which targeted 0.168 did not apply), a rebase of the format-truncation patch, and a backport of the upstream format-length patch. Info from OE-Core master patch follows: From OE-Core rev: aaf4c4f3d09ac3897205417eb15e19d54e0c0d05 From: Joshua Lock Backport a fix from upstream for a -Wformat-truncation=2 warning and implement a simple fix for a -Wimplicit-fallthrough warning. Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie (From OE-Core rev: 3b91be97ae8c36cd6bad86fed992efc9800f4c9e) Signed-off-by: Cody P Schafer Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...-Wimplicit-fallthrough-support-fixes.patch | 318 ++++++++++++++++++ ...01-ar-Fix-GCC7-Wformat-length-issues.patch | 125 +++++++ .../elfutils-0.166/Fix_one_GCC7_warning.patch | 45 +++ .../elfutils/elfutils-0.166/fallthrough.patch | 36 ++ .../elfutils/elfutils_0.166.bb | 5 + 5 files changed, 529 insertions(+) create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.166/0001-Add-GCC7-Wimplicit-fallthrough-support-fixes.patch create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.166/0001-ar-Fix-GCC7-Wformat-length-issues.patch create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.166/Fix_one_GCC7_warning.patch create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.166/fallthrough.patch diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Add-GCC7-Wimplicit-fallthrough-support-fixes.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Add-GCC7-Wimplicit-fallthrough-support-fixes.patch new file mode 100644 index 0000000000..a240323f33 --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-Add-GCC7-Wimplicit-fallthrough-support-fixes.patch @@ -0,0 +1,318 @@ +From 09949994e76eea3c1230a5c88ffa8fdf588b120f Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Wed, 2 Nov 2016 13:29:26 +0100 +Subject: [PATCH] Add GCC7 -Wimplicit-fallthrough support/fixes. + +GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one +small buglet in elflint option procession. So it seems useful to enable +to make sure all swatch case fallthroughs are deliberate. + +Add configure check to detect whether gcc support -Wimplicit-fallthrough +and enable it. Add fixes and explicit fallthrough comments where necessary. + +Signed-off-by: Mark Wielaard + +Upstream-Status: Backport +Upstream-Commit: a3cc8182b2ae05290b0eafa74b70746d7befc0e4 +--- + backends/alpha_retval.c | 4 +--- + backends/i386_regs.c | 1 + + backends/i386_retval.c | 3 +-- + backends/linux-core-note.c | 4 ++-- + backends/ppc_regs.c | 2 +- + backends/x86_64_regs.c | 1 + + config/eu.am | 8 +++++++- + configure.ac | 10 ++++++++++ + libcpu/i386_disasm.c | 2 +- + libdw/cfi.c | 2 ++ + libdw/encoded-value.h | 1 + + libdwfl/dwfl_report_elf.c | 2 +- + src/addr2line.c | 1 + + src/elfcompress.c | 3 ++- + src/elflint.c | 4 +++- + src/objdump.c | 4 +++- + tests/backtrace-data.c | 1 + + tests/backtrace.c | 2 +- + 18 files changed, 40 insertions(+), 15 deletions(-) + +diff --git a/backends/alpha_retval.c b/backends/alpha_retval.c +index 53dbfa45..7232b462 100644 +--- a/backends/alpha_retval.c ++++ b/backends/alpha_retval.c +@@ -130,9 +130,7 @@ alpha_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) + return nloc_intreg; + } + } +- +- /* Else fall through. */ +- ++ /* Fallthrough */ + case DW_TAG_structure_type: + case DW_TAG_class_type: + case DW_TAG_union_type: +diff --git a/backends/i386_regs.c b/backends/i386_regs.c +index fb8ded33..fd963a62 100644 +--- a/backends/i386_regs.c ++++ b/backends/i386_regs.c +@@ -92,6 +92,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)), + case 5: + case 8: + *type = DW_ATE_address; ++ /* Fallthrough */ + case 0 ... 3: + case 6 ... 7: + name[0] = 'e'; +diff --git a/backends/i386_retval.c b/backends/i386_retval.c +index 9da797d5..4aa646fe 100644 +--- a/backends/i386_retval.c ++++ b/backends/i386_retval.c +@@ -122,9 +122,8 @@ i386_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) + return nloc_intreg; + if (size <= 8) + return nloc_intregpair; +- +- /* Else fall through. */ + } ++ /* Fallthrough */ + + case DW_TAG_structure_type: + case DW_TAG_class_type: +diff --git a/backends/linux-core-note.c b/backends/linux-core-note.c +index ff2b226f..321721f3 100644 +--- a/backends/linux-core-note.c ++++ b/backends/linux-core-note.c +@@ -219,8 +219,8 @@ EBLHOOK(core_note) (const GElf_Nhdr *nhdr, const char *name, + case sizeof "CORE": + if (memcmp (name, "CORE", nhdr->n_namesz) == 0) + break; +- /* Buggy old Linux kernels didn't terminate "LINUX". +- Fall through. */ ++ /* Buggy old Linux kernels didn't terminate "LINUX". */ ++ /* Fall through. */ + + case sizeof "LINUX": + if (memcmp (name, "LINUX", nhdr->n_namesz) == 0) +diff --git a/backends/ppc_regs.c b/backends/ppc_regs.c +index 4b92a9aa..bcf4f7a3 100644 +--- a/backends/ppc_regs.c ++++ b/backends/ppc_regs.c +@@ -140,7 +140,7 @@ ppc_register_info (Ebl *ebl __attribute__ ((unused)), + case 100: + if (*bits == 32) + return stpcpy (name, "mq") + 1 - name; +- ++ /* Fallthrough */ + case 102 ... 107: + name[0] = 's'; + name[1] = 'p'; +diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c +index 2172d9f1..84304407 100644 +--- a/backends/x86_64_regs.c ++++ b/backends/x86_64_regs.c +@@ -87,6 +87,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)), + + case 6 ... 7: + *type = DW_ATE_address; ++ /* Fallthrough */ + case 0 ... 5: + name[0] = 'r'; + name[1] = baseregs[regno][0]; +diff --git a/config/eu.am b/config/eu.am +index 4998771d..8fe1e259 100644 +--- a/config/eu.am ++++ b/config/eu.am +@@ -61,10 +61,16 @@ else + NULL_DEREFERENCE_WARNING= + endif + ++if HAVE_IMPLICIT_FALLTHROUGH_WARNING ++IMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough ++else ++IMPLICIT_FALLTHROUGH_WARNING= ++endif ++ + AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ + -Wold-style-definition -Wstrict-prototypes \ + $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ +- $(NULL_DEREFERENCE_WARNING) \ ++ $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ + $(if $($(*F)_no_Werror),,-Werror) \ + $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ + $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ +diff --git a/configure.ac b/configure.ac +index 86a69c66..35850c64 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -336,6 +336,16 @@ CFLAGS="$old_CFLAGS"]) + AM_CONDITIONAL(HAVE_NULL_DEREFERENCE_WARNING, + [test "x$ac_cv_null_dereference" != "xno"]) + ++# -Wimplicit-fallthrough was added by GCC7 ++AC_CACHE_CHECK([whether gcc accepts -Wimplicit-fallthrough], ac_cv_implicit_fallthrough, [dnl ++old_CFLAGS="$CFLAGS" ++CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" ++AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], ++ ac_cv_implicit_fallthrough=yes, ac_cv_implicit_fallthrough=no) ++CFLAGS="$old_CFLAGS"]) ++AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING, ++ [test "x$ac_cv_implicit_fallthrough" != "xno"]) ++ + dnl Check if we have argp available from our libc + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( +diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c +index 832241f2..1a584635 100644 +--- a/libcpu/i386_disasm.c ++++ b/libcpu/i386_disasm.c +@@ -819,7 +819,7 @@ i386_disasm (const uint8_t **startp, const uint8_t *end, GElf_Addr addr, + ++param_start; + break; + } +- ++ /* Fallthrough */ + default: + assert (! "INVALID not handled"); + } +diff --git a/libdw/cfi.c b/libdw/cfi.c +index 1fd668d7..daa845f3 100644 +--- a/libdw/cfi.c ++++ b/libdw/cfi.c +@@ -138,6 +138,7 @@ execute_cfi (Dwarf_CFI *cache, + + case DW_CFA_advance_loc1: + operand = *program++; ++ /* Fallthrough */ + case DW_CFA_advance_loc + 0 ... DW_CFA_advance_loc + CFI_PRIMARY_MAX: + advance_loc: + loc += operand * cie->code_alignment_factor; +@@ -300,6 +301,7 @@ execute_cfi (Dwarf_CFI *cache, + + case DW_CFA_restore_extended: + get_uleb128 (operand, program, end); ++ /* Fallthrough */ + case DW_CFA_restore + 0 ... DW_CFA_restore + CFI_PRIMARY_MAX: + + if (unlikely (abi_cfi) && likely (opcode == DW_CFA_restore)) +diff --git a/libdw/encoded-value.h b/libdw/encoded-value.h +index 48d868fb..f0df4cec 100644 +--- a/libdw/encoded-value.h ++++ b/libdw/encoded-value.h +@@ -64,6 +64,7 @@ encoded_value_size (const Elf_Data *data, const unsigned char e_ident[], + if (*end++ & 0x80u) + return end - p; + } ++ return 0; + + default: + return 0; +diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c +index 1c6e401d..73a5511a 100644 +--- a/libdwfl/dwfl_report_elf.c ++++ b/libdwfl/dwfl_report_elf.c +@@ -170,7 +170,7 @@ __libdwfl_elf_address_range (Elf *elf, GElf_Addr base, bool add_p_vaddr, + /* An assigned base address is meaningless for these. */ + base = 0; + add_p_vaddr = true; +- ++ /* Fallthrough. */ + case ET_DYN: + default:; + size_t phnum; +diff --git a/src/addr2line.c b/src/addr2line.c +index 0ce854f6..bea24aea 100644 +--- a/src/addr2line.c ++++ b/src/addr2line.c +@@ -632,6 +632,7 @@ handle_address (const char *string, Dwfl *dwfl) + case 1: + addr = 0; + j = i; ++ /* Fallthrough */ + case 2: + if (string[j] != '\0') + break; +diff --git a/src/elfcompress.c b/src/elfcompress.c +index d0ca469c..57afa116 100644 +--- a/src/elfcompress.c ++++ b/src/elfcompress.c +@@ -153,7 +153,8 @@ parse_opt (int key, char *arg __attribute__ ((unused)), + argp_error (state, + N_("Only one input file allowed together with '-o'")); + /* We only use this for checking the number of arguments, we don't +- actually want to consume them, so fallthrough. */ ++ actually want to consume them. */ ++ /* Fallthrough */ + default: + return ARGP_ERR_UNKNOWN; + } +diff --git a/src/elflint.c b/src/elflint.c +index 15b12f6f..2c45fcb8 100644 +--- a/src/elflint.c ++++ b/src/elflint.c +@@ -210,6 +210,7 @@ parse_opt (int key, char *arg __attribute__ ((unused)), + + case 'd': + is_debuginfo = true; ++ break; + + case ARGP_gnuld: + gnuld = true; +@@ -3963,6 +3964,7 @@ section [%2zu] '%s': merge flag set but entry size is zero\n"), + case SHT_NOBITS: + if (is_debuginfo) + break; ++ /* Fallthrough */ + default: + ERROR (gettext ("\ + section [%2zu] '%s' has unexpected type %d for an executable section\n"), +@@ -4305,7 +4307,7 @@ section [%2d] '%s': unknown core file note type %" PRIu32 + if (nhdr.n_namesz == sizeof "Linux" + && !memcmp (data->d_buf + name_offset, "Linux", sizeof "Linux")) + break; +- ++ /* Fallthrough */ + default: + if (shndx == 0) + ERROR (gettext ("\ +diff --git a/src/objdump.c b/src/objdump.c +index 0aa41e89..94e9e021 100644 +--- a/src/objdump.c ++++ b/src/objdump.c +@@ -234,7 +234,9 @@ parse_opt (int key, char *arg, + program_invocation_short_name); + exit (EXIT_FAILURE); + } +- ++ /* We only use this for checking the number of arguments, we don't ++ actually want to consume them. */ ++ /* Fallthrough */ + default: + return ARGP_ERR_UNKNOWN; + } +diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c +index bc5ceba0..b7158dae 100644 +--- a/tests/backtrace-data.c ++++ b/tests/backtrace-data.c +@@ -250,6 +250,7 @@ thread_callback (Dwfl_Thread *thread, void *thread_arg __attribute__ ((unused))) + break; + case -1: + error (1, 0, "dwfl_thread_getframes: %s", dwfl_errmsg (-1)); ++ break; + default: + abort (); + } +diff --git a/tests/backtrace.c b/tests/backtrace.c +index 12476430..bf5995b4 100644 +--- a/tests/backtrace.c ++++ b/tests/backtrace.c +@@ -123,7 +123,7 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc, + assert (symname2 == NULL || strcmp (symname2, "jmp") != 0); + break; + } +- /* PASSTHRU */ ++ /* FALLTHRU */ + case 4: + assert (symname != NULL && strcmp (symname, "stdarg") == 0); + break; +-- +2.13.0 + diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/0001-ar-Fix-GCC7-Wformat-length-issues.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-ar-Fix-GCC7-Wformat-length-issues.patch new file mode 100644 index 0000000000..3465476784 --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.166/0001-ar-Fix-GCC7-Wformat-length-issues.patch @@ -0,0 +1,125 @@ +From f090883ca61f0bf0f979c5b26d4e1a69e805156e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 10 Nov 2016 18:45:02 +0100 +Subject: [PATCH] ar: Fix GCC7 -Wformat-length issues. + +GCC7 adds warnings for snprintf formatting into too small buffers. +Fix the two issues pointed out by the new warning. The ar header +fields are fixed length containing left-justified strings without +zero terminator. snprintf always adds a '\0' char at the end (which +we then don't copy into the ar header field) and numbers are decimal +strings of fixed 10 chars (-Wformat-length thinks formatting +them as size_t might overflow the buffer on 64bit arches). + +Signed-off-by: Mark Wielaard + +Upstream-Status: Backport +Upstream-Commit: d5afff85e22b38949f3e7936231c67de16e180e8 +--- + src/ar.c | 15 +++++++++++---- + src/arlib.c | 16 ++++++++++------ + 2 files changed, 21 insertions(+), 10 deletions(-) + +diff --git a/src/ar.c b/src/ar.c +index 1320d07b..f2160d35 100644 +--- a/src/ar.c ++++ b/src/ar.c +@@ -1,5 +1,5 @@ + /* Create, modify, and extract from archives. +- Copyright (C) 2005-2012 Red Hat, Inc. ++ Copyright (C) 2005-2012, 2016 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 2005. + +@@ -853,7 +853,10 @@ write_member (struct armem *memb, off_t *startp, off_t *lenp, Elf *elf, + off_t end_off, int newfd) + { + struct ar_hdr arhdr; +- char tmpbuf[sizeof (arhdr.ar_name) + 1]; ++ /* The ar_name is not actually zero teminated, but we need that for ++ snprintf. Also if the name is too long, then the string starts ++ with '/' plus an index off number (decimal). */ ++ char tmpbuf[sizeof (arhdr.ar_name) + 2]; + + bool changed_header = memb->long_name_off != -1; + if (changed_header) +@@ -1455,7 +1458,11 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, + + /* Create the header. */ + struct ar_hdr arhdr; +- char tmpbuf[sizeof (arhdr.ar_name) + 1]; ++ /* The ar_name is not actually zero teminated, but we ++ need that for snprintf. Also if the name is too ++ long, then the string starts with '/' plus an index ++ off number (decimal). */ ++ char tmpbuf[sizeof (arhdr.ar_name) + 2]; + if (all->long_name_off == -1) + { + size_t namelen = strlen (all->name); +@@ -1465,7 +1472,7 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, + } + else + { +- snprintf (tmpbuf, sizeof (arhdr.ar_name) + 1, "/%-*ld", ++ snprintf (tmpbuf, sizeof (tmpbuf), "/%-*ld", + (int) sizeof (arhdr.ar_name), all->long_name_off); + memcpy (arhdr.ar_name, tmpbuf, sizeof (arhdr.ar_name)); + } +diff --git a/src/arlib.c b/src/arlib.c +index 43a9145b..0c2e4cde 100644 +--- a/src/arlib.c ++++ b/src/arlib.c +@@ -1,5 +1,5 @@ + /* Functions to handle creation of Linux archives. +- Copyright (C) 2007-2012 Red Hat, Inc. ++ Copyright (C) 2007-2012, 2016 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 2007. + +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -107,6 +108,9 @@ arlib_init (void) + void + arlib_finalize (void) + { ++ /* Note that the size is stored as decimal string in 10 chars, ++ without zero terminator (we add + 1 here only so snprintf can ++ put it at the end, we then don't use it when we memcpy it). */ + char tmpbuf[sizeof (((struct ar_hdr *) NULL)->ar_size) + 1]; + + symtab.longnameslen = obstack_object_size (&symtab.longnamesob); +@@ -121,9 +125,9 @@ arlib_finalize (void) + + symtab.longnames = obstack_finish (&symtab.longnamesob); + +- int s = snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", ++ int s = snprintf (tmpbuf, sizeof (tmpbuf), "%-*" PRIu32 "", + (int) sizeof (((struct ar_hdr *) NULL)->ar_size), +- symtab.longnameslen - sizeof (struct ar_hdr)); ++ (uint32_t) (symtab.longnameslen - sizeof (struct ar_hdr))); + memcpy (&((struct ar_hdr *) symtab.longnames)->ar_size, tmpbuf, s); + } + +@@ -169,10 +173,10 @@ arlib_finalize (void) + + /* See comment for ar_date above. */ + memcpy (&((struct ar_hdr *) symtab.symsoff)->ar_size, tmpbuf, +- snprintf (tmpbuf, sizeof (tmpbuf), "%-*zu", ++ snprintf (tmpbuf, sizeof (tmpbuf), "%-*" PRIu32 "", + (int) sizeof (((struct ar_hdr *) NULL)->ar_size), +- symtab.symsofflen + symtab.symsnamelen +- - sizeof (struct ar_hdr))); ++ (uint32_t) (symtab.symsofflen + symtab.symsnamelen ++ - sizeof (struct ar_hdr)))); + } + + +-- +2.13.0 + diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/Fix_one_GCC7_warning.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/Fix_one_GCC7_warning.patch new file mode 100644 index 0000000000..25f5e14821 --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.166/Fix_one_GCC7_warning.patch @@ -0,0 +1,45 @@ +From 8e2ab18b874d1fda06243ad00209d44e2992928a Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 12 Feb 2017 21:51:34 +0100 +Subject: [PATCH 1/2] libasm: Fix one GCC7 -Wformat-truncation=2 warning. + +Make sure that if we have really lots of labels the tempsym doesn't get +truncated because it is too small to hold the whole name. + +This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed +out by enabling this warning because there are currently some issues +with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448 + +Signed-off-by: Mark Wielaard + +Upstream-Status: Backport (https://sourceware.org/git/?p=elfutils.git;a=commit;h=93c51144c3f664d4e9709da75a1d0fa00ea0fe95) +Signed-off-by: Joshua Lock +--- + libasm/asm_newsym.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libasm/asm_newsym.c b/libasm/asm_newsym.c +index 7f522910..76482bb2 100644 +--- a/libasm/asm_newsym.c ++++ b/libasm/asm_newsym.c +@@ -1,5 +1,5 @@ + /* Define new symbol for current position in given section. +- Copyright (C) 2002, 2005 Red Hat, Inc. ++ Copyright (C) 2002, 2005, 2017 Red Hat, Inc. + This file is part of elfutils. + Written by Ulrich Drepper , 2002. + +@@ -44,7 +44,9 @@ AsmSym_t * + asm_newsym (AsmScn_t *asmscn, const char *name, GElf_Xword size, + int type, int binding) + { +-#define TEMPSYMLEN 10 ++/* We don't really expect labels with many digits, but in theory it could ++ be 10 digits (plus ".L" and a zero terminator). */ ++#define TEMPSYMLEN 13 + char tempsym[TEMPSYMLEN]; + AsmSym_t *result; + +-- +2.13.0 + diff --git a/meta/recipes-devtools/elfutils/elfutils-0.166/fallthrough.patch b/meta/recipes-devtools/elfutils/elfutils-0.166/fallthrough.patch new file mode 100644 index 0000000000..b2623f9d2e --- /dev/null +++ b/meta/recipes-devtools/elfutils/elfutils-0.166/fallthrough.patch @@ -0,0 +1,36 @@ +GCC7 adds -Wimplicit-fallthrough to warn when a switch case falls through, +however this causes warnings (which are promoted to errors) with the elfutils +patches from Debian for mips and parisc, which use fallthrough's by design. + +Explicitly mark the intentional fallthrough switch cases with a comment to +disable the warnings where the fallthrough behaviour is desired. + +Upstream-Status: Pending [debian] +Signed-off-by: Joshua Lock + +Index: elfutils-0.168/backends/parisc_retval.c +=================================================================== +--- elfutils-0.168.orig/backends/parisc_retval.c ++++ elfutils-0.168/backends/parisc_retval.c +@@ -166,7 +166,7 @@ parisc_return_value_location_ (Dwarf_Die + return nloc_intregpair; + + /* Else fall through. */ +- } ++ } // fallthrough + + case DW_TAG_structure_type: + case DW_TAG_class_type: +Index: elfutils-0.168/backends/mips_retval.c +=================================================================== +--- elfutils-0.168.orig/backends/mips_retval.c ++++ elfutils-0.168/backends/mips_retval.c +@@ -387,7 +387,7 @@ mips_return_value_location (Dwarf_Die *f + else + return nloc_intregpair; + } +- } ++ } // fallthrough + + /* Fallthrough to handle large types */ + diff --git a/meta/recipes-devtools/elfutils/elfutils_0.166.bb b/meta/recipes-devtools/elfutils/elfutils_0.166.bb index 5d934281b3..3593c1c1d3 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.166.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.166.bb @@ -18,7 +18,10 @@ SRC_URI += "\ file://0001-remove-the-unneed-checking.patch \ file://0001-fix-a-stack-usage-warning.patch \ file://aarch64_uio.patch \ + file://Fix_one_GCC7_warning.patch \ + file://0001-Add-GCC7-Wimplicit-fallthrough-support-fixes.patch \ file://shadow.patch \ + file://0001-ar-Fix-GCC7-Wformat-length-issues.patch \ " # pick the patch from debian @@ -37,6 +40,8 @@ SRC_URI += "\ file://uclibc-support.patch \ file://elfcmp-fix-self-comparision.patch \ " +# Fix the patches from Debian with GCC7 +SRC_URI += "file://fallthrough.patch" SRC_URI_append_libc-musl = " file://0001-build-Provide-alternatives-for-glibc-assumptions-hel.patch " # The buildsystem wants to generate 2 .h files from source using a binary it just built, From f85376290f768a69f6764428da7d9795009fee95 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Fri, 16 Jun 2017 12:44:12 +0200 Subject: [PATCH 105/129] eudev: set LGPL-2.1+ for libudev package (From OE-Core rev: 56210d562347eafd1433b3fbab64dd023ece421f) Signed-off-by: Martin Jansa Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-core/udev/eudev_3.2.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/udev/eudev_3.2.bb b/meta/recipes-core/udev/eudev_3.2.bb index 211252cebc..857d20db78 100644 --- a/meta/recipes-core/udev/eudev_3.2.bb +++ b/meta/recipes-core/udev/eudev_3.2.bb @@ -1,6 +1,7 @@ SUMMARY = "eudev is a fork of systemd's udev" HOMEPAGE = "https://wiki.gentoo.org/wiki/Eudev" -LICENSE = "GPLv2.0+" +LICENSE = "GPLv2.0+ & LGPL-2.1+" +LICENSE_libudev = "LGPL-2.1+" LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe" DEPENDS = "glib-2.0 glib-2.0-native gperf-native kmod libxslt-native util-linux" From 2c638f46ba3dd426c53fe2acc10197409db2c3bc Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Fri, 10 Feb 2017 16:04:38 +0200 Subject: [PATCH 106/129] libxslt: Add build fix (with ld-is-gold) Libraries must be linked with "-lm", otherwise gold fails to link binaries with those libraries. (From OE-Core rev: 9175164380b50852a21a05d4e81294394c5486f4) (From OE-Core rev: 3bd47a7db76cead77d0aa2b3b29f8513469dbe60) Signed-off-by: Jussi Kukkonen Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../0001-Link-libraries-with-libm.patch | 48 +++++++++++++++++++ .../recipes-support/libxslt/libxslt_1.1.29.bb | 1 + 2 files changed, 49 insertions(+) create mode 100644 meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch diff --git a/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch b/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch new file mode 100644 index 0000000000..16ffeba106 --- /dev/null +++ b/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch @@ -0,0 +1,48 @@ +From 487e2f7e35dad3deec7978ce4478a3d4ea5070e7 Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen +Date: Fri, 10 Feb 2017 14:26:59 +0200 +Subject: [PATCH] Link libraries with libm + +Otherwise linking the resulting libraries to a binary (e.g. xsltproc) +fails when using gold linker: +| ../libxslt/.libs/libxslt.so: error: undefined reference to 'fmod' +| ../libxslt/.libs/libxslt.so: error: undefined reference to 'pow' +| ../libexslt/.libs/libexslt.so: error: undefined reference to 'floor' +| collect2: error: ld returned 1 exit status + +Upstream-Status: Submitted [mailing list, Feb 10 2017] +Signed-off-by: Jussi Kukkonen +--- + libexslt/Makefile.am | 2 +- + libxslt/Makefile.am | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am +index 1cf5138..5449524 100644 +--- a/libexslt/Makefile.am ++++ b/libexslt/Makefile.am +@@ -27,7 +27,7 @@ libexslt_la_SOURCES = \ + libexslt.h \ + dynamic.c + +-libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS) ++libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS) $(M_LIBS) + libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO) + + man_MANS = libexslt.3 +diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am +index d9fed68..9d44c3d 100644 +--- a/libxslt/Makefile.am ++++ b/libxslt/Makefile.am +@@ -62,7 +62,7 @@ else + LIBXSLT_VERSION_SCRIPT = + endif + +-libxslt_la_LIBADD = $(LIBXML_LIBS) $(EXTRA_LIBS) ++libxslt_la_LIBADD = $(LIBXML_LIBS) $(M_LIBS) $(EXTRA_LIBS) + libxslt_la_LDFLAGS = \ + $(WIN32_EXTRA_LDFLAGS) \ + $(LIBXSLT_VERSION_SCRIPT) \ +-- +2.1.4 + diff --git a/meta/recipes-support/libxslt/libxslt_1.1.29.bb b/meta/recipes-support/libxslt/libxslt_1.1.29.bb index be747e608d..2946a745e9 100644 --- a/meta/recipes-support/libxslt/libxslt_1.1.29.bb +++ b/meta/recipes-support/libxslt/libxslt_1.1.29.bb @@ -11,6 +11,7 @@ DEPENDS = "libxml2" SRC_URI = "ftp://xmlsoft.org/libxslt/libxslt-${PV}.tar.gz \ file://pkgconfig_fix.patch \ file://0001-Use-pkg-config-to-find-gcrypt-and-libxml2.patch \ + file://0001-Link-libraries-with-libm.patch \ " SRC_URI[md5sum] = "a129d3c44c022de3b9dcf6d6f288d72e" From bd631d76b8e14a2a1ecb5d5c2cf78ddbc085f63d Mon Sep 17 00:00:00 2001 From: Fan Xin Date: Fri, 26 May 2017 11:39:06 +0900 Subject: [PATCH 107/129] libxslt: Fix CVE-2017-5029 Backport upstream patch to fix CVE-2017-5029. (From OE-Core rev: 5266e74c990df1cf965d162d9695eb5a698883ae) (From OE-Core rev: 172f76a1a43921d92a385d6d123dffaf27eb368f) (From OE-Core rev: 25b87ebfce7216b18e85b6bc5fc7f20bcf4cf31d) Signed-off-by: Fan Xin Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...nteger-overflow-in-xsltAddTextString.patch | 80 +++++++++++++++++++ .../recipes-support/libxslt/libxslt_1.1.29.bb | 1 + 2 files changed, 81 insertions(+) create mode 100644 meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch diff --git a/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch b/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch new file mode 100644 index 0000000000..57aaacc587 --- /dev/null +++ b/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch @@ -0,0 +1,80 @@ +From 08ab2774b870de1c7b5a48693df75e8154addae5 Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Thu, 12 Jan 2017 15:39:52 +0100 +Subject: [PATCH] Check for integer overflow in xsltAddTextString + +Limit buffer size in xsltAddTextString to INT_MAX. The issue can be +exploited to trigger an out of bounds write on 64-bit systems. + +Originally reported to Chromium: + +https://crbug.com/676623 + +CVE: CVE-2017-5029 +Upstream-Status: Backport + +Signed-off-by: Fan Xin + +--- + libxslt/transform.c | 25 ++++++++++++++++++++++--- + libxslt/xsltInternals.h | 4 ++-- + 2 files changed, 24 insertions(+), 5 deletions(-) + +diff --git a/libxslt/transform.c b/libxslt/transform.c +index 519133f..02bff34 100644 +--- a/libxslt/transform.c ++++ b/libxslt/transform.c +@@ -813,13 +813,32 @@ xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, + return(target); + + if (ctxt->lasttext == target->content) { ++ int minSize; + +- if (ctxt->lasttuse + len >= ctxt->lasttsize) { ++ /* Check for integer overflow accounting for NUL terminator. */ ++ if (len >= INT_MAX - ctxt->lasttuse) { ++ xsltTransformError(ctxt, NULL, target, ++ "xsltCopyText: text allocation failed\n"); ++ return(NULL); ++ } ++ minSize = ctxt->lasttuse + len + 1; ++ ++ if (ctxt->lasttsize < minSize) { + xmlChar *newbuf; + int size; ++ int extra; ++ ++ /* Double buffer size but increase by at least 100 bytes. */ ++ extra = minSize < 100 ? 100 : minSize; ++ ++ /* Check for integer overflow. */ ++ if (extra > INT_MAX - ctxt->lasttsize) { ++ size = INT_MAX; ++ } ++ else { ++ size = ctxt->lasttsize + extra; ++ } + +- size = ctxt->lasttsize + len + 100; +- size *= 2; + newbuf = (xmlChar *) xmlRealloc(target->content,size); + if (newbuf == NULL) { + xsltTransformError(ctxt, NULL, target, +diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h +index 060b178..5ad1771 100644 +--- a/libxslt/xsltInternals.h ++++ b/libxslt/xsltInternals.h +@@ -1754,8 +1754,8 @@ struct _xsltTransformContext { + * Speed optimization when coalescing text nodes + */ + const xmlChar *lasttext; /* last text node content */ +- unsigned int lasttsize; /* last text node size */ +- unsigned int lasttuse; /* last text node use */ ++ int lasttsize; /* last text node size */ ++ int lasttuse; /* last text node use */ + /* + * Per Context Debugging + */ +-- +1.9.1 + diff --git a/meta/recipes-support/libxslt/libxslt_1.1.29.bb b/meta/recipes-support/libxslt/libxslt_1.1.29.bb index 2946a745e9..d27c706602 100644 --- a/meta/recipes-support/libxslt/libxslt_1.1.29.bb +++ b/meta/recipes-support/libxslt/libxslt_1.1.29.bb @@ -12,6 +12,7 @@ SRC_URI = "ftp://xmlsoft.org/libxslt/libxslt-${PV}.tar.gz \ file://pkgconfig_fix.patch \ file://0001-Use-pkg-config-to-find-gcrypt-and-libxml2.patch \ file://0001-Link-libraries-with-libm.patch \ + file://0001-Check-for-integer-overflow-in-xsltAddTextString.patch \ " SRC_URI[md5sum] = "a129d3c44c022de3b9dcf6d6f288d72e" From a5dfa90ea81e9d1868524ae9a4bfea752691568d Mon Sep 17 00:00:00 2001 From: Zhixiong Chi Date: Thu, 20 Apr 2017 15:04:54 +0800 Subject: [PATCH 108/129] bash: CVE-2016-0634 A vulnerability was found in a way bash expands the $HOSTNAME. Injecting the hostname with malicious code would cause it to run each time bash expanded \h in the prompt string. Porting patch from to solve CVE-2016-0634 CVE: CVE-2016-0634 (From OE-Core rev: 7dd6aa1a4bf6e9fc8a1998cda6ac5397bb5cd5cb) (From OE-Core rev: a4b37b05140b549960baef49237ce3316e84a041) (From OE-Core rev: a75c9657f785be3b2d14b10a7044105329c88e8a) Signed-off-by: Zhixiong Chi Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-extended/bash/bash_4.3.30.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/recipes-extended/bash/bash_4.3.30.bb b/meta/recipes-extended/bash/bash_4.3.30.bb index e398e87b60..b40059fa1d 100644 --- a/meta/recipes-extended/bash/bash_4.3.30.bb +++ b/meta/recipes-extended/bash/bash_4.3.30.bb @@ -21,6 +21,7 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ ${GNU_MIRROR}/bash/bash-4.3-patches/bash43-044;apply=yes;striplevel=0;name=patch044 \ ${GNU_MIRROR}/bash/bash-4.3-patches/bash43-045;apply=yes;striplevel=0;name=patch045 \ ${GNU_MIRROR}/bash/bash-4.3-patches/bash43-046;apply=yes;striplevel=0;name=patch046 \ + ${GNU_MIRROR}/bash/bash-4.3-patches/bash43-047;apply=yes;striplevel=0;name=patch047 \ file://execute_cmd.patch;striplevel=0 \ file://mkbuiltins_have_stringize.patch \ file://build-tests.patch \ @@ -68,5 +69,7 @@ SRC_URI[patch045.md5sum] = "4473244ca5abfd4b018ea26dc73e7412" SRC_URI[patch045.sha256sum] = "ba6ec3978e9eaa1eb3fabdaf3cc6fdf8c4606ac1c599faaeb4e2d69864150023" SRC_URI[patch046.md5sum] = "7e5fb09991c077076b86e0e057798913" SRC_URI[patch046.sha256sum] = "b3b456a6b690cd293353f17e22d92a202b3c8bce587ae5f2667c20c9ab6f688f" +SRC_URI[patch047.md5sum] = "8483153bad1a6f52cadc3bd9a8df7835" +SRC_URI[patch047.sha256sum] = "c69248de7e78ba6b92f118fe1ef47bc86479d5040fe0b1f908ace1c9e3c67c4a" BBCLASSEXTEND = "nativesdk" From c35d3a6c5e6aec3ab9aa25a1bdbdbf7cd220aa96 Mon Sep 17 00:00:00 2001 From: "Maxin B. John" Date: Tue, 9 May 2017 19:19:21 +0300 Subject: [PATCH 109/129] DEBIAN_MIRROR: switch from ftp to http All public-facing debian.org FTP services will be shut down on November 1, 2017 The mirrors should just be accessed using HTTP instead. https://www.debian.org/News/2017/20170425 Fixes [YOCTO #11413] (From OE-Core rev: c2cdc4d9155d7a3b9cba60fa9cbb448cf64c62bd) (From OE-Core rev: 04790a0d9ddc072a19701ba449a3aefe51dc3997) Signed-off-by: Maxin B. John Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/mirrors.bbclass | 34 +++++++++++++++++----------------- meta/conf/bitbake.conf | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/meta/classes/mirrors.bbclass b/meta/classes/mirrors.bbclass index 11847085ba..8a639b2864 100644 --- a/meta/classes/mirrors.bbclass +++ b/meta/classes/mirrors.bbclass @@ -2,23 +2,23 @@ MIRRORS += "\ ${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20120328T092752Z/debian/pool \n \ ${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20110127T084257Z/debian/pool \n \ ${DEBIAN_MIRROR} http://snapshot.debian.org/archive/debian-archive/20090802T004153Z/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.de.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.au.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.cl.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.hr.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.fi.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.hk.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.hu.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.ie.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.it.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.jp.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.no.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.pl.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.ro.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.si.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.es.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.se.debian.org/debian/pool \n \ -${DEBIAN_MIRROR} ftp://ftp.tr.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.de.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.au.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.cl.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.hr.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.fi.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.hk.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.hu.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.ie.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.it.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.jp.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.no.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.pl.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.ro.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.si.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.es.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.se.debian.org/debian/pool \n \ +${DEBIAN_MIRROR} http://ftp.tr.debian.org/debian/pool \n \ ${GNU_MIRROR} ftp://mirrors.kernel.org/gnu \n \ ${KERNELORG_MIRROR} http://www.kernel.org/pub \n \ ${GNUPG_MIRROR} ftp://ftp.gnupg.org/gcrypt \n \ diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 0f27e92e96..6e767b1bc1 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -585,7 +585,7 @@ BBLAYERS_FETCH_DIR ??= "${COREBASE}" ################################################################## APACHE_MIRROR = "http://archive.apache.org/dist" -DEBIAN_MIRROR = "ftp://ftp.debian.org/debian/pool" +DEBIAN_MIRROR = "http://ftp.debian.org/debian/pool" GENTOO_MIRROR = "http://distfiles.gentoo.org/distfiles" GNOME_GIT = "git://git.gnome.org" GNOME_MIRROR = "http://ftp.gnome.org/pub/GNOME/sources" @@ -619,7 +619,7 @@ SRC_URI[vardepsexclude] += "\ " # You can use the mirror of your country to get faster downloads by putting -# export DEBIAN_MIRROR = "ftp://ftp.de.debian.org/debian/pool" +# export DEBIAN_MIRROR = "http://ftp.de.debian.org/debian/pool" # into your local.conf FETCHCMD_svn = "/usr/bin/env svn --non-interactive --trust-server-cert" From da6dd6f9fbe70ade2535e03c87db5e65bbbdb4ca Mon Sep 17 00:00:00 2001 From: "Maxin B. John" Date: Tue, 9 May 2017 19:19:22 +0300 Subject: [PATCH 110/129] GNU_MIRROR: switch from ftp to https Based on the same reason behind DEBIAN's switch from ftp: https://www.debian.org/News/2017/20170425 (From OE-Core rev: ba119d836c0f4b20a39c92fa2e64abb0d5a55ad4) (From OE-Core rev: 16a43d53533dcc9bb6fca141b2a66cff648df0d2) Signed-off-by: Maxin B. John Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/mirrors.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/mirrors.bbclass b/meta/classes/mirrors.bbclass index 8a639b2864..2cdc71b6e3 100644 --- a/meta/classes/mirrors.bbclass +++ b/meta/classes/mirrors.bbclass @@ -19,7 +19,7 @@ ${DEBIAN_MIRROR} http://ftp.si.debian.org/debian/pool \n \ ${DEBIAN_MIRROR} http://ftp.es.debian.org/debian/pool \n \ ${DEBIAN_MIRROR} http://ftp.se.debian.org/debian/pool \n \ ${DEBIAN_MIRROR} http://ftp.tr.debian.org/debian/pool \n \ -${GNU_MIRROR} ftp://mirrors.kernel.org/gnu \n \ +${GNU_MIRROR} https://mirrors.kernel.org/gnu \n \ ${KERNELORG_MIRROR} http://www.kernel.org/pub \n \ ${GNUPG_MIRROR} ftp://ftp.gnupg.org/gcrypt \n \ ${GNUPG_MIRROR} ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt \n \ From 4f064564fd595b3a0cbc09832ce74235faa96345 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 7 Jun 2017 11:39:59 -0400 Subject: [PATCH 111/129] automake: Backport perl 5.22 fix Backport 13f00eb4493c "automake: port to Perl 5.22 and later" from automake upstream to fix build with perl 5.22 . (From OE-Core rev: 7fa044e799db651d45e4732e2527acfc2bc7cd47) (From OE-Core rev: 139d15f4af282eeef0a7f368eef518f400a4471a) Signed-off-by: Marek Vasut Cc: Ross Burton Cc: Richard Purdie Signed-off-by: Ross Burton Signed-off-by: Cody P Schafer Signed-off-by: Richard Purdie --- ...automake-port-to-Perl-5.22-and-later.patch | 32 +++++++++++++++++++ .../automake/automake_1.15.bb | 4 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/automake/automake/0001-automake-port-to-Perl-5.22-and-later.patch diff --git a/meta/recipes-devtools/automake/automake/0001-automake-port-to-Perl-5.22-and-later.patch b/meta/recipes-devtools/automake/automake/0001-automake-port-to-Perl-5.22-and-later.patch new file mode 100644 index 0000000000..0e6895fb4b --- /dev/null +++ b/meta/recipes-devtools/automake/automake/0001-automake-port-to-Perl-5.22-and-later.patch @@ -0,0 +1,32 @@ +From 13f00eb4493c217269b76614759e452d8302955e Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Thu, 31 Mar 2016 16:35:29 -0700 +Subject: [PATCH] automake: port to Perl 5.22 and later + +Without this change, Perl 5.22 complains "Unescaped left brace in +regex is deprecated" and this is planned to become a hard error in +Perl 5.26. See: +http://search.cpan.org/dist/perl-5.22.0/pod/perldelta.pod#A_literal_%22{%22_should_now_be_escaped_in_a_pattern +* bin/automake.in (substitute_ac_subst_variables): Escape left brace. + +Upstream-Status: Backport [13f00eb4493c217269b76614759e452d8302955e] +--- + bin/automake.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/bin/automake.in b/bin/automake.in +index a3a0aa318..2c8f31e14 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -3878,7 +3878,7 @@ sub substitute_ac_subst_variables_worker + sub substitute_ac_subst_variables + { + my ($text) = @_; +- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; ++ $text =~ s/\$[{]([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge; + return $text; + } + +-- +2.11.0 + diff --git a/meta/recipes-devtools/automake/automake_1.15.bb b/meta/recipes-devtools/automake/automake_1.15.bb index a3c72fd334..61ae3ba3e3 100644 --- a/meta/recipes-devtools/automake/automake_1.15.bb +++ b/meta/recipes-devtools/automake/automake_1.15.bb @@ -21,7 +21,9 @@ RDEPENDS_${PN}_class-native = "autoconf-native hostperl-runtime-native" SRC_URI += " file://python-libdir.patch \ file://buildtest.patch \ file://performance.patch \ - file://new_rt_path_for_test-driver.patch" + file://new_rt_path_for_test-driver.patch \ + file://0001-automake-port-to-Perl-5.22-and-later.patch \ + " SRC_URI[md5sum] = "716946a105ca228ab545fc37a70df3a3" SRC_URI[sha256sum] = "7946e945a96e28152ba5a6beb0625ca715c6e32ac55f2e353ef54def0c8ed924" From fa4a5024fcad307d061dea7933fbf531abf5e17d Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Sat, 17 Jun 2017 10:20:51 -0700 Subject: [PATCH 112/129] glibc: Security fix CVE-2016-6323 arm: mark __startcontext as .cantunwind, GNU CVE: CVE-2016-6323 (From OE-Core rev: e80d454711f67a9a3a2a43bb7d9ff911c4664a84) Signed-off-by: Andrej Valek Signed-off-by: Pascal Bach Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../glibc/glibc/CVE-2016-6323.patch | 39 +++++++++++++++++++ meta/recipes-core/glibc/glibc_2.24.bb | 1 + 2 files changed, 40 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/CVE-2016-6323.patch diff --git a/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch b/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch new file mode 100644 index 0000000000..f9b9fa50d9 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/CVE-2016-6323.patch @@ -0,0 +1,39 @@ +glibc-2.24: Fix CVE-2016-6323 + +[No upstream tracking] -- https://sourceware.org/bugzilla/show_bug.cgi?id=20435 + +arm: mark __startcontext as .cantunwind, GNU + +Glibc bug where the makecontext function would create +an execution context which is incompatible with the unwinder, +causing it to hang when the generation of a backtrace is attempted. + +Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e2ff6c9cc54c0b4402b8d49e4abe7000fde7617] +CVE: CVE-2016-6323 +Signed-off-by: Andrej Valek +Signed-off-by: Pascal Bach + +diff --git a/sysdeps/unix/sysv/linux/arm/setcontext.S b/sysdeps/unix/sysv/linux/arm/setcontext.S +index 603e508..d1f168f 100644 +--- a/sysdeps/unix/sysv/linux/arm/setcontext.S ++++ b/sysdeps/unix/sysv/linux/arm/setcontext.S +@@ -86,12 +86,19 @@ weak_alias(__setcontext, setcontext) + + /* Called when a makecontext() context returns. Start the + context in R4 or fall through to exit(). */ ++ /* Unwind descriptors are looked up based on PC - 2, so we have to ++ make sure to mark the instruction preceding the __startcontext ++ label as .cantunwind. */ ++ .fnstart ++ .cantunwind ++ nop + ENTRY(__startcontext) + movs r0, r4 + bne PLTJMP(__setcontext) + + @ New context was 0 - exit + b PLTJMP(HIDDEN_JUMPTARGET(exit)) ++ .fnend + END(__startcontext) + + #ifdef PIC diff --git a/meta/recipes-core/glibc/glibc_2.24.bb b/meta/recipes-core/glibc/glibc_2.24.bb index b60b692723..08ae45947f 100644 --- a/meta/recipes-core/glibc/glibc_2.24.bb +++ b/meta/recipes-core/glibc/glibc_2.24.bb @@ -38,6 +38,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0025-Define-DUMMY_LOCALE_T-if-not-defined.patch \ file://0026-build_local_scope.patch \ file://0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch \ + file://CVE-2016-6323.patch \ " SRC_URI += "\ From b8987f1a232da2bc4676b41029363ac9466a9429 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Sat, 17 Jun 2017 14:17:10 -0700 Subject: [PATCH 113/129] sgml-common: update SRC_URI from fedora to OSL WARNING: sgml-common-native-0.6.3-r1 do_fetch: Failed to fetch URL ftp://sources.redhat.com/pub/docbook-tools/new-trials/SOURCES/sgml-common-0.6.3.tgz, attempting MIRRORS if available (From OE-Core rev: cdb32a75b935985e5e86184d97b5a05c8f3ff21a) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-devtools/sgml-common/sgml-common_0.6.3.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/sgml-common/sgml-common_0.6.3.bb b/meta/recipes-devtools/sgml-common/sgml-common_0.6.3.bb index 6098673a35..64a6b92c61 100644 --- a/meta/recipes-devtools/sgml-common/sgml-common_0.6.3.bb +++ b/meta/recipes-devtools/sgml-common/sgml-common_0.6.3.bb @@ -15,7 +15,7 @@ SECTION = "base" PR = "r1" -SRC_URI = "ftp://sources.redhat.com/pub/docbook-tools/new-trials/SOURCES/sgml-common-${PV}.tgz \ +SRC_URI = "https://ftp.osuosl.org/pub/blfs/conglomeration/sgml-common/sgml-common-${PV}.tgz \ file://autohell.patch \ file://license.patch" From a746a4c171e39e2d7b1c96269910bd48a273deb3 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Sat, 17 Jun 2017 14:20:26 -0700 Subject: [PATCH 114/129] docbook-utils: update SRC_URI from fedora to osl WARNING: docbook-utils-native-0.6.14-r3 do_fetch: Failed to fetch URL ftp://sources.redhat.com/pub/docbook-tools/new-trials/SOURCES/docbook-utils-0.6.14.tar.gz, attempting MIRRORS if available (From OE-Core rev: ef47f682034f591c90572c082a753787aa1a8b9c) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../docbook-utils/docbook-utils-native_0.6.14.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/docbook-utils/docbook-utils-native_0.6.14.bb b/meta/recipes-devtools/docbook-utils/docbook-utils-native_0.6.14.bb index c3a5f3b421..44b43a810f 100644 --- a/meta/recipes-devtools/docbook-utils/docbook-utils-native_0.6.14.bb +++ b/meta/recipes-devtools/docbook-utils/docbook-utils-native_0.6.14.bb @@ -10,7 +10,7 @@ DEPENDS = "openjade-native sgmlspl-native docbook-dsssl-stylesheets-native docbo PR = "r3" SRC_URI = "\ - ftp://sources.redhat.com/pub/docbook-tools/new-trials/SOURCES/docbook-utils-${PV}.tar.gz \ + http://ftp.osuosl.org/pub/blfs/conglomeration/docbook-utils/docbook-utils-${PV}.tar.gz \ file://re.patch \ " From 5b2a7393f98081946e30e311e7277d253f6ddd9a Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Mon, 17 Jul 2017 10:25:28 +0300 Subject: [PATCH 115/129] wic: fix calculation of partition number Total number of partitions should be taken into account when calculating real partition number for msdos partition table. The number can be different for the 4th partition: it can be 4 if there are 4 partitions in the table and 5 if there are more than 4 partitions in the table. In the latter case number 4 is occupied by extended partition. [YOCTO #11790] (From OE-Core rev: a1d18c00b8c9ce800a5147eaa71372083b8ae91e) Signed-off-by: Ed Bartosh Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- scripts/lib/wic/imager/direct.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index edf5e5d221..4c547e04a6 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -108,7 +108,7 @@ def __get_part_num(self, num, parts): if pnum == num: if part.no_table: return 0 - if self.ptable_format == 'msdos' and realnum > 3: + if self.ptable_format == 'msdos' and realnum > 3 and len(parts) > 4: # account for logical partition numbering, ex. sda5.. return realnum + 1 return realnum From e6955b7d0de1900bfc3c8e83a5a00b2604f10916 Mon Sep 17 00:00:00 2001 From: Catalin Enache Date: Fri, 7 Jul 2017 19:43:34 +0300 Subject: [PATCH 116/129] glibc: fix pthread_cond_broadcast issue (arm) pthread_mutex functions such as pthread_cond_wait(), pthread_mutex_unlock() return errors after PTHREAD_PRIO_INHERIT is enabled Reference: https://sourceware.org/bugzilla/show_bug.cgi?id=18463 Upstream patches: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f0e3925bf3b8df6940c3346db17e42615979d458 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=13cb8f76da9d9420330796f469dbf10643ba5b12 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=23b5cae1af04f2d912910fdaf73cb482265798c1 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=ed19993b5b0d05d62cc883571519a67dae481a14 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2e4cf778972573221e9b87fd992844ea9b67b9bf https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=abff18c0c6055ca5d1cd46923fd1205c057139a5 This issue is Morty specific (glibc 2.24). The issue is no longer present in glibc 2.25 (master branch). (From OE-Core rev: 6dc1f1c3cc871d00ecd59d5aeeef86b7e6965750) Signed-off-by: Catalin Enache Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../0001-Add-atomic_exchange_relaxed.patch | 58 + ...tions-required-by-the-new-condition-.patch | 124 + ...tty-printers-for-the-NPTL-lock-types.patch | 3197 ++++++++ ...ementation-that-provides-stronger-or.patch | 7171 +++++++++++++++++ .../0005-Remove-__ASSUME_REQUEUE_PI.patch | 149 + .../0006-Fix-atomic_fetch_xor_release.patch | 81 + meta/recipes-core/glibc/glibc_2.24.bb | 6 + 7 files changed, 10786 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch create mode 100644 meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch create mode 100644 meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch create mode 100644 meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch create mode 100644 meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch create mode 100644 meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch diff --git a/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch b/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch new file mode 100644 index 0000000000..a33a135f78 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0001-Add-atomic_exchange_relaxed.patch @@ -0,0 +1,58 @@ +From ce74a620bf9e1a40b7ba06d35160e20633a4d8bb Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 7 Jul 2017 13:11:16 +0300 +Subject: [PATCH 1/6] Add atomic_exchange_relaxed. + +* include/atomic.h (atomic_exchange_relaxed): New + +Upstream-Status: Backport + +Author: Torvald Riegel +Signed-off-by: Catalin Enache +--- + ChangeLog | 4 ++++ + include/atomic.h | 9 +++++++++ + 2 files changed, 13 insertions(+) + +diff --git a/ChangeLog b/ChangeLog +index 0fbda90..cb87279 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,7 @@ ++2016-08-05 Torvald Riegel ++ ++ * include/atomic.h (atomic_exchange_relaxed): New. ++ + 2016-01-28 Carlos O'Donell + Alexey Makhalov + Florian Weimer +diff --git a/include/atomic.h b/include/atomic.h +index ad3db25..129ee24 100644 +--- a/include/atomic.h ++++ b/include/atomic.h +@@ -588,6 +588,9 @@ void __atomic_link_error (void); + __atomic_compare_exchange_n ((mem), (expected), (desired), 1, \ + __ATOMIC_RELEASE, __ATOMIC_RELAXED); }) + ++# define atomic_exchange_relaxed(mem, desired) \ ++ ({ __atomic_check_size((mem)); \ ++ __atomic_exchange_n ((mem), (desired), __ATOMIC_RELAXED); }) + # define atomic_exchange_acquire(mem, desired) \ + ({ __atomic_check_size((mem)); \ + __atomic_exchange_n ((mem), (desired), __ATOMIC_ACQUIRE); }) +@@ -684,6 +687,12 @@ void __atomic_link_error (void); + *(expected) == __atg103_expected; }) + # endif + ++/* XXX Fall back to acquire MO because archs do not define a weaker ++ atomic_exchange. */ ++# ifndef atomic_exchange_relaxed ++# define atomic_exchange_relaxed(mem, val) \ ++ atomic_exchange_acq ((mem), (val)) ++# endif + # ifndef atomic_exchange_acquire + # define atomic_exchange_acquire(mem, val) \ + atomic_exchange_acq ((mem), (val)) +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch b/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch new file mode 100644 index 0000000000..c4747fa27a --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0002-Add-atomic-operations-required-by-the-new-condition-.patch @@ -0,0 +1,124 @@ +From b85e30e655027132c4326d2fdde010c517165aaf Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 30 Jun 2017 14:27:34 +0300 +Subject: [PATCH 2/6] Add atomic operations required by the new condition + variable. + + * include/atomic.h (atomic_fetch_and_relaxed, + atomic_fetch_and_release, atomic_fetch_or_release, + atomic_fetch_xor_release): New. + +Upstream-Status: Backport + +Author: Torvald Riegel +Signed-off-by: Catalin Enache +--- + ChangeLog | 6 ++++++ + include/atomic.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 53 insertions(+) + +diff --git a/ChangeLog b/ChangeLog +index cb87279..96b6da2 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++2016-08-09 Torvald Riegel ++ ++ * include/atomic.h (atomic_fetch_and_relaxed, ++ atomic_fetch_and_release, atomic_fetch_or_release, ++ atomic_fetch_xor_release): New. ++ + 2016-08-05 Torvald Riegel + + * include/atomic.h (atomic_exchange_relaxed): New. +diff --git a/include/atomic.h b/include/atomic.h +index 129ee24..5a8e7e7 100644 +--- a/include/atomic.h ++++ b/include/atomic.h +@@ -611,9 +611,15 @@ void __atomic_link_error (void); + ({ __atomic_check_size((mem)); \ + __atomic_fetch_add ((mem), (operand), __ATOMIC_ACQ_REL); }) + ++# define atomic_fetch_and_relaxed(mem, operand) \ ++ ({ __atomic_check_size((mem)); \ ++ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELAXED); }) + # define atomic_fetch_and_acquire(mem, operand) \ + ({ __atomic_check_size((mem)); \ + __atomic_fetch_and ((mem), (operand), __ATOMIC_ACQUIRE); }) ++# define atomic_fetch_and_release(mem, operand) \ ++ ({ __atomic_check_size((mem)); \ ++ __atomic_fetch_and ((mem), (operand), __ATOMIC_RELEASE); }) + + # define atomic_fetch_or_relaxed(mem, operand) \ + ({ __atomic_check_size((mem)); \ +@@ -621,6 +627,13 @@ void __atomic_link_error (void); + # define atomic_fetch_or_acquire(mem, operand) \ + ({ __atomic_check_size((mem)); \ + __atomic_fetch_or ((mem), (operand), __ATOMIC_ACQUIRE); }) ++# define atomic_fetch_or_release(mem, operand) \ ++ ({ __atomic_check_size((mem)); \ ++ __atomic_fetch_or ((mem), (operand), __ATOMIC_RELEASE); }) ++ ++# define atomic_fetch_xor_release(mem, operand) \ ++ ({ __atomic_check_size((mem)); \ ++ __atomic_fetch_xor ((mem), (operand), __ATOMIC_RELEASE); }) + + #else /* !USE_ATOMIC_COMPILER_BUILTINS */ + +@@ -724,12 +737,24 @@ void __atomic_link_error (void); + atomic_exchange_and_add_acq ((mem), (operand)); }) + # endif + ++/* XXX Fall back to acquire MO because archs do not define a weaker ++ atomic_and_val. */ ++# ifndef atomic_fetch_and_relaxed ++# define atomic_fetch_and_relaxed(mem, operand) \ ++ atomic_fetch_and_acquire ((mem), (operand)) ++# endif + /* XXX The default for atomic_and_val has acquire semantics, but this is not + documented. */ + # ifndef atomic_fetch_and_acquire + # define atomic_fetch_and_acquire(mem, operand) \ + atomic_and_val ((mem), (operand)) + # endif ++# ifndef atomic_fetch_and_release ++/* XXX This unnecessarily has acquire MO. */ ++# define atomic_fetch_and_release(mem, operand) \ ++ ({ atomic_thread_fence_release (); \ ++ atomic_and_val ((mem), (operand)); }) ++# endif + + /* XXX The default for atomic_or_val has acquire semantics, but this is not + documented. */ +@@ -743,6 +768,28 @@ void __atomic_link_error (void); + # define atomic_fetch_or_relaxed(mem, operand) \ + atomic_fetch_or_acquire ((mem), (operand)) + # endif ++/* XXX Contains an unnecessary acquire MO because archs do not define a weaker ++ atomic_or_val. */ ++# ifndef atomic_fetch_or_release ++# define atomic_fetch_or_release(mem, operand) \ ++ ({ atomic_thread_fence_release (); \ ++ atomic_fetch_or_acquire ((mem), (operand)); }) ++# endif ++ ++# ifndef atomic_fetch_xor_release ++# define atomic_fetch_xor_release(mem, operand) \ ++ ({ __typeof (*(mem)) __atg104_old; \ ++ __typeof (mem) __atg104_memp = (mem); \ ++ __typeof (*(mem)) __atg104_op = (operand); \ ++ \ ++ do \ ++ __atg104_old = (*__atg104_memp); \ ++ while (__builtin_expect \ ++ (atomic_compare_and_exchange_bool_rel ( \ ++ __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\ ++ \ ++ __atg104_old; }) ++#endif + + #endif /* !USE_ATOMIC_COMPILER_BUILTINS */ + +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch b/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch new file mode 100644 index 0000000000..9eb635d716 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0003-Add-pretty-printers-for-the-NPTL-lock-types.patch @@ -0,0 +1,3197 @@ +From 246fee86fc90c57738ee282a061039f82832f4ea Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 30 Jun 2017 13:42:04 +0300 +Subject: [PATCH 3/6] Add pretty printers for the NPTL lock types + +This patch adds pretty printers for the following NPTL types: + +- pthread_mutex_t +- pthread_mutexattr_t +- pthread_cond_t +- pthread_condattr_t +- pthread_rwlock_t +- pthread_rwlockattr_t + +To load the pretty printers into your gdb session, do the following: + +python +import sys +sys.path.insert(0, '/path/to/glibc/build/nptl/pretty-printers') +end + +source /path/to/glibc/source/pretty-printers/nptl-printers.py + +You can check which printers are registered and enabled by issuing the +'info pretty-printer' gdb command. Printers should trigger automatically when +trying to print a variable of one of the types mentioned above. + +The printers are architecture-independent, and were tested on an AMD64 running +Ubuntu 14.04 and an x86 VM running Fedora 24. + +In order to work, the printers need to know the values of various flags that +are scattered throughout pthread.h and pthreadP.h as enums and #defines. Since +replicating these constants in the printers file itself would create a +maintenance burden, I wrote a script called gen-py-const.awk that Makerules uses +to extract the constants. This script is pretty much the same as gen-as-const.awk, +except it doesn't cast the constant values to 'long' and is thorougly documented. +The constants need only to be enumerated in a .pysym file, which is then referenced +by a Make variable called gen-py-const-headers. + +As for the install directory, I discussed this with Mike Frysinger and Siddhesh +Poyarekar, and we agreed that it can be handled in a separate patch, and shouldn't +block merging of this one. + +In addition, I've written a series of test cases for the pretty printers. +Each lock type (mutex, condvar and rwlock) has two test programs, one for itself +and other for its related 'attributes' object. Each test program in turn has a +PExpect-based Python script that drives gdb and compares its output to the +expected printer's. The tests run on the glibc host, which is assumed to have +both gdb and PExpect; if either is absent the tests will fail with code 77 +(UNSUPPORTED). For cross-testing you should use cross-test-ssh.sh as test-wrapper. +I've tested the printers on both native builds and a cross build using a Beaglebone +Black running Debian, with the build system's filesystem shared with the board +through NFS. + +Finally, I've written a README that explains all this and more. + + * INSTALL: Regenerated. + * Makeconfig: Add comments and whitespace to make the control flow + clearer. + (+link-printers-tests, +link-pie-printers-tests, CFLAGS-printers-tests, + installed-rtld-LDFLAGS, built-rtld-LDFLAGS, link-libc-rpath, + link-libc-tests-after-rpath-link, link-libc-printers-tests): New. + (rtld-LDFLAGS, rtld-tests-LDFLAGS, link-libc-tests-rpath-link, + link-libc-tests): Use the new variables as required. + * Makerules ($(py-const)): New rule. + generated: Add $(py-const). + * README.pretty-printers: New file. + * Rules (tests-printers-programs, tests-printers-out, py-env): New. + (others): Depend on $(py-const). + (tests): Depend on $(tests-printers-programs) or $(tests-printers-out), + as required. Pass $(tests-printers) to merge-test-results.sh. + * manual/install.texi: Add requirements for testing the pretty printers. + * nptl/Makefile (gen-py-const-headers, pretty-printers, tests-printers, + CFLAGS-test-mutexattr-printers.c CFLAGS-test-mutex-printers.c, + CFLAGS-test-condattr-printers.c, CFLAGS-test-cond-printers.c, + CFLAGS-test-rwlockattr-printers.c CFLAGS-test-rwlock-printers.c, + tests-printers-libs): Define. + * nptl/nptl-printers.py: New file. + * nptl/nptl_lock_constants.pysym: Likewise. + * nptl/test-cond-printers.c: Likewise. + * nptl/test-cond-printers.py: Likewise. + * nptl/test-condattr-printers.c: Likewise. + * nptl/test-condattr-printers.py: Likewise. + * nptl/test-mutex-printers.c: Likewise. + * nptl/test-mutex-printers.py: Likewise. + * nptl/test-mutexattr-printers.c: Likewise. + * nptl/test-mutexattr-printers.py: Likewise. + * nptl/test-rwlock-printers.c: Likewise. + * nptl/test-rwlock-printers.py: Likewise. + * nptl/test-rwlockattr-printers.c: Likewise. + * nptl/test-rwlockattr-printers.py: Likewise. + * scripts/gen-py-const.awk: Likewise. + * scripts/test_printers_common.py: Likewise. + * scripts/test_printers_exceptions.py: Likewise. + +Upstream-Status: Backport + +Author: Martin Galvan +Signed-off-by: Catalin Enache +--- + ChangeLog | 45 +++ + INSTALL | 27 ++ + Makeconfig | 76 ++++- + Makerules | 46 +++ + NEWS | 6 + + README.pretty-printers | 169 ++++++++++ + Rules | 44 ++- + manual/install.texi | 30 ++ + nptl/Makefile | 18 + + nptl/nptl-printers.py | 633 ++++++++++++++++++++++++++++++++++++ + nptl/nptl_lock_constants.pysym | 75 +++++ + nptl/test-cond-printers.c | 57 ++++ + nptl/test-cond-printers.py | 50 +++ + nptl/test-condattr-printers.c | 94 ++++++ + nptl/test-condattr-printers.py | 71 ++++ + nptl/test-mutex-printers.c | 151 +++++++++ + nptl/test-mutex-printers.py | 97 ++++++ + nptl/test-mutexattr-printers.c | 144 ++++++++ + nptl/test-mutexattr-printers.py | 101 ++++++ + nptl/test-rwlock-printers.c | 78 +++++ + nptl/test-rwlock-printers.py | 64 ++++ + nptl/test-rwlockattr-printers.c | 98 ++++++ + nptl/test-rwlockattr-printers.py | 73 +++++ + scripts/gen-py-const.awk | 118 +++++++ + scripts/test_printers_common.py | 364 +++++++++++++++++++++ + scripts/test_printers_exceptions.py | 61 ++++ + 26 files changed, 2770 insertions(+), 20 deletions(-) + create mode 100644 README.pretty-printers + create mode 100644 nptl/nptl-printers.py + create mode 100644 nptl/nptl_lock_constants.pysym + create mode 100644 nptl/test-cond-printers.c + create mode 100644 nptl/test-cond-printers.py + create mode 100644 nptl/test-condattr-printers.c + create mode 100644 nptl/test-condattr-printers.py + create mode 100644 nptl/test-mutex-printers.c + create mode 100644 nptl/test-mutex-printers.py + create mode 100644 nptl/test-mutexattr-printers.c + create mode 100644 nptl/test-mutexattr-printers.py + create mode 100644 nptl/test-rwlock-printers.c + create mode 100644 nptl/test-rwlock-printers.py + create mode 100644 nptl/test-rwlockattr-printers.c + create mode 100644 nptl/test-rwlockattr-printers.py + create mode 100644 scripts/gen-py-const.awk + create mode 100644 scripts/test_printers_common.py + create mode 100644 scripts/test_printers_exceptions.py + +diff --git a/ChangeLog b/ChangeLog +index 96b6da2..8036c1e 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,48 @@ ++2016-12-08 Martin Galvan ++ ++ * INSTALL: Regenerated. ++ * Makeconfig: Add comments and whitespace to make the control flow ++ clearer. ++ (+link-printers-tests, +link-pie-printers-tests, ++ CFLAGS-printers-tests, installed-rtld-LDFLAGS, ++ built-rtld-LDFLAGS, link-libc-rpath, ++ link-libc-tests-after-rpath-link, ++ link-libc-printers-tests): New. ++ (rtld-LDFLAGS, rtld-tests-LDFLAGS, link-libc-tests-rpath-link, ++ link-libc-tests): Use the new variables as required. ++ * Makerules ($(py-const)): New rule. ++ generated: Add $(py-const). ++ * README.pretty-printers: New file. ++ * Rules (tests-printers-programs, tests-printers-out, py-env): New. ++ (others): Depend on $(py-const). ++ (tests): Depend on $(tests-printers-programs) or ++ $(tests-printers-out), ++ as required. Pass $(tests-printers) to merge-test-results.sh. ++ * manual/install.texi: Add requirements for testing the pretty ++ printers. ++ * nptl/Makefile (gen-py-const-headers, pretty-printers, ++ tests-printers, CFLAGS-test-mutexattr-printers.c ++ CFLAGS-test-mutex-printers.c, CFLAGS-test-condattr-printers.c, ++ CFLAGS-test-cond-printers.c, CFLAGS-test-rwlockattr-printers.c ++ CFLAGS-test-rwlock-printers.c, tests-printers-libs): Define. ++ * nptl/nptl-printers.py: New file. ++ * nptl/nptl_lock_constants.pysym: Likewise. ++ * nptl/test-cond-printers.c: Likewise. ++ * nptl/test-cond-printers.py: Likewise. ++ * nptl/test-condattr-printers.c: Likewise. ++ * nptl/test-condattr-printers.py: Likewise. ++ * nptl/test-mutex-printers.c: Likewise. ++ * nptl/test-mutex-printers.py: Likewise. ++ * nptl/test-mutexattr-printers.c: Likewise. ++ * nptl/test-mutexattr-printers.py: Likewise. ++ * nptl/test-rwlock-printers.c: Likewise. ++ * nptl/test-rwlock-printers.py: Likewise. ++ * nptl/test-rwlockattr-printers.c: Likewise. ++ * nptl/test-rwlockattr-printers.py: Likewise. ++ * scripts/gen-py-const.awk: Likewise. ++ * scripts/test_printers_common.py: Likewise. ++ * scripts/test_printers_exceptions.py: Likewise. ++ + 2016-08-09 Torvald Riegel + + * include/atomic.h (atomic_fetch_and_relaxed, +diff --git a/INSTALL b/INSTALL +index ec3445f..dd62c86 100644 +--- a/INSTALL ++++ b/INSTALL +@@ -224,6 +224,33 @@ You can specify 'stop-on-test-failure=y' when running 'make check' to + make the test run stop and exit with an error status immediately when a + failure occurs. + ++ The GNU C Library pretty printers come with their own set of scripts ++for testing, which run together with the rest of the testsuite through ++'make check'. These scripts require the following tools to run ++successfully: ++ ++ * Python 2.7.6/3.4.3 or later ++ ++ Python is required for running the printers' test scripts. ++ ++ * PExpect 4.0 ++ ++ The printer tests drive GDB through test programs and compare its ++ output to the printers'. PExpect is used to capture the output of ++ GDB, and should be compatible with the Python version in your ++ system. ++ ++ * GDB 7.8 or later with support for Python 2.7.6/3.4.3 or later ++ ++ GDB itself needs to be configured with Python support in order to ++ use the pretty printers. Notice that your system having Python ++ available doesn't imply that GDB supports it, nor that your ++ system's Python and GDB's have the same version. ++ ++If these tools are absent, the printer tests will report themselves as ++'UNSUPPORTED'. Notice that some of the printer tests require the GNU C ++Library to be compiled with debugging symbols. ++ + To format the 'GNU C Library Reference Manual' for printing, type + 'make dvi'. You need a working TeX installation to do this. The + distribution builds the on-line formatted version of the manual, as Info +diff --git a/Makeconfig b/Makeconfig +index 03fd89c..2d92d94 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -416,6 +416,11 @@ $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ + $(+link-pie-after-libc) + $(call after-link,$@) + endef ++define +link-pie-printers-tests ++$(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ ++ $(+link-pie-after-libc) ++$(call after-link,$@) ++endef + endif + # Command for statically linking programs with the C library. + ifndef +link-static +@@ -445,7 +450,8 @@ ifeq (yes,$(build-pie-default)) + no-pie-ldflag = -no-pie + +link = $(+link-pie) + +link-tests = $(+link-pie-tests) +-else +++link-printers-tests = $(+link-pie-printers-tests) ++else # not build-pie-default + +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ + $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ + $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ +@@ -466,51 +472,87 @@ $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ + $(+link-after-libc) + $(call after-link,$@) + endef +-endif +-else ++define +link-printers-tests ++$(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ ++ $(+link-after-libc) ++$(call after-link,$@) ++endef ++endif # build-pie-default ++else # build-static + +link = $(+link-static) + +link-tests = $(+link-static-tests) +-endif +-endif +++link-printers-tests = $(+link-static-tests) ++endif # build-shared ++endif # +link ++ ++# The pretty printer test programs need to be compiled without optimizations ++# so they won't confuse gdb. We could use either the 'GCC optimize' pragma ++# or the 'optimize' function attribute to achieve this; however, at least on ++# ARM, gcc always produces different debugging symbols when invoked with ++# a -O greater than 0 than when invoked with -O0, regardless of anything else ++# we're using to suppress optimizations. Therefore, we need to explicitly pass ++# -O0 to it through CFLAGS. ++# Additionally, the build system will try to -include $(common-objpfx)/config.h ++# when compiling the tests, which will throw an error if some special macros ++# (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we ++# tell gcc to define IS_IN_build. ++CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build ++ + ifeq (yes,$(build-shared)) ++# These indicate whether to link using the built ld.so or the installed one. ++installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name) ++built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so ++ + ifndef rtld-LDFLAGS +-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name) ++rtld-LDFLAGS = $(installed-rtld-LDFLAGS) + endif ++ + ifndef rtld-tests-LDFLAGS + ifeq (yes,$(build-hardcoded-path-in-tests)) +-rtld-tests-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so ++rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS) + else +-rtld-tests-LDFLAGS = $(rtld-LDFLAGS) +-endif +-endif +-endif ++rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS) ++endif # build-hardcoded-path-in-tests ++endif # rtld-tests-LDFLAGS ++ ++endif # build-shared ++ + ifndef link-libc + ifeq (yes,$(build-shared)) + # We need the versioned name of libc.so in the deps of $(others) et al + # so that the symlink to libc.so is created before anything tries to + # run the linked programs. ++link-libc-rpath = -Wl,-rpath=$(rpath-link) + link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link) ++ + ifeq (yes,$(build-hardcoded-path-in-tests)) +-link-libc-tests-rpath-link = -Wl,-rpath=$(rpath-link) ++link-libc-tests-rpath-link = $(link-libc-rpath) + else + link-libc-tests-rpath-link = $(link-libc-rpath-link) +-endif ++endif # build-hardcoded-path-in-tests ++ + link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \ + $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ + $(as-needed) $(elf-objpfx)ld.so \ + $(no-as-needed) + link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib) ++ ++link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests) + link-libc-tests = $(link-libc-tests-rpath-link) \ +- $(link-libc-before-gnulib) $(gnulib-tests) ++ $(link-libc-tests-after-rpath-link) ++# Pretty printer test programs always require rpath instead of rpath-link. ++link-libc-printers-tests = $(link-libc-rpath) \ ++ $(link-libc-tests-after-rpath-link) ++ + # This is how to find at build-time things that will be installed there. + rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec + rpath-link = \ + $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) +-else ++else # build-static + link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) + link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) +-endif +-endif ++endif # build-shared ++endif # link-libc + + # Differences in the linkers on the various platforms. + LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN' +diff --git a/Makerules b/Makerules +index be3c11b..b7e0f59 100644 +--- a/Makerules ++++ b/Makerules +@@ -214,6 +214,52 @@ sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \ + -e 's@^\([^ \/$$][^ \]*\)@$$(..)\1@g' + endif + ++ifdef gen-py-const-headers ++# We'll use a static pattern rule to match .pysym files with their ++# corresponding generated .py files. ++# The generated .py files go in the submodule's dir in the glibc build dir. ++py-const-files := $(patsubst %.pysym,%.py,$(gen-py-const-headers)) ++py-const-dir := $(objpfx) ++py-const := $(addprefix $(py-const-dir),$(py-const-files)) ++py-const-script := $(..)scripts/gen-py-const.awk ++ ++# This is a hack we use to generate .py files with constants for Python ++# pretty printers. It works the same way as gen-as-const. ++# See scripts/gen-py-const.awk for details on how the awk | gcc mechanism ++# works. ++# ++# $@.tmp and $@.tmp2 are temporary files we use to store the partial contents ++# of the target file. We do this instead of just writing on $@ because, if the ++# build process terminates prematurely, re-running Make wouldn't run this rule ++# since Make would see that the target file already exists (despite it being ++# incomplete). ++# ++# The sed line replaces "@name@SOME_NAME@value@SOME_VALUE@" strings from the ++# output of 'gcc -S' with "SOME_NAME = SOME_VALUE" strings. ++# The '-n' option, combined with the '/p' command, makes sed output only the ++# modified lines instead of the whole input file. The output is redirected ++# to a .py file; we'll import it in the pretty printers file to read ++# the constants generated by gen-py-const.awk. ++# The regex has two capturing groups, for SOME_NAME and SOME_VALUE ++# respectively. Notice SOME_VALUE may be prepended by a special character, ++# depending on the assembly syntax (e.g. immediates are prefixed by a '$' ++# in AT&T x86, and by a '#' in ARM). We discard it using a complemented set ++# before the second capturing group. ++$(py-const): $(py-const-dir)%.py: %.pysym $(py-const-script) \ ++ $(common-before-compile) ++ $(make-target-directory) ++ $(AWK) -f $(py-const-script) $< \ ++ | $(CC) -S -o $@.tmp $(CFLAGS) $(CPPFLAGS) -x c - ++ echo '# GENERATED FILE\n' > $@.tmp2 ++ echo '# Constant definitions for pretty printers.' >> $@.tmp2 ++ echo '# See gen-py-const.awk for details.\n' >> $@.tmp2 ++ sed -n -r 's/^.*@name@([^@]+)@value@[^[:xdigit:]Xx-]*([[:xdigit:]Xx-]+)@.*/\1 = \2/p' \ ++ $@.tmp >> $@.tmp2 ++ mv -f $@.tmp2 $@ ++ rm -f $@.tmp ++ ++generated += $(py-const) ++endif # gen-py-const-headers + + ifdef gen-as-const-headers + # Generating headers for assembly constants. +diff --git a/NEWS b/NEWS +index b0447e7..3002773 100644 +--- a/NEWS ++++ b/NEWS +@@ -5,6 +5,12 @@ See the end for copying conditions. + Please send GNU C library bug reports via + using `glibc' in the "product" field. + ++ ++* GDB pretty printers have been added for mutex and condition variable ++ structures in POSIX Threads. When installed and loaded in gdb these pretty ++ printers show various pthread variables in human-readable form when read ++ using the 'print' or 'display' commands in gdb. ++ + Version 2.24 + + * The minimum Linux kernel version that this version of the GNU C Library +diff --git a/README.pretty-printers b/README.pretty-printers +new file mode 100644 +index 0000000..8662900 +--- /dev/null ++++ b/README.pretty-printers +@@ -0,0 +1,169 @@ ++README for the glibc Python pretty printers ++=========================================== ++ ++Pretty printers are gdb extensions that allow it to print useful, human-readable ++information about a program's variables. For example, for a pthread_mutex_t ++gdb would usually output something like this: ++ ++(gdb) print mutex ++$1 = { ++ __data = { ++ __lock = 22020096, ++ __count = 0, ++ __owner = 0, ++ __nusers = 0, ++ __kind = 576, ++ __spins = 0, ++ __elision = 0, ++ __list = { ++ __prev = 0x0, ++ __next = 0x0 ++ } ++ }, ++ __size = "\000\000P\001", '\000' , "@\002", '\000' , ++ __align = 22020096 ++} ++ ++However, with a pretty printer gdb will output something like this: ++ ++(gdb) print mutex ++$1 = pthread_mutex_t = { ++ Type = Normal, ++ Status = Unlocked, ++ Robust = No, ++ Shared = No, ++ Protocol = Priority protect, ++ Priority ceiling = 42 ++} ++ ++Before printing a value, gdb will first check if there's a pretty printer ++registered for it. If there is, it'll use it, otherwise it'll print the value ++as usual. Pretty printers can be registered in various ways; for our purposes ++we register them for the current objfile by calling ++gdb.printing.register_pretty_printer(). ++ ++Currently our printers are based on gdb.RegexpCollectionPrettyPrinter, which ++means they'll be triggered if the type of the variable we're printing matches ++a given regular expression. For example, MutexPrinter will be triggered if ++our variable's type matches the regexp '^pthread_mutex_t$'. ++ ++Besides the printers themselves, each module may have a constants file which the ++printers will import. These constants are generated from C headers during the ++build process, and need to be in the Python search path when loading the ++printers. ++ ++ ++Installing and loading ++---------------------- ++ ++The pretty printers and their constant files may be installed in different paths ++for each distro, though gdb should be able to automatically load them by itself. ++When in doubt, you can use the 'info pretty-printer' gdb command to list the ++loaded pretty printers. ++ ++If the printers aren't automatically loaded for some reason, you should add the ++following to your .gdbinit: ++ ++python ++import sys ++sys.path.insert(0, '/path/to/constants/file/directory') ++end ++ ++source /path/to/printers.py ++ ++If you're building glibc manually, '/path/to/constants/file/directory' should be ++'/path/to/glibc-build/submodule', where 'submodule' is e.g. nptl. ++ ++ ++Testing ++------- ++ ++The pretty printers come with a small test suite based on PExpect, which is a ++Python module with Expect-like features for spawning and controlling interactive ++programs. Each printer has a corresponding C program and a Python script ++that uses PExpect to drive gdb through the program and compare its output to ++the expected printer's. ++ ++The tests run on the glibc host, which is assumed to have both gdb and PExpect; ++if any of those is absent the tests will fail with code 77 (UNSUPPORTED). ++Native builds can be tested simply by doing 'make check'; cross builds must use ++cross-test-ssh.sh as test-wrapper, like this: ++ ++make test-wrapper='/path/to/scripts/cross-test-ssh.sh user@host' check ++ ++(Remember to share the build system's filesystem with the glibc host's through ++NFS or something similar). ++ ++Running 'make check' on a cross build will only compile the test programs, ++without running the scripts. ++ ++ ++Adding new pretty printers ++-------------------------- ++ ++Adding new pretty printers to glibc requires following these steps: ++ ++1. Identify which constants must be generated from C headers, and write the ++corresponding .pysym file. See scripts/gen-py-const.awk for more information ++on how this works. The name of the .pysym file must be added to the ++'gen-py-const-headers' variable in your submodule's Makefile (without the .pysym ++extension). ++ ++2. Write the pretty printer code itself. For this you can follow the gdb ++Python API documentation, and use the existing printers as examples. The printer ++code must import the generated constants file (which will have the same name ++as your .pysym file). The names of the pretty printer files must be added ++to the 'pretty-printers' variable in your submodule's Makefile (without the .py ++extension). ++ ++3. Write the unit tests for your pretty printers. The build system calls each ++test script passing it the paths to the test program source, the test program ++binary, and the printer files you added to 'pretty-printers' in the previous ++step. The test scripts, in turn, must import scripts/test_printers_common ++and call the init_test function passing it, among other things, the name of the ++set of pretty printers to enable (as seen by running 'info pretty-printer'). ++You can use the existing unit tests as examples. ++ ++4. Add the names of the pretty printer tests to the 'tests-printers' variable ++in your submodule's Makefile (without extensions). In addition, for each test ++program you must define a corresponding CFLAGS-* variable and set it to ++$(CFLAGS-printers-tests) to ensure they're compiled correctly. For example, ++test-foo-printer.c requires the following: ++ ++CFLAGS-test-foo-printer.c := $(CFLAGS-printers-tests) ++ ++Finally, if your programs need to be linked with a specific library, you can add ++its name to the 'tests-printers-libs' variable in your submodule's Makefile. ++ ++ ++Known issues ++------------ ++ ++* Pretty printers are inherently coupled to the code they're targetting, thus ++any changes to the target code must also update the corresponding printers. ++On the plus side, the printer code itself may serve as a kind of documentation ++for the target code. ++ ++* Older versions of the gdb Python API have a bug where ++gdb.RegexpCollectionPrettyPrinter would not be able to get a value's real type ++if it was typedef'd. This would cause gdb to ignore the pretty printers for ++types like pthread_mutex_t, which is defined as: ++ ++typedef union ++{ ++ ... ++} pthread_mutex_t; ++ ++This was fixed in commit 1b588015839caafc608a6944a78aea170f5fb2f6, and released ++as part of gdb 7.8. However, typedef'ing an already typedef'd type may cause ++a similar issue, e.g.: ++ ++typedef pthread_mutex_t mutex; ++mutex a_mutex; ++ ++Here, trying to print a_mutex won't trigger the pthread_mutex_t printer. ++ ++* The test programs must be compiled without optimizations. This is necessary ++because the test scripts rely on the C code structure being preserved when ++stepping through the programs. Things like aggressive instruction reordering ++or optimizing variables out may make this kind of testing impossible. +diff --git a/Rules b/Rules +index 8306d36..10a6479 100644 +--- a/Rules ++++ b/Rules +@@ -85,16 +85,27 @@ common-generated += dummy.o dummy.c + + .PHONY: others tests bench bench-build + ++# Test programs for the pretty printers. ++tests-printers-programs := $(addprefix $(objpfx),$(tests-printers)) ++ ++# .out files with the output of running the pretty printer tests. ++tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers)) ++ + ifeq ($(build-programs),yes) + others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs)) + else + others: $(addprefix $(objpfx),$(extra-objs)) + endif ++ ++# Generate constant files for Python pretty printers if required. ++others: $(py-const) ++ + ifeq ($(run-built-tests),no) +-tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special) ++tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special) \ ++ $(tests-printers-programs) + xtests: tests $(xtests-special) + else +-tests: $(tests:%=$(objpfx)%.out) $(tests-special) ++tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out) + xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) + endif + +@@ -102,7 +113,8 @@ tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special)) + xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special)) + tests: + $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ +- $(sort $(tests) $(tests-special-notdir:.out=)) \ ++ $(sort $(tests) $(tests-special-notdir:.out=) \ ++ $(tests-printers)) \ + > $(objpfx)subdir-tests.sum + xtests: + $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ +@@ -212,6 +224,32 @@ endif + + endif # tests + ++ifneq "$(strip $(tests-printers))" "" ++# We're defining this here for now; later it'll be defined at configure time ++# inside Makeconfig. ++PYTHON := python ++ ++# Static pattern rule for building the test programs for the pretty printers. ++$(tests-printers-programs): %: %.o $(tests-printers-libs) \ ++ $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ ++ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) ++ $(+link-printers-tests) ++ ++# Add the paths to the generated constants file and test_common_printers.py ++# to PYTHONPATH so the test scripts can find them. ++py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH} ++ ++# Static pattern rule that matches the test-* targets to their .c and .py ++# prerequisites. It'll run the corresponding test script for each test program ++# we compiled and place its output in the corresponding .out file. ++# The pretty printer files and test_common_printers.py must be present for all. ++$(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \ ++ $(..)scripts/test_printers_common.py ++ $(test-wrapper-env) $(py-env) \ ++ $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \ ++ $(evaluate-test) ++endif ++ + + .PHONY: distclean realclean subdir_distclean subdir_realclean \ + subdir_clean subdir_mostlyclean subdir_testclean +diff --git a/manual/install.texi b/manual/install.texi +index 79ee45f..468479e 100644 +--- a/manual/install.texi ++++ b/manual/install.texi +@@ -256,6 +256,36 @@ occurred. You can specify @samp{stop-on-test-failure=y} when running + @code{make check} to make the test run stop and exit with an error + status immediately when a failure occurs. + ++The @glibcadj{} pretty printers come with their own set of scripts for testing, ++which run together with the rest of the testsuite through @code{make check}. ++These scripts require the following tools to run successfully: ++ ++@itemize @bullet ++@item ++Python 2.7.6/3.4.3 or later ++ ++Python is required for running the printers' test scripts. ++ ++@item PExpect 4.0 ++ ++The printer tests drive GDB through test programs and compare its output ++to the printers'. PExpect is used to capture the output of GDB, and should be ++compatible with the Python version in your system. ++ ++@item ++GDB 7.8 or later with support for Python 2.7.6/3.4.3 or later ++ ++GDB itself needs to be configured with Python support in order to use the ++pretty printers. Notice that your system having Python available doesn't imply ++that GDB supports it, nor that your system's Python and GDB's have the same ++version. ++@end itemize ++ ++@noindent ++If these tools are absent, the printer tests will report themselves as ++@code{UNSUPPORTED}. Notice that some of the printer tests require @theglibc{} ++to be compiled with debugging symbols. ++ + To format the @cite{GNU C Library Reference Manual} for printing, type + @w{@code{make dvi}}. You need a working @TeX{} installation to do + this. The distribution builds the on-line formatted version of the +diff --git a/nptl/Makefile b/nptl/Makefile +index 7dec4ed..49f6ba6 100644 +--- a/nptl/Makefile ++++ b/nptl/Makefile +@@ -308,6 +308,24 @@ gen-as-const-headers = pthread-errnos.sym \ + unwindbuf.sym \ + lowlevelrobustlock.sym pthread-pi-defines.sym + ++gen-py-const-headers := nptl_lock_constants.pysym ++pretty-printers := nptl-printers.py ++tests-printers := test-mutexattr-printers test-mutex-printers \ ++ test-condattr-printers test-cond-printers \ ++ test-rwlockattr-printers test-rwlock-printers ++ ++CFLAGS-test-mutexattr-printers.c := $(CFLAGS-printers-tests) ++CFLAGS-test-mutex-printers.c := $(CFLAGS-printers-tests) ++CFLAGS-test-condattr-printers.c := $(CFLAGS-printers-tests) ++CFLAGS-test-cond-printers.c := $(CFLAGS-printers-tests) ++CFLAGS-test-rwlockattr-printers.c := $(CFLAGS-printers-tests) ++CFLAGS-test-rwlock-printers.c := $(CFLAGS-printers-tests) ++ ++ifeq ($(build-shared),yes) ++tests-printers-libs := $(shared-thread-library) ++else ++tests-printers-libs := $(static-thread-library) ++endif + + LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst + +diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py +new file mode 100644 +index 0000000..e402f23 +--- /dev/null ++++ b/nptl/nptl-printers.py +@@ -0,0 +1,633 @@ ++# Pretty printers for the NPTL lock types. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++"""This file contains the gdb pretty printers for the following types: ++ ++ * pthread_mutex_t ++ * pthread_mutexattr_t ++ * pthread_cond_t ++ * pthread_condattr_t ++ * pthread_rwlock_t ++ * pthread_rwlockattr_t ++ ++You can check which printers are registered and enabled by issuing the ++'info pretty-printer' gdb command. Printers should trigger automatically when ++trying to print a variable of one of the types mentioned above. ++""" ++ ++from __future__ import print_function ++ ++import gdb ++import gdb.printing ++from nptl_lock_constants import * ++ ++MUTEX_TYPES = { ++ PTHREAD_MUTEX_NORMAL: ('Type', 'Normal'), ++ PTHREAD_MUTEX_RECURSIVE: ('Type', 'Recursive'), ++ PTHREAD_MUTEX_ERRORCHECK: ('Type', 'Error check'), ++ PTHREAD_MUTEX_ADAPTIVE_NP: ('Type', 'Adaptive') ++} ++ ++class MutexPrinter(object): ++ """Pretty printer for pthread_mutex_t.""" ++ ++ def __init__(self, mutex): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ mutex: A gdb.value representing a pthread_mutex_t. ++ """ ++ ++ data = mutex['__data'] ++ self.lock = data['__lock'] ++ self.count = data['__count'] ++ self.owner = data['__owner'] ++ self.kind = data['__kind'] ++ self.values = [] ++ self.read_values() ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_mutex_t. ++ """ ++ ++ return 'pthread_mutex_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_mutex_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the mutex's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ self.read_type() ++ self.read_status() ++ self.read_attributes() ++ self.read_misc_info() ++ ++ def read_type(self): ++ """Read the mutex's type.""" ++ ++ mutex_type = self.kind & PTHREAD_MUTEX_KIND_MASK ++ ++ # mutex_type must be casted to int because it's a gdb.Value ++ self.values.append(MUTEX_TYPES[int(mutex_type)]) ++ ++ def read_status(self): ++ """Read the mutex's status. ++ ++ For architectures which support lock elision, this method reads ++ whether the mutex appears as locked in memory (i.e. it may show it as ++ unlocked even after calling pthread_mutex_lock). ++ """ ++ ++ if self.kind == PTHREAD_MUTEX_DESTROYED: ++ self.values.append(('Status', 'Destroyed')) ++ elif self.kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP: ++ self.read_status_robust() ++ else: ++ self.read_status_no_robust() ++ ++ def read_status_robust(self): ++ """Read the status of a robust mutex. ++ ++ In glibc robust mutexes are implemented in a very different way than ++ non-robust ones. This method reads their locking status, ++ whether it may have waiters, their registered owner (if any), ++ whether the owner is alive or not, and the status of the state ++ they're protecting. ++ """ ++ ++ if self.lock == PTHREAD_MUTEX_UNLOCKED: ++ self.values.append(('Status', 'Unlocked')) ++ else: ++ if self.lock & FUTEX_WAITERS: ++ self.values.append(('Status', 'Locked, possibly with waiters')) ++ else: ++ self.values.append(('Status', ++ 'Locked, possibly with no waiters')) ++ ++ if self.lock & FUTEX_OWNER_DIED: ++ self.values.append(('Owner ID', '%d (dead)' % self.owner)) ++ else: ++ self.values.append(('Owner ID', self.lock & FUTEX_TID_MASK)) ++ ++ if self.owner == PTHREAD_MUTEX_INCONSISTENT: ++ self.values.append(('State protected by this mutex', ++ 'Inconsistent')) ++ elif self.owner == PTHREAD_MUTEX_NOTRECOVERABLE: ++ self.values.append(('State protected by this mutex', ++ 'Not recoverable')) ++ ++ def read_status_no_robust(self): ++ """Read the status of a non-robust mutex. ++ ++ Read info on whether the mutex is locked, if it may have waiters ++ and its owner (if any). ++ """ ++ ++ lock_value = self.lock ++ ++ if self.kind & PTHREAD_MUTEX_PRIO_PROTECT_NP: ++ lock_value &= ~(PTHREAD_MUTEX_PRIO_CEILING_MASK) ++ ++ if lock_value == PTHREAD_MUTEX_UNLOCKED: ++ self.values.append(('Status', 'Unlocked')) ++ else: ++ if self.kind & PTHREAD_MUTEX_PRIO_INHERIT_NP: ++ waiters = self.lock & FUTEX_WAITERS ++ owner = self.lock & FUTEX_TID_MASK ++ else: ++ # Mutex protocol is PP or none ++ waiters = (self.lock != PTHREAD_MUTEX_LOCKED_NO_WAITERS) ++ owner = self.owner ++ ++ if waiters: ++ self.values.append(('Status', 'Locked, possibly with waiters')) ++ else: ++ self.values.append(('Status', ++ 'Locked, possibly with no waiters')) ++ ++ self.values.append(('Owner ID', owner)) ++ ++ def read_attributes(self): ++ """Read the mutex's attributes.""" ++ ++ if self.kind != PTHREAD_MUTEX_DESTROYED: ++ if self.kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP: ++ self.values.append(('Robust', 'Yes')) ++ else: ++ self.values.append(('Robust', 'No')) ++ ++ # In glibc, robust mutexes always have their pshared flag set to ++ # 'shared' regardless of what the pshared flag of their ++ # mutexattr was. Therefore a robust mutex will act as shared ++ # even if it was initialized with a 'private' mutexattr. ++ if self.kind & PTHREAD_MUTEX_PSHARED_BIT: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ self.values.append(('Shared', 'No')) ++ ++ if self.kind & PTHREAD_MUTEX_PRIO_INHERIT_NP: ++ self.values.append(('Protocol', 'Priority inherit')) ++ elif self.kind & PTHREAD_MUTEX_PRIO_PROTECT_NP: ++ prio_ceiling = ((self.lock & PTHREAD_MUTEX_PRIO_CEILING_MASK) ++ >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT) ++ ++ self.values.append(('Protocol', 'Priority protect')) ++ self.values.append(('Priority ceiling', prio_ceiling)) ++ else: ++ # PTHREAD_PRIO_NONE ++ self.values.append(('Protocol', 'None')) ++ ++ def read_misc_info(self): ++ """Read miscellaneous info on the mutex. ++ ++ For now this reads the number of times a recursive mutex was locked ++ by the same thread. ++ """ ++ ++ mutex_type = self.kind & PTHREAD_MUTEX_KIND_MASK ++ ++ if mutex_type == PTHREAD_MUTEX_RECURSIVE and self.count > 1: ++ self.values.append(('Times locked recursively', self.count)) ++ ++class MutexAttributesPrinter(object): ++ """Pretty printer for pthread_mutexattr_t. ++ ++ In the NPTL this is a type that's always casted to struct pthread_mutexattr ++ which has a single 'mutexkind' field containing the actual attributes. ++ """ ++ ++ def __init__(self, mutexattr): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ mutexattr: A gdb.value representing a pthread_mutexattr_t. ++ """ ++ ++ self.values = [] ++ ++ try: ++ mutexattr_struct = gdb.lookup_type('struct pthread_mutexattr') ++ self.mutexattr = mutexattr.cast(mutexattr_struct)['mutexkind'] ++ self.read_values() ++ except gdb.error: ++ # libpthread doesn't have debug symbols, thus we can't find the ++ # real struct type. Just print the union members. ++ self.values.append(('__size', mutexattr['__size'])) ++ self.values.append(('__align', mutexattr['__align'])) ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_mutexattr_t. ++ """ ++ ++ return 'pthread_mutexattr_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_mutexattr_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the mutexattr's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ mutexattr_type = (self.mutexattr ++ & ~PTHREAD_MUTEXATTR_FLAG_BITS ++ & ~PTHREAD_MUTEX_NO_ELISION_NP) ++ ++ # mutexattr_type must be casted to int because it's a gdb.Value ++ self.values.append(MUTEX_TYPES[int(mutexattr_type)]) ++ ++ if self.mutexattr & PTHREAD_MUTEXATTR_FLAG_ROBUST: ++ self.values.append(('Robust', 'Yes')) ++ else: ++ self.values.append(('Robust', 'No')) ++ ++ if self.mutexattr & PTHREAD_MUTEXATTR_FLAG_PSHARED: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ self.values.append(('Shared', 'No')) ++ ++ protocol = ((self.mutexattr & PTHREAD_MUTEXATTR_PROTOCOL_MASK) >> ++ PTHREAD_MUTEXATTR_PROTOCOL_SHIFT) ++ ++ if protocol == PTHREAD_PRIO_NONE: ++ self.values.append(('Protocol', 'None')) ++ elif protocol == PTHREAD_PRIO_INHERIT: ++ self.values.append(('Protocol', 'Priority inherit')) ++ elif protocol == PTHREAD_PRIO_PROTECT: ++ self.values.append(('Protocol', 'Priority protect')) ++ ++CLOCK_IDS = { ++ CLOCK_REALTIME: 'CLOCK_REALTIME', ++ CLOCK_MONOTONIC: 'CLOCK_MONOTONIC', ++ CLOCK_PROCESS_CPUTIME_ID: 'CLOCK_PROCESS_CPUTIME_ID', ++ CLOCK_THREAD_CPUTIME_ID: 'CLOCK_THREAD_CPUTIME_ID', ++ CLOCK_MONOTONIC_RAW: 'CLOCK_MONOTONIC_RAW', ++ CLOCK_REALTIME_COARSE: 'CLOCK_REALTIME_COARSE', ++ CLOCK_MONOTONIC_COARSE: 'CLOCK_MONOTONIC_COARSE' ++} ++ ++class ConditionVariablePrinter(object): ++ """Pretty printer for pthread_cond_t.""" ++ ++ def __init__(self, cond): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ cond: A gdb.value representing a pthread_cond_t. ++ """ ++ ++ # Since PTHREAD_COND_SHARED is an integer, we need to cast it to void * ++ # to be able to compare it to the condvar's __data.__mutex member. ++ # ++ # While it looks like self.shared_value should be a class variable, ++ # that would result in it having an incorrect size if we're loading ++ # these printers through .gdbinit for a 64-bit objfile in AMD64. ++ # This is because gdb initially assumes the pointer size to be 4 bytes, ++ # and only sets it to 8 after loading the 64-bit objfiles. Since ++ # .gdbinit runs before any objfiles are loaded, this would effectively ++ # make self.shared_value have a size of 4, thus breaking later ++ # comparisons with pointers whose types are looked up at runtime. ++ void_ptr_type = gdb.lookup_type('void').pointer() ++ self.shared_value = gdb.Value(PTHREAD_COND_SHARED).cast(void_ptr_type) ++ ++ data = cond['__data'] ++ self.total_seq = data['__total_seq'] ++ self.mutex = data['__mutex'] ++ self.nwaiters = data['__nwaiters'] ++ self.values = [] ++ ++ self.read_values() ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_cond_t. ++ """ ++ ++ return 'pthread_cond_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_cond_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the condvar's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ self.read_status() ++ self.read_attributes() ++ self.read_mutex_info() ++ ++ def read_status(self): ++ """Read the status of the condvar. ++ ++ This method reads whether the condvar is destroyed and how many threads ++ are waiting for it. ++ """ ++ ++ if self.total_seq == PTHREAD_COND_DESTROYED: ++ self.values.append(('Status', 'Destroyed')) ++ ++ self.values.append(('Threads waiting for this condvar', ++ self.nwaiters >> COND_NWAITERS_SHIFT)) ++ ++ def read_attributes(self): ++ """Read the condvar's attributes.""" ++ ++ clock_id = self.nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1) ++ ++ # clock_id must be casted to int because it's a gdb.Value ++ self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)])) ++ ++ shared = (self.mutex == self.shared_value) ++ ++ if shared: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ self.values.append(('Shared', 'No')) ++ ++ def read_mutex_info(self): ++ """Read the data of the mutex this condvar is bound to. ++ ++ A pthread_cond_t's __data.__mutex member is a void * which ++ must be casted to pthread_mutex_t *. For shared condvars, this ++ member isn't recorded and has a special value instead. ++ """ ++ ++ if self.mutex and self.mutex != self.shared_value: ++ mutex_type = gdb.lookup_type('pthread_mutex_t') ++ mutex = self.mutex.cast(mutex_type.pointer()).dereference() ++ ++ self.values.append(('Mutex', mutex)) ++ ++class ConditionVariableAttributesPrinter(object): ++ """Pretty printer for pthread_condattr_t. ++ ++ In the NPTL this is a type that's always casted to struct pthread_condattr, ++ which has a single 'value' field containing the actual attributes. ++ """ ++ ++ def __init__(self, condattr): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ condattr: A gdb.value representing a pthread_condattr_t. ++ """ ++ ++ self.values = [] ++ ++ try: ++ condattr_struct = gdb.lookup_type('struct pthread_condattr') ++ self.condattr = condattr.cast(condattr_struct)['value'] ++ self.read_values() ++ except gdb.error: ++ # libpthread doesn't have debug symbols, thus we can't find the ++ # real struct type. Just print the union members. ++ self.values.append(('__size', condattr['__size'])) ++ self.values.append(('__align', condattr['__align'])) ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_condattr_t. ++ """ ++ ++ return 'pthread_condattr_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_condattr_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the condattr's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ clock_id = self.condattr & ((1 << COND_NWAITERS_SHIFT) - 1) ++ ++ # clock_id must be casted to int because it's a gdb.Value ++ self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)])) ++ ++ if self.condattr & 1: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ self.values.append(('Shared', 'No')) ++ ++class RWLockPrinter(object): ++ """Pretty printer for pthread_rwlock_t.""" ++ ++ def __init__(self, rwlock): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ rwlock: A gdb.value representing a pthread_rwlock_t. ++ """ ++ ++ data = rwlock['__data'] ++ self.readers = data['__nr_readers'] ++ self.queued_readers = data['__nr_readers_queued'] ++ self.queued_writers = data['__nr_writers_queued'] ++ self.writer_id = data['__writer'] ++ self.shared = data['__shared'] ++ self.prefers_writers = data['__flags'] ++ self.values = [] ++ self.read_values() ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_rwlock_t. ++ """ ++ ++ return 'pthread_rwlock_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_rwlock_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the rwlock's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ self.read_status() ++ self.read_attributes() ++ ++ def read_status(self): ++ """Read the status of the rwlock.""" ++ ++ # Right now pthread_rwlock_destroy doesn't do anything, so there's no ++ # way to check if an rwlock is destroyed. ++ ++ if self.writer_id: ++ self.values.append(('Status', 'Locked (Write)')) ++ self.values.append(('Writer ID', self.writer_id)) ++ elif self.readers: ++ self.values.append(('Status', 'Locked (Read)')) ++ self.values.append(('Readers', self.readers)) ++ else: ++ self.values.append(('Status', 'Unlocked')) ++ ++ self.values.append(('Queued readers', self.queued_readers)) ++ self.values.append(('Queued writers', self.queued_writers)) ++ ++ def read_attributes(self): ++ """Read the attributes of the rwlock.""" ++ ++ if self.shared: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ self.values.append(('Shared', 'No')) ++ ++ if self.prefers_writers: ++ self.values.append(('Prefers', 'Writers')) ++ else: ++ self.values.append(('Prefers', 'Readers')) ++ ++class RWLockAttributesPrinter(object): ++ """Pretty printer for pthread_rwlockattr_t. ++ ++ In the NPTL this is a type that's always casted to ++ struct pthread_rwlockattr, which has two fields ('lockkind' and 'pshared') ++ containing the actual attributes. ++ """ ++ ++ def __init__(self, rwlockattr): ++ """Initialize the printer's internal data structures. ++ ++ Args: ++ rwlockattr: A gdb.value representing a pthread_rwlockattr_t. ++ """ ++ ++ self.values = [] ++ ++ try: ++ rwlockattr_struct = gdb.lookup_type('struct pthread_rwlockattr') ++ self.rwlockattr = rwlockattr.cast(rwlockattr_struct) ++ self.read_values() ++ except gdb.error: ++ # libpthread doesn't have debug symbols, thus we can't find the ++ # real struct type. Just print the union members. ++ self.values.append(('__size', rwlockattr['__size'])) ++ self.values.append(('__align', rwlockattr['__align'])) ++ ++ def to_string(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_rwlockattr_t. ++ """ ++ ++ return 'pthread_rwlockattr_t' ++ ++ def children(self): ++ """gdb API function. ++ ++ This is called from gdb when we try to print a pthread_rwlockattr_t. ++ """ ++ ++ return self.values ++ ++ def read_values(self): ++ """Read the rwlockattr's info and store it in self.values. ++ ++ The data contained in self.values will be returned by the Iterator ++ created in self.children. ++ """ ++ ++ rwlock_type = self.rwlockattr['lockkind'] ++ shared = self.rwlockattr['pshared'] ++ ++ if shared == PTHREAD_PROCESS_SHARED: ++ self.values.append(('Shared', 'Yes')) ++ else: ++ # PTHREAD_PROCESS_PRIVATE ++ self.values.append(('Shared', 'No')) ++ ++ if (rwlock_type == PTHREAD_RWLOCK_PREFER_READER_NP or ++ rwlock_type == PTHREAD_RWLOCK_PREFER_WRITER_NP): ++ # This is a known bug. Using PTHREAD_RWLOCK_PREFER_WRITER_NP will ++ # still make the rwlock prefer readers. ++ self.values.append(('Prefers', 'Readers')) ++ elif rwlock_type == PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP: ++ self.values.append(('Prefers', 'Writers')) ++ ++def register(objfile): ++ """Register the pretty printers within the given objfile.""" ++ ++ printer = gdb.printing.RegexpCollectionPrettyPrinter('glibc-pthread-locks') ++ ++ printer.add_printer('pthread_mutex_t', r'^pthread_mutex_t$', ++ MutexPrinter) ++ printer.add_printer('pthread_mutexattr_t', r'^pthread_mutexattr_t$', ++ MutexAttributesPrinter) ++ printer.add_printer('pthread_cond_t', r'^pthread_cond_t$', ++ ConditionVariablePrinter) ++ printer.add_printer('pthread_condattr_t', r'^pthread_condattr_t$', ++ ConditionVariableAttributesPrinter) ++ printer.add_printer('pthread_rwlock_t', r'^pthread_rwlock_t$', ++ RWLockPrinter) ++ printer.add_printer('pthread_rwlockattr_t', r'^pthread_rwlockattr_t$', ++ RWLockAttributesPrinter) ++ ++ if objfile == None: ++ objfile = gdb ++ ++ gdb.printing.register_pretty_printer(objfile, printer) ++ ++register(gdb.current_objfile()) +diff --git a/nptl/nptl_lock_constants.pysym b/nptl/nptl_lock_constants.pysym +new file mode 100644 +index 0000000..303ec61 +--- /dev/null ++++ b/nptl/nptl_lock_constants.pysym +@@ -0,0 +1,75 @@ ++#include ++ ++-- Mutex types ++PTHREAD_MUTEX_KIND_MASK PTHREAD_MUTEX_KIND_MASK_NP ++PTHREAD_MUTEX_NORMAL ++PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP ++PTHREAD_MUTEX_ERRORCHECK PTHREAD_MUTEX_ERRORCHECK_NP ++PTHREAD_MUTEX_ADAPTIVE_NP ++ ++-- Mutex status ++-- These are hardcoded all over the code; there are no enums/macros for them. ++PTHREAD_MUTEX_DESTROYED -1 ++PTHREAD_MUTEX_UNLOCKED 0 ++PTHREAD_MUTEX_LOCKED_NO_WAITERS 1 ++ ++-- For robust mutexes ++PTHREAD_MUTEX_INCONSISTENT ++PTHREAD_MUTEX_NOTRECOVERABLE ++FUTEX_OWNER_DIED ++ ++-- For robust and PI mutexes ++FUTEX_WAITERS ++FUTEX_TID_MASK ++ ++-- Mutex attributes ++PTHREAD_MUTEX_ROBUST_NORMAL_NP ++PTHREAD_MUTEX_PRIO_INHERIT_NP ++PTHREAD_MUTEX_PRIO_PROTECT_NP ++PTHREAD_MUTEX_PSHARED_BIT ++PTHREAD_MUTEX_PRIO_CEILING_SHIFT ++PTHREAD_MUTEX_PRIO_CEILING_MASK ++ ++-- Mutex attribute flags ++PTHREAD_MUTEXATTR_PROTOCOL_SHIFT ++PTHREAD_MUTEXATTR_PROTOCOL_MASK ++PTHREAD_MUTEXATTR_PRIO_CEILING_MASK ++PTHREAD_MUTEXATTR_FLAG_ROBUST ++PTHREAD_MUTEXATTR_FLAG_PSHARED ++PTHREAD_MUTEXATTR_FLAG_BITS ++PTHREAD_MUTEX_NO_ELISION_NP ++ ++-- Priority protocols ++PTHREAD_PRIO_NONE ++PTHREAD_PRIO_INHERIT ++PTHREAD_PRIO_PROTECT ++ ++-- These values are hardcoded as well: ++-- Value of __mutex for shared condvars. ++PTHREAD_COND_SHARED (void *)~0l ++ ++-- Value of __total_seq for destroyed condvars. ++PTHREAD_COND_DESTROYED -1ull ++ ++-- __nwaiters encodes the number of threads waiting on a condvar ++-- and the clock ID. ++-- __nwaiters >> COND_NWAITERS_SHIFT gives us the number of waiters. ++COND_NWAITERS_SHIFT ++ ++-- Condvar clock IDs ++CLOCK_REALTIME ++CLOCK_MONOTONIC ++CLOCK_PROCESS_CPUTIME_ID ++CLOCK_THREAD_CPUTIME_ID ++CLOCK_MONOTONIC_RAW ++CLOCK_REALTIME_COARSE ++CLOCK_MONOTONIC_COARSE ++ ++-- Rwlock attributes ++PTHREAD_RWLOCK_PREFER_READER_NP ++PTHREAD_RWLOCK_PREFER_WRITER_NP ++PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP ++ ++-- 'Shared' attribute values ++PTHREAD_PROCESS_PRIVATE ++PTHREAD_PROCESS_SHARED +diff --git a/nptl/test-cond-printers.c b/nptl/test-cond-printers.c +new file mode 100644 +index 0000000..0f2a5f4 +--- /dev/null ++++ b/nptl/test-cond-printers.c +@@ -0,0 +1,57 @@ ++/* Helper program for testing the pthread_cond_t pretty printer. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++ ++static int test_status_destroyed (pthread_cond_t *condvar); ++ ++int ++main (void) ++{ ++ pthread_cond_t condvar; ++ pthread_condattr_t attr; ++ int result = FAIL; ++ ++ if (pthread_condattr_init (&attr) == 0 ++ && test_status_destroyed (&condvar) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_cond* functions failed. */ ++ ++ return result; ++} ++ ++/* Initializes CONDVAR, then destroys it. */ ++static int ++test_status_destroyed (pthread_cond_t *condvar) ++{ ++ int result = FAIL; ++ ++ if (pthread_cond_init (condvar, NULL) == 0 ++ && pthread_cond_destroy (condvar) == 0) ++ result = PASS; /* Test status (destroyed). */ ++ ++ return result; ++} +diff --git a/nptl/test-cond-printers.py b/nptl/test-cond-printers.py +new file mode 100644 +index 0000000..af0e12e +--- /dev/null ++++ b/nptl/test-cond-printers.py +@@ -0,0 +1,50 @@ ++# Common tests for the ConditionVariablePrinter class. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ var = 'condvar' ++ to_string = 'pthread_cond_t' ++ ++ break_at(test_source, 'Test status (destroyed)') ++ continue_cmd() # Go to test_status_destroyed ++ test_printer(var, to_string, {'Status': 'Destroyed'}) ++ ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/nptl/test-condattr-printers.c b/nptl/test-condattr-printers.c +new file mode 100644 +index 0000000..4db4098 +--- /dev/null ++++ b/nptl/test-condattr-printers.c +@@ -0,0 +1,94 @@ ++/* Helper program for testing the pthread_cond_t and pthread_condattr_t ++ pretty printers. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++ ++static int condvar_reinit (pthread_cond_t *condvar, ++ const pthread_condattr_t *attr); ++static int test_setclock (pthread_cond_t *condvar, pthread_condattr_t *attr); ++static int test_setpshared (pthread_cond_t *condvar, pthread_condattr_t *attr); ++ ++/* Need these so we don't have lines longer than 79 chars. */ ++#define SET_SHARED(attr, shared) pthread_condattr_setpshared (attr, shared) ++ ++int ++main (void) ++{ ++ pthread_cond_t condvar; ++ pthread_condattr_t attr; ++ int result = FAIL; ++ ++ if (pthread_condattr_init (&attr) == 0 ++ && pthread_cond_init (&condvar, NULL) == 0 ++ && test_setclock (&condvar, &attr) == PASS ++ && test_setpshared (&condvar, &attr) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_cond* functions failed. */ ++ ++ return result; ++} ++ ++/* Destroys CONDVAR and re-initializes it using ATTR. */ ++static int ++condvar_reinit (pthread_cond_t *condvar, const pthread_condattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_cond_destroy (condvar) == 0 ++ && pthread_cond_init (condvar, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting the clock ID attribute. */ ++static int ++test_setclock (pthread_cond_t *condvar, pthread_condattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_condattr_setclock (attr, CLOCK_REALTIME) == 0 /* Set clock. */ ++ && condvar_reinit (condvar, attr) == PASS) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting whether the condvar can be shared between processes. */ ++static int ++test_setpshared (pthread_cond_t *condvar, pthread_condattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */ ++ && condvar_reinit (condvar, attr) == PASS ++ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0 ++ && condvar_reinit (condvar, attr) == PASS) ++ result = PASS; ++ ++ return result; ++} +diff --git a/nptl/test-condattr-printers.py b/nptl/test-condattr-printers.py +new file mode 100644 +index 0000000..7ea01db +--- /dev/null ++++ b/nptl/test-condattr-printers.py +@@ -0,0 +1,71 @@ ++# Common tests for the ConditionVariablePrinter and ++# ConditionVariableAttributesPrinter classes. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ check_debug_symbol('struct pthread_condattr') ++ ++ condvar_var = 'condvar' ++ condvar_to_string = 'pthread_cond_t' ++ ++ attr_var = 'attr' ++ attr_to_string = 'pthread_condattr_t' ++ ++ break_at(test_source, 'Set clock') ++ continue_cmd() # Go to test_setclock ++ next_cmd(2) ++ test_printer(condvar_var, condvar_to_string, {'Clock ID': 'CLOCK_REALTIME'}) ++ test_printer(attr_var, attr_to_string, {'Clock ID': 'CLOCK_REALTIME'}) ++ ++ break_at(test_source, 'Set shared') ++ continue_cmd() # Go to test_setpshared ++ next_cmd(2) ++ test_printer(condvar_var, condvar_to_string, {'Shared': 'Yes'}) ++ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'}) ++ next_cmd(2) ++ test_printer(condvar_var, condvar_to_string, {'Shared': 'No'}) ++ test_printer(attr_var, attr_to_string, {'Shared': 'No'}) ++ ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++except DebugError as exception: ++ print(exception) ++ result = UNSUPPORTED ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/nptl/test-mutex-printers.c b/nptl/test-mutex-printers.c +new file mode 100644 +index 0000000..b973e82 +--- /dev/null ++++ b/nptl/test-mutex-printers.c +@@ -0,0 +1,151 @@ ++/* Helper program for testing the pthread_mutex_t pretty printer. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++#include ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++ ++static int test_status_destroyed (pthread_mutex_t *mutex); ++static int test_status_no_robust (pthread_mutex_t *mutex, ++ pthread_mutexattr_t *attr); ++static int test_status_robust (pthread_mutex_t *mutex, ++ pthread_mutexattr_t *attr); ++static int test_locking_state_robust (pthread_mutex_t *mutex); ++static void *thread_func (void *arg); ++static int test_recursive_locks (pthread_mutex_t *mutex, ++ pthread_mutexattr_t *attr); ++ ++int ++main (void) ++{ ++ pthread_mutex_t mutex; ++ pthread_mutexattr_t attr; ++ int result = FAIL; ++ ++ if (pthread_mutexattr_init (&attr) == 0 ++ && test_status_destroyed (&mutex) == PASS ++ && test_status_no_robust (&mutex, &attr) == PASS ++ && test_status_robust (&mutex, &attr) == PASS ++ && test_recursive_locks (&mutex, &attr) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_mutex* functions failed. */ ++ ++ return result; ++} ++ ++/* Initializes MUTEX, then destroys it. */ ++static int ++test_status_destroyed (pthread_mutex_t *mutex) ++{ ++ int result = FAIL; ++ ++ if (pthread_mutex_init (mutex, NULL) == 0 ++ && pthread_mutex_destroy (mutex) == 0) ++ result = PASS; /* Test status (destroyed). */ ++ ++ return result; ++} ++ ++/* Tests locking of non-robust mutexes. */ ++static int ++test_status_no_robust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_mutexattr_setrobust (attr, PTHREAD_MUTEX_STALLED) == 0 ++ && pthread_mutex_init (mutex, attr) == 0 ++ && pthread_mutex_lock (mutex) == 0 /* Test status (non-robust). */ ++ && pthread_mutex_unlock (mutex) == 0 ++ && pthread_mutex_destroy (mutex) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests locking of robust mutexes. */ ++static int ++test_status_robust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_mutexattr_setrobust (attr, PTHREAD_MUTEX_ROBUST) == 0 ++ && pthread_mutex_init (mutex, attr) == 0 ++ && test_locking_state_robust (mutex) == PASS /* Test status (robust). */ ++ && pthread_mutex_destroy (mutex) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests locking and state corruption of robust mutexes. We'll mark it as ++ inconsistent, then not recoverable. */ ++static int ++test_locking_state_robust (pthread_mutex_t *mutex) ++{ ++ int result = FAIL; ++ pthread_t thread; ++ ++ if (pthread_create (&thread, NULL, thread_func, mutex) == 0 /* Create. */ ++ && pthread_join (thread, NULL) == 0 ++ && pthread_mutex_lock (mutex) == EOWNERDEAD /* Test locking (robust). */ ++ && pthread_mutex_unlock (mutex) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Function to be called by the child thread when testing robust mutexes. */ ++static void * ++thread_func (void *arg) ++{ ++ pthread_mutex_t *mutex = (pthread_mutex_t *)arg; ++ ++ if (pthread_mutex_lock (mutex) != 0) /* Thread function. */ ++ exit (FAIL); ++ ++ /* Thread terminates without unlocking the mutex, thus marking it as ++ inconsistent. */ ++ return NULL; ++} ++ ++/* Tests locking the mutex multiple times in a row. */ ++static int ++test_recursive_locks (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_mutexattr_settype (attr, PTHREAD_MUTEX_RECURSIVE) == 0 ++ && pthread_mutex_init (mutex, attr) == 0 ++ && pthread_mutex_lock (mutex) == 0 ++ && pthread_mutex_lock (mutex) == 0 ++ && pthread_mutex_lock (mutex) == 0 /* Test recursive locks. */ ++ && pthread_mutex_unlock (mutex) == 0 ++ && pthread_mutex_unlock (mutex) == 0 ++ && pthread_mutex_unlock (mutex) == 0 ++ && pthread_mutex_destroy (mutex) == 0) ++ result = PASS; ++ ++ return result; ++} +diff --git a/nptl/test-mutex-printers.py b/nptl/test-mutex-printers.py +new file mode 100644 +index 0000000..7f542ad +--- /dev/null ++++ b/nptl/test-mutex-printers.py +@@ -0,0 +1,97 @@ ++# Tests for the MutexPrinter class. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ var = 'mutex' ++ to_string = 'pthread_mutex_t' ++ ++ break_at(test_source, 'Test status (destroyed)') ++ continue_cmd() # Go to test_status_destroyed ++ test_printer(var, to_string, {'Status': 'Destroyed'}) ++ ++ break_at(test_source, 'Test status (non-robust)') ++ continue_cmd() # Go to test_status_no_robust ++ test_printer(var, to_string, {'Status': 'Unlocked'}) ++ next_cmd() ++ thread_id = get_current_thread_lwpid() ++ test_printer(var, to_string, {'Status': 'Locked, possibly with no waiters', ++ 'Owner ID': thread_id}) ++ ++ break_at(test_source, 'Test status (robust)') ++ continue_cmd() # Go to test_status_robust ++ test_printer(var, to_string, {'Status': 'Unlocked'}) ++ ++ # We'll now test the robust mutex locking states. We'll create a new ++ # thread that will lock a robust mutex and exit without unlocking it. ++ break_at(test_source, 'Create') ++ continue_cmd() # Go to test_locking_state_robust ++ # Set a breakpoint for the new thread to hit. ++ break_at(test_source, 'Thread function') ++ continue_cmd() ++ # By now the new thread is created and has hit its breakpoint. ++ set_scheduler_locking(True) ++ parent = 1 ++ child = 2 ++ select_thread(child) ++ child_id = get_current_thread_lwpid() ++ # We've got the new thread's ID. ++ select_thread(parent) ++ # Make the new thread finish its function while we wait. ++ continue_cmd(thread=child) ++ # The new thread should be dead by now. ++ break_at(test_source, 'Test locking (robust)') ++ continue_cmd() ++ test_printer(var, to_string, {'Owner ID': r'{0} \(dead\)'.format(child_id)}) ++ # Try to lock and unlock the mutex. ++ next_cmd() ++ test_printer(var, to_string, {'Owner ID': thread_id, ++ 'State protected by this mutex': 'Inconsistent'}) ++ next_cmd() ++ test_printer(var, to_string, {'Status': 'Unlocked', ++ 'State protected by this mutex': 'Not recoverable'}) ++ set_scheduler_locking(False) ++ ++ break_at(test_source, 'Test recursive locks') ++ continue_cmd() # Go to test_recursive_locks ++ test_printer(var, to_string, {'Times locked recursively': '2'}) ++ next_cmd() ++ test_printer(var, to_string, {'Times locked recursively': '3'}) ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/nptl/test-mutexattr-printers.c b/nptl/test-mutexattr-printers.c +new file mode 100644 +index 0000000..9ecfff7 +--- /dev/null ++++ b/nptl/test-mutexattr-printers.c +@@ -0,0 +1,144 @@ ++/* Helper program for testing the pthread_mutex_t and pthread_mutexattr_t ++ pretty printers. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++#define PRIOCEILING 42 ++ ++/* Need these so we don't have lines longer than 79 chars. */ ++#define SET_TYPE(attr, type) pthread_mutexattr_settype (attr, type) ++#define SET_ROBUST(attr, robust) pthread_mutexattr_setrobust (attr, robust) ++#define SET_SHARED(attr, shared) pthread_mutexattr_setpshared (attr, shared) ++#define SET_PROTOCOL(attr, protocol) \ ++ pthread_mutexattr_setprotocol (attr, protocol) ++#define SET_PRIOCEILING(mutex, prioceiling, old_ceiling) \ ++ pthread_mutex_setprioceiling (mutex, prioceiling, old_ceiling) ++ ++static int mutex_reinit (pthread_mutex_t *mutex, ++ const pthread_mutexattr_t *attr); ++static int test_settype (pthread_mutex_t *mutex, pthread_mutexattr_t *attr); ++static int test_setrobust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr); ++static int test_setpshared (pthread_mutex_t *mutex, pthread_mutexattr_t *attr); ++static int test_setprotocol (pthread_mutex_t *mutex, ++ pthread_mutexattr_t *attr); ++ ++int ++main (void) ++{ ++ pthread_mutex_t mutex; ++ pthread_mutexattr_t attr; ++ int result = FAIL; ++ ++ if (pthread_mutexattr_init (&attr) == 0 ++ && pthread_mutex_init (&mutex, NULL) == 0 ++ && test_settype (&mutex, &attr) == PASS ++ && test_setrobust (&mutex, &attr) == PASS ++ && test_setpshared (&mutex, &attr) == PASS ++ && test_setprotocol (&mutex, &attr) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_mutex* functions failed. */ ++ ++ return result; ++} ++ ++/* Destroys MUTEX and re-initializes it using ATTR. */ ++static int ++mutex_reinit (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_mutex_destroy (mutex) == 0 ++ && pthread_mutex_init (mutex, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting the mutex type. */ ++static int ++test_settype (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_TYPE (attr, PTHREAD_MUTEX_ERRORCHECK) == 0 /* Set type. */ ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_TYPE (attr, PTHREAD_MUTEX_RECURSIVE) == 0 ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_TYPE (attr, PTHREAD_MUTEX_NORMAL) == 0 ++ && mutex_reinit (mutex, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting whether the mutex is robust. */ ++static int ++test_setrobust (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_ROBUST (attr, PTHREAD_MUTEX_ROBUST) == 0 /* Set robust. */ ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_ROBUST (attr, PTHREAD_MUTEX_STALLED) == 0 ++ && mutex_reinit (mutex, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting whether the mutex can be shared between processes. */ ++static int ++test_setpshared (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */ ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0 ++ && mutex_reinit (mutex, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting the mutex protocol and, for Priority Protect, the Priority ++ Ceiling. */ ++static int ++test_setprotocol (pthread_mutex_t *mutex, pthread_mutexattr_t *attr) ++{ ++ int result = FAIL; ++ int old_prioceiling; ++ ++ if (SET_PROTOCOL (attr, PTHREAD_PRIO_INHERIT) == 0 /* Set protocol. */ ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_PROTOCOL (attr, PTHREAD_PRIO_PROTECT) == 0 ++ && mutex_reinit (mutex, attr) == 0 ++ && SET_PRIOCEILING(mutex, PRIOCEILING, &old_prioceiling) == 0 ++ && SET_PROTOCOL (attr, PTHREAD_PRIO_NONE) == 0 ++ && mutex_reinit (mutex, attr) == 0) ++ result = PASS; ++ ++ return result; ++} +diff --git a/nptl/test-mutexattr-printers.py b/nptl/test-mutexattr-printers.py +new file mode 100644 +index 0000000..4464723 +--- /dev/null ++++ b/nptl/test-mutexattr-printers.py +@@ -0,0 +1,101 @@ ++# Common tests for the MutexPrinter and MutexAttributesPrinter classes. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++PRIOCEILING = 42 ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ check_debug_symbol('struct pthread_mutexattr') ++ ++ mutex_var = 'mutex' ++ mutex_to_string = 'pthread_mutex_t' ++ ++ attr_var = 'attr' ++ attr_to_string = 'pthread_mutexattr_t' ++ ++ break_at(test_source, 'Set type') ++ continue_cmd() # Go to test_settype ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Type': 'Error check'}) ++ test_printer(mutex_var, mutex_to_string, {'Type': 'Error check'}) ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Type': 'Recursive'}) ++ test_printer(mutex_var, mutex_to_string, {'Type': 'Recursive'}) ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Type': 'Normal'}) ++ test_printer(mutex_var, mutex_to_string, {'Type': 'Normal'}) ++ ++ break_at(test_source, 'Set robust') ++ continue_cmd() # Go to test_setrobust ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Robust': 'Yes'}) ++ test_printer(mutex_var, mutex_to_string, {'Robust': 'Yes'}) ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Robust': 'No'}) ++ test_printer(mutex_var, mutex_to_string, {'Robust': 'No'}) ++ ++ break_at(test_source, 'Set shared') ++ continue_cmd() # Go to test_setpshared ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'}) ++ test_printer(mutex_var, mutex_to_string, {'Shared': 'Yes'}) ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Shared': 'No'}) ++ test_printer(mutex_var, mutex_to_string, {'Shared': 'No'}) ++ ++ break_at(test_source, 'Set protocol') ++ continue_cmd() # Go to test_setprotocol ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Protocol': 'Priority inherit'}) ++ test_printer(mutex_var, mutex_to_string, {'Protocol': 'Priority inherit'}) ++ next_cmd(2) ++ test_printer(attr_var, attr_to_string, {'Protocol': 'Priority protect'}) ++ test_printer(mutex_var, mutex_to_string, {'Protocol': 'Priority protect'}) ++ next_cmd(2) ++ test_printer(mutex_var, mutex_to_string, {'Priority ceiling': ++ str(PRIOCEILING)}) ++ next_cmd() ++ test_printer(attr_var, attr_to_string, {'Protocol': 'None'}) ++ test_printer(mutex_var, mutex_to_string, {'Protocol': 'None'}) ++ ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++except DebugError as exception: ++ print(exception) ++ result = UNSUPPORTED ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/nptl/test-rwlock-printers.c b/nptl/test-rwlock-printers.c +new file mode 100644 +index 0000000..dbbe9b8 +--- /dev/null ++++ b/nptl/test-rwlock-printers.c +@@ -0,0 +1,78 @@ ++/* Helper program for testing the pthread_rwlock_t pretty printer. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++ ++static int test_locking_reader (pthread_rwlock_t *rwlock); ++static int test_locking_writer (pthread_rwlock_t *rwlock); ++ ++int ++main (void) ++{ ++ pthread_rwlock_t rwlock; ++ ++ int result = FAIL; ++ ++ if (test_locking_reader (&rwlock) == PASS ++ && test_locking_writer (&rwlock) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_rwlock* functions failed. */ ++ ++ return result; ++} ++ ++/* Tests locking the rwlock multiple times as a reader. */ ++static int ++test_locking_reader (pthread_rwlock_t *rwlock) ++{ ++ int result = FAIL; ++ ++ if (pthread_rwlock_init (rwlock, NULL) == 0 ++ && pthread_rwlock_rdlock (rwlock) == 0 /* Test locking (reader). */ ++ && pthread_rwlock_rdlock (rwlock) == 0 ++ && pthread_rwlock_rdlock (rwlock) == 0 ++ && pthread_rwlock_unlock (rwlock) == 0 ++ && pthread_rwlock_unlock (rwlock) == 0 ++ && pthread_rwlock_unlock (rwlock) == 0 ++ && pthread_rwlock_destroy (rwlock) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests locking the rwlock as a writer. */ ++static int ++test_locking_writer (pthread_rwlock_t *rwlock) ++{ ++ int result = FAIL; ++ ++ if (pthread_rwlock_init (rwlock, NULL) == 0 ++ && pthread_rwlock_wrlock (rwlock) == 0 /* Test locking (writer). */ ++ && pthread_rwlock_unlock (rwlock) == 0 ++ && pthread_rwlock_destroy (rwlock) == 0) ++ result = PASS; ++ ++ return result; ++} +diff --git a/nptl/test-rwlock-printers.py b/nptl/test-rwlock-printers.py +new file mode 100644 +index 0000000..b972fa6 +--- /dev/null ++++ b/nptl/test-rwlock-printers.py +@@ -0,0 +1,64 @@ ++# Common tests for the RWLockPrinter class. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ var = 'rwlock' ++ to_string = 'pthread_rwlock_t' ++ ++ break_at(test_source, 'Test locking (reader)') ++ continue_cmd() # Go to test_locking_reader ++ test_printer(var, to_string, {'Status': 'Unlocked'}) ++ next_cmd() ++ test_printer(var, to_string, {'Status': r'Locked \(Read\)', 'Readers': '1'}) ++ next_cmd() ++ test_printer(var, to_string, {'Readers': '2'}) ++ next_cmd() ++ test_printer(var, to_string, {'Readers': '3'}) ++ ++ break_at(test_source, 'Test locking (writer)') ++ continue_cmd() # Go to test_locking_writer ++ test_printer(var, to_string, {'Status': 'Unlocked'}) ++ next_cmd() ++ thread_id = get_current_thread_lwpid() ++ test_printer(var, to_string, {'Status': r'Locked \(Write\)', ++ 'Writer ID': thread_id}) ++ ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/nptl/test-rwlockattr-printers.c b/nptl/test-rwlockattr-printers.c +new file mode 100644 +index 0000000..d12facf +--- /dev/null ++++ b/nptl/test-rwlockattr-printers.c +@@ -0,0 +1,98 @@ ++/* Helper program for testing the pthread_rwlock_t and pthread_rwlockattr_t ++ pretty printers. ++ ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++/* Keep the calls to the pthread_* functions on separate lines to make it easy ++ to advance through the program using the gdb 'next' command. */ ++ ++#include ++ ++#define PASS 0 ++#define FAIL 1 ++ ++/* Need these so we don't have lines longer than 79 chars. */ ++#define SET_KIND(attr, kind) pthread_rwlockattr_setkind_np (attr, kind) ++#define SET_SHARED(attr, shared) pthread_rwlockattr_setpshared (attr, shared) ++ ++static int rwlock_reinit (pthread_rwlock_t *rwlock, ++ const pthread_rwlockattr_t *attr); ++static int test_setkind_np (pthread_rwlock_t *rwlock, ++ pthread_rwlockattr_t *attr); ++static int test_setpshared (pthread_rwlock_t *rwlock, ++ pthread_rwlockattr_t *attr); ++ ++int ++main (void) ++{ ++ pthread_rwlock_t rwlock; ++ pthread_rwlockattr_t attr; ++ int result = FAIL; ++ ++ if (pthread_rwlockattr_init (&attr) == 0 ++ && pthread_rwlock_init (&rwlock, NULL) == 0 ++ && test_setkind_np (&rwlock, &attr) == PASS ++ && test_setpshared (&rwlock, &attr) == PASS) ++ result = PASS; ++ /* Else, one of the pthread_rwlock* functions failed. */ ++ ++ return result; ++} ++ ++/* Destroys RWLOCK and re-initializes it using ATTR. */ ++static int ++rwlock_reinit (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (pthread_rwlock_destroy (rwlock) == 0 ++ && pthread_rwlock_init (rwlock, attr) == 0) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting whether the rwlock prefers readers or writers. */ ++static int ++test_setkind_np (pthread_rwlock_t *rwlock, pthread_rwlockattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_KIND (attr, PTHREAD_RWLOCK_PREFER_READER_NP) == 0 /* Set kind. */ ++ && rwlock_reinit (rwlock, attr) == PASS ++ && SET_KIND (attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) == 0 ++ && rwlock_reinit (rwlock, attr) == PASS) ++ result = PASS; ++ ++ return result; ++} ++ ++/* Tests setting whether the rwlock can be shared between processes. */ ++static int ++test_setpshared (pthread_rwlock_t *rwlock, pthread_rwlockattr_t *attr) ++{ ++ int result = FAIL; ++ ++ if (SET_SHARED (attr, PTHREAD_PROCESS_SHARED) == 0 /* Set shared. */ ++ && rwlock_reinit (rwlock, attr) == PASS ++ && SET_SHARED (attr, PTHREAD_PROCESS_PRIVATE) == 0 ++ && rwlock_reinit (rwlock, attr) == PASS) ++ result = PASS; ++ ++ return result; ++} +diff --git a/nptl/test-rwlockattr-printers.py b/nptl/test-rwlockattr-printers.py +new file mode 100644 +index 0000000..1ca2dc6 +--- /dev/null ++++ b/nptl/test-rwlockattr-printers.py +@@ -0,0 +1,73 @@ ++# Common tests for the RWLockPrinter and RWLockAttributesPrinter classes. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++import sys ++ ++from test_printers_common import * ++ ++test_source = sys.argv[1] ++test_bin = sys.argv[2] ++printer_files = sys.argv[3:] ++printer_names = ['global glibc-pthread-locks'] ++ ++try: ++ init_test(test_bin, printer_files, printer_names) ++ go_to_main() ++ ++ check_debug_symbol('struct pthread_rwlockattr') ++ ++ rwlock_var = 'rwlock' ++ rwlock_to_string = 'pthread_rwlock_t' ++ ++ attr_var = 'attr' ++ attr_to_string = 'pthread_rwlockattr_t' ++ ++ break_at(test_source, 'Set kind') ++ continue_cmd() # Go to test_setkind_np ++ next_cmd(2) ++ test_printer(rwlock_var, rwlock_to_string, {'Prefers': 'Readers'}) ++ test_printer(attr_var, attr_to_string, {'Prefers': 'Readers'}) ++ next_cmd(2) ++ test_printer(rwlock_var, rwlock_to_string, {'Prefers': 'Writers'}) ++ test_printer(attr_var, attr_to_string, {'Prefers': 'Writers'}) ++ ++ break_at(test_source, 'Set shared') ++ continue_cmd() # Go to test_setpshared ++ next_cmd(2) ++ test_printer(rwlock_var, rwlock_to_string, {'Shared': 'Yes'}) ++ test_printer(attr_var, attr_to_string, {'Shared': 'Yes'}) ++ next_cmd(2) ++ test_printer(rwlock_var, rwlock_to_string, {'Shared': 'No'}) ++ test_printer(attr_var, attr_to_string, {'Shared': 'No'}) ++ ++ continue_cmd() # Exit ++ ++except (NoLineError, pexpect.TIMEOUT) as exception: ++ print('Error: {0}'.format(exception)) ++ result = FAIL ++ ++except DebugError as exception: ++ print(exception) ++ result = UNSUPPORTED ++ ++else: ++ print('Test succeeded.') ++ result = PASS ++ ++exit(result) +diff --git a/scripts/gen-py-const.awk b/scripts/gen-py-const.awk +new file mode 100644 +index 0000000..4586f59 +--- /dev/null ++++ b/scripts/gen-py-const.awk +@@ -0,0 +1,118 @@ ++# Script to generate constants for Python pretty printers. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++# This script is a smaller version of the clever gen-asm-const.awk hack used to ++# generate ASM constants from .sym files. We'll use this to generate constants ++# for Python pretty printers. ++# ++# The input to this script are .pysym files that look like: ++# #C_Preprocessor_Directive... ++# NAME1 ++# NAME2 expression... ++# ++# A line giving just a name implies an expression consisting of just that name. ++# Comments start with '--'. ++# ++# The output of this script is a 'dummy' function containing 'asm' declarations ++# for each non-preprocessor line in the .pysym file. The expression values ++# will appear as input operands to the 'asm' declaration. For example, if we ++# have: ++# ++# /* header.h */ ++# #define MACRO 42 ++# ++# struct S { ++# char c1; ++# char c2; ++# char c3; ++# }; ++# ++# enum E { ++# ZERO, ++# ONE ++# }; ++# ++# /* symbols.pysym */ ++# #include ++# #include "header.h" ++# -- This is a comment ++# MACRO ++# C3_OFFSET offsetof(struct S, c3) ++# E_ONE ONE ++# ++# the output will be: ++# ++# #include ++# #include "header.h" ++# void dummy(void) ++# { ++# asm ("@name@MACRO@value@%0@" : : "i" (MACRO)); ++# asm ("@name@C3_OFFSET@value@%0@" : : "i" (offsetof(struct S, c3))); ++# asm ("@name@E_ONE@value@%0@" : : "i" (ONE)); ++# } ++# ++# We'll later feed this output to gcc -S. Since '-S' tells gcc to compile but ++# not assemble, gcc will output something like: ++# ++# dummy: ++# ... ++# @name@MACRO@value@$42@ ++# @name@C3_OFFSET@value@$2@ ++# @name@E_ONE@value@$1@ ++# ++# Finally, we can process that output to extract the constant values. ++# Notice gcc may prepend a special character such as '$' to each value. ++ ++# found_symbol indicates whether we found a non-comment, non-preprocessor line. ++BEGIN { found_symbol = 0 } ++ ++# C preprocessor directives go straight through. ++/^#/ { print; next; } ++ ++# Skip comments. ++/--/ { next; } ++ ++# Trim leading whitespace. ++{ sub(/^[[:blank:]]*/, ""); } ++ ++# If we found a non-comment, non-preprocessor line, print the 'dummy' function ++# header. ++NF > 0 && !found_symbol { ++ print "void dummy(void)\n{"; ++ found_symbol = 1; ++} ++ ++# If the line contains just a name, duplicate it so we can use that name ++# as the value of the expression. ++NF == 1 { sub(/^.*$/, "& &"); } ++ ++# If a line contains a name and an expression... ++NF > 1 { ++ name = $1; ++ ++ # Remove any characters before the second field. ++ sub(/^[^[:blank:]]+[[:blank:]]+/, ""); ++ ++ # '$0' ends up being everything that appeared after the first field ++ # separator. ++ printf " asm (\"@name@%s@value@%0@\" : : \"i\" (%s));\n", name, $0; ++} ++ ++# Close the 'dummy' function. ++END { if (found_symbol) print "}"; } +diff --git a/scripts/test_printers_common.py b/scripts/test_printers_common.py +new file mode 100644 +index 0000000..c79d7e3 +--- /dev/null ++++ b/scripts/test_printers_common.py +@@ -0,0 +1,364 @@ ++# Common functions and variables for testing the Python pretty printers. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++"""These tests require PExpect 4.0 or newer. ++ ++Exported constants: ++ PASS, FAIL, UNSUPPORTED (int): Test exit codes, as per evaluate-test.sh. ++""" ++ ++import os ++import re ++from test_printers_exceptions import * ++ ++PASS = 0 ++FAIL = 1 ++UNSUPPORTED = 77 ++ ++gdb_bin = 'gdb' ++gdb_options = '-q -nx' ++gdb_invocation = '{0} {1}'.format(gdb_bin, gdb_options) ++pexpect_min_version = 4 ++gdb_min_version = (7, 8) ++encoding = 'utf-8' ++ ++try: ++ import pexpect ++except ImportError: ++ print('PExpect 4.0 or newer must be installed to test the pretty printers.') ++ exit(UNSUPPORTED) ++ ++pexpect_version = pexpect.__version__.split('.')[0] ++ ++if int(pexpect_version) < pexpect_min_version: ++ print('PExpect 4.0 or newer must be installed to test the pretty printers.') ++ exit(UNSUPPORTED) ++ ++if not pexpect.which(gdb_bin): ++ print('gdb 7.8 or newer must be installed to test the pretty printers.') ++ exit(UNSUPPORTED) ++ ++timeout = 5 ++TIMEOUTFACTOR = os.environ.get('TIMEOUTFACTOR') ++ ++if TIMEOUTFACTOR: ++ timeout = int(TIMEOUTFACTOR) ++ ++try: ++ # Check the gdb version. ++ version_cmd = '{0} --version'.format(gdb_invocation, timeout=timeout) ++ gdb_version_out = pexpect.run(version_cmd, encoding=encoding) ++ ++ # The gdb version string is "GNU gdb ", where ++ # PKGVERSION can be any text. We assume that there'll always be a space ++ # between PKGVERSION and the version number for the sake of the regexp. ++ version_match = re.search(r'GNU gdb .* ([1-9]+)\.([0-9]+)', gdb_version_out) ++ ++ if not version_match: ++ print('The gdb version string (gdb -v) is incorrectly formatted.') ++ exit(UNSUPPORTED) ++ ++ gdb_version = (int(version_match.group(1)), int(version_match.group(2))) ++ ++ if gdb_version < gdb_min_version: ++ print('gdb 7.8 or newer must be installed to test the pretty printers.') ++ exit(UNSUPPORTED) ++ ++ # Check if gdb supports Python. ++ gdb_python_cmd = '{0} -ex "python import os" -batch'.format(gdb_invocation, ++ timeout=timeout) ++ gdb_python_error = pexpect.run(gdb_python_cmd, encoding=encoding) ++ ++ if gdb_python_error: ++ print('gdb must have python support to test the pretty printers.') ++ exit(UNSUPPORTED) ++ ++ # If everything's ok, spawn the gdb process we'll use for testing. ++ gdb = pexpect.spawn(gdb_invocation, echo=False, timeout=timeout, ++ encoding=encoding) ++ gdb_prompt = u'\(gdb\)' ++ gdb.expect(gdb_prompt) ++ ++except pexpect.ExceptionPexpect as exception: ++ print('Error: {0}'.format(exception)) ++ exit(FAIL) ++ ++def test(command, pattern=None): ++ """Sends 'command' to gdb and expects the given 'pattern'. ++ ++ If 'pattern' is None, simply consumes everything up to and including ++ the gdb prompt. ++ ++ Args: ++ command (string): The command we'll send to gdb. ++ pattern (raw string): A pattern the gdb output should match. ++ ++ Returns: ++ string: The string that matched 'pattern', or an empty string if ++ 'pattern' was None. ++ """ ++ ++ match = '' ++ ++ gdb.sendline(command) ++ ++ if pattern: ++ # PExpect does a non-greedy match for '+' and '*'. Since it can't look ++ # ahead on the gdb output stream, if 'pattern' ends with a '+' or a '*' ++ # we may end up matching only part of the required output. ++ # To avoid this, we'll consume 'pattern' and anything that follows it ++ # up to and including the gdb prompt, then extract 'pattern' later. ++ index = gdb.expect([u'{0}.+{1}'.format(pattern, gdb_prompt), ++ pexpect.TIMEOUT]) ++ ++ if index == 0: ++ # gdb.after now contains the whole match. Extract the text that ++ # matches 'pattern'. ++ match = re.match(pattern, gdb.after, re.DOTALL).group() ++ elif index == 1: ++ # We got a timeout exception. Print information on what caused it ++ # and bail out. ++ error = ('Response does not match the expected pattern.\n' ++ 'Command: {0}\n' ++ 'Expected pattern: {1}\n' ++ 'Response: {2}'.format(command, pattern, gdb.before)) ++ ++ raise pexpect.TIMEOUT(error) ++ else: ++ # Consume just the the gdb prompt. ++ gdb.expect(gdb_prompt) ++ ++ return match ++ ++def init_test(test_bin, printer_files, printer_names): ++ """Loads the test binary file and the required pretty printers to gdb. ++ ++ Args: ++ test_bin (string): The name of the test binary file. ++ pretty_printers (list of strings): A list with the names of the pretty ++ printer files. ++ """ ++ ++ # Load all the pretty printer files. We're assuming these are safe. ++ for printer_file in printer_files: ++ test('source {0}'.format(printer_file)) ++ ++ # Disable all the pretty printers. ++ test('disable pretty-printer', r'0 of [0-9]+ printers enabled') ++ ++ # Enable only the required printers. ++ for printer in printer_names: ++ test('enable pretty-printer {0}'.format(printer), ++ r'[1-9][0-9]* of [1-9]+ printers enabled') ++ ++ # Finally, load the test binary. ++ test('file {0}'.format(test_bin)) ++ ++def go_to_main(): ++ """Executes a gdb 'start' command, which takes us to main.""" ++ ++ test('start', r'main') ++ ++def get_line_number(file_name, string): ++ """Returns the number of the line in which 'string' appears within a file. ++ ++ Args: ++ file_name (string): The name of the file we'll search through. ++ string (string): The string we'll look for. ++ ++ Returns: ++ int: The number of the line in which 'string' appears, starting from 1. ++ """ ++ number = -1 ++ ++ with open(file_name) as src_file: ++ for i, line in enumerate(src_file): ++ if string in line: ++ number = i + 1 ++ break ++ ++ if number == -1: ++ raise NoLineError(file_name, string) ++ ++ return number ++ ++def break_at(file_name, string, temporary=True, thread=None): ++ """Places a breakpoint on the first line in 'file_name' containing 'string'. ++ ++ 'string' is usually a comment like "Stop here". Notice this may fail unless ++ the comment is placed inline next to actual code, e.g.: ++ ++ ... ++ /* Stop here */ ++ ... ++ ++ may fail, while: ++ ++ ... ++ some_func(); /* Stop here */ ++ ... ++ ++ will succeed. ++ ++ If 'thread' isn't None, the breakpoint will be set for all the threads. ++ Otherwise, it'll be set only for 'thread'. ++ ++ Args: ++ file_name (string): The name of the file we'll place the breakpoint in. ++ string (string): A string we'll look for inside the file. ++ We'll place a breakpoint on the line which contains it. ++ temporary (bool): Whether the breakpoint should be automatically deleted ++ after we reach it. ++ thread (int): The number of the thread we'll place the breakpoint for, ++ as seen by gdb. If specified, it should be greater than zero. ++ """ ++ ++ if not thread: ++ thread_str = '' ++ else: ++ thread_str = 'thread {0}'.format(thread) ++ ++ if temporary: ++ command = 'tbreak' ++ break_type = 'Temporary breakpoint' ++ else: ++ command = 'break' ++ break_type = 'Breakpoint' ++ ++ line_number = str(get_line_number(file_name, string)) ++ ++ test('{0} {1}:{2} {3}'.format(command, file_name, line_number, thread_str), ++ r'{0} [0-9]+ at 0x[a-f0-9]+: file {1}, line {2}\.'.format(break_type, ++ file_name, ++ line_number)) ++ ++def continue_cmd(thread=None): ++ """Executes a gdb 'continue' command. ++ ++ If 'thread' isn't None, the command will be applied to all the threads. ++ Otherwise, it'll be applied only to 'thread'. ++ ++ Args: ++ thread (int): The number of the thread we'll apply the command to, ++ as seen by gdb. If specified, it should be greater than zero. ++ """ ++ ++ if not thread: ++ command = 'continue' ++ else: ++ command = 'thread apply {0} continue'.format(thread) ++ ++ test(command) ++ ++def next_cmd(count=1, thread=None): ++ """Executes a gdb 'next' command. ++ ++ If 'thread' isn't None, the command will be applied to all the threads. ++ Otherwise, it'll be applied only to 'thread'. ++ ++ Args: ++ count (int): The 'count' argument of the 'next' command. ++ thread (int): The number of the thread we'll apply the command to, ++ as seen by gdb. If specified, it should be greater than zero. ++ """ ++ ++ if not thread: ++ command = 'next' ++ else: ++ command = 'thread apply {0} next' ++ ++ test('{0} {1}'.format(command, count)) ++ ++def select_thread(thread): ++ """Selects the thread indicated by 'thread'. ++ ++ Args: ++ thread (int): The number of the thread we'll switch to, as seen by gdb. ++ This should be greater than zero. ++ """ ++ ++ if thread > 0: ++ test('thread {0}'.format(thread)) ++ ++def get_current_thread_lwpid(): ++ """Gets the current thread's Lightweight Process ID. ++ ++ Returns: ++ string: The current thread's LWP ID. ++ """ ++ ++ # It's easier to get the LWP ID through the Python API than the gdb CLI. ++ command = 'python print(gdb.selected_thread().ptid[1])' ++ ++ return test(command, r'[0-9]+') ++ ++def set_scheduler_locking(mode): ++ """Executes the gdb 'set scheduler-locking' command. ++ ++ Args: ++ mode (bool): Whether the scheduler locking mode should be 'on'. ++ """ ++ modes = { ++ True: 'on', ++ False: 'off' ++ } ++ ++ test('set scheduler-locking {0}'.format(modes[mode])) ++ ++def test_printer(var, to_string, children=None, is_ptr=True): ++ """ Tests the output of a pretty printer. ++ ++ For a variable called 'var', this tests whether its associated printer ++ outputs the expected 'to_string' and children (if any). ++ ++ Args: ++ var (string): The name of the variable we'll print. ++ to_string (raw string): The expected output of the printer's 'to_string' ++ method. ++ children (map {raw string->raw string}): A map with the expected output ++ of the printer's children' method. ++ is_ptr (bool): Whether 'var' is a pointer, and thus should be ++ dereferenced. ++ """ ++ ++ if is_ptr: ++ var = '*{0}'.format(var) ++ ++ test('print {0}'.format(var), to_string) ++ ++ if children: ++ for name, value in children.items(): ++ # Children are shown as 'name = value'. ++ test('print {0}'.format(var), r'{0} = {1}'.format(name, value)) ++ ++def check_debug_symbol(symbol): ++ """ Tests whether a given debugging symbol exists. ++ ++ If the symbol doesn't exist, raises a DebugError. ++ ++ Args: ++ symbol (string): The symbol we're going to check for. ++ """ ++ ++ try: ++ test('ptype {0}'.format(symbol), r'type = {0}'.format(symbol)) ++ ++ except pexpect.TIMEOUT: ++ # The symbol doesn't exist. ++ raise DebugError(symbol) +diff --git a/scripts/test_printers_exceptions.py b/scripts/test_printers_exceptions.py +new file mode 100644 +index 0000000..17034b5 +--- /dev/null ++++ b/scripts/test_printers_exceptions.py +@@ -0,0 +1,61 @@ ++# Exception classes used when testing the Python pretty printers. ++# ++# Copyright (C) 2016 Free Software Foundation, Inc. ++# 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 ++# . ++ ++class NoLineError(Exception): ++ """Custom exception to indicate that a test file doesn't contain ++ the requested string. ++ """ ++ ++ def __init__(self, file_name, string): ++ """Constructor. ++ ++ Args: ++ file_name (string): The name of the test file. ++ string (string): The string that was requested. ++ """ ++ ++ super(NoLineError, self).__init__() ++ self.file_name = file_name ++ self.string = string ++ ++ def __str__(self): ++ """Shows a readable representation of the exception.""" ++ ++ return ('File {0} has no line containing the following string: {1}' ++ .format(self.file_name, self.string)) ++ ++class DebugError(Exception): ++ """Custom exception to indicate that a required debugging symbol is missing. ++ """ ++ ++ def __init__(self, symbol): ++ """Constructor. ++ ++ Args: ++ symbol (string): The name of the entity whose debug info is missing. ++ """ ++ ++ super(DebugError, self).__init__() ++ self.symbol = symbol ++ ++ def __str__(self): ++ """Shows a readable representation of the exception.""" ++ ++ return ('The required debugging information for {0} is missing.' ++ .format(self.symbol)) +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch b/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch new file mode 100644 index 0000000000..3c7bfa160f --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0004-New-condvar-implementation-that-provides-stronger-or.patch @@ -0,0 +1,7171 @@ +From 27af8689a6ba8d182f3cbe6ba42cc654ceed0351 Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 30 Jun 2017 11:56:41 +0300 +Subject: [PATCH 4/6] New condvar implementation that provides stronger + ordering guarantees. + +This is a new implementation for condition variables, required +after http://austingroupbugs.net/view.php?id=609 to fix bug 13165. In +essence, we need to be stricter in which waiters a signal or broadcast +is required to wake up; this couldn't be solved using the old algorithm. +ISO C++ made a similar clarification, so this also fixes a bug in +current libstdc++, for example. + +We can't use the old algorithm anymore because futexes do not guarantee +to wake in FIFO order. Thus, when we wake, we can't simply let any +waiter grab a signal, but we need to ensure that one of the waiters +happening before the signal is woken up. This is something the previous +algorithm violated (see bug 13165). + +There's another issue specific to condvars: ABA issues on the underlying +futexes. Unlike mutexes that have just three states, or semaphores that +have no tokens or a limited number of them, the state of a condvar is +the *order* of the waiters. A waiter on a semaphore can grab a token +whenever one is available; a condvar waiter must only consume a signal +if it is eligible to do so as determined by the relative order of the +waiter and the signal. +Therefore, this new algorithm maintains two groups of waiters: Those +eligible to consume signals (G1), and those that have to wait until +previous waiters have consumed signals (G2). Once G1 is empty, G2 +becomes the new G1. 64b counters are used to avoid ABA issues. + +This condvar doesn't yet use a requeue optimization (ie, on a broadcast, +waking just one thread and requeueing all others on the futex of the +mutex supplied by the program). I don't think doing the requeue is +necessarily the right approach (but I haven't done real measurements +yet): +* If a program expects to wake many threads at the same time and make +that scalable, a condvar isn't great anyway because of how it requires +waiters to operate mutually exclusive (due to the mutex usage). Thus, a +thundering herd problem is a scalability problem with or without the +optimization. Using something like a semaphore might be more +appropriate in such a case. +* The scalability problem is actually at the mutex side; the condvar +could help (and it tries to with the requeue optimization), but it +should be the mutex who decides how that is done, and whether it is done +at all. +* Forcing all but one waiter into the kernel-side wait queue of the +mutex prevents/avoids the use of lock elision on the mutex. Thus, it +prevents the only cure against the underlying scalability problem +inherent to condvars. +* If condvars use short critical sections (ie, hold the mutex just to +check a binary flag or such), which they should do ideally, then forcing +all those waiter to proceed serially with kernel-based hand-off (ie, +futex ops in the mutex' contended state, via the futex wait queues) will +be less efficient than just letting a scalable mutex implementation take +care of it. Our current mutex impl doesn't employ spinning at all, but +if critical sections are short, spinning can be much better. +* Doing the requeue stuff requires all waiters to always drive the mutex +into the contended state. This leads to each waiter having to call +futex_wake after lock release, even if this wouldn't be necessary. + + [BZ #13165] + * nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast): Rewrite to + use new algorithm. + * nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise. + * nptl/pthread_cond_init.c (__pthread_cond_init): Likewise. + * nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise. + * nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise. + (__pthread_cond_timedwait): Move here from pthread_cond_timedwait.c. + (__condvar_confirm_wakeup, __condvar_cancel_waiting, + __condvar_cleanup_waiting, __condvar_dec_grefs, + __pthread_cond_wait_common): New. + (__condvar_cleanup): Remove. + * npt/pthread_condattr_getclock.c (pthread_condattr_getclock): Adapt. + * npt/pthread_condattr_setclock.c (pthread_condattr_setclock): + Likewise. + * npt/pthread_condattr_getpshared.c (pthread_condattr_getpshared): + Likewise. + * npt/pthread_condattr_init.c (pthread_condattr_init): Likewise. + * nptl/tst-cond1.c: Add comment. + * nptl/tst-cond20.c (do_test): Adapt. + * nptl/tst-cond22.c (do_test): Likewise. + * sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt + structure. + * sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_cond_t): + Likewise. + * sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_cond_t): + Likewise. + * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_cond_t): + Likewise. + * sysdeps/x86/bits/pthreadtypes.h (pthread_cond_t): Likewise. + * sysdeps/nptl/internaltypes.h (COND_NWAITERS_SHIFT): Remove. + (COND_CLOCK_BITS): Adapt. + * sysdeps/nptl/pthread.h (PTHREAD_COND_INITIALIZER): Adapt. + * nptl/pthreadP.h (__PTHREAD_COND_CLOCK_MONOTONIC_MASK, + __PTHREAD_COND_SHARED_MASK): New. + * nptl/nptl-printers.py (CLOCK_IDS): Remove. + (ConditionVariablePrinter, ConditionVariableAttributesPrinter): Adapt. + * nptl/nptl_lock_constants.pysym: Adapt. + * nptl/test-cond-printers.py: Adapt. + * sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear, + cond_compat_check_and_clear): Adapt. + * sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c: Remove file ... + * sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c + (__pthread_cond_timedwait): ... and move here. + * nptl/DESIGN-condvar.txt: Remove file. + * nptl/lowlevelcond.sym: Likewise. + * nptl/pthread_cond_timedwait.c: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise. + * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise. + +Upstream-Status: Backport + +Author: Torvald Riegel +Signed-off-by: Catalin Enache +--- + ChangeLog | 74 ++ + nptl/DESIGN-condvar.txt | 134 --- + nptl/Makefile | 6 +- + nptl/lowlevelcond.sym | 16 - + nptl/nptl-printers.py | 70 +- + nptl/nptl_lock_constants.pysym | 27 +- + nptl/pthreadP.h | 7 + + nptl/pthread_cond_broadcast.c | 99 ++- + nptl/pthread_cond_common.c | 466 ++++++++++ + nptl/pthread_cond_destroy.c | 82 +- + nptl/pthread_cond_init.c | 28 +- + nptl/pthread_cond_signal.c | 99 ++- + nptl/pthread_cond_timedwait.c | 268 ------ + nptl/pthread_cond_wait.c | 754 ++++++++++++---- + nptl/pthread_condattr_getclock.c | 2 +- + nptl/pthread_condattr_getpshared.c | 3 +- + nptl/pthread_condattr_init.c | 4 +- + nptl/pthread_condattr_setclock.c | 11 +- + nptl/test-cond-printers.py | 2 +- + nptl/tst-cond1.c | 3 + + nptl/tst-cond20.c | 5 +- + nptl/tst-cond22.c | 18 +- + sysdeps/aarch64/nptl/bits/pthreadtypes.h | 31 +- + sysdeps/arm/nptl/bits/pthreadtypes.h | 29 +- + sysdeps/ia64/nptl/bits/pthreadtypes.h | 31 +- + sysdeps/m68k/nptl/bits/pthreadtypes.h | 32 +- + sysdeps/microblaze/nptl/bits/pthreadtypes.h | 29 +- + sysdeps/mips/nptl/bits/pthreadtypes.h | 31 +- + sysdeps/nios2/nptl/bits/pthreadtypes.h | 31 +- + sysdeps/nptl/internaltypes.h | 17 +- + sysdeps/nptl/pthread.h | 2 +- + sysdeps/s390/nptl/bits/pthreadtypes.h | 29 +- + sysdeps/sh/nptl/bits/pthreadtypes.h | 29 +- + sysdeps/tile/nptl/bits/pthreadtypes.h | 29 +- + sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h | 31 +- + sysdeps/unix/sysv/linux/hppa/internaltypes.h | 40 +- + .../unix/sysv/linux/hppa/pthread_cond_timedwait.c | 41 - + sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c | 13 + + .../sysv/linux/i386/i686/pthread_cond_timedwait.S | 20 - + .../unix/sysv/linux/i386/pthread_cond_broadcast.S | 241 ----- + sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S | 216 ----- + .../unix/sysv/linux/i386/pthread_cond_timedwait.S | 974 --------------------- + sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S | 642 -------------- + .../unix/sysv/linux/powerpc/bits/pthreadtypes.h | 31 +- + .../sysv/linux/x86_64/pthread_cond_broadcast.S | 177 ---- + .../unix/sysv/linux/x86_64/pthread_cond_signal.S | 161 ---- + .../sysv/linux/x86_64/pthread_cond_timedwait.S | 623 ------------- + sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S | 555 ------------ + sysdeps/x86/bits/pthreadtypes.h | 29 +- + 49 files changed, 1671 insertions(+), 4621 deletions(-) + delete mode 100644 nptl/DESIGN-condvar.txt + delete mode 100644 nptl/lowlevelcond.sym + create mode 100644 nptl/pthread_cond_common.c + delete mode 100644 nptl/pthread_cond_timedwait.c + delete mode 100644 sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c + delete mode 100644 sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S + delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S + delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S + delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S + delete mode 100644 sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S + delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S + delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S + delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S + delete mode 100644 sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S + +diff --git a/ChangeLog b/ChangeLog +index 8036c1e..c94db7b 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,77 @@ ++2016-12-31 Torvald Riegel ++ ++ [BZ #13165] ++ * nptl/pthread_cond_broadcast.c (__pthread_cond_broadcast): Rewrite to ++ use new algorithm. ++ * nptl/pthread_cond_destroy.c (__pthread_cond_destroy): Likewise. ++ * nptl/pthread_cond_init.c (__pthread_cond_init): Likewise. ++ * nptl/pthread_cond_signal.c (__pthread_cond_signal): Likewise. ++ * nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise. ++ (__pthread_cond_timedwait): Move here from pthread_cond_timedwait.c. ++ (__condvar_confirm_wakeup, __condvar_cancel_waiting, ++ __condvar_cleanup_waiting, __condvar_dec_grefs, ++ __pthread_cond_wait_common): New. ++ (__condvar_cleanup): Remove. ++ * npt/pthread_condattr_getclock.c (pthread_condattr_getclock): Adapt. ++ * npt/pthread_condattr_setclock.c (pthread_condattr_setclock): ++ Likewise. ++ * npt/pthread_condattr_getpshared.c (pthread_condattr_getpshared): ++ Likewise. ++ * npt/pthread_condattr_init.c (pthread_condattr_init): Likewise. ++ * nptl/tst-cond1.c: Add comment. ++ * nptl/tst-cond20.c (do_test): Adapt. ++ * nptl/tst-cond22.c (do_test): Likewise. ++ * sysdeps/aarch64/nptl/bits/pthreadtypes.h (pthread_cond_t): Adapt ++ structure. ++ * sysdeps/arm/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/ia64/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/m68k/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/microblaze/nptl/bits/pthreadtypes.h (pthread_cond_t): ++ Likewise. ++ * sysdeps/mips/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/nios2/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/s390/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/sh/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/tile/nptl/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h (pthread_cond_t): ++ Likewise. ++ * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h (pthread_cond_t): ++ Likewise. ++ * sysdeps/x86/bits/pthreadtypes.h (pthread_cond_t): Likewise. ++ * sysdeps/nptl/internaltypes.h (COND_NWAITERS_SHIFT): Remove. ++ (COND_CLOCK_BITS): Adapt. ++ * sysdeps/nptl/pthread.h (PTHREAD_COND_INITIALIZER): Adapt. ++ * nptl/pthreadP.h (__PTHREAD_COND_CLOCK_MONOTONIC_MASK, ++ __PTHREAD_COND_SHARED_MASK): New. ++ * nptl/nptl-printers.py (CLOCK_IDS): Remove. ++ (ConditionVariablePrinter, ConditionVariableAttributesPrinter): Adapt. ++ * nptl/nptl_lock_constants.pysym: Adapt. ++ * nptl/test-cond-printers.py: Adapt. ++ * sysdeps/unix/sysv/linux/hppa/internaltypes.h (cond_compat_clear, ++ cond_compat_check_and_clear): Adapt. ++ * sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c: Remove file ... ++ * sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c ++ (__pthread_cond_timedwait): ... and move here. ++ * nptl/DESIGN-condvar.txt: Remove file. ++ * nptl/lowlevelcond.sym: Likewise. ++ * nptl/pthread_cond_timedwait.c: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Likewise. ++ * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise. ++ * sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise. ++ + 2016-12-08 Martin Galvan + + * INSTALL: Regenerated. +diff --git a/nptl/DESIGN-condvar.txt b/nptl/DESIGN-condvar.txt +deleted file mode 100644 +index 4845251..0000000 +--- a/nptl/DESIGN-condvar.txt ++++ /dev/null +@@ -1,134 +0,0 @@ +-Conditional Variable pseudocode. +-================================ +- +- int pthread_cond_timedwait (pthread_cond_t *cv, pthread_mutex_t *mutex); +- int pthread_cond_signal (pthread_cond_t *cv); +- int pthread_cond_broadcast (pthread_cond_t *cv); +- +-struct pthread_cond_t { +- +- unsigned int cond_lock; +- +- internal mutex +- +- uint64_t total_seq; +- +- Total number of threads using the conditional variable. +- +- uint64_t wakeup_seq; +- +- sequence number for next wakeup. +- +- uint64_t woken_seq; +- +- sequence number of last woken thread. +- +- uint32_t broadcast_seq; +- +-} +- +- +-struct cv_data { +- +- pthread_cond_t *cv; +- +- uint32_t bc_seq +- +-} +- +- +- +-cleanup_handler(cv_data) +-{ +- cv = cv_data->cv; +- lll_lock(cv->lock); +- +- if (cv_data->bc_seq == cv->broadcast_seq) { +- ++cv->wakeup_seq; +- ++cv->woken_seq; +- } +- +- /* make sure no signal gets lost. */ +- FUTEX_WAKE(cv->wakeup_seq, ALL); +- +- lll_unlock(cv->lock); +-} +- +- +-cond_timedwait(cv, mutex, timeout): +-{ +- lll_lock(cv->lock); +- mutex_unlock(mutex); +- +- cleanup_push +- +- ++cv->total_seq; +- val = seq = cv->wakeup_seq; +- cv_data.bc = cv->broadcast_seq; +- cv_data.cv = cv; +- +- while (1) { +- +- lll_unlock(cv->lock); +- +- enable_async(&cv_data); +- +- ret = FUTEX_WAIT(cv->wakeup_seq, val, timeout); +- +- restore_async +- +- lll_lock(cv->lock); +- +- if (bc != cv->broadcast_seq) +- goto bc_out; +- +- val = cv->wakeup_seq; +- +- if (val != seq && cv->woken_seq != val) { +- ret = 0; +- break; +- } +- +- if (ret == TIMEDOUT) { +- ++cv->wakeup_seq; +- break; +- } +- } +- +- ++cv->woken_seq; +- +- bc_out: +- lll_unlock(cv->lock); +- +- cleanup_pop +- +- mutex_lock(mutex); +- +- return ret; +-} +- +-cond_signal(cv) +-{ +- lll_lock(cv->lock); +- +- if (cv->total_seq > cv->wakeup_seq) { +- ++cv->wakeup_seq; +- FUTEX_WAKE(cv->wakeup_seq, 1); +- } +- +- lll_unlock(cv->lock); +-} +- +-cond_broadcast(cv) +-{ +- lll_lock(cv->lock); +- +- if (cv->total_seq > cv->wakeup_seq) { +- cv->wakeup_seq = cv->total_seq; +- cv->woken_seq = cv->total_seq; +- ++cv->broadcast_seq; +- FUTEX_WAKE(cv->wakeup_seq, ALL); +- } +- +- lll_unlock(cv->lock); +-} +diff --git a/nptl/Makefile b/nptl/Makefile +index 49f6ba6..1f0674c 100644 +--- a/nptl/Makefile ++++ b/nptl/Makefile +@@ -71,7 +71,7 @@ libpthread-routines = nptl-init vars events version pt-interp \ + pthread_rwlockattr_getkind_np \ + pthread_rwlockattr_setkind_np \ + pthread_cond_init pthread_cond_destroy \ +- pthread_cond_wait pthread_cond_timedwait \ ++ pthread_cond_wait \ + pthread_cond_signal pthread_cond_broadcast \ + old_pthread_cond_init old_pthread_cond_destroy \ + old_pthread_cond_wait old_pthread_cond_timedwait \ +@@ -181,7 +181,6 @@ CFLAGS-pthread_timedjoin.c = -fexceptions -fasynchronous-unwind-tables + CFLAGS-pthread_once.c = $(uses-callbacks) -fexceptions \ + -fasynchronous-unwind-tables + CFLAGS-pthread_cond_wait.c = -fexceptions -fasynchronous-unwind-tables +-CFLAGS-pthread_cond_timedwait.c = -fexceptions -fasynchronous-unwind-tables + CFLAGS-sem_wait.c = -fexceptions -fasynchronous-unwind-tables + CFLAGS-sem_timedwait.c = -fexceptions -fasynchronous-unwind-tables + +@@ -303,8 +302,7 @@ test-xfail-tst-once5 = yes + # Files which must not be linked with libpthread. + tests-nolibpthread = tst-unload + +-gen-as-const-headers = pthread-errnos.sym \ +- lowlevelcond.sym lowlevelrwlock.sym \ ++gen-as-const-headers = pthread-errnos.sym lowlevelrwlock.sym \ + unwindbuf.sym \ + lowlevelrobustlock.sym pthread-pi-defines.sym + +diff --git a/nptl/lowlevelcond.sym b/nptl/lowlevelcond.sym +deleted file mode 100644 +index 18e1ada..0000000 +--- a/nptl/lowlevelcond.sym ++++ /dev/null +@@ -1,16 +0,0 @@ +-#include +-#include +-#include +-#include +- +--- +- +-cond_lock offsetof (pthread_cond_t, __data.__lock) +-cond_futex offsetof (pthread_cond_t, __data.__futex) +-cond_nwaiters offsetof (pthread_cond_t, __data.__nwaiters) +-total_seq offsetof (pthread_cond_t, __data.__total_seq) +-wakeup_seq offsetof (pthread_cond_t, __data.__wakeup_seq) +-woken_seq offsetof (pthread_cond_t, __data.__woken_seq) +-dep_mutex offsetof (pthread_cond_t, __data.__mutex) +-broadcast_seq offsetof (pthread_cond_t, __data.__broadcast_seq) +-nwaiters_shift COND_NWAITERS_SHIFT +diff --git a/nptl/nptl-printers.py b/nptl/nptl-printers.py +index e402f23..76adadd 100644 +--- a/nptl/nptl-printers.py ++++ b/nptl/nptl-printers.py +@@ -293,16 +293,6 @@ class MutexAttributesPrinter(object): + elif protocol == PTHREAD_PRIO_PROTECT: + self.values.append(('Protocol', 'Priority protect')) + +-CLOCK_IDS = { +- CLOCK_REALTIME: 'CLOCK_REALTIME', +- CLOCK_MONOTONIC: 'CLOCK_MONOTONIC', +- CLOCK_PROCESS_CPUTIME_ID: 'CLOCK_PROCESS_CPUTIME_ID', +- CLOCK_THREAD_CPUTIME_ID: 'CLOCK_THREAD_CPUTIME_ID', +- CLOCK_MONOTONIC_RAW: 'CLOCK_MONOTONIC_RAW', +- CLOCK_REALTIME_COARSE: 'CLOCK_REALTIME_COARSE', +- CLOCK_MONOTONIC_COARSE: 'CLOCK_MONOTONIC_COARSE' +-} +- + class ConditionVariablePrinter(object): + """Pretty printer for pthread_cond_t.""" + +@@ -313,24 +303,8 @@ class ConditionVariablePrinter(object): + cond: A gdb.value representing a pthread_cond_t. + """ + +- # Since PTHREAD_COND_SHARED is an integer, we need to cast it to void * +- # to be able to compare it to the condvar's __data.__mutex member. +- # +- # While it looks like self.shared_value should be a class variable, +- # that would result in it having an incorrect size if we're loading +- # these printers through .gdbinit for a 64-bit objfile in AMD64. +- # This is because gdb initially assumes the pointer size to be 4 bytes, +- # and only sets it to 8 after loading the 64-bit objfiles. Since +- # .gdbinit runs before any objfiles are loaded, this would effectively +- # make self.shared_value have a size of 4, thus breaking later +- # comparisons with pointers whose types are looked up at runtime. +- void_ptr_type = gdb.lookup_type('void').pointer() +- self.shared_value = gdb.Value(PTHREAD_COND_SHARED).cast(void_ptr_type) +- + data = cond['__data'] +- self.total_seq = data['__total_seq'] +- self.mutex = data['__mutex'] +- self.nwaiters = data['__nwaiters'] ++ self.wrefs = data['__wrefs'] + self.values = [] + + self.read_values() +@@ -360,7 +334,6 @@ class ConditionVariablePrinter(object): + + self.read_status() + self.read_attributes() +- self.read_mutex_info() + + def read_status(self): + """Read the status of the condvar. +@@ -369,41 +342,22 @@ class ConditionVariablePrinter(object): + are waiting for it. + """ + +- if self.total_seq == PTHREAD_COND_DESTROYED: +- self.values.append(('Status', 'Destroyed')) +- +- self.values.append(('Threads waiting for this condvar', +- self.nwaiters >> COND_NWAITERS_SHIFT)) ++ self.values.append(('Threads known to still execute a wait function', ++ self.wrefs >> PTHREAD_COND_WREFS_SHIFT)) + + def read_attributes(self): + """Read the condvar's attributes.""" + +- clock_id = self.nwaiters & ((1 << COND_NWAITERS_SHIFT) - 1) +- +- # clock_id must be casted to int because it's a gdb.Value +- self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)])) ++ if (self.wrefs & PTHREAD_COND_CLOCK_MONOTONIC_MASK) != 0: ++ self.values.append(('Clock ID', 'CLOCK_MONOTONIC')) ++ else: ++ self.values.append(('Clock ID', 'CLOCK_REALTIME')) + +- shared = (self.mutex == self.shared_value) +- +- if shared: ++ if (self.wrefs & PTHREAD_COND_SHARED_MASK) != 0: + self.values.append(('Shared', 'Yes')) + else: + self.values.append(('Shared', 'No')) + +- def read_mutex_info(self): +- """Read the data of the mutex this condvar is bound to. +- +- A pthread_cond_t's __data.__mutex member is a void * which +- must be casted to pthread_mutex_t *. For shared condvars, this +- member isn't recorded and has a special value instead. +- """ +- +- if self.mutex and self.mutex != self.shared_value: +- mutex_type = gdb.lookup_type('pthread_mutex_t') +- mutex = self.mutex.cast(mutex_type.pointer()).dereference() +- +- self.values.append(('Mutex', mutex)) +- + class ConditionVariableAttributesPrinter(object): + """Pretty printer for pthread_condattr_t. + +@@ -453,10 +407,12 @@ class ConditionVariableAttributesPrinter(object): + created in self.children. + """ + +- clock_id = self.condattr & ((1 << COND_NWAITERS_SHIFT) - 1) ++ clock_id = (self.condattr >> 1) & ((1 << COND_CLOCK_BITS) - 1) + +- # clock_id must be casted to int because it's a gdb.Value +- self.values.append(('Clock ID', CLOCK_IDS[int(clock_id)])) ++ if clock_id != 0: ++ self.values.append(('Clock ID', 'CLOCK_MONOTONIC')) ++ else: ++ self.values.append(('Clock ID', 'CLOCK_REALTIME')) + + if self.condattr & 1: + self.values.append(('Shared', 'Yes')) +diff --git a/nptl/nptl_lock_constants.pysym b/nptl/nptl_lock_constants.pysym +index 303ec61..2ab3179 100644 +--- a/nptl/nptl_lock_constants.pysym ++++ b/nptl/nptl_lock_constants.pysym +@@ -44,26 +44,13 @@ PTHREAD_PRIO_NONE + PTHREAD_PRIO_INHERIT + PTHREAD_PRIO_PROTECT + +--- These values are hardcoded as well: +--- Value of __mutex for shared condvars. +-PTHREAD_COND_SHARED (void *)~0l +- +--- Value of __total_seq for destroyed condvars. +-PTHREAD_COND_DESTROYED -1ull +- +--- __nwaiters encodes the number of threads waiting on a condvar +--- and the clock ID. +--- __nwaiters >> COND_NWAITERS_SHIFT gives us the number of waiters. +-COND_NWAITERS_SHIFT +- +--- Condvar clock IDs +-CLOCK_REALTIME +-CLOCK_MONOTONIC +-CLOCK_PROCESS_CPUTIME_ID +-CLOCK_THREAD_CPUTIME_ID +-CLOCK_MONOTONIC_RAW +-CLOCK_REALTIME_COARSE +-CLOCK_MONOTONIC_COARSE ++-- Condition variable ++-- FIXME Why do macros prefixed with __ cannot be used directly? ++PTHREAD_COND_SHARED_MASK __PTHREAD_COND_SHARED_MASK ++PTHREAD_COND_CLOCK_MONOTONIC_MASK __PTHREAD_COND_CLOCK_MONOTONIC_MASK ++COND_CLOCK_BITS ++-- These values are hardcoded: ++PTHREAD_COND_WREFS_SHIFT 3 + + -- Rwlock attributes + PTHREAD_RWLOCK_PREFER_READER_NP +diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h +index 4edc74b..e9992bc 100644 +--- a/nptl/pthreadP.h ++++ b/nptl/pthreadP.h +@@ -167,6 +167,13 @@ enum + #define __PTHREAD_ONCE_FORK_GEN_INCR 4 + + ++/* Condition variable definitions. See __pthread_cond_wait_common. ++ Need to be defined here so there is one place from which ++ nptl_lock_constants can grab them. */ ++#define __PTHREAD_COND_CLOCK_MONOTONIC_MASK 2 ++#define __PTHREAD_COND_SHARED_MASK 1 ++ ++ + /* Internal variables. */ + + +diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c +index 552fd42..87c0755 100644 +--- a/nptl/pthread_cond_broadcast.c ++++ b/nptl/pthread_cond_broadcast.c +@@ -19,72 +19,71 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include ++#include + + #include +-#include + ++#include "pthread_cond_common.c" + ++ ++/* We do the following steps from __pthread_cond_signal in one critical ++ section: (1) signal all waiters in G1, (2) close G1 so that it can become ++ the new G2 and make G2 the new G1, and (3) signal all waiters in the new ++ G1. We don't need to do all these steps if there are no waiters in G1 ++ and/or G2. See __pthread_cond_signal for further details. */ + int + __pthread_cond_broadcast (pthread_cond_t *cond) + { + LIBC_PROBE (cond_broadcast, 1, cond); + +- int pshared = (cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; +- /* Make sure we are alone. */ +- lll_lock (cond->__data.__lock, pshared); ++ unsigned int wrefs = atomic_load_relaxed (&cond->__data.__wrefs); ++ if (wrefs >> 3 == 0) ++ return 0; ++ int private = __condvar_get_private (wrefs); ++ ++ __condvar_acquire_lock (cond, private); + +- /* Are there any waiters to be woken? */ +- if (cond->__data.__total_seq > cond->__data.__wakeup_seq) ++ unsigned long long int wseq = __condvar_load_wseq_relaxed (cond); ++ unsigned int g2 = wseq & 1; ++ unsigned int g1 = g2 ^ 1; ++ wseq >>= 1; ++ bool do_futex_wake = false; ++ ++ /* Step (1): signal all waiters remaining in G1. */ ++ if (cond->__data.__g_size[g1] != 0) + { +- /* Yes. Mark them all as woken. */ +- cond->__data.__wakeup_seq = cond->__data.__total_seq; +- cond->__data.__woken_seq = cond->__data.__total_seq; +- cond->__data.__futex = (unsigned int) cond->__data.__total_seq * 2; +- int futex_val = cond->__data.__futex; +- /* Signal that a broadcast happened. */ +- ++cond->__data.__broadcast_seq; +- +- /* We are done. */ +- lll_unlock (cond->__data.__lock, pshared); +- +- /* Wake everybody. */ +- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex; +- +- /* Do not use requeue for pshared condvars. */ +- if (mut == (void *) ~0l +- || PTHREAD_MUTEX_PSHARED (mut) & PTHREAD_MUTEX_PSHARED_BIT) +- goto wake_all; +- +-#if (defined lll_futex_cmp_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- if (USE_REQUEUE_PI (mut)) +- { +- if (lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, INT_MAX, +- &mut->__data.__lock, futex_val, +- LLL_PRIVATE) == 0) +- return 0; +- } +- else +-#endif +- /* lll_futex_requeue returns 0 for success and non-zero +- for errors. */ +- if (!__builtin_expect (lll_futex_requeue (&cond->__data.__futex, 1, +- INT_MAX, &mut->__data.__lock, +- futex_val, LLL_PRIVATE), 0)) +- return 0; +- +-wake_all: +- lll_futex_wake (&cond->__data.__futex, INT_MAX, pshared); +- return 0; ++ /* Add as many signals as the remaining size of the group. */ ++ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1, ++ cond->__data.__g_size[g1] << 1); ++ cond->__data.__g_size[g1] = 0; ++ ++ /* We need to wake G1 waiters before we quiesce G1 below. */ ++ /* TODO Only set it if there are indeed futex waiters. We could ++ also try to move this out of the critical section in cases when ++ G2 is empty (and we don't need to quiesce). */ ++ futex_wake (cond->__data.__g_signals + g1, INT_MAX, private); + } + +- /* We are done. */ +- lll_unlock (cond->__data.__lock, pshared); ++ /* G1 is complete. Step (2) is next unless there are no waiters in G2, in ++ which case we can stop. */ ++ if (__condvar_quiesce_and_switch_g1 (cond, wseq, &g1, private)) ++ { ++ /* Step (3): Send signals to all waiters in the old G2 / new G1. */ ++ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1, ++ cond->__data.__g_size[g1] << 1); ++ cond->__data.__g_size[g1] = 0; ++ /* TODO Only set it if there are indeed futex waiters. */ ++ do_futex_wake = true; ++ } ++ ++ __condvar_release_lock (cond, private); ++ ++ if (do_futex_wake) ++ futex_wake (cond->__data.__g_signals + g1, INT_MAX, private); + + return 0; + } +diff --git a/nptl/pthread_cond_common.c b/nptl/pthread_cond_common.c +new file mode 100644 +index 0000000..b374396 +--- /dev/null ++++ b/nptl/pthread_cond_common.c +@@ -0,0 +1,466 @@ ++/* pthread_cond_common -- shared code for condition variable. ++ Copyright (C) 2016 Free Software Foundation, Inc. ++ 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 ++ . */ ++ ++#include ++#include ++#include ++#include ++ ++/* We need 3 least-significant bits on __wrefs for something else. */ ++#define __PTHREAD_COND_MAX_GROUP_SIZE ((unsigned) 1 << 29) ++ ++#if __HAVE_64B_ATOMICS == 1 ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_load_wseq_relaxed (pthread_cond_t *cond) ++{ ++ return atomic_load_relaxed (&cond->__data.__wseq); ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_fetch_add_wseq_acquire (pthread_cond_t *cond, unsigned int val) ++{ ++ return atomic_fetch_add_acquire (&cond->__data.__wseq, val); ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val) ++{ ++ return atomic_fetch_xor_release (&cond->__data.__wseq, val); ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_load_g1_start_relaxed (pthread_cond_t *cond) ++{ ++ return atomic_load_relaxed (&cond->__data.__g1_start); ++} ++ ++static void __attribute__ ((unused)) ++__condvar_add_g1_start_relaxed (pthread_cond_t *cond, unsigned int val) ++{ ++ atomic_store_relaxed (&cond->__data.__g1_start, ++ atomic_load_relaxed (&cond->__data.__g1_start) + val); ++} ++ ++#else ++ ++/* We use two 64b counters: __wseq and __g1_start. They are monotonically ++ increasing and single-writer-multiple-readers counters, so we can implement ++ load, fetch-and-add, and fetch-and-xor operations even when we just have ++ 32b atomics. Values we add or xor are less than or equal to 1<<31 (*), ++ so we only have to make overflow-and-addition atomic wrt. to concurrent ++ load operations and xor operations. To do that, we split each counter into ++ two 32b values of which we reserve the MSB of each to represent an ++ overflow from the lower-order half to the higher-order half. ++ ++ In the common case, the state is (higher-order / lower-order half, and . is ++ basically concatenation of the bits): ++ 0.h / 0.l = h.l ++ ++ When we add a value of x that overflows (i.e., 0.l + x == 1.L), we run the ++ following steps S1-S4 (the values these represent are on the right-hand ++ side): ++ S1: 0.h / 1.L == (h+1).L ++ S2: 1.(h+1) / 1.L == (h+1).L ++ S3: 1.(h+1) / 0.L == (h+1).L ++ S4: 0.(h+1) / 0.L == (h+1).L ++ If the LSB of the higher-order half is set, readers will ignore the ++ overflow bit in the lower-order half. ++ ++ To get an atomic snapshot in load operations, we exploit that the ++ higher-order half is monotonically increasing; if we load a value V from ++ it, then read the lower-order half, and then read the higher-order half ++ again and see the same value V, we know that both halves have existed in ++ the sequence of values the full counter had. This is similar to the ++ validated reads in the time-based STMs in GCC's libitm (e.g., ++ method_ml_wt). ++ ++ The xor operation needs to be an atomic read-modify-write. The write ++ itself is not an issue as it affects just the lower-order half but not bits ++ used in the add operation. To make the full fetch-and-xor atomic, we ++ exploit that concurrently, the value can increase by at most 1<<31 (*): The ++ xor operation is only called while having acquired the lock, so not more ++ than __PTHREAD_COND_MAX_GROUP_SIZE waiters can enter concurrently and thus ++ increment __wseq. Therefore, if the xor operation observes a value of ++ __wseq, then the value it applies the modification to later on can be ++ derived (see below). ++ ++ One benefit of this scheme is that this makes load operations ++ obstruction-free because unlike if we would just lock the counter, readers ++ can almost always interpret a snapshot of each halves. Readers can be ++ forced to read a new snapshot when the read is concurrent with an overflow. ++ However, overflows will happen infrequently, so load operations are ++ practically lock-free. ++ ++ (*) The highest value we add is __PTHREAD_COND_MAX_GROUP_SIZE << 2 to ++ __g1_start (the two extra bits are for the lock in the two LSBs of ++ __g1_start). */ ++ ++typedef struct ++{ ++ unsigned int low; ++ unsigned int high; ++} _condvar_lohi; ++ ++static uint64_t ++__condvar_fetch_add_64_relaxed (_condvar_lohi *lh, unsigned int op) ++{ ++ /* S1. Note that this is an atomic read-modify-write so it extends the ++ release sequence of release MO store at S3. */ ++ unsigned int l = atomic_fetch_add_relaxed (&lh->low, op); ++ unsigned int h = atomic_load_relaxed (&lh->high); ++ uint64_t result = ((uint64_t) h << 31) | l; ++ l += op; ++ if ((l >> 31) > 0) ++ { ++ /* Overflow. Need to increment higher-order half. Note that all ++ add operations are ordered in happens-before. */ ++ h++; ++ /* S2. Release MO to synchronize with the loads of the higher-order half ++ in the load operation. See __condvar_load_64_relaxed. */ ++ atomic_store_release (&lh->high, h | ((unsigned int) 1 << 31)); ++ l ^= (unsigned int) 1 << 31; ++ /* S3. See __condvar_load_64_relaxed. */ ++ atomic_store_release (&lh->low, l); ++ /* S4. Likewise. */ ++ atomic_store_release (&lh->high, h); ++ } ++ return result; ++} ++ ++static uint64_t ++__condvar_load_64_relaxed (_condvar_lohi *lh) ++{ ++ unsigned int h, l, h2; ++ do ++ { ++ /* This load and the second one below to the same location read from the ++ stores in the overflow handling of the add operation or the ++ initializing stores (which is a simple special case because ++ initialization always completely happens before further use). ++ Because no two stores to the higher-order half write the same value, ++ the loop ensures that if we continue to use the snapshot, this load ++ and the second one read from the same store operation. All candidate ++ store operations have release MO. ++ If we read from S2 in the first load, then we will see the value of ++ S1 on the next load (because we synchronize with S2), or a value ++ later in modification order. We correctly ignore the lower-half's ++ overflow bit in this case. If we read from S4, then we will see the ++ value of S3 in the next load (or a later value), which does not have ++ the overflow bit set anymore. ++ */ ++ h = atomic_load_acquire (&lh->high); ++ /* This will read from the release sequence of S3 (i.e, either the S3 ++ store or the read-modify-writes at S1 following S3 in modification ++ order). Thus, the read synchronizes with S3, and the following load ++ of the higher-order half will read from the matching S2 (or a later ++ value). ++ Thus, if we read a lower-half value here that already overflowed and ++ belongs to an increased higher-order half value, we will see the ++ latter and h and h2 will not be equal. */ ++ l = atomic_load_acquire (&lh->low); ++ /* See above. */ ++ h2 = atomic_load_relaxed (&lh->high); ++ } ++ while (h != h2); ++ if (((l >> 31) > 0) && ((h >> 31) > 0)) ++ l ^= (unsigned int) 1 << 31; ++ return ((uint64_t) (h & ~((unsigned int) 1 << 31)) << 31) + l; ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_load_wseq_relaxed (pthread_cond_t *cond) ++{ ++ return __condvar_load_64_relaxed ((_condvar_lohi *) &cond->__data.__wseq32); ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_fetch_add_wseq_acquire (pthread_cond_t *cond, unsigned int val) ++{ ++ uint64_t r = __condvar_fetch_add_64_relaxed ++ ((_condvar_lohi *) &cond->__data.__wseq32, val); ++ atomic_thread_fence_acquire (); ++ return r; ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_fetch_xor_wseq_release (pthread_cond_t *cond, unsigned int val) ++{ ++ _condvar_lohi *lh = (_condvar_lohi *) &cond->__data.__wseq32; ++ /* First, get the current value. See __condvar_load_64_relaxed. */ ++ unsigned int h, l, h2; ++ do ++ { ++ h = atomic_load_acquire (&lh->high); ++ l = atomic_load_acquire (&lh->low); ++ h2 = atomic_load_relaxed (&lh->high); ++ } ++ while (h != h2); ++ if (((l >> 31) > 0) && ((h >> 31) == 0)) ++ h++; ++ h &= ~((unsigned int) 1 << 31); ++ l &= ~((unsigned int) 1 << 31); ++ ++ /* Now modify. Due to the coherence rules, the prior load will read a value ++ earlier in modification order than the following fetch-xor. ++ This uses release MO to make the full operation have release semantics ++ (all other operations access the lower-order half). */ ++ unsigned int l2 = atomic_fetch_xor_release (&lh->low, val) ++ & ~((unsigned int) 1 << 31); ++ if (l2 < l) ++ /* The lower-order half overflowed in the meantime. This happened exactly ++ once due to the limit on concurrent waiters (see above). */ ++ h++; ++ return ((uint64_t) h << 31) + l2; ++} ++ ++static uint64_t __attribute__ ((unused)) ++__condvar_load_g1_start_relaxed (pthread_cond_t *cond) ++{ ++ return __condvar_load_64_relaxed ++ ((_condvar_lohi *) &cond->__data.__g1_start32); ++} ++ ++static void __attribute__ ((unused)) ++__condvar_add_g1_start_relaxed (pthread_cond_t *cond, unsigned int val) ++{ ++ ignore_value (__condvar_fetch_add_64_relaxed ++ ((_condvar_lohi *) &cond->__data.__g1_start32, val)); ++} ++ ++#endif /* !__HAVE_64B_ATOMICS */ ++ ++ ++/* The lock that signalers use. See pthread_cond_wait_common for uses. ++ The lock is our normal three-state lock: not acquired (0) / acquired (1) / ++ acquired-with-futex_wake-request (2). However, we need to preserve the ++ other bits in the unsigned int used for the lock, and therefore it is a ++ little more complex. */ ++static void __attribute__ ((unused)) ++__condvar_acquire_lock (pthread_cond_t *cond, int private) ++{ ++ unsigned int s = atomic_load_relaxed (&cond->__data.__g1_orig_size); ++ while ((s & 3) == 0) ++ { ++ if (atomic_compare_exchange_weak_acquire (&cond->__data.__g1_orig_size, ++ &s, s | 1)) ++ return; ++ /* TODO Spinning and back-off. */ ++ } ++ /* We can't change from not acquired to acquired, so try to change to ++ acquired-with-futex-wake-request and do a futex wait if we cannot change ++ from not acquired. */ ++ while (1) ++ { ++ while ((s & 3) != 2) ++ { ++ if (atomic_compare_exchange_weak_acquire ++ (&cond->__data.__g1_orig_size, &s, (s & ~(unsigned int) 3) | 2)) ++ { ++ if ((s & 3) == 0) ++ return; ++ break; ++ } ++ /* TODO Back off. */ ++ } ++ futex_wait_simple (&cond->__data.__g1_orig_size, ++ (s & ~(unsigned int) 3) | 2, private); ++ /* Reload so we see a recent value. */ ++ s = atomic_load_relaxed (&cond->__data.__g1_orig_size); ++ } ++} ++ ++/* See __condvar_acquire_lock. */ ++static void __attribute__ ((unused)) ++__condvar_release_lock (pthread_cond_t *cond, int private) ++{ ++ if ((atomic_fetch_and_release (&cond->__data.__g1_orig_size, ++ ~(unsigned int) 3) & 3) ++ == 2) ++ futex_wake (&cond->__data.__g1_orig_size, 1, private); ++} ++ ++/* Only use this when having acquired the lock. */ ++static unsigned int __attribute__ ((unused)) ++__condvar_get_orig_size (pthread_cond_t *cond) ++{ ++ return atomic_load_relaxed (&cond->__data.__g1_orig_size) >> 2; ++} ++ ++/* Only use this when having acquired the lock. */ ++static void __attribute__ ((unused)) ++__condvar_set_orig_size (pthread_cond_t *cond, unsigned int size) ++{ ++ /* We have acquired the lock, but might get one concurrent update due to a ++ lock state change from acquired to acquired-with-futex_wake-request. ++ The store with relaxed MO is fine because there will be no further ++ changes to the lock bits nor the size, and we will subsequently release ++ the lock with release MO. */ ++ unsigned int s; ++ s = (atomic_load_relaxed (&cond->__data.__g1_orig_size) & 3) ++ | (size << 2); ++ if ((atomic_exchange_relaxed (&cond->__data.__g1_orig_size, s) & 3) ++ != (s & 3)) ++ atomic_store_relaxed (&cond->__data.__g1_orig_size, (size << 2) | 2); ++} ++ ++/* Returns FUTEX_SHARED or FUTEX_PRIVATE based on the provided __wrefs ++ value. */ ++static int __attribute__ ((unused)) ++__condvar_get_private (int flags) ++{ ++ if ((flags & __PTHREAD_COND_SHARED_MASK) == 0) ++ return FUTEX_PRIVATE; ++ else ++ return FUTEX_SHARED; ++} ++ ++/* This closes G1 (whose index is in G1INDEX), waits for all futex waiters to ++ leave G1, converts G1 into a fresh G2, and then switches group roles so that ++ the former G2 becomes the new G1 ending at the current __wseq value when we ++ eventually make the switch (WSEQ is just an observation of __wseq by the ++ signaler). ++ If G2 is empty, it will not switch groups because then it would create an ++ empty G1 which would require switching groups again on the next signal. ++ Returns false iff groups were not switched because G2 was empty. */ ++static bool __attribute__ ((unused)) ++__condvar_quiesce_and_switch_g1 (pthread_cond_t *cond, uint64_t wseq, ++ unsigned int *g1index, int private) ++{ ++ const unsigned int maxspin = 0; ++ unsigned int g1 = *g1index; ++ ++ /* If there is no waiter in G2, we don't do anything. The expression may ++ look odd but remember that __g_size might hold a negative value, so ++ putting the expression this way avoids relying on implementation-defined ++ behavior. ++ Note that this works correctly for a zero-initialized condvar too. */ ++ unsigned int old_orig_size = __condvar_get_orig_size (cond); ++ uint64_t old_g1_start = __condvar_load_g1_start_relaxed (cond) >> 1; ++ if (((unsigned) (wseq - old_g1_start - old_orig_size) ++ + cond->__data.__g_size[g1 ^ 1]) == 0) ++ return false; ++ ++ /* Now try to close and quiesce G1. We have to consider the following kinds ++ of waiters: ++ * Waiters from less recent groups than G1 are not affected because ++ nothing will change for them apart from __g1_start getting larger. ++ * New waiters arriving concurrently with the group switching will all go ++ into G2 until we atomically make the switch. Waiters existing in G2 ++ are not affected. ++ * Waiters in G1 will be closed out immediately by setting a flag in ++ __g_signals, which will prevent waiters from blocking using a futex on ++ __g_signals and also notifies them that the group is closed. As a ++ result, they will eventually remove their group reference, allowing us ++ to close switch group roles. */ ++ ++ /* First, set the closed flag on __g_signals. This tells waiters that are ++ about to wait that they shouldn't do that anymore. This basically ++ serves as an advance notificaton of the upcoming change to __g1_start; ++ waiters interpret it as if __g1_start was larger than their waiter ++ sequence position. This allows us to change __g1_start after waiting ++ for all existing waiters with group references to leave, which in turn ++ makes recovery after stealing a signal simpler because it then can be ++ skipped if __g1_start indicates that the group is closed (otherwise, ++ we would have to recover always because waiters don't know how big their ++ groups are). Relaxed MO is fine. */ ++ atomic_fetch_or_relaxed (cond->__data.__g_signals + g1, 1); ++ ++ /* Wait until there are no group references anymore. The fetch-or operation ++ injects us into the modification order of __g_refs; release MO ensures ++ that waiters incrementing __g_refs after our fetch-or see the previous ++ changes to __g_signals and to __g1_start that had to happen before we can ++ switch this G1 and alias with an older group (we have two groups, so ++ aliasing requires switching group roles twice). Note that nobody else ++ can have set the wake-request flag, so we do not have to act upon it. ++ ++ Also note that it is harmless if older waiters or waiters from this G1 ++ get a group reference after we have quiesced the group because it will ++ remain closed for them either because of the closed flag in __g_signals ++ or the later update to __g1_start. New waiters will never arrive here ++ but instead continue to go into the still current G2. */ ++ unsigned r = atomic_fetch_or_release (cond->__data.__g_refs + g1, 0); ++ while ((r >> 1) > 0) ++ { ++ for (unsigned int spin = maxspin; ((r >> 1) > 0) && (spin > 0); spin--) ++ { ++ /* TODO Back off. */ ++ r = atomic_load_relaxed (cond->__data.__g_refs + g1); ++ } ++ if ((r >> 1) > 0) ++ { ++ /* There is still a waiter after spinning. Set the wake-request ++ flag and block. Relaxed MO is fine because this is just about ++ this futex word. */ ++ r = atomic_fetch_or_relaxed (cond->__data.__g_refs + g1, 1); ++ ++ if ((r >> 1) > 0) ++ futex_wait_simple (cond->__data.__g_refs + g1, r, private); ++ /* Reload here so we eventually see the most recent value even if we ++ do not spin. */ ++ r = atomic_load_relaxed (cond->__data.__g_refs + g1); ++ } ++ } ++ /* Acquire MO so that we synchronize with the release operation that waiters ++ use to decrement __g_refs and thus happen after the waiters we waited ++ for. */ ++ atomic_thread_fence_acquire (); ++ ++ /* Update __g1_start, which finishes closing this group. The value we add ++ will never be negative because old_orig_size can only be zero when we ++ switch groups the first time after a condvar was initialized, in which ++ case G1 will be at index 1 and we will add a value of 1. See above for ++ why this takes place after waiting for quiescence of the group. ++ Relaxed MO is fine because the change comes with no additional ++ constraints that others would have to observe. */ ++ __condvar_add_g1_start_relaxed (cond, ++ (old_orig_size << 1) + (g1 == 1 ? 1 : - 1)); ++ ++ /* Now reopen the group, thus enabling waiters to again block using the ++ futex controlled by __g_signals. Release MO so that observers that see ++ no signals (and thus can block) also see the write __g1_start and thus ++ that this is now a new group (see __pthread_cond_wait_common for the ++ matching acquire MO loads). */ ++ atomic_store_release (cond->__data.__g_signals + g1, 0); ++ ++ /* At this point, the old G1 is now a valid new G2 (but not in use yet). ++ No old waiter can neither grab a signal nor acquire a reference without ++ noticing that __g1_start is larger. ++ We can now publish the group switch by flipping the G2 index in __wseq. ++ Release MO so that this synchronizes with the acquire MO operation ++ waiters use to obtain a position in the waiter sequence. */ ++ wseq = __condvar_fetch_xor_wseq_release (cond, 1) >> 1; ++ g1 ^= 1; ++ *g1index ^= 1; ++ ++ /* These values are just observed by signalers, and thus protected by the ++ lock. */ ++ unsigned int orig_size = wseq - (old_g1_start + old_orig_size); ++ __condvar_set_orig_size (cond, orig_size); ++ /* Use and addition to not loose track of cancellations in what was ++ previously G2. */ ++ cond->__data.__g_size[g1] += orig_size; ++ ++ /* The new G1's size may be zero because of cancellations during its time ++ as G2. If this happens, there are no waiters that have to receive a ++ signal, so we do not need to add any and return false. */ ++ if (cond->__data.__g_size[g1] == 0) ++ return false; ++ ++ return true; ++} +diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c +index 1acd804..5845c6a 100644 +--- a/nptl/pthread_cond_destroy.c ++++ b/nptl/pthread_cond_destroy.c +@@ -20,66 +20,42 @@ + #include + #include "pthreadP.h" + #include +- +- ++#include ++#include ++ ++#include "pthread_cond_common.c" ++ ++/* See __pthread_cond_wait for a high-level description of the algorithm. ++ ++ A correct program must make sure that no waiters are blocked on the condvar ++ when it is destroyed, and that there are no concurrent signals or ++ broadcasts. To wake waiters reliably, the program must signal or ++ broadcast while holding the mutex or after having held the mutex. It must ++ also ensure that no signal or broadcast are still pending to unblock ++ waiters; IOW, because waiters can wake up spuriously, the program must ++ effectively ensure that destruction happens after the execution of those ++ signal or broadcast calls. ++ Thus, we can assume that all waiters that are still accessing the condvar ++ have been woken. We wait until they have confirmed to have woken up by ++ decrementing __wrefs. */ + int + __pthread_cond_destroy (pthread_cond_t *cond) + { +- int pshared = (cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; +- + LIBC_PROBE (cond_destroy, 1, cond); + +- /* Make sure we are alone. */ +- lll_lock (cond->__data.__lock, pshared); +- +- if (cond->__data.__total_seq > cond->__data.__wakeup_seq) +- { +- /* If there are still some waiters which have not been +- woken up, this is an application bug. */ +- lll_unlock (cond->__data.__lock, pshared); +- return EBUSY; +- } +- +- /* Tell pthread_cond_*wait that this condvar is being destroyed. */ +- cond->__data.__total_seq = -1ULL; +- +- /* If there are waiters which have been already signalled or +- broadcasted, but still are using the pthread_cond_t structure, +- pthread_cond_destroy needs to wait for them. */ +- unsigned int nwaiters = cond->__data.__nwaiters; +- +- if (nwaiters >= (1 << COND_NWAITERS_SHIFT)) ++ /* Set the wake request flag. We could also spin, but destruction that is ++ concurrent with still-active waiters is probably neither common nor ++ performance critical. Acquire MO to synchronize with waiters confirming ++ that they finished. */ ++ unsigned int wrefs = atomic_fetch_or_acquire (&cond->__data.__wrefs, 4); ++ int private = __condvar_get_private (wrefs); ++ while (wrefs >> 3 != 0) + { +- /* Wake everybody on the associated mutex in case there are +- threads that have been requeued to it. +- Without this, pthread_cond_destroy could block potentially +- for a long time or forever, as it would depend on other +- thread's using the mutex. +- When all threads waiting on the mutex are woken up, pthread_cond_wait +- only waits for threads to acquire and release the internal +- condvar lock. */ +- if (cond->__data.__mutex != NULL +- && cond->__data.__mutex != (void *) ~0l) +- { +- pthread_mutex_t *mut = (pthread_mutex_t *) cond->__data.__mutex; +- lll_futex_wake (&mut->__data.__lock, INT_MAX, +- PTHREAD_MUTEX_PSHARED (mut)); +- } +- +- do +- { +- lll_unlock (cond->__data.__lock, pshared); +- +- lll_futex_wait (&cond->__data.__nwaiters, nwaiters, pshared); +- +- lll_lock (cond->__data.__lock, pshared); +- +- nwaiters = cond->__data.__nwaiters; +- } +- while (nwaiters >= (1 << COND_NWAITERS_SHIFT)); ++ futex_wait_simple (&cond->__data.__wrefs, wrefs, private); ++ /* See above. */ ++ wrefs = atomic_load_acquire (&cond->__data.__wrefs); + } +- ++ /* The memory the condvar occupies can now be reused. */ + return 0; + } + versioned_symbol (libpthread, __pthread_cond_destroy, +diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c +index 9023370..c1eac5f 100644 +--- a/nptl/pthread_cond_init.c ++++ b/nptl/pthread_cond_init.c +@@ -19,25 +19,29 @@ + #include + #include "pthreadP.h" + #include ++#include + + ++/* See __pthread_cond_wait for details. */ + int + __pthread_cond_init (pthread_cond_t *cond, const pthread_condattr_t *cond_attr) + { + struct pthread_condattr *icond_attr = (struct pthread_condattr *) cond_attr; + +- cond->__data.__lock = LLL_LOCK_INITIALIZER; +- cond->__data.__futex = 0; +- cond->__data.__nwaiters = (icond_attr != NULL +- ? ((icond_attr->value >> 1) +- & ((1 << COND_NWAITERS_SHIFT) - 1)) +- : CLOCK_REALTIME); +- cond->__data.__total_seq = 0; +- cond->__data.__wakeup_seq = 0; +- cond->__data.__woken_seq = 0; +- cond->__data.__mutex = (icond_attr == NULL || (icond_attr->value & 1) == 0 +- ? NULL : (void *) ~0l); +- cond->__data.__broadcast_seq = 0; ++ memset (cond, 0, sizeof (pthread_cond_t)); ++ ++ /* Update the pretty printers if the internal representation of icond_attr ++ is changed. */ ++ ++ /* Iff not equal to ~0l, this is a PTHREAD_PROCESS_PRIVATE condvar. */ ++ if (icond_attr != NULL && (icond_attr->value & 1) != 0) ++ cond->__data.__wrefs |= __PTHREAD_COND_SHARED_MASK; ++ int clockid = (icond_attr != NULL ++ ? ((icond_attr->value >> 1) & ((1 << COND_CLOCK_BITS) - 1)) ++ : CLOCK_REALTIME); ++ /* If 0, CLOCK_REALTIME is used; CLOCK_MONOTONIC otherwise. */ ++ if (clockid != CLOCK_REALTIME) ++ cond->__data.__wrefs |= __PTHREAD_COND_CLOCK_MONOTONIC_MASK; + + LIBC_PROBE (cond_init, 2, cond, cond_attr); + +diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c +index b3a6d3d..a95d569 100644 +--- a/nptl/pthread_cond_signal.c ++++ b/nptl/pthread_cond_signal.c +@@ -19,62 +19,79 @@ + #include + #include + #include +-#include ++#include + #include + #include ++#include ++#include + + #include +-#include + #include + ++#include "pthread_cond_common.c" + ++/* See __pthread_cond_wait for a high-level description of the algorithm. */ + int + __pthread_cond_signal (pthread_cond_t *cond) + { +- int pshared = (cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; +- + LIBC_PROBE (cond_signal, 1, cond); + +- /* Make sure we are alone. */ +- lll_lock (cond->__data.__lock, pshared); +- +- /* Are there any waiters to be woken? */ +- if (cond->__data.__total_seq > cond->__data.__wakeup_seq) ++ /* First check whether there are waiters. Relaxed MO is fine for that for ++ the same reasons that relaxed MO is fine when observing __wseq (see ++ below). */ ++ unsigned int wrefs = atomic_load_relaxed (&cond->__data.__wrefs); ++ if (wrefs >> 3 == 0) ++ return 0; ++ int private = __condvar_get_private (wrefs); ++ ++ __condvar_acquire_lock (cond, private); ++ ++ /* Load the waiter sequence number, which represents our relative ordering ++ to any waiters. Relaxed MO is sufficient for that because: ++ 1) We can pick any position that is allowed by external happens-before ++ constraints. In particular, if another __pthread_cond_wait call ++ happened before us, this waiter must be eligible for being woken by ++ us. The only way do establish such a happens-before is by signaling ++ while having acquired the mutex associated with the condvar and ++ ensuring that the signal's critical section happens after the waiter. ++ Thus, the mutex ensures that we see that waiter's __wseq increase. ++ 2) Once we pick a position, we do not need to communicate this to the ++ program via a happens-before that we set up: First, any wake-up could ++ be a spurious wake-up, so the program must not interpret a wake-up as ++ an indication that the waiter happened before a particular signal; ++ second, a program cannot detect whether a waiter has not yet been ++ woken (i.e., it cannot distinguish between a non-woken waiter and one ++ that has been woken but hasn't resumed execution yet), and thus it ++ cannot try to deduce that a signal happened before a particular ++ waiter. */ ++ unsigned long long int wseq = __condvar_load_wseq_relaxed (cond); ++ unsigned int g1 = (wseq & 1) ^ 1; ++ wseq >>= 1; ++ bool do_futex_wake = false; ++ ++ /* If G1 is still receiving signals, we put the signal there. If not, we ++ check if G2 has waiters, and if so, quiesce and switch G1 to the former ++ G2; if this results in a new G1 with waiters (G2 might have cancellations ++ already, see __condvar_quiesce_and_switch_g1), we put the signal in the ++ new G1. */ ++ if ((cond->__data.__g_size[g1] != 0) ++ || __condvar_quiesce_and_switch_g1 (cond, wseq, &g1, private)) + { +- /* Yes. Mark one of them as woken. */ +- ++cond->__data.__wakeup_seq; +- ++cond->__data.__futex; +- +-#if (defined lll_futex_cmp_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- pthread_mutex_t *mut = cond->__data.__mutex; +- +- if (USE_REQUEUE_PI (mut) +- /* This can only really fail with a ENOSYS, since nobody can modify +- futex while we have the cond_lock. */ +- && lll_futex_cmp_requeue_pi (&cond->__data.__futex, 1, 0, +- &mut->__data.__lock, +- cond->__data.__futex, pshared) == 0) +- { +- lll_unlock (cond->__data.__lock, pshared); +- return 0; +- } +- else +-#endif +- /* Wake one. */ +- if (! __builtin_expect (lll_futex_wake_unlock (&cond->__data.__futex, +- 1, 1, +- &cond->__data.__lock, +- pshared), 0)) +- return 0; +- +- /* Fallback if neither of them work. */ +- lll_futex_wake (&cond->__data.__futex, 1, pshared); ++ /* Add a signal. Relaxed MO is fine because signaling does not need to ++ establish a happens-before relation (see above). We do not mask the ++ release-MO store when initializing a group in ++ __condvar_quiesce_and_switch_g1 because we use an atomic ++ read-modify-write and thus extend that store's release sequence. */ ++ atomic_fetch_add_relaxed (cond->__data.__g_signals + g1, 2); ++ cond->__data.__g_size[g1]--; ++ /* TODO Only set it if there are indeed futex waiters. */ ++ do_futex_wake = true; + } + +- /* We are done. */ +- lll_unlock (cond->__data.__lock, pshared); ++ __condvar_release_lock (cond, private); ++ ++ if (do_futex_wake) ++ futex_wake (cond->__data.__g_signals + g1, 1, private); + + return 0; + } +diff --git a/nptl/pthread_cond_timedwait.c b/nptl/pthread_cond_timedwait.c +deleted file mode 100644 +index 711a51d..0000000 +--- a/nptl/pthread_cond_timedwait.c ++++ /dev/null +@@ -1,268 +0,0 @@ +-/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Martin Schwidefsky , 2003. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#ifndef HAVE_CLOCK_GETTIME_VSYSCALL +-# undef INTERNAL_VSYSCALL +-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL +-# undef INLINE_VSYSCALL +-# define INLINE_VSYSCALL INLINE_SYSCALL +-#else +-# include +-#endif +- +-/* Cleanup handler, defined in pthread_cond_wait.c. */ +-extern void __condvar_cleanup (void *arg) +- __attribute__ ((visibility ("hidden"))); +- +-struct _condvar_cleanup_buffer +-{ +- int oldtype; +- pthread_cond_t *cond; +- pthread_mutex_t *mutex; +- unsigned int bc_seq; +-}; +- +-int +-__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, +- const struct timespec *abstime) +-{ +- struct _pthread_cleanup_buffer buffer; +- struct _condvar_cleanup_buffer cbuffer; +- int result = 0; +- +- /* Catch invalid parameters. */ +- if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) +- return EINVAL; +- +- int pshared = (cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; +- +-#if (defined lll_futex_timed_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- int pi_flag = 0; +-#endif +- +- /* Make sure we are alone. */ +- lll_lock (cond->__data.__lock, pshared); +- +- /* Now we can release the mutex. */ +- int err = __pthread_mutex_unlock_usercnt (mutex, 0); +- if (err) +- { +- lll_unlock (cond->__data.__lock, pshared); +- return err; +- } +- +- /* We have one new user of the condvar. */ +- ++cond->__data.__total_seq; +- ++cond->__data.__futex; +- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT; +- +- /* Work around the fact that the kernel rejects negative timeout values +- despite them being valid. */ +- if (__glibc_unlikely (abstime->tv_sec < 0)) +- goto timeout; +- +- /* Remember the mutex we are using here. If there is already a +- different address store this is a bad user bug. Do not store +- anything for pshared condvars. */ +- if (cond->__data.__mutex != (void *) ~0l) +- cond->__data.__mutex = mutex; +- +- /* Prepare structure passed to cancellation handler. */ +- cbuffer.cond = cond; +- cbuffer.mutex = mutex; +- +- /* Before we block we enable cancellation. Therefore we have to +- install a cancellation handler. */ +- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer); +- +- /* The current values of the wakeup counter. The "woken" counter +- must exceed this value. */ +- unsigned long long int val; +- unsigned long long int seq; +- val = seq = cond->__data.__wakeup_seq; +- /* Remember the broadcast counter. */ +- cbuffer.bc_seq = cond->__data.__broadcast_seq; +- +- while (1) +- { +-#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \ +- || !defined lll_futex_timed_wait_bitset) +- struct timespec rt; +- { +-# ifdef __NR_clock_gettime +- INTERNAL_SYSCALL_DECL (err); +- (void) INTERNAL_VSYSCALL (clock_gettime, err, 2, +- (cond->__data.__nwaiters +- & ((1 << COND_NWAITERS_SHIFT) - 1)), +- &rt); +- /* Convert the absolute timeout value to a relative timeout. */ +- rt.tv_sec = abstime->tv_sec - rt.tv_sec; +- rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec; +-# else +- /* Get the current time. So far we support only one clock. */ +- struct timeval tv; +- (void) __gettimeofday (&tv, NULL); +- +- /* Convert the absolute timeout value to a relative timeout. */ +- rt.tv_sec = abstime->tv_sec - tv.tv_sec; +- rt.tv_nsec = abstime->tv_nsec - tv.tv_usec * 1000; +-# endif +- } +- if (rt.tv_nsec < 0) +- { +- rt.tv_nsec += 1000000000; +- --rt.tv_sec; +- } +- /* Did we already time out? */ +- if (__glibc_unlikely (rt.tv_sec < 0)) +- { +- if (cbuffer.bc_seq != cond->__data.__broadcast_seq) +- goto bc_out; +- +- goto timeout; +- } +-#endif +- +- unsigned int futex_val = cond->__data.__futex; +- +- /* Prepare to wait. Release the condvar futex. */ +- lll_unlock (cond->__data.__lock, pshared); +- +- /* Enable asynchronous cancellation. Required by the standard. */ +- cbuffer.oldtype = __pthread_enable_asynccancel (); +- +-/* REQUEUE_PI was implemented after FUTEX_CLOCK_REALTIME, so it is sufficient +- to check just the former. */ +-#if (defined lll_futex_timed_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- /* If pi_flag remained 1 then it means that we had the lock and the mutex +- but a spurious waker raced ahead of us. Give back the mutex before +- going into wait again. */ +- if (pi_flag) +- { +- __pthread_mutex_cond_lock_adjust (mutex); +- __pthread_mutex_unlock_usercnt (mutex, 0); +- } +- pi_flag = USE_REQUEUE_PI (mutex); +- +- if (pi_flag) +- { +- unsigned int clockbit = (cond->__data.__nwaiters & 1 +- ? 0 : FUTEX_CLOCK_REALTIME); +- err = lll_futex_timed_wait_requeue_pi (&cond->__data.__futex, +- futex_val, abstime, clockbit, +- &mutex->__data.__lock, +- pshared); +- pi_flag = (err == 0); +- } +- else +-#endif +- +- { +-#if (!defined __ASSUME_FUTEX_CLOCK_REALTIME \ +- || !defined lll_futex_timed_wait_bitset) +- /* Wait until woken by signal or broadcast. */ +- err = lll_futex_timed_wait (&cond->__data.__futex, +- futex_val, &rt, pshared); +-#else +- unsigned int clockbit = (cond->__data.__nwaiters & 1 +- ? 0 : FUTEX_CLOCK_REALTIME); +- err = lll_futex_timed_wait_bitset (&cond->__data.__futex, futex_val, +- abstime, clockbit, pshared); +-#endif +- } +- +- /* Disable asynchronous cancellation. */ +- __pthread_disable_asynccancel (cbuffer.oldtype); +- +- /* We are going to look at shared data again, so get the lock. */ +- lll_lock (cond->__data.__lock, pshared); +- +- /* If a broadcast happened, we are done. */ +- if (cbuffer.bc_seq != cond->__data.__broadcast_seq) +- goto bc_out; +- +- /* Check whether we are eligible for wakeup. */ +- val = cond->__data.__wakeup_seq; +- if (val != seq && cond->__data.__woken_seq != val) +- break; +- +- /* Not woken yet. Maybe the time expired? */ +- if (__glibc_unlikely (err == -ETIMEDOUT)) +- { +- timeout: +- /* Yep. Adjust the counters. */ +- ++cond->__data.__wakeup_seq; +- ++cond->__data.__futex; +- +- /* The error value. */ +- result = ETIMEDOUT; +- break; +- } +- } +- +- /* Another thread woken up. */ +- ++cond->__data.__woken_seq; +- +- bc_out: +- +- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT; +- +- /* If pthread_cond_destroy was called on this variable already, +- notify the pthread_cond_destroy caller all waiters have left +- and it can be successfully destroyed. */ +- if (cond->__data.__total_seq == -1ULL +- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT)) +- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared); +- +- /* We are done with the condvar. */ +- lll_unlock (cond->__data.__lock, pshared); +- +- /* The cancellation handling is back to normal, remove the handler. */ +- __pthread_cleanup_pop (&buffer, 0); +- +- /* Get the mutex before returning. */ +-#if (defined lll_futex_timed_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- if (pi_flag) +- { +- __pthread_mutex_cond_lock_adjust (mutex); +- err = 0; +- } +- else +-#endif +- err = __pthread_mutex_cond_lock (mutex); +- +- return err ?: result; +-} +- +-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, +- GLIBC_2_3_2); +diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c +index 3f62acc..2b43402 100644 +--- a/nptl/pthread_cond_wait.c ++++ b/nptl/pthread_cond_wait.c +@@ -19,219 +19,655 @@ + #include + #include + #include +-#include ++#include + #include + #include +-#include ++#include ++#include ++#include ++#include + + #include + #include ++#include ++ ++#include "pthread_cond_common.c" ++ + + struct _condvar_cleanup_buffer + { +- int oldtype; ++ uint64_t wseq; + pthread_cond_t *cond; + pthread_mutex_t *mutex; +- unsigned int bc_seq; ++ int private; + }; + + +-void +-__attribute__ ((visibility ("hidden"))) +-__condvar_cleanup (void *arg) ++/* Decrease the waiter reference count. */ ++static void ++__condvar_confirm_wakeup (pthread_cond_t *cond, int private) + { +- struct _condvar_cleanup_buffer *cbuffer = +- (struct _condvar_cleanup_buffer *) arg; +- unsigned int destroying; +- int pshared = (cbuffer->cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; ++ /* If destruction is pending (i.e., the wake-request flag is nonzero) and we ++ are the last waiter (prior value of __wrefs was 1 << 3), then wake any ++ threads waiting in pthread_cond_destroy. Release MO to synchronize with ++ these threads. Don't bother clearing the wake-up request flag. */ ++ if ((atomic_fetch_add_release (&cond->__data.__wrefs, -8) >> 2) == 3) ++ futex_wake (&cond->__data.__wrefs, INT_MAX, private); ++} ++ + +- /* We are going to modify shared data. */ +- lll_lock (cbuffer->cond->__data.__lock, pshared); ++/* Cancel waiting after having registered as a waiter previously. SEQ is our ++ position and G is our group index. ++ The goal of cancellation is to make our group smaller if that is still ++ possible. If we are in a closed group, this is not possible anymore; in ++ this case, we need to send a replacement signal for the one we effectively ++ consumed because the signal should have gotten consumed by another waiter ++ instead; we must not both cancel waiting and consume a signal. ++ ++ Must not be called while still holding a reference on the group. ++ ++ Returns true iff we consumed a signal. ++ ++ On some kind of timeouts, we may be able to pretend that a signal we ++ effectively consumed happened before the timeout (i.e., similarly to first ++ spinning on signals before actually checking whether the timeout has ++ passed already). Doing this would allow us to skip sending a replacement ++ signal, but this case might happen rarely because the end of the timeout ++ must race with someone else sending a signal. Therefore, we don't bother ++ trying to optimize this. */ ++static void ++__condvar_cancel_waiting (pthread_cond_t *cond, uint64_t seq, unsigned int g, ++ int private) ++{ ++ bool consumed_signal = false; + +- if (cbuffer->bc_seq == cbuffer->cond->__data.__broadcast_seq) ++ /* No deadlock with group switching is possible here because we have do ++ not hold a reference on the group. */ ++ __condvar_acquire_lock (cond, private); ++ ++ uint64_t g1_start = __condvar_load_g1_start_relaxed (cond) >> 1; ++ if (g1_start > seq) ++ { ++ /* Our group is closed, so someone provided enough signals for it. ++ Thus, we effectively consumed a signal. */ ++ consumed_signal = true; ++ } ++ else + { +- /* This thread is not waiting anymore. Adjust the sequence counters +- appropriately. We do not increment WAKEUP_SEQ if this would +- bump it over the value of TOTAL_SEQ. This can happen if a thread +- was woken and then canceled. */ +- if (cbuffer->cond->__data.__wakeup_seq +- < cbuffer->cond->__data.__total_seq) ++ if (g1_start + __condvar_get_orig_size (cond) <= seq) ++ { ++ /* We are in the current G2 and thus cannot have consumed a signal. ++ Reduce its effective size or handle overflow. Remember that in ++ G2, unsigned int size is zero or a negative value. */ ++ if (cond->__data.__g_size[g] + __PTHREAD_COND_MAX_GROUP_SIZE > 0) ++ { ++ cond->__data.__g_size[g]--; ++ } ++ else ++ { ++ /* Cancellations would overflow the maximum group size. Just ++ wake up everyone spuriously to create a clean state. This ++ also means we do not consume a signal someone else sent. */ ++ __condvar_release_lock (cond, private); ++ __pthread_cond_broadcast (cond); ++ return; ++ } ++ } ++ else + { +- ++cbuffer->cond->__data.__wakeup_seq; +- ++cbuffer->cond->__data.__futex; ++ /* We are in current G1. If the group's size is zero, someone put ++ a signal in the group that nobody else but us can consume. */ ++ if (cond->__data.__g_size[g] == 0) ++ consumed_signal = true; ++ else ++ { ++ /* Otherwise, we decrease the size of the group. This is ++ equivalent to atomically putting in a signal just for us and ++ consuming it right away. We do not consume a signal sent ++ by someone else. We also cannot have consumed a futex ++ wake-up because if we were cancelled or timed out in a futex ++ call, the futex will wake another waiter. */ ++ cond->__data.__g_size[g]--; ++ } + } +- ++cbuffer->cond->__data.__woken_seq; + } + +- cbuffer->cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT; ++ __condvar_release_lock (cond, private); + +- /* If pthread_cond_destroy was called on this variable already, +- notify the pthread_cond_destroy caller all waiters have left +- and it can be successfully destroyed. */ +- destroying = 0; +- if (cbuffer->cond->__data.__total_seq == -1ULL +- && cbuffer->cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT)) ++ if (consumed_signal) + { +- lll_futex_wake (&cbuffer->cond->__data.__nwaiters, 1, pshared); +- destroying = 1; ++ /* We effectively consumed a signal even though we didn't want to. ++ Therefore, we need to send a replacement signal. ++ If we would want to optimize this, we could do what ++ pthread_cond_signal does right in the critical section above. */ ++ __pthread_cond_signal (cond); + } ++} + +- /* We are done. */ +- lll_unlock (cbuffer->cond->__data.__lock, pshared); +- +- /* Wake everybody to make sure no condvar signal gets lost. */ +- if (! destroying) +- lll_futex_wake (&cbuffer->cond->__data.__futex, INT_MAX, pshared); +- +- /* Get the mutex before returning unless asynchronous cancellation +- is in effect. We don't try to get the mutex if we already own it. */ +- if (!(USE_REQUEUE_PI (cbuffer->mutex)) +- || ((cbuffer->mutex->__data.__lock & FUTEX_TID_MASK) +- != THREAD_GETMEM (THREAD_SELF, tid))) +- { +- __pthread_mutex_cond_lock (cbuffer->mutex); +- } +- else +- __pthread_mutex_cond_lock_adjust (cbuffer->mutex); ++/* Wake up any signalers that might be waiting. */ ++static void ++__condvar_dec_grefs (pthread_cond_t *cond, unsigned int g, int private) ++{ ++ /* Release MO to synchronize-with the acquire load in ++ __condvar_quiesce_and_switch_g1. */ ++ if (atomic_fetch_add_release (cond->__data.__g_refs + g, -2) == 3) ++ { ++ /* Clear the wake-up request flag before waking up. We do not need more ++ than relaxed MO and it doesn't matter if we apply this for an aliased ++ group because we wake all futex waiters right after clearing the ++ flag. */ ++ atomic_fetch_and_relaxed (cond->__data.__g_refs + g, ~(unsigned int) 1); ++ futex_wake (cond->__data.__g_refs + g, INT_MAX, private); ++ } + } + ++/* Clean-up for cancellation of waiters waiting for normal signals. We cancel ++ our registration as a waiter, confirm we have woken up, and re-acquire the ++ mutex. */ ++static void ++__condvar_cleanup_waiting (void *arg) ++{ ++ struct _condvar_cleanup_buffer *cbuffer = ++ (struct _condvar_cleanup_buffer *) arg; ++ pthread_cond_t *cond = cbuffer->cond; ++ unsigned g = cbuffer->wseq & 1; + +-int +-__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) ++ __condvar_dec_grefs (cond, g, cbuffer->private); ++ ++ __condvar_cancel_waiting (cond, cbuffer->wseq >> 1, g, cbuffer->private); ++ /* FIXME With the current cancellation implementation, it is possible that ++ a thread is cancelled after it has returned from a syscall. This could ++ result in a cancelled waiter consuming a futex wake-up that is then ++ causing another waiter in the same group to not wake up. To work around ++ this issue until we have fixed cancellation, just add a futex wake-up ++ conservatively. */ ++ futex_wake (cond->__data.__g_signals + g, 1, cbuffer->private); ++ ++ __condvar_confirm_wakeup (cond, cbuffer->private); ++ ++ /* XXX If locking the mutex fails, should we just stop execution? This ++ might be better than silently ignoring the error. */ ++ __pthread_mutex_cond_lock (cbuffer->mutex); ++} ++ ++/* This condvar implementation guarantees that all calls to signal and ++ broadcast and all of the three virtually atomic parts of each call to wait ++ (i.e., (1) releasing the mutex and blocking, (2) unblocking, and (3) re- ++ acquiring the mutex) happen in some total order that is consistent with the ++ happens-before relations in the calling program. However, this order does ++ not necessarily result in additional happens-before relations being ++ established (which aligns well with spurious wake-ups being allowed). ++ ++ All waiters acquire a certain position in a 64b waiter sequence (__wseq). ++ This sequence determines which waiters are allowed to consume signals. ++ A broadcast is equal to sending as many signals as are unblocked waiters. ++ When a signal arrives, it samples the current value of __wseq with a ++ relaxed-MO load (i.e., the position the next waiter would get). (This is ++ sufficient because it is consistent with happens-before; the caller can ++ enforce stronger ordering constraints by calling signal while holding the ++ mutex.) Only waiters with a position less than the __wseq value observed ++ by the signal are eligible to consume this signal. ++ ++ This would be straight-forward to implement if waiters would just spin but ++ we need to let them block using futexes. Futexes give no guarantee of ++ waking in FIFO order, so we cannot reliably wake eligible waiters if we ++ just use a single futex. Also, futex words are 32b in size, but we need ++ to distinguish more than 1<<32 states because we need to represent the ++ order of wake-up (and thus which waiters are eligible to consume signals); ++ blocking in a futex is not atomic with a waiter determining its position in ++ the waiter sequence, so we need the futex word to reliably notify waiters ++ that they should not attempt to block anymore because they have been ++ already signaled in the meantime. While an ABA issue on a 32b value will ++ be rare, ignoring it when we are aware of it is not the right thing to do ++ either. ++ ++ Therefore, we use a 64b counter to represent the waiter sequence (on ++ architectures which only support 32b atomics, we use a few bits less). ++ To deal with the blocking using futexes, we maintain two groups of waiters: ++ * Group G1 consists of waiters that are all eligible to consume signals; ++ incoming signals will always signal waiters in this group until all ++ waiters in G1 have been signaled. ++ * Group G2 consists of waiters that arrive when a G1 is present and still ++ contains waiters that have not been signaled. When all waiters in G1 ++ are signaled and a new signal arrives, the new signal will convert G2 ++ into the new G1 and create a new G2 for future waiters. ++ ++ We cannot allocate new memory because of process-shared condvars, so we ++ have just two slots of groups that change their role between G1 and G2. ++ Each has a separate futex word, a number of signals available for ++ consumption, a size (number of waiters in the group that have not been ++ signaled), and a reference count. ++ ++ The group reference count is used to maintain the number of waiters that ++ are using the group's futex. Before a group can change its role, the ++ reference count must show that no waiters are using the futex anymore; this ++ prevents ABA issues on the futex word. ++ ++ To represent which intervals in the waiter sequence the groups cover (and ++ thus also which group slot contains G1 or G2), we use a 64b counter to ++ designate the start position of G1 (inclusive), and a single bit in the ++ waiter sequence counter to represent which group slot currently contains ++ G2. This allows us to switch group roles atomically wrt. waiters obtaining ++ a position in the waiter sequence. The G1 start position allows waiters to ++ figure out whether they are in a group that has already been completely ++ signaled (i.e., if the current G1 starts at a later position that the ++ waiter's position). Waiters cannot determine whether they are currently ++ in G2 or G1 -- but they do not have too because all they are interested in ++ is whether there are available signals, and they always start in G2 (whose ++ group slot they know because of the bit in the waiter sequence. Signalers ++ will simply fill the right group until it is completely signaled and can ++ be closed (they do not switch group roles until they really have to to ++ decrease the likelihood of having to wait for waiters still holding a ++ reference on the now-closed G1). ++ ++ Signalers maintain the initial size of G1 to be able to determine where ++ G2 starts (G2 is always open-ended until it becomes G1). They track the ++ remaining size of a group; when waiters cancel waiting (due to PThreads ++ cancellation or timeouts), they will decrease this remaining size as well. ++ ++ To implement condvar destruction requirements (i.e., that ++ pthread_cond_destroy can be called as soon as all waiters have been ++ signaled), waiters increment a reference count before starting to wait and ++ decrement it after they stopped waiting but right before they acquire the ++ mutex associated with the condvar. ++ ++ pthread_cond_t thus consists of the following (bits that are used for ++ flags and are not part of the primary value of each field but necessary ++ to make some things atomic or because there was no space for them ++ elsewhere in the data structure): ++ ++ __wseq: Waiter sequence counter ++ * LSB is index of current G2. ++ * Waiters fetch-add while having acquire the mutex associated with the ++ condvar. Signalers load it and fetch-xor it concurrently. ++ __g1_start: Starting position of G1 (inclusive) ++ * LSB is index of current G2. ++ * Modified by signalers while having acquired the condvar-internal lock ++ and observed concurrently by waiters. ++ __g1_orig_size: Initial size of G1 ++ * The two least-significant bits represent the condvar-internal lock. ++ * Only accessed while having acquired the condvar-internal lock. ++ __wrefs: Waiter reference counter. ++ * Bit 2 is true if waiters should run futex_wake when they remove the ++ last reference. pthread_cond_destroy uses this as futex word. ++ * Bit 1 is the clock ID (0 == CLOCK_REALTIME, 1 == CLOCK_MONOTONIC). ++ * Bit 0 is true iff this is a process-shared condvar. ++ * Simple reference count used by both waiters and pthread_cond_destroy. ++ (If the format of __wrefs is changed, update nptl_lock_constants.pysym ++ and the pretty printers.) ++ For each of the two groups, we have: ++ __g_refs: Futex waiter reference count. ++ * LSB is true if waiters should run futex_wake when they remove the ++ last reference. ++ * Reference count used by waiters concurrently with signalers that have ++ acquired the condvar-internal lock. ++ __g_signals: The number of signals that can still be consumed. ++ * Used as a futex word by waiters. Used concurrently by waiters and ++ signalers. ++ * LSB is true iff this group has been completely signaled (i.e., it is ++ closed). ++ __g_size: Waiters remaining in this group (i.e., which have not been ++ signaled yet. ++ * Accessed by signalers and waiters that cancel waiting (both do so only ++ when having acquired the condvar-internal lock. ++ * The size of G2 is always zero because it cannot be determined until ++ the group becomes G1. ++ * Although this is of unsigned type, we rely on using unsigned overflow ++ rules to make this hold effectively negative values too (in ++ particular, when waiters in G2 cancel waiting). ++ ++ A PTHREAD_COND_INITIALIZER condvar has all fields set to zero, which yields ++ a condvar that has G2 starting at position 0 and a G1 that is closed. ++ ++ Because waiters do not claim ownership of a group right when obtaining a ++ position in __wseq but only reference count the group when using futexes ++ to block, it can happen that a group gets closed before a waiter can ++ increment the reference count. Therefore, waiters have to check whether ++ their group is already closed using __g1_start. They also have to perform ++ this check when spinning when trying to grab a signal from __g_signals. ++ Note that for these checks, using relaxed MO to load __g1_start is ++ sufficient because if a waiter can see a sufficiently large value, it could ++ have also consume a signal in the waiters group. ++ ++ Waiters try to grab a signal from __g_signals without holding a reference ++ count, which can lead to stealing a signal from a more recent group after ++ their own group was already closed. They cannot always detect whether they ++ in fact did because they do not know when they stole, but they can ++ conservatively add a signal back to the group they stole from; if they ++ did so unnecessarily, all that happens is a spurious wake-up. To make this ++ even less likely, __g1_start contains the index of the current g2 too, ++ which allows waiters to check if there aliasing on the group slots; if ++ there wasn't, they didn't steal from the current G1, which means that the ++ G1 they stole from must have been already closed and they do not need to ++ fix anything. ++ ++ It is essential that the last field in pthread_cond_t is __g_signals[1]: ++ The previous condvar used a pointer-sized field in pthread_cond_t, so a ++ PTHREAD_COND_INITIALIZER from that condvar implementation might only ++ initialize 4 bytes to zero instead of the 8 bytes we need (i.e., 44 bytes ++ in total instead of the 48 we need). __g_signals[1] is not accessed before ++ the first group switch (G2 starts at index 0), which will set its value to ++ zero after a harmless fetch-or whose return value is ignored. This ++ effectively completes initialization. ++ ++ ++ Limitations: ++ * This condvar isn't designed to allow for more than ++ __PTHREAD_COND_MAX_GROUP_SIZE * (1 << 31) calls to __pthread_cond_wait. ++ * More than __PTHREAD_COND_MAX_GROUP_SIZE concurrent waiters are not ++ supported. ++ * Beyond what is allowed as errors by POSIX or documented, we can also ++ return the following errors: ++ * EPERM if MUTEX is a recursive mutex and the caller doesn't own it. ++ * EOWNERDEAD or ENOTRECOVERABLE when using robust mutexes. Unlike ++ for other errors, this can happen when we re-acquire the mutex; this ++ isn't allowed by POSIX (which requires all errors to virtually happen ++ before we release the mutex or change the condvar state), but there's ++ nothing we can do really. ++ * When using PTHREAD_MUTEX_PP_* mutexes, we can also return all errors ++ returned by __pthread_tpp_change_priority. We will already have ++ released the mutex in such cases, so the caller cannot expect to own ++ MUTEX. ++ ++ Other notes: ++ * Instead of the normal mutex unlock / lock functions, we use ++ __pthread_mutex_unlock_usercnt(m, 0) / __pthread_mutex_cond_lock(m) ++ because those will not change the mutex-internal users count, so that it ++ can be detected when a condvar is still associated with a particular ++ mutex because there is a waiter blocked on this condvar using this mutex. ++*/ ++static __always_inline int ++__pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex, ++ const struct timespec *abstime) + { +- struct _pthread_cleanup_buffer buffer; +- struct _condvar_cleanup_buffer cbuffer; ++ const int maxspin = 0; + int err; +- int pshared = (cond->__data.__mutex == (void *) ~0l) +- ? LLL_SHARED : LLL_PRIVATE; +- +-#if (defined lll_futex_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- int pi_flag = 0; +-#endif ++ int result = 0; + + LIBC_PROBE (cond_wait, 2, cond, mutex); + +- /* Make sure we are alone. */ +- lll_lock (cond->__data.__lock, pshared); +- +- /* Now we can release the mutex. */ ++ /* Acquire a position (SEQ) in the waiter sequence (WSEQ). We use an ++ atomic operation because signals and broadcasts may update the group ++ switch without acquiring the mutex. We do not need release MO here ++ because we do not need to establish any happens-before relation with ++ signalers (see __pthread_cond_signal); modification order alone ++ establishes a total order of waiters/signals. We do need acquire MO ++ to synchronize with group reinitialization in ++ __condvar_quiesce_and_switch_g1. */ ++ uint64_t wseq = __condvar_fetch_add_wseq_acquire (cond, 2); ++ /* Find our group's index. We always go into what was G2 when we acquired ++ our position. */ ++ unsigned int g = wseq & 1; ++ uint64_t seq = wseq >> 1; ++ ++ /* Increase the waiter reference count. Relaxed MO is sufficient because ++ we only need to synchronize when decrementing the reference count. */ ++ unsigned int flags = atomic_fetch_add_relaxed (&cond->__data.__wrefs, 8); ++ int private = __condvar_get_private (flags); ++ ++ /* Now that we are registered as a waiter, we can release the mutex. ++ Waiting on the condvar must be atomic with releasing the mutex, so if ++ the mutex is used to establish a happens-before relation with any ++ signaler, the waiter must be visible to the latter; thus, we release the ++ mutex after registering as waiter. ++ If releasing the mutex fails, we just cancel our registration as a ++ waiter and confirm that we have woken up. */ + err = __pthread_mutex_unlock_usercnt (mutex, 0); +- if (__glibc_unlikely (err)) ++ if (__glibc_unlikely (err != 0)) + { +- lll_unlock (cond->__data.__lock, pshared); ++ __condvar_cancel_waiting (cond, seq, g, private); ++ __condvar_confirm_wakeup (cond, private); + return err; + } + +- /* We have one new user of the condvar. */ +- ++cond->__data.__total_seq; +- ++cond->__data.__futex; +- cond->__data.__nwaiters += 1 << COND_NWAITERS_SHIFT; +- +- /* Remember the mutex we are using here. If there is already a +- different address store this is a bad user bug. Do not store +- anything for pshared condvars. */ +- if (cond->__data.__mutex != (void *) ~0l) +- cond->__data.__mutex = mutex; +- +- /* Prepare structure passed to cancellation handler. */ +- cbuffer.cond = cond; +- cbuffer.mutex = mutex; +- +- /* Before we block we enable cancellation. Therefore we have to +- install a cancellation handler. */ +- __pthread_cleanup_push (&buffer, __condvar_cleanup, &cbuffer); +- +- /* The current values of the wakeup counter. The "woken" counter +- must exceed this value. */ +- unsigned long long int val; +- unsigned long long int seq; +- val = seq = cond->__data.__wakeup_seq; +- /* Remember the broadcast counter. */ +- cbuffer.bc_seq = cond->__data.__broadcast_seq; ++ /* Now wait until a signal is available in our group or it is closed. ++ Acquire MO so that if we observe a value of zero written after group ++ switching in __condvar_quiesce_and_switch_g1, we synchronize with that ++ store and will see the prior update of __g1_start done while switching ++ groups too. */ ++ unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g); + + do + { +- unsigned int futex_val = cond->__data.__futex; +- /* Prepare to wait. Release the condvar futex. */ +- lll_unlock (cond->__data.__lock, pshared); +- +- /* Enable asynchronous cancellation. Required by the standard. */ +- cbuffer.oldtype = __pthread_enable_asynccancel (); +- +-#if (defined lll_futex_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- /* If pi_flag remained 1 then it means that we had the lock and the mutex +- but a spurious waker raced ahead of us. Give back the mutex before +- going into wait again. */ +- if (pi_flag) ++ while (1) + { +- __pthread_mutex_cond_lock_adjust (mutex); +- __pthread_mutex_unlock_usercnt (mutex, 0); ++ /* Spin-wait first. ++ Note that spinning first without checking whether a timeout ++ passed might lead to what looks like a spurious wake-up even ++ though we should return ETIMEDOUT (e.g., if the caller provides ++ an absolute timeout that is clearly in the past). However, ++ (1) spurious wake-ups are allowed, (2) it seems unlikely that a ++ user will (ab)use pthread_cond_wait as a check for whether a ++ point in time is in the past, and (3) spinning first without ++ having to compare against the current time seems to be the right ++ choice from a performance perspective for most use cases. */ ++ unsigned int spin = maxspin; ++ while (signals == 0 && spin > 0) ++ { ++ /* Check that we are not spinning on a group that's already ++ closed. */ ++ if (seq < (__condvar_load_g1_start_relaxed (cond) >> 1)) ++ goto done; ++ ++ /* TODO Back off. */ ++ ++ /* Reload signals. See above for MO. */ ++ signals = atomic_load_acquire (cond->__data.__g_signals + g); ++ spin--; ++ } ++ ++ /* If our group will be closed as indicated by the flag on signals, ++ don't bother grabbing a signal. */ ++ if (signals & 1) ++ goto done; ++ ++ /* If there is an available signal, don't block. */ ++ if (signals != 0) ++ break; ++ ++ /* No signals available after spinning, so prepare to block. ++ We first acquire a group reference and use acquire MO for that so ++ that we synchronize with the dummy read-modify-write in ++ __condvar_quiesce_and_switch_g1 if we read from that. In turn, ++ in this case this will make us see the closed flag on __g_signals ++ that designates a concurrent attempt to reuse the group's slot. ++ We use acquire MO for the __g_signals check to make the ++ __g1_start check work (see spinning above). ++ Note that the group reference acquisition will not mask the ++ release MO when decrementing the reference count because we use ++ an atomic read-modify-write operation and thus extend the release ++ sequence. */ ++ atomic_fetch_add_acquire (cond->__data.__g_refs + g, 2); ++ if (((atomic_load_acquire (cond->__data.__g_signals + g) & 1) != 0) ++ || (seq < (__condvar_load_g1_start_relaxed (cond) >> 1))) ++ { ++ /* Our group is closed. Wake up any signalers that might be ++ waiting. */ ++ __condvar_dec_grefs (cond, g, private); ++ goto done; ++ } ++ ++ // Now block. ++ struct _pthread_cleanup_buffer buffer; ++ struct _condvar_cleanup_buffer cbuffer; ++ cbuffer.wseq = wseq; ++ cbuffer.cond = cond; ++ cbuffer.mutex = mutex; ++ cbuffer.private = private; ++ __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer); ++ ++ if (abstime == NULL) ++ { ++ /* Block without a timeout. */ ++ err = futex_wait_cancelable ( ++ cond->__data.__g_signals + g, 0, private); ++ } ++ else ++ { ++ /* Block, but with a timeout. ++ Work around the fact that the kernel rejects negative timeout ++ values despite them being valid. */ ++ if (__glibc_unlikely (abstime->tv_sec < 0)) ++ err = ETIMEDOUT; ++ ++ else if ((flags & __PTHREAD_COND_CLOCK_MONOTONIC_MASK) != 0) ++ { ++ /* CLOCK_MONOTONIC is requested. */ ++ struct timespec rt; ++ if (__clock_gettime (CLOCK_MONOTONIC, &rt) != 0) ++ __libc_fatal ("clock_gettime does not support " ++ "CLOCK_MONOTONIC"); ++ /* Convert the absolute timeout value to a relative ++ timeout. */ ++ rt.tv_sec = abstime->tv_sec - rt.tv_sec; ++ rt.tv_nsec = abstime->tv_nsec - rt.tv_nsec; ++ if (rt.tv_nsec < 0) ++ { ++ rt.tv_nsec += 1000000000; ++ --rt.tv_sec; ++ } ++ /* Did we already time out? */ ++ if (__glibc_unlikely (rt.tv_sec < 0)) ++ err = ETIMEDOUT; ++ else ++ err = futex_reltimed_wait_cancelable ++ (cond->__data.__g_signals + g, 0, &rt, private); ++ } ++ else ++ { ++ /* Use CLOCK_REALTIME. */ ++ err = futex_abstimed_wait_cancelable ++ (cond->__data.__g_signals + g, 0, abstime, private); ++ } ++ } ++ ++ __pthread_cleanup_pop (&buffer, 0); ++ ++ if (__glibc_unlikely (err == ETIMEDOUT)) ++ { ++ __condvar_dec_grefs (cond, g, private); ++ /* If we timed out, we effectively cancel waiting. Note that ++ we have decremented __g_refs before cancellation, so that a ++ deadlock between waiting for quiescence of our group in ++ __condvar_quiesce_and_switch_g1 and us trying to acquire ++ the lock during cancellation is not possible. */ ++ __condvar_cancel_waiting (cond, seq, g, private); ++ result = ETIMEDOUT; ++ goto done; ++ } ++ else ++ __condvar_dec_grefs (cond, g, private); ++ ++ /* Reload signals. See above for MO. */ ++ signals = atomic_load_acquire (cond->__data.__g_signals + g); + } +- pi_flag = USE_REQUEUE_PI (mutex); + +- if (pi_flag) ++ } ++ /* Try to grab a signal. Use acquire MO so that we see an up-to-date value ++ of __g1_start below (see spinning above for a similar case). In ++ particular, if we steal from a more recent group, we will also see a ++ more recent __g1_start below. */ ++ while (!atomic_compare_exchange_weak_acquire (cond->__data.__g_signals + g, ++ &signals, signals - 2)); ++ ++ /* We consumed a signal but we could have consumed from a more recent group ++ that aliased with ours due to being in the same group slot. If this ++ might be the case our group must be closed as visible through ++ __g1_start. */ ++ uint64_t g1_start = __condvar_load_g1_start_relaxed (cond); ++ if (seq < (g1_start >> 1)) ++ { ++ /* We potentially stole a signal from a more recent group but we do not ++ know which group we really consumed from. ++ We do not care about groups older than current G1 because they are ++ closed; we could have stolen from these, but then we just add a ++ spurious wake-up for the current groups. ++ We will never steal a signal from current G2 that was really intended ++ for G2 because G2 never receives signals (until it becomes G1). We ++ could have stolen a signal from G2 that was conservatively added by a ++ previous waiter that also thought it stole a signal -- but given that ++ that signal was added unnecessarily, it's not a problem if we steal ++ it. ++ Thus, the remaining case is that we could have stolen from the current ++ G1, where "current" means the __g1_start value we observed. However, ++ if the current G1 does not have the same slot index as we do, we did ++ not steal from it and do not need to undo that. This is the reason ++ for putting a bit with G2's index into__g1_start as well. */ ++ if (((g1_start & 1) ^ 1) == g) + { +- err = lll_futex_wait_requeue_pi (&cond->__data.__futex, +- futex_val, &mutex->__data.__lock, +- pshared); +- +- pi_flag = (err == 0); ++ /* We have to conservatively undo our potential mistake of stealing ++ a signal. We can stop trying to do that when the current G1 ++ changes because other spinning waiters will notice this too and ++ __condvar_quiesce_and_switch_g1 has checked that there are no ++ futex waiters anymore before switching G1. ++ Relaxed MO is fine for the __g1_start load because we need to ++ merely be able to observe this fact and not have to observe ++ something else as well. ++ ??? Would it help to spin for a little while to see whether the ++ current G1 gets closed? This might be worthwhile if the group is ++ small or close to being closed. */ ++ unsigned int s = atomic_load_relaxed (cond->__data.__g_signals + g); ++ while (__condvar_load_g1_start_relaxed (cond) == g1_start) ++ { ++ /* Try to add a signal. We don't need to acquire the lock ++ because at worst we can cause a spurious wake-up. If the ++ group is in the process of being closed (LSB is true), this ++ has an effect similar to us adding a signal. */ ++ if (((s & 1) != 0) ++ || atomic_compare_exchange_weak_relaxed ++ (cond->__data.__g_signals + g, &s, s + 2)) ++ { ++ /* If we added a signal, we also need to add a wake-up on ++ the futex. We also need to do that if we skipped adding ++ a signal because the group is being closed because ++ while __condvar_quiesce_and_switch_g1 could have closed ++ the group, it might stil be waiting for futex waiters to ++ leave (and one of those waiters might be the one we stole ++ the signal from, which cause it to block using the ++ futex). */ ++ futex_wake (cond->__data.__g_signals + g, 1, private); ++ break; ++ } ++ /* TODO Back off. */ ++ } + } +- else +-#endif +- /* Wait until woken by signal or broadcast. */ +- lll_futex_wait (&cond->__data.__futex, futex_val, pshared); +- +- /* Disable asynchronous cancellation. */ +- __pthread_disable_asynccancel (cbuffer.oldtype); +- +- /* We are going to look at shared data again, so get the lock. */ +- lll_lock (cond->__data.__lock, pshared); +- +- /* If a broadcast happened, we are done. */ +- if (cbuffer.bc_seq != cond->__data.__broadcast_seq) +- goto bc_out; +- +- /* Check whether we are eligible for wakeup. */ +- val = cond->__data.__wakeup_seq; + } +- while (val == seq || cond->__data.__woken_seq == val); + +- /* Another thread woken up. */ +- ++cond->__data.__woken_seq; ++ done: + +- bc_out: ++ /* Confirm that we have been woken. We do that before acquiring the mutex ++ to allow for execution of pthread_cond_destroy while having acquired the ++ mutex. */ ++ __condvar_confirm_wakeup (cond, private); + +- cond->__data.__nwaiters -= 1 << COND_NWAITERS_SHIFT; +- +- /* If pthread_cond_destroy was called on this varaible already, +- notify the pthread_cond_destroy caller all waiters have left +- and it can be successfully destroyed. */ +- if (cond->__data.__total_seq == -1ULL +- && cond->__data.__nwaiters < (1 << COND_NWAITERS_SHIFT)) +- lll_futex_wake (&cond->__data.__nwaiters, 1, pshared); ++ /* Woken up; now re-acquire the mutex. If this doesn't fail, return RESULT, ++ which is set to ETIMEDOUT if a timeout occured, or zero otherwise. */ ++ err = __pthread_mutex_cond_lock (mutex); ++ /* XXX Abort on errors that are disallowed by POSIX? */ ++ return (err != 0) ? err : result; ++} + +- /* We are done with the condvar. */ +- lll_unlock (cond->__data.__lock, pshared); + +- /* The cancellation handling is back to normal, remove the handler. */ +- __pthread_cleanup_pop (&buffer, 0); ++/* See __pthread_cond_wait_common. */ ++int ++__pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) ++{ ++ return __pthread_cond_wait_common (cond, mutex, NULL); ++} + +- /* Get the mutex before returning. Not needed for PI. */ +-#if (defined lll_futex_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +- if (pi_flag) +- { +- __pthread_mutex_cond_lock_adjust (mutex); +- return 0; +- } +- else +-#endif +- return __pthread_mutex_cond_lock (mutex); ++/* See __pthread_cond_wait_common. */ ++int ++__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, ++ const struct timespec *abstime) ++{ ++ /* Check parameter validity. This should also tell the compiler that ++ it can assume that abstime is not NULL. */ ++ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) ++ return EINVAL; ++ return __pthread_cond_wait_common (cond, mutex, abstime); + } + + versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, + GLIBC_2_3_2); ++versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, ++ GLIBC_2_3_2); +diff --git a/nptl/pthread_condattr_getclock.c b/nptl/pthread_condattr_getclock.c +index d156302..cecb4aa 100644 +--- a/nptl/pthread_condattr_getclock.c ++++ b/nptl/pthread_condattr_getclock.c +@@ -23,6 +23,6 @@ int + pthread_condattr_getclock (const pthread_condattr_t *attr, clockid_t *clock_id) + { + *clock_id = (((((const struct pthread_condattr *) attr)->value) >> 1) +- & ((1 << COND_NWAITERS_SHIFT) - 1)); ++ & ((1 << COND_CLOCK_BITS) - 1)); + return 0; + } +diff --git a/nptl/pthread_condattr_getpshared.c b/nptl/pthread_condattr_getpshared.c +index 5a10f3e..8147966 100644 +--- a/nptl/pthread_condattr_getpshared.c ++++ b/nptl/pthread_condattr_getpshared.c +@@ -22,7 +22,8 @@ + int + pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared) + { +- *pshared = ((const struct pthread_condattr *) attr)->value & 1; ++ *pshared = (((const struct pthread_condattr *) attr)->value & 1 ++ ? PTHREAD_PROCESS_SHARED : PTHREAD_PROCESS_PRIVATE); + + return 0; + } +diff --git a/nptl/pthread_condattr_init.c b/nptl/pthread_condattr_init.c +index 0ce42e5..6e5168d 100644 +--- a/nptl/pthread_condattr_init.c ++++ b/nptl/pthread_condattr_init.c +@@ -23,7 +23,9 @@ + int + __pthread_condattr_init (pthread_condattr_t *attr) + { +- memset (attr, '\0', sizeof (*attr)); ++ struct pthread_condattr *iattr = (struct pthread_condattr *) attr; ++ /* Default is not pshared and CLOCK_REALTIME. */ ++ iattr-> value = CLOCK_REALTIME << 1; + + return 0; + } +diff --git a/nptl/pthread_condattr_setclock.c b/nptl/pthread_condattr_setclock.c +index 25e2a17..3cfad84 100644 +--- a/nptl/pthread_condattr_setclock.c ++++ b/nptl/pthread_condattr_setclock.c +@@ -18,7 +18,7 @@ + + #include + #include +-#include ++#include + #include + #include + #include "pthreadP.h" +@@ -33,12 +33,17 @@ pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock_id) + in the pthread_cond_t structure needs to be adjusted. */ + return EINVAL; + ++ /* If we do not support waiting using CLOCK_MONOTONIC, return an error. */ ++ if (clock_id == CLOCK_MONOTONIC ++ && !futex_supports_exact_relative_timeouts()) ++ return ENOTSUP; ++ + /* Make sure the value fits in the bits we reserved. */ +- assert (clock_id < (1 << COND_NWAITERS_SHIFT)); ++ assert (clock_id < (1 << COND_CLOCK_BITS)); + + int *valuep = &((struct pthread_condattr *) attr)->value; + +- *valuep = ((*valuep & ~(((1 << COND_NWAITERS_SHIFT) - 1) << 1)) ++ *valuep = ((*valuep & ~(((1 << COND_CLOCK_BITS) - 1) << 1)) + | (clock_id << 1)); + + return 0; +diff --git a/nptl/test-cond-printers.py b/nptl/test-cond-printers.py +index af0e12e..9e807c9 100644 +--- a/nptl/test-cond-printers.py ++++ b/nptl/test-cond-printers.py +@@ -35,7 +35,7 @@ try: + + break_at(test_source, 'Test status (destroyed)') + continue_cmd() # Go to test_status_destroyed +- test_printer(var, to_string, {'Status': 'Destroyed'}) ++ test_printer(var, to_string, {'Threads known to still execute a wait function': '0'}) + + continue_cmd() # Exit + +diff --git a/nptl/tst-cond1.c b/nptl/tst-cond1.c +index 75ab9c8..509bbd0 100644 +--- a/nptl/tst-cond1.c ++++ b/nptl/tst-cond1.c +@@ -73,6 +73,9 @@ do_test (void) + + puts ("parent: wait for condition"); + ++ /* This test will fail on spurious wake-ups, which are allowed; however, ++ the current implementation shouldn't produce spurious wake-ups in the ++ scenario we are testing here. */ + err = pthread_cond_wait (&cond, &mut); + if (err != 0) + error (EXIT_FAILURE, err, "parent: cannot wait fir signal"); +diff --git a/nptl/tst-cond20.c b/nptl/tst-cond20.c +index 918c4ad..665a66a 100644 +--- a/nptl/tst-cond20.c ++++ b/nptl/tst-cond20.c +@@ -96,7 +96,10 @@ do_test (void) + + for (i = 0; i < ROUNDS; ++i) + { +- pthread_cond_wait (&cond2, &mut); ++ /* Make sure we discard spurious wake-ups. */ ++ do ++ pthread_cond_wait (&cond2, &mut); ++ while (count != N); + + if (i & 1) + pthread_mutex_unlock (&mut); +diff --git a/nptl/tst-cond22.c b/nptl/tst-cond22.c +index bd978e5..64f19ea 100644 +--- a/nptl/tst-cond22.c ++++ b/nptl/tst-cond22.c +@@ -106,10 +106,11 @@ do_test (void) + status = 1; + } + +- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", +- c.__data.__lock, c.__data.__futex, c.__data.__total_seq, +- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, +- c.__data.__nwaiters, c.__data.__broadcast_seq); ++ printf ("cond = { %llu, %llu, %u/%u/%u, %u/%u/%u, %u, %u }\n", ++ c.__data.__wseq, c.__data.__g1_start, ++ c.__data.__g_signals[0], c.__data.__g_refs[0], c.__data.__g_size[0], ++ c.__data.__g_signals[1], c.__data.__g_refs[1], c.__data.__g_size[1], ++ c.__data.__g1_orig_size, c.__data.__wrefs); + + if (pthread_create (&th, NULL, tf, (void *) 1l) != 0) + { +@@ -148,10 +149,11 @@ do_test (void) + status = 1; + } + +- printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", +- c.__data.__lock, c.__data.__futex, c.__data.__total_seq, +- c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, +- c.__data.__nwaiters, c.__data.__broadcast_seq); ++ printf ("cond = { %llu, %llu, %u/%u/%u, %u/%u/%u, %u, %u }\n", ++ c.__data.__wseq, c.__data.__g1_start, ++ c.__data.__g_signals[0], c.__data.__g_refs[0], c.__data.__g_size[0], ++ c.__data.__g_signals[1], c.__data.__g_refs[1], c.__data.__g_size[1], ++ c.__data.__g1_orig_size, c.__data.__wrefs); + + return status; + } +diff --git a/sysdeps/aarch64/nptl/bits/pthreadtypes.h b/sysdeps/aarch64/nptl/bits/pthreadtypes.h +index 13984a7..c6fa632 100644 +--- a/sysdeps/aarch64/nptl/bits/pthreadtypes.h ++++ b/sysdeps/aarch64/nptl/bits/pthreadtypes.h +@@ -90,17 +90,30 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; +- long int __align; ++ __extension__ long long int __align; + } pthread_cond_t; + + typedef union +diff --git a/sysdeps/arm/nptl/bits/pthreadtypes.h b/sysdeps/arm/nptl/bits/pthreadtypes.h +index afb5392..53518c6 100644 +--- a/sysdeps/arm/nptl/bits/pthreadtypes.h ++++ b/sysdeps/arm/nptl/bits/pthreadtypes.h +@@ -93,14 +93,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/ia64/nptl/bits/pthreadtypes.h b/sysdeps/ia64/nptl/bits/pthreadtypes.h +index f2e6dac..e72dbfd 100644 +--- a/sysdeps/ia64/nptl/bits/pthreadtypes.h ++++ b/sysdeps/ia64/nptl/bits/pthreadtypes.h +@@ -90,17 +90,30 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; +- long int __align; ++ __extension__ long long int __align; + } pthread_cond_t; + + typedef union +diff --git a/sysdeps/m68k/nptl/bits/pthreadtypes.h b/sysdeps/m68k/nptl/bits/pthreadtypes.h +index d8faa7a..c5e9021 100644 +--- a/sysdeps/m68k/nptl/bits/pthreadtypes.h ++++ b/sysdeps/m68k/nptl/bits/pthreadtypes.h +@@ -88,19 +88,33 @@ typedef union + + + /* Data structure for conditional variable handling. The structure of +- the attribute type is deliberately not exposed. */ ++ the attribute type is not exposed on purpose. */ + typedef union + { + struct + { +- int __lock __attribute__ ((__aligned__ (4))); +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ /* Enforce proper alignment of fields used as futex words. */ ++ unsigned int __g_refs[2] __attribute__ ((__aligned__ (4))); ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/microblaze/nptl/bits/pthreadtypes.h b/sysdeps/microblaze/nptl/bits/pthreadtypes.h +index 9e9e307..b6623c2 100644 +--- a/sysdeps/microblaze/nptl/bits/pthreadtypes.h ++++ b/sysdeps/microblaze/nptl/bits/pthreadtypes.h +@@ -91,14 +91,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/mips/nptl/bits/pthreadtypes.h b/sysdeps/mips/nptl/bits/pthreadtypes.h +index 68ed94b..7ddc7bf 100644 +--- a/sysdeps/mips/nptl/bits/pthreadtypes.h ++++ b/sysdeps/mips/nptl/bits/pthreadtypes.h +@@ -117,19 +117,32 @@ typedef union + + + /* Data structure for conditional variable handling. The structure of +- the attribute type is deliberately not exposed. */ ++ the attribute type is not exposed on purpose. */ + typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/nios2/nptl/bits/pthreadtypes.h b/sysdeps/nios2/nptl/bits/pthreadtypes.h +index 76076d0..3995e26 100644 +--- a/sysdeps/nios2/nptl/bits/pthreadtypes.h ++++ b/sysdeps/nios2/nptl/bits/pthreadtypes.h +@@ -88,19 +88,32 @@ typedef union + + + /* Data structure for conditional variable handling. The structure of +- the attribute type is deliberately not exposed. */ ++ the attribute type is not exposed on purpose. */ + typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/nptl/internaltypes.h b/sysdeps/nptl/internaltypes.h +index 203c548..31e5a43 100644 +--- a/sysdeps/nptl/internaltypes.h ++++ b/sysdeps/nptl/internaltypes.h +@@ -68,20 +68,13 @@ struct pthread_condattr + { + /* Combination of values: + +- Bit 0 : flag whether conditional variable will be sharable between +- processes. +- +- Bit 1-7: clock ID. */ ++ Bit 0 : flag whether conditional variable will be ++ sharable between processes. ++ Bit 1-COND_CLOCK_BITS: Clock ID. COND_CLOCK_BITS is the number of bits ++ needed to represent the ID of the clock. */ + int value; + }; +- +- +-/* The __NWAITERS field is used as a counter and to house the number +- of bits for other purposes. COND_CLOCK_BITS is the number +- of bits needed to represent the ID of the clock. COND_NWAITERS_SHIFT +- is the number of bits reserved for other purposes like the clock. */ +-#define COND_CLOCK_BITS 1 +-#define COND_NWAITERS_SHIFT 1 ++#define COND_CLOCK_BITS 1 + + + /* Read-write lock variable attribute data structure. */ +diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h +index fd0894e..c122446 100644 +--- a/sysdeps/nptl/pthread.h ++++ b/sysdeps/nptl/pthread.h +@@ -183,7 +183,7 @@ enum + + + /* Conditional variable handling. */ +-#define PTHREAD_COND_INITIALIZER { { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } } ++#define PTHREAD_COND_INITIALIZER { { {0}, {0}, {0, 0}, {0, 0}, 0, 0, {0, 0} } } + + + /* Cleanup buffers */ +diff --git a/sysdeps/s390/nptl/bits/pthreadtypes.h b/sysdeps/s390/nptl/bits/pthreadtypes.h +index 40d10fe..4e455ab 100644 +--- a/sysdeps/s390/nptl/bits/pthreadtypes.h ++++ b/sysdeps/s390/nptl/bits/pthreadtypes.h +@@ -142,14 +142,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/sh/nptl/bits/pthreadtypes.h b/sysdeps/sh/nptl/bits/pthreadtypes.h +index 13fbd73..065dd11 100644 +--- a/sysdeps/sh/nptl/bits/pthreadtypes.h ++++ b/sysdeps/sh/nptl/bits/pthreadtypes.h +@@ -93,14 +93,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/tile/nptl/bits/pthreadtypes.h b/sysdeps/tile/nptl/bits/pthreadtypes.h +index 7d68650..c12737f 100644 +--- a/sysdeps/tile/nptl/bits/pthreadtypes.h ++++ b/sysdeps/tile/nptl/bits/pthreadtypes.h +@@ -122,14 +122,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h +index 1a1779b..d88b045 100644 +--- a/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h ++++ b/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h +@@ -84,19 +84,32 @@ typedef union + + + /* Data structure for conditional variable handling. The structure of +- the attribute type is deliberately not exposed. */ ++ the attribute type is not exposed on purpose. */ + typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/unix/sysv/linux/hppa/internaltypes.h b/sysdeps/unix/sysv/linux/hppa/internaltypes.h +index 651ce2e..d649657 100644 +--- a/sysdeps/unix/sysv/linux/hppa/internaltypes.h ++++ b/sysdeps/unix/sysv/linux/hppa/internaltypes.h +@@ -46,32 +46,38 @@ fails because __initializer is zero, and the structure will be used as + is correctly. */ + + #define cond_compat_clear(var) \ +-({ \ +- int tmp = 0; \ +- var->__data.__lock = 0; \ +- var->__data.__futex = 0; \ +- var->__data.__mutex = NULL; \ +- /* Clear __initializer last, to indicate initialization is done. */ \ +- __asm__ __volatile__ ("stw,ma %1,0(%0)" \ +- : : "r" (&var->__data.__initializer), "r" (tmp) : "memory"); \ ++({ \ ++ int tmp = 0; \ ++ var->__data.__wseq = 0; \ ++ var->__data.__signals_sent = 0; \ ++ var->__data.__confirmed = 0; \ ++ var->__data.__generation = 0; \ ++ var->__data.__mutex = NULL; \ ++ var->__data.__quiescence_waiters = 0; \ ++ var->__data.__clockid = 0; \ ++ /* Clear __initializer last, to indicate initialization is done. */ \ ++ /* This synchronizes-with the acquire load below. */ \ ++ atomic_store_release (&var->__data.__initializer, 0); \ + }) + + #define cond_compat_check_and_clear(var) \ + ({ \ +- int ret; \ +- volatile int *value = &var->__data.__initializer; \ +- if ((ret = atomic_compare_and_exchange_val_acq(value, 2, 1))) \ ++ int v; \ ++ int *value = &var->__data.__initializer; \ ++ /* This synchronizes-with the release store above. */ \ ++ while ((v = atomic_load_acquire (value)) != 0) \ + { \ +- if (ret == 1) \ ++ if (v == 1 \ ++ /* Relaxed MO is fine; it only matters who's first. */ \ ++ && atomic_compare_exchange_acquire_weak_relaxed (value, 1, 2)) \ + { \ +- /* Initialize structure. */ \ ++ /* We're first; initialize structure. */ \ + cond_compat_clear (var); \ ++ break; \ + } \ + else \ +- { \ +- /* Yield until structure is initialized. */ \ +- while (*value == 2) sched_yield (); \ +- } \ ++ /* Yield before we re-check initialization status. */ \ ++ sched_yield (); \ + } \ + }) + +diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c +deleted file mode 100644 +index ec6fd23..0000000 +--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_timedwait.c ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* Copyright (C) 2009-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Carlos O'Donell , 2009. +- +- 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 +- . */ +- +-#ifndef INCLUDED_SELF +-# define INCLUDED_SELF +-# include +-#else +-# include +-# include +-# include +-# include +-int +-__pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, +- const struct timespec *abstime) +-{ +- cond_compat_check_and_clear (cond); +- return __pthread_cond_timedwait_internal (cond, mutex, abstime); +-} +-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, +- GLIBC_2_3_2); +-# undef versioned_symbol +-# define versioned_symbol(lib, local, symbol, version) +-# undef __pthread_cond_timedwait +-# define __pthread_cond_timedwait __pthread_cond_timedwait_internal +-# include_next +-#endif +diff --git a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c +index 8f02831..0611f7d 100644 +--- a/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c ++++ b/sysdeps/unix/sysv/linux/hppa/pthread_cond_wait.c +@@ -32,9 +32,22 @@ __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) + } + versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, + GLIBC_2_3_2); ++int ++__pthread_cond_timedwait (cond, mutex, abstime) ++ pthread_cond_t *cond; ++ pthread_mutex_t *mutex; ++ const struct timespec *abstime; ++{ ++ cond_compat_check_and_clear (cond); ++ return __pthread_cond_timedwait_internal (cond, mutex, abstime); ++} ++versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, ++ GLIBC_2_3_2); + # undef versioned_symbol + # define versioned_symbol(lib, local, symbol, version) + # undef __pthread_cond_wait + # define __pthread_cond_wait __pthread_cond_wait_internal ++# undef __pthread_cond_timedwait ++# define __pthread_cond_timedwait __pthread_cond_timedwait_internal + # include_next + #endif +diff --git a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S +deleted file mode 100644 +index f697e5b..0000000 +--- a/sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S ++++ /dev/null +@@ -1,20 +0,0 @@ +-/* Copyright (C) 2003-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2003. +- +- 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 +- . */ +- +-#define HAVE_CMOV 1 +-#include "../pthread_cond_timedwait.S" +diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S +deleted file mode 100644 +index 5996688..0000000 +--- a/sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S ++++ /dev/null +@@ -1,241 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- .text +- +- /* int pthread_cond_broadcast (pthread_cond_t *cond) */ +- .globl __pthread_cond_broadcast +- .type __pthread_cond_broadcast, @function +- .align 16 +-__pthread_cond_broadcast: +- cfi_startproc +- pushl %ebx +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebx, 0) +- pushl %esi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%esi, 0) +- pushl %edi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%edi, 0) +- pushl %ebp +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebp, 0) +- cfi_remember_state +- +- movl 20(%esp), %ebx +- +- LIBC_PROBE (cond_broadcast, 1, %edx) +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jnz 1f +- +-2: addl $cond_futex, %ebx +- movl total_seq+4-cond_futex(%ebx), %eax +- movl total_seq-cond_futex(%ebx), %ebp +- cmpl wakeup_seq+4-cond_futex(%ebx), %eax +- ja 3f +- jb 4f +- cmpl wakeup_seq-cond_futex(%ebx), %ebp +- jna 4f +- +- /* Cause all currently waiting threads to recognize they are +- woken up. */ +-3: movl %ebp, wakeup_seq-cond_futex(%ebx) +- movl %eax, wakeup_seq-cond_futex+4(%ebx) +- movl %ebp, woken_seq-cond_futex(%ebx) +- movl %eax, woken_seq-cond_futex+4(%ebx) +- addl %ebp, %ebp +- addl $1, broadcast_seq-cond_futex(%ebx) +- movl %ebp, (%ebx) +- +- /* Get the address of the mutex used. */ +- movl dep_mutex-cond_futex(%ebx), %edi +- +- /* Unlock. */ +- LOCK +- subl $1, cond_lock-cond_futex(%ebx) +- jne 7f +- +- /* Don't use requeue for pshared condvars. */ +-8: cmpl $-1, %edi +- je 9f +- +- /* Do not use requeue for pshared condvars. */ +- testl $PS_BIT, MUTEX_KIND(%edi) +- jne 9f +- +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%edi), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- je 81f +- +- /* Wake up all threads. */ +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %ecx +-#else +- movl %gs:PRIVATE_FUTEX, %ecx +- orl $FUTEX_CMP_REQUEUE, %ecx +-#endif +- movl $SYS_futex, %eax +- movl $0x7fffffff, %esi +- movl $1, %edx +- /* Get the address of the futex involved. */ +-# if MUTEX_FUTEX != 0 +- addl $MUTEX_FUTEX, %edi +-# endif +-/* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for sysenter. +- ENTER_KERNEL */ +- int $0x80 +- +- /* For any kind of error, which mainly is EAGAIN, we try again +- with WAKE. The general test also covers running on old +- kernels. */ +- cmpl $0xfffff001, %eax +- jae 9f +- +-6: xorl %eax, %eax +- popl %ebp +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebp) +- popl %edi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%edi) +- popl %esi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%esi) +- popl %ebx +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebx) +- ret +- +- cfi_restore_state +- +-81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx +- movl $SYS_futex, %eax +- movl $0x7fffffff, %esi +- movl $1, %edx +- /* Get the address of the futex involved. */ +-# if MUTEX_FUTEX != 0 +- addl $MUTEX_FUTEX, %edi +-# endif +- int $0x80 +- +- /* For any kind of error, which mainly is EAGAIN, we try again +- with WAKE. The general test also covers running on old +- kernels. */ +- cmpl $0xfffff001, %eax +- jb 6b +- jmp 9f +- +- /* Initial locking failed. */ +-1: +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 2b +- +- .align 16 +- /* Unlock. */ +-4: LOCK +- subl $1, cond_lock-cond_futex(%ebx) +- je 6b +- +- /* Unlock in loop requires wakeup. */ +-5: leal cond_lock-cond_futex(%ebx), %eax +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 6b +- +- /* Unlock in loop requires wakeup. */ +-7: leal cond_lock-cond_futex(%ebx), %eax +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 8b +- +-9: /* The futex requeue functionality is not available. */ +- movl $0x7fffffff, %edx +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $SYS_futex, %eax +- ENTER_KERNEL +- jmp 6b +- cfi_endproc +- .size __pthread_cond_broadcast, .-__pthread_cond_broadcast +-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast, +- GLIBC_2_3_2) +diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S +deleted file mode 100644 +index 0038775..0000000 +--- a/sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S ++++ /dev/null +@@ -1,216 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- .text +- +- /* int pthread_cond_signal (pthread_cond_t *cond) */ +- .globl __pthread_cond_signal +- .type __pthread_cond_signal, @function +- .align 16 +-__pthread_cond_signal: +- +- cfi_startproc +- pushl %ebx +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebx, 0) +- pushl %edi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%edi, 0) +- cfi_remember_state +- +- movl 12(%esp), %edi +- +- LIBC_PROBE (cond_signal, 1, %edi) +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%edi) +-#else +- cmpxchgl %edx, cond_lock(%edi) +-#endif +- jnz 1f +- +-2: leal cond_futex(%edi), %ebx +- movl total_seq+4(%edi), %eax +- movl total_seq(%edi), %ecx +- cmpl wakeup_seq+4(%edi), %eax +-#if cond_lock != 0 +- /* Must use leal to preserve the flags. */ +- leal cond_lock(%edi), %edi +-#endif +- ja 3f +- jb 4f +- cmpl wakeup_seq-cond_futex(%ebx), %ecx +- jbe 4f +- +- /* Bump the wakeup number. */ +-3: addl $1, wakeup_seq-cond_futex(%ebx) +- adcl $0, wakeup_seq-cond_futex+4(%ebx) +- addl $1, (%ebx) +- +- /* Wake up one thread. */ +- pushl %esi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%esi, 0) +- pushl %ebp +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebp, 0) +- +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- sete %cl +- je 8f +- +- movl dep_mutex-cond_futex(%ebx), %edx +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%edx), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- je 9f +- +-8: subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE_OP, %ecx +- movl $SYS_futex, %eax +- movl $1, %edx +- movl $1, %esi +- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %ebp +- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for +- sysenter. +- ENTER_KERNEL */ +- int $0x80 +- popl %ebp +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebp) +- popl %esi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%esi) +- +- /* For any kind of error, we try again with WAKE. +- The general test also covers running on old kernels. */ +- cmpl $-4095, %eax +- jae 7f +- +-6: xorl %eax, %eax +- popl %edi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%edi) +- popl %ebx +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebx) +- ret +- +- cfi_restore_state +- +-9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx +- movl $SYS_futex, %eax +- movl $1, %edx +- xorl %esi, %esi +- movl dep_mutex-cond_futex(%ebx), %edi +- movl (%ebx), %ebp +- /* FIXME: Until Ingo fixes 4G/4G vDSO, 6 arg syscalls are broken for +- sysenter. +- ENTER_KERNEL */ +- int $0x80 +- popl %ebp +- popl %esi +- +- leal -cond_futex(%ebx), %edi +- +- /* For any kind of error, we try again with WAKE. +- The general test also covers running on old kernels. */ +- cmpl $-4095, %eax +- jb 4f +- +-7: +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- orl $FUTEX_WAKE, %ecx +- +- movl $SYS_futex, %eax +- /* %edx should be 1 already from $FUTEX_WAKE_OP syscall. +- movl $1, %edx */ +- ENTER_KERNEL +- +- /* Unlock. Note that at this point %edi always points to +- cond_lock. */ +-4: LOCK +- subl $1, (%edi) +- je 6b +- +- /* Unlock in loop requires wakeup. */ +-5: movl %edi, %eax +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 6b +- +- /* Initial locking failed. */ +-1: +-#if cond_lock == 0 +- movl %edi, %edx +-#else +- leal cond_lock(%edi), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%edi) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 2b +- +- cfi_endproc +- .size __pthread_cond_signal, .-__pthread_cond_signal +-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, +- GLIBC_2_3_2) +diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S +deleted file mode 100644 +index 6256376..0000000 +--- a/sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S ++++ /dev/null +@@ -1,974 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- .text +- +-/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, +- const struct timespec *abstime) */ +- .globl __pthread_cond_timedwait +- .type __pthread_cond_timedwait, @function +- .align 16 +-__pthread_cond_timedwait: +-.LSTARTCODE: +- cfi_startproc +-#ifdef SHARED +- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect, +- DW.ref.__gcc_personality_v0) +- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART) +-#else +- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0) +- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART) +-#endif +- +- pushl %ebp +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebp, 0) +- pushl %edi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%edi, 0) +- pushl %esi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%esi, 0) +- pushl %ebx +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebx, 0) +- +- movl 20(%esp), %ebx +- movl 28(%esp), %ebp +- +- LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp) +- +- cmpl $1000000000, 4(%ebp) +- movl $EINVAL, %eax +- jae 18f +- +- /* Stack frame: +- +- esp + 32 +- +--------------------------+ +- esp + 24 | timeout value | +- +--------------------------+ +- esp + 20 | futex pointer | +- +--------------------------+ +- esp + 16 | pi-requeued flag | +- +--------------------------+ +- esp + 12 | old broadcast_seq value | +- +--------------------------+ +- esp + 4 | old wake_seq value | +- +--------------------------+ +- esp + 0 | old cancellation mode | +- +--------------------------+ +- */ +- +-#ifndef __ASSUME_FUTEX_CLOCK_REALTIME +-# ifdef PIC +- LOAD_PIC_REG (cx) +- cmpl $0, __have_futex_clock_realtime@GOTOFF(%ecx) +-# else +- cmpl $0, __have_futex_clock_realtime +-# endif +- je .Lreltmo +-#endif +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jnz 1f +- +- /* Store the reference to the mutex. If there is already a +- different value in there this is a bad user bug. */ +-2: cmpl $-1, dep_mutex(%ebx) +- movl 24(%esp), %eax +- je 17f +- movl %eax, dep_mutex(%ebx) +- +- /* Unlock the mutex. */ +-17: xorl %edx, %edx +- call __pthread_mutex_unlock_usercnt +- +- testl %eax, %eax +- jne 16f +- +- addl $1, total_seq(%ebx) +- adcl $0, total_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +-#ifdef __ASSUME_FUTEX_CLOCK_REALTIME +-# define FRAME_SIZE 24 +-#else +-# define FRAME_SIZE 32 +-#endif +- subl $FRAME_SIZE, %esp +- cfi_adjust_cfa_offset(FRAME_SIZE) +- cfi_remember_state +- +- /* Get and store current wakeup_seq value. */ +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- movl broadcast_seq(%ebx), %eax +- movl %edi, 4(%esp) +- movl %edx, 8(%esp) +- movl %eax, 12(%esp) +- +- /* Reset the pi-requeued flag. */ +- movl $0, 16(%esp) +- +- cmpl $0, (%ebp) +- movl $-ETIMEDOUT, %esi +- js 6f +- +-8: movl cond_futex(%ebx), %edi +- movl %edi, 20(%esp) +- +- /* Unlock. */ +- LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 3f +- +-.LcleanupSTART: +-4: call __pthread_enable_asynccancel +- movl %eax, (%esp) +- +- leal (%ebp), %esi +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- sete %cl +- je 40f +- +- movl dep_mutex(%ebx), %edi +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%edi), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 40f +- +- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx +- /* The following only works like this because we only support +- two clocks, represented using a single bit. */ +- testl $1, cond_nwaiters(%ebx) +- /* XXX Need to implement using sete instead of a jump. */ +- jne 42f +- orl $FUTEX_CLOCK_REALTIME, %ecx +- +-42: movl 20(%esp), %edx +- addl $cond_futex, %ebx +-.Ladd_cond_futex_pi: +- movl $SYS_futex, %eax +- ENTER_KERNEL +- subl $cond_futex, %ebx +-.Lsub_cond_futex_pi: +- movl %eax, %esi +- /* Set the pi-requeued flag only if the kernel has returned 0. The +- kernel does not hold the mutex on ETIMEDOUT or any other error. */ +- cmpl $0, %eax +- sete 16(%esp) +- je 41f +- +- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns +- successfully, it has already locked the mutex for us and the +- pi_flag (16(%esp)) is set to denote that fact. However, if another +- thread changed the futex value before we entered the wait, the +- syscall may return an EAGAIN and the mutex is not locked. We go +- ahead with a success anyway since later we look at the pi_flag to +- decide if we got the mutex or not. The sequence numbers then make +- sure that only one of the threads actually wake up. We retry using +- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal +- and PI futexes don't mix. +- +- Note that we don't check for EAGAIN specifically; we assume that the +- only other error the futex function could return is EAGAIN (barring +- the ETIMEOUT of course, for the timeout case in futex) since +- anything else would mean an error in our function. It is too +- expensive to do that check for every call (which is quite common in +- case of a large number of threads), so it has been skipped. */ +- cmpl $-ENOSYS, %eax +- jne 41f +- xorl %ecx, %ecx +- +-40: subl $1, %ecx +- movl $0, 16(%esp) +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAIT_BITSET, %ecx +- /* The following only works like this because we only support +- two clocks, represented using a single bit. */ +- testl $1, cond_nwaiters(%ebx) +- jne 30f +- orl $FUTEX_CLOCK_REALTIME, %ecx +-30: +- movl 20(%esp), %edx +- movl $0xffffffff, %ebp +- addl $cond_futex, %ebx +-.Ladd_cond_futex: +- movl $SYS_futex, %eax +- ENTER_KERNEL +- subl $cond_futex, %ebx +-.Lsub_cond_futex: +- movl 28+FRAME_SIZE(%esp), %ebp +- movl %eax, %esi +- +-41: movl (%esp), %eax +- call __pthread_disable_asynccancel +-.LcleanupEND: +- +- /* Lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jnz 5f +- +-6: movl broadcast_seq(%ebx), %eax +- cmpl 12(%esp), %eax +- jne 23f +- +- movl woken_seq(%ebx), %eax +- movl woken_seq+4(%ebx), %ecx +- +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- +- cmpl 8(%esp), %edx +- jne 7f +- cmpl 4(%esp), %edi +- je 15f +- +-7: cmpl %ecx, %edx +- jne 9f +- cmp %eax, %edi +- jne 9f +- +-15: cmpl $-ETIMEDOUT, %esi +- je 28f +- +- /* We need to go back to futex_wait. If we're using requeue_pi, then +- release the mutex we had acquired and go back. */ +- movl 16(%esp), %edx +- test %edx, %edx +- jz 8b +- +- /* Adjust the mutex values first and then unlock it. The unlock +- should always succeed or else the kernel did not lock the mutex +- correctly. */ +- movl dep_mutex(%ebx), %eax +- call __pthread_mutex_cond_lock_adjust +- movl dep_mutex(%ebx), %eax +- xorl %edx, %edx +- call __pthread_mutex_unlock_usercnt +- jmp 8b +- +-28: addl $1, wakeup_seq(%ebx) +- adcl $0, wakeup_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- movl $ETIMEDOUT, %esi +- jmp 14f +- +-23: xorl %esi, %esi +- jmp 24f +- +-9: xorl %esi, %esi +-14: addl $1, woken_seq(%ebx) +- adcl $0, woken_seq+4(%ebx) +- +-24: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- movl total_seq(%ebx), %eax +- andl total_seq+4(%ebx), %eax +- cmpl $0xffffffff, %eax +- jne 25f +- movl cond_nwaiters(%ebx), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 25f +- +- addl $cond_nwaiters, %ebx +- movl $SYS_futex, %eax +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_nwaiters(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $1, %edx +- ENTER_KERNEL +- subl $cond_nwaiters, %ebx +- +-25: LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 10f +- +-11: movl 24+FRAME_SIZE(%esp), %eax +- /* With requeue_pi, the mutex lock is held in the kernel. */ +- movl 16(%esp), %ecx +- testl %ecx, %ecx +- jnz 27f +- +- call __pthread_mutex_cond_lock +-26: addl $FRAME_SIZE, %esp +- cfi_adjust_cfa_offset(-FRAME_SIZE) +- +- /* We return the result of the mutex_lock operation if it failed. */ +- testl %eax, %eax +-#ifdef HAVE_CMOV +- cmovel %esi, %eax +-#else +- jne 22f +- movl %esi, %eax +-22: +-#endif +- +-18: popl %ebx +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebx) +- popl %esi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%esi) +- popl %edi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%edi) +- popl %ebp +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebp) +- +- ret +- +- cfi_restore_state +- +-27: call __pthread_mutex_cond_lock_adjust +- xorl %eax, %eax +- jmp 26b +- +- cfi_adjust_cfa_offset(-FRAME_SIZE); +- /* Initial locking failed. */ +-1: +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 2b +- +- /* The initial unlocking of the mutex failed. */ +-16: +- LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 18b +- +- movl %eax, %esi +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- +- movl %esi, %eax +- jmp 18b +- +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +- /* Unlock in loop requires wakeup. */ +-3: +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 4b +- +- /* Locking in loop failed. */ +-5: +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 6b +- +- /* Unlock after loop requires wakeup. */ +-10: +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 11b +- +-#ifndef __ASSUME_FUTEX_CLOCK_REALTIME +- cfi_adjust_cfa_offset(-FRAME_SIZE) +-.Lreltmo: +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-# if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-# else +- cmpxchgl %edx, cond_lock(%ebx) +-# endif +- jnz 101f +- +- /* Store the reference to the mutex. If there is already a +- different value in there this is a bad user bug. */ +-102: cmpl $-1, dep_mutex(%ebx) +- movl 24(%esp), %eax +- je 117f +- movl %eax, dep_mutex(%ebx) +- +- /* Unlock the mutex. */ +-117: xorl %edx, %edx +- call __pthread_mutex_unlock_usercnt +- +- testl %eax, %eax +- jne 16b +- +- addl $1, total_seq(%ebx) +- adcl $0, total_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +- subl $FRAME_SIZE, %esp +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +- /* Get and store current wakeup_seq value. */ +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- movl broadcast_seq(%ebx), %eax +- movl %edi, 4(%esp) +- movl %edx, 8(%esp) +- movl %eax, 12(%esp) +- +- /* Reset the pi-requeued flag. */ +- movl $0, 16(%esp) +- +- /* Get the current time. */ +-108: movl %ebx, %edx +-# ifdef __NR_clock_gettime +- /* Get the clock number. */ +- movl cond_nwaiters(%ebx), %ebx +- andl $((1 << nwaiters_shift) - 1), %ebx +- /* Only clocks 0 and 1 are allowed so far. Both are handled in the +- kernel. */ +- leal 24(%esp), %ecx +- movl $__NR_clock_gettime, %eax +- ENTER_KERNEL +- movl %edx, %ebx +- +- /* Compute relative timeout. */ +- movl (%ebp), %ecx +- movl 4(%ebp), %edx +- subl 24(%esp), %ecx +- subl 28(%esp), %edx +-# else +- /* Get the current time. */ +- leal 24(%esp), %ebx +- xorl %ecx, %ecx +- movl $__NR_gettimeofday, %eax +- ENTER_KERNEL +- movl %edx, %ebx +- +- /* Compute relative timeout. */ +- movl 28(%esp), %eax +- movl $1000, %edx +- mul %edx /* Milli seconds to nano seconds. */ +- movl (%ebp), %ecx +- movl 4(%ebp), %edx +- subl 24(%esp), %ecx +- subl %eax, %edx +-# endif +- jns 112f +- addl $1000000000, %edx +- subl $1, %ecx +-112: testl %ecx, %ecx +- movl $-ETIMEDOUT, %esi +- js 106f +- +- /* Store relative timeout. */ +-121: movl %ecx, 24(%esp) +- movl %edx, 28(%esp) +- +- movl cond_futex(%ebx), %edi +- movl %edi, 20(%esp) +- +- /* Unlock. */ +- LOCK +-# if cond_lock == 0 +- subl $1, (%ebx) +-# else +- subl $1, cond_lock(%ebx) +-# endif +- jne 103f +- +-.LcleanupSTART2: +-104: call __pthread_enable_asynccancel +- movl %eax, (%esp) +- +- leal 24(%esp), %esi +-# if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-# endif +- cmpl $-1, dep_mutex(%ebx) +- sete %cl +- subl $1, %ecx +-# ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-# else +- andl %gs:PRIVATE_FUTEX, %ecx +-# endif +-# if FUTEX_WAIT != 0 +- addl $FUTEX_WAIT, %ecx +-# endif +- movl 20(%esp), %edx +- addl $cond_futex, %ebx +-.Ladd_cond_futex2: +- movl $SYS_futex, %eax +- ENTER_KERNEL +- subl $cond_futex, %ebx +-.Lsub_cond_futex2: +- movl %eax, %esi +- +-141: movl (%esp), %eax +- call __pthread_disable_asynccancel +-.LcleanupEND2: +- +- +- /* Lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-# if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-# else +- cmpxchgl %edx, cond_lock(%ebx) +-# endif +- jnz 105f +- +-106: movl broadcast_seq(%ebx), %eax +- cmpl 12(%esp), %eax +- jne 23b +- +- movl woken_seq(%ebx), %eax +- movl woken_seq+4(%ebx), %ecx +- +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- +- cmpl 8(%esp), %edx +- jne 107f +- cmpl 4(%esp), %edi +- je 115f +- +-107: cmpl %ecx, %edx +- jne 9b +- cmp %eax, %edi +- jne 9b +- +-115: cmpl $-ETIMEDOUT, %esi +- je 28b +- +- jmp 8b +- +- cfi_adjust_cfa_offset(-FRAME_SIZE) +- /* Initial locking failed. */ +-101: +-# if cond_lock == 0 +- movl %ebx, %edx +-# else +- leal cond_lock(%ebx), %edx +-# endif +-# if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-# endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-# if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-# endif +- call __lll_lock_wait +- jmp 102b +- +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +- /* Unlock in loop requires wakeup. */ +-103: +-# if cond_lock == 0 +- movl %ebx, %eax +-# else +- leal cond_lock(%ebx), %eax +-# endif +-# if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-# endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-# if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-# endif +- call __lll_unlock_wake +- jmp 104b +- +- /* Locking in loop failed. */ +-105: +-# if cond_lock == 0 +- movl %ebx, %edx +-# else +- leal cond_lock(%ebx), %edx +-# endif +-# if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-# endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-# if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-# endif +- call __lll_lock_wait +- jmp 106b +-#endif +- +- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait +-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, +- GLIBC_2_3_2) +- +- +- .type __condvar_tw_cleanup2, @function +-__condvar_tw_cleanup2: +- subl $cond_futex, %ebx +- .size __condvar_tw_cleanup2, .-__condvar_tw_cleanup2 +- .type __condvar_tw_cleanup, @function +-__condvar_tw_cleanup: +- movl %eax, %esi +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jz 1f +- +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- +-1: movl broadcast_seq(%ebx), %eax +- cmpl 12(%esp), %eax +- jne 3f +- +- /* We increment the wakeup_seq counter only if it is lower than +- total_seq. If this is not the case the thread was woken and +- then canceled. In this case we ignore the signal. */ +- movl total_seq(%ebx), %eax +- movl total_seq+4(%ebx), %edi +- cmpl wakeup_seq+4(%ebx), %edi +- jb 6f +- ja 7f +- cmpl wakeup_seq(%ebx), %eax +- jbe 7f +- +-6: addl $1, wakeup_seq(%ebx) +- adcl $0, wakeup_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- +-7: addl $1, woken_seq(%ebx) +- adcl $0, woken_seq+4(%ebx) +- +-3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- xorl %edi, %edi +- movl total_seq(%ebx), %eax +- andl total_seq+4(%ebx), %eax +- cmpl $0xffffffff, %eax +- jne 4f +- movl cond_nwaiters(%ebx), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 4f +- +- addl $cond_nwaiters, %ebx +- movl $SYS_futex, %eax +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_nwaiters(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $1, %edx +- ENTER_KERNEL +- subl $cond_nwaiters, %ebx +- movl $1, %edi +- +-4: LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- je 2f +- +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- +- /* Wake up all waiters to make sure no signal gets lost. */ +-2: testl %edi, %edi +- jnz 5f +- addl $cond_futex, %ebx +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $SYS_futex, %eax +- movl $0x7fffffff, %edx +- ENTER_KERNEL +- +- /* Lock the mutex only if we don't own it already. This only happens +- in case of PI mutexes, if we got cancelled after a successful +- return of the futex syscall and before disabling async +- cancellation. */ +-5: movl 24+FRAME_SIZE(%esp), %eax +- movl MUTEX_KIND(%eax), %ebx +- andl $(ROBUST_BIT|PI_BIT), %ebx +- cmpl $PI_BIT, %ebx +- jne 8f +- +- movl (%eax), %ebx +- andl $TID_MASK, %ebx +- cmpl %ebx, %gs:TID +- jne 8f +- /* We managed to get the lock. Fix it up before returning. */ +- call __pthread_mutex_cond_lock_adjust +- jmp 9f +- +-8: call __pthread_mutex_cond_lock +- +-9: movl %esi, (%esp) +-.LcallUR: +- call _Unwind_Resume +- hlt +-.LENDCODE: +- cfi_endproc +- .size __condvar_tw_cleanup, .-__condvar_tw_cleanup +- +- +- .section .gcc_except_table,"a",@progbits +-.LexceptSTART: +- .byte DW_EH_PE_omit # @LPStart format (omit) +- .byte DW_EH_PE_omit # @TType format (omit) +- .byte DW_EH_PE_sdata4 # call-site format +- # DW_EH_PE_sdata4 +- .uleb128 .Lcstend-.Lcstbegin +-.Lcstbegin: +- .long .LcleanupSTART-.LSTARTCODE +- .long .Ladd_cond_futex_pi-.LcleanupSTART +- .long __condvar_tw_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .Ladd_cond_futex_pi-.LSTARTCODE +- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi +- .long __condvar_tw_cleanup2-.LSTARTCODE +- .uleb128 0 +- .long .Lsub_cond_futex_pi-.LSTARTCODE +- .long .Ladd_cond_futex-.Lsub_cond_futex_pi +- .long __condvar_tw_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .Ladd_cond_futex-.LSTARTCODE +- .long .Lsub_cond_futex-.Ladd_cond_futex +- .long __condvar_tw_cleanup2-.LSTARTCODE +- .uleb128 0 +- .long .Lsub_cond_futex-.LSTARTCODE +- .long .LcleanupEND-.Lsub_cond_futex +- .long __condvar_tw_cleanup-.LSTARTCODE +- .uleb128 0 +-#ifndef __ASSUME_FUTEX_CLOCK_REALTIME +- .long .LcleanupSTART2-.LSTARTCODE +- .long .Ladd_cond_futex2-.LcleanupSTART2 +- .long __condvar_tw_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .Ladd_cond_futex2-.LSTARTCODE +- .long .Lsub_cond_futex2-.Ladd_cond_futex2 +- .long __condvar_tw_cleanup2-.LSTARTCODE +- .uleb128 0 +- .long .Lsub_cond_futex2-.LSTARTCODE +- .long .LcleanupEND2-.Lsub_cond_futex2 +- .long __condvar_tw_cleanup-.LSTARTCODE +- .uleb128 0 +-#endif +- .long .LcallUR-.LSTARTCODE +- .long .LENDCODE-.LcallUR +- .long 0 +- .uleb128 0 +-.Lcstend: +- +- +-#ifdef SHARED +- .hidden DW.ref.__gcc_personality_v0 +- .weak DW.ref.__gcc_personality_v0 +- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits +- .align 4 +- .type DW.ref.__gcc_personality_v0, @object +- .size DW.ref.__gcc_personality_v0, 4 +-DW.ref.__gcc_personality_v0: +- .long __gcc_personality_v0 +-#endif +diff --git a/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S +deleted file mode 100644 +index 5016718..0000000 +--- a/sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S ++++ /dev/null +@@ -1,642 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- +- .text +- +-/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */ +- .globl __pthread_cond_wait +- .type __pthread_cond_wait, @function +- .align 16 +-__pthread_cond_wait: +-.LSTARTCODE: +- cfi_startproc +-#ifdef SHARED +- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect, +- DW.ref.__gcc_personality_v0) +- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART) +-#else +- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0) +- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART) +-#endif +- +- pushl %ebp +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebp, 0) +- pushl %edi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%edi, 0) +- pushl %esi +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%esi, 0) +- pushl %ebx +- cfi_adjust_cfa_offset(4) +- cfi_rel_offset(%ebx, 0) +- +- xorl %esi, %esi +- movl 20(%esp), %ebx +- +- LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx) +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jnz 1f +- +- /* Store the reference to the mutex. If there is already a +- different value in there this is a bad user bug. */ +-2: cmpl $-1, dep_mutex(%ebx) +- movl 24(%esp), %eax +- je 15f +- movl %eax, dep_mutex(%ebx) +- +- /* Unlock the mutex. */ +-15: xorl %edx, %edx +- call __pthread_mutex_unlock_usercnt +- +- testl %eax, %eax +- jne 12f +- +- addl $1, total_seq(%ebx) +- adcl $0, total_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- addl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +-#define FRAME_SIZE 20 +- subl $FRAME_SIZE, %esp +- cfi_adjust_cfa_offset(FRAME_SIZE) +- cfi_remember_state +- +- /* Get and store current wakeup_seq value. */ +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- movl broadcast_seq(%ebx), %eax +- movl %edi, 4(%esp) +- movl %edx, 8(%esp) +- movl %eax, 12(%esp) +- +- /* Reset the pi-requeued flag. */ +-8: movl $0, 16(%esp) +- movl cond_futex(%ebx), %ebp +- +- /* Unlock. */ +- LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 3f +- +-.LcleanupSTART: +-4: call __pthread_enable_asynccancel +- movl %eax, (%esp) +- +- xorl %ecx, %ecx +- cmpl $-1, dep_mutex(%ebx) +- sete %cl +- je 18f +- +- movl dep_mutex(%ebx), %edi +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%edi), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 18f +- +- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %ecx +- movl %ebp, %edx +- xorl %esi, %esi +- addl $cond_futex, %ebx +-.Ladd_cond_futex_pi: +- movl $SYS_futex, %eax +- ENTER_KERNEL +- subl $cond_futex, %ebx +-.Lsub_cond_futex_pi: +- /* Set the pi-requeued flag only if the kernel has returned 0. The +- kernel does not hold the mutex on error. */ +- cmpl $0, %eax +- sete 16(%esp) +- je 19f +- +- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns +- successfully, it has already locked the mutex for us and the +- pi_flag (16(%esp)) is set to denote that fact. However, if another +- thread changed the futex value before we entered the wait, the +- syscall may return an EAGAIN and the mutex is not locked. We go +- ahead with a success anyway since later we look at the pi_flag to +- decide if we got the mutex or not. The sequence numbers then make +- sure that only one of the threads actually wake up. We retry using +- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal +- and PI futexes don't mix. +- +- Note that we don't check for EAGAIN specifically; we assume that the +- only other error the futex function could return is EAGAIN since +- anything else would mean an error in our function. It is too +- expensive to do that check for every call (which is quite common in +- case of a large number of threads), so it has been skipped. */ +- cmpl $-ENOSYS, %eax +- jne 19f +- xorl %ecx, %ecx +- +-18: subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +-#if FUTEX_WAIT != 0 +- addl $FUTEX_WAIT, %ecx +-#endif +- movl %ebp, %edx +- addl $cond_futex, %ebx +-.Ladd_cond_futex: +- movl $SYS_futex, %eax +- ENTER_KERNEL +- subl $cond_futex, %ebx +-.Lsub_cond_futex: +- +-19: movl (%esp), %eax +- call __pthread_disable_asynccancel +-.LcleanupEND: +- +- /* Lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jnz 5f +- +-6: movl broadcast_seq(%ebx), %eax +- cmpl 12(%esp), %eax +- jne 16f +- +- movl woken_seq(%ebx), %eax +- movl woken_seq+4(%ebx), %ecx +- +- movl wakeup_seq(%ebx), %edi +- movl wakeup_seq+4(%ebx), %edx +- +- cmpl 8(%esp), %edx +- jne 7f +- cmpl 4(%esp), %edi +- je 22f +- +-7: cmpl %ecx, %edx +- jne 9f +- cmp %eax, %edi +- je 22f +- +-9: addl $1, woken_seq(%ebx) +- adcl $0, woken_seq+4(%ebx) +- +- /* Unlock */ +-16: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- movl total_seq(%ebx), %eax +- andl total_seq+4(%ebx), %eax +- cmpl $0xffffffff, %eax +- jne 17f +- movl cond_nwaiters(%ebx), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 17f +- +- addl $cond_nwaiters, %ebx +- movl $SYS_futex, %eax +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_nwaiters(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $1, %edx +- ENTER_KERNEL +- subl $cond_nwaiters, %ebx +- +-17: LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 10f +- +- /* With requeue_pi, the mutex lock is held in the kernel. */ +-11: movl 24+FRAME_SIZE(%esp), %eax +- movl 16(%esp), %ecx +- testl %ecx, %ecx +- jnz 21f +- +- call __pthread_mutex_cond_lock +-20: addl $FRAME_SIZE, %esp +- cfi_adjust_cfa_offset(-FRAME_SIZE); +- +-14: popl %ebx +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebx) +- popl %esi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%esi) +- popl %edi +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%edi) +- popl %ebp +- cfi_adjust_cfa_offset(-4) +- cfi_restore(%ebp) +- +- /* We return the result of the mutex_lock operation. */ +- ret +- +- cfi_restore_state +- +-21: call __pthread_mutex_cond_lock_adjust +- xorl %eax, %eax +- jmp 20b +- +- cfi_adjust_cfa_offset(-FRAME_SIZE); +- +- /* We need to go back to futex_wait. If we're using requeue_pi, then +- release the mutex we had acquired and go back. */ +-22: movl 16(%esp), %edx +- test %edx, %edx +- jz 8b +- +- /* Adjust the mutex values first and then unlock it. The unlock +- should always succeed or else the kernel did not lock the mutex +- correctly. */ +- movl dep_mutex(%ebx), %eax +- call __pthread_mutex_cond_lock_adjust +- movl dep_mutex(%ebx), %eax +- xorl %edx, %edx +- call __pthread_mutex_unlock_usercnt +- jmp 8b +- +- /* Initial locking failed. */ +-1: +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 2b +- +- /* The initial unlocking of the mutex failed. */ +-12: +- LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- jne 14b +- +- movl %eax, %esi +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- +- movl %esi, %eax +- jmp 14b +- +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +- /* Unlock in loop requires wakeup. */ +-3: +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 4b +- +- /* Locking in loop failed. */ +-5: +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- jmp 6b +- +- /* Unlock after loop requires wakeup. */ +-10: +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- jmp 11b +- +- .size __pthread_cond_wait, .-__pthread_cond_wait +-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, +- GLIBC_2_3_2) +- +- +- .type __condvar_w_cleanup2, @function +-__condvar_w_cleanup2: +- subl $cond_futex, %ebx +- .size __condvar_w_cleanup2, .-__condvar_w_cleanup2 +-.LSbl4: +- .type __condvar_w_cleanup, @function +-__condvar_w_cleanup: +- movl %eax, %esi +- +- /* Get internal lock. */ +- movl $1, %edx +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %edx, (%ebx) +-#else +- cmpxchgl %edx, cond_lock(%ebx) +-#endif +- jz 1f +- +-#if cond_lock == 0 +- movl %ebx, %edx +-#else +- leal cond_lock(%ebx), %edx +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_lock_wait +- +-1: movl broadcast_seq(%ebx), %eax +- cmpl 12(%esp), %eax +- jne 3f +- +- /* We increment the wakeup_seq counter only if it is lower than +- total_seq. If this is not the case the thread was woken and +- then canceled. In this case we ignore the signal. */ +- movl total_seq(%ebx), %eax +- movl total_seq+4(%ebx), %edi +- cmpl wakeup_seq+4(%ebx), %edi +- jb 6f +- ja 7f +- cmpl wakeup_seq(%ebx), %eax +- jbe 7f +- +-6: addl $1, wakeup_seq(%ebx) +- adcl $0, wakeup_seq+4(%ebx) +- addl $1, cond_futex(%ebx) +- +-7: addl $1, woken_seq(%ebx) +- adcl $0, woken_seq+4(%ebx) +- +-3: subl $(1 << nwaiters_shift), cond_nwaiters(%ebx) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- xorl %edi, %edi +- movl total_seq(%ebx), %eax +- andl total_seq+4(%ebx), %eax +- cmpl $0xffffffff, %eax +- jne 4f +- movl cond_nwaiters(%ebx), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 4f +- +- addl $cond_nwaiters, %ebx +- movl $SYS_futex, %eax +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_nwaiters(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $1, %edx +- ENTER_KERNEL +- subl $cond_nwaiters, %ebx +- movl $1, %edi +- +-4: LOCK +-#if cond_lock == 0 +- subl $1, (%ebx) +-#else +- subl $1, cond_lock(%ebx) +-#endif +- je 2f +- +-#if cond_lock == 0 +- movl %ebx, %eax +-#else +- leal cond_lock(%ebx), %eax +-#endif +-#if (LLL_SHARED-LLL_PRIVATE) > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex(%ebx) +- setne %cl +- subl $1, %ecx +- andl $(LLL_SHARED-LLL_PRIVATE), %ecx +-#if LLL_PRIVATE != 0 +- addl $LLL_PRIVATE, %ecx +-#endif +- call __lll_unlock_wake +- +- /* Wake up all waiters to make sure no signal gets lost. */ +-2: testl %edi, %edi +- jnz 5f +- addl $cond_futex, %ebx +-#if FUTEX_PRIVATE_FLAG > 255 +- xorl %ecx, %ecx +-#endif +- cmpl $-1, dep_mutex-cond_futex(%ebx) +- sete %cl +- subl $1, %ecx +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %ecx +-#else +- andl %gs:PRIVATE_FUTEX, %ecx +-#endif +- addl $FUTEX_WAKE, %ecx +- movl $SYS_futex, %eax +- movl $0x7fffffff, %edx +- ENTER_KERNEL +- +- /* Lock the mutex only if we don't own it already. This only happens +- in case of PI mutexes, if we got cancelled after a successful +- return of the futex syscall and before disabling async +- cancellation. */ +-5: movl 24+FRAME_SIZE(%esp), %eax +- movl MUTEX_KIND(%eax), %ebx +- andl $(ROBUST_BIT|PI_BIT), %ebx +- cmpl $PI_BIT, %ebx +- jne 8f +- +- movl (%eax), %ebx +- andl $TID_MASK, %ebx +- cmpl %ebx, %gs:TID +- jne 8f +- /* We managed to get the lock. Fix it up before returning. */ +- call __pthread_mutex_cond_lock_adjust +- jmp 9f +- +-8: call __pthread_mutex_cond_lock +- +-9: movl %esi, (%esp) +-.LcallUR: +- call _Unwind_Resume +- hlt +-.LENDCODE: +- cfi_endproc +- .size __condvar_w_cleanup, .-__condvar_w_cleanup +- +- +- .section .gcc_except_table,"a",@progbits +-.LexceptSTART: +- .byte DW_EH_PE_omit # @LPStart format (omit) +- .byte DW_EH_PE_omit # @TType format (omit) +- .byte DW_EH_PE_sdata4 # call-site format +- # DW_EH_PE_sdata4 +- .uleb128 .Lcstend-.Lcstbegin +-.Lcstbegin: +- .long .LcleanupSTART-.LSTARTCODE +- .long .Ladd_cond_futex_pi-.LcleanupSTART +- .long __condvar_w_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .Ladd_cond_futex_pi-.LSTARTCODE +- .long .Lsub_cond_futex_pi-.Ladd_cond_futex_pi +- .long __condvar_w_cleanup2-.LSTARTCODE +- .uleb128 0 +- .long .Lsub_cond_futex_pi-.LSTARTCODE +- .long .Ladd_cond_futex-.Lsub_cond_futex_pi +- .long __condvar_w_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .Ladd_cond_futex-.LSTARTCODE +- .long .Lsub_cond_futex-.Ladd_cond_futex +- .long __condvar_w_cleanup2-.LSTARTCODE +- .uleb128 0 +- .long .Lsub_cond_futex-.LSTARTCODE +- .long .LcleanupEND-.Lsub_cond_futex +- .long __condvar_w_cleanup-.LSTARTCODE +- .uleb128 0 +- .long .LcallUR-.LSTARTCODE +- .long .LENDCODE-.LcallUR +- .long 0 +- .uleb128 0 +-.Lcstend: +- +-#ifdef SHARED +- .hidden DW.ref.__gcc_personality_v0 +- .weak DW.ref.__gcc_personality_v0 +- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits +- .align 4 +- .type DW.ref.__gcc_personality_v0, @object +- .size DW.ref.__gcc_personality_v0, 4 +-DW.ref.__gcc_personality_v0: +- .long __gcc_personality_v0 +-#endif +diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h +index 345e79a..371bc3c 100644 +--- a/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h ++++ b/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h +@@ -123,19 +123,32 @@ typedef union + + + /* Data structure for conditional variable handling. The structure of +- the attribute type is deliberately not exposed. */ ++ the attribute type is not exposed on purpose. */ + typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S +deleted file mode 100644 +index de455dd..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S ++++ /dev/null +@@ -1,177 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- .text +- +- /* int pthread_cond_broadcast (pthread_cond_t *cond) */ +-ENTRY(__pthread_cond_broadcast) +- +- LIBC_PROBE (cond_broadcast, 1, %rdi) +- +- /* Get internal lock. */ +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jnz 1f +- +-2: addq $cond_futex, %rdi +- movq total_seq-cond_futex(%rdi), %r9 +- cmpq wakeup_seq-cond_futex(%rdi), %r9 +- jna 4f +- +- /* Cause all currently waiting threads to recognize they are +- woken up. */ +- movq %r9, wakeup_seq-cond_futex(%rdi) +- movq %r9, woken_seq-cond_futex(%rdi) +- addq %r9, %r9 +- movl %r9d, (%rdi) +- incl broadcast_seq-cond_futex(%rdi) +- +- /* Get the address of the mutex used. */ +- mov dep_mutex-cond_futex(%rdi), %R8_LP +- +- /* Unlock. */ +- LOCK +- decl cond_lock-cond_futex(%rdi) +- jne 7f +- +-8: cmp $-1, %R8_LP +- je 9f +- +- /* Do not use requeue for pshared condvars. */ +- testl $PS_BIT, MUTEX_KIND(%r8) +- jne 9f +- +- /* Requeue to a PI mutex if the PI bit is set. */ +- movl MUTEX_KIND(%r8), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- je 81f +- +- /* Wake up all threads. */ +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %esi +-#else +- movl %fs:PRIVATE_FUTEX, %esi +- orl $FUTEX_CMP_REQUEUE, %esi +-#endif +- movl $SYS_futex, %eax +- movl $1, %edx +- movl $0x7fffffff, %r10d +- syscall +- +- /* For any kind of error, which mainly is EAGAIN, we try again +- with WAKE. The general test also covers running on old +- kernels. */ +- cmpq $-4095, %rax +- jae 9f +- +-10: xorl %eax, %eax +- retq +- +- /* Wake up all threads. */ +-81: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi +- movl $SYS_futex, %eax +- movl $1, %edx +- movl $0x7fffffff, %r10d +- syscall +- +- /* For any kind of error, which mainly is EAGAIN, we try again +- with WAKE. The general test also covers running on old +- kernels. */ +- cmpq $-4095, %rax +- jb 10b +- jmp 9f +- +- .align 16 +- /* Unlock. */ +-4: LOCK +- decl cond_lock-cond_futex(%rdi) +- jne 5f +- +-6: xorl %eax, %eax +- retq +- +- /* Initial locking failed. */ +-1: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- jmp 2b +- +- /* Unlock in loop requires wakeup. */ +-5: addq $cond_lock-cond_futex, %rdi +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- jmp 6b +- +- /* Unlock in loop requires wakeup. */ +-7: addq $cond_lock-cond_futex, %rdi +- cmp $-1, %R8_LP +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- subq $cond_lock-cond_futex, %rdi +- jmp 8b +- +-9: /* The futex requeue functionality is not available. */ +- cmp $-1, %R8_LP +- movl $0x7fffffff, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- jmp 10b +-END(__pthread_cond_broadcast) +- +-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast, +- GLIBC_2_3_2) +diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S +deleted file mode 100644 +index da14bc3..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S ++++ /dev/null +@@ -1,161 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +- +- .text +- +-ENTRY(__pthread_cond_signal) +- +- LIBC_PROBE (cond_signal, 1, %rdi) +- +- /* Get internal lock. */ +- movq %rdi, %r8 +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jnz 1f +- +-2: addq $cond_futex, %rdi +- movq total_seq(%r8), %rcx +- cmpq wakeup_seq(%r8), %rcx +- jbe 4f +- +- /* Bump the wakeup number. */ +- addq $1, wakeup_seq(%r8) +- addl $1, (%rdi) +- +- /* Wake up one thread. */ +- LP_OP(cmp) $-1, dep_mutex(%r8) +- movl $FUTEX_WAKE_OP, %esi +- movl $1, %edx +- movl $SYS_futex, %eax +- je 8f +- +- /* Get the address of the mutex used. */ +- mov dep_mutex(%r8), %RCX_LP +- movl MUTEX_KIND(%rcx), %r11d +- andl $(ROBUST_BIT|PI_BIT), %r11d +- cmpl $PI_BIT, %r11d +- je 9f +- +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $(FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG), %esi +-#else +- orl %fs:PRIVATE_FUTEX, %esi +-#endif +- +-8: movl $1, %r10d +-#if cond_lock != 0 +- addq $cond_lock, %r8 +-#endif +- movl $FUTEX_OP_CLEAR_WAKE_IF_GT_ONE, %r9d +- syscall +-#if cond_lock != 0 +- subq $cond_lock, %r8 +-#endif +- /* For any kind of error, we try again with WAKE. +- The general test also covers running on old kernels. */ +- cmpq $-4095, %rax +- jae 7f +- +- xorl %eax, %eax +- retq +- +- /* Wake up one thread and requeue none in the PI Mutex case. */ +-9: movl $(FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi +- movq %rcx, %r8 +- xorq %r10, %r10 +- movl (%rdi), %r9d // XXX Can this be right? +- syscall +- +- leaq -cond_futex(%rdi), %r8 +- +- /* For any kind of error, we try again with WAKE. +- The general test also covers running on old kernels. */ +- cmpq $-4095, %rax +- jb 4f +- +-7: +-#ifdef __ASSUME_PRIVATE_FUTEX +- andl $FUTEX_PRIVATE_FLAG, %esi +-#else +- andl %fs:PRIVATE_FUTEX, %esi +-#endif +- orl $FUTEX_WAKE, %esi +- movl $SYS_futex, %eax +- /* %rdx should be 1 already from $FUTEX_WAKE_OP syscall. +- movl $1, %edx */ +- syscall +- +- /* Unlock. */ +-4: LOCK +-#if cond_lock == 0 +- decl (%r8) +-#else +- decl cond_lock(%r8) +-#endif +- jne 5f +- +-6: xorl %eax, %eax +- retq +- +- /* Initial locking failed. */ +-1: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- jmp 2b +- +- /* Unlock in loop requires wakeup. */ +-5: +- movq %r8, %rdi +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- jmp 6b +-END(__pthread_cond_signal) +- +-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal, +- GLIBC_2_3_2) +diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S +deleted file mode 100644 +index 82ffa1a..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S ++++ /dev/null +@@ -1,623 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +- +- .text +- +- +-/* int pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, +- const struct timespec *abstime) */ +- .globl __pthread_cond_timedwait +- .type __pthread_cond_timedwait, @function +- .align 16 +-__pthread_cond_timedwait: +-.LSTARTCODE: +- cfi_startproc +-#ifdef SHARED +- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect, +- DW.ref.__gcc_personality_v0) +- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART) +-#else +- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0) +- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART) +-#endif +- +- pushq %r12 +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%r12, 0) +- pushq %r13 +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%r13, 0) +- pushq %r14 +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%r14, 0) +- pushq %r15 +- cfi_adjust_cfa_offset(8) +- cfi_rel_offset(%r15, 0) +-#define FRAME_SIZE (32+8) +- subq $FRAME_SIZE, %rsp +- cfi_adjust_cfa_offset(FRAME_SIZE) +- cfi_remember_state +- +- LIBC_PROBE (cond_timedwait, 3, %rdi, %rsi, %rdx) +- +- cmpq $1000000000, 8(%rdx) +- movl $EINVAL, %eax +- jae 48f +- +- /* Stack frame: +- +- rsp + 48 +- +--------------------------+ +- rsp + 32 | timeout value | +- +--------------------------+ +- rsp + 24 | old wake_seq value | +- +--------------------------+ +- rsp + 16 | mutex pointer | +- +--------------------------+ +- rsp + 8 | condvar pointer | +- +--------------------------+ +- rsp + 4 | old broadcast_seq value | +- +--------------------------+ +- rsp + 0 | old cancellation mode | +- +--------------------------+ +- */ +- +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- +- /* Prepare structure passed to cancellation handler. */ +- movq %rdi, 8(%rsp) +- movq %rsi, 16(%rsp) +- movq %rdx, %r13 +- +- je 22f +- mov %RSI_LP, dep_mutex(%rdi) +- +-22: +- xorb %r15b, %r15b +- +- /* Get internal lock. */ +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jnz 31f +- +- /* Unlock the mutex. */ +-32: movq 16(%rsp), %rdi +- xorl %esi, %esi +- callq __pthread_mutex_unlock_usercnt +- +- testl %eax, %eax +- jne 46f +- +- movq 8(%rsp), %rdi +- incq total_seq(%rdi) +- incl cond_futex(%rdi) +- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Get and store current wakeup_seq value. */ +- movq 8(%rsp), %rdi +- movq wakeup_seq(%rdi), %r9 +- movl broadcast_seq(%rdi), %edx +- movq %r9, 24(%rsp) +- movl %edx, 4(%rsp) +- +- cmpq $0, (%r13) +- movq $-ETIMEDOUT, %r14 +- js 36f +- +-38: movl cond_futex(%rdi), %r12d +- +- /* Unlock. */ +- LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- jne 33f +- +-.LcleanupSTART1: +-34: callq __pthread_enable_asynccancel +- movl %eax, (%rsp) +- +- movq %r13, %r10 +- movl $FUTEX_WAIT_BITSET, %esi +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- je 60f +- +- mov dep_mutex(%rdi), %R8_LP +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%r8), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 61f +- +- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi +- xorl %eax, %eax +- /* The following only works like this because we only support +- two clocks, represented using a single bit. */ +- testl $1, cond_nwaiters(%rdi) +- movl $FUTEX_CLOCK_REALTIME, %edx +- cmove %edx, %eax +- orl %eax, %esi +- movq %r12, %rdx +- addq $cond_futex, %rdi +- movl $SYS_futex, %eax +- syscall +- +- cmpl $0, %eax +- sete %r15b +- +-#ifdef __ASSUME_REQUEUE_PI +- jmp 62f +-#else +- je 62f +- +- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns +- successfully, it has already locked the mutex for us and the +- pi_flag (%r15b) is set to denote that fact. However, if another +- thread changed the futex value before we entered the wait, the +- syscall may return an EAGAIN and the mutex is not locked. We go +- ahead with a success anyway since later we look at the pi_flag to +- decide if we got the mutex or not. The sequence numbers then make +- sure that only one of the threads actually wake up. We retry using +- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal +- and PI futexes don't mix. +- +- Note that we don't check for EAGAIN specifically; we assume that the +- only other error the futex function could return is EAGAIN (barring +- the ETIMEOUT of course, for the timeout case in futex) since +- anything else would mean an error in our function. It is too +- expensive to do that check for every call (which is quite common in +- case of a large number of threads), so it has been skipped. */ +- cmpl $-ENOSYS, %eax +- jne 62f +- +- subq $cond_futex, %rdi +-#endif +- +-61: movl $(FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG), %esi +-60: xorb %r15b, %r15b +- xorl %eax, %eax +- /* The following only works like this because we only support +- two clocks, represented using a single bit. */ +- testl $1, cond_nwaiters(%rdi) +- movl $FUTEX_CLOCK_REALTIME, %edx +- movl $0xffffffff, %r9d +- cmove %edx, %eax +- orl %eax, %esi +- movq %r12, %rdx +- addq $cond_futex, %rdi +- movl $SYS_futex, %eax +- syscall +-62: movq %rax, %r14 +- +- movl (%rsp), %edi +- callq __pthread_disable_asynccancel +-.LcleanupEND1: +- +- /* Lock. */ +- movq 8(%rsp), %rdi +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jne 35f +- +-36: movl broadcast_seq(%rdi), %edx +- +- movq woken_seq(%rdi), %rax +- +- movq wakeup_seq(%rdi), %r9 +- +- cmpl 4(%rsp), %edx +- jne 53f +- +- cmpq 24(%rsp), %r9 +- jbe 45f +- +- cmpq %rax, %r9 +- ja 39f +- +-45: cmpq $-ETIMEDOUT, %r14 +- je 99f +- +- /* We need to go back to futex_wait. If we're using requeue_pi, then +- release the mutex we had acquired and go back. */ +- test %r15b, %r15b +- jz 38b +- +- /* Adjust the mutex values first and then unlock it. The unlock +- should always succeed or else the kernel did not lock the +- mutex correctly. */ +- movq %r8, %rdi +- callq __pthread_mutex_cond_lock_adjust +- xorl %esi, %esi +- callq __pthread_mutex_unlock_usercnt +- /* Reload cond_var. */ +- movq 8(%rsp), %rdi +- jmp 38b +- +-99: incq wakeup_seq(%rdi) +- incl cond_futex(%rdi) +- movl $ETIMEDOUT, %r14d +- jmp 44f +- +-53: xorq %r14, %r14 +- jmp 54f +- +-39: xorq %r14, %r14 +-44: incq woken_seq(%rdi) +- +-54: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- cmpq $0xffffffffffffffff, total_seq(%rdi) +- jne 55f +- movl cond_nwaiters(%rdi), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 55f +- +- addq $cond_nwaiters, %rdi +- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi) +- movl $1, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- subq $cond_nwaiters, %rdi +- +-55: LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- jne 40f +- +- /* If requeue_pi is used the kernel performs the locking of the +- mutex. */ +-41: movq 16(%rsp), %rdi +- testb %r15b, %r15b +- jnz 64f +- +- callq __pthread_mutex_cond_lock +- +-63: testq %rax, %rax +- cmoveq %r14, %rax +- +-48: addq $FRAME_SIZE, %rsp +- cfi_adjust_cfa_offset(-FRAME_SIZE) +- popq %r15 +- cfi_adjust_cfa_offset(-8) +- cfi_restore(%r15) +- popq %r14 +- cfi_adjust_cfa_offset(-8) +- cfi_restore(%r14) +- popq %r13 +- cfi_adjust_cfa_offset(-8) +- cfi_restore(%r13) +- popq %r12 +- cfi_adjust_cfa_offset(-8) +- cfi_restore(%r12) +- +- retq +- +- cfi_restore_state +- +-64: callq __pthread_mutex_cond_lock_adjust +- movq %r14, %rax +- jmp 48b +- +- /* Initial locking failed. */ +-31: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +- jmp 32b +- +- /* Unlock in loop requires wakeup. */ +-33: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- jmp 34b +- +- /* Locking in loop failed. */ +-35: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- jmp 36b +- +- /* Unlock after loop requires wakeup. */ +-40: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- jmp 41b +- +- /* The initial unlocking of the mutex failed. */ +-46: movq 8(%rsp), %rdi +- movq %rax, (%rsp) +- LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- jne 47f +- +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- +-47: movq (%rsp), %rax +- jmp 48b +- +- .size __pthread_cond_timedwait, .-__pthread_cond_timedwait +-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait, +- GLIBC_2_3_2) +- +- +- .align 16 +- .type __condvar_cleanup2, @function +-__condvar_cleanup2: +- /* Stack frame: +- +- rsp + 72 +- +--------------------------+ +- rsp + 64 | %r12 | +- +--------------------------+ +- rsp + 56 | %r13 | +- +--------------------------+ +- rsp + 48 | %r14 | +- +--------------------------+ +- rsp + 24 | unused | +- +--------------------------+ +- rsp + 16 | mutex pointer | +- +--------------------------+ +- rsp + 8 | condvar pointer | +- +--------------------------+ +- rsp + 4 | old broadcast_seq value | +- +--------------------------+ +- rsp + 0 | old cancellation mode | +- +--------------------------+ +- */ +- +- movq %rax, 24(%rsp) +- +- /* Get internal lock. */ +- movq 8(%rsp), %rdi +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jz 1f +- +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- +-1: movl broadcast_seq(%rdi), %edx +- cmpl 4(%rsp), %edx +- jne 3f +- +- /* We increment the wakeup_seq counter only if it is lower than +- total_seq. If this is not the case the thread was woken and +- then canceled. In this case we ignore the signal. */ +- movq total_seq(%rdi), %rax +- cmpq wakeup_seq(%rdi), %rax +- jbe 6f +- incq wakeup_seq(%rdi) +- incl cond_futex(%rdi) +-6: incq woken_seq(%rdi) +- +-3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- xorq %r12, %r12 +- cmpq $0xffffffffffffffff, total_seq(%rdi) +- jne 4f +- movl cond_nwaiters(%rdi), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 4f +- +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- leaq cond_nwaiters(%rdi), %rdi +- movl $1, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- subq $cond_nwaiters, %rdi +- movl $1, %r12d +- +-4: LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- je 2f +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- +- /* Wake up all waiters to make sure no signal gets lost. */ +-2: testq %r12, %r12 +- jnz 5f +- addq $cond_futex, %rdi +- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi) +- movl $0x7fffffff, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- +- /* Lock the mutex only if we don't own it already. This only happens +- in case of PI mutexes, if we got cancelled after a successful +- return of the futex syscall and before disabling async +- cancellation. */ +-5: movq 16(%rsp), %rdi +- movl MUTEX_KIND(%rdi), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 7f +- +- movl (%rdi), %eax +- andl $TID_MASK, %eax +- cmpl %eax, %fs:TID +- jne 7f +- /* We managed to get the lock. Fix it up before returning. */ +- callq __pthread_mutex_cond_lock_adjust +- jmp 8f +- +-7: callq __pthread_mutex_cond_lock +- +-8: movq 24(%rsp), %rdi +- movq FRAME_SIZE(%rsp), %r15 +- movq FRAME_SIZE+8(%rsp), %r14 +- movq FRAME_SIZE+16(%rsp), %r13 +- movq FRAME_SIZE+24(%rsp), %r12 +-.LcallUR: +- call _Unwind_Resume +- hlt +-.LENDCODE: +- cfi_endproc +- .size __condvar_cleanup2, .-__condvar_cleanup2 +- +- +- .section .gcc_except_table,"a",@progbits +-.LexceptSTART: +- .byte DW_EH_PE_omit # @LPStart format +- .byte DW_EH_PE_omit # @TType format +- .byte DW_EH_PE_uleb128 # call-site format +- .uleb128 .Lcstend-.Lcstbegin +-.Lcstbegin: +- .uleb128 .LcleanupSTART1-.LSTARTCODE +- .uleb128 .LcleanupEND1-.LcleanupSTART1 +- .uleb128 __condvar_cleanup2-.LSTARTCODE +- .uleb128 0 +- .uleb128 .LcallUR-.LSTARTCODE +- .uleb128 .LENDCODE-.LcallUR +- .uleb128 0 +- .uleb128 0 +-.Lcstend: +- +- +-#ifdef SHARED +- .hidden DW.ref.__gcc_personality_v0 +- .weak DW.ref.__gcc_personality_v0 +- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits +- .align LP_SIZE +- .type DW.ref.__gcc_personality_v0, @object +- .size DW.ref.__gcc_personality_v0, LP_SIZE +-DW.ref.__gcc_personality_v0: +- ASM_ADDR __gcc_personality_v0 +-#endif +diff --git a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S +deleted file mode 100644 +index c82f37b..0000000 +--- a/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S ++++ /dev/null +@@ -1,555 +0,0 @@ +-/* Copyright (C) 2002-2016 Free Software Foundation, Inc. +- This file is part of the GNU C Library. +- Contributed by Ulrich Drepper , 2002. +- +- 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 +- . */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +- +- .text +- +-/* int pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex) */ +- .globl __pthread_cond_wait +- .type __pthread_cond_wait, @function +- .align 16 +-__pthread_cond_wait: +-.LSTARTCODE: +- cfi_startproc +-#ifdef SHARED +- cfi_personality(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect, +- DW.ref.__gcc_personality_v0) +- cfi_lsda(DW_EH_PE_pcrel | DW_EH_PE_sdata4, .LexceptSTART) +-#else +- cfi_personality(DW_EH_PE_udata4, __gcc_personality_v0) +- cfi_lsda(DW_EH_PE_udata4, .LexceptSTART) +-#endif +- +-#define FRAME_SIZE (32+8) +- leaq -FRAME_SIZE(%rsp), %rsp +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +- /* Stack frame: +- +- rsp + 32 +- +--------------------------+ +- rsp + 24 | old wake_seq value | +- +--------------------------+ +- rsp + 16 | mutex pointer | +- +--------------------------+ +- rsp + 8 | condvar pointer | +- +--------------------------+ +- rsp + 4 | old broadcast_seq value | +- +--------------------------+ +- rsp + 0 | old cancellation mode | +- +--------------------------+ +- */ +- +- LIBC_PROBE (cond_wait, 2, %rdi, %rsi) +- +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- +- /* Prepare structure passed to cancellation handler. */ +- movq %rdi, 8(%rsp) +- movq %rsi, 16(%rsp) +- +- je 15f +- mov %RSI_LP, dep_mutex(%rdi) +- +- /* Get internal lock. */ +-15: movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jne 1f +- +- /* Unlock the mutex. */ +-2: movq 16(%rsp), %rdi +- xorl %esi, %esi +- callq __pthread_mutex_unlock_usercnt +- +- testl %eax, %eax +- jne 12f +- +- movq 8(%rsp), %rdi +- incq total_seq(%rdi) +- incl cond_futex(%rdi) +- addl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Get and store current wakeup_seq value. */ +- movq 8(%rsp), %rdi +- movq wakeup_seq(%rdi), %r9 +- movl broadcast_seq(%rdi), %edx +- movq %r9, 24(%rsp) +- movl %edx, 4(%rsp) +- +- /* Unlock. */ +-8: movl cond_futex(%rdi), %edx +- LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- jne 3f +- +-.LcleanupSTART: +-4: callq __pthread_enable_asynccancel +- movl %eax, (%rsp) +- +- xorq %r10, %r10 +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- leaq cond_futex(%rdi), %rdi +- movl $FUTEX_WAIT, %esi +- je 60f +- +- mov dep_mutex-cond_futex(%rdi), %R8_LP +- /* Requeue to a non-robust PI mutex if the PI bit is set and +- the robust bit is not set. */ +- movl MUTEX_KIND(%r8), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 61f +- +- movl $(FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG), %esi +- movl $SYS_futex, %eax +- syscall +- +- cmpl $0, %eax +- sete %r8b +- +-#ifdef __ASSUME_REQUEUE_PI +- jmp 62f +-#else +- je 62f +- +- /* When a futex syscall with FUTEX_WAIT_REQUEUE_PI returns +- successfully, it has already locked the mutex for us and the +- pi_flag (%r8b) is set to denote that fact. However, if another +- thread changed the futex value before we entered the wait, the +- syscall may return an EAGAIN and the mutex is not locked. We go +- ahead with a success anyway since later we look at the pi_flag to +- decide if we got the mutex or not. The sequence numbers then make +- sure that only one of the threads actually wake up. We retry using +- normal FUTEX_WAIT only if the kernel returned ENOSYS, since normal +- and PI futexes don't mix. +- +- Note that we don't check for EAGAIN specifically; we assume that the +- only other error the futex function could return is EAGAIN since +- anything else would mean an error in our function. It is too +- expensive to do that check for every call (which is quite common in +- case of a large number of threads), so it has been skipped. */ +- cmpl $-ENOSYS, %eax +- jne 62f +- +-# ifndef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAIT, %esi +-# endif +-#endif +- +-61: +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), %esi +-#else +- orl %fs:PRIVATE_FUTEX, %esi +-#endif +-60: xorb %r8b, %r8b +- movl $SYS_futex, %eax +- syscall +- +-62: movl (%rsp), %edi +- callq __pthread_disable_asynccancel +-.LcleanupEND: +- +- /* Lock. */ +- movq 8(%rsp), %rdi +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jnz 5f +- +-6: movl broadcast_seq(%rdi), %edx +- +- movq woken_seq(%rdi), %rax +- +- movq wakeup_seq(%rdi), %r9 +- +- cmpl 4(%rsp), %edx +- jne 16f +- +- cmpq 24(%rsp), %r9 +- jbe 19f +- +- cmpq %rax, %r9 +- jna 19f +- +- incq woken_seq(%rdi) +- +- /* Unlock */ +-16: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- cmpq $0xffffffffffffffff, total_seq(%rdi) +- jne 17f +- movl cond_nwaiters(%rdi), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 17f +- +- addq $cond_nwaiters, %rdi +- LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi) +- movl $1, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- subq $cond_nwaiters, %rdi +- +-17: LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- jne 10f +- +- /* If requeue_pi is used the kernel performs the locking of the +- mutex. */ +-11: movq 16(%rsp), %rdi +- testb %r8b, %r8b +- jnz 18f +- +- callq __pthread_mutex_cond_lock +- +-14: leaq FRAME_SIZE(%rsp), %rsp +- cfi_adjust_cfa_offset(-FRAME_SIZE) +- +- /* We return the result of the mutex_lock operation. */ +- retq +- +- cfi_adjust_cfa_offset(FRAME_SIZE) +- +-18: callq __pthread_mutex_cond_lock_adjust +- xorl %eax, %eax +- jmp 14b +- +- /* We need to go back to futex_wait. If we're using requeue_pi, then +- release the mutex we had acquired and go back. */ +-19: testb %r8b, %r8b +- jz 8b +- +- /* Adjust the mutex values first and then unlock it. The unlock +- should always succeed or else the kernel did not lock the mutex +- correctly. */ +- movq 16(%rsp), %rdi +- callq __pthread_mutex_cond_lock_adjust +- movq %rdi, %r8 +- xorl %esi, %esi +- callq __pthread_mutex_unlock_usercnt +- /* Reload cond_var. */ +- movq 8(%rsp), %rdi +- jmp 8b +- +- /* Initial locking failed. */ +-1: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +- jmp 2b +- +- /* Unlock in loop requires wakeup. */ +-3: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- /* The call preserves %rdx. */ +- callq __lll_unlock_wake +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- jmp 4b +- +- /* Locking in loop failed. */ +-5: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- jmp 6b +- +- /* Unlock after loop requires wakeup. */ +-10: +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- jmp 11b +- +- /* The initial unlocking of the mutex failed. */ +-12: movq %rax, %r10 +- movq 8(%rsp), %rdi +- LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- je 13f +- +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_unlock_wake +- +-13: movq %r10, %rax +- jmp 14b +- +- .size __pthread_cond_wait, .-__pthread_cond_wait +-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait, +- GLIBC_2_3_2) +- +- +- .align 16 +- .type __condvar_cleanup1, @function +- .globl __condvar_cleanup1 +- .hidden __condvar_cleanup1 +-__condvar_cleanup1: +- /* Stack frame: +- +- rsp + 32 +- +--------------------------+ +- rsp + 24 | unused | +- +--------------------------+ +- rsp + 16 | mutex pointer | +- +--------------------------+ +- rsp + 8 | condvar pointer | +- +--------------------------+ +- rsp + 4 | old broadcast_seq value | +- +--------------------------+ +- rsp + 0 | old cancellation mode | +- +--------------------------+ +- */ +- +- movq %rax, 24(%rsp) +- +- /* Get internal lock. */ +- movq 8(%rsp), %rdi +- movl $1, %esi +- xorl %eax, %eax +- LOCK +-#if cond_lock == 0 +- cmpxchgl %esi, (%rdi) +-#else +- cmpxchgl %esi, cond_lock(%rdi) +-#endif +- jz 1f +- +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- callq __lll_lock_wait +-#if cond_lock != 0 +- subq $cond_lock, %rdi +-#endif +- +-1: movl broadcast_seq(%rdi), %edx +- cmpl 4(%rsp), %edx +- jne 3f +- +- /* We increment the wakeup_seq counter only if it is lower than +- total_seq. If this is not the case the thread was woken and +- then canceled. In this case we ignore the signal. */ +- movq total_seq(%rdi), %rax +- cmpq wakeup_seq(%rdi), %rax +- jbe 6f +- incq wakeup_seq(%rdi) +- incl cond_futex(%rdi) +-6: incq woken_seq(%rdi) +- +-3: subl $(1 << nwaiters_shift), cond_nwaiters(%rdi) +- +- /* Wake up a thread which wants to destroy the condvar object. */ +- xorl %ecx, %ecx +- cmpq $0xffffffffffffffff, total_seq(%rdi) +- jne 4f +- movl cond_nwaiters(%rdi), %eax +- andl $~((1 << nwaiters_shift) - 1), %eax +- jne 4f +- +- LP_OP(cmp) $-1, dep_mutex(%rdi) +- leaq cond_nwaiters(%rdi), %rdi +- movl $1, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- subq $cond_nwaiters, %rdi +- movl $1, %ecx +- +-4: LOCK +-#if cond_lock == 0 +- decl (%rdi) +-#else +- decl cond_lock(%rdi) +-#endif +- je 2f +-#if cond_lock != 0 +- addq $cond_lock, %rdi +-#endif +- LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi) +- movl $LLL_PRIVATE, %eax +- movl $LLL_SHARED, %esi +- cmovne %eax, %esi +- /* The call preserves %rcx. */ +- callq __lll_unlock_wake +- +- /* Wake up all waiters to make sure no signal gets lost. */ +-2: testl %ecx, %ecx +- jnz 5f +- addq $cond_futex, %rdi +- LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi) +- movl $0x7fffffff, %edx +-#ifdef __ASSUME_PRIVATE_FUTEX +- movl $FUTEX_WAKE, %eax +- movl $(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), %esi +- cmove %eax, %esi +-#else +- movl $0, %eax +- movl %fs:PRIVATE_FUTEX, %esi +- cmove %eax, %esi +- orl $FUTEX_WAKE, %esi +-#endif +- movl $SYS_futex, %eax +- syscall +- +- /* Lock the mutex only if we don't own it already. This only happens +- in case of PI mutexes, if we got cancelled after a successful +- return of the futex syscall and before disabling async +- cancellation. */ +-5: movq 16(%rsp), %rdi +- movl MUTEX_KIND(%rdi), %eax +- andl $(ROBUST_BIT|PI_BIT), %eax +- cmpl $PI_BIT, %eax +- jne 7f +- +- movl (%rdi), %eax +- andl $TID_MASK, %eax +- cmpl %eax, %fs:TID +- jne 7f +- /* We managed to get the lock. Fix it up before returning. */ +- callq __pthread_mutex_cond_lock_adjust +- jmp 8f +- +- +-7: callq __pthread_mutex_cond_lock +- +-8: movq 24(%rsp), %rdi +-.LcallUR: +- call _Unwind_Resume +- hlt +-.LENDCODE: +- cfi_endproc +- .size __condvar_cleanup1, .-__condvar_cleanup1 +- +- +- .section .gcc_except_table,"a",@progbits +-.LexceptSTART: +- .byte DW_EH_PE_omit # @LPStart format +- .byte DW_EH_PE_omit # @TType format +- .byte DW_EH_PE_uleb128 # call-site format +- .uleb128 .Lcstend-.Lcstbegin +-.Lcstbegin: +- .uleb128 .LcleanupSTART-.LSTARTCODE +- .uleb128 .LcleanupEND-.LcleanupSTART +- .uleb128 __condvar_cleanup1-.LSTARTCODE +- .uleb128 0 +- .uleb128 .LcallUR-.LSTARTCODE +- .uleb128 .LENDCODE-.LcallUR +- .uleb128 0 +- .uleb128 0 +-.Lcstend: +- +- +-#ifdef SHARED +- .hidden DW.ref.__gcc_personality_v0 +- .weak DW.ref.__gcc_personality_v0 +- .section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits +- .align LP_SIZE +- .type DW.ref.__gcc_personality_v0, @object +- .size DW.ref.__gcc_personality_v0, LP_SIZE +-DW.ref.__gcc_personality_v0: +- ASM_ADDR __gcc_personality_v0 +-#endif +diff --git a/sysdeps/x86/bits/pthreadtypes.h b/sysdeps/x86/bits/pthreadtypes.h +index 16b8f4f..a3a738f 100644 +--- a/sysdeps/x86/bits/pthreadtypes.h ++++ b/sysdeps/x86/bits/pthreadtypes.h +@@ -140,14 +140,27 @@ typedef union + { + struct + { +- int __lock; +- unsigned int __futex; +- __extension__ unsigned long long int __total_seq; +- __extension__ unsigned long long int __wakeup_seq; +- __extension__ unsigned long long int __woken_seq; +- void *__mutex; +- unsigned int __nwaiters; +- unsigned int __broadcast_seq; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __wseq; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __wseq32; ++ }; ++ __extension__ union ++ { ++ __extension__ unsigned long long int __g1_start; ++ struct { ++ unsigned int __low; ++ unsigned int __high; ++ } __g1_start32; ++ }; ++ unsigned int __g_refs[2]; ++ unsigned int __g_size[2]; ++ unsigned int __g1_orig_size; ++ unsigned int __wrefs; ++ unsigned int __g_signals[2]; + } __data; + char __size[__SIZEOF_PTHREAD_COND_T]; + __extension__ long long int __align; +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch b/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch new file mode 100644 index 0000000000..8d4ba41078 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0005-Remove-__ASSUME_REQUEUE_PI.patch @@ -0,0 +1,149 @@ +From 27b7131d3d8133bf3a5ce72d4e4ff4dfadd71f20 Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 30 Jun 2017 12:08:29 +0300 +Subject: [PATCH 5/6] Remove __ASSUME_REQUEUE_PI + +The new cond var implementation (ed19993b5b0d) removed all the +__ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no +need to keep defining it. This patch removes all USE_REQUEUE_PI +and __ASSUME_REQUEUE_PI. It is as follow up from BZ#18463. + +Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf, +m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. + + * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro. + * sysdeps/unix/sysv/linux/arm/kernel-features.h + (__ASSUME_REQUEUE_PI): Likewise. + * sysdeps/unix/sysv/linux/kernel-features.h + (__ASSUME_REQUEUE_PI): Likewise. + * sysdeps/unix/sysv/linux/m68k/kernel-features.h + (__ASSUME_REQUEUE_PI): Likewise. + * sysdeps/unix/sysv/linux/mips/kernel-features.h + (__ASSUME_REQUEUE_PI): Likewise. + * sysdeps/unix/sysv/linux/sparc/kernel-features.h + (__ASSUME_REQUEUE_PI): Likewise. + +Upstream-Status: Backport + +Author: Adhemerval Zanella +Signed-off-by: Catalin Enache +--- + ChangeLog | 14 ++++++++++++++ + nptl/pthreadP.h | 12 ------------ + sysdeps/unix/sysv/linux/arm/kernel-features.h | 1 - + sysdeps/unix/sysv/linux/kernel-features.h | 5 ----- + sysdeps/unix/sysv/linux/m68k/kernel-features.h | 1 - + sysdeps/unix/sysv/linux/mips/kernel-features.h | 1 - + sysdeps/unix/sysv/linux/sparc/kernel-features.h | 1 - + 7 files changed, 14 insertions(+), 21 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index c94db7b..44c518b 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,17 @@ ++2017-04-04 Adhemerval Zanella ++ ++ * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro. ++ * sysdeps/unix/sysv/linux/arm/kernel-features.h ++ (__ASSUME_REQUEUE_PI): Likewise. ++ * sysdeps/unix/sysv/linux/kernel-features.h ++ (__ASSUME_REQUEUE_PI): Likewise. ++ * sysdeps/unix/sysv/linux/m68k/kernel-features.h ++ (__ASSUME_REQUEUE_PI): Likewise. ++ * sysdeps/unix/sysv/linux/mips/kernel-features.h ++ (__ASSUME_REQUEUE_PI): Likewise. ++ * sysdeps/unix/sysv/linux/sparc/kernel-features.h ++ (__ASSUME_REQUEUE_PI): Likewise. ++ + 2016-12-31 Torvald Riegel + + [BZ #13165] +diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h +index e9992bc..730c4ad 100644 +--- a/nptl/pthreadP.h ++++ b/nptl/pthreadP.h +@@ -594,18 +594,6 @@ extern void __wait_lookup_done (void) attribute_hidden; + # define PTHREAD_STATIC_FN_REQUIRE(name) __asm (".globl " #name); + #endif + +-/* Test if the mutex is suitable for the FUTEX_WAIT_REQUEUE_PI operation. */ +-#if (defined lll_futex_wait_requeue_pi \ +- && defined __ASSUME_REQUEUE_PI) +-# define USE_REQUEUE_PI(mut) \ +- ((mut) && (mut) != (void *) ~0l \ +- && (((mut)->__data.__kind \ +- & (PTHREAD_MUTEX_PRIO_INHERIT_NP | PTHREAD_MUTEX_ROBUST_NORMAL_NP)) \ +- == PTHREAD_MUTEX_PRIO_INHERIT_NP)) +-#else +-# define USE_REQUEUE_PI(mut) 0 +-#endif +- + /* Returns 0 if POL is a valid scheduling policy. */ + static inline int + check_sched_policy_attr (int pol) +diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h +index 6ca607e..339ad45 100644 +--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h +@@ -23,7 +23,6 @@ + futex_atomic_cmpxchg_inatomic, depending on kernel + configuration. */ + #if __LINUX_KERNEL_VERSION < 0x030E03 +-# undef __ASSUME_REQUEUE_PI + # undef __ASSUME_SET_ROBUST_LIST + #endif + +diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h +index 1d3b554..9f2cf9f 100644 +--- a/sysdeps/unix/sysv/linux/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/kernel-features.h +@@ -101,11 +101,6 @@ + #define __ASSUME_PREADV 1 + #define __ASSUME_PWRITEV 1 + +-/* Support for FUTEX_*_REQUEUE_PI was added in 2.6.31 (but some +- architectures lack futex_atomic_cmpxchg_inatomic in some +- configurations). */ +-#define __ASSUME_REQUEUE_PI 1 +- + /* Support for recvmmsg functionality was added in 2.6.33. The macros + defined correspond to those for accept4. */ + #if __LINUX_KERNEL_VERSION >= 0x020621 +diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h +index 46ec601..174c1c6 100644 +--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h +@@ -51,6 +51,5 @@ + + /* No support for PI futexes or robust mutexes before 3.10 for m68k. */ + #if __LINUX_KERNEL_VERSION < 0x030a00 +-# undef __ASSUME_REQUEUE_PI + # undef __ASSUME_SET_ROBUST_LIST + #endif +diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h +index b486d90..a795911c 100644 +--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h +@@ -24,7 +24,6 @@ + /* The MIPS kernel does not support futex_atomic_cmpxchg_inatomic if + emulating LL/SC. */ + #if __mips == 1 || defined _MIPS_ARCH_R5900 +-# undef __ASSUME_REQUEUE_PI + # undef __ASSUME_SET_ROBUST_LIST + #endif + +diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h +index 69c9c7c..dd3ddf0 100644 +--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h ++++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h +@@ -34,6 +34,5 @@ + /* 32-bit SPARC kernels do not support + futex_atomic_cmpxchg_inatomic. */ + #if !defined __arch64__ && !defined __sparc_v9__ +-# undef __ASSUME_REQUEUE_PI + # undef __ASSUME_SET_ROBUST_LIST + #endif +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch b/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch new file mode 100644 index 0000000000..7616efa183 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch @@ -0,0 +1,81 @@ +From b671f20cc160238b62894d032a55baf85867106e Mon Sep 17 00:00:00 2001 +From: Catalin Enache +Date: Fri, 30 Jun 2017 19:12:43 +0300 +Subject: [PATCH 6/6] Fix atomic_fetch_xor_release. + +No code uses atomic_fetch_xor_release except for the upcoming +conditional variable rewrite. Therefore there is no user +visible bug here. The use of atomic_compare_and_exchange_bool_rel +is removed (since it doesn't exist anymore), and is replaced +by atomic_compare_exchange_weak_release. + +We use weak_release because it provides better performance in +the loop (the weak semantic) and because the xor is release MO +(the release semantic). We don't reload expected in the loop +because atomic_compare_and_exchange_weak_release does this for +us as part of the CAS failure. + +It is otherwise a fairly plain conversion that fixes building +the new condvar for 32-bit x86. Passes all regression tests +for x86. + +Upstream-Status: Backport + +Author: Carlos O'Donell +Signed-off-by: Catalin Enache +--- + ChangeLog | 6 ++++++ + include/atomic.h | 19 +++++++++++-------- + 2 files changed, 17 insertions(+), 8 deletions(-) + +diff --git a/ChangeLog b/ChangeLog +index 44c518b..893262d 100644 +--- a/ChangeLog ++++ b/ChangeLog +@@ -1,3 +1,9 @@ ++2016-10-26 Carlos O'Donell ++ ++ * include/atomic.h ++ [USE_COMPILER_ATOMIC_BUILTINS && !atomic_fetch_xor_release] ++ (atomic_fetch_xor_release): Use atomic_compare_exchange_weak_release. ++ + 2017-04-04 Adhemerval Zanella + + * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro. +diff --git a/include/atomic.h b/include/atomic.h +index 5a8e7e7..c8b4664 100644 +--- a/include/atomic.h ++++ b/include/atomic.h +@@ -777,18 +777,21 @@ void __atomic_link_error (void); + # endif + + # ifndef atomic_fetch_xor_release ++/* Failing the atomic_compare_exchange_weak_release reloads the value in ++ __atg104_expected, so we need only do the XOR again and retry. */ + # define atomic_fetch_xor_release(mem, operand) \ +- ({ __typeof (*(mem)) __atg104_old; \ +- __typeof (mem) __atg104_memp = (mem); \ ++ ({ __typeof (mem) __atg104_memp = (mem); \ ++ __typeof (*(mem)) __atg104_expected = (*__atg104_memp); \ ++ __typeof (*(mem)) __atg104_desired; \ + __typeof (*(mem)) __atg104_op = (operand); \ + \ + do \ +- __atg104_old = (*__atg104_memp); \ +- while (__builtin_expect \ +- (atomic_compare_and_exchange_bool_rel ( \ +- __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\ +- \ +- __atg104_old; }) ++ __atg104_desired = __atg104_expected ^ __atg104_op; \ ++ while (__glibc_unlikely \ ++ (atomic_compare_exchange_weak_release ( \ ++ __atg104_memp, &__atg104_expected, __atg104_desired) \ ++ == 0)); \ ++ __atg104_expected; }) + #endif + + #endif /* !USE_ATOMIC_COMPILER_BUILTINS */ +-- +2.10.2 + diff --git a/meta/recipes-core/glibc/glibc_2.24.bb b/meta/recipes-core/glibc/glibc_2.24.bb index 08ae45947f..e723e03dcf 100644 --- a/meta/recipes-core/glibc/glibc_2.24.bb +++ b/meta/recipes-core/glibc/glibc_2.24.bb @@ -39,6 +39,12 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0026-build_local_scope.patch \ file://0028-Bug-20116-Fix-use-after-free-in-pthread_create.patch \ file://CVE-2016-6323.patch \ + file://0001-Add-atomic_exchange_relaxed.patch \ + file://0002-Add-atomic-operations-required-by-the-new-condition-.patch \ + file://0003-Add-pretty-printers-for-the-NPTL-lock-types.patch \ + file://0004-New-condvar-implementation-that-provides-stronger-or.patch \ + file://0005-Remove-__ASSUME_REQUEUE_PI.patch \ + file://0006-Fix-atomic_fetch_xor_release.patch \ " SRC_URI += "\ From 2d80c47b180880d5e773d48b74347223cff6e8e9 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Tue, 25 Jul 2017 08:29:02 -0700 Subject: [PATCH 117/129] pcre: update SRC_URI to SOURCEFORGE_MIRROR ERROR: libpcre-8.39-r0 do_checkuri: Function failed: do_checkuri [Yocto # 11796] (From OE-Core rev: 3fd12a06fabcdcac0ef40ca71eb694ac988e6cd7) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-support/libpcre/libpcre_8.39.bb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meta/recipes-support/libpcre/libpcre_8.39.bb b/meta/recipes-support/libpcre/libpcre_8.39.bb index 2d4668b52d..90dfb33558 100644 --- a/meta/recipes-support/libpcre/libpcre_8.39.bb +++ b/meta/recipes-support/libpcre/libpcre_8.39.bb @@ -7,7 +7,9 @@ HOMEPAGE = "http://www.pcre.org" SECTION = "devel" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://LICENCE;md5=b8221cbf43c5587f90ccf228f1185cc2" -SRC_URI = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PV}.tar.bz2 \ + + +SRC_URI = "${SOURCEFORGE_MIRROR}/projects/pcre/files/prce/8.39/pcre-${PV}.tar.bz2 \ file://pcre-cross.patch \ file://fix-pcre-name-collision.patch \ file://run-ptest \ From 17fa79728344e8f33ff69dc52dbc90fefa550498 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Tue, 25 Jul 2017 08:49:21 -0700 Subject: [PATCH 118/129] rng-tools: update SRC_URI to SOURCEFORGE_MIRROR fixes: k ERROR: rng-tools-5-r0 do_checkuri: Function failed: do_checkuri [Yocto # 11799] (From OE-Core rev: df65f494bdb480b24d663c8e8f22c70e1ce8a3ea) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-support/rng-tools/rng-tools_5.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-support/rng-tools/rng-tools_5.bb b/meta/recipes-support/rng-tools/rng-tools_5.bb index 913a092fd6..9329e8ad31 100644 --- a/meta/recipes-support/rng-tools/rng-tools_5.bb +++ b/meta/recipes-support/rng-tools/rng-tools_5.bb @@ -2,7 +2,7 @@ SUMMARY = "Random number generator daemon" LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc" -SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \ +SRC_URI = "${SOURCEFORGE_MIRROR}/gkernel/${BP}.tar.gz \ file://0001-If-the-libc-is-lacking-argp-use-libargp.patch \ file://0002-Add-argument-to-control-the-libargp-dependency.patch \ file://underquote.patch \ From 40a97fa9a7acc2be2ed44dee9aa8a156dbcc3ab7 Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Tue, 25 Jul 2017 09:04:29 -0700 Subject: [PATCH 119/129] ed: update SRC_URI to OSL ERROR: ed-1.9-r0 do_checkuri: Function failed: do_checkuri [Yocto # 11798] (From OE-Core rev: 643979162fa7f0329ed9d01c4b1c7f142e2cae0e) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-extended/ed/ed_1.9.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-extended/ed/ed_1.9.bb b/meta/recipes-extended/ed/ed_1.9.bb index f2ec42ad1a..d128de321e 100644 --- a/meta/recipes-extended/ed/ed_1.9.bb +++ b/meta/recipes-extended/ed/ed_1.9.bb @@ -11,7 +11,7 @@ SECTION = "base" # LSB states that ed should be in /bin/ bindir = "${base_bindir}" -SRC_URI = "${GNU_MIRROR}/ed/ed-${PV}.tar.gz" +SRC_URI = "https://ftp.osuosl.org/pub/blfs/conglomeration/ed/ed-${PV}.tar.gz" SRC_URI[md5sum] = "565b6d1d5a9a8816b9b304fc4ed9405d" SRC_URI[sha256sum] = "d5b372cfadf073001823772272fceac2cfa87552c5cd5a8efc1c8aae61f45a88" From d5b5efafb40ddb04d868dc29af4f98344a686807 Mon Sep 17 00:00:00 2001 From: Kai Kang Date: Sat, 27 May 2017 15:45:03 +0800 Subject: [PATCH 120/129] lsof: clear setuid Having 'lsof' as a +s (setuid) binary could lead to security issues if a compromise in the binary is found. It is better that it be -s by default as a precaution. (From OE-Core rev: 4ea593aed96129c58e6bc24df71334c2a2bccff0) Signed-off-by: Kai Kang Signed-off-by: Richard Purdie (cherry picked from commit 346c65dd6855106069d1861ca965d3121eb084d1) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-extended/lsof/lsof_4.89.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-extended/lsof/lsof_4.89.bb b/meta/recipes-extended/lsof/lsof_4.89.bb index b732cf0acd..650b34c7e2 100644 --- a/meta/recipes-extended/lsof/lsof_4.89.bb +++ b/meta/recipes-extended/lsof/lsof_4.89.bb @@ -53,6 +53,6 @@ do_compile () { do_install () { install -d ${D}${sbindir} ${D}${mandir}/man8 - install -m 4755 lsof ${D}${sbindir}/lsof + install -m 0755 lsof ${D}${sbindir}/lsof install -m 0644 lsof.8 ${D}${mandir}/man8/lsof.8 } From 0ec430131e315704caa2a0b97f3a0b1ce899f1f6 Mon Sep 17 00:00:00 2001 From: Andre McCurdy Date: Thu, 6 Jul 2017 12:49:00 -0700 Subject: [PATCH 121/129] lsof: minor recipe cleanup - Add HOMEPAGE - Remove ${S} from LIC_FILES_CHKSUM path - Use tabs consistently to indent do_configure() - Re-order LIC_FILES_CHKSUM definition to follow OE style guide (From OE-Core rev: 4304ea26b7d4cd9d83b7f3414165e9399b640c73) Signed-off-by: Andre McCurdy Signed-off-by: Ross Burton (cherry picked from commit 78701c5b873605240226c502de3b940097433596) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-extended/lsof/lsof_4.89.bb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/meta/recipes-extended/lsof/lsof_4.89.bb b/meta/recipes-extended/lsof/lsof_4.89.bb index 650b34c7e2..0c38e979b6 100644 --- a/meta/recipes-extended/lsof/lsof_4.89.bb +++ b/meta/recipes-extended/lsof/lsof_4.89.bb @@ -1,8 +1,10 @@ SUMMARY = "LiSt Open Files tool" DESCRIPTION = "Lsof is a Unix-specific diagnostic tool. \ Its name stands for LiSt Open Files, and it does just that." +HOMEPAGE = "http://people.freebsd.org/~abe/" SECTION = "devel" LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" SRC_URI = "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${PV}.tar.bz2" @@ -12,9 +14,8 @@ SRC_URI[sha256sum] = "81ac2fc5fdc944793baf41a14002b6deb5a29096b387744e28f8c30a36 UPSTREAM_CHECK_URI = "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof" LOCALSRC = "file://${WORKDIR}/lsof_${PV}/lsof_${PV}_src.tar" -S = "${WORKDIR}/lsof_${PV}_src" -LIC_FILES_CHKSUM = "file://${S}/00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" +S = "${WORKDIR}/lsof_${PV}_src" python do_unpack () { # temporarily change S for unpack @@ -36,11 +37,11 @@ export LSOF_INCLUDE = "${STAGING_INCDIR}" do_configure () { export LSOF_AR="${AR} cr" export LSOF_RANLIB="${RANLIB}" - if [ "x${GLIBCVERSION}" != "x" ];then - LINUX_CLIB=`echo ${GLIBCVERSION} |sed -e 's,\.,,g'` - LINUX_CLIB="-DGLIBCV=${LINUX_CLIB}" - export LINUX_CLIB - fi + if [ "x${GLIBCVERSION}" != "x" ]; then + LINUX_CLIB=`echo ${GLIBCVERSION} |sed -e 's,\.,,g'` + LINUX_CLIB="-DGLIBCV=${LINUX_CLIB}" + export LINUX_CLIB + fi yes | ./Configure linux } From e45e0dbcca097fb6761d24353debad274d088512 Mon Sep 17 00:00:00 2001 From: Andre McCurdy Date: Thu, 6 Jul 2017 12:49:01 -0700 Subject: [PATCH 122/129] lsof: update SRC_URI Upstream lsof releases are hosted on an ftp server which times out download attempts from hosts for which it can not perform a DNS reverse-lookup. See: https://people.freebsd.org/~abe/ http://www.mirrorservice.org seems to be the most commonly used alternative (and using it for SRC_URI allows the custom UPSTREAM_CHECK_URI to be removed). (From OE-Core rev: ac31b1b2eaa22d32c5c3e7dcb6fa4f66303123e0) Signed-off-by: Andre McCurdy Signed-off-by: Ross Burton (cherry picked from commit 4e718242c1554021689a7946add055b22b81ec42) Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-extended/lsof/lsof_4.89.bb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meta/recipes-extended/lsof/lsof_4.89.bb b/meta/recipes-extended/lsof/lsof_4.89.bb index 0c38e979b6..29245b1ab9 100644 --- a/meta/recipes-extended/lsof/lsof_4.89.bb +++ b/meta/recipes-extended/lsof/lsof_4.89.bb @@ -6,13 +6,16 @@ SECTION = "devel" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://00README;beginline=645;endline=679;md5=964df275d26429ba3b39dbb9f205172a" -SRC_URI = "ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${PV}.tar.bz2" +# Upstream lsof releases are hosted on an ftp server which times out download +# attempts from hosts for which it can not perform a DNS reverse-lookup (See: +# https://people.freebsd.org/~abe/ ). http://www.mirrorservice.org seems to be +# the most commonly used alternative. + +SRC_URI = "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_${PV}.tar.bz2" SRC_URI[md5sum] = "1b9cd34f3fb86856a125abbf2be3a386" SRC_URI[sha256sum] = "81ac2fc5fdc944793baf41a14002b6deb5a29096b387744e28f8c30a360a3718" -UPSTREAM_CHECK_URI = "http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof" - LOCALSRC = "file://${WORKDIR}/lsof_${PV}/lsof_${PV}_src.tar" S = "${WORKDIR}/lsof_${PV}_src" From 0f33bfad25a9016581b89437fe0e346d620e8ed5 Mon Sep 17 00:00:00 2001 From: Nikolay Merinov Date: Wed, 26 Jul 2017 13:05:08 +0500 Subject: [PATCH 123/129] systemd: Disable DefaultDependencies for sysv scripts on rcS runlevel systemd-sysv-generator translate sysv services on rcS runlevel to services that starts before sysinit.target. This behavour conflict with default dependency on same tartget. String that define "DefaultDependency=no" was lost from patch for sysv generator during porting patches to systemd 229 in commit 64ab17b707dc431aaed880d6d8615971243f46f8. Current commit returns changes required for services that work on rcS runlevel. (From OE-Core rev: 5c0a87c94ab086514039f2f8d0e9b06daa2179a7) Signed-off-by: Nikolay Merinov Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...add-support-for-executing-scripts-und.patch | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch index ac67f65685..5736f57814 100644 --- a/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch +++ b/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch @@ -57,7 +57,17 @@ index b5925a4..ea06d6a 100644 } SysvStub; static void free_sysvstub(SysvStub *s) { -@@ -711,17 +717,31 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { +@@ -194,6 +198,9 @@ static int generate_unit_file(SysvStub *s) { + if (s->description) + fprintf(f, "Description=%s\n", s->description); + ++ if (!s->default_dependencies) ++ fprintf(f, "DefaultDependencies=no\n"); ++ + STRV_FOREACH(p, s->before) + fprintf(f, "Before=%s\n", *p); + STRV_FOREACH(p, s->after) +@@ -711,17 +720,31 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { if (s->has_lsb && other->has_lsb) continue; @@ -95,7 +105,7 @@ index b5925a4..ea06d6a 100644 /* FIXME: Maybe we should compare the name here lexicographically? */ } -@@ -788,6 +808,8 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { +@@ -788,6 +811,8 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { return log_oom(); service->sysv_start_priority = -1; @@ -104,7 +114,7 @@ index b5925a4..ea06d6a 100644 service->name = name; service->path = fpath; name = fpath = NULL; -@@ -871,9 +893,11 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic +@@ -871,9 +896,11 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic if (de->d_name[0] == 'S') { @@ -118,7 +128,7 @@ index b5925a4..ea06d6a 100644 r = set_ensure_allocated(&runlevel_services[i], NULL); if (r < 0) { log_oom(); -@@ -887,7 +911,8 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic +@@ -887,7 +914,8 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic } } else if (de->d_name[0] == 'K' && From 81f8a454d0fe1ccf1042cbe6d53b4ecf52c5c22d Mon Sep 17 00:00:00 2001 From: Maxin John Date: Tue, 1 Aug 2017 13:13:10 +0300 Subject: [PATCH 124/129] libpng12: move SRC_URI back to SOURCEFORGE_MIRROR Since GENTOO_MIRROR removes older binaries, move back to SOURCEFORGE_MIRROR. Also provide a MIRROR to "older-releases" directory. [YOCTO #11556] (From OE-Core rev: 2340d0d244ea8eb3568d6ce06dd751bedf93eb1e) Signed-off-by: Maxin B. John Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-lsb4/libpng/libpng12_1.2.56.bb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/recipes-lsb4/libpng/libpng12_1.2.56.bb b/meta/recipes-lsb4/libpng/libpng12_1.2.56.bb index 10c350ac25..277d69ff05 100644 --- a/meta/recipes-lsb4/libpng/libpng12_1.2.56.bb +++ b/meta/recipes-lsb4/libpng/libpng12_1.2.56.bb @@ -9,7 +9,11 @@ DEPENDS = "zlib" PN = "libpng12" S = "${WORKDIR}/libpng-${PV}" -SRC_URI = "${GENTOO_MIRROR}/libpng-${PV}.tar.xz" +LIBV = "12" + +SRC_URI = "${SOURCEFORGE_MIRROR}/project/libpng/libpng${LIBV}/${PV}/libpng-${PV}.tar.xz" + +MIRRORS += "${SOURCEFORGE_MIRROR}/project/libpng/libpng${LIBV}/${PV}/ ${SOURCEFORGE_MIRROR}/project/libpng/libpng${LIBV}/older-releases/${PV}" SRC_URI[md5sum] = "868562bd1c58b76ed8703f135a2e439a" SRC_URI[sha256sum] = "24ce54581468b937734a6ecc86f7e121bc46a90d76a0d948dca08f32ee000dbe" From 5e4adbd78003bec7b0fd2295c27b7ac75ab326ed Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Fri, 4 Aug 2017 17:26:58 +0100 Subject: [PATCH 125/129] archiver: Escape recipe name in regex The recipe name needs to be escaped when using it in a regular expression so that and special characters are treated literally (From OE-Core rev: a26d12e43059fe37c843d3ff9480ead2e796e21f) Signed-off-by: Joshua Watt Signed-off-by: Ross Burton Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/archiver.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index 3543ca9c58..188f8c0423 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass @@ -349,8 +349,8 @@ python do_ar_recipe () { bbappend_files = d.getVar('BBINCLUDED', True).split() # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded. - bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn) - bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn) + bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn)) + bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn)) for file in bbappend_files: if bbappend_re.match(file) or bbappend_re1.match(file): shutil.copy(file, outdir) From 7cc37c53909d958fd432f93c8f569a4de69a298f Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 4 Aug 2017 17:26:59 +0100 Subject: [PATCH 126/129] systemd: remove upstreamed patch The addition of missing.h to user-utils.c was done in v230 with 0b6b45d5. (From OE-Core rev: b9e5a58f64e45be37b9532b20bf22d91257abbd6) Signed-off-by: Ross Burton Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- ...h-for-getting-secure_getenv-definiti.patch | 27 ------------------- meta/recipes-core/systemd/systemd_230.bb | 1 - 2 files changed, 28 deletions(-) delete mode 100644 meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch diff --git a/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch b/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch deleted file mode 100644 index 5797a29e60..0000000000 --- a/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 6cedbaee7964f6a6c61b9f2c8f0b87cef9370424 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Tue, 15 Dec 2015 22:51:55 +0000 -Subject: [PATCH 26/38] include missing.h for getting secure_getenv definition - -Signed-off-by: Khem Raj ---- -Upstream-Status: Pending - - src/basic/user-util.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/user-util.c b/src/basic/user-util.c -index 55672b3..22c4a23 100644 ---- a/src/basic/user-util.c -+++ b/src/basic/user-util.c -@@ -38,6 +38,7 @@ - #include "path-util.h" - #include "string-util.h" - #include "user-util.h" -+#include "missing.h" - - bool uid_is_valid(uid_t uid) { - --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd_230.bb b/meta/recipes-core/systemd/systemd_230.bb index 19d144d3fa..702e377264 100644 --- a/meta/recipes-core/systemd/systemd_230.bb +++ b/meta/recipes-core/systemd/systemd_230.bb @@ -33,7 +33,6 @@ SRC_URI += " \ file://0018-make-test-dir-configurable.patch \ file://0019-remove-duplicate-include-uchar.h.patch \ file://0020-check-for-uchar.h-in-configure.patch \ - file://0021-include-missing.h-for-getting-secure_getenv-definiti.patch \ file://0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ file://udev-re-enable-mount-propagation-for-udevd.patch \ file://CVE-2016-7795.patch \ From 07e5111828d6cad3133beb23e50312e4a5d6b73c Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 4 Aug 2017 17:27:00 +0100 Subject: [PATCH 127/129] systemd: refuse to load units with errors (CVE-2017-1000082) If a unit has a statement such as User=0day where the username exists but is strictly speaking invalid, the unit will be started as the root user instead. Backport a patch from upstream to mitigate this by refusing to start units such as this. (From OE-Core rev: e56cb926c170f493ee2a9c4c63d0ecbf883d4685) Signed-off-by: Ross Burton Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- .../systemd/systemd/validate-user.patch | 856 ++++++++++++++++++ meta/recipes-core/systemd/systemd_230.bb | 1 + 2 files changed, 857 insertions(+) create mode 100644 meta/recipes-core/systemd/systemd/validate-user.patch diff --git a/meta/recipes-core/systemd/systemd/validate-user.patch b/meta/recipes-core/systemd/systemd/validate-user.patch new file mode 100644 index 0000000000..8e0e0c1b9a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/validate-user.patch @@ -0,0 +1,856 @@ +If a user is created with a strictly-speaking invalid name such as '0day' and a +unit created to run as that user, systemd rejects the username and runs the unit +as root. + +CVE: CVE-2017-1000082 +Upstream-Status: Backport +Signed-off-by: Ross Burton + +From e0c4eb1435d50cb3797cf94100d4886dc2022bce Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jul 2016 12:23:39 +0200 +Subject: [PATCH 1/3] sysusers: move various user credential validity checks to + src/basic/ + +This way we can reuse them for validating User=/Group= settings in unit files +(to be added in a later commit). + +Also, add some tests for them. +--- + src/basic/user-util.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++ + src/basic/user-util.h | 5 +++ + src/sysusers/sysusers.c | 75 -------------------------------------- + src/test/test-user-util.c | 87 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 185 insertions(+), 75 deletions(-) + +diff --git a/src/basic/user-util.c b/src/basic/user-util.c +index f65ca3eda..c85b5c6a8 100644 +--- a/src/basic/user-util.c ++++ b/src/basic/user-util.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + + #include "missing.h" + #include "alloc-util.h" +@@ -39,6 +40,7 @@ + #include "path-util.h" + #include "string-util.h" + #include "user-util.h" ++#include "utf8.h" + + bool uid_is_valid(uid_t uid) { + +@@ -479,3 +481,94 @@ int take_etc_passwd_lock(const char *root) { + + return fd; + } ++ ++bool valid_user_group_name(const char *u) { ++ const char *i; ++ long sz; ++ ++ /* Checks if the specified name is a valid user/group name. */ ++ ++ if (isempty(u)) ++ return false; ++ ++ if (!(u[0] >= 'a' && u[0] <= 'z') && ++ !(u[0] >= 'A' && u[0] <= 'Z') && ++ u[0] != '_') ++ return false; ++ ++ for (i = u+1; *i; i++) { ++ if (!(*i >= 'a' && *i <= 'z') && ++ !(*i >= 'A' && *i <= 'Z') && ++ !(*i >= '0' && *i <= '9') && ++ *i != '_' && ++ *i != '-') ++ return false; ++ } ++ ++ sz = sysconf(_SC_LOGIN_NAME_MAX); ++ assert_se(sz > 0); ++ ++ if ((size_t) (i-u) > (size_t) sz) ++ return false; ++ ++ if ((size_t) (i-u) > UT_NAMESIZE - 1) ++ return false; ++ ++ return true; ++} ++ ++bool valid_user_group_name_or_id(const char *u) { ++ ++ /* Similar as above, but is also fine with numeric UID/GID specifications, as long as they are in the right ++ * range, and not the invalid user ids. */ ++ ++ if (isempty(u)) ++ return false; ++ ++ if (valid_user_group_name(u)) ++ return true; ++ ++ return parse_uid(u, NULL) >= 0; ++} ++ ++bool valid_gecos(const char *d) { ++ ++ if (!d) ++ return false; ++ ++ if (!utf8_is_valid(d)) ++ return false; ++ ++ if (string_has_cc(d, NULL)) ++ return false; ++ ++ /* Colons are used as field separators, and hence not OK */ ++ if (strchr(d, ':')) ++ return false; ++ ++ return true; ++} ++ ++bool valid_home(const char *p) { ++ ++ if (isempty(p)) ++ return false; ++ ++ if (!utf8_is_valid(p)) ++ return false; ++ ++ if (string_has_cc(p, NULL)) ++ return false; ++ ++ if (!path_is_absolute(p)) ++ return false; ++ ++ if (!path_is_safe(p)) ++ return false; ++ ++ /* Colons are used as field separators, and hence not OK */ ++ if (strchr(p, ':')) ++ return false; ++ ++ return true; ++} +diff --git a/src/basic/user-util.h b/src/basic/user-util.h +index 8026eca3f..36f71fb00 100644 +--- a/src/basic/user-util.h ++++ b/src/basic/user-util.h +@@ -68,3 +68,8 @@ int take_etc_passwd_lock(const char *root); + static inline bool userns_supported(void) { + return access("/proc/self/uid_map", F_OK) >= 0; + } ++ ++bool valid_user_group_name(const char *u); ++bool valid_user_group_name_or_id(const char *u); ++bool valid_gecos(const char *d); ++bool valid_home(const char *p); +diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c +index 4377f1b91..df3b7de30 100644 +--- a/src/sysusers/sysusers.c ++++ b/src/sysusers/sysusers.c +@@ -1299,81 +1299,6 @@ static bool item_equal(Item *a, Item *b) { + return true; + } + +-static bool valid_user_group_name(const char *u) { +- const char *i; +- long sz; +- +- if (isempty(u)) +- return false; +- +- if (!(u[0] >= 'a' && u[0] <= 'z') && +- !(u[0] >= 'A' && u[0] <= 'Z') && +- u[0] != '_') +- return false; +- +- for (i = u+1; *i; i++) { +- if (!(*i >= 'a' && *i <= 'z') && +- !(*i >= 'A' && *i <= 'Z') && +- !(*i >= '0' && *i <= '9') && +- *i != '_' && +- *i != '-') +- return false; +- } +- +- sz = sysconf(_SC_LOGIN_NAME_MAX); +- assert_se(sz > 0); +- +- if ((size_t) (i-u) > (size_t) sz) +- return false; +- +- if ((size_t) (i-u) > UT_NAMESIZE - 1) +- return false; +- +- return true; +-} +- +-static bool valid_gecos(const char *d) { +- +- if (!d) +- return false; +- +- if (!utf8_is_valid(d)) +- return false; +- +- if (string_has_cc(d, NULL)) +- return false; +- +- /* Colons are used as field separators, and hence not OK */ +- if (strchr(d, ':')) +- return false; +- +- return true; +-} +- +-static bool valid_home(const char *p) { +- +- if (isempty(p)) +- return false; +- +- if (!utf8_is_valid(p)) +- return false; +- +- if (string_has_cc(p, NULL)) +- return false; +- +- if (!path_is_absolute(p)) +- return false; +- +- if (!path_is_safe(p)) +- return false; +- +- /* Colons are used as field separators, and hence not OK */ +- if (strchr(p, ':')) +- return false; +- +- return true; +-} +- + static int parse_line(const char *fname, unsigned line, const char *buffer) { + + static const Specifier specifier_table[] = { +diff --git a/src/test/test-user-util.c b/src/test/test-user-util.c +index 8d1ec19f1..2a344a9f9 100644 +--- a/src/test/test-user-util.c ++++ b/src/test/test-user-util.c +@@ -61,6 +61,88 @@ static void test_uid_ptr(void) { + assert_se(PTR_TO_UID(UID_TO_PTR(1000)) == 1000); + } + ++static void test_valid_user_group_name(void) { ++ assert_se(!valid_user_group_name(NULL)); ++ assert_se(!valid_user_group_name("")); ++ assert_se(!valid_user_group_name("1")); ++ assert_se(!valid_user_group_name("65535")); ++ assert_se(!valid_user_group_name("-1")); ++ assert_se(!valid_user_group_name("-kkk")); ++ assert_se(!valid_user_group_name("rööt")); ++ assert_se(!valid_user_group_name(".")); ++ assert_se(!valid_user_group_name("eff.eff")); ++ assert_se(!valid_user_group_name("foo\nbar")); ++ assert_se(!valid_user_group_name("0123456789012345678901234567890123456789")); ++ assert_se(!valid_user_group_name_or_id("aaa:bbb")); ++ ++ assert_se(valid_user_group_name("root")); ++ assert_se(valid_user_group_name("lennart")); ++ assert_se(valid_user_group_name("LENNART")); ++ assert_se(valid_user_group_name("_kkk")); ++ assert_se(valid_user_group_name("kkk-")); ++ assert_se(valid_user_group_name("kk-k")); ++ ++ assert_se(valid_user_group_name("some5")); ++ assert_se(!valid_user_group_name("5some")); ++ assert_se(valid_user_group_name("INNER5NUMBER")); ++} ++ ++static void test_valid_user_group_name_or_id(void) { ++ assert_se(!valid_user_group_name_or_id(NULL)); ++ assert_se(!valid_user_group_name_or_id("")); ++ assert_se(valid_user_group_name_or_id("0")); ++ assert_se(valid_user_group_name_or_id("1")); ++ assert_se(valid_user_group_name_or_id("65534")); ++ assert_se(!valid_user_group_name_or_id("65535")); ++ assert_se(valid_user_group_name_or_id("65536")); ++ assert_se(!valid_user_group_name_or_id("-1")); ++ assert_se(!valid_user_group_name_or_id("-kkk")); ++ assert_se(!valid_user_group_name_or_id("rööt")); ++ assert_se(!valid_user_group_name_or_id(".")); ++ assert_se(!valid_user_group_name_or_id("eff.eff")); ++ assert_se(!valid_user_group_name_or_id("foo\nbar")); ++ assert_se(!valid_user_group_name_or_id("0123456789012345678901234567890123456789")); ++ assert_se(!valid_user_group_name_or_id("aaa:bbb")); ++ ++ assert_se(valid_user_group_name_or_id("root")); ++ assert_se(valid_user_group_name_or_id("lennart")); ++ assert_se(valid_user_group_name_or_id("LENNART")); ++ assert_se(valid_user_group_name_or_id("_kkk")); ++ assert_se(valid_user_group_name_or_id("kkk-")); ++ assert_se(valid_user_group_name_or_id("kk-k")); ++ ++ assert_se(valid_user_group_name_or_id("some5")); ++ assert_se(!valid_user_group_name_or_id("5some")); ++ assert_se(valid_user_group_name_or_id("INNER5NUMBER")); ++} ++ ++static void test_valid_gecos(void) { ++ ++ assert_se(!valid_gecos(NULL)); ++ assert_se(valid_gecos("")); ++ assert_se(valid_gecos("test")); ++ assert_se(valid_gecos("Ümläüt")); ++ assert_se(!valid_gecos("In\nvalid")); ++ assert_se(!valid_gecos("In:valid")); ++} ++ ++static void test_valid_home(void) { ++ ++ assert_se(!valid_home(NULL)); ++ assert_se(!valid_home("")); ++ assert_se(!valid_home(".")); ++ assert_se(!valid_home("/home/..")); ++ assert_se(!valid_home("/home/../")); ++ assert_se(!valid_home("/home\n/foo")); ++ assert_se(!valid_home("./piep")); ++ assert_se(!valid_home("piep")); ++ assert_se(!valid_home("/home/user:lennart")); ++ ++ assert_se(valid_home("/")); ++ assert_se(valid_home("/home")); ++ assert_se(valid_home("/home/foo")); ++} ++ + int main(int argc, char*argv[]) { + + test_uid_to_name_one(0, "root"); +@@ -75,5 +157,10 @@ int main(int argc, char*argv[]) { + test_parse_uid(); + test_uid_ptr(); + ++ test_valid_user_group_name(); ++ test_valid_user_group_name_or_id(); ++ test_valid_gecos(); ++ test_valid_home(); ++ + return 0; + } +-- +2.11.0 + + +From 1affacaaf6eff93e53563a644567cc5c3930cb28 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 14 Jul 2016 12:28:06 +0200 +Subject: [PATCH 2/3] core: be stricter when parsing User=/Group= fields + +Let's verify the validity of the syntax of the user/group names set. +--- + src/core/load-fragment-gperf.gperf.m4 | 10 +-- + src/core/load-fragment.c | 118 ++++++++++++++++++++++++++++++++++ + src/core/load-fragment.h | 2 + + 3 files changed, 125 insertions(+), 5 deletions(-) + +diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4 +index 819341898..110089696 100644 +--- a/src/core/load-fragment-gperf.gperf.m4 ++++ b/src/core/load-fragment-gperf.gperf.m4 +@@ -19,9 +19,9 @@ m4_dnl Define the context options only once + m4_define(`EXEC_CONTEXT_CONFIG_ITEMS', + `$1.WorkingDirectory, config_parse_working_directory, 0, offsetof($1, exec_context) + $1.RootDirectory, config_parse_unit_path_printf, 0, offsetof($1, exec_context.root_directory) +-$1.User, config_parse_unit_string_printf, 0, offsetof($1, exec_context.user) +-$1.Group, config_parse_unit_string_printf, 0, offsetof($1, exec_context.group) +-$1.SupplementaryGroups, config_parse_strv, 0, offsetof($1, exec_context.supplementary_groups) ++$1.User, config_parse_user_group, 0, offsetof($1, exec_context.user) ++$1.Group, config_parse_user_group, 0, offsetof($1, exec_context.group) ++$1.SupplementaryGroups, config_parse_user_group_strv, 0, offsetof($1, exec_context.supplementary_groups) + $1.Nice, config_parse_exec_nice, 0, offsetof($1, exec_context) + $1.OOMScoreAdjust, config_parse_exec_oom_score_adjust, 0, offsetof($1, exec_context) + $1.IOSchedulingClass, config_parse_exec_io_class, 0, offsetof($1, exec_context) +@@ -275,8 +275,8 @@ Socket.ExecStartPost, config_parse_exec, SOCKET_EXEC + Socket.ExecStopPre, config_parse_exec, SOCKET_EXEC_STOP_PRE, offsetof(Socket, exec_command) + Socket.ExecStopPost, config_parse_exec, SOCKET_EXEC_STOP_POST, offsetof(Socket, exec_command) + Socket.TimeoutSec, config_parse_sec, 0, offsetof(Socket, timeout_usec) +-Socket.SocketUser, config_parse_unit_string_printf, 0, offsetof(Socket, user) +-Socket.SocketGroup, config_parse_unit_string_printf, 0, offsetof(Socket, group) ++Socket.SocketUser, config_parse_user_group, 0, offsetof(Socket, user) ++Socket.SocketGroup, config_parse_user_group, 0, offsetof(Socket, group) + Socket.SocketMode, config_parse_mode, 0, offsetof(Socket, socket_mode) + Socket.DirectoryMode, config_parse_mode, 0, offsetof(Socket, directory_mode) + Socket.Accept, config_parse_bool, 0, offsetof(Socket, accept) +diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c +index 86b4fb071..f43781803 100644 +--- a/src/core/load-fragment.c ++++ b/src/core/load-fragment.c +@@ -64,6 +64,7 @@ + #include "unit-name.h" + #include "unit-printf.h" + #include "unit.h" ++#include "user-util.h" + #include "utf8.h" + #include "web-util.h" + +@@ -1758,6 +1759,123 @@ int config_parse_sec_fix_0( + return 0; + } + ++int config_parse_user_group( ++ const char *unit, ++ const char *filename, ++ unsigned line, ++ const char *section, ++ unsigned section_line, ++ const char *lvalue, ++ int ltype, ++ const char *rvalue, ++ void *data, ++ void *userdata) { ++ ++ char **user = data, *n; ++ Unit *u = userdata; ++ int r; ++ ++ assert(filename); ++ assert(lvalue); ++ assert(rvalue); ++ assert(u); ++ ++ if (isempty(rvalue)) ++ n = NULL; ++ else { ++ _cleanup_free_ char *k = NULL; ++ ++ r = unit_full_printf(u, rvalue, &k); ++ if (r < 0) { ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue); ++ return 0; ++ } ++ ++ if (!valid_user_group_name_or_id(k)) { ++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); ++ return 0; ++ } ++ ++ n = k; ++ k = NULL; ++ } ++ ++ free(*user); ++ *user = n; ++ ++ return 0; ++} ++ ++int config_parse_user_group_strv( ++ const char *unit, ++ const char *filename, ++ unsigned line, ++ const char *section, ++ unsigned section_line, ++ const char *lvalue, ++ int ltype, ++ const char *rvalue, ++ void *data, ++ void *userdata) { ++ ++ char ***users = data; ++ Unit *u = userdata; ++ const char *p; ++ int r; ++ ++ assert(filename); ++ assert(lvalue); ++ assert(rvalue); ++ assert(u); ++ ++ if (isempty(rvalue)) { ++ char **empty; ++ ++ empty = new0(char*, 1); ++ if (!empty) ++ return log_oom(); ++ ++ strv_free(*users); ++ *users = empty; ++ ++ return 0; ++ } ++ ++ p = rvalue; ++ for (;;) { ++ _cleanup_free_ char *word = NULL, *k = NULL; ++ ++ r = extract_first_word(&p, &word, WHITESPACE, 0); ++ if (r == 0) ++ break; ++ if (r == -ENOMEM) ++ return log_oom(); ++ if (r < 0) { ++ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); ++ break; ++ } ++ ++ r = unit_full_printf(u, word, &k); ++ if (r < 0) { ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word); ++ continue; ++ } ++ ++ if (!valid_user_group_name_or_id(k)) { ++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); ++ continue; ++ } ++ ++ r = strv_push(users, k); ++ if (r < 0) ++ return log_oom(); ++ ++ k = NULL; ++ } ++ ++ return 0; ++} ++ + int config_parse_busname_service( + const char *unit, + const char *filename, +diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h +index b36a2e3a0..213bce55a 100644 +--- a/src/core/load-fragment.h ++++ b/src/core/load-fragment.h +@@ -111,6 +111,8 @@ int config_parse_exec_utmp_mode(const char *unit, const char *filename, unsigned + int config_parse_working_directory(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); + int config_parse_fdname(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); + int config_parse_sec_fix_0(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); ++int config_parse_user_group(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); ++int config_parse_user_group_strv(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); + + /* gperf prototypes */ + const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length); +-- +2.11.0 + + +From 97e0456384ed5c930394062d340237ea6130ece0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Thu, 6 Jul 2017 13:28:19 -0400 +Subject: [PATCH 3/3] core/load-fragment: refuse units with errors in certain + directives + +If an error is encountered in any of the Exec* lines, WorkingDirectory, +SELinuxContext, ApparmorProfile, SmackProcessLabel, Service (in .socket +units), User, or Group, refuse to load the unit. If the config stanza +has support, ignore the failure if '-' is present. + +For those configuration directives, even if we started the unit, it's +pretty likely that it'll do something unexpected (like write files +in a wrong place, or with a wrong context, or run with wrong permissions, +etc). It seems better to refuse to start the unit and have the admin +clean up the configuration without giving the service a chance to mess +up stuff. + +Note that all "security" options that restrict what the unit can do +(Capabilities, AmbientCapabilities, Restrict*, SystemCallFilter, Limit*, +PrivateDevices, Protect*, etc) are _not_ treated like this. Such options are +only supplementary, and are not always available depending on the architecture +and compilation options, so unit authors have to make sure that the service +runs correctly without them anyway. + +Fixes #6237, #6277. + +Signed-off-by: Ross Burton +--- + src/core/load-fragment.c | 101 ++++++++++++++++++++++++++++------------------ + src/test/test-unit-file.c | 14 +++---- + 2 files changed, 69 insertions(+), 46 deletions(-) + +diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c +index f43781803..b1fb1d407 100644 +--- a/src/core/load-fragment.c ++++ b/src/core/load-fragment.c +@@ -626,20 +626,28 @@ int config_parse_exec( + + if (isempty(f)) { + /* First word is either "-" or "@" with no command. */ +- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty path in command line, ignoring: \"%s\"", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Empty path in command line%s: \"%s\"", ++ ignore ? ", ignoring" : "", rvalue); ++ return ignore ? 0 : -ENOEXEC; + } + if (!string_is_safe(f)) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path contains special characters, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Executable path contains special characters%s: %s", ++ ignore ? ", ignoring" : "", rvalue); ++ return ignore ? 0 : -ENOEXEC; + } + if (!path_is_absolute(f)) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path is not absolute, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Executable path is not absolute%s: %s", ++ ignore ? ", ignoring" : "", rvalue); ++ return ignore ? 0 : -ENOEXEC; + } + if (endswith(f, "/")) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Executable path specifies a directory, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Executable path specifies a directory%s: %s", ++ ignore ? ", ignoring" : "", rvalue); ++ return ignore ? 0 : -ENOEXEC; + } + + if (f == firstword) { +@@ -695,7 +703,7 @@ int config_parse_exec( + if (r == 0) + break; + else if (r < 0) +- return 0; ++ return ignore ? 0 : -ENOEXEC; + + if (!GREEDY_REALLOC(n, nbufsize, nlen + 2)) + return log_oom(); +@@ -705,8 +713,10 @@ int config_parse_exec( + } + + if (!n || !n[0]) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Empty executable name or zeroeth argument, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Empty executable name or zeroeth argument%s: %s", ++ ignore ? ", ignoring" : "", rvalue); ++ return ignore ? 0 : -ENOEXEC; + } + + nce = new0(ExecCommand, 1); +@@ -1214,8 +1224,10 @@ int config_parse_exec_selinux_context( + + r = unit_name_printf(u, rvalue, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, ++ "Failed to resolve specifiers%s: %m", ++ ignore ? ", ignoring" : ""); ++ return ignore ? 0 : -ENOEXEC; + } + + free(c->selinux_context); +@@ -1262,8 +1274,10 @@ int config_parse_exec_apparmor_profile( + + r = unit_name_printf(u, rvalue, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, ++ "Failed to resolve specifiers%s: %m", ++ ignore ? ", ignoring" : ""); ++ return ignore ? 0 : -ENOEXEC; + } + + free(c->apparmor_profile); +@@ -1310,8 +1324,10 @@ int config_parse_exec_smack_process_label( + + r = unit_name_printf(u, rvalue, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %m"); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, ++ "Failed to resolve specifiers%s: %m", ++ ignore ? ", ignoring" : ""); ++ return ignore ? 0 : -ENOEXEC; + } + + free(c->smack_process_label); +@@ -1520,19 +1536,19 @@ int config_parse_socket_service( + + r = unit_name_printf(UNIT(s), rvalue, &p); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve specifiers: %s", rvalue); ++ return -ENOEXEC; + } + + if (!endswith(p, ".service")) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service, ignoring: %s", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, "Unit must be of type service: %s", rvalue); ++ return -ENOEXEC; + } + + r = manager_load_unit(UNIT(s)->manager, p, NULL, &error, &x); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s, ignoring: %s", rvalue, bus_error_message(&error, r)); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to load unit %s: %s", rvalue, bus_error_message(&error, r)); ++ return -ENOEXEC; + } + + unit_ref_set(&s->service, x); +@@ -1787,13 +1803,13 @@ int config_parse_user_group( + + r = unit_full_printf(u, rvalue, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", rvalue); ++ return -ENOEXEC; + } + + if (!valid_user_group_name_or_id(k)) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k); ++ return -ENOEXEC; + } + + n = k; +@@ -1851,19 +1867,19 @@ int config_parse_user_group_strv( + if (r == -ENOMEM) + return log_oom(); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax, ignoring: %s", rvalue); +- break; ++ log_syntax(unit, LOG_ERR, filename, line, r, "Invalid syntax: %s", rvalue); ++ return -ENOEXEC; + } + + r = unit_full_printf(u, word, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", word); +- continue; ++ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s: %m", word); ++ return -ENOEXEC; + } + + if (!valid_user_group_name_or_id(k)) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID, ignoring: %s", k); +- continue; ++ log_syntax(unit, LOG_ERR, filename, line, 0, "Invalid user/group name or numeric ID: %s", k); ++ return -ENOEXEC; + } + + r = strv_push(users, k); +@@ -2022,20 +2038,24 @@ int config_parse_working_directory( + + r = unit_full_printf(u, rvalue, &k); + if (r < 0) { +- log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in working directory path '%s', ignoring: %m", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, r, ++ "Failed to resolve unit specifiers in working directory path '%s'%s: %m", ++ rvalue, missing_ok ? ", ignoring" : ""); ++ return missing_ok ? 0 : -ENOEXEC; + } + + path_kill_slashes(k); + + if (!utf8_is_valid(k)) { + log_syntax_invalid_utf8(unit, LOG_ERR, filename, line, rvalue); +- return 0; ++ return missing_ok ? 0 : -ENOEXEC; + } + + if (!path_is_absolute(k)) { +- log_syntax(unit, LOG_ERR, filename, line, 0, "Working directory path '%s' is not absolute, ignoring.", rvalue); +- return 0; ++ log_syntax(unit, LOG_ERR, filename, line, 0, ++ "Working directory path '%s' is not absolute%s.", ++ rvalue, missing_ok ? ", ignoring" : ""); ++ return missing_ok ? 0 : -ENOEXEC; + } + + free(c->working_directory); +@@ -4043,8 +4063,11 @@ int unit_load_fragment(Unit *u) { + return r; + + r = load_from_path(u, k); +- if (r < 0) ++ if (r < 0) { ++ if (r == -ENOEXEC) ++ log_unit_notice(u, "Unit configuration has fatal error, unit will not be started."); + return r; ++ } + + if (u->load_state == UNIT_STUB) { + SET_FOREACH(t, u->names, i) { +diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c +index ade0ff2a6..fe1969570 100644 +--- a/src/test/test-unit-file.c ++++ b/src/test/test-unit-file.c +@@ -146,7 +146,7 @@ static void test_config_parse_exec(void) { + r = config_parse_exec(NULL, "fake", 4, "section", 1, + "LValue", 0, "/RValue/ argv0 r1", + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + + log_info("/* honour_argv0 */"); +@@ -161,7 +161,7 @@ static void test_config_parse_exec(void) { + r = config_parse_exec(NULL, "fake", 3, "section", 1, + "LValue", 0, "@/RValue", + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + + log_info("/* no command, whitespace only, reset */"); +@@ -220,7 +220,7 @@ static void test_config_parse_exec(void) { + "-@/RValue argv0 r1 ; ; " + "/goo/goo boo", + &c, u); +- assert_se(r >= 0); ++ assert_se(r == -ENOEXEC); + c1 = c1->command_next; + check_execcommand(c1, "/RValue", "argv0", "r1", NULL, true); + +@@ -374,7 +374,7 @@ static void test_config_parse_exec(void) { + r = config_parse_exec(NULL, "fake", 4, "section", 1, + "LValue", 0, path, + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + } + +@@ -401,21 +401,21 @@ static void test_config_parse_exec(void) { + r = config_parse_exec(NULL, "fake", 4, "section", 1, + "LValue", 0, "/path\\", + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + + log_info("/* missing ending ' */"); + r = config_parse_exec(NULL, "fake", 4, "section", 1, + "LValue", 0, "/path 'foo", + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + + log_info("/* missing ending ' with trailing backslash */"); + r = config_parse_exec(NULL, "fake", 4, "section", 1, + "LValue", 0, "/path 'foo\\", + &c, u); +- assert_se(r == 0); ++ assert_se(r == -ENOEXEC); + assert_se(c1->command_next == NULL); + + log_info("/* invalid space between modifiers */"); +-- +2.11.0 + diff --git a/meta/recipes-core/systemd/systemd_230.bb b/meta/recipes-core/systemd/systemd_230.bb index 702e377264..40f1428340 100644 --- a/meta/recipes-core/systemd/systemd_230.bb +++ b/meta/recipes-core/systemd/systemd_230.bb @@ -36,6 +36,7 @@ SRC_URI += " \ file://0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch \ file://udev-re-enable-mount-propagation-for-udevd.patch \ file://CVE-2016-7795.patch \ + file://validate-user.patch \ " SRC_URI_append_libc-uclibc = "\ file://0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch \ From d3f57a0560a4653a98dc756010b8ca2c77cb030f Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 15 Feb 2017 14:47:53 -0800 Subject: [PATCH 128/129] [backport] runqemu: Allow the user to specity no kernel or rootFS Update the runqemu script from master to allow startin QEMU with a blank kernel. This patch has already been applied upstream: Commit id: 7f013f2a541b5c3bbf117a1c2ef189da1e753f2e runqemu: Allow the user to specity no kernel or rootFS In some cirsumstances the user doesn't want to supply a kernel, rootFS or DTB to QEMU. This will occur more now that QEMU supports loading images using a '-device loader' method. Allow users to specify 'none' for QB_DEFAULT_FSTYPE or QB_DEFAULT_KERNEL to avoid supplying these options to QEMU. (From OE-Core rev: 2cc01c4e46b05b7ffcc8a11e7ebde6c43256c3c3) Signed-off-by: Alistair Francis Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- scripts/runqemu | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/runqemu b/scripts/runqemu index 1df6875111..8de1d5291a 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -453,7 +453,7 @@ class BaseConfig(object): def check_rootfs(self): """Check and set rootfs""" - if self.fstype == 'nfs': + if self.fstype == 'nfs' or self.fstype == "none": return if self.rootfs and not os.path.exists(self.rootfs): @@ -478,9 +478,16 @@ class BaseConfig(object): if self.fstype in self.vmtypes: return + # QB_DEFAULT_KERNEL is always a full file path + kernel_name = os.path.basename(self.get('QB_DEFAULT_KERNEL')) + + # The user didn't want a kernel to be loaded + if kernel_name == "none": + return + deploy_dir_image = self.get('DEPLOY_DIR_IMAGE') if not self.kernel: - kernel_match_name = "%s/%s" % (deploy_dir_image, self.get('QB_DEFAULT_KERNEL')) + kernel_match_name = "%s/%s" % (deploy_dir_image, kernel_name) kernel_match_link = "%s/%s" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) kernel_startswith = "%s/%s*" % (deploy_dir_image, self.get('KERNEL_IMAGETYPE')) cmds = (kernel_match_name, kernel_match_link, kernel_startswith) @@ -873,6 +880,9 @@ class BaseConfig(object): k_root = '/dev/nfs nfsroot=%s:%s,%s' % (self.nfs_server, self.nfs_dir, self.unfs_opts) self.kernel_cmdline = 'root=%s rw highres=off' % k_root + if self.fstype == 'none': + self.rootfs_options = '' + self.set('ROOTFS_OPTIONS', self.rootfs_options) def guess_qb_system(self): From 8f6dfda5c3fe488e114033ba79230d944f3c2b90 Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 15 Feb 2017 14:47:52 -0800 Subject: [PATCH 129/129] runqemu: Add background launching support Add support to the runqemu script to launch a program in the background. This command can be specified by setting the QB_BACKGROUND_COMMAND variable. This launches the command in the background before starting QEMU. This is useful for starting servers or services that QEMU or the guest will connect to. This is useful for deploying certain images or debugging. Signed-off-by: Alistair Francis --- scripts/runqemu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/runqemu b/scripts/runqemu index 8de1d5291a..0b10616019 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -969,6 +969,13 @@ class BaseConfig(object): kernel_opts += " -dtb %s" % self.dtb else: kernel_opts = "" + background_cmd = self.get('QB_BACKGROUND_COMMAND') + + if background_cmd: + logger.info('Running in the background %s' % background_cmd) + if subprocess.call(background_cmd + ' &', shell=True) != 0: + raise Exception('Failed to run %s' % cmd) + cmd = "%s %s" % (self.qemu_opt, kernel_opts) logger.info('Running %s' % cmd) if subprocess.call(cmd, shell=True) != 0: