• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT] Debugger protection (was: Implementing Licensing ...)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OT] Debugger protection (was: Implementing Licensing ...)


  • Subject: Re: [OT] Debugger protection (was: Implementing Licensing ...)
  • From: Allan Odgaard <email@hidden>
  • Date: Thu, 8 Apr 2004 23:33:19 +0200

On 8. Apr 2004, at 21:55, Howard Jones wrote:

Self-modifying code would of cause not be very good for non-x86 platforms.
Why is that? I don't see any reasons (aside from the obvious horribleness of it) why it's an x86 specific thing... It was certainly a fairly common thing to do back in my 68000 days.

The technical reason is that there is a separate data and code cache (called a Harvard architecture AFAIK), so if you overwrite some of the instructions, the changes will not take effect if these were in the code cache (as the changes are made to the data cache) and/or if there is no write-through.

It worked for the 68000 because the cache was either very small or non-existent (I think it cached one instruction so only single line loops would benefit) -- on the 68020 it would not work unless you explicitly flushed the cache.

In some operation systems self-modifying code is not allowed by (an enforced) convention, so memory pages are either set to be writable or executable, but cannot be both. This is to prevent buffer overruns from executing malicious code or similar.

I do not know the details about the x86, but have on several occasions seen references to how it allowed self-modifying code -- wether it allows it w/o a cache flush I do not know, but that was my understanding (and thus this "allowance" has later been yet another perplexing element for Intel and AMD to work with).

Of cause the PPC do allow self-modifying code on some level, as it loads code from disk into memory, applies relocation etc. -- but changing your own program on-the-fly will most likely fail to work unless you flush caches, which will affect the performance significantly.





** Cocoa FAQ: <http://www.alastairs-place.net/cocoa/faq.txt> **
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >[little OT] Licensing/Implementing in Cocoa/Obj-C (From: Matt Jaffa <email@hidden>)
 >Re: [little OT] Licensing/Implementing in Cocoa/Obj-C (From: Stefan Pantke <email@hidden>)
 >Re: [little OT] Licensing/Implementing in Cocoa/Obj-C (From: Allan Odgaard <email@hidden>)
 >Re: [little OT] Licensing/Implementing in Cocoa/Obj-C (From: Stefan Pantke <email@hidden>)
 >Re: [now OT] Licensing/Implementing in Cocoa/Obj-C (From: Shawn Erickson <email@hidden>)
 >Re: [now OT] Licensing/Implementing in Cocoa/Obj-C - Interest in product? (From: Stefan Pantke <email@hidden>)
 >Re: [now OT] Licensing/Implementing in Cocoa/Obj-C - Interest in product? (From: j o a r <email@hidden>)
 >Implementing Licensing in C/ObjC/Cocoa (was: Re: [now OT] Licensing/Implementing in Cocoa/Obj-C - Interest in product?) (From: Alastair Houghton <email@hidden>)
 >Re: Implementing Licensing in C/ObjC/Cocoa (was: Re: [now OT] Licensing/Implementing in Cocoa/Obj-C - Interest in product?) (From: Stefan Pantke <email@hidden>)
 >[OT] Debugger protection (was: Implementing Licensing ...) (From: Allan Odgaard <email@hidden>)
 >Re: [OT] Debugger protection (was: Implementing Licensing ...) (From: Howard Jones <email@hidden>)

  • Prev by Date: RE: Simple question: How do you store a sender's ID?
  • Next by Date: Re: [OT] Debugger protection (was: Implementing Licensing ...)
  • Previous by thread: Re: [OT] Debugger protection (was: Implementing Licensing ...)
  • Next by thread: Re: [now OT] Licensing/Implementing in Cocoa/Obj-C - Interest in product?
  • Index(es):
    • Date
    • Thread