DragonFly users List (threaded) for 2007-11
DragonFly BSD
DragonFly users List (threaded) for 2007-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: vsnprintf broken


From: Johannes Hofmann <Johannes.Hofmann@xxxxxx>
Date: 12 Nov 2007 21:00:56 GMT

Simon 'corecode' Schubert <corecode@fs.ei.tum.de> wrote:
> [-- text/plain, encoding quoted-printable, charset: UTF-8, 29 lines --]
> 
> Simon 'corecode' Schubert wrote:
>> Johannes Hofmann wrote:
>>> Hello,
>>>
>>> I see crashes with a string handling library on DragonFly.
>>> The problem can be reduced to the test program below. It crashes on
>>> DragonFly when compiled with "gcc -O2 -o foo foo.c". Without -O2 it 
>>> runs fine. No problems on Linux with or without -O2.
>>> Can anyone spot the problem? I think its related to the use of
>>> va_copy().
>> 
>> No, the problem is that gcc uses %ebx after a function call, which it is
>> not allowed to do:
> [snip]
>> Or does the ABI dictate that %ebx needs to be restored?  Seems that
>> linux/glibc doesn't clobber ebx.
> 
> okay, I am wrong here.  %ebx is supposed to be saved and is also being
> saved by vsnprinf.  gcc is good.
> 
> So this is actually a case of stack smashing.  Have fun finding the bug
> in vsnprintf or in your code :)

Will have :-). On FreeBSD-6.0 it works ok, so I think I will start from
there....

Cheers,
Johannes

> 
>> cheers
>>   simon
> 
> 
> 
> [-- application/pgp-signature, encoding 7bit, 9 lines, name: signature.asc --]
> [-- Description: OpenPGP digital signature --]
> 



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]