Messages in this thread | | | Date | Thu, 1 Jul 2004 02:48:18 +0100 | From | Jamie Lokier <> | Subject | Re: Do x86 NX and AMD prefetch check cause page fault infinite loop? |
| |
Ingo, I think I now know what must be added to your 32-bit NX patch to prevent the "infinite loop without a signal" problem.
It appears the correct way to prevent that one possibility I thought of, with no side effects, is to add this test in i386/mm/fault.c:is_prefetch():
/* Catch an obscure case of prefetch inside an NX page. */ if (error_code & 16) return 0;
That means that it doesn't count as a prefetch fault if it's an _instruction_ fault. I.e. an instruction fault will always raise a signal. Bit 4 of error_code was kindly added alongside the NX feature by AMD.
(Tweak: Because early Intel 64-bit chips don't have NX, perhaps it should say "if ((error_code & 16) && boot_cpu_has(X86_FEATURE_NX))" instead -- if we find the bit isn't architecturally set to 0 for those chips).
This test isn't needed in the plain, non-NX i386 kernel, because the condition can never occur. (Actually it can once, a really obscure condition due to separate ITLB and DTLB loading and page table races with other CPUs, but it's transient so won't loop infinitely).
Enjoy, -- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |