All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Prem Karat <pkarat@mvista.com>, linux-mips@linux-mips.org
Cc: ddaney.cavm@gmail.com
Subject: Re: [RFC PATCH 1/1] MIPS: Enable VDSO randomization.
Date: Sat, 19 Apr 2014 17:49:53 +0400	[thread overview]
Message-ID: <53527F01.30003@cogentembedded.com> (raw)
In-Reply-To: <20140419093302.GH2717@064904.mvista.com>

Hello.

On 19-04-2014 13:33, Prem Karat wrote:

> Based on commit 1091458d09e1a (mmap randomization)

> For 32-bit address spaces randomize within a
> 16MB space, for 64-bit within a 256MB space.

> Signed-off-by: Prem Karat <pkarat@mvista.com>
[...]

> @@ -67,7 +69,18 @@ subsys_initcall(init_vdso);
>
>   static unsigned long vdso_addr(unsigned long start)
>   {
> -	return STACK_TOP;
> +	unsigned long offset = 0UL;
> +
> +	if (current->flags & PF_RANDOMIZE) {
> +		offset = get_random_int();
> +		offset = offset << PAGE_SHIFT;

    Why not:

		offset <<= PAGE_SHIFT;

> +		if (TASK_IS_32BIT_ADDR)
> +			offset &= 0xfffffful;
> +		else
> +			offset &= 0xffffffful;
> +	}
> +
> +	return (STACK_TOP + offset);

    Parens not needed.

WBR, Sergei

  reply	other threads:[~2014-04-19 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-19  9:33 [RFC PATCH 1/1] MIPS: Enable VDSO randomization Prem Karat
2014-04-19 13:49 ` Sergei Shtylyov [this message]
2014-04-19 22:56 ` David Daney
2014-04-21  3:40   ` Prem Karat
2014-04-21 18:38     ` David Daney

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=53527F01.30003@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=pkarat@mvista.com \
    /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.