linux - Can we call system call in kernel space? -


sometimes, when have call system call in kernel system, invoke it's helper or related kernel functions, instead 'syscall'. still wondering can call system call in kernel space? if not, stops doing that.

my question little bit weird.

actually, contrary popular belief (and answers here), answer is, yes, can, depending on os:

  • in linux, can call system calls if can find kernel export (do "cat /proc/kallsysms | grep sys_" example). there minor "trick" around protection in syscalls (those accept user mode *), setting data segment (kernel_ds). it's not recommended, makes sense if need access files kernel (e.g. selinux).

  • in windows, of nt* calls in kernel available zw* calls - "dumpbin /exports c:\windows\system32\ntoskrnl.exe | findstr zw (or nt)" example.

  • in mac os x, technically shouldn't allowed, though there clever hacks around it.

even though system calls indeed interface between user mode , kernel, there surprisingly quite few cases production-worthy code -- through careful observance of caveats.


Comments

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -