From: Jiri Slaby <jslaby@novell.com>
To: jirislaby@gmail.com
Cc: sfr@canb.auug.org.au, Jiri Slaby <jslaby@novell.com>,
nhorman@tuxdriver.com, Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>,
linuxppc-dev@ozlabs.org, mingo@redhat.com, tglx@linutronix.de,
marcin.slusarz@gmail.com, hpa@zytor.com,
Paul Mackerras <paulus@samba.org>,
akpm@linux-foundation.org, torvalds@linux-foundation.org,
mingo@elte.hu
Subject: [PATCH 04/16] PPC: use ACCESS_ONCE for rlimits
Date: Wed, 18 Nov 2009 15:51:50 +0100 [thread overview]
Message-ID: <1258555922-2064-4-git-send-email-jslaby@novell.com> (raw)
In-Reply-To: <4B040A03.2020508@gmail.com>
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@novell.com>
Cc: James Morris <jmorris@namei.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
---
arch/powerpc/mm/mmap_64.c | 6 ++++--
arch/powerpc/platforms/cell/spufs/coredump.c | 3 ++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c
index 0d957a4..e96a5f6 100644
--- a/arch/powerpc/mm/mmap_64.c
+++ b/arch/powerpc/mm/mmap_64.c
@@ -47,7 +47,8 @@ static inline int mmap_is_legacy(void)
if (current->personality & ADDR_COMPAT_LAYOUT)
return 1;
- if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
+ if (ACCESS_ONCE(current->signal->rlim[RLIMIT_STACK].rlim_cur) ==
+ RLIM_INFINITY)
return 1;
return sysctl_legacy_va_layout;
@@ -77,7 +78,8 @@ static unsigned long mmap_rnd(void)
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;
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index c4d4a19..2abf290 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -54,7 +54,8 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer,
*/
static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset)
{
- unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
+ unsigned long limit = ACCESS_ONCE(current->signal->
+ rlim[RLIMIT_CORE].rlim_cur);
ssize_t written;
if (*foffset + nr > limit)
--
1.6.4.2
parent reply other threads:[~2009-11-18 15:00 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <4B040A03.2020508@gmail.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1258555922-2064-4-git-send-email-jslaby@novell.com \
--to=jslaby@novell.com \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jirislaby@gmail.com \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=marcin.slusarz@gmail.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=nhorman@tuxdriver.com \
--cc=paulus@samba.org \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox