From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: sfr@canb.auug.org.au, jirislaby@gmail.com, nhorman@tuxdriver.com,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-kernel@vger.kernel.org, oleg@redhat.com,
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, James Morris <jmorris@namei.org>,
torvalds@linux-foundation.org, mingo@elte.hu
Subject: Re: [PATCH v3 16/27] PPC: use helpers for rlimits
Date: Sat, 28 Nov 2009 11:19:17 +1100 [thread overview]
Message-ID: <1259367557.2076.11.camel@pasglop> (raw)
In-Reply-To: <1259363167-9347-16-git-send-email-jslaby@suse.cz>
On Sat, 2009-11-28 at 00:05 +0100, Jiri Slaby wrote:
> 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.
>
> I.e. either use newly added rlimit helpers or ACCESS_ONCE if not
> applicable.
Thanks. I have that already queued up.
Cheers,
Ben.
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> 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 | 4 ++--
> arch/powerpc/platforms/cell/spufs/coredump.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c
> index 0d957a4..8df1299 100644
> --- a/arch/powerpc/mm/mmap_64.c
> +++ b/arch/powerpc/mm/mmap_64.c
> @@ -47,7 +47,7 @@ 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 (rlim_get_cur(RLIMIT_STACK) == RLIM_INFINITY)
> return 1;
>
> return sysctl_legacy_va_layout;
> @@ -77,7 +77,7 @@ 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 = rlim_get_cur(RLIMIT_STACK);
>
> 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..4ef1c92 100644
> --- a/arch/powerpc/platforms/cell/spufs/coredump.c
> +++ b/arch/powerpc/platforms/cell/spufs/coredump.c
> @@ -54,7 +54,7 @@ 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 = rlim_get_cur(RLIMIT_CORE);
> ssize_t written;
>
> if (*foffset + nr > limit)
WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: jirislaby@gmail.com, mingo@elte.hu, nhorman@tuxdriver.com,
sfr@canb.auug.org.au, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, marcin.slusarz@gmail.com,
tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
torvalds@linux-foundation.org, oleg@redhat.com,
James Morris <jmorris@namei.org>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev@ozlabs.org
Subject: Re: [PATCH v3 16/27] PPC: use helpers for rlimits
Date: Sat, 28 Nov 2009 11:19:17 +1100 [thread overview]
Message-ID: <1259367557.2076.11.camel@pasglop> (raw)
In-Reply-To: <1259363167-9347-16-git-send-email-jslaby@suse.cz>
On Sat, 2009-11-28 at 00:05 +0100, Jiri Slaby wrote:
> 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.
>
> I.e. either use newly added rlimit helpers or ACCESS_ONCE if not
> applicable.
Thanks. I have that already queued up.
Cheers,
Ben.
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> 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 | 4 ++--
> arch/powerpc/platforms/cell/spufs/coredump.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c
> index 0d957a4..8df1299 100644
> --- a/arch/powerpc/mm/mmap_64.c
> +++ b/arch/powerpc/mm/mmap_64.c
> @@ -47,7 +47,7 @@ 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 (rlim_get_cur(RLIMIT_STACK) == RLIM_INFINITY)
> return 1;
>
> return sysctl_legacy_va_layout;
> @@ -77,7 +77,7 @@ 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 = rlim_get_cur(RLIMIT_STACK);
>
> 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..4ef1c92 100644
> --- a/arch/powerpc/platforms/cell/spufs/coredump.c
> +++ b/arch/powerpc/platforms/cell/spufs/coredump.c
> @@ -54,7 +54,7 @@ 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 = rlim_get_cur(RLIMIT_CORE);
> ssize_t written;
>
> if (*foffset + nr > limit)
next prev parent reply other threads:[~2009-11-28 0:20 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-27 23:05 [PATCH v3 01/27] SECURITY: selinux, fix update_rlimit_cpu parameter Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 02/27] SECURITY: add task_struct to setrlimit Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 03/27] core: add task_struct to update_rlimit_cpu Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 04/27] sys_setrlimit: make sure ->rlim_max never grows Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 05/27] core: split sys_setrlimit Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 06/27] core: allow setrlimit to non-current tasks Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 07/27] core: optimize setrlimit for current task Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 08/27] FS: proc, switch limits reading to fops Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 09/27] FS: proc, make limits writable Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 10/27] core: do security check under task_lock Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 11/27] core: rename setrlimit to do_setrlimit Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 12/27] resource: move kernel functions inside __KERNEL__ Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 13/27] core: posix-cpu-timers, cleanup rlimits usage Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 14/27] resource: add helpers for fetching rlimits Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 15/27] IA64: use helpers for rlimits Jiri Slaby
2009-11-27 23:05 ` Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 16/27] PPC: " Jiri Slaby
2009-11-27 23:05 ` Jiri Slaby
2009-11-28 0:19 ` Benjamin Herrenschmidt [this message]
2009-11-28 0:19 ` Benjamin Herrenschmidt
2009-11-28 8:47 ` Jiri Slaby
2009-11-28 8:47 ` Jiri Slaby
2009-11-28 21:16 ` Benjamin Herrenschmidt
2009-11-28 21:16 ` Benjamin Herrenschmidt
2009-11-29 11:06 ` Stephen Rothwell
2009-11-29 11:06 ` Stephen Rothwell
2009-11-27 23:05 ` [PATCH v3 17/27] S390: " Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 18/27] SPARC: " Jiri Slaby
2009-11-27 23:05 ` Jiri Slaby
2009-11-27 23:05 ` [PATCH v3 19/27] X86: " Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 20/27] FS: " Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 21/27] MM: " Jiri Slaby
2009-11-27 23:06 ` Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 22/27] core: " Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 23/27] misc: " Jiri Slaby
[not found] ` <1259363167-9347-23-git-send-email-jslaby-AlSwsSmVLrQ@public.gmane.org>
2009-12-09 23:59 ` Roland Dreier
2009-12-09 23:59 ` Roland Dreier
[not found] ` <1259363167-9347-1-git-send-email-jslaby-AlSwsSmVLrQ@public.gmane.org>
2009-11-27 23:06 ` Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 24/27] core: implement getprlimit and setprlimit syscalls Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 25/27] unistd: add __NR_[get|set]prlimit syscall numbers Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 26/27] COMPAT: add get/put_compat_rlimit Jiri Slaby
2009-11-27 23:06 ` [PATCH v3 27/27] x86: add ia32 compat prlimit syscalls Jiri Slaby
2009-11-27 23:41 ` [PATCH v3 00/27] writable limits Jiri Slaby
2009-11-28 7:28 ` Ingo Molnar
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=1259367557.2076.11.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=akpm@linux-foundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jirislaby@gmail.com \
--cc=jmorris@namei.org \
--cc=jslaby@suse.cz \
--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=oleg@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.