How to disable dexopt/dexverify ?

Discuss porting Android to any device.

How to disable dexopt/dexverify ?

Postby Bytec0d3 » Fri Feb 18, 2011 5:26 pm

Hi all,
i'm trying to disable dexopt on the emulator to test the execution of a corrupted dex file.
I've tried this:
Code: Select all
adb shell setprop dalvik.vm.dexopt-flags v=n
adb shell stop; adb shell start

adb shell getprop | grep dalvik
[dalvik.vm.dexopt-flags]: [v=n]


but when i lunch the .jar file with
Code: Select all
adb shell dalvikvm -cp /mnt/sdcard/Test.jar Test


dexopt seems still to be launched:
Code: Select all
D/dalvikvm(  337): DexOpt: incorrect opt magic number (0xff ff ff ff)
D/dalvikvm(  337): ODEX file is stale or bad; removing and retrying (/data/dalvik-cache/mnt@sdcard@Test.jar@classes.dex)
D/dalvikvm(  337): DexOpt: --- BEGIN 'Test.jar' (bootstrap=0) ---
E/dalvikvm(  338): Bogus size for section: got 0xe; expected 0x16ac
E/dalvikvm(  338): Swap of section type 0001 failed
E/dalvikvm(  338): ERROR: Byte swap + verify failed
E/dalvikvm(  338): Optimization failed
W/dalvikvm(  337): DexOpt: --- END 'Test.jar' --- status=0xff00,process failed
E/dalvikvm(  337): Unable to extract+optimize DEX from 'Test.jar'
W/dalvikvm(  337): threadid=1: thread exiting with uncaught exception (group=0x40015560)


I get the same error if i launch the command:

Code: Select all
adb shell dalvikvm -Xverify:none -Xdexopt:none -cp /mnt/sdcard/Test.jar Test


so how can i disable dexopt / dex verification process?

Thanks in advance.
Bytec0d3
Freshman
Freshman
 
Posts: 4
Joined: Fri Oct 29, 2010 10:29 am

Top

Re: How to disable dexopt/dexverify ?

Postby Openxcell » Thu Apr 14, 2011 10:53 am

Bytec0d3 wrote:Hi all,
i'm trying to disable dexopt on the emulator to test the execution of a corrupted dex file.
I've tried this:
Code: Select all
adb shell setprop dalvik.vm.dexopt-flags v=n
adb shell stop; adb shell start

adb shell getprop | grep dalvik
[dalvik.vm.dexopt-flags]: [v=n]


but when i lunch the .jar file with
Code: Select all
adb shell dalvikvm -cp /mnt/sdcard/Test.jar Test





Code: Select all
D/dalvikvm(  337): DexOpt: incorrect opt magic number (0xff ff ff ff)
D/dalvikvm(  337): ODEX file is stale or bad; removing and retrying (/data/dalvik-cache/mnt@sdcard@Test.jar@classes.dex)
D/dalvikvm(  337): DexOpt: --- BEGIN 'Test.jar' (bootstrap=0) ---
E/dalvikvm(  338): Bogus size for section: got 0xe; expected 0x16ac
E/dalvikvm(  338): Swap of section type 0001 failed
E/dalvikvm(  338): ERROR: Byte swap + verify failed
E/dalvikvm(  338): Optimization failed
W/dalvikvm(  337): DexOpt: --- END 'Test.jar' --- status=0xff00,process failed
E/dalvikvm(  337): Unable to extract+optimize DEX from 'Test.jar'
W/dalvikvm(  337): threadid=1: thread exiting with uncaught exception (group=0x40015560)


I get the same error if i launch the command:

Code: Select all
adb shell dalvikvm -Xverify:none -Xdexopt:none -cp /mnt/sdcard/Test.jar Test


so how can i disable dexopt / dex verification process?

Thanks in advance.



You can disable dexopt using command line flags. Classes that have been verified successfully have a flag set in the ODEX.They will not be re-verified when loaded. The Linux access permissions are expected to prevent tampering; if you can get around those, installing faulty bytecode is far from the easiest line of attack.
The ODEX file has a 32-bit checksum, but that's chiefly present as a quick check for corrupted data.
Openxcell
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Mon Mar 28, 2011 1:59 pm

Top

Return to Porting Android

Who is online

Users browsing this forum: No registered users and 4 guests