Commit Graph
29 Commits
Author SHA1 Message Date
borysp 7df0739e9a [Pal] Fix bugs in path normalization
Previous implementation had a few bugs in path-normalization functions,
e.g., in get_norm_path(): "../..a/" -> "....a" and "/../a"   -> "../a",
and in get_base_name(): "/" -> garbage (buffer overflow).
2019-08-12 20:21:19 -07:00
Isaku Yamahata 7eade65b91 [Pal, LibOS] Fix vprintf signature to take va_list instead of its pointer 2019-07-09 12:34:50 -07:00
Rafał Wojdyła 5a5b42fff8 [LibOS/PAL] Memory corruption fixes
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)
2019-06-10 16:15:12 -07:00
Chia-Che Tsai be9852784f [All components] Remove all modelines from all source files 2019-06-07 15:30:43 -05:00
Michał Kowalczyk 4fe1365d05 [Pal/Linux] Turn on -Wsign-compare and fix the produced warnings 2019-05-31 01:03:55 -07:00
Michał Kowalczyk 16d90cfe12 Fix parenthesizing and formatting of C macros 2019-05-23 19:14:23 +02:00
Simon Gaiser 205c574ac7 [Pal] Add macro for copying fixed size arrays 2019-04-26 01:06:58 +02:00
Li Lei 195c2b1f7b [PAL] Enable Wunsed-parameter warning as part of Wextra 2019-04-03 14:27:43 +02:00
Chia-Che Tsai cba6e3278a Add -Werror to CFLAGS with WERROR=1
Signed-off-by: Chia-Che Tsai <chiache@tamu.edu>
2019-02-12 20:09:43 -06:00
Chia-Che Tsai 48f330c88b [Linux/SGX PAL] Use the C11 standard instead of GNU99
Signed-off-by: Chia-Che Tsai <chiache@tamu.edu>
2019-02-10 13:52:18 -06:00
Isaku Yamahata 7ec3baeabe Pal/Linux, FreeBSD: ~15 instead of ~16 for child stack alignment
It should be "& ~15", not "& ~16" to align to 16 bytes.
It seems typo.

Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
2019-02-05 08:12:41 -05:00
Don Porter 03cb0e0bb3 Address a TOCTTOU vulnerability in SGX read/map (#131)
* 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
2018-06-25 07:54:40 -07:00
Chia-Che Tsai f8bf469018 Cleaning up and rewriting VMA bookkeeping code (#183)
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
2018-04-16 08:47:50 -07:00
Chia-Che Tsai 84f81d8f13 Lots of bugfixes (#145)
- 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
2017-12-18 16:03:36 -08:00
Don Porter 0433461802 License change to LGPL (#140)
* 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
2017-12-08 10:02:36 -08:00
Jaehyun Han d782947948 Fix the limitation on the number of trusted files (#87)
* Support a large number of trusted files. (Issue #9)

* Config counts overall key size of entries
2017-11-21 09:09:45 +00:00
Don Porter 62302518e8 Remove the wolfssl code (#77)
Delete wolfssl from the code base

A few minor issues with build, CI timeouts, and gitignores.
2017-11-15 16:58:10 +00:00
Don Porter 8d99e037ea Replace rsa implementation, from wolfssl to mbedtls. (#76)
Switch the RSA implementation from wolfssl to mbedtls
2017-10-23 01:41:24 +01:00
Don Porter b20e34cf5f Switch the AES-CMAC implementation from wolfssl to mbedtls. (#75)
* Switch the AES-CMAC implementation from wolfssl to mbedtls
2017-10-22 17:16:12 +01:00
Don Porter 2e9438f71c Replace Linux List code with a new implementation (#71)
* 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
2017-10-21 13:35:26 +01:00
Don Porter 64a57f2241 Malloc fixes (#70)
* 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.
2017-09-23 17:17:40 +01:00
Chia-Che Tsai 76967f39d3 Bugfixes:
- Fixing AES-CMAC algorithm
- Using SHA512 to hash file stubs (much faster than SHA256 and AES-CMAC)
- Hardening enclave interface (still work-in-progress); delt with issue #28
- Handling socket/pipe polling better
- Allowing setting the lowest heap address in enclaves ('sgx.heap_min' in manifest)
- Fixing the pipe between processes (for SGX)
- Fixing race condition in futex handling in LibOS
- Inheriting epoll handles in forked chilren
- Assigning signal code (now only hard-coding FPE_INTDIV, BUS_ADRERR, SEGV_ACCERR, SEGV_MAPERR)
- Fixing race condition in vma allocation (likely to fix bug() in bookkeep/shim_vma.c)
- Clearer debug message in LibOS
- Fixing calling convention in LibOS and glibc
- Fixing futex behavior (FUTEX_WAIT takes relative time, FUTEX_WAIT_BITSET takes absolute time)
- More system call implemented
- More application working (NGINX)
2017-02-11 09:03:47 -05:00
Chia-Che Tsai 46abc3beea bugfix: snprintf returns wrong # of written characters; and can potentially go overflow 2016-08-23 15:26:27 -04:00
Chia-Che Tsai 1a1e199c79 release v0.4beta
Release of Graphene SGX:
Supporting native Linux application in Intel SGX enclaves.
Most applications are supported. Some features may still be buggy.

Improving portability of Graphene:
Eliminating GCC-ism of the host-generic code.
Easier to port to non-Posix platform (e.g., Windows without Cygwin).
2016-07-19 19:45:55 -04:00
Chia-Che Tsai 3ddaf63709 merge internal patches 2016-03-02 22:34:57 -05:00
Chia-Che Tsai eece099382 1. in printf: va_list might be passed by value; pass by address instead
2. new gcc does not the loop in _DkGetCPUInfo
3. a bug in _DkEventWait where synchronization events aren't handle
   properly.
2016-01-19 22:39:28 -05:00
Chia-Che Tsai b5586bbfc6 release v0.3
- Bugfixes in PAL and SHIM
- Improvement of migration scheme in SHIM, which largely speed up
  forking
- Upgrade glibc to 2.19
- FreeBSD port
- Support OpenJDK, python and R
2015-11-30 08:38:50 -05:00
Chia-Che Tsai 7f19f62f31 beta version 0.2
Plenty of bugfixes for Linux kernel later than 3.5 and Ubuntu later than 10.10.
More organized code to improve portability.
Regression tests for Pal to test completeness of implementation.
2015-05-20 14:15:52 -04:00
Chia-Che Tsai 10c06ad723 The first official release 2014-06-02 12:45:42 -04:00