All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: Balbir Singh <bsingharora@gmail.com>,
	"linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>,
	Bhupesh Sharma <bhsharma@redhat.com>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>
Subject: Re: [kernel-hardening] Re: [PATCH v2] powerpc/mm: Add support for runtime configuration of ASLR limits
Date: Mon, 24 Apr 2017 10:56:04 -0700	[thread overview]
Message-ID: <CAGXu5jLgCGKfyjP=yW4A_E6vCCtuiKdLeb1f80K6cyxpEA2Y=Q@mail.gmail.com> (raw)
In-Reply-To: <8737cxswuk.fsf@concordia.ellerman.id.au>

On Mon, Apr 24, 2017 at 7:29 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Balbir Singh <bsingharora@gmail.com> writes:
>
>> On Fri, 2017-04-21 at 00:36 +1000, Michael Ellerman wrote:
>>> Add powerpc support for mmap_rnd_bits and mmap_rnd_compat_bits, which are two
>>> sysctls that allow a user to configure the number of bits of randomness used for
>>> ASLR.
> ...
>>
>> Could we please suggest that this should not be sent to stable or back-ported
>> as the 128T default is new?
>
> I'm not sure I follow. I didn't tag it for stable. Do you mean we should
> explicitly mark it as not-for-stable?
>
> If someone sends it to stable@vger I'll be pinged before it goes in and
> nak it, if someone wants to backport it (incorrectly) to their own tree
> then good luck to them :)
>
>>> diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
>>> index a5d9ef59debe..6141cfff634e 100644
>>> --- a/arch/powerpc/mm/mmap.c
>>> +++ b/arch/powerpc/mm/mmap.c
>>> @@ -59,13 +59,14 @@ static inline int mmap_is_legacy(void)
>>>
>>>  unsigned long arch_mmap_rnd(void)
>>>  {
>>> -    unsigned long rnd;
>>> +    unsigned long shift, rnd;
>>>
>>> -    /* 8MB for 32bit, 1GB for 64bit */
>>> +    shift = mmap_rnd_bits;
>>> +#ifdef CONFIG_COMPAT
>>>      if (is_32bit_task())
>>> -            rnd = get_random_long() % (1<<(23-PAGE_SHIFT));
>>> -    else
>>> -            rnd = get_random_long() % (1UL<<(30-PAGE_SHIFT));
>>> +            shift = mmap_rnd_compat_bits;
>>> +#endif
>>> +    rnd = get_random_long() % (1 << shift);
>>
>> Nitpick, 1 should be 1UL?

Nice catch!

> No, shift can only be 29 at most IIRC?

The largest value in the kconfigs is 33?

> But it's a bit fragile, so I'll change it.

Thanks!

-Kees

-- 
Kees Cook
Pixel Security

  reply	other threads:[~2017-04-24 17:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 14:36 [PATCH v2] powerpc/mm: Add support for runtime configuration of ASLR limits Michael Ellerman
2017-04-20 14:36 ` [kernel-hardening] " Michael Ellerman
2017-04-20 20:08 ` Kees Cook
2017-04-20 20:08   ` [kernel-hardening] " Kees Cook
2017-04-21  5:51 ` Aneesh Kumar K.V
2017-04-21  5:51   ` [kernel-hardening] " Aneesh Kumar K.V
2017-04-21  6:49 ` Bhupesh Sharma
2017-04-21  6:49   ` [kernel-hardening] " Bhupesh Sharma
2017-04-23 11:53 ` [v2] " Michael Ellerman
2017-04-23 11:53   ` [kernel-hardening] " Michael Ellerman
2017-04-24  1:02 ` [PATCH v2] " Balbir Singh
2017-04-24  1:02   ` [kernel-hardening] " Balbir Singh
2017-04-24 14:29   ` Michael Ellerman
2017-04-24 17:56     ` Kees Cook [this message]
2017-04-24 22:44       ` Michael Ellerman
2017-04-24 22:44         ` Michael Ellerman
2017-04-25  0:56     ` Balbir Singh

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='CAGXu5jLgCGKfyjP=yW4A_E6vCCtuiKdLeb1f80K6cyxpEA2Y=Q@mail.gmail.com' \
    --to=keescook@chromium.org \
    --cc=bhsharma@redhat.com \
    --cc=bsingharora@gmail.com \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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.