import libffi-3.1-21.el8

This commit is contained in:
CentOS Sources 2020-01-21 16:26:40 -05:00 committed by Stepan Oksanichenko
parent f36ea9842a
commit f5ff919fd6
2 changed files with 4 additions and 66 deletions

View File

@ -1,63 +0,0 @@
Also flush the code alias mapping when creating a closure. It seems
that this is necessary on some aarch64 implementations. The existing
code only flashes the writable mapping.
diff -rup a/include/ffi_common.h b/include/ffi_common.h
--- a/include/ffi_common.h 2014-04-25 13:45:13.000000000 -0400
+++ b/include/ffi_common.h 2019-06-14 14:12:04.387499160 -0400
@@ -82,6 +82,10 @@ ffi_status ffi_prep_cif_machdep(ffi_cif
ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif,
unsigned int nfixedargs, unsigned int ntotalargs);
+/* Translate a data pointer to a code pointer. Needed for closures on
+ some targets. */
+void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN;
+
/* Extended cif, used in callback from assembly routine */
typedef struct
{
Only in b/include: ffi_common.h.orig
diff -rup a/src/aarch64/ffi.c b/src/aarch64/ffi.c
--- a/src/aarch64/ffi.c 2019-06-14 14:11:03.485469505 -0400
+++ b/src/aarch64/ffi.c 2019-06-14 14:12:04.392499162 -0400
@@ -926,6 +926,10 @@ ffi_prep_closure_loc (ffi_closure* closu
FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, codeloc,
cif->aarch64_flags);
+ /* Also clear the cache on the executable alias mapping. */
+ unsigned char *code = ffi_data_to_code_pointer (&closure->tramp[0]);
+ ffi_clear_cache (code, code + FFI_TRAMPOLINE_SIZE);
+
closure->cif = cif;
closure->user_data = user_data;
closure->fun = fun;
Only in b/src/aarch64: ffi.c.orig
diff -rup a/src/closures.c b/src/closures.c
--- a/src/closures.c 2014-05-11 09:54:19.000000000 -0400
+++ b/src/closures.c 2019-06-14 14:12:04.396499164 -0400
@@ -597,6 +597,13 @@ ffi_closure_alloc (size_t size, void **c
return ptr;
}
+void *
+ffi_data_to_code_pointer (void *data)
+{
+ msegmentptr seg = segment_holding (gm, data);
+ return add_segment_exec_offset (data, seg);
+}
+
/* Release a chunk of memory allocated with ffi_closure_alloc. If
FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the
writable or the executable address given. Otherwise, only the
@@ -656,5 +663,11 @@ ffi_closure_free (void *ptr)
free (ptr);
}
+void *
+ffi_data_to_code_pointer (void *data)
+{
+ return data;
+}
+
# endif /* ! FFI_MMAP_EXEC_WRIT */
#endif /* FFI_CLOSURES */

View File

@ -2,7 +2,7 @@
Name: libffi
Version: 3.1
Release: 20%{?dist}
Release: 21%{?dist}
Summary: A portable foreign function interface library
Group: System Environment/Libraries
@ -15,7 +15,6 @@ Patch0: libffi-3.1-fix-include-path.patch
Patch1: libffi-3.1-fix-exec-stack.patch
Patch2: libffi-aarch64-rhbz1174037.patch
Patch3: libffi-3.1-aarch64-fix-exec-stack.patch
Patch4: libffi-rh1652930.patch
Patch5: libffi-3.1-closures-Create-temporary-file-with-O_TMPFILE-and-O_.patch
%description
@ -65,7 +64,6 @@ developing applications that use %{name}.
%patch1 -p1 -b .execstack
%patch2 -p1 -b .aarch64
%patch3 -p1 -b .aarch64execstack
%patch4 -p1
%patch5 -p1
@ -127,6 +125,9 @@ fi
%{_infodir}/libffi.info.gz
%changelog
* Thu Aug 1 2019 DJ Delorie <dj@redhat.com> - 3.1-21
- Revert 1652930 until 1721569 can be fixed (#1652930)
* Fri Jun 14 2019 DJ Delorie <dj@redhat.com> - 3.1-20
- closures: Create temporary file with O_TMPFILE and O_CLOEXEC (#1720600)