lkml.org 
[lkml]   [2003]   [Jul]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Emulating i486 on i386 (was: TSCs are a no-no on i386)
On Thu, 2003-07-31 12:51:09 +0100, Alan Cox <alan@lxorguk.ukuu.org.uk>
wrote in message <1059652268.16608.8.camel@dhcp22.swansea.linux.org.uk>:
> On Iau, 2003-07-31 at 12:38, Jan-Benedict Glaw wrote:
> > Thanks for that. In the meantime, I've started to give a try to the
> > userspace version (using a LD_PRELOAD lib). My current Problem:
> >
> > amtus:~/sigill_catcher# LD_PRELOAD=./libsigill.so ls
> > sigill.c:_init():69: sigill started, sigaction() = 0
> > build.sh intercept.h libsigill.so run.sh sigill.c sigill.o
> > amtus:~/sigill_catcher# LD_PRELOAD=./libsigill.so apt-get update
> > Illegal instruction
> >
> > See? It's loaded at the "ls" call, but it seems to be not loaded for
> > apt-get.
>
> Remember you need to overload signal setting functions like sigaction.
> My guess is apt decided to disable your signal and you didnt stop it

I thought about that. Though, strace shows this is straight after ldso
mapped all libs. So apt-get's main() didn't yet start.

amtus:~/sigill_catcher# cat run.sh
#!/bin/sh

LD_PRELOAD=./libsigill.so apt-get update

amtus:~/sigill_catcher# strace -o xxx -f -ff ./run.sh
Process 681 attached (waiting for parent)
Process 681 resumed (parent 680 ready)
Process 680 suspended
Process 680 resumed
Process 681 detached
./run.sh: line 3: 681 Illegal instruction LD_PRELOAD=./libsigill.so apt-get update
amtus:~/sigill_catcher# grep -i sig xx* | grep -i ILL
xxx:stat64("/root/sigill_catcher", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
xxx:wait4(-1, [WIFSIGNALED(s) && WTERMSIG(s) == SIGILL], 0, NULL) = 681
xxx.681:open("./libsigill.so", O_RDONLY) = 3
xxx.681:getcwd("/root/sigill_catcher", 128) = 21
xxx.681:--- SIGILL (Illegal instruction) @ 0 (0) ---

So my lib gets loaded, but it's _init() function seems to be called too
late (in prior, some parts of libstdc++5 decided to commit suicide).

Looking at the strace, libsigill is the loaded as the very first action.
Then, all the other libs are mapped. It seems that _init()ing them
happens somewhat in reverse order or something like that... I'm a but
hosed in that case:)

MfG, JBG

--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak!
ret = do_actions((curr | FREE_SPEECH) & ~(IRAQ_WAR_2 | DRM | TCPA));
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.097 / U:8.704 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site