News for hackers. Stuff that matters.
Re:Termux and Android 10 by bla3 on Monday May 18, 2020 @12:52PM (#23224912)
Please refrain from using titles that are more alarmist than the original title. If linking to something with an alarmist title (not the case here!), use a more neutral headline for your submission.
Re:Termux and Android 10 by asveikau on Monday May 18, 2020 @12:58PM (#23225018)
I don't think it's very alarmist or an overstatement though. An android 10 app is no longer allowed to do what termux does.

I guess with more reading they are saying they need to declare themselves as targeting android 9 or lower until they find a solution. At some point, I imagine, that will not be an option.

To some degree it should also be on Google to ensure that tightening security (or perceived tightening of security) doesn't break valid use cases.

edit: Ok, for some reason I can't reply, but I see the workaround is to write to another directory.

Re:Termux and Android 10 by kllrnohj on Monday May 18, 2020 @04:23PM (#23227892)
The title is that Android 10 is killing Termux. But it's not, it's killing exec() on writable files.

There's alternatives Termux could take, which the Google issue tracker already mentions such as bundling the executables in the APK & using extractNativeLibs=true so they can be exec'd ( https://issuetracker.google.com/issues/128554619#comment4 ). They could use a loader that mmap's the code with PROT_EXEC but not PROT_WRITE, that also works (this is how JIT's work, and Android is obviously not breaking JITs anytime soon)

It's not entirely clear why Termux hasn't seemingly made any move on the alternative approaches raised a year ago (that's how old the issue is: https://github.com/termux/termux-app/issues/1072 ), and there's a bunch of nonsensical alarmist bullshit muddying up the waters which isn't helping.

Re:Termux and Android 10 by stonewareslord on Monday May 18, 2020 @05:32PM (#23228627)
Termux allows you to apt install thousands of packages. The options in that issue aren't nearly as good. Bundling every binary in the apk? That would be a breach of licenses, let alone the amount of storage that would take up to have gimp, libreoffice, Firefox, etc installed. As mentioned, proot is a temporary hack (why wouldn't any app just stick proot in their lib Dir?).

Even if the workaround works, this would break apt install from non-termux repos, compiling and running with gcc, maybe Python packages installed with pip.

Google's intent here is to block code execution in the app home Dir. Any workaround would be a security violation and eventually stopped. How is this not killing Termux?

Re:Termux and Android 10 by kllrnohj on Monday May 18, 2020 @05:38PM (#23228677)
> Google's intent here is to block code execution in the app home Dir

Google's actions are to block exec of writable code. What their _intentions_ are is pure speculation and detracts from the actual issue. Your claim is largely unsubstantiated & lacks evidence, particularly as Google recommended ways to continue to do exactly what you claim they are intending to block.

> The options in that issue aren't nearly as good.

How is using a PROT_EXEC mmap "not nearly as good"? It's the same end result. There's no technical banning of executing downloaded code. That's not what was done, and doing that would also break Chrome which should be glaringly obvious that Google isn't intending or going to do.

It takes a bit more effort, and it's not as "simple" as just exec'ing random stuff, but it's not without its own upsides as well (like not violating W^X, which is a _well_ proven security design)

Re:Termux and Android 10 by AshamedCaptain on Tuesday May 19, 2020 @05:19AM (#23232902)
That is not at all what happens. W^X is not the problem. W^X is already enabled by default. Executable pages are not mapped in as writable even if the image file is writable. The security argument is bullshit.

The problem is that they don't want you mapping code from anywhere other than your strictly read only .apk.

There is no workaround proposed there other than shipping every single piece of executable code with the .apk.

Sure, you can workaround right now with proot or the like by creating your own executable loader, but who guarantees this works with Android 11? It is also a violation of their policy.

In fact, what they are saying there is that eventually fork and exec are going to be deprecated because they disalign with the Android process model.

Re:Termux and Android 10 by dueF7un3 on Monday May 18, 2020 @01:57PM (#23225945)
I'm confused, because I use termux on android-10 (on a pixel2) without any problem.

I have a cron running on it that mails my notifications to me, a ssh server which my laptop use to send my backups on my phone, a go http server running a local app that I use in the mobile's browser, I'll often take screenshots on the phone, then scp them on the laptop, etc.

Am I missing something?

EDIT: I won't reply to each of you to not be floody, thanks everyone for the clarifications :)

Re:Termux and Android 10 by adrianmonk on Monday May 18, 2020 @02:10PM (#23226166)
Android apps ship with a file called AndroidManifest.xml that (among other things) tells the operating system the latest version of the API that the app understands, i.e. what the app was compiled and tested against. The operating system tries to maintain backward compatibility with what the app is expecting.

The Termux maintainers have built their app to tell the operating system that Termux is only aware of how the Android 9 API works. So when you run Termux on your Android 10 device, the operating system tries to behave like it's Android 9. So it allows this.

They (Google) do this to ease the transition so that when a new version of Android is released, they don't force all developers everywhere to immediately fix all compatibility issues.

But they do want developers to do it eventually, so at some point in the future, they will probably stop allowing the Termux maintainers to upload an app that declares "I don't understand Android 10 yet".

Re:Termux and Android 10 by gst on Monday May 18, 2020 @02:03PM (#23226055)
> I'm confused, because I use termux on android-10 (on a pixel2) without any problem.

It's only an issue if applications target Android 10 APIs. Termux still targets an older API version and is thus not yet affected by this issue. Eventually they'll need to target a newer version because the Google Play store specifies a minimum API version that applications need to use.

Re:Termux and Android 10 by tdeck on Monday May 18, 2020 @02:05PM (#23226088)
Android apps specify a target SDK version (essentially a kind of OS version) in their manifest alongside a min SDK version. The advantage of targeting a newer SDK than the oldest one you support is that you get access to new APIs, but it often comes with additional restrictions as well. Google Play periodically updates their policy to require that targetSdkVersion be above a certain value in order for an app to be published in the play store (currently that value corresponds to Android 9) [1]. What this means is that this policy is an optional trade-off today but likely to be a requirement in the future.

[1]: https://developer.android.com/distribute/best-practices/deve...

Re:Termux and Android 10 by asveikau on Monday May 18, 2020 @02:06PM (#23226106)
You are running in a compatibility mode. If they built it declaring support for Android 10 at build time it would be subject to the new rules and break.

Long term, I can only assume targeting an old SDK will not be supported at some point.

Re:Termux and Android 10 by ShamelessC on Monday May 18, 2020 @05:40PM (#23228698)
> I have a cron running on it that mails my notifications to me.

Off-topic, but that's awesome! How do you get access to your notifications from Termux?

Re:Termux and Android 10 by dueF7un3 on Monday May 18, 2020 @08:43PM (#23230104)
Termux exposes an api as binaries, putting them in `$PATH`, so you can then call them in a any script/program: https://wiki.termux.com/wiki/Termux:API

It basically give access to most permissions an app can get. The cool thing is that you allow the permission for termux, and then all you scripts can use them.

But yeah indeed, the notif2mail was quite a game changer, for me :) I had a big problem of spam calls/sms at some point, and this allowed me to get my notifications through my spam filter and remove the spam. I also use it to trigger desktop notification when my phone battery is low or full.

EDIT: oh, actually, it's not termux itself, but the addon Termux:API (which is a second app, from Play Store point of view). Also, the command to list notifications is `termux-notification-list`, but it doesn't appear in this documentation page, for some reason. All api executable start with `termux-`, so it's quite easy to list them from the shell.

To start cron when booting the phone, I had also to use an other addon, Termux:Boot : https://wiki.termux.com/wiki/Termux:Boot

Re:Termux and Android 10 by shockinglytrue on Monday May 18, 2020 @01:42PM (#23225712)
It's still possible, you just have to dance around a little more

In one project we work around this by shipping a tiny wrapper in the APK to exec that then uses dlopen() on the target, which is now built as a library.

Pretty sure a generic hack could be made to run unmodified executables this way. Certainly in the security community userland ELF loaders are very old news, even X11R6 had its own at one point

Re:Termux and Android 10 by AshamedCaptain on Monday May 18, 2020 @03:02PM (#23226941)
And the next release Android uses noexec and therefore you can't even mmap(...PROT_EXEC) the binary. So you now have yo copy the binaries to RAM by yourself on exec().

And then at some point you realize that, like Cygwin, you have built a system where fork() fails randomly by design.

And then Google blacklists both fork and exec.

Re:Termux and Android 10 by shockinglytrue on Monday May 18, 2020 @05:37PM (#23228669)
Not sure why you're being downvoted, this unfortunately all makes sense
Re:Termux and Android 10 by andybak on Monday May 18, 2020 @01:05PM (#23225133)
From my brief reading it sounds like they have a solution and there's no danger of it stopping working.

In any case - don't editorialize in your titles.

Re:Termux and Android 10 by cft on Monday May 18, 2020 @01:48PM (#23225793)
You might call this a solution, but I disagree:

https://github.com/termux/termux-app/issues/1072#issuecommen...

"As i said on another issue, you should really start communicating this to users now , via as many channels as you can. I understand why you are doing what you do, but it is a big change and will annoy and/or confuse users however will you implement it. so getting people prepared now (ie as soon as possible, and before they have to do anything) will avoid a lot of angst and be in your best interests."

The "solution" is to publish 100s of different play store apps with Linux packages or to disable the ability to run installed programs.

Re:Termux and Android 10 by on_and_off on Monday May 18, 2020 @04:38PM (#23228049)
Another title could be : "termux failed to update to Android changes for 2 years"