Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Illegal instruction" on armv8 android device #3761

Closed
qwerty62 opened this issue Jul 30, 2019 · 10 comments
Closed

"Illegal instruction" on armv8 android device #3761

qwerty62 opened this issue Jul 30, 2019 · 10 comments

Comments

@qwerty62
Copy link

qwerty62 commented Jul 30, 2019

I've been running the samples from DynamoRIO-ARM-Android-EABI-7.1.0-1 on an armv8 android device. I built a simple HelloWorld binary executable from 64-bit Ubuntu 16.04 using Android-NDK, and pushed it onto the android device. It ran normally without DynamoRIO or any client, showing:
HelloWorld!
but when I ran it under DynamoRIO by:
./drrun -c ../samples/bin32/libbbsize.so -- ../hello
it showed:
Illegal instruction

I tried using "-debug" flag:
./drrun -debug -c ../samples/bin32/libbbsize.so -- ../hello
and it showed:
<Starting application /data/DynamoRIO/hello (31910)>
<Initial options = -no_dynamic_options -client_lib '/data/DynamoRIO/samples/bin3
2/libbbsize.so;0;' -code_api -stack_size 56K -signal_stack_size 32K -max_elide_j
mp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -n
ative_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct >
<WARNING! symbol lookup error: libc.so undefined symbol >
Illegal instruction

It would be great if anyone can offer some help.
Thanks.

@hgreving2304
Copy link

hgreving2304 commented Jul 30, 2019 via email

@derekbruening
Copy link
Contributor

Android support is 32-bit only, and the package you cite DynamoRIO-ARM-Android-EABI-7.1.0-1 does not have a sample/bin64 directory. Please clarify what you are running.

@qwerty62
Copy link
Author

qwerty62 commented Jul 31, 2019

Android support is 32-bit only, and the package you cite DynamoRIO-ARM-Android-EABI-7.1.0-1 does not have a sample/bin64 directory. Please clarify what you are running.

@derekbruening Sorry I mistook the directory. It was samples/bin32. And I believe ARM-V8 is compatible with 32-bit.

@qwerty62 qwerty62 reopened this Jul 31, 2019
@qwerty62
Copy link
Author

Could you run with loglevel 3 and check the output, and - better - run in gdb and check for the SIGILL's pc. Please note you might need to ignore the first SIGILL you're getting, which is used in DynamoRIO internally. Thanks

On Tue, Jul 30, 2019 at 2:38 AM qwerty62 @.***> wrote: I've been running the samples from DynamoRIO-ARM-Android-EABI-7.1.0-1 on an armv8 android device. I built a simple HelloWorld binary executable from 64-bit Ubuntu 16.04 using NDK, and pushed it onto the android device. It ran normally without DynamoRIO or any client, showing: HelloWorld! but when I ran it under DynamoRIO by: ./drrun -c ../sample/bin64/libbbsize.so -- ../hello it showed: Illegal instruction I tried using "-debug" flag: ./drrun -debug -c ../sample/bin64/libbbsize.so -- ../hello and it showed: <Starting application /data/DynamoRIO/hello_v7 (31910)> <Initial options = -no_dynamic_options -client_lib '/data/DynamoRIO/samples/bin3 2/libbbsize.so;0;' -code_api -stack_size 56K -signal_stack_size 32K -max_elide_j mp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -n ative_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct > <WARNING! symbol lookup error: libc.so undefined symbol > Illegal instruction It would be great if anyone can offer some help. Thanks. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#3761?email_source=notifications&email_token=AKK7Q5NPSUPOZDMIG2LGRJLQCAD2FA5CNFSM4IH2MPD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HCH7WFA>, or mute the thread https://github.com/notifications/unsubscribe-auth/AKK7Q5KWDPD64TXNGUF2653QCAD2FANCNFSM4IH2MPDQ .

Ran with -loglevel 3 and got the log with two .html files. But I cannot find anything valuable in the files. Could you please give some instructions on how to check the log files? @hgreving2304
Thanks.

@hgreving2304
Copy link

hgreving2304 commented Jul 31, 2019 via email

@qwerty62
Copy link
Author

qwerty62 commented Aug 1, 2019

While some systems and newer cores have the ability to run both ARM and AArch64 binaries in different processes, the ISAs are entirely different and not compatible. DynamoRIO has no ability to migrate between the two, Android support is 32-bit only, see above. It still sounds like you might be running an AArch64 binary, could you clarify?

On Tue, Jul 30, 2019 at 7:40 PM qwerty62 @.> wrote: Could you run with loglevel 3 and check the output, and - better - run in gdb and check for the SIGILL's pc. Please note you might need to ignore the first SIGILL you're getting, which is used in DynamoRIO internally. Thanks … <#m_-4789562876007238151_> On Tue, Jul 30, 2019 at 2:38 AM qwerty62 @.> wrote: I've been running the samples from DynamoRIO-ARM-Android-EABI-7.1.0-1 on an armv8 android device. I built a simple HelloWorld binary executable from 64-bit Ubuntu 16.04 using NDK, and pushed it onto the android device. It ran normally without DynamoRIO or any client, showing: HelloWorld! but when I ran it under DynamoRIO by: ./drrun -c ../sample/bin64/libbbsize.so -- ../hello it showed: Illegal instruction I tried using "-debug" flag: ./drrun -debug -c ../sample/bin64/libbbsize.so -- ../hello and it showed: <Starting application /data/DynamoRIO/hello_v7 (31910)> <Initial options = -no_dynamic_options -client_lib '/data/DynamoRIO/samples/bin3 2/libbbsize.so;0;' -code_api -stack_size 56K -signal_stack_size 32K -max_elide_j mp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -n ative_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct > <WARNING! symbol lookup error: libc.so undefined symbol > Illegal instruction It would be great if anyone can offer some help. Thanks. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#3761 <#3761>?email_source=notifications&email_token=AKK7Q5NPSUPOZDMIG2LGRJLQCAD2FA5CNFSM4IH2MPD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HCH7WFA>, or mute the thread https://github.com/notifications/unsubscribe-auth/AKK7Q5KWDPD64TXNGUF2653QCAD2FANCNFSM4IH2MPDQ . Ran with -loglevel 3 and got the log with two .html files. But I cannot find anything valuable in the files. Could you please give some instructions on how to check the log files? @hgreving2304 https://github.com/hgreving2304 Thanks. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3761?email_source=notifications&email_token=AKK7Q5OJXHG7UO3XTDFNSETQCD3SBA5CNFSM4IH2MPD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3F4I2I#issuecomment-516670569>, or mute the thread https://github.com/notifications/unsubscribe-auth/AKK7Q5P7OOZL6FGJDXLEAUTQCD3SBANCNFSM4IH2MPDQ .

snapshot
@hgreving2304 As you can see from above, the binary I'm running is a 32-bit binary, should be able to run on DynamoRIO I guess.

@hgreving2304
Copy link

hgreving2304 commented Aug 1, 2019 via email

@qwerty62
Copy link
Author

qwerty62 commented Aug 5, 2019

Solved the problem by adding set(DynamoRIO_USE_LIBC OFF) to the CMakelist.txt.
Thanks @hgreving2304 @derekbruening

@qwerty62 qwerty62 closed this as completed Aug 5, 2019
@hgreving2304
Copy link

Linking the client to libc should not result in invalid code and an illegal instruction.

@derekbruening
Copy link
Contributor

Agreed, it sounds like there is some problem with the private loading of Bionic. Probably this is a duplicate of #3543 on Android 9+. There is a workaround patch in that issue. Marking it as a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants