From: "Devansh Patel -X (devanshp - E INFOCHIPS PRIVATE LIMITED at Cisco)" <devanshp@cisco.com>
To: openembedded-devel@lists.openembedded.org
Subject: [meta-oe][scarthgap][PATCH] jq: backport CVE-2026-40164 entropy follow-up
Date: Tue, 24 Nov 2026 01:40:29 -0800 [thread overview]
Message-ID: <20261124094029.1551086-1-devanshp@cisco.com> (raw)
From: Devansh Patel <devanshp@cisco.com>
Backport the upstream follow-up to the CVE-2026-40164 hash seed fix.
Prefer getentropy() and try /dev/urandom if getentropy() fails.
https://github.com/jqlang/jq/commit/32580f5d83f4321588a1ebf8e3893f7fbecefe4e
Signed-off-by: Devansh Patel <devanshp@cisco.com>
---
.../jq/jq/CVE-2026-40164-follow-up.patch | 61 +++++++++++++++++++
meta-oe/recipes-devtools/jq/jq_1.7.1.bb | 1 +
2 files changed, 62 insertions(+)
create mode 100644 meta-oe/recipes-devtools/jq/jq/CVE-2026-40164-follow-up.patch
diff --git a/meta-oe/recipes-devtools/jq/jq/CVE-2026-40164-follow-up.patch b/meta-oe/recipes-devtools/jq/jq/CVE-2026-40164-follow-up.patch
new file mode 100644
index 0000000000000000000000000000000000000000..85f180ab9c647fa8414cd4fa950efc37c5173667
--- /dev/null
+++ b/meta-oe/recipes-devtools/jq/jq/CVE-2026-40164-follow-up.patch
@@ -0,0 +1,61 @@
+From c5e838c81ef5e47ab3a544c195fb0f856f48257e Mon Sep 17 00:00:00 2001
+From: Brandon <breakouttradersc@gmail.com>
+Date: Fri, 25 Sep 2026 03:39:06 -0400
+Subject: [PATCH] Prefer getentropy() over arc4random() to seed the string hash
+ (#3629)
+
+glibc's arc4random() aborts with "Fatal glibc error: cannot get entropy
+for arc4random" when the kernel lacks getrandom(2), so jq died on
+startup on older kernels once 0c7d133 began seeding the hash on every
+run. getentropy() merely returns -1/ENOSYS there, so prefer it, and
+route its failure through the existing `/dev/urandom` path - which works
+on precisely those kernels -- instead of a guessable `getpid() ^ time()`.
+
+CVE: CVE-2026-40164
+Upstream-Status: Backport [https://github.com/jqlang/jq/commit/32580f5d83f4321588a1ebf8e3893f7fbecefe4e]
+
+Signed-off-by: Devansh Patel <devanshp@cisco.com>
+---
+ src/jv.c | 19 ++++++++++++-------
+ 1 file changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/src/jv.c b/src/jv.c
+index 6f79693a1a2b8e398838053cb9f39981f98e7029..f524a29c47abadde9f7c569345cd3e1fdf31ebf1 100644
+--- a/src/jv.c
++++ b/src/jv.c
+@@ -1207,12 +1207,18 @@ static pthread_once_t hash_seed_once = PTHREAD_ONCE_INIT;
+
+ static void jvp_hash_seed_init(void) {
+ uint32_t seed;
+-#if defined(HAVE_ARC4RANDOM)
+- seed = arc4random();
+-#elif defined(HAVE_GETENTROPY)
+- if (getentropy(&seed, sizeof(seed)) != 0)
+- seed = (uint32_t)getpid() ^ (uint32_t)time(NULL);
+-#else
++ /* Prefer getentropy() over arc4random(): glibc's arc4random() aborts the
++ * process when the kernel lacks getrandom(2) (#3584), while getentropy()
++ * merely fails, letting us fall back to /dev/urandom. */
++#if defined(HAVE_GETENTROPY)
++ if (getentropy(&seed, sizeof(seed)) == 0) {
++ hash_seed = seed;
++ return;
++ }
++#elif defined(HAVE_ARC4RANDOM)
++ hash_seed = arc4random();
++ return;
++#endif
+ int fd = open("/dev/urandom", O_RDONLY);
+ if (fd >= 0) {
+ if (read(fd, &seed, sizeof(seed)) != 4)
+@@ -1221,7 +1227,6 @@ static void jvp_hash_seed_init(void) {
+ } else {
+ seed = (uint32_t)getpid() ^ (uint32_t)time(NULL);
+ }
+-#endif
+ hash_seed = seed;
+ }
+
+--
+2.35.6
+
diff --git a/meta-oe/recipes-devtools/jq/jq_1.7.1.bb b/meta-oe/recipes-devtools/jq/jq_1.7.1.bb
index 7cd3b3d483e8591c50e9786f7827f773f6281d1e..bd8aa5ba1aad9f304dcbb4562601d3a01b76bb3b 100644
--- a/meta-oe/recipes-devtools/jq/jq_1.7.1.bb
+++ b/meta-oe/recipes-devtools/jq/jq_1.7.1.bb
@@ -16,6 +16,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
file://CVE-2025-48060.patch \
file://CVE-2025-9403.patch \
file://CVE-2026-40164.patch \
+ file://CVE-2026-40164-follow-up.patch \
file://CVE-2026-32316.patch \
file://CVE-2026-33947.patch \
file://CVE-2026-33948.patch \
--
2.35.6
reply other threads:[~2026-11-24 9:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124094029.1551086-1-devanshp@cisco.com \
--to=devanshp@cisco.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.