diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/kmod/files/kmod-34.2-s390.patch b/sdk_container/src/third_party/portage-stable/sys-apps/kmod/files/kmod-34.2-s390.patch new file mode 100644 index 0000000000..be66340290 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/sys-apps/kmod/files/kmod-34.2-s390.patch @@ -0,0 +1,53 @@ +From 4e18b842b3dae5486adb2c6cc11bdfdd53ee8646 Mon Sep 17 00:00:00 2001 +From: Tobias Stoeckmann +Date: Wed, 14 Jan 2026 20:58:50 +0100 +Subject: [PATCH] util: Add s390 31 bit mode support + +Even though size_t is of the same size as a uint32_t, the s390 +architecture is a bit picky about its 31 bit mode with size_t. + +Use custom code to fix this issue in a rather architecture +independent but unfortunately slower way for s390 31 bit mode. + +Reference: https://github.com/kmod-project/kmod/issues/402 +Signed-off-by: Tobias Stoeckmann +--- + shared/util.h | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/shared/util.h b/shared/util.h +index bf3f1009..b785f5b1 100644 +--- a/shared/util.h ++++ b/shared/util.h +@@ -123,7 +123,15 @@ static inline bool uaddsz_overflow(size_t a, size_t b, size_t *res) + #if __SIZEOF_SIZE_T__ == 8 + return uadd64_overflow(a, b, res); + #elif __SIZEOF_SIZE_T__ == 4 ++#ifdef __s390__ ++ if (b < SIZE_MAX - a) { ++ *res = a + b; ++ return true; ++ } ++ return false; ++#else + return uadd32_overflow(a, b, res); ++#endif + #else + #error "Unknown sizeof(size_t)" + #endif +@@ -167,7 +175,15 @@ static inline bool umulsz_overflow(size_t a, size_t b, size_t *res) + #if __SIZEOF_SIZE_T__ == 8 + return umul64_overflow(a, b, res); + #elif __SIZEOF_SIZE_T__ == 4 ++#ifdef __s390__ ++ if (a == 0 || b <= SIZE_MAX / a) { ++ *res = a * b; ++ return true; ++ } ++ return false; ++#else + return umul32_overflow(a, b, res); ++#endif + #else + #error "Unknown sizeof(size_t)" + #endif diff --git a/sdk_container/src/third_party/portage-stable/sys-apps/kmod/kmod-34.2.ebuild b/sdk_container/src/third_party/portage-stable/sys-apps/kmod/kmod-34.2.ebuild index 619e783507..c8e68cf221 100644 --- a/sdk_container/src/third_party/portage-stable/sys-apps/kmod/kmod-34.2.ebuild +++ b/sdk_container/src/third_party/portage-stable/sys-apps/kmod/kmod-34.2.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -40,6 +40,10 @@ BDEPEND=" zlib? ( virtual/pkgconfig ) " +PATCHES=( + "${FILESDIR}/${P}-s390.patch" +) + pkg_setup() { : }