shim_defs.h 2.9 KB

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