Commit c1a72173 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[POWERPC] spufs: Don't return -ENOSYS as extra notes size if spufs is not loaded

Because the SPU coredump code might be built as part of a module (spufs),
we have a stub which is called by the coredump code, this routine then calls
into spufs if it's loaded.

Unfortunately the stub returns -ENOSYS if spufs is not loaded, which is
interpreted by the coredump code as an extra note size of -38 bytes. This
leads to a corrupt core dump.

If spufs is not loaded there will be no SPU ELF notes to write, and so the
extra notes size will be == 0.
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Acked-by: default avatarArnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 59000b53
...@@ -31,15 +31,19 @@ static DEFINE_MUTEX(spu_coredump_mutex); ...@@ -31,15 +31,19 @@ static DEFINE_MUTEX(spu_coredump_mutex);
int arch_notes_size(void) int arch_notes_size(void)
{ {
long ret; int ret;
ret = -ENOSYS;
mutex_lock(&spu_coredump_mutex); mutex_lock(&spu_coredump_mutex);
if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) { if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) {
ret = spu_coredump_calls->arch_notes_size(); ret = spu_coredump_calls->arch_notes_size();
module_put(spu_coredump_calls->owner); module_put(spu_coredump_calls->owner);
} else {
ret = 0;
} }
mutex_unlock(&spu_coredump_mutex); mutex_unlock(&spu_coredump_mutex);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment