[Cbe-oss-dev] [PATCH 1/1] Fix another user-visible SPU coredump bug

Michael Ellerman michael at ellerman.id.au
Tue Aug 21 14:50:44 EST 2007


On Mon, 2007-08-20 at 15:30 +0200, Arnd Bergmann wrote:
> On Monday 13 August 2007, Michael Ellerman wrote:
> > 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.
> 
> Uli just stumbled over this patch and noted that it's the wrong solution.
> gdb expects the notes to be in exactly the same format as the file
> contents.

Urgh. I'd say the contents of the coredump should be binary, tools can
do what they want with it after that. I guess it's easier to just keep
gdb happy, but there might be other debuggers that disagree.

> This means that the notes sizes were correct, but the content
> was incorrectly written in binary form instead of using the
> correct format string.

No they weren't. They might have been correct for certain values, but
there's no guarantee what size the output of:

 sprintf(s, "0x%lx", unknown_value)

will be.

To support that we're going to need to calculate the size on the fly,
based on the content of the file, rather than hard coding. Which means
completely redesigning the reading logic basically.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070821/33b712ea/attachment.pgp>


More information about the cbe-oss-dev mailing list