pal_security.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Copyright (C) 2014 Stony Brook University
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef PAL_SECURITY_H
  14. #define PAL_SECURITY_H
  15. #include <linux/limits.h>
  16. #include <sysdeps/generic/ldsodefs.h>
  17. #include "pal.h"
  18. /* Rendezvous structure used by the run-time dynamic linker to communicate
  19. details of shared object loading to the debugger. If the executable's
  20. dynamic section has a DT_DEBUG element, the run-time linker sets that
  21. element's value to the address where this structure can be found. */
  22. struct r_debug {
  23. int r_version; /* Version number for this protocol. */
  24. struct link_map* r_map; /* Head of the chain of loaded objects. */
  25. /* This is the address of a function internal to the run-time linker,
  26. that will always be called when the linker begins to map in a
  27. library or unmap it, and again when the mapping change is complete.
  28. The debugger can set a breakpoint at this address if it wants to
  29. notice shared object mapping changes. */
  30. ElfW(Addr) r_brk;
  31. enum {
  32. /* This state value describes the mapping change taking place when
  33. the `r_brk' address is called. */
  34. RT_CONSISTENT, /* Mapping change is complete. */
  35. RT_ADD, /* Beginning to add a new object. */
  36. RT_DELETE /* Beginning to remove an object mapping. */
  37. } r_state;
  38. ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */
  39. };
  40. void pal_dl_debug_state(void);
  41. /* This structure communicates dl state to the debugger. The debugger
  42. normally finds it via the DT_DEBUG entry in the dynamic section, but in
  43. a statically-linked program there is no dynamic section for the debugger
  44. to examine and it looks for this particular symbol name. */
  45. extern struct r_debug pal_r_debug;
  46. symbol_version_default(pal_r_debug, _r_debug, PAL);
  47. extern struct pal_sec {
  48. /* system variables */
  49. unsigned int process_id;
  50. int random_device;
  51. /* pipes and sockets */
  52. unsigned long pipe_prefix_id;
  53. /* for debugger */
  54. void (*_dl_debug_state)(void);
  55. struct r_debug* _r_debug;
  56. } pal_sec;
  57. #define PROC_INIT_FD 255
  58. #define RANDGEN_DEVICE "/dev/urandom"
  59. #endif /* PAL_SECURITY_H */