resource.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * AppArmor security module
  4. *
  5. * This file contains AppArmor resource limits function definitions.
  6. *
  7. * Copyright (C) 1998-2008 Novell/SUSE
  8. * Copyright 2009-2010 Canonical Ltd.
  9. */
  10. #ifndef __AA_RESOURCE_H
  11. #define __AA_RESOURCE_H
  12. #include <linux/resource.h>
  13. #include <linux/sched.h>
  14. #include "apparmorfs.h"
  15. struct aa_profile;
  16. /* struct aa_rlimit - rlimit settings for the profile
  17. * @mask: which hard limits to set
  18. * @limits: rlimit values that override task limits
  19. *
  20. * AppArmor rlimits are used to set confined task rlimits. Only the
  21. * limits specified in @mask will be controlled by apparmor.
  22. */
  23. struct aa_rlimit {
  24. unsigned int mask;
  25. struct rlimit limits[RLIM_NLIMITS];
  26. };
  27. extern struct aa_sfs_entry aa_sfs_entry_rlimit[];
  28. int aa_map_resource(int resource);
  29. int aa_task_setrlimit(const struct cred *subj_cred, struct aa_label *label,
  30. struct task_struct *task,
  31. unsigned int resource, struct rlimit *new_rlim);
  32. void __aa_transition_rlimits(struct aa_label *old, struct aa_label *new);
  33. static inline void aa_free_rlimit_rules(struct aa_rlimit *rlims)
  34. {
  35. /* NOP */
  36. }
  37. #endif /* __AA_RESOURCE_H */