Subject: cell: Fix another user-visible SPU coredump bug From: Michael Ellerman The SPU coredump code has an array of "spufs_coredump_reader"s, each of which has either a read or a get callback, as well as the size of the data it will generate. Those with read callbacks can generate an arbitrary amount of data, however the get callbacks all return a u64, 8 bytes, and this is enforced by do_coredump_read(). There seems to be a bit of confusion however, and some of the get callbacks supposedly return quantities other than 8 bytes. It looks as though there might have been some ascii vs binary mixup, eg. "0x11112222\n" == 11, and "0x1111222233334444\n" == 19. Although this bug doesn't lead to unloadable coredumps, it does make the contents of the SPU notes incomprehensible to user space (without hacks) - so I think we should fix it asap. Signed-off-by: Michael Ellerman Acked-by: Jeremy Kerr Signed-off-by: Arnd Bergmann --- Paulus, please apply for 23, Jeremy has already acked this. Apologies this is late in the cycle, I've only just had time to look into it. --- arch/powerpc/platforms/cell/spufs/file.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) --- Index: linux-2.6/arch/powerpc/platforms/cell/spufs/file.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c +++ linux-2.6/arch/powerpc/platforms/cell/spufs/file.c @@ -2212,14 +2212,14 @@ struct tree_descr spufs_dir_nosched_cont struct spufs_coredump_reader spufs_coredump_read[] = { { "regs", __spufs_regs_read, NULL, 128 * 16 }, { "fpcr", __spufs_fpcr_read, NULL, 16 }, - { "lslr", NULL, __spufs_lslr_get, 11 }, - { "decr", NULL, __spufs_decr_get, 11 }, - { "decr_status", NULL, __spufs_decr_status_get, 11 }, + { "lslr", NULL, __spufs_lslr_get, 8 }, + { "decr", NULL, __spufs_decr_get, 8 }, + { "decr_status", NULL, __spufs_decr_status_get, 8 }, { "mem", __spufs_mem_read, NULL, 256 * 1024, }, { "signal1", __spufs_signal1_read, NULL, 4 }, - { "signal1_type", NULL, __spufs_signal1_type_get, 2 }, + { "signal1_type", NULL, __spufs_signal1_type_get, 8 }, { "signal2", __spufs_signal2_read, NULL, 4 }, - { "signal2_type", NULL, __spufs_signal2_type_get, 2 }, + { "signal2_type", NULL, __spufs_signal2_type_get, 8 }, { "event_mask", NULL, __spufs_event_mask_get, 8 }, { "event_status", NULL, __spufs_event_status_get, 8 }, { "mbox_info", __spufs_mbox_info_read, NULL, 4 }, @@ -2227,7 +2227,7 @@ struct spufs_coredump_reader spufs_cored { "wbox_info", __spufs_wbox_info_read, NULL, 16 }, { "dma_info", __spufs_dma_info_read, NULL, 69 * 8 }, { "proxydma_info", __spufs_proxydma_info_read, NULL, 35 * 8 }, - { "object-id", NULL, __spufs_object_id_get, 19 }, + { "object-id", NULL, __spufs_object_id_get, 8 }, { }, }; int spufs_coredump_num_notes = ARRAY_SIZE(spufs_coredump_read) - 1;