All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] MIPS: Make TASK_SIZE reflect proper size for both 32 and 64 bit processes.
Date: Wed, 13 Oct 2010 15:23:23 +0100	[thread overview]
Message-ID: <20101013142323.GE29127@linux-mips.org> (raw)
In-Reply-To: <1286917316-15849-1-git-send-email-ddaney@caviumnetworks.com>

On Tue, Oct 12, 2010 at 02:01:56PM -0700, David Daney wrote:

> The TASK_SIZE macro should reflect the size of a user process virtual
> address space.  Previously for 64-bit kernels, this was not the case.
> The immediate cause of pain was in
> hugetlbfs/inode.c:hugetlb_get_unmapped_area() where 32-bit processes
> trying to mmap a huge page would be served a page with an address
> outside of the 32-bit address range.  But there are other uses of
> TASK_SIZE in the kernel as well that would like an accurate value.
> 
> The new definition is nice because it now makes TASK_SIZE and
> TASK_SIZE_OF() yield the same value for any given process.
> 
> For 32-bit kernels there should be no change, although I did factor
> out some code in asm/processor.h that became identical for the 32-bit and
> 64-bit cases.
> 
> Another, perhaps non-obvious, change is that in 64-bit kernels, the
> get_fs() value (A.K.A current_thread_info()->addr_limit) will now vary
> depending on the address space size of the process.  This is a change,
> as previously even 32-bit processes would have an addr_limit
> appropriate for a 64-bit process.  This will change the behavior of
> access_ok(), but I think the new behavior is desirable.
> 
> Before the patch it may have been possible for a user space process to
> pass a pointer to the kernel that would pass the access_ok() check,
> but be outside of the 32-bit address space.

That was intensional.  The sole purpose of the access_ok check is to prevent
users from passing kernel addresses to syscalls.  Beyond that we absolutely
don't care.  The creation of mappings above 0x7fff8000 is prevented in the
syscalls themselves but even if that's mechanism should have a hole that
is not a problem for uaccess.h - the protection of the kernel will hold.

  Ralf

      reply	other threads:[~2010-10-13 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 21:01 [PATCH] MIPS: Make TASK_SIZE reflect proper size for both 32 and 64 bit processes David Daney
2010-10-13 14:23 ` Ralf Baechle [this message]

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=20101013142323.GE29127@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.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.