On Thu, May 26, 2011 at 10:40:39AM +0300, Akos PASZTORY wrote:
On Wed, May 25, 2011 at 11:33 PM, Akos PASZTORY
<akos.pasztory(a)gmail.com> wrote:
>> 2) I'd also had problems with setjmp - I think this was in perl (in
>> the spec wrapper); adding
>>
>> -nlongjmp,siglongjmp,_longjmp,__longjmp_chk,__libc_longjmp,__libc_siglongjmp
>
> I am investigating this (or a related) issue, similar to [1]. Calling
> setjmp via the profiling PLT trampoline will result in storing the
> wrong stack pointer in jmp_buf...
>
> [1]
https://fedorahosted.org/pipermail/latrace/2010-October/000004.html
Hm, there was a vfork/setjmp workaround in a branch, I thought it made
to master, but I don't see it now. Jiri, do you have any ideas how
this could be fixed in glibc? (I don't really see any.)
that branch was just silly workaround... simple bypass via strcmp
for vfork|setjmp... '-n' option is better, maybe we can put setjmp
and vfork as predefined symbols to '-n' string..
I dont think we can fix vfork because of its nature, man says:
---
The vfork() function has the same effect as fork(2), except that the
behavior is undefined if the process created by vfork() either
modifies any data other than a variable of type pid_t used to
store the return value from vfork(), or returns from the function in
which vfork() was called, or calls any other function before successfully calling
_exit(2) or one of the exec(3) family of functions.
---
latrace will break this.. I dont see the way out
as for setjmp, as I said it could be probably fixed in libc but
I'm not sure how.. I need to get back to where I stop last time ;)
I'll post something about that
thanks,
jirka
Attached a test program I was playing with on ARM. It crashes under
latrace. Passing '-n _setjmp' to latrace makes it work.
#if 0
exec cc -g -O0 $0
#endif
#include <setjmp.h>
#include <string.h>
#include <stdio.h>
static jmp_buf jb;
void bb(char *x)
{
x[20] = 'a';
printf("2 %p %80s\n", x, x);
longjmp(jb, 1);
}
void aa()
{
char x[81];
memset(x, '.', sizeof(x));
x[80] = 0;
printf("1 %p %80s\n", x, x);
if (setjmp(jb) > 0) {
printf("3 JB.sp = %x\n", jb[0].__jmpbuf[8]);
printf("3 %p %80s\n", x, x);
return;
}
printf("1 JB.sp = %x\n", jb[0].__jmpbuf[8]);
bb(x);
}
int main()
{
aa();
return 0;
}
_______________________________________________
latrace mailing list
latrace(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/latrace