It was said that one of the reasons for having a kernel stack is to protect kernel data from user space access during the syscall. But this is the part I don't quite get, so there must be some knowledge gap here.
Imagine if there were no kernel stacks, and syscall reuses user space stack. Because the syscall won't return to user code unless it finishes, and by the time the syscall finishes, it would have unwound its stack already, I don't see what opportunities do user code have to access the transiently existed syscall stack frames and the data that resided on it.
Is it because user stack exists in user memory space in which any user code can access, therefore any other active threads could've read the stack frames of the aforementioned thread while it's still trapped inside the syscall? Is this the only way this accessing could have happened theoretically?