From patchwork Wed Dec 2 22:10:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Marko, Peter" X-Patchwork-Id: 107041 X-Patchwork-Delegate: yoann.congal@smile.fr Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.180.1796249440148272391 for ; Wed, 02 Dec 2026 14:10:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=gqiCC1dQ; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.225, mailfrom: fm-256628-202612022210376d4a27558600020707-jejmj6@rts-flowmailer.siemens.com) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 202612022210376d4a27558600020707 for ; Wed, 02 Dec 2026 23:10:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=peter.marko@siemens.com; h=from:from:sender:to:to:cc:cc:subject:subject:content-type:content-type:content-transfer-encoding:content-transfer-encoding:Date:Message-ID:MIME-Version; bh=coLKFpiT9kunSi+qW1qQ6nlYtFCW7vKQshhkgFMTbBU=; b=gqiCC1dQl1q5vADFTLm63c8xi49ZFT0bqv51n6ZwW2AsrU6z18LgsZd7QS3n54KAYftvva ZN9aRpctVp2hpqgYTFPP2FQz1hdVCih0HO+mHPI1jO4RfGO5ohEi9E8+Ufb088GxZhMscVlh gHJosnl4Whq9f3EAw7uDD4yfxX4a0/BUJDLLC3fITvTcOEwtDae8luXhhHNhIok49GWGDz9h +8SXgNoX+8udfgR3KGpeg8Mc8HYs90YKIq8VNsodKwtMi+5MsGa5NRvFEE2GNp5xASfbf2kU zB5WlSB6G5ePyFJtWF2gGwbrrFv5LantQzi78y5VWjxj+wlcT2fhV7cg==; From: Peter Marko To: openembedded-core@lists.openembedded.org Cc: Peter Marko Subject: [blacksail][PATCH] m4: patch CVE-2026-107189 Date: Wed, 2 Dec 2026 23:10:21 +0100 Message-ID: <20261202221022.641132-1-peter.marko@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-256628:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Wed, 02 Dec 2026 22:10:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251861 From: Peter Marko Pick patch mentioned in CVE description. There are two adaptations to the original patch. 1. add hunk with include statement, it is part of large refactoring and not worth to backport just to add a trivial line 2. add single line change of converting xcharalloc to ximalloc from commit [1]. This makes the final hunk have identical output as the original CVE patch. It is not worth to try to backport large refactoring which anyway also does not cleanly apply to release. [1] https://github.com/autotools-mirror/m4/commit/92641ac2ce8694e75f202f1bd2e3d8c99ee0df55 AI-Generated: Uses GitHub Copilot Signed-off-by: Peter Marko Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie (From OE-Core rev: c69183e0ddc04335ef0bfe2823aac61f8f4ec6e3) Signed-off-by: Peter Marko --- meta/recipes-devtools/m4/m4-1.4.21.inc | 1 + .../m4/m4/CVE-2026-107189.patch | 82 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 meta/recipes-devtools/m4/m4/CVE-2026-107189.patch diff --git a/meta/recipes-devtools/m4/m4-1.4.21.inc b/meta/recipes-devtools/m4/m4-1.4.21.inc index 41f8021d025..bae193e9e01 100644 --- a/meta/recipes-devtools/m4/m4-1.4.21.inc +++ b/meta/recipes-devtools/m4/m4-1.4.21.inc @@ -7,6 +7,7 @@ GNU M4 also has built-in functions for including files, running shell commands, inherit autotools texinfo ptest gettext SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \ + file://CVE-2026-107189.patch \ " SRC_URI:append:class-target = " file://run-ptest \ file://0001-test-c32ispunct-Check-for-musl-along-with-glibc.patch \ diff --git a/meta/recipes-devtools/m4/m4/CVE-2026-107189.patch b/meta/recipes-devtools/m4/m4/CVE-2026-107189.patch new file mode 100644 index 00000000000..0964748bacf --- /dev/null +++ b/meta/recipes-devtools/m4/m4/CVE-2026-107189.patch @@ -0,0 +1,82 @@ +From 69aef802fb25ab600d37210f44e5128633cbc432 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Tue, 7 Jul 2026 12:25:34 -0700 +Subject: [PATCH] m4: fix undefined behavior for frozen INT_MAX +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Problem reported by Michał Majchrowicz. +* src/freeze.c (reload_frozen_state): +Use idx_t, not int, to record allocation sizes. +(GET_STRING): Avoid undefined behavior if a frozen-state file +has a string of length INT_MAX. + +CVE: CVE-2026-107189 +Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/m4.git/commit/?id=69aef802fb25ab600d37210f44e5128633cbc432] + +There are two adaptations to the original patch. +1. add hunk with include statement, it is part of large refactoring + and not worth to backport just to add a trivial line +2. add single line change of converting xcharalloc to ximalloc from + commit [1]. This makes the final hunk have identical output as + the original CVE patch. It is not worth to try to backport large + refactoring which anyway also does not cleanly apply to release. +[1] https://github.com/autotools-mirror/m4/commit/92641ac2ce8694e75f202f1bd2e3d8c99ee0df55 + +Signed-off-by: Peter Marko +--- + THANKS | 1 + + src/freeze.c | 11 +++++++---- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/THANKS b/THANKS +index 3802f8b9..75f160b4 100644 +--- a/THANKS ++++ b/THANKS +@@ -90,6 +90,7 @@ Matthias Rabe rabe@mathematik.uni-bielefeld.de + Michael Fetterman mafetter@ichips.intel.com + Michael L. Welcome welcome@bigbird.llnl.gov + Michael Witten mfwitten@gmail.com ++Michał Majchrowicz mmajchrowicz@afine.com + Mike Dupont jamesmikedupont@googlemail.com + Mike Frysinger vapier@gentoo.org + Mike Lijewski lijewski@theory.tc.cornell.edu +diff --git a/src/freeze.c b/src/freeze.c +index 34f0e057..1bae4c00 100644 +--- a/src/freeze.c ++++ b/src/freeze.c +@@ -23,6 +23,8 @@ + + #include "m4.h" + ++#include ++ + /*-------------------------------------------------------------------. + | Destructively reverse a symbol list and return the reversed list. | + `-------------------------------------------------------------------*/ +@@ -183,7 +185,7 @@ reload_frozen_state (const char *name) + int character; + int operation; + char *string[2]; +- int allocated[2]; ++ idx_t allocated[2]; + int number[2]; + const builtin *bp; + bool advance_line = true; +@@ -247,11 +249,12 @@ reload_frozen_state (const char *name) + { \ + void *tmp; \ + char *p; \ +- if (number[(i)] + 1 > allocated[(i)]) \ ++ if (allocated[(i)] <= number[(i)]) \ + { \ + free (string[(i)]); \ +- allocated[(i)] = number[(i)] + 1; \ +- string[(i)] = xcharalloc ((size_t) allocated[(i)]); \ ++ if (ckd_add (&allocated[(i)], number[(i)], 1)) \ ++ xalloc_die (); \ ++ string[(i)] = ximalloc (allocated[(i)]); \ + } \ + if (number[(i)] > 0 \ + && !fread (string[(i)], (size_t) number[(i)], 1, file)) \