ld unresolved symbols
Hi, sorry i send the first mail only to you but not to this list.
Why do you call mprotect not by int $0x80?
----- Original Message -----
From: "Jason Roberts" <[email protected]>
Date: Thu, 06 Nov 2003 19:21:44 +0000
To: [email protected]
Subject: ld unresolved symbols
Quoted 105 lines
Hi all,
I was trying to implement some smc--- someone Maik ? suggested using mprotect
to get write acces to code seg. Anyways, nasm will assemble but linker complains:
smc.o(.text+0x64): In function `protect':
: undefined reference to `_mprotect'I compiled like this:
nasm -f elf -i/usr/include/sys smc.asm
ld -s smc.oany help would be appreciated...
I dont want to wade through 85+ pages of dense reading to find the right 'switch' -- I do have a life besides code bashing:)
Thanks
JRsection .data
string db "normal execution",10,13,0
hstring db "I am modified!",10,13,0section .text
global
_start
extern_mprotect
_start:jmp
_testhacked:
mov edx,17 ;length of buffer mov eax,4 ;sys_write mov ebx,1 ;file descriptor mov ecx,hstring ;bufferint
0x80
jmp exit
_test:call modify
xor eax,eax ;this will be performed but ignored
hack_me:mov edx,19 ;length of buffer
mov eax,4 ;sys_write
mov ebx,1 ;file descriptor
mov ecx,string ;buffer
int0x80modify:
mov edi,to_write;load address of code-to-write in EDI
pushhack_me;save address to write for mprotect
call protect
mov [hack_me], edi ;write code to location 'hack_me:'
ret ;return from call
to_write:jmp hacked
protect:
pop edi mov ecx,0x2 ;PROT_WRITE push ecx mov ecx,2048 push ecx push edi call _mprotect retexit:
mov ebx,eax
mov eax,1
int0x80_________________________________________________________________
Send a QuickGreet with MSN Messenger
http://www.msnmessenger-download.com/tracking/cdp_games-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 6 lines
______________________________________________ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze