ElderDrivers / EdXposed

Elder driver Xposed Framework.
https://edxp.meowcat.org/
GNU General Public License v3.0
5.37k stars 621 forks source link

[BUG] XSharedPreferences AccessDeniedException #796

Open rhjdvsgsgks opened 3 years ago

rhjdvsgsgks commented 3 years ago

什么情况/What happened?

module works, but some error in log

Xposed模块列表/Xposed Module List

any module which used XSharedPreferences

Magisk模块列表/Magisk Module List

Riru Riru - EdXposed

版本信息/Versions

Android: 9

Magisk: 21.2

Riru: 23.1

EdXposed: 4665 sandhook

相关日志/Related Logs

01-09 06:56:04.215  1932  1932 D XSharedPreferences: Created WatchService instance
01-09 06:56:04.229  1932  2010 D XSharedPreferences: Daemon thread started
01-09 06:56:04.237  1932  1932 D XSharedPreferences: Failed to register file watcher
01-09 06:56:04.237  1932  1932 D XSharedPreferences: java.nio.file.AccessDeniedException: /data/data/xxx/shared_prefs
01-09 06:56:04.237  1932  1932 D XSharedPreferences:    at sun.nio.fs.LinuxWatchService$Poller.implRegister(LinuxWatchService.java:282)
01-09 06:56:04.237  1932  1932 D XSharedPreferences:    at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
01-09 06:56:04.237  1932  1932 D XSharedPreferences:    at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:359)
01-09 06:56:04.237  1932  1932 D XSharedPreferences:    at java.lang.Thread.run(Thread.java:764)
XspeedPL commented 3 years ago

Module compiled for old Xposed API level I presume. Unless you're using permissive SELinux the module should not be able to read user preferences.

Which module is it? The developer should update the module to use new XSP in /data/misc mode.

rhjdvsgsgks commented 3 years ago

I'm using a lot old module which stop updating few years ago, will edxposed be able to only use new xsp for new module (declared api version in manifest.xml) to keep some "compatibility" ? it's not make sense to force all module using new xsp

XspeedPL commented 3 years ago

Actually I also think the new XSP behavior should be used as default, or at least an option in the EdXposed Installer to force enable it for all modules. A lot of old modules stopped working only due to preference reading issues caused by SELinux, having this option could solve many of those.

rhjdvsgsgks commented 3 years ago

that's good if new xsp can fix old module reading preference issue, but could it stop trying to create watcher on old preference path, or directly copy old preference to new path? AccessDeniedException in log is too noisy

kotori2 commented 3 years ago

@rhjdvsgsgks imo it's too tricky to hook stuffs to stop modules from writing files

rhjdvsgsgks commented 3 years ago

@kotori2 how about just "stop trying to create watcher on old preference path"

XspeedPL commented 3 years ago

Well, we can assume using new paths is the usual. But some people may want to not use them for whatever reason. Like on older Androids that don't need it, or permissive SELinux. Outright disabling the feature is not optimal. Also just removing the error log is also not a good idea, as it does what it should: reports an erroneous state. If you're worried about performance due to excessive logging, you can disable logs completely in Android developer settings.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.