-
Notifications
You must be signed in to change notification settings - Fork 137
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
For arm 32bit android build, the "__sync_synchronize" symbol is UNDEFINED in liblkl-hijack.so #348
Comments
I also faced atomic ops symbols issue which I tried to solve by #273. not upstreamed yet but it would be great if you can try the patch if it works or not. |
@thehajime Thanks for your help. They are:
From the pull request #273 , I can see some similar ops are defined for ARMEL arch. However, all of them are not with "_4" ending. What should we can do about these symbols? Could you give some advices on it? |
@thehajime Here is one solution mentioned in one old (about 5 years ago) blog: How to solve __sync_add_and_fetch_4, but we need to rebuild the compiler, which is more complicated for me. |
@thehajime By adding "-march=armv8-a" to both
I can track to BTW, for comparison, the lkl hijacking for aarch64 works fine for me. |
a stack trace with gdb (from core dump if you have) will be helpful to see what's wrong with. does
That's a great news. |
Yes, I enabled
No.
|
@thehajime Here is the final parts of Anything useful for debug? Thanks.
|
@mxi1 thanks for the trace, but I wasn't able to imagine how it works bad.. maybe I think we can fix the build issue you faced If PIE build is a constraint on Android binary, we can add the linker flag ( |
@thehajime Thanks for your advice.
Now, I can run the 32bit
From the source code, the segmentation fault comes from |
@thehajime In order to find where the code crashes, I added several checkpoints, and found the location:
it will call the In |
@mxi1 now I'm trying to test this on aarch64 but still struggling to build liblkl-hijack.so. which toolchain did you use when aarch64 hijack works fine ? I'm right now using the tarball generated by btw, please close this issue if you solved the original issue. |
@thehajime Okay, I think I can close this issue, and I am still preparing one patch for both arm32 and arm64 supports. There's one bug in aarch64 android gcc toolchain 4.9, you need to use one higher-version toolchain, I remember version 5.4 should work, which I got from linaro git repo. Let me try to find the url for you from my home laptop |
@mxi1 Thanks a lot ! Though I still faced the same issue of linking (https://sourceware.org/bugzilla/show_bug.cgi?id=18270), I can successfully build liblkl-hijack.so with 6.3 version of toolchain (https://android-git.linaro.org/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-6.3-linaro.git/) and it's working fine on aarch64 emulator (of Android).
|
@thehajime I didn't notice this issue. I am trying to make the networking function of this hijack library work for me. Is the issue very serious for running lkl on aarch64 platform? |
@mxi1 we're trying to make the network working but not deeply tried yet. the above issue of 4.9/5.4 toolchains is about ld (linker), we cannot build liblkl-hijack.so so we cannot avoid the issue. |
@thehajime Have you enabled 64BIT in the config file? I checked my Makefile, no special options for elf64-littleaarch64 support. What I do is just adding |
yes
my current, work-in-progress patches are available here. it's going to be more complicated later :) |
btw, I'm testing 7.x android for the above aarch64 hijack. |
@thehajime the android version doesn't matter. the gcc cross-toolchain stays the 4.9 version, and it seems Google will use llvm to replace gcc. I have added two comments in your 5c5bd5c patch, you could try my way to see if it works. |
Have you ever tried the ARM 32bit build with arm-linux-androideabi-gcc (4.9.x, 5.x, 6.x, whatever)? I am trying to make hijacking work on Android shell.
After the CROSS_PATH, CROSS_COMPILE and SYS_ROOT environmental variables are set, and some endian-related macro redefinitions are removed, the build process looks nice and the
liblkl-hijack.so
file is generated. Then, I pushed the file to one root-ed Android device, and setup theLD_PRELOAD=/blah/blah/liblkl-hijack.so
to run theip addr show
-like commands.Here, the issues show up with
symbols cannot located
. Actually, there're more than one UNDEFINED symbols like dpdk and vde-related symbols. I removed all the dpdk and vde-related code blocks because they don't exist on my root-ed android device. Then, the confusing__sync_synchronize
comes up.I searched via Google, and knew that this symbol is gcc-internal, and should not appear in symbol table of the dynamic library. I tried to remove the
--nodefaultlibs
option, and this symbol is not UDNEFINED, but thesegment fault
error will show up when hijack is working.Has anyone met the similar issue on any ARM 32bit platforms? Please give me your hands for this. Thank you!
The text was updated successfully, but these errors were encountered: