pal_security.h 3.0 KB

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