lkml.org 
[lkml]   [2018]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v12 19/22] selftests/vm: detect write violation on a mapped access-denied-key page
    Date
    detect write-violation on a page to which access-disabled
    key is associated much after the page is mapped.

    cc: Dave Hansen <dave.hansen@intel.com>
    cc: Florian Weimer <fweimer@redhat.com>
    Signed-off-by: Ram Pai <linuxram@us.ibm.com>
    ---
    tools/testing/selftests/vm/protection_keys.c | 13 +++++++++++++
    1 files changed, 13 insertions(+), 0 deletions(-)

    diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
    index b685e26..437ee74 100644
    --- a/tools/testing/selftests/vm/protection_keys.c
    +++ b/tools/testing/selftests/vm/protection_keys.c
    @@ -1059,6 +1059,18 @@ void test_write_of_access_disabled_region(int *ptr, u16 pkey)
    *ptr = __LINE__;
    expected_pkey_fault(pkey);
    }
    +
    +void test_write_of_access_disabled_region_with_page_already_mapped(int *ptr,
    + u16 pkey)
    +{
    + *ptr = __LINE__;
    + dprintf1("disabling access; after accessing the page, "
    + " to PKEY[%02d], doing write\n", pkey);
    + pkey_access_deny(pkey);
    + *ptr = __LINE__;
    + expected_pkey_fault(pkey);
    +}
    +
    void test_kernel_write_of_access_disabled_region(int *ptr, u16 pkey)
    {
    int ret;
    @@ -1343,6 +1355,7 @@ void test_mprotect_pkey_on_unsupported_cpu(int *ptr, u16 pkey)
    test_write_of_write_disabled_region,
    test_write_of_write_disabled_region_with_page_already_mapped,
    test_write_of_access_disabled_region,
    + test_write_of_access_disabled_region_with_page_already_mapped,
    test_kernel_write_of_access_disabled_region,
    test_kernel_write_of_write_disabled_region,
    test_kernel_gup_of_access_disabled_region,
    --
    1.7.1
    \
     
     \ /
      Last update: 2018-02-22 02:58    [W:2.096 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site