Compare commits
10 Commits
471ee9629b
...
7920e0f9ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7920e0f9ee | ||
|
|
9db797a1c2 | ||
|
|
1d98bc732f | ||
|
|
9daacc460e | ||
|
|
15689f2d60 | ||
|
|
8d5b5f500a | ||
|
|
974361437a | ||
|
|
1cbd961cae | ||
|
|
e835a20abd | ||
|
|
98987ef3fe |
74
backport-Fix-signed-vs-unsigned-comparison.patch
Normal file
74
backport-Fix-signed-vs-unsigned-comparison.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From ebbc5e14cdbfcc24bf3c9bb7b41ee10cd979c535 Mon Sep 17 00:00:00 2001
|
||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
||||
Date: Thu, 2 Feb 2023 11:40:17 +0000
|
||||
Subject: [PATCH] Fix signed vs unsigned comparison (#765)
|
||||
|
||||
As reported by -Wsign-compare. In the case of getting the result of
|
||||
comparing the result of sysconf (_SC_PAGESIZE) to other value, this also
|
||||
correctly handles edge cases where the above fails and returns -1.
|
||||
|
||||
Co-authored-by: serge-sans-paille <sguelton@mozilla.com>
|
||||
---
|
||||
src/closures.c | 2 +-
|
||||
src/prep_cif.c | 2 +-
|
||||
src/tramp.c | 7 +++++--
|
||||
3 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/closures.c b/src/closures.c
|
||||
index 9aafbec4b..c42527795 100644
|
||||
--- a/src/closures.c
|
||||
+++ b/src/closures.c
|
||||
@@ -795,7 +795,7 @@ open_temp_exec_file (void)
|
||||
static int
|
||||
allocate_space (int fd, off_t offset, off_t len)
|
||||
{
|
||||
- static size_t page_size;
|
||||
+ static long page_size;
|
||||
|
||||
/* Obtain system page size. */
|
||||
if (!page_size)
|
||||
diff --git a/src/prep_cif.c b/src/prep_cif.c
|
||||
index 2d0f2521f..0e2d58e5e 100644
|
||||
--- a/src/prep_cif.c
|
||||
+++ b/src/prep_cif.c
|
||||
@@ -234,7 +234,7 @@ ffi_status ffi_prep_cif_var(ffi_cif *cif,
|
||||
{
|
||||
ffi_status rc;
|
||||
size_t int_size = ffi_type_sint.size;
|
||||
- int i;
|
||||
+ unsigned int i;
|
||||
|
||||
rc = ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes);
|
||||
|
||||
diff --git a/src/tramp.c b/src/tramp.c
|
||||
index b9d273a1a..7e005b054 100644
|
||||
--- a/src/tramp.c
|
||||
+++ b/src/tramp.c
|
||||
@@ -266,7 +266,7 @@ ffi_tramp_get_temp_file (void)
|
||||
* trampoline table to make sure that the temporary file can be mapped.
|
||||
*/
|
||||
count = write(tramp_globals.fd, tramp_globals.text, tramp_globals.map_size);
|
||||
- if (count == tramp_globals.map_size && tramp_table_alloc ())
|
||||
+ if (count >=0 && (size_t)count == tramp_globals.map_size && tramp_table_alloc ())
|
||||
return 1;
|
||||
|
||||
close (tramp_globals.fd);
|
||||
@@ -374,6 +374,8 @@ tramp_table_unmap (struct tramp_table *table)
|
||||
static int
|
||||
ffi_tramp_init (void)
|
||||
{
|
||||
+ long page_size;
|
||||
+
|
||||
if (tramp_globals.status == TRAMP_GLOBALS_PASSED)
|
||||
return 1;
|
||||
|
||||
@@ -396,7 +398,8 @@ ffi_tramp_init (void)
|
||||
&tramp_globals.map_size);
|
||||
tramp_globals.ntramp = tramp_globals.map_size / tramp_globals.size;
|
||||
|
||||
- if (sysconf (_SC_PAGESIZE) > tramp_globals.map_size)
|
||||
+ page_size = sysconf (_SC_PAGESIZE);
|
||||
+ if (page_size >= 0 && (size_t)page_size > tramp_globals.map_size)
|
||||
return 0;
|
||||
|
||||
if (ffi_tramp_init_os ())
|
||||
28
fix-AARCH64EB-support.patch
Normal file
28
fix-AARCH64EB-support.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From b1af55df9b05eaf4b982c135f4ba6f263b72e458 Mon Sep 17 00:00:00 2001
|
||||
From: Xin Shi <shixin21@huawei.com>
|
||||
Date: Mon, 20 Mar 2023 16:42:57 +0800
|
||||
Subject: [PATCH] fix AARCH64EB support
|
||||
|
||||
Signed-off-by: Xin Shi <shixin21@huawei.com>
|
||||
---
|
||||
src/aarch64/ffi.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
|
||||
index 6544ac0..580e965 100644
|
||||
--- a/src/aarch64/ffi.c
|
||||
+++ b/src/aarch64/ffi.c
|
||||
@@ -758,6 +758,10 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue,
|
||||
}
|
||||
state.nsrn = N_V_ARG_REG;
|
||||
dest = allocate_to_stack (&state, stack, ty->alignment, s);
|
||||
+#ifdef __AARCH64EB__
|
||||
+ if (t == FFI_TYPE_FLOAT)
|
||||
+ dest = dest +4;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
else if (s > 16)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
33
libffi.spec
33
libffi.spec
@ -1,6 +1,6 @@
|
||||
Name: libffi
|
||||
Version: 3.4.2
|
||||
Release: 5
|
||||
Release: 8
|
||||
Summary: A Portable Foreign Function Interface Library
|
||||
License: MIT
|
||||
URL: http://sourceware.org/libffi
|
||||
@ -11,6 +11,9 @@ Source2: ffitarget-multilib.h
|
||||
Patch0: backport-x86-64-Always-double-jump-table-slot-size-for-CET-71.patch
|
||||
Patch1: backport-Fix-check-for-invalid-varargs-arguments-707.patch
|
||||
Patch2: libffi-Add-sw64-architecture.patch
|
||||
Patch3: backport-Fix-signed-vs-unsigned-comparison.patch
|
||||
Patch4: riscv-extend-return-types-smaller-than-ffi_arg-680.patch
|
||||
Patch5: fix-AARCH64EB-support.patch
|
||||
|
||||
BuildRequires: gcc gcc-c++ dejagnu
|
||||
BuildRequires: make
|
||||
@ -98,6 +101,34 @@ fi
|
||||
%{_infodir}/libffi.info.gz
|
||||
|
||||
%changelog
|
||||
* Tue Nov 14 2023 zhangruifang<zhangruifang1@h-partners.com> - 3.4.2-8
|
||||
- revert version to 3.4.2-8
|
||||
- compatibility issues exist between versions
|
||||
|
||||
* Thu Oct 26 2023 zhangruifang<zhangruifang1@h-partners.com> - 3.4.4-1
|
||||
- Type:enhancement
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:update version to 3.4.4
|
||||
|
||||
* Mon Apr 10 2023 shixin <shixin21@huawei.com> - 3.4.2-8
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:Fix AARCH64EB support
|
||||
|
||||
* Wed Mar 29 2023 laokz <zhangkai@iscas.ac.cn> - 3.4.2-7
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:Backport upstream patch to fix riscv %check error
|
||||
|
||||
* Thu Mar 23 2023 fuanan <fuanan3@h-partners.com> - 3.4.2-6
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:backport patches from upstream
|
||||
|
||||
* Wed Dec 14 2022 yixiangzhike <yixiangzhike007@163.com> - 3.4.2-5
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
51
riscv-extend-return-types-smaller-than-ffi_arg-680.patch
Normal file
51
riscv-extend-return-types-smaller-than-ffi_arg-680.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From aa3fce08ba620c50db17215a9f14dd0f1facf741 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@linux-m68k.org>
|
||||
Date: Sun, 13 Feb 2022 21:04:33 +0100
|
||||
Subject: [PATCH] riscv: extend return types smaller than ffi_arg (#680)
|
||||
|
||||
Co-authored-by: Andreas Schwab <schwab@suse.de>
|
||||
---
|
||||
src/riscv/ffi.c | 27 ++++++++++++++++++++++++++-
|
||||
1 file changed, 26 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/riscv/ffi.c b/src/riscv/ffi.c
|
||||
index c910858..ebd05ba 100644
|
||||
--- a/src/riscv/ffi.c
|
||||
+++ b/src/riscv/ffi.c
|
||||
@@ -373,7 +373,32 @@ ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue,
|
||||
|
||||
cb.used_float = cb.used_integer = 0;
|
||||
if (!return_by_ref && rvalue)
|
||||
- unmarshal(&cb, cif->rtype, 0, rvalue);
|
||||
+ {
|
||||
+ if (IS_INT(cif->rtype->type)
|
||||
+ && cif->rtype->size < sizeof (ffi_arg))
|
||||
+ {
|
||||
+ /* Integer types smaller than ffi_arg need to be extended. */
|
||||
+ switch (cif->rtype->type)
|
||||
+ {
|
||||
+ case FFI_TYPE_SINT8:
|
||||
+ case FFI_TYPE_SINT16:
|
||||
+ case FFI_TYPE_SINT32:
|
||||
+ unmarshal_atom (&cb, (sizeof (ffi_arg) > 4
|
||||
+ ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32),
|
||||
+ rvalue);
|
||||
+ break;
|
||||
+ case FFI_TYPE_UINT8:
|
||||
+ case FFI_TYPE_UINT16:
|
||||
+ case FFI_TYPE_UINT32:
|
||||
+ unmarshal_atom (&cb, (sizeof (ffi_arg) > 4
|
||||
+ ? FFI_TYPE_UINT64 : FFI_TYPE_UINT32),
|
||||
+ rvalue);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ unmarshal(&cb, cif->rtype, 0, rvalue);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.39.2
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user