All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: mm: support instruction SETEND
Date: Wed, 7 Jan 2015 10:25:43 +0000	[thread overview]
Message-ID: <20150107102543.GD7485@arm.com> (raw)
In-Reply-To: <54AD061A.6090602@arm.com>

On Wed, Jan 07, 2015 at 10:10:34AM +0000, Suzuki K. Poulose wrote:
> On 07/01/15 05:52, Leo Yan wrote:
> > Currently kernel has set the bit SCTLR_EL1.SED, so the SETEND
> > instruction will be treated as UNALLOCATED; this error can be
> > reproduced when ARMv8 cpu runs with EL1/aarch64 and EL0/aarch32
> > mode, finally kernel will trap the exception if the userspace
> > libs use SETEND instruction.
> >
> > So this patch clears bit SCTLR_EL1.SED to support SETEND instruction.
> >
> The best way to do this, is via the instruction emulation framework 
> added by Punit, which handles the armv8 deprecated/obsoleted 
> instructions. This is now queued for 3.19.
> I have a patchset which adds the 'SETEND' emulation support to the 
> framework. This will enable better handling of the feature, including 
> finding out the users of the deprecated instruction (when we switch to 
> the emulation mode).
> 
> Btw, there is one open question that I am seeking answer for.
> 
> What should be the endianness of the signal handlers ? Should we leave 
> it to the application ? Or restore the 'default' endianness for the 
> signal handler ?

I think we should restore the default endianness, otherwise you're
essentially forcing signal handlers to do a setend as their first
instruction to get into a consistent state. That also matches the endianness
of the sigframe that we push onto the stack, right?

setjmp/longjmp could be fun, but I think that an application would need
to take care not to make endianness assumptions across those anyway.

Will

WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: "Suzuki K. Poulose" <Suzuki.Poulose@arm.com>
Cc: Leo Yan <leo.yan@linaro.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Xiaolong Ye <yexl@marvell.com>
Subject: Re: [PATCH] arm64: mm: support instruction SETEND
Date: Wed, 7 Jan 2015 10:25:43 +0000	[thread overview]
Message-ID: <20150107102543.GD7485@arm.com> (raw)
In-Reply-To: <54AD061A.6090602@arm.com>

On Wed, Jan 07, 2015 at 10:10:34AM +0000, Suzuki K. Poulose wrote:
> On 07/01/15 05:52, Leo Yan wrote:
> > Currently kernel has set the bit SCTLR_EL1.SED, so the SETEND
> > instruction will be treated as UNALLOCATED; this error can be
> > reproduced when ARMv8 cpu runs with EL1/aarch64 and EL0/aarch32
> > mode, finally kernel will trap the exception if the userspace
> > libs use SETEND instruction.
> >
> > So this patch clears bit SCTLR_EL1.SED to support SETEND instruction.
> >
> The best way to do this, is via the instruction emulation framework 
> added by Punit, which handles the armv8 deprecated/obsoleted 
> instructions. This is now queued for 3.19.
> I have a patchset which adds the 'SETEND' emulation support to the 
> framework. This will enable better handling of the feature, including 
> finding out the users of the deprecated instruction (when we switch to 
> the emulation mode).
> 
> Btw, there is one open question that I am seeking answer for.
> 
> What should be the endianness of the signal handlers ? Should we leave 
> it to the application ? Or restore the 'default' endianness for the 
> signal handler ?

I think we should restore the default endianness, otherwise you're
essentially forcing signal handlers to do a setend as their first
instruction to get into a consistent state. That also matches the endianness
of the sigframe that we push onto the stack, right?

setjmp/longjmp could be fun, but I think that an application would need
to take care not to make endianness assumptions across those anyway.

Will

  reply	other threads:[~2015-01-07 10:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07  5:52 [PATCH] arm64: mm: support instruction SETEND Leo Yan
2015-01-07  5:52 ` Leo Yan
2015-01-07 10:10 ` Suzuki K. Poulose
2015-01-07 10:10   ` Suzuki K. Poulose
2015-01-07 10:25   ` Will Deacon [this message]
2015-01-07 10:25     ` Will Deacon
2015-01-07 14:25     ` Catalin Marinas
2015-01-07 14:25       ` Catalin Marinas
2015-01-07 10:58   ` Leo Yan
2015-01-07 10:58     ` Leo Yan
2015-01-07 11:11     ` Will Deacon
2015-01-07 11:11       ` Will Deacon
2015-01-07 14:06       ` Leo Yan
2015-01-07 14:06         ` Leo Yan

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=20150107102543.GD7485@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.