diff options
author | Jan Beulich <JBeulich@suse.com> | 2016-02-10 02:03:00 -0700 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-02-25 10:41:43 +0100 |
commit | 405e1133d00e0271cedef75c17ecb773ff3e2732 (patch) | |
tree | 05d6cc18bed901ce2b3355c287695d3a5f92f7b4 /include/scsi/scsi_dh.h | |
parent | b176862fca8625b0a8bee207bca9b611413e5e24 (diff) |
x86/mm: Avoid premature success when changing page attributes
set_memory_nx() (and set_memory_x()) currently differ in behavior from
all other set_memory_*() functions when encountering a virtual address
space hole within the kernel address range: They stop processing at the
hole, but nevertheless report success (making the caller believe the
operation was carried out on the entire range). While observed to be a
problem - triggering the CONFIG_DEBUG_WX warning - only with out of
tree code, I suspect (but didn't check) that on x86-64 the
CONFIG_DEBUG_PAGEALLOC logic in free_init_pages() would, when called
from free_initmem(), have the same effect on the set_memory_nx() called
from mark_rodata_ro().
This unexpected behavior is a result of change_page_attr_set_clr()
special casing changes to only the NX bit, in that it passes "false" as
the "checkalias" argument to __change_page_attr_set_clr(). Since this
flag becomes the "primary" argument of both __change_page_attr() and
__cpa_process_fault(), the latter would so far return success without
adjusting cpa->numpages. Success to the higher level callers, however,
means that whatever cpa->numpages currently holds is the count of
successfully processed pages. The cases when __change_page_attr() calls
__cpa_process_fault(), otoh, don't generally mean the entire range got
processed (as can be seen from one of the two success return paths in
__cpa_process_fault() already adjusting ->numpages).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/56BB0AD402000078000D05BF@prv-mh.provo.novell.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/scsi/scsi_dh.h')
0 files changed, 0 insertions, 0 deletions