tomoyo.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * security/tomoyo/tomoyo.h
  3. *
  4. * Implementation of the Domain-Based Mandatory Access Control.
  5. *
  6. * Copyright (C) 2005-2009 NTT DATA CORPORATION
  7. *
  8. * Version: 2.2.0 2009/04/01
  9. *
  10. */
  11. #ifndef _SECURITY_TOMOYO_TOMOYO_H
  12. #define _SECURITY_TOMOYO_TOMOYO_H
  13. struct tomoyo_path_info;
  14. struct path;
  15. struct inode;
  16. struct linux_binprm;
  17. struct pt_regs;
  18. int tomoyo_check_exec_perm(struct tomoyo_domain_info *domain,
  19. const struct tomoyo_path_info *filename);
  20. int tomoyo_check_open_permission(struct tomoyo_domain_info *domain,
  21. struct path *path, const int flag);
  22. int tomoyo_check_1path_perm(struct tomoyo_domain_info *domain,
  23. const u8 operation, struct path *path);
  24. int tomoyo_check_2path_perm(struct tomoyo_domain_info *domain,
  25. const u8 operation, struct path *path1,
  26. struct path *path2);
  27. int tomoyo_check_rewrite_permission(struct tomoyo_domain_info *domain,
  28. struct file *filp);
  29. int tomoyo_find_next_domain(struct linux_binprm *bprm);
  30. /* Index numbers for Access Controls. */
  31. #define TOMOYO_TYPE_SINGLE_PATH_ACL 0
  32. #define TOMOYO_TYPE_DOUBLE_PATH_ACL 1
  33. /* Index numbers for File Controls. */
  34. /*
  35. * TYPE_READ_WRITE_ACL is special. TYPE_READ_WRITE_ACL is automatically set
  36. * if both TYPE_READ_ACL and TYPE_WRITE_ACL are set. Both TYPE_READ_ACL and
  37. * TYPE_WRITE_ACL are automatically set if TYPE_READ_WRITE_ACL is set.
  38. * TYPE_READ_WRITE_ACL is automatically cleared if either TYPE_READ_ACL or
  39. * TYPE_WRITE_ACL is cleared. Both TYPE_READ_ACL and TYPE_WRITE_ACL are
  40. * automatically cleared if TYPE_READ_WRITE_ACL is cleared.
  41. */
  42. #define TOMOYO_TYPE_READ_WRITE_ACL 0
  43. #define TOMOYO_TYPE_EXECUTE_ACL 1
  44. #define TOMOYO_TYPE_READ_ACL 2
  45. #define TOMOYO_TYPE_WRITE_ACL 3
  46. #define TOMOYO_TYPE_CREATE_ACL 4
  47. #define TOMOYO_TYPE_UNLINK_ACL 5
  48. #define TOMOYO_TYPE_MKDIR_ACL 6
  49. #define TOMOYO_TYPE_RMDIR_ACL 7
  50. #define TOMOYO_TYPE_MKFIFO_ACL 8
  51. #define TOMOYO_TYPE_MKSOCK_ACL 9
  52. #define TOMOYO_TYPE_MKBLOCK_ACL 10
  53. #define TOMOYO_TYPE_MKCHAR_ACL 11
  54. #define TOMOYO_TYPE_TRUNCATE_ACL 12
  55. #define TOMOYO_TYPE_SYMLINK_ACL 13
  56. #define TOMOYO_TYPE_REWRITE_ACL 14
  57. #define TOMOYO_MAX_SINGLE_PATH_OPERATION 15
  58. #define TOMOYO_TYPE_LINK_ACL 0
  59. #define TOMOYO_TYPE_RENAME_ACL 1
  60. #define TOMOYO_MAX_DOUBLE_PATH_OPERATION 2
  61. #define TOMOYO_DOMAINPOLICY 0
  62. #define TOMOYO_EXCEPTIONPOLICY 1
  63. #define TOMOYO_DOMAIN_STATUS 2
  64. #define TOMOYO_PROCESS_STATUS 3
  65. #define TOMOYO_MEMINFO 4
  66. #define TOMOYO_SELFDOMAIN 5
  67. #define TOMOYO_VERSION 6
  68. #define TOMOYO_PROFILE 7
  69. #define TOMOYO_MANAGER 8
  70. extern struct tomoyo_domain_info tomoyo_kernel_domain;
  71. static inline struct tomoyo_domain_info *tomoyo_domain(void)
  72. {
  73. return current_cred()->security;
  74. }
  75. static inline struct tomoyo_domain_info *tomoyo_real_domain(struct task_struct
  76. *task)
  77. {
  78. return task_cred_xxx(task, security);
  79. }
  80. #endif /* !defined(_SECURITY_TOMOYO_TOMOYO_H) */