I understand how a read()
from a C code work, which traps into the kernel mode, provide its syscall number in the %eax, and in the kernel, the syscall handler reads from %eax to get the syscall number and do the correct syscall.
But I don't understand how can the syscall handler prevent some non-security things from happening, such as a user program wants to read a kernel memory in which it shouldn't do that.
Can you provide me with an example of some mechanisms of the syscall handler in the kernel that it can prevent bad user syscalls? Or you can just give me some link to some notes so that I can read at?