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

custom csd_wrapper not working on 5.0 lollipop #1

Closed
widewing opened this issue Dec 3, 2014 · 5 comments
Closed

custom csd_wrapper not working on 5.0 lollipop #1

widewing opened this issue Dec 3, 2014 · 5 comments

Comments

@widewing
Copy link

widewing commented Dec 3, 2014

I see it generated tmp file for the script in the app's cache dir, but it's not executed.
It was working perfectly in previous android versions (including L Preview)

@widewing widewing changed the title custom csd_wrapper not working in 5.0 lollipop custom csd_wrapper not working on 5.0 lollipop Dec 3, 2014
@cernekee
Copy link
Owner

cernekee commented Dec 3, 2014

The issue I saw on the early 'L' builds is that the non-PIE curl binary is rejected by the new linker version:

https://code.google.com/p/android-developer-preview/issues/detail?id=888

Current plan is to bundle the run_pie binary in a future release.

@widewing
Copy link
Author

widewing commented Dec 4, 2014

Actually the PIE issue is another issue. I replaced it with pie enabled curl and yes it works on l preview. But this not work anymore after I upgrade 5.0.0 release.
I tested it with a simple script: just echo a test string into sdcard, nothing happened.

cernekee added a commit that referenced this issue Dec 29, 2014
Now that curl is a PIE binary, it won't run as-is on ICS.  Before
connecting, write out a wrapper script that either invokes curl-bin
(a PIE ELF binary) directly, or uses run_pie to execute it via dlopen().

fixes #1

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
cernekee added a commit that referenced this issue Dec 29, 2014
Now that curl is a PIE binary, it won't run as-is on ICS.  Before
connecting, write out a wrapper script that either invokes curl-bin
(a PIE ELF binary) directly, or uses run_pie to execute it via dlopen().

fixes #1

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
@cernekee
Copy link
Owner

Actually the PIE issue is another issue. I replaced it with pie enabled curl and yes it works on l preview.

I have added a workaround for this. Could you try this apk (or build the -next branch)?

https://dl.dropboxusercontent.com/u/169702767/openconnect/openconnect-1.10-beta1.apk

But this not work anymore after I upgrade 5.0.0 release.

FWIW I tested the above apk on 5.0 (Hammerhead LRX210), on ICS 4.0 in the emulator (ARM), and on a Nexus 7 (2012) running 4.2.2. I think the curl problem has been resolved, at least.

I tested it with a simple script: just echo a test string into sdcard, nothing happened.

Apps might need to go through a special API to write to /sdcard on newer Android versions, or your access may be confined to a specific directory. I haven't actually used this but it is documented here.

A more reliable test case might involve writing to /data/data/app.openconnect/files. I've also had some success in the past killing the app, then using strace -o /data/local/tmp/log -fF -p PID (as root) to attach to zygote and watch what happens when the app starts. The downside is that this produces a lot of data and slows everything down. You'll want to search for the execve() calls to see what happens when your script runs.

@widewing
Copy link
Author

This build works like a charm! I must have got something wrong with my tests

@cernekee
Copy link
Owner

Thanks for the feedback. I'll make a new release soon.

I replaced it with pie enabled curl

One thing that occurred to me is that you would need to build the new curl into a fresh APK (and sign it with your own key), because AssetExtractor will try to overwrite any local copies under /data/data/app.openconnect if the CRC doesn't match the bundled version.

Or you could just use a different name like curl-pie, and call it using that name from your script...

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

No branches or pull requests

2 participants