@@ -63,6 +63,7 @@
#include <linux/pagewalk.h>
#include <linux/shmem_fs.h>
#include <linux/sysctl.h>
+#include <linux/set_memory.h>
#include "swap.h"
#include "internal.h"
#include "ras/ras_event.h"
@@ -2407,7 +2408,9 @@ static void memory_failure_work_func(struct work_struct *work)
if (entry.flags & MF_SOFT_OFFLINE)
soft_offline_page(entry.pfn, entry.flags);
else
- memory_failure(entry.pfn, entry.flags);
+ if (!memory_failure(entry.pfn, entry.flags))
+ if (!entry.flags & MF_SW_SIMULATED)
+ set_mce_nospec(entry.pfn);
}
}
If memory_failure() succeeds to hwpoison a page, the set_mce_nospec() is expected to be called to prevent speculative access to the page by marking it not-present. Add such missing call to set_mce_nospec() in async memory failure handling scene. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/memory-failure.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)