logs archiveIRC Archive / Undernet / #asm / 2006 / June / 14 / 1
vml
Lalla.
_0x90
yo
ike-
love the topic :)
Hsd
hi
hello!
MalibuVI
;)
Hsd
I wonder what #ASM means?
I program with assembler
it usually called ASM
so I joined :D
am I wrong?
I dont understand the topic :(
my mother tongue is not English
The_Base
hello
I created a var like this file: db "./3nCryPt",0 but when I try to examine it with gdb (x/s fflie) I get an out of bounds erro. What do I have to do ?
pls I need this help :/ Im stuck
ThFabba
uhm
"x/s fflie"?
The_Base
never mind
I gor a work around
got*
         

ThFabba
ah, k
The_Base
Im trying to program in linux using the c libraries
but I can stand it no more
everytime is another problem
its so frustation
there is no good tutotial or reference in the internet
besides wasting my day
Inode
there're a few ok ones
The_Base
not with this topic
Inode
well it should be rather straight forward once you know the basics of calling functions/including libraries from the libc
The_Base
I know
Inode
try this one
http://www.janw.dommel.be/eng.html
The_Base
thats easy. The error that I keep getting while compiling and link that is the problem.
I've seen this page
Inode
what's the error?
The_Base
now for example I keep getting undefined reference to `_fopen' with ld
Inode
can i see the source?
also
if you're using calls to the libc
you shouldn't need ld
create the object file with as
and run gcc to create the binary file
well (g)as or nasm will do
The_Base
I change _open to open so I can compile with gcc
Inode
does it work for you then?
The_Base
http://www.rafb.net/paste/results/Uvj9EN28.html
but I get an error in fclose
Program received signal SIGSEGV, Segmentation fault.
0x001603c9 in _IO_new_file_close_it () from /lib/libc.so.6
Im on a x86_64 but I compiled with m32
it should work
Inode
why are you using add and sub to adjust the stack pointer after calling the functions?
The_Base
to correct the pushs
I wasnt sure if the functions would sort that
Inode
i think "sub esp,4" on line 38 should be "add esp, 4"
The_Base
oops
Inode
also add a check for NULL (ie. [fdesc] == 0) on line 31
err 32
The_Base
well I check manually on gdb but can do that again
         

Inode
in case fopen fails
The_Base
that automatically
Inode
are you compiling with, gcc objfile.o -o binfile .... ?
The_Base
nasm -f elf -g shifter.asm
gcc -m32 -ggdb shifter.o -o shifter
Inode
ok
adding "-Wall -Werror" to the gcc cmd line might give some more descriptive errors/warnings
The_Base
nothing all quiet
Inode
does the binfile run ok?
edcba
don't even know why you try to rebalance the stacj
stack
The_Base
that I can remove
got it
changed push fdesc to push [fdesc]
eax had the address of the pointer. I copied that address to fdesc but was passing the fdesc address (not the address that fdesc holds) to the fclose
:)
so it was trying to close a non existing file descriptor
:)
Program exited normally.
I love that message
thanks
do you know how to see if a file is been open on linux ?
Inode
from the cmd line?
The_Base
even though I think it worked
yes
or in proc
/proc
I'm sure I've seen one before
Inode
well
The_Base
long time ago
Inode
you can try lsof
but it should only list currently open files
The_Base
thats the one
thanks
Inode
maybe set a break point on the esp adjustment or the push [fdesc], run the prog, and then check
The_Base
yeah its opening
yes. I set it after fopen
I removed that adjustment. I'm hoping that fopen and fclose pop those values and not just read them. But I think I will have to put it back since the only way they can alter an argument passed as &var
let me check
Inode
well, it's likely you can do without them, it just means maybe 12 bytes (3 objects) less of a local stack available
once compiled their function prologue should get rid of the args from the stack at call/run-time
The_Base
it runs without but the stack get deallocated
weeeeeee
that a reliefe
well got to take tha dog for a walk. Laterz all
and thanks again
thats my first asm prog :D
next »