Android 如何强制执行权限?

发布于 2024-11-02 13:09:36 字数 875 浏览 1 评论 0原文

我读过几篇关于“Android安全模型”的文章(12, 3 及更多)。我了解权限的理论 MAC 模型,以及与应用程序开发相关的大部分内容。但关于以下方面的广泛低级细节的文档似乎很少:

  1. 如何在系统级别实际执行权限。也就是说,使用JNI,什么会阻止我直接访问GPS等硬件? (我意识到可能有一个与 Android 无关的 Linux 文档来回答这个问题,或者对此问题有一个更通用和经典的操作系统解决方案)。
  2. 使用 Android ICC 时,执行堆栈上实际发生了什么以及调用哪些函数。

有人可以向我推荐 Android 的解释和/或相关代码段吗?

//编辑: 为了澄清事情(因为评论者似乎很困惑),标题中的问题在这里分为两个单独的(完全不同的)问题。 这里的第一个答案确实回答了第一个问题,关于 ARM 处理器中存在的低级机制(谢谢)。 关于国际刑事法院程序调用的第二个问题仍未得到解答......

I have read several articles about the "Android Security Model" (1, 2, 3 and more). I understand the theoretical MAC model of permissions, and most of what is relevant for application development. But there is seemingly very little documentation about extensive low-level details of:

  1. How permissions are ACTUALLY enforced at system-level. That is, using JNI, what will stop me from directly accessing hardware such as the GPS? (I realize there might be a fallback on linux documentation, unrelated to Android, answering this, or an even more general and classic OS solution to this problem).
  2. What actually happens on the execution stack and which functions are called when utilizing Android ICC.

Can anybody refer me to an explaination and/or relevant code segments from Android?

//EDIT:
To clarify things (because it seems commenters were confused), the question in the title is split here in two seperate (quite different) questions.
The first answer here indeed answers the first question, regarding low-level mechanisms that exist in ARM processor (thanks).
The second question regarding ICC procedure calls remains unanswered...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南风起 2024-11-09 13:09:36

最后,处理器本身允许操作系统设置内核/特权/管理程序模式与用户/非特权执行模式。如果不升级到特权模式,您将无法启用/禁用/配置中断、访问某些外设和/或违反内存边界(取决于体系结构)。例如,请参阅此文档ARM A8 处理器

如果您想要更高的权限,您唯一能做的就是使用 SWI 指令触发系统调用中断,向系统调用处理程序传递一个数字以通知它您想要执行的操作。由该处理程序决定您是否可以直接访问硬件。

这就是最终阻止您直接访问 GPS 的原因。我无法在软件方面为您提供帮助。

In the end, it's the processor itself that allows the OS to set kernel/privileged/supervisor mode vs. user/unprivileged modes of execution. Without escalating to a privileged mode, you can't enable/disable/configure interrupts, access certain peripherals, and/or violate memory boundaries (depending on the architecture). See, for example, this documentation for the ARM A8 processors.

If you want higher privileges, the only thing you can do is trigger a system call interrupt with the SWI instruction, passing the system call handler a number to inform it of what you want to do. It's up to that handler to decide whether you can or cannot access the hardware directly.

This is what stops you from directly accessing the GPS in the end. I can't help you with the software side of things.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文