linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Bhupesh Sharma <bhsharma@redhat.com>
Cc: linuxppc-dev@lists.ozlabs.org,
	kernel-hardening@lists.openwall.com,
	linux-kernel@vger.kernel.org,
	Alistair Popple <alistair@popple.id.au>,
	Anatolij Gustschin <agust@denx.de>,
	Kees Cook <keescook@chromium.org>,
	Daniel Cashman <dcashman@android.com>,
	Scott Wood <oss@buserror.net>, Paul Mackerras <paulus@samba.org>,
	Daniel Cashman <dcashman@google.com>,
	Bhupesh SHARMA <bhupesh.linux@gmail.com>,
	Alexander Graf <agraf@suse.com>
Subject: Re: [PATCH v3] powerpc: mm: support ARCH_MMAP_RND_BITS
Date: Thu, 13 Apr 2017 12:28:42 +0530	[thread overview]
Message-ID: <03284709-498c-1e52-40f0-b19d20e56b8e@linux.vnet.ibm.com> (raw)
In-Reply-To: <CACi5LpP5jC7obg57zj2jZUQCoh_Et2rbdQMtthXy3Ksb2Qc4ow@mail.gmail.com>



On Thursday 13 April 2017 12:22 PM, Bhupesh Sharma wrote:
> Hi Aneesh,
>
> On Thu, Apr 13, 2017 at 12:06 PM, Aneesh Kumar K.V
> <aneesh.kumar@linux.vnet.ibm.com> wrote:
>> Bhupesh Sharma <bhsharma@redhat.com> writes:
>>
>>> powerpc arch_mmap_rnd() currently uses hard-coded values - (23-PAGE_SHIFT) for
>>> 32-bit and (30-PAGE_SHIFT) for 64-bit, to generate the random offset
>>> for the mmap base address for a ASLR ELF.
>>>
>>> This patch makes sure that powerpc mmap arch_mmap_rnd() implementation
>>> is similar to other ARCHs (like x86, arm64) and uses mmap_rnd_bits
>>> and helpers to generate the mmap address randomization.
>>>
>>> The maximum and minimum randomization range values represent
>>> a compromise between increased ASLR effectiveness and avoiding
>>> address-space fragmentation.
>>>
>>> Using the Kconfig option and suitable /proc tunable, platform
>>> developers may choose where to place this compromise.
>>>
>>> Also this patch keeps the default values as new minimums.
>>>
>>> Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
>>> Reviewed-by: Kees Cook <keescook@chromium.org>
>>> ---
>>> * Changes since v2:
>>> v2 can be seen here (https://patchwork.kernel.org/patch/9551509/)
>>>     - Changed a few minimum and maximum randomization ranges as per Michael's suggestion.
>>>     - Corrected Kees's email address in the Reviewed-by line.
>>>     - Added further comments in kconfig to explain how the address ranges were worked out.
>>>
>>> * Changes since v1:
>>> v1 can be seen here (https://lists.ozlabs.org/pipermail/linuxppc-dev/2017-February/153594.html)
>>>     - No functional change in this patch.
>>>     - Dropped PATCH 2/2 from v1 as recommended by Kees Cook.
>>>
>>>  arch/powerpc/Kconfig   | 44 ++++++++++++++++++++++++++++++++++++++++++++
>>>  arch/powerpc/mm/mmap.c |  7 ++++---
>>>  2 files changed, 48 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>>> index 97a8bc8..84aae67 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -22,6 +22,48 @@ config MMU
>>>       bool
>>>       default y
>>>
>>> +# min bits determined by the following formula:
>>> +# VA_BITS - PAGE_SHIFT - CONSTANT
>>> +# where,
>>> +#    VA_BITS = 46 bits for 64BIT and 4GB - 1 Page = 31 bits for 32BIT
>>
>>
>> Where did we derive that 46 bits from ? is that based on TASK_SIZE ?
>
> Yes. It was derived from TASK_SIZE :
> http://lxr.free-electrons.com/source/arch/powerpc/include/asm/processor.h#L105
>

That is getting update to 128TB by default and conditionally to 512TB

-aneesh

  reply	other threads:[~2017-04-13  6:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 19:45 [PATCH v3] powerpc: mm: support ARCH_MMAP_RND_BITS Bhupesh Sharma
2017-04-10 17:20 ` Bhupesh Sharma
2017-04-13  6:36 ` Aneesh Kumar K.V
2017-04-13  6:52   ` Bhupesh Sharma
2017-04-13  6:58     ` Aneesh Kumar K.V [this message]
2017-04-13  7:09       ` Balbir Singh
2017-04-17  4:48         ` Bhupesh SHARMA
2017-04-13  7:46       ` Bhupesh Sharma

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=03284709-498c-1e52-40f0-b19d20e56b8e@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=agraf@suse.com \
    --cc=agust@denx.de \
    --cc=alistair@popple.id.au \
    --cc=bhsharma@redhat.com \
    --cc=bhupesh.linux@gmail.com \
    --cc=dcashman@android.com \
    --cc=dcashman@google.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oss@buserror.net \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).