- patches.suse/rlim-0001-SECURITY-selinux-fix-update_rlimit_cpu-parameter.patch:
Refresh.
- patches.suse/rlim-0002-resource-move-kernel-function-inside-__KERNEL__.patch:
resource: move kernel function inside __KERNEL__ (FATE#305733).
- patches.suse/rlim-0003-resource-add-helpers-for-fetching-rlimits.patch:
resource: add helpers for fetching rlimits (FATE#305733).
- patches.suse/rlim-0004-IA64-use-helpers-for-rlimits.patch:
[IA64] use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0005-core-posix-cpu-timers-cleanup-rlimits-usage.patch:
core: posix-cpu-timers, cleanup rlimits usage (FATE#305733).
- patches.suse/rlim-0006-PPC-use-helpers-for-rlimits.patch: PPC:
use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0007-S390-use-helpers-for-rlimits.patch:
S390: use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0008-SPARC-use-helpers-for-rlimits.patch:
SPARC: use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0009-X86-use-helpers-for-rlimits.patch: X86:
use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0010-FS-use-helpers-for-rlimits.patch: FS:
use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0011-MM-use-helpers-for-rlimits.patch: MM:
use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0012-core-use-helpers-for-rlimits.patch:
core: use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0013-infiniband-use-helpers-for-rlimits.patch:
infiniband: use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0014-ipc-use-helpers-for-rlimits.patch: ipc:
use helpers for rlimits (FATE#305733).
- patches.suse/rlim-0015-SECURITY-add-task_struct-to-setrlimit.patch:
SECURITY: add task_struct to setrlimit (FATE#305733).
- patches.suse/rlim-0016-core-add-task_struct-to-update_rlimit_cpu.patch:
core: add task_struct to update_rlimit_cpu (FATE#305733).
- patches.suse/rlim-0017-sys_setrlimit-make-sure-rlim_max-never-grows.patch:
sys_setrlimit: make sure ->rlim_max never grows (FATE#305733).
- patches.suse/rlim-0018-core-split-sys_setrlimit.patch: core:
split sys_setrlimit (FATE#305733).
- patches.suse/rlim-0019-core-allow-setrlimit-to-non-current-tasks.patch:
core: allow setrlimit to non-current tasks (FATE#305733).
- patches.suse/rlim-0020-core-optimize-setrlimit-for-current-task.patch:
core: optimize setrlimit for current task (FATE#305733).
- patches.suse/rlim-0021-FS-proc-switch-limits-reading-to-fops.patch:
FS: proc, switch limits reading to fops (FATE#305733).
- patches.suse/rlim-0022-FS-proc-make-limits-writable.patch:
FS: proc, make limits writable (FATE#305733).
- patches.suse/rlim-0023-core-do-security-check-under-task_lock.patch:
core: do security check under task_lock (FATE#305733).
- patches.suse/rlim-0002-SECURITY-add-task_struct-to-setrlimit.patch:
Delete.
- patches.suse/rlim-0003-core-add-task_struct-to-update_rlimit_cpu.patch:
Delete.
- patches.suse/rlim-0004-sys_setrlimit-make-sure-rlim_max-never-grows.patch:
Delete.
- patches.suse/rlim-0005-core-split-sys_setrlimit.patch: Delete.
- patches.suse/rlim-0006-core-allow-setrlimit-to-non-current-tasks.patch:
Delete.
- patches.suse/rlim-0007-core-optimize-setrlimit-for-current-task.patch:
Delete.
- patches.suse/rlim-0008-FS-proc-make-limits-writable.patch:
Delete.
- patches.suse/rlim-0009-core-posix-cpu-timers-cleanup-rlimits-usage.patch:
Delete.
- patches.suse/rlim-0010-core-do-security-check-under-task_lock.patch:
Delete.
- patches.suse/rlim-0011-resource-add-helpers-for-fetching-rlimits.patch:
Delete.
- patches.suse/rlim-0012-IA64-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0013-PPC-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0014-S390-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0015-SPARC-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0016-X86-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0017-FS-use-helpers-for-rlimits.patch: Delete.
- patches.suse/rlim-0018-MM-use-helpers-for-rlimits.patch: Delete.
- patches.suse/rlim-0019-core-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0020-misc-use-helpers-for-rlimits.patch:
Delete.
- patches.suse/rlim-0021-core-rename-setrlimit-to-do_setrlimit.patch:
Delete.
- patches.suse/rlim-0022-core-implement-getprlimit-and-setprlimit-syscalls.patch:
Delete.
- patches.suse/rlim-0023-unistd-add-__NR_-get-set-prlimit-syscall-numbers.patch:
Delete.
- patches.suse/rlim-0024-COMPAT-add-get-put_compat_rlimit.patch:
Delete.
- patches.suse/rlim-0025-x86-add-ia32-compat-prlimit-syscalls.patch:
Delete.
Sync with upstream. Drop limits syscalls altogether.
suse-commit:
1445f51813f12ddfcb4c1b091d625cf036f76b1b
goto out;
/* Check against rlimit.. */
- rlim = rlim_get_cur(RLIMIT_DATA);
+ rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
goto out;
inline void
ia64_set_rbs_bot (void)
{
- unsigned long stack_size = rlim_get_max(RLIMIT_STACK) & -16;
+ unsigned long stack_size = rlimit_max(RLIMIT_STACK) & -16;
if (stack_size > MAX_USER_STACK_SIZE)
stack_size = MAX_USER_STACK_SIZE;
if (current->personality & ADDR_COMPAT_LAYOUT)
return 1;
- if (rlim_get_cur(RLIMIT_STACK) == RLIM_INFINITY)
+ if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
return 1;
return sysctl_legacy_va_layout;
static inline unsigned long mmap_base(void)
{
- unsigned long gap = rlim_get_cur(RLIMIT_STACK);
+ unsigned long gap = rlimit(RLIMIT_STACK);
if (gap < MIN_GAP)
gap = MIN_GAP;
*/
static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
{
- unsigned long limit = rlim_get_cur(RLIMIT_CORE);
+ unsigned long limit = rlimit(RLIMIT_CORE);
ssize_t written;
if (*foffset + nr > limit)
static inline unsigned long mmap_base(void)
{
- unsigned long gap = rlim_get_cur(RLIMIT_STACK);
+ unsigned long gap = rlimit(RLIMIT_STACK);
if (gap < MIN_GAP)
gap = MIN_GAP;
#endif
return sysctl_legacy_va_layout ||
(current->personality & ADDR_COMPAT_LAYOUT) ||
- rlim_get_cur(RLIMIT_STACK) == RLIM_INFINITY;
+ rlimit(RLIMIT_STACK) == RLIM_INFINITY;
}
#ifndef CONFIG_64BIT
* Fall back to the standard layout if the personality
* bit is set, or if the expected stack growth is unlimited:
*/
- gap = rlim_get_cur(RLIMIT_STACK);
+ gap = rlimit(RLIMIT_STACK);
if (!test_thread_flag(TIF_32BIT) ||
(current->personality & ADDR_COMPAT_LAYOUT) ||
gap == RLIM_INFINITY ||
* size limits imposed on them by creating programs with large
* arrays in the data or bss.
*/
- rlim = rlim_get_cur(RLIMIT_DATA);
+ rlim = rlimit(RLIMIT_DATA);
if (rlim >= RLIM_INFINITY)
rlim = ~0;
if (ex.a_data + ex.a_bss > rlim)
if (current->personality & ADDR_COMPAT_LAYOUT)
return 1;
- if (rlim_get_cur(RLIMIT_STACK)
- == RLIM_INFINITY)
+ if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
return 1;
return sysctl_legacy_va_layout;
static unsigned long mmap_base(void)
{
- unsigned long gap =
- rlim_get_cur(RLIMIT_STACK);
+ unsigned long gap = rlimit(RLIMIT_STACK);
if (gap < MIN_GAP)
gap = MIN_GAP;
down_write(¤t->mm->mmap_sem);
locked = npages + current->mm->locked_vm;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
+ lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
if ((locked > lock_limit) && !capable(CAP_IPC_LOCK)) {
ret = -ENOMEM;
size_t got;
int ret;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
+ lock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;
if (num_pages > lock_limit) {
ret = -ENOMEM;
if (inode->i_size < offset) {
unsigned long limit;
- limit = rlim_get_cur(RLIMIT_FSIZE);
+ limit = rlimit(RLIMIT_FSIZE);
if (limit != RLIM_INFINITY && offset > limit)
goto out_sig;
if (offset > inode->i_sb->s_maxbytes)
* size limits imposed on them by creating programs with large
* arrays in the data or bss.
*/
- rlim = rlim_get_cur(RLIMIT_DATA);
+ rlim = rlimit(RLIMIT_DATA);
if (rlim >= RLIM_INFINITY)
rlim = ~0;
if (ex.a_data + ex.a_bss > rlim)
* size limits imposed on them by creating programs with large
* arrays in the data or bss.
*/
- rlim = rlim_get_cur(RLIMIT_DATA);
+ rlim = rlimit(RLIMIT_DATA);
if (rlim >= RLIM_INFINITY)
rlim = ~0;
if (data_len + bss_len > rlim) {
#ifdef CONFIG_STACK_GROWSUP
/* Limit stack size to 1GB */
- stack_base = rlim_get_max(RLIMIT_STACK);
+ stack_base = rlimit_max(RLIMIT_STACK);
if (stack_base > (1 << 30))
stack_base = 1 << 30;
/* core limit size */
case 'c':
rc = snprintf(out_ptr, out_end - out_ptr,
- "%lu", rlim_get_cur(RLIMIT_CORE));
+ "%lu", rlimit(RLIMIT_CORE));
if (rc > out_end - out_ptr)
goto out;
out_ptr += rc;
int retval = 0;
int flag = 0;
int ispipe = 0;
- unsigned long core_limit = rlim_get_cur(RLIMIT_CORE);
+ unsigned long core_limit = rlimit(RLIMIT_CORE);
char **helper_argv = NULL;
int helper_argc = 0;
int dump_count = 0;
switch (cmd) {
case F_DUPFD:
case F_DUPFD_CLOEXEC:
- if (arg >= rlim_get_cur(RLIMIT_NOFILE))
+ if (arg >= rlimit(RLIMIT_NOFILE))
break;
err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
if (err >= 0) {
* N.B. For clone tasks sharing a files structure, this test
* will limit the total number of files that can be opened.
*/
- if (nr >= rlim_get_cur(RLIMIT_NOFILE))
+ if (nr >= rlimit(RLIMIT_NOFILE))
return -EMFILE;
/* Do we need to expand? */
collect_sigign_sigcatch(p, &ignored, &caught);
num_threads = atomic_read(&p->signal->count);
qsize = atomic_read(&__task_cred(p)->user->sigpending);
- qlim = task_rlim_get_cur(p, RLIMIT_SIGPENDING);
+ qlim = task_rlimit(p, RLIMIT_SIGPENDING);
unlock_task_sighand(p, &flags);
}
NULL, &proc_single_file_operations, \
{ .proc_show = show } )
-static ssize_t proc_info_read(struct file * file, char __user * buf,
- size_t count, loff_t *ppos);
/*
* Count the number of hardlinks for the pid_entry table, excluding the .
* and .. links.
};
/* Display limits for a process */
-static int proc_pid_limits(struct task_struct *task, char *buffer)
+static ssize_t limits_read(struct file *file, char __user *buf, size_t rcount,
+ loff_t *ppos)
{
- unsigned int i;
- int count = 0;
- unsigned long flags;
- char *bufptr = buffer;
-
struct rlimit rlim[RLIM_NLIMITS];
+ struct task_struct *task;
+ unsigned long flags;
+ unsigned int i;
+ ssize_t count = 0;
+ char *bufptr;
- if (!lock_task_sighand(task, &flags))
+ task = get_proc_task(file->f_path.dentry->d_inode);
+ if (!task)
+ return -ESRCH;
+ if (!lock_task_sighand(task, &flags)) {
+ put_task_struct(task);
return 0;
+ }
memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
unlock_task_sighand(task, &flags);
+ put_task_struct(task);
+
+ bufptr = (char *)__get_free_page(GFP_TEMPORARY);
+ if (!bufptr)
+ return -ENOMEM;
/*
* print the file header
count += sprintf(&bufptr[count], "\n");
}
+ count = simple_read_from_buffer(buf, rcount, ppos, bufptr, count);
+
+ free_page((unsigned long)bufptr);
+
return count;
}
}
static const struct file_operations proc_pid_limits_operations = {
- .read = proc_info_read,
- .write = limits_write,
+ .read = limits_read,
+ .write = limits_write,
};
#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
INF("auxv", S_IRUSR, proc_pid_auxv),
ONE("status", S_IRUGO, proc_pid_status),
ONE("personality", S_IRUSR, proc_pid_personality),
- NOD("limits", S_IFREG|S_IRUSR|S_IWUSR, NULL,
- &proc_pid_limits_operations,
- { .proc_read = proc_pid_limits }),
+ REG("limits", S_IRUSR|S_IWUSR, proc_pid_limits_operations),
#ifdef CONFIG_SCHED_DEBUG
REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
#endif
INF("auxv", S_IRUSR, proc_pid_auxv),
ONE("status", S_IRUGO, proc_pid_status),
ONE("personality", S_IRUSR, proc_pid_personality),
- NOD("limits", S_IFREG|S_IRUSR|S_IWUSR, NULL,
- &proc_pid_limits_operations,
- { .proc_read = proc_pid_limits }),
+ REG("limits", S_IRUSR|S_IWUSR, proc_pid_limits_operations),
#ifdef CONFIG_SCHED_DEBUG
REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
#endif
struct poll_list *walk = head;
unsigned long todo = nfds;
- if (nfds > rlim_get_cur(RLIMIT_NOFILE))
+ if (nfds > rlimit(RLIMIT_NOFILE))
return -EINVAL;
len = min_t(unsigned int, nfds, N_STACK_PPS);
#include <linux/time.h>
-struct task_struct;
-
/*
* Resource control/accounting header file for linux
*/
*/
#include <asm/resource.h>
+#ifdef __KERNEL__
+
+struct task_struct;
+
int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
int do_setrlimit(struct task_struct *tsk, unsigned int resource,
struct rlimit *new_rlim);
+#endif /* __KERNEL__ */
+
#endif
}
#endif /* CONFIG_MM_OWNER */
-static inline unsigned long task_rlim_get_cur(const struct task_struct *tsk,
+#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
+
+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_rlim_get_max(const struct task_struct *tsk,
+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 rlim_get_cur(unsigned int limit)
+static inline unsigned long rlimit(unsigned int limit)
{
- return task_rlim_get_cur(current, limit);
+ return task_rlimit(current, limit);
}
-static inline unsigned long rlim_get_max(unsigned int limit)
+static inline unsigned long rlimit_max(unsigned int limit)
{
- return task_rlim_get_max(current, limit);
+ return task_rlimit_max(current, limit);
}
-#define TASK_STATE_TO_CHAR_STR "RSDTtZX"
-
#endif /* __KERNEL__ */
#endif
asmlinkage long sys_getrlimit(unsigned int resource,
struct rlimit __user *rlim);
-asmlinkage long sys_getprlimit(pid_t pid, unsigned int resource,
- struct rlimit __user *rlim);
#if defined(COMPAT_RLIM_OLD_INFINITY) || !(defined(CONFIG_IA64))
asmlinkage long sys_old_getrlimit(unsigned int resource, struct rlimit __user *rlim);
#endif
asmlinkage long sys_setrlimit(unsigned int resource,
struct rlimit __user *rlim);
-asmlinkage long sys_setprlimit(pid_t pid, unsigned int resource,
- struct rlimit __user *rlim);
asmlinkage long sys_getrusage(int who, struct rusage __user *ru);
asmlinkage long sys_umask(int mask);
spin_lock(&mq_lock);
if (u->mq_bytes + mq_bytes < u->mq_bytes ||
u->mq_bytes + mq_bytes >
- task_rlim_get_cur(p, RLIMIT_MSGQUEUE)) {
+ task_rlimit(p, RLIMIT_MSGQUEUE)) {
spin_unlock(&mq_lock);
goto out_inode;
}
if (euid != shp->shm_perm.uid &&
euid != shp->shm_perm.cuid)
goto out_unlock;
- if (cmd == SHM_LOCK && !rlim_get_cur(RLIMIT_MEMLOCK))
+ if (cmd == SHM_LOCK && !rlimit(RLIMIT_MEMLOCK))
goto out_unlock;
}
#endif
retval = -EAGAIN;
if (atomic_read(&p->real_cred->user->processes) >=
- task_rlim_get_cur(p, RLIMIT_NPROC)) {
+ task_rlimit(p, RLIMIT_NPROC)) {
if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
p->real_cred->user != INIT_USER)
goto bad_fork_free;
if (user_locked > user_lock_limit)
extra = user_locked - user_lock_limit;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
lock_limit >>= PAGE_SHIFT;
locked = vma->vm_mm->locked_vm + extra;
* If the RLIMIT_CPU timer will expire before the
* ITIMER_PROF timer, we have nothing else to do.
*/
- if (task_rlim_get_cur(tsk, RLIMIT_CPU)
+ if (task_rlimit(tsk, RLIMIT_CPU)
< cputime_to_secs(*newval))
return;
}
/* convert nice value [19,-20] to rlimit style value [1,40] */
int nice_rlim = 20 - nice;
- return (nice_rlim <= task_rlim_get_cur(p, RLIMIT_NICE) ||
+ return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) ||
capable(CAP_SYS_NICE));
}
if (!lock_task_sighand(p, &flags))
return -ESRCH;
- rlim_rtprio = task_rlim_get_cur(p, RLIMIT_RTPRIO);
+ rlim_rtprio = task_rlimit(p, RLIMIT_RTPRIO);
unlock_task_sighand(p, &flags);
/* can't set/change the rt policy */
return;
/* max may change after cur was read, this will be fixed next tick */
- soft = task_rlim_get_cur(p, RLIMIT_RTTIME);
- hard = task_rlim_get_max(p, RLIMIT_RTTIME);
+ soft = task_rlimit(p, RLIMIT_RTTIME);
+ hard = task_rlimit_max(p, RLIMIT_RTTIME);
if (soft != RLIM_INFINITY) {
unsigned long next;
atomic_inc(&user->sigpending);
if (override_rlimit ||
atomic_read(&user->sigpending) <=
- task_rlim_get_cur(t, RLIMIT_SIGPENDING))
+ task_rlimit(t, RLIMIT_SIGPENDING))
q = kmem_cache_alloc(sigqueue_cachep, flags);
if (unlikely(q == NULL)) {
atomic_dec(&user->sigpending);
return -EINVAL;
}
- if (atomic_read(&new_user->processes) >= rlim_get_cur(RLIMIT_NPROC) &&
+ if (atomic_read(&new_user->processes) >= rlimit(RLIMIT_NPROC) &&
new_user != INIT_USER) {
free_uid(new_user);
return -EAGAIN;
}
}
-static int check_prlimit_permission(struct task_struct *task)
-{
- const struct cred *cred = current_cred(), *tcred;
- int ret = 0;
-
- rcu_read_lock();
- tcred = __task_cred(task);
- if ((cred->uid != tcred->euid ||
- cred->uid != tcred->suid ||
- cred->uid != tcred->uid ||
- cred->gid != tcred->egid ||
- cred->gid != tcred->sgid ||
- cred->gid != tcred->gid) &&
- !capable(CAP_SYS_RESOURCE)) {
- ret = -EPERM;
- }
- rcu_read_unlock();
- return ret;
-}
-
-SYSCALL_DEFINE3(getprlimit, pid_t, pid, unsigned int, resource,
- struct rlimit __user *, rlim)
-{
- struct rlimit val;
- struct task_struct *tsk;
- int ret;
-
- if (resource >= RLIM_NLIMITS)
- return -EINVAL;
-
- read_lock(&tasklist_lock);
-
- tsk = find_task_by_vpid(pid);
- if (!tsk || !tsk->sighand) {
- ret = -ESRCH;
- goto err_unlock;
- }
-
- ret = check_prlimit_permission(tsk);
- if (ret)
- goto err_unlock;
-
- task_lock(tsk->group_leader);
- val = tsk->signal->rlim[resource];
- task_unlock(tsk->group_leader);
-
- read_unlock(&tasklist_lock);
-
- return copy_to_user(rlim, &val, sizeof(*rlim)) ? -EFAULT : 0;
-err_unlock:
- read_unlock(&tasklist_lock);
- return ret;
-}
-
-
#ifdef __ARCH_WANT_SYS_OLD_GETRLIMIT
/*
struct rlimit *old_rlim;
int retval = 0;
+ if (resource >= RLIM_NLIMITS)
+ return -EINVAL;
if (new_rlim->rlim_cur > new_rlim->rlim_max)
return -EINVAL;
if (resource == RLIMIT_NOFILE && new_rlim->rlim_max > sysctl_nr_open)
{
struct rlimit new_rlim;
- if (resource >= RLIM_NLIMITS)
- return -EINVAL;
if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
return -EFAULT;
return do_setrlimit(current, resource, &new_rlim);
}
-SYSCALL_DEFINE3(setprlimit, pid_t, pid, unsigned int, resource,
- struct rlimit __user *, rlim)
-{
- struct task_struct *tsk;
- struct rlimit new_rlim;
- int ret;
-
- if (resource >= RLIM_NLIMITS)
- return -EINVAL;
-
- if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
- return -EFAULT;
-
- rcu_read_lock();
- tsk = find_task_by_vpid(pid);
- if (!tsk) {
- rcu_read_unlock();
- return -ESRCH;
- }
- get_task_struct(tsk);
- rcu_read_unlock();
-
- ret = check_prlimit_permission(tsk);
- if (!ret)
- ret = do_setrlimit(tsk, resource, &new_rlim);
-
- put_task_struct(tsk);
-
- return ret;
-}
-
/*
* It would make sense to put struct rusage in the task_struct,
* except that would make the task_struct be *really big*. After
inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk)
{
struct inode *inode = file->f_mapping->host;
- unsigned long limit = rlim_get_cur(RLIMIT_FSIZE);
+ unsigned long limit = rlimit(RLIMIT_FSIZE);
if (unlikely(*pos < 0))
return -EINVAL;
{
if (capable(CAP_IPC_LOCK))
return 1;
- if (rlim_get_cur(RLIMIT_MEMLOCK) != 0)
+ if (rlimit(RLIMIT_MEMLOCK) != 0)
return 1;
return 0;
}
locked = len >> PAGE_SHIFT;
locked += current->mm->locked_vm;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
lock_limit >>= PAGE_SHIFT;
/* check against resource limits */
down_write(¤t->mm->mmap_sem);
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
lock_limit >>= PAGE_SHIFT;
ret = -ENOMEM;
int allowed = 0;
locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
if (lock_limit == RLIM_INFINITY)
allowed = 1;
lock_limit >>= PAGE_SHIFT;
* segment grow beyond its set limit the in case where the limit is
* not page aligned -Ram Gupta
*/
- rlim = rlim_get_cur(RLIMIT_DATA);
+ rlim = rlimit(RLIMIT_DATA);
if (rlim < RLIM_INFINITY && (brk - mm->start_brk) +
(mm->end_data - mm->start_data) > rlim)
goto out;
unsigned long locked, lock_limit;
locked = len >> PAGE_SHIFT;
locked += mm->locked_vm;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
lock_limit >>= PAGE_SHIFT;
if (locked > lock_limit && !capable(CAP_IPC_LOCK))
return -EAGAIN;
unsigned long locked, lock_limit;
locked = len >> PAGE_SHIFT;
locked += mm->locked_vm;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
lock_limit >>= PAGE_SHIFT;
if (locked > lock_limit && !capable(CAP_IPC_LOCK))
return -EAGAIN;
unsigned long cur = mm->total_vm; /* pages */
unsigned long lim;
- lim = rlim_get_cur(RLIMIT_AS) >> PAGE_SHIFT;
+ lim = rlimit(RLIMIT_AS) >> PAGE_SHIFT;
if (cur + npages > lim)
return 0;
if (vma->vm_flags & VM_LOCKED) {
unsigned long locked, lock_limit;
locked = mm->locked_vm << PAGE_SHIFT;
- lock_limit = rlim_get_cur(RLIMIT_MEMLOCK);
+ lock_limit = rlimit(RLIMIT_MEMLOCK);
locked += new_len - old_len;
ret = -EAGAIN;
if (locked > lock_limit && !capable(CAP_IPC_LOCK))
locked = mm->locked_vm << PAGE_SHIFT;
locked += size;
- if (locked > rlim_get_cur(RLIMIT_MEMLOCK)) {
+ if (locked > rlimit(RLIMIT_MEMLOCK)) {
PFM_DBG("RLIMIT_MEMLOCK reached ask_locked=%lu rlim_cur=%lu",
locked,
- rlim_get_cur(RLIMIT_MEMLOCK));
+ rlimit(RLIMIT_MEMLOCK));
up_write(&mm->mmap_sem);
mmput(mm);