From: Mark Kettenis Subject: Re: devel/ruby-ffi failure on arm64 BTI To: Theo Buehler Cc: kn@openbsd.org, ports@openbsd.org, jeremy@openbsd.org, kettenis@openbsd.org Date: Thu, 26 Mar 2026 22:10:07 +0100 > Date: Tue, 24 Mar 2026 11:01:16 +0100 > From: Theo Buehler > > kettenis, if you have some time, could you perhaps take a look? > This regressed since you fixed it in june 2024: > https://marc.info/?l=openbsd-ports&m=171905655818079&w=2 This fixes the libffi issue. And of course I found a similar diff on the machine from where I send my mail from 2024. Seems I never sent that one out. I do get a SIGSEGV in libyaml-0.so.0.0 in some other test though. But I don't think that's a BTI issue. Index: devel/libffi/Makefile =================================================================== RCS file: /cvs/ports/devel/libffi/Makefile,v diff -u -p -r1.57 Makefile --- devel/libffi/Makefile 3 Aug 2025 09:00:10 -0000 1.57 +++ devel/libffi/Makefile 26 Mar 2026 21:04:12 -0000 @@ -2,6 +2,7 @@ COMMENT= Foreign Function Interface V= 3.5.2 DISTNAME= libffi-$V +REVISION= 0 SHARED_LIBS += ffi 2.4 # 10.0 Index: devel/libffi/patches/patch-src_aarch64_ffi_c =================================================================== RCS file: devel/libffi/patches/patch-src_aarch64_ffi_c diff -N devel/libffi/patches/patch-src_aarch64_ffi_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ devel/libffi/patches/patch-src_aarch64_ffi_c 26 Mar 2026 21:04:12 -0000 @@ -0,0 +1,15 @@ +Index: src/aarch64/ffi.c +--- src/aarch64/ffi.c.orig ++++ src/aarch64/ffi.c +@@ -889,8 +889,9 @@ ffi_prep_closure_loc (ffi_closure *closure, + # endif + #else + static const unsigned char trampoline[16] = { +- 0x90, 0x00, 0x00, 0x58, /* ldr x16, tramp+16 */ +- 0xf1, 0xff, 0xff, 0x10, /* adr x17, tramp+0 */ ++ 0x5f, 0x24, 0x03, 0xd5, /* bti c */ ++ 0x70, 0x00, 0x00, 0x58, /* ldr x16, tramp+16 */ ++ 0xd1, 0xff, 0xff, 0x10, /* adr x17, tramp+0 */ + 0x00, 0x02, 0x1f, 0xd6 /* br x16 */ + }; + char *tramp = closure->tramp;