Messages in this thread | | | Date | Tue, 30 Sep 2003 01:19:30 +0100 | From | Jamie Lokier <> | Subject | Re: [PATCH] Athlon Prefetch workaround for 2.6.0test6 |
| |
Andi Kleen wrote: > + /* > + * Avoid recursive faults. This catches the kernel jumping to nirvana. > + * More complicated races with unmapped EIP are handled elsewhere for > + * user space. > + */ > + if (regs->eip == addr) > + return 0;
I'm curious - how does this help?
If the kernel jumps into nirvana, it will page fault. is_prefetch() will do a __get_user which will fault - recursion, ok. The inner fault handler will reach fixup_exception(), fixup the __get_user, and return without recursing further. is_prefetch() will simply return.
So how does the above test help?
> + if (seg & (1<<2)) > + desc = current->mm->context.ldt; > + else > + desc = (u32 *)&cpu_gdt_table[smp_processor_id()]; > + desc = (void *)desc + (seg & ~7); > + return (desc[0] >> 16) | > + ((desc[1] & 0xFF) << 16) | > + (desc[1] & 0xFF000000);
In addition to needing get_cpu() to protect the GDT access, this code needs to take down(¤t->mm->context.sem) for the LDT access.
Otherwise, context.ldt may have been vfree()'d by the time you use it, and the desc[0..1] accesses will panic.
Thanks, -- 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/
| |