From: Michael Ellerman <mpe@ellerman.id.au>
To: Balbir Singh <bsingharora@gmail.com>, linuxppc-dev@ozlabs.org
Cc: bhsharma@redhat.com, keescook@chromium.org,
kernel-hardening@lists.openwall.com
Subject: Re: [kernel-hardening] Re: [PATCH v2] powerpc/mm: Add support for runtime configuration of ASLR limits
Date: Tue, 25 Apr 2017 00:29:07 +1000 [thread overview]
Message-ID: <8737cxswuk.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <1492995750.2418.4.camel@gmail.com>
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?
No, shift can only be 29 at most IIRC?
But it's a bit fragile, so I'll change it.
cheers
next prev parent reply other threads:[~2017-04-24 14:29 UTC|newest]
Thread overview: 10+ 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 20:08 ` Kees Cook
2017-04-21 5:51 ` Aneesh Kumar K.V
2017-04-21 6:49 ` Bhupesh Sharma
2017-04-23 11:53 ` [v2] " Michael Ellerman
2017-04-24 1:02 ` [PATCH v2] " Balbir Singh
2017-04-24 14:29 ` Michael Ellerman [this message]
2017-04-24 17:56 ` [kernel-hardening] " Kees Cook
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=8737cxswuk.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=bhsharma@redhat.com \
--cc=bsingharora@gmail.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=linuxppc-dev@ozlabs.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).