Reputation: 129
I know my question might sound strange, however I am wondering what would happen if I tried to copy the source code of a syscall in a C file and if I tried to run it.
Which security mechanism of the operating system will stop the code execution?
Upvotes: 1
Views: 70
Reputation: 48662
It wouldn't work at all. The security mechanism that would stop it belongs to the CPU, not to the operating system. CPUs have different privilege levels that code runs at, and your userspace code would run at the lowest privilege level, which isn't allowed to do the things that kernels need to do, so the processor would fault when you tried to do them anyway.
Upvotes: 1