All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nigel Stephens <nigel@mips.com>
To: franck.bui-huu@innova-card.com
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH] User stack pointer randomisation
Date: Thu, 19 Jul 2007 13:20:46 +0100	[thread overview]
Message-ID: <469F571E.5080408@mips.com> (raw)
In-Reply-To: <469F5345.5010209@innova-card.com>



Franck Bui-Huu wrote:
> +/*
> + * Don't forget that the stack pointer must be aligned on a 8 bytes
> + * boundary for 32-bits ABI and 16 bytes for 64-bits ABI.
> + */
> +unsigned long arch_align_stack(unsigned long sp)
> +{
> +	if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
> +		sp -= get_random_int() & ~PAGE_MASK;
> +
> +	return sp & ALMASK;
> +}
>   

Hmm, the kernel isn't necessarily built using the same ABI as
applications. While this will in fact do the right thing for O32 apps
running on 64-bit kernels, it's kind of by accident, and suggests some
equivalence which isn't really there. Would it be better to force 16
byte alignment (the maximum alignment required by any ABI) in all cases,
rather than relying on the kernel's ALMASK being correct for user
applications? Just a thought.

Nigel

  reply	other threads:[~2007-07-19 12:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 12:04 [PATCH] User stack pointer randomisation Franck Bui-Huu
2007-07-19 12:20 ` Nigel Stephens [this message]
2007-07-19 12:36   ` Franck Bui-Huu
2007-07-19 12:30 ` Ralf Baechle
2007-07-19 12:40   ` Franck Bui-Huu
2007-07-19 15:16     ` Franck Bui-Huu

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=469F571E.5080408@mips.com \
    --to=nigel@mips.com \
    --cc=franck.bui-huu@innova-card.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 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.