Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Bootloop with November 16 security patches #129

Closed
Underknowledge opened this issue Nov 13, 2016 · 126 comments
Closed

Bootloop with November 16 security patches #129

Underknowledge opened this issue Nov 13, 2016 · 126 comments

Comments

@Underknowledge
Copy link

One plus X on 6.0.1 with OOS 3.1.4 [Oxygen OS3 v2.78 SU.zip]( <-maybe problem?) & x86 xposed

Can install and run Xposed but when i want to start a single module i stuck in bootloop.
Tried with diffrent modules like youtube background player, Amplyfy, Gravitybox & More

Also tested v84 - same case.
always flashing uninstaller and reflashing..
i try to make logcats? on wednesday - wish me luck Stay tuned =D

@aviraxp
Copy link

aviraxp commented Nov 14, 2016

https://github.com/rovo89/XposedBridge/wiki/Bugs

Generally, I think it is an known issue, which is caused by the November security patches. You can find some details here aosp-mirror/platform_frameworks_base@186af6a.

Sadly there is no solution at the moment, unless you know how to build a rom and revert this commit.

Wait, x86 xposed? I think you are saying ARM, otherwise you cannot boot with xposed.

@Underknowledge
Copy link
Author

Jeah.. sorry. Version 86 ARM..
Is it helping if i create logcats?

Read 200+ posts on xda. Didnt saw one who pointed Out the November patch.

Do somebody know? Can i Just Flash a oder Version of oos (OnePlus) over it and Flash xposed & superSU again?

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

I actually didn't know about this issue either, I don't think anyone brought it up on GitHub before. Someone mentioned the security patches, but I thought this was just a very limited issue.

Logs would definitely help as I don't have the official ROM installed at the moment.

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

@aviraxp Did you/someone already verify that the issue is caused by that commit?

@aviraxp
Copy link

aviraxp commented Nov 14, 2016

Not quite sure, but I know that this ROM version contains November security patches, and this commit in the patches, as you see, introduces a whitelist, which does not consider /data/app an open path that zygote is allowed to open, and thus cause the bootloop. It is already confirmed by many people on XDA discussion thread.

Someone has already tried to bypass it by always return true for the bool IsWhiteListed, and it seems works, though has some issues.

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

Yes, makes sense. Not sure if /proc/self/fd shows the path like it was opened or if it resolves symlinks. If it does not resolve symlinks, it could probably tricked with /system/framework/../../some/other/path.jar. Otherwise... not sure how this could be circumvented. Probably only by disabling this new security feature, which may be possible by making ReopenOrDetach() a no-op. SELinux might complain about that though...

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

Actually, even to disable this feature would be more work as the check is done before Zygote forks...
So I would highly recommend not to upgrade at this point if Xposed is more important to you than the potential security increase!

@rovo89 rovo89 changed the title Bootloop when activating 1 module Bootloop with November 16 security patches Nov 14, 2016
@aviraxp
Copy link

aviraxp commented Nov 14, 2016

Thanks for your insights, symlinks may make sense, or I think bind-mount is another method?Besides, I have noticed that this commit is merged into Nougat several days ago, so I guess the way of Closed on nougat is longer...

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

Bind mounts require that the target file already exists.

@aviraxp
Copy link

aviraxp commented Nov 14, 2016

Yes, creating an empty file in advance is fine. Or maybe topjohnwu's magisk works, as it supports creating non-exist files. I will try to play with the possibility these days.

@rovo89
Copy link
Owner

rovo89 commented Nov 14, 2016

Nothing of that would be suitable for the official Xposed version though, so I need to find an alternative solution anyway...

@Ibuprophen
Copy link

That security update affected the D2VZW CM13 Nightly beginning with the 11 November release.

I was able to install the Xposed installer and restart as normal but, after installing a module (any module), then activating that module, that is when the the restart hangs on the CM splash screen (blue guy at the center).

Framework for the ARM 86 installed fine without any errors.

Just wanted title let you know...

@HanabishiRecca
Copy link

HanabishiRecca commented Nov 15, 2016

I think that is:

Coz http://pastebin.com/1e6XNpU6

Also check: https://review.cyanogenmod.org/#/c/170575/

@aviraxp
Copy link

aviraxp commented Nov 15, 2016

@HanabishiRecca Nah,

https://github.com/android/platform_frameworks_base/blob/186af6a4e5a79915ef2917393d36a3266e261f81/core/jni/com_android_internal_os_Zygote.cpp#L478

It is upstream AOSP commit that causes this.

According to the guy that brought up this commit, he will add more paths to whitelist in the future, but surely not /data/app, which most Xposed modules are in.

@HanabishiRecca
Copy link

@aviraxp, I mean this is possible solution for Xposed.
What if try to add /data/app to extra whitelist? (just suppose, I'm pretty noob in android)
https://review.cyanogenmod.org/#/c/170575/6/core/jni/fd_utils-inl.h
https://review.cyanogenmod.org/#/c/170575/6/core/jni/fd_utils-inl-extra.h

@AndyCGYan
Copy link

AndyCGYan commented Nov 15, 2016

@HanabishiRecca I literally just tried that and it doesn't work - seems like explicit reference to each APK is required. But I'm now trying another approach - I'll just make the whitelist judgement function return true, i.e. whitelist everything. I'll let you know what happens after the build.

@aviraxp
Copy link

aviraxp commented Nov 15, 2016

@HanabishiRecca Ah, sorry... Anyway, recompiling rom is needed, which is far from a common user's knowledge. I am going to fully revert this commit in my own rom.

@AndyCGYan
Copy link

@aviraxp How? As you probably saw I posted in the XDA Xposed discussion thread, plain git revert won't work because of conflicts. Do you do a full rebase? // Also, good to see another Chinese here, and you happen to have the same name as one of my classmates O_o

@aviraxp
Copy link

aviraxp commented Nov 15, 2016

@AndyCGYan Maybe it is because CM added some lines to whitelist. You can manually check it.

@arter97
Copy link

arter97 commented Nov 15, 2016

This would be hacky as hell, but how about making symlink from /data/data/de.robv.android.xposed.installer/files/load.apk to /system/framework/XposedBridge_load.jar upon installation, since every .jar files in /system/framework is allowed?

@rovo89
Copy link
Owner

rovo89 commented Nov 15, 2016

That would require modifying /system. This is prevented by read-only partitions and SELinux and would not work on systemless.

@arter97
Copy link

arter97 commented Nov 15, 2016

Ugh.
And I guess modding libandroid_hardware.so will be out of the question, eh?

@AndyCGYan
Copy link

AndyCGYan commented Nov 15, 2016

2nd test complete and successful - device booted with all Xposed modules enabled!

For ROM builders: manually edit frameworks/base/core/jni/fd_utils-inl.h, find the method IsWhitelisted() and make it return "true" all the time, so that it whitelists everything. Save, commit, build. This should be easier than trying to revert all future whitelist-related changes (I'm a git beginner so no good at that).

EDIT: Arter's description (in #200 above) is more precise and detailed. I'll leave it here nonetheless.

@aviraxp
Copy link

aviraxp commented Nov 15, 2016

@AndyCGYan , @arter97 's this commit would be better, arter97/android_frameworks_base@35724b0, as it detects XposedBridge, so it would be more secure for users who doesn't use Xposed.

@AndyCGYan
Copy link

@aviraxp Thanks for the heads up, didn't know he also made it available. I'll just pick that in later builds.

@rovo89
Copy link
Owner

rovo89 commented Nov 15, 2016

Here's another idea: Maybe Xposed could avoid keeping those files open at all. I assume that this field keeps the file alive: https://android.googlesource.com/platform/libcore/+/android-6.0.1_r74/dalvik/src/main/java/dalvik/system/DexPathList.java#419
Maybe closing the ZipFile early enough could make it pass the criteria. I can't try this before Wednesday even though.

@wanam
Copy link

wanam commented Nov 15, 2016

Yes, i think we can hook and close "zipFile" after "findNativeLibrary" and "findResource" calls and set "initialized" field to false, both methods call "maybeInit();", so i guess we can't expect in which order they will be executed.

Unfortunately i can't test it, i don't have a device that runs this sec patch.

@wynn1212
Copy link

@shakalaca Thanks! It works for me.

@wynn1212
Copy link

Thanks to Master @shakalaca .
But the script seems not run properly.
It looks like I have to manual to "chmod 755 installer " and run it.

rovo89 added a commit that referenced this issue Nov 24, 2016
This is to work around a new security feature introduced by Google in
the November 16 patches. It would abort the runtime if files are open
that are not whitelisted. To avoid this, we close the files ourselves
and reopen them after Zygote has forked. The mechanism is the same that
Google has introduced, with a few modifications to fit Xposed's needs.

This requires also a change on the native side.

Fixes #129.
wanam pushed a commit to wanam/XposedBridge that referenced this issue Nov 25, 2016
This is to work around a new security feature introduced by Google in
the November 16 patches. It would abort the runtime if files are open
that are not whitelisted. To avoid this, we close the files ourselves
and reopen them after Zygote has forked. The mechanism is the same that
Google has introduced, with a few modifications to fit Xposed's needs.

This requires also a change on the native side.

Fixes rovo89#129.
wanam pushed a commit to wanam/Xposed that referenced this issue Nov 25, 2016
This is to work around a new security feature introduced by Google in
the November 16 patches. It would abort the runtime if files are open
that are not whitelisted. To avoid this, we close the files ourselves
and reopen them after Zygote has forked. The mechanism is the same that
Google has introduced, with a few modifications to fit Xposed's needs.

This requires also a change on the Java side.

Fixes rovo89/XposedBridge#129.
@Lanchon
Copy link

Lanchon commented Nov 26, 2016

@rovo89
hi! so just to clarify:
v87 has the mem leak and fixing that is due in a later version?
thanks!

@josephcsible
Copy link

No, the leak was only present in the test build. It's fixed in the official v87.

Liliniser pushed a commit to Liliniser/XposedBridge that referenced this issue Nov 27, 2016
This is to work around a new security feature introduced by Google in
the November 16 patches. It would abort the runtime if files are open
that are not whitelisted. To avoid this, we close the files ourselves
and reopen them after Zygote has forked. The mechanism is the same that
Google has introduced, with a few modifications to fit Xposed's needs.

This requires also a change on the native side.

Fixes rovo89#129.
@fda77
Copy link

fda77 commented Nov 27, 2016

I'm using Xposed part frequently to write to a created subdir in /data/system/.
The module is writing there log files and data collected during runtime.
The app part does read the data&log by a hooked method, so there are no premission problems.
Note: Some time ago it was state that the Xposed internal log should not be polluted by apps, thats why I'm using seperate logfile

@rovo89
Copy link
Owner

rovo89 commented Nov 28, 2016

@fda77 Ok, but do you open that file in initZygote() and keep it open afterwards? If you open it in handleLoadPackage() or close the file after writing/reading, then Google's security fix shouldn't get into your way.

@fda77
Copy link

fda77 commented Nov 28, 2016

@rovo89: Yes, in initZygote() a service is started which writes eg log file. This file is not closed (but flushed sometimes). Reopen&close for every single line seems for me not very fast

@rovo89
Copy link
Owner

rovo89 commented Nov 29, 2016

I agree that reopening a log file for every line you want to write is not good for performance. But doesn't SELinux get in your way when you try to open the file in Zygote or write to it in app processes? It's very strict about such things. And the more important question is: Did the changes by Google break this part of your modules?

@Ibuprophen
Copy link

@rovo89, I just wanted to let you know that I had noticed the following line when I had flashed the v87 ARM Framework file:

"Zip does not contain SELinux file_contexts file in its root."

But, it is active within the installer app and I haven't noticed anything really out of the ordinary (so far).

@Ibuprophen
Copy link

Ibuprophen commented Nov 29, 2016

Also @rovo89 , did you notice this?

zygote: Allow device to append extra whitelisted
CyanogenMod/android_frameworks_base@7a9c884

@josephcsible
Copy link

@ibuprophen1 The CM devs specifically said that they would not add Xposed to that. It's strictly for devices that don't support the feature at all without it.

@Ibuprophen
Copy link

@josephcsible Add XPosed to what?
I didn't ask for Rovo89 to add anything.
Did you understand what was reported to Rovo89 at all?
I just wanted to bring something to Rovo89's attention. I'm not sure why you responded to something that was not even brought up.
Thanks, you gave it the old college try... ;-)

@josephcsible
Copy link

@ibuprophen1 To clarify, you're not the first one who brought up that commit. It's already been discussed and turned out to be useless to Xposed.

@Ibuprophen
Copy link

@josephcsible, Thank you for the clarification.
I really do appreciate it! ;-)

@fda77
Copy link

fda77 commented Dec 15, 2016

@rovo89

Did the changes by Google break this part of your modules?

Not sure, as i hav not yet a ROM with the changes. Nexus 7 is discontinued and latest image by Google is of August 2016

@mino178
Copy link

mino178 commented Dec 26, 2016

@rovo89 ..... i didnt read all of this, so is the fix available ...... I cant get the xposed installer ...... you know the problem her better than me > <..... All i know is after installing the zip my device stucks at "samsung logo"...... all i can do to get the it to boot normally n get me to home screen is uninstall the installed zip. Please let me know when the fix is available

@HanabishiRecca
Copy link

@mino178, did you ever read the xda forum? Xposed DOES NOT work with samsung firmware.
You might try unofficial builds for samsung: http://forum.xda-developers.com/xposed/unofficial-xposed-samsung-lollipop-t3180960, but no one can guarantee.

P.S. Samsung firmware is very restricted, if you wanna freedom - just don't buy samsung.

@jswinde
Copy link

jswinde commented Dec 27, 2016

That's not entirely true @hanabishi. I have xposed running successfully on my Samsung Galaxy S4 and S3 devices.

@HanabishiRecca
Copy link

@jswinde, Touchwiz ROM + Official Xposed? I don't think so.

@mino178
Copy link

mino178 commented Dec 27, 2016

@HanabishiRecca ..... I did read that.... they said S5 note 4 etc r supported... in fact I came here from that page...... this Stuck at Samsung logo is only happenin to device that hv Nov security patch......S4 n s3 r working OK .... even rovo89 said this is cuz of Nov patch .... :'( all I want r the awesome tweaks from xposed

@mino178
Copy link

mino178 commented Dec 27, 2016

On s4 n s3 v hv firmware from the Samsung Web, rooted by CF-Auto Root.......n then xposed installed thanks to xda ..... v also hv CWM recovery

@retsifp
Copy link

retsifp commented Dec 27, 2016

@mino178 Please don't use this issue for discussions! (Go to XDA instead!) >200 People get emails for every post you do here!

In addition to that, if you use XPosed v87, it's not about this issue. And I think a Samsung ROM won't have the November 2016 security patches, so there can't be this problem.

@hallodare
Copy link

Hi, I've asked on xda as mentioned above, but haven't received a reply.

Basically I'm just curious as to know how the testing is going, just a general update. I'm not asking for a release date, just an update. Thanks

@jswinde
Copy link

jswinde commented Jan 14, 2017

@hallodare, just subscribe to the main Xposed announcement thread on XDA so you'll be notified any time Rovo89 posts new discoveries, progress, and builds.

@hallodare
Copy link

I have

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

No branches or pull requests