From 507222c4595e6a9367cbef8e563cd4ad6481e78f Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 14 Apr 2026 11:54:44 +0100 Subject: [PATCH] dev-lang/mono: fix build on arm64; backport UB fix Closes: https://bugs.gentoo.org/960113 Signed-off-by: Sam James --- .../mono/files/mono-6.14.1-c99-arm64.patch | 31 +++++++++++++++++++ .../files/mono-6.14.1-strcpy-overlap.patch | 28 +++++++++++++++++ ...no-6.14.1.ebuild => mono-6.14.1-r1.ebuild} | 2 ++ 3 files changed, 61 insertions(+) create mode 100644 dev-lang/mono/files/mono-6.14.1-c99-arm64.patch create mode 100644 dev-lang/mono/files/mono-6.14.1-strcpy-overlap.patch rename dev-lang/mono/{mono-6.14.1.ebuild => mono-6.14.1-r1.ebuild} (97%) diff --git a/dev-lang/mono/files/mono-6.14.1-c99-arm64.patch b/dev-lang/mono/files/mono-6.14.1-c99-arm64.patch new file mode 100644 index 0000000000000..ecd1f18ec7386 --- /dev/null +++ b/dev-lang/mono/files/mono-6.14.1-c99-arm64.patch @@ -0,0 +1,31 @@ +https://bugs.gentoo.org/960113 +https://gitlab.winehq.org/mono/mono/-/commit/2224c6915a98f870cc9a3a9f9e3698e7b20e3d27 + +From 2224c6915a98f870cc9a3a9f9e3698e7b20e3d27 Mon Sep 17 00:00:00 2001 +From: Esme Povirk +Date: Sat, 12 Apr 2025 20:31:54 +0000 +Subject: [PATCH] arm64: Fix a pointer-to-int cast size mismatch. + +--- + mono/utils/mono-sigcontext.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/mono/utils/mono-sigcontext.h b/mono/utils/mono-sigcontext.h +index 2153c1cad57..6426f44b7c7 100644 +--- a/mono/utils/mono-sigcontext.h ++++ b/mono/utils/mono-sigcontext.h +@@ -492,6 +492,12 @@ typedef struct ucontext { + #define UCONTEXT_REG_SP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.sp) + #define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->uc_mcontext.regs [ARMREG_R0]) + #define UCONTEXT_GREGS(ctx) (&(((ucontext_t*)(ctx))->uc_mcontext.regs)) ++ #define UCONTEXT_REG_SET_PC(ctx, val) do { \ ++ UCONTEXT_REG_PC (ctx) = (gsize)(val); \ ++ } while (0) ++ #define UCONTEXT_REG_SET_SP(ctx, val) do { \ ++ UCONTEXT_REG_SP (ctx) = (val); \ ++ } while (0) + #endif + + #ifndef UCONTEXT_REG_SET_PC +-- +GitLab diff --git a/dev-lang/mono/files/mono-6.14.1-strcpy-overlap.patch b/dev-lang/mono/files/mono-6.14.1-strcpy-overlap.patch new file mode 100644 index 0000000000000..eb155d6422e68 --- /dev/null +++ b/dev-lang/mono/files/mono-6.14.1-strcpy-overlap.patch @@ -0,0 +1,28 @@ +https://gitlab.winehq.org/mono/mono/-/commit/dee6acaeb59e46661efd4ca2018cdd1c275d2a09 + +From dee6acaeb59e46661efd4ca2018cdd1c275d2a09 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= +Date: Wed, 3 Sep 2025 22:28:13 +0200 +Subject: [PATCH] Avoid strcpy on overlapping strings in mono_path_canonicalize + (ASan). + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57691 +--- + mono/utils/mono-path.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mono/utils/mono-path.c b/mono/utils/mono-path.c +index 2f4790666a4..a9924732902 100644 +--- a/mono/utils/mono-path.c ++++ b/mono/utils/mono-path.c +@@ -87,7 +87,7 @@ mono_path_canonicalize (const char *path) + lastpos = lastpos-1; + #endif + +- if (dest != lastpos) strcpy (dest, lastpos); ++ if (dest != lastpos) memmove (dest, lastpos, strlen(lastpos) + 1); + + g_strreverse (abspath); + +-- +GitLab diff --git a/dev-lang/mono/mono-6.14.1.ebuild b/dev-lang/mono/mono-6.14.1-r1.ebuild similarity index 97% rename from dev-lang/mono/mono-6.14.1.ebuild rename to dev-lang/mono/mono-6.14.1-r1.ebuild index e73580a1cb4d8..79794b6aff7fc 100644 --- a/dev-lang/mono/mono-6.14.1.ebuild +++ b/dev-lang/mono/mono-6.14.1-r1.ebuild @@ -39,6 +39,8 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/${PN}-6.14.1-disable-automagic-ccache.patch "${FILESDIR}"/${PN}-6.12.0.199-configure-c99.patch + "${FILESDIR}"/${PN}-6.14.1-c99-arm64.patch + "${FILESDIR}"/${PN}-6.14.1-strcpy-overlap.patch ) pkg_pretend() {