Re: [PATCH] garbage values in file /proc/net/sockstat

From: Eric Dumazet
Date: Mon Jan 23 2006 - 08:29:38 EST


Andi Kleen a écrit :
On Monday 23 January 2006 12:21, pravin shelar wrote:
In 2.6.16-rc1-mm1, (for x86_64 arch) cpu_possible_map is not same as NR_CPUS (prefill_possible_map()). Therefore per cpu areas are allocated for cpu_possible cpus only (setup_per_cpu_areas()). This causes sockstat to return garbage value on x84_64 arch.

So these per_cpu accesses are geting relocated (RELOC_HIDE) using
boot_cpu_pda[]->data_offset which is not initialized.

There are other instances of same bug where per_cpu() macro is used
without cpu_possible() check. e.g. net/core/utils.c :: net_random_reseed(), net/core/dev.c :: net_dev_init(), etc.

This patch fixes these bugs.

Thanks. Patches Look good. Dave, can you push them for 2.6.16 still please?


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.

Something like :

file include/asm-x86_64/pgtable.h

#define CPUDATA_RED_ZONE 0xffff808000000000UL /* start of percpu catcher */

file arch/x86_64/kernel/setup64.c

setup_per_cpu_areas(void)
{
...
for (i = 0 ; i < NR_CPUS ; i++) {
if (!cpu_possible(cpu))
cpu_pda(i)->data_offset = CPUDATA_RED_ZONE - __per_cpu_start ;
}
}

Eric

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/