|
@@ -430,12 +430,24 @@ static inline bool pti_kernel_image_global_ok(void)
|
|
|
*/
|
|
|
void pti_clone_kernel_text(void)
|
|
|
{
|
|
|
+ /*
|
|
|
+ * rodata is part of the kernel image and is normally
|
|
|
+ * readable on the filesystem or on the web. But, do not
|
|
|
+ * clone the areas past rodata, they might contain secrets.
|
|
|
+ */
|
|
|
unsigned long start = PFN_ALIGN(_text);
|
|
|
- unsigned long end = ALIGN((unsigned long)_end, PMD_PAGE_SIZE);
|
|
|
+ unsigned long end = (unsigned long)__end_rodata_hpage_align;
|
|
|
|
|
|
if (!pti_kernel_image_global_ok())
|
|
|
return;
|
|
|
|
|
|
+ pr_debug("mapping partial kernel image into user address space\n");
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Note that this will undo _some_ of the work that
|
|
|
+ * pti_set_kernel_image_nonglobal() did to clear the
|
|
|
+ * global bit.
|
|
|
+ */
|
|
|
pti_clone_pmds(start, end, _PAGE_RW);
|
|
|
}
|
|
|
|
|
@@ -458,8 +470,6 @@ void pti_set_kernel_image_nonglobal(void)
|
|
|
if (pti_kernel_image_global_ok())
|
|
|
return;
|
|
|
|
|
|
- pr_debug("set kernel image non-global\n");
|
|
|
-
|
|
|
set_memory_nonglobal(start, (end - start) >> PAGE_SHIFT);
|
|
|
}
|
|
|
|