]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/memory-failure.c
media: dvb_ca_en50221: prevent using slot_info for Spectre attacs
[mirror_ubuntu-bionic-kernel.git] / mm / memory-failure.c
index 4acdf393a80181336084f4f6da6539f78249ba30..c0d7bc6910e8b9776e1801e7a1e9fbd717e464b7 100644 (file)
@@ -508,6 +508,7 @@ static const char * const action_page_types[] = {
        [MF_MSG_POISONED_HUGE]          = "huge page already hardware poisoned",
        [MF_MSG_HUGE]                   = "huge page",
        [MF_MSG_FREE_HUGE]              = "free huge page",
+       [MF_MSG_NON_PMD_HUGE]           = "non-pmd-sized huge page",
        [MF_MSG_UNMAP_FAILED]           = "unmapping failed page",
        [MF_MSG_DIRTY_SWAPCACHE]        = "dirty swapcache page",
        [MF_MSG_CLEAN_SWAPCACHE]        = "clean swapcache page",
@@ -1090,6 +1091,21 @@ static int memory_failure_hugetlb(unsigned long pfn, int trapno, int flags)
                return 0;
        }
 
+       /*
+        * TODO: hwpoison for pud-sized hugetlb doesn't work right now, so
+        * simply disable it. In order to make it work properly, we need
+        * make sure that:
+        *  - conversion of a pud that maps an error hugetlb into hwpoison
+        *    entry properly works, and
+        *  - other mm code walking over page table is aware of pud-aligned
+        *    hwpoison entries.
+        */
+       if (huge_page_size(page_hstate(head)) > PMD_SIZE) {
+               action_result(pfn, MF_MSG_NON_PMD_HUGE, MF_IGNORED);
+               res = -EBUSY;
+               goto out;
+       }
+
        if (!hwpoison_user_mappings(p, pfn, trapno, flags, &head)) {
                action_result(pfn, MF_MSG_UNMAP_FAILED, MF_IGNORED);
                res = -EBUSY;
@@ -1146,8 +1162,6 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
                return 0;
        }
 
-       arch_unmap_kpfn(pfn);
-
        orig_head = hpage = compound_head(p);
        num_poisoned_pages_inc();