From d0cbfd0db5b1983acc07d7f7d0346c52d8337d968971065944ace780c9d0bfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 7 Jun 2024 18:39:50 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main libffi revision 051910918a7a9f2542713c8392281131 --- 830.patch | 89 +++++++++++++++++++++++++++++++++++++++++++++ libffi-3.4.4.tar.gz | 3 -- libffi-3.4.6.tar.gz | 3 ++ libffi.changes | 25 +++++++++++++ libffi.spec | 6 ++- 5 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 830.patch delete mode 100644 libffi-3.4.4.tar.gz create mode 100644 libffi-3.4.6.tar.gz diff --git a/830.patch b/830.patch new file mode 100644 index 0000000..62f1d22 --- /dev/null +++ b/830.patch @@ -0,0 +1,89 @@ +From 38d1c9d783b2c3b2b271e66a712962ffbbf7b9a5 Mon Sep 17 00:00:00 2001 +From: Bill Roberts +Date: Thu, 7 Mar 2024 13:07:29 -0600 +Subject: [PATCH 1/3] bti: add identifier to ffi_closure_SYSV_V_alt + +This was missing BTI_C identifier. + +Old Code: +ffi_closure_SYSV_V_alt: +0000fffff7f70500: ldr x17, [sp, #8] + +Signed-off-by: Bill Roberts +--- + src/aarch64/sysv.S | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S +index fdd0e8b7..ba49aa13 100644 +--- a/src/aarch64/sysv.S ++++ b/src/aarch64/sysv.S +@@ -527,6 +527,7 @@ L(do_closure): + #if defined(FFI_EXEC_STATIC_TRAMP) + .align 4 + CNAME(ffi_closure_SYSV_V_alt): ++ BTI_C + /* See the comments above trampoline_code_table. */ + ldr x17, [sp, #8] /* Load closure in x17 */ + add sp, sp, #16 /* Restore the stack */ +@@ -541,6 +542,7 @@ CNAME(ffi_closure_SYSV_V_alt): + + .align 4 + CNAME(ffi_closure_SYSV_alt): ++ BTI_C + /* See the comments above trampoline_code_table. */ + ldr x17, [sp, #8] /* Load closure in x17 */ + add sp, sp, #16 /* Restore the stack */ + +From da2376df7618356e9ab792a8a3cc17ba02a3108a Mon Sep 17 00:00:00 2001 +From: Bill Roberts +Date: Thu, 7 Mar 2024 13:07:34 -0600 +Subject: [PATCH 2/3] testsuite: fix whitespace in Makefile.am + +Signed-off-by: Bill Roberts +--- + testsuite/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am +index d286cf7f..6ba98e12 100644 +--- a/testsuite/Makefile.am ++++ b/testsuite/Makefile.am +@@ -8,7 +8,7 @@ CLEANFILES = *.exe core* *.log *.sum + + EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \ + emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \ +- emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ ++ emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ + lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ + libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \ + libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \ + +From 243fc9e2a1ebcf60a90652ac1e0bc82a945760a5 Mon Sep 17 00:00:00 2001 +From: Bill Roberts +Date: Thu, 7 Mar 2024 13:03:13 -0600 +Subject: [PATCH 3/3] aarch64: correct comment describing BTI + +The comment is incorrect, BTI is enabled per mapping via mprotect with +PROT_BTI flag set, not per-process. When the loader loads the library, +if the GNU Notes section is missing this, PROT_BTI will not be enabled +for that mapping, but is independent of other mappings. + +Signed-off-by: Bill Roberts +--- + src/aarch64/sysv.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S +index ba49aa13..60cfa505 100644 +--- a/src/aarch64/sysv.S ++++ b/src/aarch64/sysv.S +@@ -68,7 +68,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + #define BTI_J hint #36 + /* + * The ELF Notes section needs to indicate if BTI is supported, as the first ELF loaded that doesn't +- * declare this support disables it for the whole process. ++ * declare this support disables it for memory region containing the loaded library. + */ + # define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ + .text diff --git a/libffi-3.4.4.tar.gz b/libffi-3.4.4.tar.gz deleted file mode 100644 index ee001f2..0000000 --- a/libffi-3.4.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d66c56ad259a82cf2a9dfc408b32bf5da52371500b84745f7fb8b645712df676 -size 1362394 diff --git a/libffi-3.4.6.tar.gz b/libffi-3.4.6.tar.gz new file mode 100644 index 0000000..86221d1 --- /dev/null +++ b/libffi-3.4.6.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e +size 1391684 diff --git a/libffi.changes b/libffi.changes index 7581dd3..95d6021 100644 --- a/libffi.changes +++ b/libffi.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Tue Mar 19 15:22:24 UTC 2024 - Guillaume GARDET + +- Add patches to fix BTI on aarch64: + * 830.patch +- Update to 3.4.6: + * Fix long double regression on mips64 and alpha. +- Update to 3.4.5: + * Add support for wasm32. + * Add support for aarch64 branch target identification (bti). + * Add support for ARCv3: ARC32 & ARC64. + * Add support for HPPA64, and many HPPA fixes. + * Add support for Haikuos on PowerPC. + * Fixes for AIX, loongson, MIPS, power, sparc64, and x86 Darwin. +- Drop upstreamed patches: + * 808.patch + * 810.patch + +------------------------------------------------------------------- +Wed Dec 6 09:11:47 UTC 2023 - Guillaume GARDET + +- Add upstream patches to fix BTI on aarch64: + * 808.patch + * 810.patch + ------------------------------------------------------------------- Mon Oct 24 13:07:19 UTC 2022 - Andreas Schwab diff --git a/libffi.spec b/libffi.spec index 9c68deb..ee284ff 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,7 +1,7 @@ # # spec file for package libffi # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define libffi_sover 8 Name: libffi -Version: 3.4.4 +Version: 3.4.6 Release: 0 Summary: Foreign Function Interface Library License: MIT @@ -26,6 +26,8 @@ Group: Development/Languages/C and C++ URL: https://sourceware.org/libffi/ Source: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-%{version}.tar.gz Source99: baselibs.conf +# Fix BTI for aarch64 with PR 830 +Patch1: https://github.com/libffi/libffi/pull/830.patch # for make check BuildRequires: dejagnu BuildRequires: expect