提交 c5974b83 编写于 作者: L Linus Torvalds

Merge branch 'limits_cleanup' of git://decibel.fi.muni.cz/~xslaby/linux

* 'limits_cleanup' of git://decibel.fi.muni.cz/~xslaby/linux:
  resource: add helpers for fetching rlimits
  resource: move kernel function inside __KERNEL__
  SECURITY: selinux, fix update_rlimit_cpu parameter
......@@ -3,8 +3,6 @@
#include <linux/time.h>
struct task_struct;
/*
* Resource control/accounting header file for linux
*/
......@@ -70,6 +68,12 @@ struct rlimit {
*/
#include <asm/resource.h>
#ifdef __KERNEL__
struct task_struct;
int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
#endif /* __KERNEL__ */
#endif
......@@ -2601,6 +2601,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
}
#endif /* CONFIG_MM_OWNER */
static inline unsigned long task_rlimit(const struct task_struct *tsk,
unsigned int limit)
{
return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur);
}
static inline unsigned long task_rlimit_max(const struct task_struct *tsk,
unsigned int limit)
{
return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max);
}
static inline unsigned long rlimit(unsigned int limit)
{
return task_rlimit(current, limit);
}
static inline unsigned long rlimit_max(unsigned int limit)
{
return task_rlimit_max(current, limit);
}
#endif /* __KERNEL__ */
#endif
......@@ -2365,7 +2365,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
initrlim = init_task.signal->rlim + i;
rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
}
update_rlimit_cpu(rlim->rlim_cur);
update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册