[PATCH] powerpc/mm: Fix thread_pkey_regs_init()

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3054d

3 messages, 3 authors, 2018-03-31 · open the first message on its own page

[PATCH] powerpc/mm: Fix thread_pkey_regs_init()

From: Ram Pai <hidden>
Date: 2018-03-27 02:37:24

thread_pkey_regs_init() initializes the pkey related registers
instead of initializing the fields in the task structures.  Fortunately
those key related registers are re-set to zero when the task
gets scheduled on the cpu. However its good to fix this glaringly
visible error.

cc: Michael Ellermen <mpe@ellerman.id.au>
Signed-off-by: Ram Pai <redacted>
Signed-off-by: Thiago Jung Bauermann <redacted>
---
 arch/powerpc/mm/pkeys.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/pkeys.c b/arch/powerpc/mm/pkeys.c
index 58bbb55..61dba4e 100644
--- a/arch/powerpc/mm/pkeys.c
+++ b/arch/powerpc/mm/pkeys.c
@@ -338,9 +338,9 @@ void thread_pkey_regs_init(struct thread_struct *thread)
 	if (static_branch_likely(&pkey_disabled))
 		return;
 
-	write_amr(read_amr() & pkey_amr_uamor_mask);
-	write_iamr(read_iamr() & pkey_iamr_mask);
-	write_uamor(read_uamor() & pkey_amr_uamor_mask);
+	thread->amr = read_amr() & pkey_amr_uamor_mask;
+	thread->iamr = read_iamr() & pkey_iamr_mask;
+	thread->uamor = read_uamor() & pkey_amr_uamor_mask;
 }
 
 static inline bool pkey_allows_readwrite(int pkey)
-- 
1.8.3.1

Re: [PATCH] powerpc/mm: Fix thread_pkey_regs_init()

From: Balbir Singh <bsingharora@gmail.com>
Date: 2018-03-27 03:53:56

On Tue, Mar 27, 2018 at 1:36 PM, Ram Pai [off-list ref] wrote:
thread_pkey_regs_init() initializes the pkey related registers
instead of initializing the fields in the task structures.  Fortunately
those key related registers are re-set to zero when the task
gets scheduled on the cpu. However its good to fix this glaringly
visible error.

cc: Michael Ellermen <mpe@ellerman.id.au>
Signed-off-by: Ram Pai <redacted>
Signed-off-by: Thiago Jung Bauermann <redacted>
---
Acked-by: Balbir Singh <bsingharora@gmail.com>

Balbir Singh

Re: powerpc/mm: Fix thread_pkey_regs_init()

From: Michael Ellerman <hidden>
Date: 2018-03-31 14:04:12

On Tue, 2018-03-27 at 02:36:54 UTC, Ram Pai wrote:
thread_pkey_regs_init() initializes the pkey related registers
instead of initializing the fields in the task structures.  Fortunately
those key related registers are re-set to zero when the task
gets scheduled on the cpu. However its good to fix this glaringly
visible error.

cc: Michael Ellermen <mpe@ellerman.id.au>
Signed-off-by: Ram Pai <redacted>
Signed-off-by: Thiago Jung Bauermann <redacted>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f208638680e5cb4eb0d2871ce8c29a

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help