Commit Graph
41 Commits
Author SHA1 Message Date
Ryan C. Underwood d46406088d Fully allocate file backing writable maps (#389)
When ftruncate() is used on a filesystem supporting sparse files,
space in the file is not actually allocated.  Then, when the file
is mmap'd and libffi writes to the mapping, SIGBUS is thrown to
the calling application.  Instead, always fully allocate the file
that will back writable maps.
2018-03-18 10:00:42 -04:00
Anthony Green 4fdbb0578e Merge pull request #320 from 0-wiz-0/master
Support NetBSD with mprotect.
2017-11-03 07:05:31 -04:00
Jean-Luc Jumpertz 181fc4cc9c Merge branch 'master' based on ksjogo/libffi
Added a tvOS target in Xcode project. Misc Xcode project cleanup.
  Fix macOS build target in Xcode project.

# Conflicts:
#	src/aarch64/ffi.c
#	src/x86/ffi64.c
2017-10-23 15:02:29 +02:00
Joerg Sonnenberger 2bfcd29955 Support NetBSD with mprotect.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
2017-10-02 15:34:03 +02:00
Anthony Green 93d8e7dd17 Fix #265 2017-09-27 21:51:34 -04:00
Jean-Luc Jumpertz a78da73956 Fix macOS build target in Xcode project.
- Add missing files for desktop platforms in generate-darwin-source-and-headers.py, and in the Xcode project.
- Add a static library target for macOS.
- Fix "implicit conversion loses integer precision" warnings for iOS mad macOS targets.
2017-09-04 15:55:34 +02:00
Ole André Vadla Ravnås 57d8ff044c Simplify iOS trampoline table allocation
By using VM_FLAGS_OVERWRITE there is no need for speculatively
allocating on a page we just deallocated. This approach eliminates the
race-condition and gets rid of the retry logic.
2017-03-30 13:30:50 +02:00
Ole André Vadla Ravnås d42ce7b95c Fix error path so mutex is unlocked before returning
In the unusual case where ffi_trampoline_table_alloc() fails.
2017-03-15 01:27:43 +01:00
Berker Peksag 74b3f52014 Remove unused FFI_CLOSURE_TEST
It was here since the first commit c6dddbd (warning: huge diff) and
it wasn't defined by the configure script. It was probably used
manually during development.
2016-05-19 18:05:36 +03:00
Kylie McClain e169ba2b83 Fix usage on musl libc
A gcc compiled on musl does not define __gnu_linux__, it defines __linux__.
Only on glibc does __gnu_linux__ get defined, but both define __linux__, so
we should check for that instead.

With this patch, libffi works perfectly, and passes its testsuite entirely
on musl libc systems.
2016-04-29 21:31:59 -04:00
Russell Keith-Magee bc4fc07aa5 Fixed #181 -- Corrected problems with ARMv7 build under iOS.
Based on a patch from @fealebenpae, with input from @SolaWing and @rth7680,
and testing from @superdump.
2015-12-21 00:37:06 +08:00
Anthony Green 1cee07be47 Remove compiler warning 2014-06-12 06:30:59 -04:00
Mickaël Salaün c1166d4f65 closures: Check for mkostemp(3) 2014-05-19 23:11:33 +02:00
Mickaël Salaün 8daeed9570 closures: Create temporary file with O_TMPFILE and O_CLOEXEC when available
The open_temp_exec_file_dir function can create a temporary file without
file system accessible link. If the O_TMPFILE flag is not defined (old
Linux kernel or libc) the behavior is unchanged.

The open_temp_exec_file_name function now need a new argument "flags"
(like O_CLOEXEC) used for temporary file creation.

The O_TMPFILE flag allow temporary file creation without race condition.
This feature/fix prevent another process to access the (future)
executable file from the file system.

The O_CLOEXEC flag automatically close the temporary file for any
execve. This avoid transmitting (executable) file descriptor to a child
process.
2014-05-19 23:11:33 +02:00
Magnus Granberg 52b3457093 Check /proc/self/status for PaX status. 2014-05-11 09:55:28 -04:00
Anthony Green 11d7aa9d7a Merge pull request #46 from makotokato/android-clang
Fix build failure when using clang for Android
2014-02-28 01:09:06 -05:00
Zachary Waldowski 9da28b4427 Darwin/x86_64: Fix 64-bit type shortening warnings 2014-02-05 14:28:58 -05:00
Anthony Green 3dc3f32c35 Undo iOS ARM64 changes. 2013-12-05 16:23:25 -05:00
Zachary Waldowski 0612081e6c Darwin: Misc size_t warnings 2013-11-30 04:14:10 -05:00
Anthony Green 128cd1d2f3 Fix spelling errors 2013-10-08 06:45:51 -04:00
Makoto Kato 3b44d41156 Fix build failure when using clang for Android
clang for Android generates __gnu_linux__ define, but gcc for Android doesn't.  So we should add check it for Android
2013-07-10 15:34:53 +09:00
Anthony Green 12b1886d7b cygwin fix & updates for 3.0.13 2013-03-17 18:33:59 -04:00
Anthony Green e944b8c7eb Add PaX work-around 2012-10-30 14:06:40 -04:00
Anthony Green 6a6e7f862f Fix kfreebsd 2011-11-12 16:20:42 -05:00
Anthony Green c411f140f3 Fix ax_enable_builddir macro on BSD systems 2011-11-12 07:32:36 -05:00
Anthony Green 049d8386ff Many new patches 2011-08-22 14:50:10 -04:00
Anthony Green 747d6c32d4 Add Interix support 2011-02-09 14:56:23 -05:00
Anthony Green 0cad4386fa Add ChangeLog entry. Fix copyright headers. 2011-02-09 06:11:46 -05:00
Anthony Green 1106229a57 Add iOS support 2011-02-08 19:20:09 -05:00
Anthony Green 0e5843995f Refresh from GCC 2011-02-08 07:52:40 -05:00
Anthony Green 2db72615b5 Rebase 2010-11-21 10:50:56 -05:00
Landon Fuller 83038cf24a Implement FFI_EXEC_TRAMPOLINE_TABLE allocator for iOS/ARM.
This provides working closure support on iOS/ARM devices where
PROT_WRITE|PROT_EXEC is not permitted. The code passes basic
smoke tests, but requires further review.
2010-09-19 14:36:45 -07:00
Landon Fuller 9e1196444e Add a hard-coded FFI_EXEC_TRAMPOLINE_TABLE arm implementation.
This implements support for re-mapping a shared table of executable
trampolines directly in front of a writable configuration page, working
around PROT_WRITE restrictions for sandboxed applications on Apple's
iOS.

This implementation is for testing purposes; a proper allocator is still
necessary, and ARM-specific code needs to be moved out of
src/closures.c.
2010-09-19 10:43:06 -07:00
Anthony Green eaf444eabc Fix selinux test 2010-07-10 08:59:09 -04:00
Anthony Green f2c2a4fce9 Remove warnings and add OS/2 support 2010-04-13 10:19:28 -04:00
Anthony Green c3042afaf3 Reset quilt patches post 3.0.9 merge with GCC 2010-01-01 08:08:02 -05:00
Anthony Green 0cfe60e9d1 3.0.9rc12 2009-12-29 10:06:04 -05:00
Anthony Green 39c8792ece 3.0.9rc7 2009-12-25 21:52:28 -05:00
Anthony Green 115ab36fce Update missing changes for 3.0.9r4. 2009-12-24 00:22:00 -05:00
Anthony Green e4a91de766 From Abdulaziz Ghuloum. Adds special case for Snow Leopard. 2009-10-05 00:16:17 -04:00
Anthony Green c6dddbd02b Initial commit 2009-10-04 08:11:33 -04:00