Commit Graph
71 Commits
Author SHA1 Message Date
Simon Gaiser 64e46adcc0 [Makefile] Use generated header dependencies
Fixes #189.
2019-08-14 00:44:17 +02:00
borysp d4ac504842 [Pal] Enable relative manifest path 2019-08-12 20:22:27 -07:00
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 bd2529a039 [Pal/lib] Remove redundant aligned attribute from struct atomic_int 2019-07-30 16:50:34 -07:00
Chia-Che Tsai 6583e69a04 [PAL] Skip trailing whitespaces/comments in manifest files 2019-07-29 18:27:16 -07:00
Isaku Yamahata 4789a3a188 [{shim,Pal}] Refactor Makefiles to utilize Makefile.rules 2019-07-11 07:04:33 +02: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
Isaku Yamahata 08b535f759 [Makefiles] Introduce Makefile.configs for configuration
Introduce Makefile.configs as a single place to allow override
of configuration variables CC, AS, AR, and LD.
2019-06-20 16:21:17 -07:00
Isaku Yamahata ba3da57092 [LibOS,Pal/lib] Add atomic_inc_return, atomic_add_return
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.
2019-06-13 16:20:43 -07:00
Chia-Che Tsai d314707d4c [LibOS] Fix all warnings with -Wsign-compare
Signed-off-by: Chia-Che Tsai <chiache@tamu.edu>
2019-06-12 20:08:38 -05: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
Isaku Yamahata a12b8c0149 [Pal] Enable -Wnull-dereference 2019-05-30 19:05:17 -07:00
Isaku Yamahata 312159dbcb [Pal] Add noreturn function attribute where appropriate 2019-05-30 19:03:43 -07:00
Li Lei f4507c3ddd [Pal/Linux-SGX] Turn on -Wsign-compare and fix the produced warnings 2019-05-30 01:57:43 +02:00
Michał Kowalczyk 16d90cfe12 Fix parenthesizing and formatting of C macros 2019-05-23 19:14:23 +02:00
Michał Kowalczyk d508ce5061 Cleanup and uppercase list.h macros 2019-05-23 19:14:23 +02:00
Michał Kowalczyk 46f553fe5d Cleanup and uppercase C macros 2019-05-23 19:14:23 +02:00
Isaku Yamahata 52e3f9d5d8 [Pal/Lib] Atomics: Remove unnecessary "memory" clobber
In atomic operand, actual modified memory is already specified as "m" or
"+m", so there's no point of having "memory" clobber.
2019-05-19 04:01:01 +02:00
Dmitrii Kuvaiskii 17b3997226 [Pal] Fix htonl/htons() byte-order macro to __BYTE_ORDER 2019-05-13 14:37:27 -07:00
Michał Kowalczyk 2bc2c04194 Remove trailing blanks 2019-05-07 16:32:16 +02:00
Isaku Yamahata c29bcc8c5b [Pal, LibOS] Add missing clobbered "cc" to inline asm 2019-05-01 13:21:30 +02:00
Michał Kowalczyk 17102eab9d Change DkRandomBitsRead interface and fix error checking
Now it returns 0 on success and -PAL_* on error.
2019-04-30 22:26:08 +02:00
Simon Gaiser 205c574ac7 [Pal] Add macro for copying fixed size arrays 2019-04-26 01:06:58 +02:00
Rafał Wojdyła b46496a379 Fix free() to accept NULL pointers 2019-04-12 18:05:30 +02:00
Rafał Wojdyła a05c812aa1 [Pal] Add an assert to memmgr.h 2019-04-12 18:05:30 +02:00
Rafał Wojdyła 6e3fe04482 [Pal] Fix listp_del macro 2019-04-12 18:05:30 +02:00
Simon Gaiser 946a58f338 [Pal] Add %i support to printf 2019-04-09 16:42:11 +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 203a3920fa Fix a regression on exec in trying to repro #59. Remove an assertion that doesn't seem to be doing much good, given that the size is always statically determined in hex2str.
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
2018-11-13 13:02:42 -05:00
Chia-Che Tsai 7f5a4cc87f Allowing concurrent builds of different PALs 2018-10-29 17:23:51 -04: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
Don Porter 1f2360c857 Hex2str clean up and unit testing (#134)
* 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.
2018-06-16 17:31:20 -04: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
Don Porter 75ea0372f6 Error propagation bugfix in PAL initialization (#114)
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()
2017-12-27 16:41:17 -05:00
Chia-Che Tsai 849859809c fix for large files within an SGX enclave (#136)
Replacing some "int" in the code base as "int64_t" or "uint64_t".
2017-12-19 08:57:36 -08: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
Don Porter d04f172e89 Replace the atomics implementation (#83)
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.
2017-12-07 11:30:48 -08:00
Don Porter 62f07c7181 Reimplement directory caching (#78)
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.
2017-12-07 08:51:30 -08:00
Michał Kowalczyk 3a24ad56d4 Add lacking .PHONY to Makefiles (#118) 2017-11-25 08:56:36 +00: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 8add0b94f7 Replace the wolfssl Diffie Hellman implementation with mbedtls (#74)
* Switch to the mbedtls implementation of Diffie Hellman
2017-10-22 15:29:00 +01:00