Re: [PATCH V2] MIPS: VDSO: Reduce VDSO_RANDOMIZE_SIZE to 64MB for 64bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Huacai,

On Sat, Oct 20, 2018 at 09:01:31PM +0800, Huacai Chen wrote:
> By the way, not all VDSO_RANDOMIZE_SIZE can be used for vdso_base()
> randomization because VDSO need some room to locate itself (in this
> patch we reserve 64KB).
> 
>%
> 
> diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
> index 48a9c6b..d6232d9 100644
> --- a/arch/mips/kernel/vdso.c
> +++ b/arch/mips/kernel/vdso.c
> @@ -106,7 +106,7 @@ static unsigned long vdso_base(void)
>  	base = STACK_TOP + PAGE_SIZE;
>  
>  	if (current->flags & PF_RANDOMIZE) {
> -		base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1);
> +		base += get_random_int() & (VDSO_RANDOMIZE_SIZE - SZ_64K - 1);
>  		base = PAGE_ALIGN(base);
>  	}

This change in v2 is unnecessary - STACK_TOP already accounts for the
size of the VDSO, so we don't need to leave space for it a second time
here.

v1 of your patch is in mips-fixes, which I'll submit a pull request for
soon.

Thanks,
    Paul


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux