[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1258555922-2064-5-git-send-email-jslaby@novell.com>
Date: Wed, 18 Nov 2009 15:51:51 +0100
From: Jiri Slaby <jslaby@...ell.com>
To: jirislaby@...il.com
Cc: mingo@...e.hu, nhorman@...driver.com, sfr@...b.auug.org.au,
linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
marcin.slusarz@...il.com, tglx@...utronix.de, mingo@...hat.com,
hpa@...or.com, torvalds@...ux-foundation.org,
Jiri Slaby <jslaby@...ell.com>,
James Morris <jmorris@...ei.org>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
linux390@...ibm.com, linux-s390@...r.kernel.org
Subject: [PATCH 05/16] S390: use ACCESS_ONCE for rlimits
Make sure compiler won't do weird things with limits. E.g. fetching
them twice may return 2 different values after writable limits are
implemented.
Signed-off-by: Jiri Slaby <jslaby@...ell.com>
Cc: James Morris <jmorris@...ei.org>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Martin Schwidefsky <schwidefsky@...ibm.com>
Cc: Heiko Carstens <heiko.carstens@...ibm.com>
Cc: linux390@...ibm.com
Cc: linux-s390@...r.kernel.org
---
arch/s390/mm/mmap.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index f4558cc..90d3216 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -40,7 +40,8 @@
static inline unsigned long mmap_base(void)
{
- unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+ unsigned long gap = ACCESS_ONCE(current->signal->
+ rlim[RLIMIT_STACK].rlim_cur);
if (gap < MIN_GAP)
gap = MIN_GAP;
@@ -59,9 +60,11 @@ static inline int mmap_is_legacy(void)
if (!is_compat_task())
return 1;
#endif
+ if (ACCESS_ONCE(current->signal->rlim[RLIMIT_STACK].rlim_cur) ==
+ RLIM_INFINITY)
+ return 1;
return sysctl_legacy_va_layout ||
- (current->personality & ADDR_COMPAT_LAYOUT) ||
- current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY;
+ (current->personality & ADDR_COMPAT_LAYOUT);
}
#ifndef CONFIG_64BIT
--
1.6.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists