• 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
Odd binary differences
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd binary differences


  • Subject: Odd binary differences
  • From: Eyal Redler <email@hidden>
  • Date: Tue, 09 Apr 2013 12:56:10 +0300

Hi,

I would be grateful if anyone could help me with the following very odd issue.

A little explanation first:

An application I've developed contains an anti tampering mechanism which involves verifying the CRC of certain functions in the code. While running, the application does a CRC check on a certain range of code in the app and then uses the value to lookup into a table which is configured to cause the app to crash for a bad CRC.

Of-course, the CRC value is not known until I actually compile the code and, on the other hand, I need to know the CRC in order to compile the code that generates the table. For this purpose I have a method whereby I compile and run the code, the app emits the right CRC and crashes, I use the CRC emitted to generate the correct table and re-compile. The table is not part of the CRC check and the machine code produced for the table is always the same size.

This method worked great for some time, I've produced several version of the app until I've upgraded xcode to a version which I can't recall (it could be that it was the 4 upgrade or maybe 4.x). Since then I'm experiencing this
1. I compile the app and run it - certain CRC value is emitted
2. I use the CRC to produce the table and re-compile
3. Run the app - a different CRC is produced (not always)
4. I can take the new CRC, produce re-generate the table, re-compile and it will work. But sometimes it will revert to the previous CRC. I can also simple try again and this time it will produce the right code (without any change to the source code)

So this is the problem: For the same exact c code, xcode will produce a slightly different object code.

A few more observations:
1. Inspecting the binary using otool -vt shows that the difference between two binaries is a few call instructions
		where one binary has:
	000049ec	calll	0x001fbd30
		and the other has:
	000049ec	calll	0x001fbd0c
		or
	00026fe9	jmp	0x001fbd06
	00026fe9	jmp	0x001fbd1e
2. The change is not random - xcode alternates between two versions of the code.
3. I tried to quit or clean or both before each compile but that didn't seem to help make it more consistent.

Thanks in advance for anyone who could help me shed some light on this.

Eyal
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Odd binary differences
      • From: Rich Siegel <email@hidden>
  • Prev by Date: Re: Distributing My Apps
  • Next by Date: Re: Odd binary differences
  • Previous by thread: Re: Xcode crash at background thread breakpoint
  • Next by thread: Re: Odd binary differences
  • Index(es):
    • Date
    • Thread