shim_defs.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef _SHIM_DEFS_H_
  2. #define _SHIM_DEFS_H_
  3. /*
  4. * If enable CPSTORE_DERANDOMIZATION, the library OS will try to
  5. * load the checkpoint (either from the parent or a file) at the
  6. * exact address it was created. Currently this option is disabled
  7. * to prevent internal fragmentation of virtual memory space.
  8. */
  9. #define CPSTORE_DERANDOMIZATION 1
  10. /* This macro disables current vfork implementation and aliases it to fork.
  11. *
  12. * Rationale:
  13. * Current vfork() implementation is broken and works only in simple cases.
  14. * The implementation creates a new thread in the same process and runs it
  15. * in place of the previous (parent) thread which called vfork(). When the
  16. * "pseudo-process" new thread reaches execve(), it silently dies and
  17. * switches execution back to the suspended parent thread (as per vfork
  18. * semantics). Because execve() emulation creates a new host-OS process,
  19. * this vfork implementation works in simple benign cases.
  20. *
  21. * However, this co-existence of the "pseudo-process" thread with threads
  22. * of the parent process leads to bugs elsewhere in Graphene. In general,
  23. * the rest of Graphene is not aware of such situation when two processes
  24. * co-exist in the same Graphene instance and share memory. If the new
  25. * "pseudo-process" thread makes syscalls in-between vfork() and execve()
  26. * or abnormally dies or receives a signal, Graphene may hang or segfault
  27. * or end up with inconsistent internal state.
  28. *
  29. * Therefore, instead of trying to support Linux semantics for vfork() --
  30. * which requires adding corner-cases in signal handling and syscalls --
  31. * we simply redirect vfork() as fork(). We assume that performance hit is
  32. * negligible (Graphene has to migrate internal state anyway which is slow)
  33. * and apps do not rely on insane Linux-specific semantics of vfork().
  34. * */
  35. #define ALIAS_VFORK_AS_FORK 1
  36. #define DEFAULT_HEAP_MIN_SIZE (256 * 1024 * 1024) /* 256MB */
  37. #define DEFAULT_MEM_MAX_NPAGES (1024 * 1024) /* 4GB */
  38. #define DEFAULT_BRK_MAX_SIZE (256 * 1024) /* 256KB */
  39. #define DEFAULT_SYS_STACK_SIZE (256 * 1024) /* 256KB */
  40. #define CP_INIT_VMA_SIZE (64 * 1024 * 1024) /* 64MB */
  41. #define ENABLE_ASLR 1
  42. /* debug message printout */
  43. #define DEBUGBUF_SIZE 256
  44. #define DEBUGBUF_BREAK 0
  45. #define DEFAULT_VMA_COUNT 64
  46. /* System V IPC semaphore / message queue migration */
  47. #define MIGRATE_SYSV_SEM 0
  48. #define MIGRATE_SYSV_MSG 1
  49. /* ELF aux vectors */
  50. #define REQUIRED_ELF_AUXV 8 /* number of LibOS-supported vectors */
  51. #define REQUIRED_ELF_AUXV_SPACE 16 /* extra memory space (in bytes) */
  52. #endif /* _SHIM_DEFS_H_ */