Andi Kleen a écrit : > On Monday 23 January 2006 14:28, Eric Dumazet wrote: > >> Shouldnt we force a page fault for not possible cpus in cpu_data >> to catch all access to per_cpu(some_object, some_not_possible_cpu) ? >> >> We can use a red zone big enough to hold the whole per_cpu data. > > Good idea. Can you please send me a tested patch? > I did a patch (on top of 2.6.16-rc1-mm2) , but the kernel crashes in sched_init(void) for (i = 0; i < NR_CPUS; i++) { prio_array_t *array; rq = cpu_rq(i); spin_lock_init(&rq->lock); <<-CRASH In my config, NR_CPUS = 8, and I have one only one CPU inside my test box. So should I send only the patch or all the corrections I have to do to avoid all possible crashes in my config ? Thank you Eric Dumazet [PATCH] x86_64 : Use a special CPUDATA_RED_ZONE to catch accesses to per_cpu(some_object, some_not_possible_cpu) Because cpu_data(cpu)->data_offset may contain garbage, some buggy code may do random things without notice. If we initialize data_offset so that the per_cpu() data sits in an unmapped memory area, we should get page faults and stack traces should help us find the bugs. Signed-off-by: Eric Dumazet