As written in book of Peter Baer Galvin's Operating System Concepts , there are two modes of operation -
1.user mode
2.kernel mode
So, my question is when we root our android do we alter the linux kernel to get permissions of kernel mode ?
As written in book of Peter Baer Galvin's Operating System Concepts , there are two modes of operation -
1.user mode
2.kernel mode
So, my question is when we root our android do we alter the linux kernel to get permissions of kernel mode ?
Root permissions and kernel mode are not the same thing. Programs with root access can access part of the kernel, but root is not the kernel itself.
The Android (and Linux) user model has a set of users, each part of a set of groups. These groups are used to manage which users are allowed access to what. For example, in Linux you could set up all printer devices to be owned by the printing group, so only users that are part of the printing group can access printers.
In Android every app gets its own user account to prevent apps from accessing each others data.
Amongst all of these users, there's one special user: root. This is the user with the highest set of permissions, also called the "super user". Basically, all permission checks are disabled for this user. Root can do things like change ownership of files, add users to groups, manage system components and more.
Kernel mode is slightly different. When a Linux-based system boots, the kernel is the first thing loaded by the bootloader. The kernel takes care of processing system commands ("write byte x to file y", "list all devices attached to the USB bus"). It's also where many drivers reside, which help the system understand how to communicate to a device.
After initializing the kernel starts a program in user mode. Programs running in this mode are not allowed direct memory access to devices, they can't modify page tables, basically they can't do anything the kernel is supposed to do. The only way to execute a system command is to go though the kernel, and the kernel decides whether or not a program is allowed to do so.
In Android, the kernel starts an initialization program that in turn starts some background processes and the Android system you can interact with.
The kernel decides what user is allowed to execute certain system functions. Many system functions, such as mounting a partition to make it writable, are only accessible to programs running as root. Root can contact and control the kernel, but in the end the kernel decides what root can and can not do.
So: generally kernel mode refers to code running inside the kernel, while root refers to the permissions a program has.
For the sake of clarity I'm ignoring tools like SELinux which is designed to limit the files programs running as root can access. This is a security measure so that even if a system program running as root gets exploited and starts executing code from hackers, it can't compromise the system. This is done using a special module in the kernel.
Q & A