Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 309783 Details for
Bug 437214
ulimit -d <size>
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
rlimit test patch
bz437214_rlimit_d.patch (text/plain), 4.16 KB, created by
Linda Wang
on 2008-06-18 19:55:55 UTC
(
hide
)
Description:
rlimit test patch
Filename:
MIME Type:
Creator:
Linda Wang
Created:
2008-06-18 19:55:55 UTC
Size:
4.16 KB
patch
obsolete
>diff -upN linux-2.6.9/mm/mmap.c.orig linux-2.6.9/mm/mmap.c >--- linux-2.6.9/mm/mmap.c.orig 2008-03-18 14:27:44.000000000 +0100 >+++ linux-2.6.9/mm/mmap.c 2008-03-20 16:44:23.000000000 +0100 >@@ -144,10 +144,18 @@ asmlinkage unsigned long sys_brk(unsigne > goto out; > } > >- /* Check against rlimit.. */ >+ /* >+ * Check against private data size limit. Count memory allocations >+ * which are not shared and not executable code as private data. >+ */ > rlim = current->rlim[RLIMIT_DATA].rlim_cur; >- if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim) >- goto out; >+ if (rlim < RLIM_INFINITY) { >+ unsigned long priv_vm; >+ priv_vm = mm->total_vm - mm->shared_vm - mm->exec_vm; >+ priv_vm <<= PAGE_SHIFT; >+ if (priv_vm + (newbrk-oldbrk) > rlim) >+ goto out; >+ } > > /* Check against existing mmap mappings. */ > if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE)) >@@ -759,9 +767,10 @@ void __vm_stat_account(struct mm_struct > } > #endif /* CONFIG_HUGETLB */ > >- if (file) >- mm->shared_vm += pages; >- else if (flags & stack_flags) >+ if (file) { >+ if (flags & VM_SHARED) >+ mm->shared_vm += pages; >+ } else if (flags & stack_flags) > mm->stack_vm += pages; > if (flags & VM_EXEC) > mm->exec_vm += pages; >@@ -927,6 +936,21 @@ munmap_back: > > current->rlim[RLIMIT_AS].rlim_cur) > return -ENOMEM; > >+ /* >+ * Check against private data size limit. Count memory allocations >+ * which are not shared and not executable code as private data. >+ */ >+ if (!(vm_flags & (VM_SHARED|VM_EXEC))) { >+ unsigned long rlim, priv_vm; >+ rlim = current->rlim[RLIMIT_DATA].rlim_cur; >+ if (rlim < RLIM_INFINITY) { >+ priv_vm = mm->total_vm - mm->shared_vm - mm->exec_vm; >+ priv_vm <<= PAGE_SHIFT; >+ if (priv_vm + len > rlim) >+ return -ENOMEM; >+ } >+ } >+ > if (accountable && (!(flags & MAP_NORESERVE) || > sysctl_overcommit_memory == OVERCOMMIT_NEVER)) { > if (vm_flags & VM_SHARED) { >diff -upN linux-2.6.9/mm/mprotect.c.orig linux-2.6.9/mm/mprotect.c >--- linux-2.6.9/mm/mprotect.c.orig 2008-03-18 14:27:30.000000000 +0100 >+++ linux-2.6.9/mm/mprotect.c 2008-03-20 14:05:18.000000000 +0100 >@@ -143,6 +143,22 @@ mprotect_fixup(struct vm_area_struct *vm > } > } > >+ /* >+ * Check against private data size limit. When execute permission >+ * is removed, the mapping is counted toward the private data size. >+ */ >+ if (!(newflags & VM_EXEC) && (vma->vm_flags & VM_EXEC)) { >+ unsigned long rlim; >+ rlim = current->rlim[RLIMIT_DATA].rlim_cur; >+ if (rlim < RLIM_INFINITY) { >+ unsigned long priv_vm; >+ priv_vm = mm->total_vm - mm->shared_vm - mm->exec_vm; >+ priv_vm <<= PAGE_SHIFT; >+ if (priv_vm + (end - start) > rlim) >+ return -ENOMEM; >+ } >+ } >+ > newprot = protection_map[newflags & 0xf]; > > /* >diff -upN linux-2.6.9/mm/mremap.c.orig linux-2.6.9/mm/mremap.c >--- linux-2.6.9/mm/mremap.c.orig 2008-03-18 14:27:21.000000000 +0100 >+++ linux-2.6.9/mm/mremap.c 2008-03-20 14:05:44.000000000 +0100 >@@ -338,6 +338,23 @@ unsigned long do_mremap(unsigned long ad > > current->rlim[RLIMIT_AS].rlim_cur) > goto out; > >+ /* >+ * Check against private data size limit. Count memory allocations >+ * which are not shared and not executable code as private data. >+ */ >+ if (!(vma->vm_flags & (VM_EXEC|VM_SHARED))) { >+ unsigned long rlim; >+ rlim = current->rlim[RLIMIT_DATA].rlim_cur; >+ if (rlim < RLIM_INFINITY) { >+ unsigned long priv_vm; >+ struct mm_struct *mm = current->mm; >+ priv_vm = mm->total_vm - mm->shared_vm - mm->exec_vm; >+ priv_vm <<= PAGE_SHIFT; >+ if (priv_vm + (new_len - old_len) > rlim) >+ goto out; >+ } >+ } >+ > if (vma->vm_flags & VM_ACCOUNT) { > charged = (new_len - old_len) >> PAGE_SHIFT; > if (security_vm_enough_memory(charged)) >diff -upN linux-2.6.9/fs/proc/task_mmu.c.orig linux-2.6.9/fs/proc/task_mmu.c >--- linux-2.6.9/fs/proc/task_mmu.c.orig 2008-03-18 14:27:40.000000000 +0100 >+++ linux-2.6.9/fs/proc/task_mmu.c 2008-03-18 15:45:20.000000000 +0100 >@@ -12,7 +12,7 @@ char *task_mem(struct mm_struct *mm, cha > { > unsigned long data, text, lib; > >- data = mm->total_vm - mm->shared_vm - mm->stack_vm; >+ data = mm->total_vm - mm->shared_vm - mm->stack_vm - mm->exec_vm; > text = (mm->end_code - mm->start_code) >> 10; > lib = (mm->exec_vm << (PAGE_SHIFT-10)) - text; > buffer += sprintf(buffer,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 437214
: 309783