keystone-engine / keystone

Keystone assembler framework: Core (Arm, Arm64, Hexagon, Mips, PowerPC, Sparc, SystemZ & X86) + bindings
http://www.keystone-engine.org
GNU General Public License v2.0
2.26k stars 453 forks source link

Error in assembly of thumb2 instructions(adr/adr.w) #483

Open ele7enxxh opened 3 years ago

ele7enxxh commented 3 years ago

Hi all,

kstool:

kstool thumb "start:; adr r3, start; b #0x129f8;" 0x32f048  --> wrong
start:; adr r3, start; b #0x129f8; = [ af f2 04 03 e3 f4 d5 bc ] 

kstool thumb "start:; adr.w r3, start; b #0x129f8;" 0x32f048  --> right
start:; adr.w r3, start; b #0x129f8; = [ af f2 04 03 e3 f4 d4 bc ]

cstool:

cstool thumb "af f2 04 03 e3 f4 d5 bc" 0x32f048
32f048  af f2 04 03  subw       r3, pc, #4
32f04c  e3 f4 d5 bc  b.w        #0x129fa ---> wrong

cstool thumb "af f2 04 03 e3 f4 d4 bc" 0x32f048
32f048  af f2 04 03  subw       r3, pc, #4
32f04c  e3 f4 d4 bc  b.w        #0x129f8 ----> right
google-mirror commented 3 years ago

http://aosp.opersys.com/xref/android-10.0.0_r3/xref/cts/hostsidetests/securitybulletin/securityPatch/CVE-2018-9424/poc.cpp