pal_security.h 3.2 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 "pal.h"
  18. #define PATH_MAX 80
  19. #define PIPE_MAX 32
  20. struct link_gdb_map;
  21. /* Rendezvous structure used by the run-time dynamic linker to communicate
  22. details of shared object loading to the debugger. If the executable's
  23. dynamic section has a DT_DEBUG element, the run-time linker sets that
  24. element's value to the address where this structure can be found. */
  25. struct r_debug {
  26. int r_version; /* Version number for this protocol. */
  27. struct link_map * r_map; /* Head of the chain of loaded objects. */
  28. /* This is the address of a function internal to the run-time linker,
  29. that will always be called when the linker begins to map in a
  30. library or unmap it, and again when the mapping change is complete.
  31. The debugger can set a breakpoint at this address if it wants to
  32. notice shared object mapping changes. */
  33. void (*r_brk) (struct r_debug *, struct link_gdb_map *);
  34. enum {
  35. /* This state value describes the mapping change taking place when
  36. the `r_brk' address is called. */
  37. RT_CONSISTENT, /* Mapping change is complete. */
  38. RT_ADD, /* Beginning to add a new object. */
  39. RT_DELETE /* Beginning to remove an object mapping. */
  40. } r_state;
  41. };
  42. void pal_r_debug_state (struct r_debug *, struct link_gdb_map *);
  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 int domain_id;
  50. char pipe_prefix[PIPE_MAX];
  51. void * user_addr_base;
  52. int rand_gen;
  53. unsigned short mcast_port;
  54. void (*r_debug_state) (struct r_debug *,
  55. struct link_gdb_map *);
  56. struct r_debug * r_debug;
  57. } pal_sec;
  58. #define GRAPHENE_TEMPDIR "/tmp/graphene"
  59. #define GRAPHENE_PIPEDIR GRAPHENE_TEMPDIR "/pipes"
  60. #define PROC_INIT_FD 255
  61. #define GRAPHENE_MCAST_GROUP "239.0.0.1"
  62. #endif /* PAL_SECURITY_H */