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

android: fix bug where MayUseCollector is not available on some custom rom #330

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

thinhbuzz
Copy link
Contributor

@thinhbuzz thinhbuzz commented Jul 30, 2024

fix Error: libart.so: unable to find export '_ZNK3art2gc4Heap15MayUseCollectorENS0_13CollectorTypeE
eg: frida/frida#2925
original change: #326

@poldenais
Copy link

hi @thinhbuzz is there a fix for this? I got a similar issue now running a script.

@QingShiLuoGu
Copy link

same issue,please merge it

@thinhbuzz
Copy link
Contributor Author

@oleavr please check this

@Rycoh99
Copy link

Rycoh99 commented Aug 2, 2024

I compiled a test version myself with this fix, but now I get the same error but with the export "_ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv" from libart.so, am I the only one or does that change alone work for you?

@QingShiLuoGu
Copy link

@Rycoh99 I got same error:
unable to find export '_ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv'"
environment: android 15, arm64
@thinhbuzz can ypu help analyze?

@JorySeverijnse
Copy link

Any expected date when this will be approved and when the next release comes with this fix? Having same issue btw

@Rycoh99
Copy link

Rycoh99 commented Aug 5, 2024

Any expected date when this will be approved and when the next release comes with this fix? Having same issue btw

We still have to wait sadly...

@NgoHuy
Copy link

NgoHuy commented Aug 15, 2024

I create new PR, with this PR and mine, it should work on latest lineageos. #332

@Rycoh99
Copy link

Rycoh99 commented Aug 15, 2024

I create new PR, with this PR and mine, it should work on latest lineageos. #332

I just tried it but it doesn't seem to work, still getting some errors complaining about _ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv, maybe I compiled it wrong, but I don't know for sure, will try again

@thinhbuzz
Copy link
Contributor Author

I create new PR, with this PR and mine, it should work on latest lineageos. #332

I just tried it but it doesn't seem to work, still getting some errors complaining about _ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv, maybe I compiled it wrong, but I don't know for sure, will try again

please try again with the latest commit of this PR

@NgoHuy
Copy link

NgoHuy commented Aug 15, 2024

I create new PR, with this PR and mine, it should work on latest lineageos. #332

I just tried it but it doesn't seem to work, still getting some errors complaining about _ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv, maybe I compiled it wrong, but I don't know for sure, will try again

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

@NgoHuy
Copy link

NgoHuy commented Aug 15, 2024

I create new PR, with this PR and mine, it should work on latest lineageos. #332

I just tried it but it doesn't seem to work, still getting some errors complaining about _ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv, maybe I compiled it wrong, but I don't know for sure, will try again

please try again with the latest commit of this PR

I don't want to override your PR, then I created new PR, your new commit overrides my PR, it's not good fair.

@thinhbuzz
Copy link
Contributor Author

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

we have different approaches, if you had the same approach as me I wouldn't have added it to my PR.

@Rycoh99
Copy link

Rycoh99 commented Aug 15, 2024

I create new PR, with this PR and mine, it should work on latest lineageos. #332

I just tried it but it doesn't seem to work, still getting some errors complaining about _ZN3art2gc9collector17ConcurrentCopying12CopyingPhaseEv, maybe I compiled it wrong, but I don't know for sure, will try again

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

Yeah, that's what I did, seems to work now with the latest commit from thinhbuzz though, thanks!

@NgoHuy
Copy link

NgoHuy commented Aug 16, 2024

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

we have different approaches, if you had the same approach as me I wouldn't have added it to my PR.

What's approach? My PR is seperate from you, I see the problem after your patch and patched it, when user builds frida, they need to modify frida-java-bridge on their end. Don't include other PR if you didnot ask them before!

@thinhbuzz
Copy link
Contributor Author

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

we have different approaches, if you had the same approach as me I wouldn't have added it to my PR.

What's approach? My PR is seperate from you, I see the problem after your patch and patched it, when user builds frida, they need to modify frida-java-bridge on their end. Don't include other PR if you didnot ask them before!

  1. you use get and i use find, get can throw exception when not found
  2. people report new bugs in my PR and you create new PR. when i update PR to fix the issue people update you say i did wrong?

Huh?

@NgoHuy
Copy link

NgoHuy commented Aug 16, 2024

You need edit manually file at directory build/subprojects/frida-gum/ which is under node_modules

we have different approaches, if you had the same approach as me I wouldn't have added it to my PR.

What's approach? My PR is seperate from you, I see the problem after your patch and patched it, when user builds frida, they need to modify frida-java-bridge on their end. Don't include other PR if you didnot ask them before!

1. you use get and i use find, get can throw exception when not found

2. people report new bugs in my PR and you create new PR. when i update PR to fix the issue people update you say i did wrong?

Huh?

Firstly, my PR is fix from original patch not from you, I respect your PR, it's the way opensource community runs. But you not!
image
2nd, I show that only my PR and your PR are merge, it would run.
3rd, you're right about getExportByName vs findExportByName, but in case you call it directly or include other function like attach, when you assign it to variable, it uses return of this function, in this case is NativePointer return, and it's null.

Copy link
Member

@oleavr oleavr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🚀 Sorry it took me so long to get to this, I was out on vacation.

I refactored a tiny bit, but don't have a setup I can test this on at the minute. Could you take it for a quick spin just to check that I didn't break anything?

Note that this will result in method hooking stability issues on affected systems, so we should figure out a better solution someday. In the meantime this is obviously a lot better than failing completely, like we do currently, so I think we should merge this.

Which happens on some custom ROMs. This does however mean that our hooks
become unreliable on such systems, since we fail to tie into the GC
cycle. We should consider scanning libart's memory as a fallback.
@oleavr
Copy link
Member

oleavr commented Aug 20, 2024

Oops, updated with style fixes reported by the linter (probably my fault).

zer0def pushed a commit to zer0def/undetected-frida that referenced this pull request Aug 22, 2024
zer0def pushed a commit to zer0def/undetected-frida that referenced this pull request Aug 22, 2024
zer0def pushed a commit to zer0def/undetected-frida that referenced this pull request Aug 22, 2024
zer0def pushed a commit to zer0def/undetected-frida that referenced this pull request Aug 23, 2024
@sorasful
Copy link

Hey, I do have the same issue. Do we need something to merge this ? How can we help ?

@oleavr oleavr merged commit 5fcd910 into frida:main Aug 30, 2024
7 of 11 checks passed
@oleavr
Copy link
Member

oleavr commented Aug 30, 2024

Thanks! 🙌

@esauvisky
Copy link
Contributor

I am still encountering the following error :

Error: Unable to perform state transition; please file a bug
    at bt (frida/node_modules/frida-java-bridge/lib/android.js:578:1)
    at frida/node_modules/frida-java-bridge/lib/class-model.js:112:1
    at Function.build (frida/node_modules/frida-java-bridge/lib/class-model.js:7:1)
    at k._make (frida/node_modules/frida-java-bridge/lib/class-factory.js:168:1)
    at k.use (frida/node_modules/frida-java-bridge/lib/class-factory.js:62:1)
    at frida/node_modules/frida-java-bridge/index.js:216:1
    at c.perform (frida/node_modules/frida-java-bridge/lib/vm.js:12:1)
    at _.performNow (frida/node_modules/frida-java-bridge/index.js:213:1)
    at Object.1 (src/dev.js:8:6)
    at o (node_modules/browser-pack/_prelude.js:1:1)

This occurs even with the following minimal code:

Java.perform(function () {

});

ART runtime: com.google.android.art versionCode:350820460

@freerunners
Copy link

Hi! How can I fix the problem? I have the same issue

@Rycoh99
Copy link

Rycoh99 commented Sep 5, 2024

Hi! How can I fix the problem? I have the same issue

Hi! As the fix is already implemented into the GitHub repositories from what I've seen, you just have to wait for the next build of frida-server on the main repo.

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

Successfully merging this pull request may close these issues.

10 participants