18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * AppArmor security module 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * This file contains AppArmor resource limits function definitions. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (C) 1998-2008 Novell/SUSE 88c2ecf20Sopenharmony_ci * Copyright 2009-2010 Canonical Ltd. 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef __AA_RESOURCE_H 128c2ecf20Sopenharmony_ci#define __AA_RESOURCE_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <linux/resource.h> 158c2ecf20Sopenharmony_ci#include <linux/sched.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include "apparmorfs.h" 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_cistruct aa_profile; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* struct aa_rlimit - rlimit settings for the profile 228c2ecf20Sopenharmony_ci * @mask: which hard limits to set 238c2ecf20Sopenharmony_ci * @limits: rlimit values that override task limits 248c2ecf20Sopenharmony_ci * 258c2ecf20Sopenharmony_ci * AppArmor rlimits are used to set confined task rlimits. Only the 268c2ecf20Sopenharmony_ci * limits specified in @mask will be controlled by apparmor. 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_cistruct aa_rlimit { 298c2ecf20Sopenharmony_ci unsigned int mask; 308c2ecf20Sopenharmony_ci struct rlimit limits[RLIM_NLIMITS]; 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciextern struct aa_sfs_entry aa_sfs_entry_rlimit[]; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciint aa_map_resource(int resource); 368c2ecf20Sopenharmony_ciint aa_task_setrlimit(struct aa_label *label, struct task_struct *task, 378c2ecf20Sopenharmony_ci unsigned int resource, struct rlimit *new_rlim); 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_civoid __aa_transition_rlimits(struct aa_label *old, struct aa_label *new); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cistatic inline void aa_free_rlimit_rules(struct aa_rlimit *rlims) 428c2ecf20Sopenharmony_ci{ 438c2ecf20Sopenharmony_ci /* NOP */ 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#endif /* __AA_RESOURCE_H */ 47