Add $LIBFFI_TMPDIR environment variable support (#1667620)

This commit is contained in:
DJ Delorie 2020-04-30 23:01:25 -04:00
parent e39a9572c0
commit 2c1dc799ce
2 changed files with 23 additions and 2 deletions

View File

@ -0,0 +1,17 @@
Most temp file directories need to be hardened against execution, but
libffi needs execute privileges. Add a libffi-specific temp directory
that can be set up by sysadmins as needed with suitable permissions.
This both ensures that libffi will have a valid temp directory to use
as well as preventing attempts to access other directories.
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 2020-04-29 20:50:00.454853909 -0400
@@ -362,6 +362,7 @@ static struct
const char *arg;
int repeat;
} open_temp_exec_file_opts[] = {
+ { open_temp_exec_file_env, "LIBFFI_TMPDIR", 0 },
{ open_temp_exec_file_env, "TMPDIR", 0 },
{ open_temp_exec_file_dir, "/tmp", 0 },
{ open_temp_exec_file_dir, "/var/tmp", 0 },

View File

@ -4,7 +4,7 @@
Name: libffi
Version: 3.1
Release: 24%{?dist}
Release: 25%{?dist}
Summary: A portable foreign function interface library
License: MIT
URL: http://sourceware.org/libffi
@ -16,6 +16,7 @@ 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-3.1-libffi_tmpdir.patch
BuildRequires: gcc
%if %{without bootstrap}
@ -67,7 +68,7 @@ developing applications that use %{name}.
%patch1 -p1 -b .execstack
%patch2 -p1 -b .aarch64
%patch3 -p1 -b .aarch64execstack
%patch4 -p1 -b .libffitmpdir
%build
%configure --disable-static
@ -120,6 +121,9 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}
%{_infodir}/libffi.info.*
%changelog
* Thu Apr 30 2020 DJ Delorie <idj@redhat.com> - 3.1-25
- Add $LIBFFI_TMPDIR environment variable support (#1667620)
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild