PDA

View Full Version : Electric Fence linux


Cpl. Shrike
20-04-2004, 16:18
Anybody got expirience using "electric fence" on linux ??


Got so far as inluding the libefence.a to the link list.
like this.

MOD_DIR = /usr/steam/hlds_l/tod/dlls/shrikebot_i586.so
MOD_DIR2 = /usr/steam/hlds_l/dod/dlls/shrikebot_i586.so

CPP = g++
BASEFLAGS = -Dstricmp=strcasecmp -Dstrcmpi=strcasecmp
CPPFLAGS = ${BASEFLAGS} -march=i586 -O2 -w -I../engine -I../common -I../pm_shared

OBJ = bot.o bot_chat.o bot_client.o bot_combat.o bot_goal.o bot_models.o \
bot_navigate.o bot_start.o dll.o dll_command.o engine.o linkfunc.o \
sb_export.o sb_util.o waypoint.o wptnav.o /usr/lib/libefence.a

shrikebot_i586.so: ${OBJ}
${CPP} -fPIC -shared -o $@ ${OBJ} -Xlinker -Map -Xlinker shrike_bot.map -ldl

cp -f shrikebot_i586.so ${MOD_DIR}
cp -f shrikebot_i586.so ${MOD_DIR2}

clean:
-rm -f *.o
-rm -f *.so

%.o: %.cpp
${CPP} ${CPPFLAGS} -c $< -o $@

%.o: %.c
${CPP} ${CPPFLAGS} -c $< -o $@

And it compiles without error.

But im a little in the dark what to do next.
Documentation on the program is hard to find.
Just run the DLL ?? where can expect output ??
:|

stefanhendriks
20-04-2004, 20:25
i have never heard of it. Any link for info?

Cpl. Shrike
20-04-2004, 22:09
Err well that's kinda the problem. hard to find any tut's on it.

but it comes shiped with almost all linux distros.
"ElectricFence-2.2.2-13.RPM" (ftp://fr.rpmfind.net/linux/PLD/current/dists/ra/PLD/i386/PLD/RPMS/ElectricFence-2.2.2-13.i386.rpm)

It's suppose to detect bad mallocs and overflows. =)

From the small bits and piece i found on google i understand it has to be compiled in. But i fail to grasp on how to actually use it. :(

stefanhendriks
20-04-2004, 23:01
Found on google ;)

http://perens.com/FreeSoftware/
"my malloc() debugger for Linux and Unix. This will stop your program on the exact instruction that overruns or under-runs a malloc() buffer. "

http://packages.debian.org/unstable/devel/electric-fence
Package: electric-fence (2.1.13-0.1)

A malloc(3) debugger



Electric Fence is a debugger that uses virtual memory hardware to detect illegal memory accesses. It can detect two common programming bugs: software that overruns or underruns the boundaries of a malloc() memory allocation, and software that touches a memory allocation that has been released by free().

Unlike other malloc() debuggers, Electric Fence will detect read accesses as well as writes, and it will stop and pinpoint the exact instruction that causes an error. It is not as thorough as Purify, however. In order to debug a program it needs to be linked with Electric Fence's library or dynamic linking needs to be used; README.Debian explains that in detail.

...

i have a dozen of those links:
http://www.opennet.ru/prog/info/1373.shtml
http://www.portalux.com/detail?oid=2695
http://linux.maruhn.com/sec/electricfence.html

as far as i can tell from this information. It is a debugging tool as you described.

Cpl. Shrike
20-04-2004, 23:37
yup and that's as far as the story goes
I visited all those linkies before. i do know google a little :D

It's just my n00b linux knowledge, im just missing some info somewhere down the line.

===========
edit.

Ahh i think i got something going here.

man libefence

Pierre-Marie Baty
21-04-2004, 00:30
===========
edit.

Ahh i think i got something going here.

man libefence:D ROFL.

I'm sure lots of things are going better now. :D

Cpl. Shrike
21-04-2004, 00:34
Well to be honest i doubt it will ever turn a up an error.

I can run the server/bot for days on linux.
Trying to catch the bogus message id that was reported in the shrikebot section.