]> Git Repo - J-linux.git/commitdiff
x86: Use helpers for rlimits
authorJiri Slaby <[email protected]>
Wed, 27 Jan 2010 16:32:22 +0000 (17:32 +0100)
committerH. Peter Anvin <[email protected]>
Wed, 27 Jan 2010 23:17:31 +0000 (15:17 -0800)
Make sure compiler won't do weird things with limits.  Fetching them
twice may return 2 different values after writable limits are
implemented.

We can either use rlimit helpers added in
3e10e716abf3c71bdb5d86b8f507f9e72236c9cd or ACCESS_ONCE if not
applicable; this patch uses the helpers.

Signed-off-by: Jiri Slaby <[email protected]>
LKML-Reference: <1264609942[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: H. Peter Anvin <[email protected]>
arch/x86/ia32/ia32_aout.c
arch/x86/mm/mmap.c

index 2a4d073d2cf12124830ddcd2879485c5f61629b0..06474788723f5b9ee31d030f52a07a477779237d 100644 (file)
@@ -297,7 +297,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
         * size limits imposed on them by creating programs with large
         * arrays in the data or bss.
         */
-       rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
+       rlim = rlimit(RLIMIT_DATA);
        if (rlim >= RLIM_INFINITY)
                rlim = ~0;
        if (ex.a_data + ex.a_bss > rlim)
index c8191defc38a36f16ae60245a60f781229169d06..1dab5194fd9df9f6bead4b0e09d154bd2b26e178 100644 (file)
@@ -71,7 +71,7 @@ static int mmap_is_legacy(void)
        if (current->personality & ADDR_COMPAT_LAYOUT)
                return 1;
 
-       if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
+       if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
                return 1;
 
        return sysctl_legacy_va_layout;
@@ -96,7 +96,7 @@ static unsigned long mmap_rnd(void)
 
 static unsigned long mmap_base(void)
 {
-       unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+       unsigned long gap = rlimit(RLIMIT_STACK);
 
        if (gap < MIN_GAP)
                gap = MIN_GAP;
This page took 0.055015 seconds and 4 git commands to generate.