• Arjan van de Ven's avatar
    x86: fix pageattr-selftest · 488fd995
    Arjan van de Ven authored
    In Ingo's testing, he found a bug in the CPA selftest code. What would
    happen is that the test would call change_page_attr_addr on a range of
    memory, part of which was read only, part of which was writable. The
    only thing the test wanted to change was the global bit...
    
    What actually happened was that the selftest would take the permissions
    of the first page, and then the change_page_attr_addr call would then
    set the permissions of the entire range to this first page. In the
    rodata section case, this resulted in pages after the .rodata becoming
    read only... which made the kernel rather unhappy in many interesting
    ways.
    
    This is just another example of how dangerous the cpa API is (was); this
    patch changes the test to use the incremental clear/set APIs
    instead, and it changes the clear/set implementation to work on a 1 page
    at a time basis.
    Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    488fd995
pageattr-test.c 4.85 KB