Android 中的类不安全?
Android Dalvik 标准库是否有类似于 Java SE 中未记录的类 sun.misc.Unsafe 的类,它允许直接访问内存。
Do the Android Dalvik standard libraries have any class similar to the undocumented class sun.misc.Unsafe in Java SE which allows direct access to memory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Android 实现了 sun.misc.Unsafe 的部分内容,主要是为了支持 JSR-166 并发类。它不是 Android API 的一部分。
Android implements parts of sun.misc.Unsafe, primarily to support the JSR-166 concurrency classes. It's not part of the Android API.
它有 JNI 桥,可以允许任何事情,但它并不“不安全”,因为你必须将其编码到你的应用程序中。据我所知,没有公开的方法可以摆脱 JVM 沙箱(至少在没有发现漏洞的情况下)。
It has the JNI bridge which could allow for just about anything but it's not "unsafe" since you have to code that into your app. As far as I know there is no exposed way to get out of the JVM sandbox (at least not without finding an exploit).
是的,Android有sun.misc.Unsafe,但是接口与OpenJDK有点不同: https://cs.android.com/android/platform/superproject/main/+/main:libcore/ojluni/src/main/java/sun/misc/Unsafe.java
Yes, Android has sun.misc.Unsafe, but the interface is a little different from OpenJDK: https://cs.android.com/android/platform/superproject/main/+/main:libcore/ojluni/src/main/java/sun/misc/Unsafe.java