# Re: \[PATCH v12 20/22\] selftests/vm: testcases must restore pkey-permissions

- From: Dave Hansen \<hidden\>
- Date: 2018-03-16 22:32:48 
- List: linux-doc
- Page: https://ratatoskr.run/linux-doc/2018/03/5218933
- Thread: https://ratatoskr.run/linux-kselftest/2018/02/5195852/t.md

```text
On 02/21/2018 05:55 PM, Ram Pai wrote:
> Generally the signal handler restores the state of the pkey register
> before returning. However there are times when the read/write operation
> can legitamely fail without invoking the signal handler.  Eg: A
> sys_read() operaton to a write-protected page should be disallowed.  In
> such a case the state of the pkey register is not restored to its
> original state.  The test case is responsible for restoring the key
> register state to its original value.

Oh, that's a good point.

Could we just do this in a common place, though?  Like reset the
register after each test?  Seems more foolproof.
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
```
