tags:

views:

75

answers:

3

Hello,

After reading this wikipedia article :

http://en.wikipedia.org/wiki/Self-modifying_code

I am wondering if this technique has been done on iPhone.

Thanks

Thierry

A: 

Not allowed by apple, and I believe it's physically prevented, the code space can't be modified, and code cannot run from the data space. (Jailbreaking could fix this however)

Bill K
A: 

A standard iPhone application is unable to set a memory page as executable. So, it's impossible to modify your own code or generate code at runtime (ie.: Just In Time compilation).

A jailbroken device will allow you to have such pages though.

JPD002
thanks.My goal was to find a way to securing a library which my application was compiled with. Any idea ?
thierryb
You want to obfuscate the code in your library so people won't reverse engineer it?
JPD002
yes this is what I need to do
thierryb
Well, if it's a standard C or C++ library, symbolic information shouldn't appear in the binary generated by the Release configuration. It should be enough to stop anyone who doesn't have knowledge of the ARM architecture.
JPD002
A: 
Three things that are most trecherous:
Connectors that corrode
Recursive algorithms 
And self modifying code 
         -- traditional programmer's chanty

Self modifying code is the easiest and surest way to make code behavior completely unpredictable. It's something that is interesting academically but it is seldom a practical tool.

As near as I can tell, it's primary use is to wreak vengeance on an employer when you know you're going to be fired.

TechZen