Commit c5974b83 authored by Linus Torvalds's avatar 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
parents 14107c75 3e10e716
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <linux/time.h> #include <linux/time.h>
struct task_struct;
/* /*
* Resource control/accounting header file for linux * Resource control/accounting header file for linux
*/ */
...@@ -70,6 +68,12 @@ struct rlimit { ...@@ -70,6 +68,12 @@ struct rlimit {
*/ */
#include <asm/resource.h> #include <asm/resource.h>
#ifdef __KERNEL__
struct task_struct;
int getrusage(struct task_struct *p, int who, struct rusage __user *ru); int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
#endif /* __KERNEL__ */
#endif #endif
...@@ -2601,6 +2601,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) ...@@ -2601,6 +2601,28 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
} }
#endif /* CONFIG_MM_OWNER */ #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 /* __KERNEL__ */
#endif #endif
...@@ -2365,7 +2365,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm) ...@@ -2365,7 +2365,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
initrlim = init_task.signal->rlim + i; initrlim = init_task.signal->rlim + i;
rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur); 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment