From patchwork Wed Dec 2 22:10:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Marko, Peter" X-Patchwork-Id: 107042 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.181.1796249442898689105 for ; Wed, 02 Dec 2026 14:10:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=peter.marko@siemens.com header.s=fm1 header.b=M1TDq/j1; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.225, mailfrom: fm-256628-202612022210408121243b5600020725-n_abgj@rts-flowmailer.siemens.com) Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 202612022210408121243b5600020725 for ; Wed, 02 Dec 2026 23:10:40 +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=nEXVSLf2HNNlM+VhoQtd676O7pjqZBLDr5Gj5IF5A34=; b=M1TDq/j1PT4AW2Eor8M0ulQJZva2dg+DQBH4SyflnBHCod5/tbZRuKgJV1oQVob+1e/wF1 XD02fQ+fWRda/4iRJpNRPEHBawTShQxc6ZGqlJziv0btu6acDGNWdcwf64Yavm08eZPc9miH JTf18H2Q3CfjHYvsdjdFiahboi1HOx+Ym0pfBgQYZpDTaiYGIBVhZh+tI2xRtuCp6Hb1C/V0 41lZuYLeaBLhwhRN2EIwgM1CYzNeyKZ5NYvSMKH5VOaHQBUKs6OZ5Gnp0TmFs/3KVn4QWSUq kulf7F9LPXU+AcCAjNpTWFkK0ywk7eLwPynFC9mhJtXtsS0JHKLWEoBQ==; From: Peter Marko To: openembedded-core@lists.openembedded.org Cc: Peter Marko Subject: [wrynose][PATCH] m4: patch CVE-2026-107189 Date: Wed, 2 Dec 2026 23:10:02 +0100 Message-ID: <20261202221003.641018-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/251862 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 1af9b9a7830..020cecb7896 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)) \