Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
- Subject: Re: intercepting system calls works on tiger(10.4.5) but not on panther(10.3.9)
- From: "Peter O'Gorman" <email@hidden>
- Date: Thu, 18 May 2006 14:08:38 +0900
On Wed, 2006-05-17 at 22:50 -0600, Puthali H.B wrote:
>
> But on panther, I face two kinds of problems, depending on whether I
> use dlopen or syscall to call the underlying system connect.
>
> If I use dlopen, followed by dlsym, then it loops in the over-ridden
> connect, which is very weird.
Not really, on panther dlsym(RTLD_NEXT,"connect") is always going to
give you the first connect function it finds when force flat namespace
is in effect. So you get into an infinite loop, exhaust stack and crash.
This is fixed in tiger.
>
> where as, if I use syscall, then it throws up the following-
Again, works for me:
peter$ cat connect.c
#include <stdio.h>
#include <sys/syscall.h>
int
connect(int s, const struct sockaddr *name, int namelen)
{
fprintf(stderr,"Connect Called\n");
return syscall(SYS_connect,s,name,namelen);
}
peter$ cc -dynamiclib -o test_connect.dylib connect.c
peter$ env DYLD_INSERT_LIBRARIES=./test_connect.dylib \
DYLD_FORCE_FLAT_NAMESPACE=1 ftp ftp.pogma.com
Connect Called
Connected to ftp.pogma.com.
I think you probably want to avoid dlsym RTLD_NEXT et.al. on panther and
just use the syscalls.
Peter
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden