Skip to content

Commit 0b80d3c

Browse files
kvaneeshgregkh
authored andcommitted
selftests/powerpc: ptrace-pkey: Don't update expected UAMOR value
[ Upstream commit 3563b9b ] With commit 4a4a5e5 ("powerpc/pkeys: key allocation/deallocation must not change pkey registers") we are not updating UAMOR on key allocation. So don't update the expected uamor value in the test. Fixes: 4a4a5e5 ("powerpc/pkeys: key allocation/deallocation must not change pkey registers") Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200709032946.881753-23-aneesh.kumar@linux.ibm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a075f69 commit 0b80d3c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,20 @@ static int child(struct shared_info *info)
101101
*/
102102
info->invalid_amr = info->amr2 | (~0x0UL & ~info->expected_uamor);
103103

104+
/*
105+
* if PKEY_DISABLE_EXECUTE succeeded we should update the expected_iamr
106+
*/
104107
if (disable_execute)
105108
info->expected_iamr |= 1ul << pkeyshift(pkey1);
106109
else
107110
info->expected_iamr &= ~(1ul << pkeyshift(pkey1));
108111

109-
info->expected_iamr &= ~(1ul << pkeyshift(pkey2) | 1ul << pkeyshift(pkey3));
112+
/*
113+
* We allocated pkey2 and pkey 3 above. Clear the IAMR bits.
114+
*/
115+
info->expected_iamr &= ~(1ul << pkeyshift(pkey2));
116+
info->expected_iamr &= ~(1ul << pkeyshift(pkey3));
110117

111-
info->expected_uamor |= 3ul << pkeyshift(pkey1) |
112-
3ul << pkeyshift(pkey2);
113118
/*
114119
* Create an IAMR value different from expected value.
115120
* Kernel will reject an IAMR and UAMOR change.

0 commit comments

Comments
 (0)