Skip to content

Releases

libffi 3.8.3

Choose a tag to compare

@github-actions github-actions released this 04 Dec 13:14
0051b11

Closures: harden the static trampoline and dual-mapped
allocators against file substitution, descriptor reuse, fork,
exec and unbounded growth. ffi_closure_alloc now fails under
descriptor or memory shortage rather than fall back to writable
and executable memory (GHSA-26w4-x7cp-hqrf, GHSA-c53h-r358-jq5p,
GHSA-crmr-jj5p-g9m9, GHSA-jcw7-j6f7-7f6c, GHSA-jrcv-gw2r-69p2,
GHSA-p4qf-9qp5-wr7m, GHSA-vxrh-9x7w-f873, GHSA-x484-2v5q-wpf4).
ffi_prep_cif, ffi_get_struct_offsets and the raw API: return
FFI_BAD_TYPEDEF for structs nested more than 256 deep and for
degenerate nested aggregates; fix union layout and raw argument
sizes (GHSA-rg7h-586f-j3jq, GHSA-r9g2-p4xg-w9rm,
GHSA-jv63-53jg-w9c4, GHSA-93cv-5wh7-x97j, GHSA-8m94-mxq7-rgvq).
ffi_call: stop leaking stale stack bytes into struct results
through unused argument registers (GHSA-vw6q-85pv-vhgp).
x86: fix __int128 closure arguments on x86-64, raw calls and raw
closures on i386, fastcall under MSVC, and small struct returns
on Darwin and the BSDs (GHSA-x75f-6hch-vwvj,
GHSA-658h-m3hx-82cw, GHSA-6j85-qw7c-jx5m, GHSA-vvfm-pfc8-2v7c,
GHSA-q9m4-8x8q-7j2h, GHSA-3wq2-9wh7-q55f).
AArch64 and ARM: fix variadic calls on arm64_32 and Windows, Go
closures with pointer authentication, VFP arguments that
overflow to the stack, and struct returns on 32-bit iOS and
watchOS (GHSA-h52h-3759-xqm4, GHSA-jcm7-p6wr-hfvc,
GHSA-r95v-2vw6-fhgg, GHSA-vp66-qmjw-4c67, GHSA-4wcj-4jp8-2hcj,
GHSA-j5wr-9gx4-wfvp, GHSA-jjr5-g9h2-6rg9, GHSA-h8mr-643h-pxv2).
PowerPC: fix struct alignment, homogeneous aggregates and long
double handling on Linux; map ELFv1 closures non-executable
(GHSA-2px9-vcxp-8vvf, GHSA-722c-22fv-c8c2, GHSA-77cv-g7wq-956w,
GHSA-m77m-mfq6-4q44, GHSA-qmw4-fc8v-qhp2).
PowerPC Darwin and AIX: fix struct layout and sizing, long
double and nested float struct arguments (GHSA-3c69-f74q-6j4w,
GHSA-mc4m-mrcj-873f, GHSA-65pg-wjv4-hcg8, GHSA-fmx6-3569-fxwp,
GHSA-phv8-5583-cpm7, GHSA-3768-f4h6-mc9f, GHSA-5q3x-q3j3-crqq,
GHSA-j448-7jm3-3646, GHSA-h6m9-v87c-hv9x).
MIPS and SPARC64: fix long double, integer complex and aligned
struct arguments, and closure struct padding
(GHSA-4rw4-cjgp-f67q, GHSA-7h77-7p98-xvjp, GHSA-fc52-fqjv-qgxf,
GHSA-p3p7-wm2f-8x9h, GHSA-xxmg-fqfm-rc76, GHSA-rp9f-q7gw-h768).
RISC-V and LoongArch: fix emulated unions, discarded results,
float+int struct results and struct argument copies
(GHSA-32vc-xp8w-c7g4, GHSA-7j9f-98wq-3q69, GHSA-2x2m-r343-wq32,
GHSA-mj95-3cxf-vh6w, GHSA-rxq3-66x8-h25f).
WebAssembly: fix variadic argument layout and padded unions
(GHSA-496g-xr45-r65g, GHSA-529m-c54w-f2mx).
m68k: fix small struct and floating-point returns from calls and
closures (GHSA-3364-pfq9-hr35, GHSA-73rr-g5cx-9vv5,
GHSA-7pm3-9p5h-6jx2, GHSA-mfj5-g22f-8hr6, GHSA-rp3f-3774-6cw8).
Other ports (ARC, AVR32, CRIS, C-SKY, FR-V, IA-64, KVX, Meta,
MicroBlaze, OpenRISC, PA-RISC, SH, SH-5, Xtensa): fix
out-of-bounds reads and writes in argument and result
marshalling (GHSA-4h3f-ccxx-93fj, GHSA-rh9g-99qh-jqh7,
GHSA-p5g4-rcpp-fmxr, GHSA-6mqv-f389-qqfp, GHSA-vhp7-44f9-gp2g,
GHSA-p5vv-6gc6-g2qm, GHSA-4974-p6mw-j6c4, GHSA-836r-pf7m-9h2g,
GHSA-8vw3-2vmw-q49v, GHSA-c9q4-86gv-65mm, GHSA-vrg6-8crj-fj5h,
GHSA-qmvf-hpvp-9c7m, GHSA-35xq-j76p-6xxr, GHSA-fqmg-5fgh-qxh8,
GHSA-gr8m-rp95-5qgx, GHSA-gh7f-rmhg-8xfp, GHSA-jff3-c46r-53v3).
Static trampolines: find libffi's file through the dynamic
loader when the /proc/self/maps path is unusable (#1084).
hppa: fix closures in static executables that export symbols.
i386: give closures aligned copies of under-aligned arguments
(#1088).
LoongArch: fix over-aligned aggregate arguments (#1089).
x86-64: return a struct of one binary128 long double in %xmm0
(#1076).
x86: fix raw closures built with MSVC (#1074).
aarch64: fix ffi_call in MSVC /RTC1 debug builds (#1059).
MIPS N32/N64: fix struct and complex returns and arguments
(#1071).
powerpc64 ELFv1: pass a struct of one IBM long double like the
scalar.

libffi 3.8.2

Choose a tag to compare

@github-actions github-actions released this 25 Nov 20:24
ddd2fe1

x86-64: reject vector types under the Win64 ABIs on non-Windows
builds, as documented (GHSA-v9rw-6cxm-q6rf).
CRIS: reject vector types (GHSA-j9pv-w354-7fg2).
aarch64: reserve enough stack for large by-value structs mixed
with 16-byte-aligned arguments (GHSA-wc36-xxj4-cxh5).
Pass by-value aggregates aligned beyond the stack alignment
correctly on x86-64, i386, ARM, MIPS, m88k and AArch64
(GHSA-rwpw-56v4-44r3).
powerpc64 ELFv2: fix closures overwriting the caller's frame
with float structs and _Complex arguments
(GHSA-p8c7-j6j7-h7vg), and stop padding IBM long double
aggregates (GHSA-34hv-975q-7p7w).
RISC-V, LoongArch: fix one-float structs passed after the FP
argument registers run out (GHSA-2xrh-7r9c-rwmf).
Static trampolines: make the temporary code-table file
immutable, so a forked child cannot rewrite its parent's
closures (GHSA-7qx4-vhpx-x6qm).
i386: fix ffi_raw_call argument placement and refuse raw
closures with in-memory results (GHSA-qgq7-fxgw-wrp4,
GHSA-64xf-g9qc-vf93).
MIPS: fix O32 closures returning _Complex long long
(GHSA-xh8m-x7vg-ww5m) and N32/N64 complex arguments at the
end of the argument registers (GHSA-p8w7-v539-c775).
Refuse oversized signatures instead of truncating them
(GHSA-qpm4-52vm-3xff, GHSA-j4q2-5r23-67rj,
GHSA-76jh-g582-v8x4).
SPARC: fix ffi_call with a NULL rvalue for large struct results
(GHSA-v569-599f-q4hr).
AIX: make struct layout independent of prior ffi_prep_cif calls
(GHSA-f45x-cg8q-3q9w).
LoongArch: do not write to the result buffer of a void call
(#1083).

libffi 3.8.1

Choose a tag to compare

@github-actions github-actions released this 14 Nov 13:22
de7afe7

libffi 3.8.1 is a bug-fix and security release. It is ABI-compatible with
3.8.0 — the soname stays libffi.so.8 and no source changes are needed to
upgrade.

Security fixes

Each issue is local and high-complexity, and is limited to the target noted
in bold. See the linked advisory for full details and CVSS.

  • AArch64 — ffi_call placed the pointer to a by-value composite larger
    than 16 bytes at the wrong stack offset, and homogeneous-aggregate
    (HFA/HVA) detection did not match AAPCS64, so a callee or closure could use
    the wrong pointer. (GHSA-h52h-3759-xqm4, GHSA-vg77-j273-647r)
  • macOS on Apple Silicon (Darwin arm64) — heap use-after-free in the
    trampoline-table closure allocator once a process used more than one
    trampoline table (over 1024 live closures). (GHSA-23hx-9rxv-9qfp)
  • Linux and Cygwin (static trampolines) — the /proc/self/maps path was
    truncated at the first space and the reopened file was never verified, so a
    file at a truncated or replaced path could be mapped as trampoline code.
    (GHSA-fq46-69xf-x5gf)
  • s390x — closures mishandled 128-bit integer arguments, passing an
    uninitialized pointer to the callback; they are now passed by reference like
    complex types. (GHSA-wf8m-qr3x-cch4)
  • x86-64 (System V) — vector types whose calling convention is undefined
    (sub-8-byte vectors and <1 x double>, where GCC and Clang disagree) were
    misclassified; libffi now rejects them with FFI_BAD_TYPEDEF.
    (GHSA-5pc3-hr6f-q3mm)
  • Raw API with static trampolines (notably i386) — raw-API closures passed
    the wrong pointer as the handler's data (and the i386 native path corrupted
    the closure), causing a wild indirect call. (GHSA-w6j9-w53f-2857)

Bug fixes and ABI conformance

  • Broader ABI-conformance work and test coverage for complex-number calls,
    closures, and small aggregates across ARM, x86, PowerPC, MIPS, RISC-V,
    LoongArch, and SPARC.
  • AArch64 / ARM big-endian — fixed closures receiving garbage sub-word
    integer and float arguments, and sub-word and float return values
    (#1012, closes #1011, #675).
  • x86-64 — return a single-long double struct in %st0 like a bare
    long double (#1058); copy the upper half of 16-byte vector arguments in
    reusable call plans.
  • powerpc64 — fixed _Complex long double when the ABI's long double is
    64 bits (e.g. -mlong-double-64 or musl).
  • RISC-V — ignore the caller's return buffer for void calls.
  • MIPS — emit CFI in the N32/N64 assembly so unwinding works through
    libffi frames (#1063).
  • wasm — correct heap accesses at or above 2 GiB (#1062), make closures
    work with stack switching, and declare the stack-helper dependencies in
    EM_JS_DEPS for newer Emscripten (#1019).
  • Closures / trampolines (all targets) — fail allocation gracefully when
    the page-size lookup fails (#1015) and bound the executable-mmap retry loop
    (#1055).

Build and packaging

  • Keep the bundled dlmalloc symbols static so they cannot clash with an
    application's allocator, and emit subsections_via_symbols on Apple
    platforms for linker dead-stripping (#1017).
  • Honor an explicit --enable-docs, respect every --libdir spelling, and
    keep CCASFLAGS in sync with CFLAGS (#1060).

libffi 3.8.0

Choose a tag to compare

@github-actions github-actions released this 08 Aug 22:12

New features

  • FFI_TYPE_VECTOR (SIMD) type support with libffi-computed layout, for aarch64 and x86-64 (#1000, closes #773).
  • ffi_call_plan_size — report the total memory a reusable call plan owns, for embedders that account for the memory held by long-lived plans.
  • powerpc64 ELFv2 _Complex long double support for both IBM-128 (double-double) and IEEE-128 formats (#1003, closes #1001).

Fixes

  • powerpc64 big-endian ELFv2 closures returning 5-, 6-, or 7-byte structs: missing return jump-table entries produced a wrong result and leaked a libffi code pointer.
  • ia64 return-value jump-table desync after the FFI_TYPE_LAST bump, which corrupted small-struct and HFA returns.
  • powerpc Darwin closure returns broken by #951 (#1002).
  • i386 FreeBSD/OpenBSD small structs now returned in registers (1, 2, 4, or 8 bytes), matching the platform ABI and fixing a segfault on struct returns through ffi_call and closures.

Performance

  • Cache the static trampoline "unsupported" verdict on hosts whose page size exceeds the trampoline table mapping, avoiding redundant re-initialization on every closure allocation (e.g. 64K-page aarch64).

libffi 3.7.1

Choose a tag to compare

@github-actions github-actions released this 10 Jul 14:00

Fix aarch64 ffi_call memory corruption when passing many large
structs by value.
Fix i386 thiscall/fastcall closure stack cleanup for 64-bit
integer and struct arguments.
Fix aarch64 int128 argument split between x7 and the stack on
Darwin (#993).
Fix aarch64 clang-cl link failure for HFA helper functions (#996).
Build a generic ffi_call_plan fallback on Windows x86-64.
Add Windows ARM64 (MSVC) build and continuous integration support.

libffi 3.7.0

Choose a tag to compare

@github-actions github-actions released this 08 Jul 11:45

Add reusable call plans (ffi_call_plan_alloc/ffi_call_plan_invoke/ffi_call_plan_free).
Fix PA-RISC build broken by the conditional __int128 support added in 3.6.0.
Fix PA-RISC stack overflow passing many small structs by value.
Fix powerpc aix/darwin closure build errors (#987).
Include .note.GNU-stack on FreeBSD/x86 (#991).
Fix MSVC Win32 spin-lock atomics in bundled dlmalloc (#989).
Harden static trampoline and x86_64 closure internals.
Fix ffi_call clobbering the caller's argument pointer array
when passing large structs by value.
Allow a NULL rvalue in ffi_call to discard the return value.
Fix wasm widening of integral returns narrower than ffi_arg.

libffi 3.6.0

Choose a tag to compare

@github-actions github-actions released this 20 Jun 13:59

Add LoongArch32 support.
Add RISC-V static trampoline support.
Add aarch64 GCS (Guarded Control Stack) support.
Add aarch64 feature build attribute support.
Add ppc64le ELFv2 complex type support.
Add conditional target support for __int128.
Add x86_64 IEEE binary128 long double support (e.g. x86_64 Android).
Update bundled dlmalloc to upstream 2.8.6.
Fix closures using FFI_REGISTER ABI.
Fix SH linker errors with USER_LABEL_PREFIX.
Fix compilation for ARM Windows targets.
Fix compilation for Cortex-A53.
Fix test compilation for some Android platforms.
Fix x86 ASAN compatibility for win64.
Fix clang -Werror-semi builds on riscv, or1k, loongarch.
Fix NULL deref in dlmalloc sys_trim on heap corruption.
Fix ThreadSanitizer data race in dlmalloc mparams init (#873).
Define WIN32_LEAN_AND_MEAN before including windows.h.
Fix comments that trip up some toolchains.

v3.5.2

Choose a tag to compare

@atgreen atgreen released this 02 Aug 07:01

What's Changed

  • fix: enable FFI_MMAP_EXEC_WRIT for DragonFly BSD by @liweitianux in #930
  • Emscripten: Add wasm64 target by @ktock in #927
  • fix: Ensure trampoline file descriptors are closed on exec.

New Contributors

Full Changelog: v3.5.1...v3.5.2

v3.5.1

Choose a tag to compare

@atgreen atgreen released this 10 Jun 21:35

What's Changed

  • Downgrade Autoconf requirement to version 2.68 by @kleisauke in #922
  • Fix symbol versioning error.

Full Changelog: v3.5.0...v3.5.1

snapshots

snapshots Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 09 Jun 16:24

Snapshot built from 0051b11

⌂ 换网址