mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Colin King <colin.king@canonical.com>
Cc: Will Deacon <will.deacon@arm.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Janet Liu <janet.liu@spreadtrum.com>, Jiri Slaby <jslaby@suse.cz>,
	Jisheng Zhang <jszhang@marvell.com>,
	James Morse <james.morse@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: do not enforce strict 16 byte alignment to stack pointer
Date: Thu, 12 May 2016 10:25:45 +0100	[thread overview]
Message-ID: <20160512092545.GC11226@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <1462985814-16146-1-git-send-email-colin.king@canonical.com>

On Wed, May 11, 2016 at 05:56:54PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> copy_thread should not be enforcing 16 byte aligment and returning
> -EINVAL. Other architectures trap misaligned stack access with SIGBUS
> so arm64 should follow this convention, so remove the strict enforcement
> check.
> 
> For example, currently clone(2) fails with -EINVAL when passing
> a misaligned stack and this gives little clue to what is wrong. Instead,
> it is arguable that a SIGBUS on the fist access to a misaligned stack
> allows one to figure out that it is a misaligned stack issue rather
> than trying to figure out why an unconventional (and undocumented)
> -EINVAL is being returned.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  arch/arm64/kernel/process.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 5655f756..8414971 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -258,9 +258,6 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start,
>  		if (stack_start) {
>  			if (is_compat_thread(task_thread_info(p)))
>  				childregs->compat_sp = stack_start;
> -			/* 16-byte aligned stack mandatory on AArch64 */
> -			else if (stack_start & 15)
> -				return -EINVAL;
>  			else
>  				childregs->sp = stack_start;
>  		}

As we discussed on the linux-man list, I don't expect this change to
break existing working user apps since they pass an aligned stack
already. I really doubt anyone relies on the -EINVAL here.

That said, I don't think we should add a cc stable (which you haven't
anyway), at least we have a point in time where this change was made. As
the patch stands:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

(but let's wait for Will's opinion as well)

  reply	other threads:[~2016-05-12  9:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 16:56 Colin King
2016-05-12  9:25 ` Catalin Marinas [this message]
2016-05-12 10:16   ` Will Deacon

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=20160512092545.GC11226@e104818-lin.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=colin.king@canonical.com \
    --cc=james.morse@arm.com \
    --cc=janet.liu@spreadtrum.com \
    --cc=jslaby@suse.cz \
    --cc=jszhang@marvell.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=takahiro.akashi@linaro.org \
    --cc=will.deacon@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®