![]() |
|
Message-ID: <20170202122256.GD5179@localhost.localdomain> Date: Thu, 2 Feb 2017 17:52:56 +0530 From: Balbir Singh <bsingharora@...il.com> To: Michael Ellerman <mpe@...erman.id.au> Cc: Bhupesh Sharma <bhsharma@...hat.com>, linuxppc-dev@...ts.ozlabs.org, kernel-hardening@...ts.openwall.com, Anatolij Gustschin <agust@...x.de>, keescook@...omium.org, Daniel Cashman <dcashman@...roid.com>, Scott Wood <oss@...error.net>, Paul Mackerras <paulus@...ba.org>, dcashman@...gle.com, Alistair Popple <alistair@...ple.id.au>, bhupesh.linux@...il.com, Alexander Graf <agraf@...e.com> Subject: Re: [PATCH 1/2] powerpc: mm: support ARCH_MMAP_RND_BITS On Thu, Feb 02, 2017 at 09:23:33PM +1100, Michael Ellerman wrote: > +config ARCH_MMAP_RND_BITS_MIN > + # On 64-bit up to 1G of address space (2^30) > + default 12 if 64BIT && PPC_256K_PAGES # 256K (2^18), = 30 - 18 = 12 > + default 14 if 64BIT && PPC_64K_PAGES # 64K (2^16), = 30 - 16 = 14 > + default 16 if 64BIT && PPC_16K_PAGES # 16K (2^14), = 30 - 14 = 16 > + default 18 if 64BIT # 4K (2^12), = 30 - 12 = 18 > + default ARCH_MMAP_RND_COMPAT_BITS_MIN > + > +config ARCH_MMAP_RND_BITS_MAX > + # On 64-bit up to 32T of address space (2^45) I thought it was 64T, TASK_SIZE_USER64 is 2^46? <snip> > I also have what I think is a better hunk for that: > > 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 = (unsigned long)get_random_int() % (1<<(23-PAGE_SHIFT)); > - else > - rnd = (unsigned long)get_random_int() % (1<<(30-PAGE_SHIFT)); > + shift = mmap_rnd_compat_bits; > +#endif > + > + rnd = (unsigned long)get_random_int() % (1 << shift); > > But I'm just nit picking I guess :) > No.. the version above is nicer IMHO Balbir
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.