Skip to content

Commit 384e331

Browse files
nodejs-github-botRenegade334
authored andcommitted
deps: update libffi to 3.8.2
1 parent f2d9356 commit 384e331

27 files changed

Lines changed: 1305 additions & 182 deletions

‎deps/libffi/ChangeLog‎

Lines changed: 745 additions & 0 deletions
Large diffs are not rendered by default.

‎deps/libffi/README.md‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
libffi-3.8.1 was released on November 14, 2026.
2+
libffi-3.8.2 was released on November 25, 2026.
33

44

55
What is libffi?
@@ -201,6 +201,40 @@ History
201201

202202
See the git log for details at http://github.com/libffi/libffi.
203203

204+
3.8.2 November-25-2026
205+
x86-64: reject vector types under the Win64 ABIs on non-Windows
206+
builds, as documented (GHSA-v9rw-6cxm-q6rf).
207+
CRIS: reject vector types (GHSA-j9pv-w354-7fg2).
208+
aarch64: reserve enough stack for large by-value structs mixed
209+
with 16-byte-aligned arguments (GHSA-wc36-xxj4-cxh5).
210+
Pass by-value aggregates aligned beyond the stack alignment
211+
correctly on x86-64, i386, ARM, MIPS, m88k and AArch64
212+
(GHSA-rwpw-56v4-44r3).
213+
powerpc64 ELFv2: fix closures overwriting the caller's frame
214+
with float structs and _Complex arguments
215+
(GHSA-p8c7-j6j7-h7vg), and stop padding IBM long double
216+
aggregates (GHSA-34hv-975q-7p7w).
217+
RISC-V, LoongArch: fix one-float structs passed after the FP
218+
argument registers run out (GHSA-2xrh-7r9c-rwmf).
219+
Static trampolines: make the temporary code-table file
220+
immutable, so a forked child cannot rewrite its parent's
221+
closures (GHSA-7qx4-vhpx-x6qm).
222+
i386: fix ffi_raw_call argument placement and refuse raw
223+
closures with in-memory results (GHSA-qgq7-fxgw-wrp4,
224+
GHSA-64xf-g9qc-vf93).
225+
MIPS: fix O32 closures returning _Complex long long
226+
(GHSA-xh8m-x7vg-ww5m) and N32/N64 complex arguments at the
227+
end of the argument registers (GHSA-p8w7-v539-c775).
228+
Refuse oversized signatures instead of truncating them
229+
(GHSA-qpm4-52vm-3xff, GHSA-j4q2-5r23-67rj,
230+
GHSA-76jh-g582-v8x4).
231+
SPARC: fix ffi_call with a NULL rvalue for large struct results
232+
(GHSA-v569-599f-q4hr).
233+
AIX: make struct layout independent of prior ffi_prep_cif calls
234+
(GHSA-f45x-cg8q-3q9w).
235+
LoongArch: do not write to the result buffer of a void call
236+
(#1083).
237+
204238
3.8.1 November-14-2026
205239
Improve ABI conformance and test coverage for complex-number
206240
calls, closures, and small aggregates across ARM, x86, PowerPC,

‎deps/libffi/configure‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.72 for libffi 3.8.1.
3+
# Generated by GNU Autoconf 2.72 for libffi 3.8.2.
44
#
55
# Report bugs to <http://github.com/libffi/libffi/issues>.
66
#
@@ -614,8 +614,8 @@ MAKEFLAGS=
614614
# Identity of this package.
615615
PACKAGE_NAME='libffi'
616616
PACKAGE_TARNAME='libffi'
617-
PACKAGE_VERSION='3.8.1'
618-
PACKAGE_STRING='libffi 3.8.1'
617+
PACKAGE_VERSION='3.8.2'
618+
PACKAGE_STRING='libffi 3.8.2'
619619
PACKAGE_BUGREPORT='http://github.com/libffi/libffi/issues'
620620
PACKAGE_URL=''
621621

@@ -1414,7 +1414,7 @@ if test "$ac_init_help" = "long"; then
14141414
# Omit some internal or obsolete options to make the list less imposing.
14151415
# This message is too long to be a string in the A/UX 3.1 sh.
14161416
cat <<_ACEOF
1417-
'configure' configures libffi 3.8.1 to adapt to many kinds of systems.
1417+
'configure' configures libffi 3.8.2 to adapt to many kinds of systems.
14181418

14191419
Usage: $0 [OPTION]... [VAR=VALUE]...
14201420

@@ -1486,7 +1486,7 @@ fi
14861486

14871487
if test -n "$ac_init_help"; then
14881488
case $ac_init_help in
1489-
short | recursive ) echo "Configuration of libffi 3.8.1:";;
1489+
short | recursive ) echo "Configuration of libffi 3.8.2:";;
14901490
esac
14911491
cat <<\_ACEOF
14921492

@@ -1625,7 +1625,7 @@ fi
16251625
test -n "$ac_init_help" && exit $ac_status
16261626
if $ac_init_version; then
16271627
cat <<\_ACEOF
1628-
libffi configure 3.8.1
1628+
libffi configure 3.8.2
16291629
generated by GNU Autoconf 2.72
16301630

16311631
Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2274,7 +2274,7 @@ cat >config.log <<_ACEOF
22742274
This file contains any messages produced by compilers while
22752275
running configure, to aid debugging if configure makes a mistake.
22762276

2277-
It was created by libffi $as_me 3.8.1, which was
2277+
It was created by libffi $as_me 3.8.2, which was
22782278
generated by GNU Autoconf 2.72. Invocation command line was
22792279

22802280
$ $0$ac_configure_args_raw
@@ -3266,10 +3266,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
32663266
ac_config_headers="$ac_config_headers fficonfig.h"
32673267

32683268

3269-
FFI_VERSION_STRING="3.8.1"
3270-
ffi_version_major=`echo "3.8.1" | cut -d. -f1`
3271-
ffi_version_minor=`echo "3.8.1" | cut -d. -f2 | sed 's/[^0-9].*//'`
3272-
ffi_version_micro=`echo "3.8.1" | cut -d. -f3 | sed 's/[^0-9].*//'`
3269+
FFI_VERSION_STRING="3.8.2"
3270+
ffi_version_major=`echo "3.8.2" | cut -d. -f1`
3271+
ffi_version_minor=`echo "3.8.2" | cut -d. -f2 | sed 's/[^0-9].*//'`
3272+
ffi_version_micro=`echo "3.8.2" | cut -d. -f3 | sed 's/[^0-9].*//'`
32733273
FFI_VERSION_NUMBER=`expr ${ffi_version_major:-0} \* 10000 + ${ffi_version_minor:-0} \* 100 + ${ffi_version_micro:-0}`
32743274

32753275

@@ -4214,7 +4214,7 @@ fi
42144214

42154215
# Define the identity of the package.
42164216
PACKAGE='libffi'
4217-
VERSION='3.8.1'
4217+
VERSION='3.8.2'
42184218

42194219

42204220
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -22472,7 +22472,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
2247222472
# report actual input values of CONFIG_FILES etc. instead of their
2247322473
# values after options handling.
2247422474
ac_log="
22475-
This file was extended by libffi $as_me 3.8.1, which was
22475+
This file was extended by libffi $as_me 3.8.2, which was
2247622476
generated by GNU Autoconf 2.72. Invocation command line was
2247722477

2247822478
CONFIG_FILES = $CONFIG_FILES
@@ -22540,7 +22540,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
2254022540
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
2254122541
ac_cs_config='$ac_cs_config_escaped'
2254222542
ac_cs_version="\\
22543-
libffi config.status 3.8.1
22543+
libffi config.status 3.8.2
2254422544
configured by $0, generated by GNU Autoconf 2.72,
2254522545
with options \\"\$ac_cs_config\\"
2254622546

‎deps/libffi/configure.ac‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure
22

33
AC_PREREQ([2.68])
44

5-
AC_INIT([libffi],[3.8.1],[http://github.com/libffi/libffi/issues])
5+
AC_INIT([libffi],[3.8.2],[http://github.com/libffi/libffi/issues])
66
AC_CONFIG_HEADERS([fficonfig.h])
77

88
dnl Derive the version macros from AC_INIT so they cannot drift when the

‎deps/libffi/generate-headers.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from pathlib import Path
88

99

10-
LIBFFI_VERSION = '3.8.1'
11-
LIBFFI_VERSION_NUMBER = '30801'
10+
LIBFFI_VERSION = '3.8.2'
11+
LIBFFI_VERSION_NUMBER = '30802'
1212

1313
def normalize_arch(target_arch):
1414
aliases = {

‎deps/libffi/include/ffi_common.h‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ void ffi_type_test(ffi_type *a, const char *file, int line);
119119
/* v cast to size_t and aligned down to a multiple of a */
120120
#define FFI_ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
121121

122+
/* Upper bound on the size of an aggregate laid out by ffi_prep_cif.
123+
Summing member sizes must not wrap, and the call code adds the size of
124+
the return type to its frame and argument block (an alloca), so the
125+
bound leaves headroom for those additions even where size_t is 32
126+
bits. No real object comes anywhere near it. */
127+
#define FFI_MAX_TYPE_SIZE (((size_t) -1) / 4)
128+
129+
/* Upper bounds on a signature, checked by ffi_prep_cif_core before any
130+
port sees it. Several ports keep argument counts in an int and the
131+
size of the argument area in the 32-bit cif->bytes, and compute that
132+
size in ways that can wrap; no call can use an argument area larger
133+
than a thread's stack anyway, so refuse signatures far beyond that
134+
rather than let any port truncate them. */
135+
#define FFI_MAX_ARG_BYTES ((size_t) 256 << 20)
136+
#define FFI_MAX_NARGS (FFI_MAX_ARG_BYTES / 8)
137+
122138
/* Perform machine dependent cif processing */
123139
ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
124140
ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
@@ -139,6 +155,9 @@ ffi_status ffi_prep_cif_core(ffi_cif *cif,
139155
ffi_type *rtype,
140156
ffi_type **atypes);
141157

158+
/* Nonzero if TY is, or contains, a vector (SIMD) type. */
159+
int ffi_type_contains_vector (ffi_type *ty) FFI_HIDDEN;
160+
142161
/* Translate a data pointer to a code pointer. Needed for closures on
143162
some targets. */
144163
void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;

‎deps/libffi/libtool-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
# release, then set age to 0.
2727
#
2828
# CURRENT:REVISION:AGE
29-
13:1:5
29+
13:2:5

‎deps/libffi/src/aarch64/ffi.c‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,16 @@ static void *
324324
allocate_and_copy_struct_to_stack (struct arg_state *state, void *stack,
325325
size_t alignment, size_t size, void *value)
326326
{
327-
size_t dest = state->next_struct_area - size;
327+
char *dest = (char *) stack + state->next_struct_area - size;
328328

329-
/* Round down to the natural alignment of the value. */
330-
dest = FFI_ALIGN_DOWN (dest, alignment);
331-
state->next_struct_area = dest;
329+
/* Round down to the natural alignment of the value. Round the address,
330+
not the offset: the slab is only 16-byte aligned, and the callee may
331+
rely on the full alignment of the copy. ffi_prep_cif_machdep reserves
332+
what this can skip for alignments above 16. */
333+
dest = (char *) FFI_ALIGN_DOWN (dest, alignment);
334+
state->next_struct_area = (size_t) (dest - (char *) stack);
332335

333-
return memcpy ((char *) stack + dest, value, size);
336+
return memcpy (dest, value, size);
334337
}
335338

336339
static ffi_arg
@@ -660,16 +663,32 @@ ffi_prep_cif_machdep (ffi_cif *cif)
660663
NSAA, growing up). The generic prep_cif accounting in cif->bytes
661664
only charges the payload copy, not that 8-byte pointer slot, so the
662665
two regions can collide and a later struct copy can overwrite an
663-
already-spilled pointer with the copied payload bytes. Reserve an
664-
extra 8 bytes per such argument so the slab is always large enough
665-
for both. */
666+
already-spilled pointer with the copied payload bytes. Nor does it
667+
charge the alignment padding that only arises because the payload and
668+
the pointer live in different regions: the 8-byte pointer slot can
669+
leave the NSAA at an odd doubleword where the generic layout (which
670+
placed the payload there instead) did not, so a following 16-byte
671+
aligned stack argument (__int128, long double, ...) needs 8 bytes of
672+
padding, and a 16-byte aligned payload copied below an odd-doubleword
673+
next_struct_area needs another 8. Reserve an extra 16 bytes per such
674+
argument so the slab is always large enough for all of it. */
666675
for (i = 0, n = cif->nargs; i < n; i++)
667676
{
668677
ffi_type *ty = cif->arg_types[i];
669678
if (ty->size > 16 && !is_vfp_type (ty))
670-
bytes += 8;
679+
{
680+
bytes += 16;
681+
/* Rounding the copy's address down to an alignment above the
682+
slab's 16 can skip up to alignment - 1 more bytes. */
683+
if (ty->alignment > 16)
684+
bytes += ty->alignment;
685+
}
671686
}
672687

688+
/* cif->bytes is an unsigned int: refuse a total it cannot hold. */
689+
if (bytes > INT_MAX)
690+
return FFI_BAD_TYPEDEF;
691+
673692
/* Round the stack up to a multiple of the stack alignment requirement. */
674693
cif->bytes = (unsigned) FFI_ALIGN(bytes, 16);
675694
cif->flags = flags;

‎deps/libffi/src/arm/ffi.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,23 @@ ffi_align (ffi_type *ty, void *p)
8181
alignment = 4;
8282
#else
8383
alignment = ty->alignment;
84+
/* An aggregate aligned beyond a doubleword can only have got that from
85+
the alignment of the type itself (an attribute on the type, or a
86+
caller-set alignment), which the AAPCS ignores when passing it: it
87+
uses the largest member alignment, and never more than a doubleword.
88+
The argument area is only doubleword aligned anyway. */
89+
if (alignment > 8)
90+
{
91+
ffi_type **p;
92+
93+
alignment = 4;
94+
if (ty->elements != NULL)
95+
for (p = ty->elements; *p != NULL; p++)
96+
if ((*p)->alignment > alignment)
97+
alignment = (*p)->alignment;
98+
if (alignment > 8)
99+
alignment = 8;
100+
}
84101
if (alignment < 4)
85102
alignment = 4;
86103
#endif

‎deps/libffi/src/closures.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,12 @@ static int
618618
open_temp_exec_file_memfd (const char *name)
619619
{
620620
int fd;
621+
#ifdef MFD_ALLOW_SEALING
622+
/* Let ffi_tramp_get_temp_file () seal the file once it has been filled. */
623+
fd = memfd_create (name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
624+
#else
621625
fd = memfd_create (name, MFD_CLOEXEC);
626+
#endif
622627
return fd;
623628
}
624629
#endif

0 commit comments

Comments
 (0)