-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Revisit the Android W^X problem #2155
Comments
On the one hand, we need to think about how we can still give the sandboxed code access to storage files. On the other hand, we can use this opportunity to explore support for containers and containerized applications (e.g. Docker, Flatpak, ...), possibly after figuring out how to resolve complications made by the SE Android policies. |
We would definitely risk being suddenly removed from play store if we try to circumvent the policy, but as you said I guess it is theoretically possible to comply in the same way as browsers with javascript. I think what we need is some people to feel strong enough about this "issue" to actually develop and experiment with possible solutions. The apk route has been shown to be possible, but needs much more work. Alternative ideas are great, but an idea is not really worth anything before it is implemented (as business people like to say). |
Yes and No! I studied the use of a boot loops concept and made good experiences. |
I agree with @iamahuman .. @xeffyr If we just use proot to solve this, it may become easier.. but it has its own problems... 1- This is a known fact- performance issues... 2- Usual termux users love the fact that these packages are run directly under the android system.. That's why most users ask for packages natively that adjust without them with proot 3- Any bugs or issues with proot upstream would also be an issue with Termux.... 4- The Build script would have to be modified.. I don't know to what extent.... The best approach, I think would be to modify termux-exec, which currently is a wrapper only for shebangs around execv(). This would mean more work.. but has its benefits... |
@suhan-paradkar We have only 3 variants of resolving the issue:
Variant 1 is current one, 3 - against Play Store policy.
To do so you need to inject a LD_PRELOAD into Dalvik/ART startup. This is not possible and therefore you can't use shared library approach. It also works on function level and not the system call - will cause troubles with non-C/C++ programs. You need a program which takes ELF executable, load its sections into memory and passes execution flow. A bare variant of |
What is that build script? It won't be hard to make Termux app build proot and bundle into APK. If you are talking about package scripts, then there no issues at all. It even possible to get rid of most of our packages with IMO, impact on user experience is inevitable. You can't keep quality, functionality, performance or application store availability on high level at same time. Even now this isn't possible, not saying about what will be after fixing |
@xeffyr I've a question: Is the existence of
Agree! My current build script support also: "1. Leaving everything as-is and continuting with SDK 28." |
https://support.google.com/googleplay/android-developer/answer/9888379:
Proot by itself doesn't violate anything. But it lets application to continue violate policy through downloadable packages. Yes, Termux already violates the policy and it doesn't matter whether proot is added or not. It still exists in Play Store, but there are risks. |
OK - very juristic formulation. Thus, play store as a distributor no longer suitable for a developing app like termux, when Google does not change that. In the bootloop, after the first version are always local |
The only "advantage" is being able to submit updates to Play Store. Not so many. Termux works on Android 11 and even on 12 beta. That's expected, because Android currently preserves backwards compatibility. Problems will be only if with specific update Google decides to drop it. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
These solutions wouldn't have to overall reduce usability: for example, if binaries could be installed to sdcard storage, that would be a huge plus elsewhere. |
Sorry for the dumb question but with the packaging everything into the apk does that mean it is no longer possible for users to compile and run programs? That would be unfortunate. |
@Vixeliz PRoot can be used to workaround that but: a. Any custom executable loader is technically against Play Store app publishing policy. - Matters only if we decide to continue Play Store updates. |
@xeffyr I see, if you were to try and get back on play store is it feasable to have two versions one with proot and one without? My main use case for termux is developing applications and im very worried it won't be possible going forward. |
I don't think 2 termux versions with and without proot would be a good idea. because it needs to maintain one for non-proot-ed termux app for target level 29 (assuming in-APK's for example) and for proot-ed termux app it also needs to maintain existing package implementation which is apt and would probably need much maintenance so preferably one choice is a choice |
I see well personally i am crossing my fingers for proot then. |
In the The more ELF in |
I suppose withdrawing from Play Store has one big problem: funding. |
Play Store is a just one of ways for funding and no one of maintainers except Fornwall shares it (both account & funding) anyway. While Termux can |
As an user, I think the best approach is the current one: don't use play store for publishing the app. Other ways to overcome this issue seem to have too many disadvantages and in future Google could tighten PS policies even more. There are already too much problems caused by wrong choices made by Google on Android done on the assumption that users are stupid, or for the sake of privacy and security (when instead those should be in a compromise with usability and comfort). You get two advantages by don't publishing the app to PS:
|
Docs have been added for android app data file execute restrictions at following links.
@DownrightNifty Hey, thanks for the offer. Check https://termux.dev/donate for how to donate to me or preferably other termux devs currently. I already have funding for next couple of months, and it's not as much a money issue, as it's a time issue. I have a gazillion things to do related to Termux and currently termux app updates and related work takes higher priority since they have been already been delayed for far too long (as LWN points out too) and more people are in greater need of the update with fixes and additions than any future breakage. I have been working on the updates full time for more than a year at this point, there is just so much work to do and everything is broken. Getting the permission added to AOSP is a priority for me too, just not the top priority and I do plan on looking into it after the releases like I have already said. Go ahead if you want to make a blog post, that would be great. However, I think after all this time, all the important people who may be able to actually get a real fix implemented already know about it, but then again funding could help motivate someone to take charge. Also a working hack is being worked on at termux/termux-exec#24 as mentioned above. |
This comment was marked as off-topic.
This comment was marked as off-topic.
as workaround (for termux-play-store/termux-issues#24 termux/termux-app#2155 termux/termux-app#4037 ). Fixes ``` ~/SubStack $ ./a.out cxx/Macros.hxx: pass execves(): pass execvex(): pass virusAnalysisTestsThrows(): pass assistantCnsTestsThrows(): /data/data/com.termux/files/usr/bin/sh: 1: wget: Permission denied /data/data/com.termux/files/usr/bin ``` , (to ``` conversationCnsTestsThrows(): --2024-06-15 18:22:01-- https://stackoverflow.com/robots.txt Resolving stackoverflow.com (stackoverflow.com)... 172.64.155.249, 104.18.32.7 Connecting to stackoverflow.com (stackoverflow.com)|172.64.155.249|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/plain] Saving to: ‘robots.txt’ robots.txt [ <=> ] 1.99K --.-KB/s in 0.07s 2024-06-15 18:22:02 (27.4 KB/s) - ‘robots.txt’ saved [2036] ``` , as was)
as workaround (for termux-play-store/termux-issues#24 termux/termux-app#2155 termux/termux-app#4037 ). Fixes ``` ~/SubStack $ ./a.out cxx/Macros.hxx: pass execves(): pass execvex(): pass virusAnalysisTestsThrows(): pass assistantCnsTestsThrows(): /data/data/com.termux/files/usr/bin/sh: 1: wget: Permission denied /data/data/com.termux/files/usr/bin ``` , (to ``` conversationCnsTestsThrows(): --2024-06-15 18:22:01-- https://stackoverflow.com/robots.txt Resolving stackoverflow.com (stackoverflow.com)... 172.64.155.249, 104.18.32.7 Connecting to stackoverflow.com (stackoverflow.com)|172.64.155.249|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/plain] Saving to: ‘robots.txt’ robots.txt [ <=> ] 1.99K --.-KB/s in 0.07s 2024-06-15 18:22:02 (27.4 KB/s) - ‘robots.txt’ saved [2036] ``` , as was)
It is just a random thought, but what will happen in the case if we drop using bionic linker and start using our own linker and executable/library format? Yes, it definitely will break a lot of stuff working with ELF file format, and will cause higher RAM usage (because kernel shares readonly executable pages related to shared libs to save some memory, which will not happen in our case because of W^X restriction), but we will be able to be back to GP. |
The policy isn't specifically about ELF or dex code, but executable code with system API access in general. The only way to really comply would be using Wasm, Wasi, and providing a custom API for things Wasi doesn't provide (like pthreads, somehow shared memory, etc...). |
Alternatively, a gentoo approach would also comply: if only source code is downloaded, technically you're not downloading executables, and if your definition of app only includes the apk, you're also not updating the app from another source. That with a custom loader would probably be the easiest. |
What is considered to be a system API access? We can restrict access to some functions because we will have full control on the linking process. |
Alternative solution could be creating archives with all linking data (.o, .a files and linking command) to be linked on device (if building from source is ok). |
Sounds cool. ArchLinux does this too.
It is now about "how much access does this function give you; if it is too much access, block"; Android has app-level permissions for this. If it starts with "Standard C library" or "Standard C++ library", it uses operating system calls: |
.o and .a files already contain executable code. |
But it is not linked yet. |
I think we've rules lawyered Google's arbitrary rules that obviously were not written with any application like Termux in mind enough for one day, don't you think? |
I think if .so is not allowed, so is .a and .o.
https://support.google.com/googleplay/android-developer/answer/9888379?sjid=9674596579061280027-EU |
Truth is that this is solved (or almost): |
@SwuduSusuwu Awesome to hear if I read your response correctly. I guess people were also concerned about the long-term feasibility of the solution. How was it solved in the end, I assume in a way that it will not become problematic with deprecation of older SDK's? It would be interesting to learn more about it. |
If understood (don't remember where this post was), Termux now has a special version which loads all executables into Termux's own process (just for Google Store).
|
No, it runs every binary via Original Termux: Termux from Play Store, see what says |
Feature description
Termux should circumvent Play Store policy of restricting execution of arbitrary code from third parties, by imitating what Google Chrome does. Bundling packages into APKs is certainly not the way to go.
isolated_app
?), emulating forbidden system calls as needed. (Note that we already do this with execve to handle#!/usr/bin/...
shebangs)./system/bin/linker
).Reference implementation
N/A
Related
The text was updated successfully, but these errors were encountered: