* Jamie Lokier wrote: > 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). Thanks for the analysis Jamie, this should certainly solve the problem. I've attached a patch against BK that implements this. I've tested the patched x86 kernel on an athlon64 box and on a non-NX box - it works fine. Bit 4 also simplifies the detection of illegal code execution within the kernel - i retested that too and it still works fine. Ingo