linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Neuling <mikey@neuling.org>
Cc: linuxppc-dev@lists.ozlabs.org, Matt Evans <matt@ozlabs.org>
Subject: Re: [PATCH 3/5] powerpc/tm: Fix restoration of MSR on 32bit signal return
Date: Sun, 09 Jun 2013 17:27:40 +1000	[thread overview]
Message-ID: <1370762860.14883.13.camel@pasglop> (raw)
In-Reply-To: <1370601390-29065-3-git-send-email-mikey@neuling.org>

On Fri, 2013-06-07 at 20:36 +1000, Michael Neuling wrote:
> Currently we clear out the MSR TM bits on signal return assuming that the
> signal should never return to an active transaction.
> 
> This is bogus as the user may do this.  It's most likely the transaction will
> be doomed due to a treclaim but that's a problem for the HW not the kernel.
> 
> This removes the stripping of these MSR TM bits.
> 
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> ---

> @@ -859,8 +860,10 @@ static long restore_tm_user_regs(struct pt_regs *regs,
>  	tm_enable();
>  	/* This loads the checkpointed FP/VEC state, if used */
>  	tm_recheckpoint(&current->thread, msr);
> -	/* The task has moved into TM state S, so ensure MSR reflects this */
> -	regs->msr = (regs->msr & ~MSR_TS_MASK) | MSR_TS_S;
> +	/* Retore the top half of the MSR */
> +	if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
> +		return 1;
> +	regs->msr = (regs->msr | (((unsigned long)msr_hi) << 32));

What kind of damage can I do by calling sigreturn with a cooked
frame with random MSR bits set ? You should probably filter
what bits you allow to come from the frame.

Additionally, I would also make sure I only do that if the CPU
features say TM is supported in case that MSR bit means something else
on a different/older CPU...

Cheers,
Ben.

  reply	other threads:[~2013-06-09  7:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-07 10:36 [PATCH 1/5] powerpc/tm: Fix writing top half of MSR on 32 bit signals Michael Neuling
2013-06-07 10:36 ` [PATCH 2/5] powerpc/tm: Fix 32 bit non-rt signals Michael Neuling
2013-06-09  7:25   ` Benjamin Herrenschmidt
2013-06-09 10:12     ` Michael Neuling
2013-06-07 10:36 ` [PATCH 3/5] powerpc/tm: Fix restoration of MSR on 32bit signal return Michael Neuling
2013-06-09  7:27   ` Benjamin Herrenschmidt [this message]
2013-06-09  9:56     ` Michael Neuling
2013-06-07 10:36 ` [PATCH 4/5] powerpc/tm: Fix return of 32bit rt signals to active transactions Michael Neuling
2013-06-07 10:36 ` [PATCH 5/5] powerpc/tm: Fix return of active 64bit signals Michael Neuling

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=1370762860.14883.13.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=matt@ozlabs.org \
    --cc=mikey@neuling.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).