4

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...

Roei Schus
  • 315
  • 3
  • 8

1 Answers1

2

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.

Kevin Vermeer
  • 2,736
  • 2
  • 27
  • 38
  • 1
    I don't think this is what the OP is asking about. I believe he is asking about the permissions such as `USES_INTERNET` – Chris Thompson Apr 20 '11 at 18:51
  • 1
    @Chris - The OP distinctly referred to the use of JNI and ICC. I wasn't sure whether the OP wanted the low-level stuff or the high-level stuff, so I went ahead and explained the low level. – Kevin Vermeer Apr 20 '11 at 18:56
  • Yeah, he's talking about system-level, so I'm assuming the low-level information's what he's looking for. – Kevin Coppock Apr 20 '11 at 19:02
  • hmm based on the recent edit, it would seem as though you're right! My bad! – Chris Thompson Apr 20 '11 at 23:01