From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv3] arm64: Rework valid_user_regs
Date: Tue, 1 Mar 2016 13:40:44 +0000 [thread overview]
Message-ID: <20160301134043.GA14022@arm.com> (raw)
In-Reply-To: <CAFEAcA9PmQYFYBw0GstA88MGHwGivB+VJdowBf6T1ggneZKihg@mail.gmail.com>
On Tue, Mar 01, 2016 at 01:08:33PM +0000, Peter Maydell wrote:
> On 1 March 2016 at 12:47, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Feb 16, 2016 at 06:20:05PM +0000, Will Deacon wrote:
> >> > +static int valid_native_regs(struct user_pt_regs *regs)
> >> > +{
> >> > + regs->pstate &= ~SPSR_EL1_AARCH64_RES0_BITS;
> >> > +
> >> > + if (user_mode(regs) && !(regs->pstate & PSR_MODE32_BIT) &&
> >> > + (regs->pstate & PSR_D_BIT) == 0 &&
> >> > + (regs->pstate & PSR_A_BIT) == 0 &&
> >> > + (regs->pstate & PSR_I_BIT) == 0 &&
> >> > + (regs->pstate & PSR_F_BIT) == 0) {
> >> > + return 1;
> >> > + }
> >> > +
> >> > + /* Force PSR to a valid 64-bit EL0t */
> >> > + regs->pstate &= PSR_N_BIT | PSR_Z_BIT | PSR_C_BIT | PSR_V_BIT;
> >>
> >> Can we not just zap the pstate to PSR_MODE_EL0t and be done with it?
> >
> > I'm worried that some userspace might be relying on these being
> > preserved.
>
> This function is called as part of signal-return, right?
> You clearly can't just zap the flag registers in that code
> path, because you'd then be corrupting the flags of the
> bit of userspace code that was interrupted by the signal.
> (Or am I missing something?)
Well, it would only occur if the signal handler had tried to set pstate
to an invalid value. That said, it is a change in behaviour, so we can
leave it as Mark has suggested.
Will
next prev parent reply other threads:[~2016-03-01 13:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 18:15 [PATCHv3] arm64: Rework valid_user_regs Mark Rutland
2016-02-16 18:20 ` Will Deacon
2016-02-29 19:08 ` Will Deacon
2016-03-01 12:47 ` Mark Rutland
2016-03-01 13:08 ` Peter Maydell
2016-03-01 13:40 ` Will Deacon [this message]
2016-03-01 14:01 ` Mark Rutland
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=20160301134043.GA14022@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.