157 / 163 · C11 · 8 min
A Few Words About Security
This chapter introduces the importance of operating system security, explaining why the OS as the foundation of all computing must be protected, and discusses the challenges in achieving security.
In this lesson
The Central Role of OS Security
Nearly all software depends on the operating system to run. If the OS is insecure, even perfect applications above it cannot guarantee safety. The OS controls hardware resources, so any vulnerability may allow attackers to take over the entire system. Given the widespread use of operating systems, their security flaws have far-reaching effects.
Difficulties in Achieving Security
Operating systems have large amounts of code and complex algorithms, making flaws easy to hide. They must isolate multiple concurrent processes to prevent one from harming others or the system. Unknown programs downloaded by users should not receive the same privileges as the owner, or they could cause severe damage.
Resources That Need Protection
The OS can access all memory, files, devices, and networks. A process cannot protect itself from a malicious OS. Therefore, it is essential to ensure the OS itself has no exploitable vulnerabilities and to patch them promptly. Hardware such as security enclaves provides extra isolation, though it is difficult to implement perfectly.
Pitfalls
- Believing application security is sufficient while ignoring the underlying OS
- Delaying installation of operating system security updates
Run an example
Minimum C11 · complete program · Download .c
#include <stdio.h>
int main(void) {
printf("OS security simulation: processes isolated by kernel.\n");
printf("Access granted only to permitted resources.\n");
printf("Malicious process cannot steal data or crash others.\n");
return 0;
}
Compile locally
gcc -std=c11 -Wall -Wextra -Wpedantic -Werror ostep-53-security-intro.c -o example && ./exampleExpected result
OS security simulation: processes isolated by kernel.
Access granted only to permitted resources.
Malicious process cannot steal data or crash others.
CHECK YOUR UNDERSTANDING
Close the answer. Explain it.
Why must the operating system provide isolation mechanisms to protect process resources?
Show a reference answer
Because multiple processes run concurrently; without isolation, a malicious or buggy process could access or destroy other processes' data and resources.
Check the sources
Drafts and official chapters change. The version mark is only the example’s minimum.