pal_security.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 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 Lesser 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 Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser 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. /* system variables */
  50. unsigned int process_id;
  51. int random_device;
  52. /* pipes and sockets */
  53. unsigned long pipe_prefix_id;
  54. unsigned short mcast_port;
  55. /* for debugger */
  56. void (*_dl_debug_state) (void);
  57. struct r_debug * _r_debug;
  58. } pal_sec;
  59. #define PROC_INIT_FD 255
  60. #define RANDGEN_DEVICE "/dev/urandom"
  61. #endif /* PAL_SECURITY_H */