enable stack protector for Pal/Linux.
for other Pal, enabling stack protector results in error.
Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
Some parts of LibOS used the combination of atomic_inc/add() + atomic_read()
which is not atomic. This commit introduces atomic_inc/add_return() to
make those parts atomic.
This commit contains the following memory-corruption fixes:
- Add a separate debug_print_vma() function
- Fix _DkGetAvailableUserAddressRange() returning incorrect memory range
- Protect memory occupied by LibOS code from being overwritten
- Check return values of init_brk*() calls
- Add check for allocation failure in __bkeep_mmap()
- Fix initial brk region allocation (previously could overwrite PAL data)
Fixing the bound of a debug buffer in SGX PAL
Rewrite bytes2hexstr; Add two new macros, alloca_bytes2hexstr() and malloc_bytes2hexstr().
Remove HASHBUF_SIZE
Add comments for the bytes2hexstr() macros.
Add a compile-time assertion
* Fix a bug where configuration error ends up doing a huge allocation, rather than catching the error. Add some documentation to the slabmgr code.
* Add a unit test and some documentation to answer the question in issue #107. I can't see how offset and map_start would end up being different.
* Rewrite of SGX file_map to remove TOCTTTOU now passes all unit tests
* Apply a similar fix to file_read.
* Factor complicated verification code into a common helper routine.
* Adjust the memory copying strategy so that all bits in the returned buffed are exactly the same bits as verified in the trusted, scratch buffer.
* Fixing the TOCTOU issue in file checking
* Adding comments for load_trusted_file() and copy_and_check_trusted_file(); Deprecate the old design
* Documenting the file checking mechanism
* Fix off-by-one error in __hex2str()
* Add a unit test and documentation for hex2str, in light of issue #129/PR #130. Although only used by SGX pal, I moved hex2str into a library function, since it isn't SGX specifix. Change the function signature to pass in a stack-allocated buffer. Adjust a few hash types, and make the build stop earlier on a failure.
1. Redesign of the VMA bookkeeping logic in the library OS
2. ASLR reimplementation
3. Support MAP_32BITS flags for mmap()
4. Safeguarding library OS internal memory from user memory and checkpoint buffers
5. Eliminating race conditions at VMA lookup and bookkeeping
6. Enable early VMA bookkeeping during initialization
7. Adding documentation for the VMA implementation
Fix a bug where configuration error ends up doing a huge allocation, rather than catching the error. Add some documentation to the slabmgr code.
Fix a stack corruption on signal delivery in a PAL call. Basically, some important code that saves registers and other state, in case we need to jump out of the PAL, was getting optimized out. Added some documentation about how the exception handling code works.
A bugfix for getsockname()
- Fix a severe bug caused by merging #87. The patch does not check the return values from get_config_entries_size(), while the return values can easily be negative (-PAL_ERROR_INVAL). Any usage of this function should carefully check the return values and also pass the size into get_config_entries() to prevent buffer overflow.
- Fix a minor bug in handling IPC disconnection. The callback ipc_child_exit() never receives a "term_signal" parameter. The callback is called when thepipe to a child process unexpectedly terminates, which can only mean the child process has crashed. I believe the proper signal to send is SIGKILL.
- Remove a compilation warning caused by type mismatch of __malloc().
- Allow binding TCP socket to ANY address
- enable LD_PRELOAD in glibc
- disable output buffering in LTP tests to reveal omitted passes
- Remove a double-unlock in shim_async.c
- Replace all int with size_t or ssize_t in Graphene configuration API
- Add new passed LTP tests
* Update all headers to reflect LGPL license.
* Add submodule for gcc test inputs
* Add submodule for lmbench-2.5
* Fix Travis build with submodules
* Migrate driver to sub repository
* Migrate driver to sub repository
Replace the atomics implementation.
* Change the PAL Semaphore to a Mutex, and fix some issues in the Mutex implementations
* Tweak the layout of a PAL Handle
* Rework some of the IPC helper synchronization
* Taking out waitpid03 - it is flaky, even on the commit where it was added to the PASSED list.
Replace the directory cache implementation.
* Fix unix domain socket lookup.
* Fix a bug in the getdents EINVAL case
* remove profiling code in dcache.c; cleaning up some style issues
* adding a note to the recursive path_lookupat() code
* remove a few compilation warnings
* Apply Chia-Che's suggested fixes; add more now-passing cases to LTP nice list.
* Ref counting bug for /proc/self/fd/. Document and implement expected behavior in relevant helper function.
* Remove the Linux linked list implementation, replace with a new implementation that adds some type-checking that list pointers (heads) and entries/nodes match.
* Fix the debug build by consolidating assertions into one header
* Several memory allocation fixes, primarily motivated by the fact that the Diffie-Hellman implementation in mbedtls is sensitive to misaligned allocations. All malloc's are now 16-byte aligned. This PR has several other points where remalloc was used instead of realloc, or memory needed to be zeroed upon allocation. Finally, this PR also standardizes the definition of assert across layers, so that code in the lib directory can both use assertions and link properly in the PAL and shim.