LinuxPPC-Dev Archive on lore.kernel.org
 help / Atom feed
* [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
@ 2019-01-09 13:16 Breno Leitao
  2019-01-14 10:12 ` Michael Ellerman
  2019-01-16 13:35 ` [PATCH] " Sasha Levin
  0 siblings, 2 replies; 5+ messages in thread
From: Breno Leitao @ 2019-01-09 13:16 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Breno Leitao, mikey, stable, gregkh

Commit e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
moved a code block around and this block uses a 'msr' variable outside of
the CONFIG_PPC_TRANSACTIONAL_MEM, however the 'msr' variable is declared
inside a CONFIG_PPC_TRANSACTIONAL_MEM block, causing a possible error when
CONFIG_PPC_TRANSACTION_MEM is not defined.

	error: 'msr' undeclared (first use in this function)

This is not causing a compilation error in the mainline kernel, because
'msr' is being used as an argument of MSR_TM_ACTIVE(), which is defined as
the following when CONFIG_PPC_TRANSACTIONAL_MEM is *not* set:

	#define MSR_TM_ACTIVE(x) 0

This patch just fixes this issue avoiding the 'msr' variable usage outside
the CONFIG_PPC_TRANSACTIONAL_MEM block, avoiding trusting in the
MSR_TM_ACTIVE() definition.

Cc: stable@vger.kernel.org
Reported-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Fixes: e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
Signed-off-by: Breno Leitao <leitao@debian.org>
---

NB: Since stable kernels didn't cherry picked 5c784c8414fba ('powerpc/tm:
Remove msr_tm_active()), MSR_TM_ACTIVE() is not defined as 0 for
CONFIG_PPC_TRANSACTIONAL_MEM=n case, thus triggering the compilation error
above.

Tested against stable kernel 4.19.13-rc2 and problem is now fixed when
CONFIG_PPC_TRANSACTIONAL_MEM=n

 arch/powerpc/kernel/signal_64.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index daa28cb72272..8fe698162ab9 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -739,11 +739,12 @@ SYSCALL_DEFINE0(rt_sigreturn)
 		if (restore_tm_sigcontexts(current, &uc->uc_mcontext,
 					   &uc_transact->uc_mcontext))
 			goto badframe;
-	}
+	} else
 #endif
-	/* Fall through, for non-TM restore */
-	if (!MSR_TM_ACTIVE(msr)) {
+	{
 		/*
+		 * Fall through, for non-TM restore
+		 *
 		 * Unset MSR[TS] on the thread regs since MSR from user
 		 * context does not have MSR active, and recheckpoint was
 		 * not called since restore_tm_sigcontexts() was not called
-- 
2.19.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
  2019-01-09 13:16 [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM Breno Leitao
@ 2019-01-14 10:12 ` Michael Ellerman
  2019-01-16 13:35 ` [PATCH] " Sasha Levin
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2019-01-14 10:12 UTC (permalink / raw)
  To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao, gregkh, mikey, stable

On Wed, 2019-01-09 at 13:16:45 UTC, Breno Leitao wrote:
> Commit e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
> moved a code block around and this block uses a 'msr' variable outside of
> the CONFIG_PPC_TRANSACTIONAL_MEM, however the 'msr' variable is declared
> inside a CONFIG_PPC_TRANSACTIONAL_MEM block, causing a possible error when
> CONFIG_PPC_TRANSACTION_MEM is not defined.
> 
> 	error: 'msr' undeclared (first use in this function)
> 
> This is not causing a compilation error in the mainline kernel, because
> 'msr' is being used as an argument of MSR_TM_ACTIVE(), which is defined as
> the following when CONFIG_PPC_TRANSACTIONAL_MEM is *not* set:
> 
> 	#define MSR_TM_ACTIVE(x) 0
> 
> This patch just fixes this issue avoiding the 'msr' variable usage outside
> the CONFIG_PPC_TRANSACTIONAL_MEM block, avoiding trusting in the
> MSR_TM_ACTIVE() definition.
> 
> Cc: stable@vger.kernel.org
> Reported-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
> Fixes: e1c3743e1a20 ("powerpc/tm: Set MSR[TS] just prior to recheckpoint")
> Signed-off-by: Breno Leitao <leitao@debian.org>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/897bc3df8c5aebb54c32d831f917592e

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
  2019-01-09 13:16 [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM Breno Leitao
  2019-01-14 10:12 ` Michael Ellerman
@ 2019-01-16 13:35 ` " Sasha Levin
  2019-01-17 11:49   ` Breno Leitao
  1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-01-16 13:35 UTC (permalink / raw)
  To: Sasha Levin; +Cc: , mikey, stable, gregkh

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: e1c3743e1a20 powerpc/tm: Set MSR[TS] just prior to recheckpoint.

The bot has tested the following trees: v4.20.2, v4.19.15, v4.14.93, v4.9.150.

v4.20.2: Failed to apply! Possible dependencies:
    Unable to calculate

v4.19.15: Failed to apply! Possible dependencies:
    Unable to calculate

v4.14.93: Failed to apply! Possible dependencies:
    0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
    67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
    6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
    b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
    bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
    f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")

v4.9.150: Failed to apply! Possible dependencies:
    0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
    67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
    6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
    b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
    bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
    f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")


How should we proceed with this patch?

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
  2019-01-16 13:35 ` [PATCH] " Sasha Levin
@ 2019-01-17 11:49   ` Breno Leitao
  2019-01-18 14:51     ` Sasha Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Breno Leitao @ 2019-01-17 11:49 UTC (permalink / raw)
  To: Sasha Levin, linuxppc-dev; +Cc: mikey, stable, gregkh

hi Sasha,

On 1/16/19 11:35 AM, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: e1c3743e1a20 powerpc/tm: Set MSR[TS] just prior to recheckpoint.
> 
> The bot has tested the following trees: v4.20.2, v4.19.15, v4.14.93, v4.9.150.
> 
> v4.20.2: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.19.15: Failed to apply! Possible dependencies:
>     Unable to calculate
> 
> v4.14.93: Failed to apply! Possible dependencies:
>     0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
>     67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
>     6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
>     b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
>     bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
>     f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")
> 
> v4.9.150: Failed to apply! Possible dependencies:
>     0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
>     67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
>     6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
>     b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
>     bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
>     f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")
> 
> 
> How should we proceed with this patch?

I understand that the commit that this patch fixes is not integrated into
stable tree.

I think it does not need to make stable at this moment, thus.

Thanks,
Breno

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM
  2019-01-17 11:49   ` Breno Leitao
@ 2019-01-18 14:51     ` Sasha Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-01-18 14:51 UTC (permalink / raw)
  To: Breno Leitao; +Cc: mikey, linuxppc-dev, stable, gregkh

On Thu, Jan 17, 2019 at 09:49:05AM -0200, Breno Leitao wrote:
>hi Sasha,
>
>On 1/16/19 11:35 AM, Sasha Levin wrote:
>> Hi,
>>
>> [This is an automated email]
>>
>> This commit has been processed because it contains a "Fixes:" tag,
>> fixing commit: e1c3743e1a20 powerpc/tm: Set MSR[TS] just prior to recheckpoint.
>>
>> The bot has tested the following trees: v4.20.2, v4.19.15, v4.14.93, v4.9.150.
>>
>> v4.20.2: Failed to apply! Possible dependencies:
>>     Unable to calculate
>>
>> v4.19.15: Failed to apply! Possible dependencies:
>>     Unable to calculate
>>
>> v4.14.93: Failed to apply! Possible dependencies:
>>     0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
>>     67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
>>     6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
>>     b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
>>     bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
>>     f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")
>>
>> v4.9.150: Failed to apply! Possible dependencies:
>>     0d60619e1c0c ("powerpc: Add missing prototype for sys_debug_setcontext()")
>>     67b464a89c21 ("powerpc/32: Mark both tmp variables as unused")
>>     6f5b9f018f4c ("powerpc/tm: Unset MSR[TS] if not recheckpointing")
>>     b53875c4b4f2 ("powerpc: Add missing prototypes for sys_sigreturn() & sys_rt_sigreturn()")
>>     bf7fb32dd5fc ("powerpc: Add missing prototypes for ppc_select() & ppc_fadvise64_64()")
>>     f3675644e172 ("powerpc/syscalls: signal_{32, 64} - switch to SYSCALL_DEFINE")
>>
>>
>> How should we proceed with this patch?
>
>I understand that the commit that this patch fixes is not integrated into
>stable tree.
>
>I think it does not need to make stable at this moment, thus.

The commit it fixes (e1c3743e1a20) exists in all 4.9+ stable trees as it
itself was tagged for stable.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 13:16 [PATCH] powerpc/tm: Limit TM code inside PPC_TRANSACTIONAL_MEM Breno Leitao
2019-01-14 10:12 ` Michael Ellerman
2019-01-16 13:35 ` [PATCH] " Sasha Levin
2019-01-17 11:49   ` Breno Leitao
2019-01-18 14:51     ` Sasha Levin

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org linuxppc-dev@archiver.kernel.org
	public-inbox-index linuxppc-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox