简体   繁体   English

系统调用可以导致Linux中的系统恐慌吗?

[英]Can a system call cause a system panic in linux?

Please don't consider syscalls due to calls to panic() etc., which are actually supposed to panic the system. 由于调用panic()等,请不要考虑系统调用,这实际上应该是恐慌系统。 I am more interested in general purpose system calls such as Socket , read, write etc. If such syscalls do cause a panic, then is this a kernel bug? 我对通用系统调用更感兴趣,如Socket ,读取,写入等。如果这样的系统调用确实引起恐慌,那么这是一个内核错误吗? My understanding is that it should be a kernel bug. 我的理解是它应该是一个内核bug。 If passed with wrong arguments then system-call should just abort not panic the complete system. 如果传递错误的参数,那么系统调用应该只是中止而不是恐慌整个系统。

Strangely enough, this is not 100% correct. 奇怪的是,这不是100%正确。

Yes, input to system calls by a non privileged user should not cause a panic unless there is a bug in the kernel or a hardware malfunction (such as broken RAM chips). 是的,非特权用户对系统调用的输入不应引起恐慌,除非内核中存在错误或硬件故障(例如RAM芯片损坏)。

However, this not true for a privileged user (such as root). 但是,对于特权用户(例如root)而言,情况并非如此。 Consider the write(2) system call, when applied to /dev/mem by a privileged user (root being the obvious example) - there is nothing stopping you from overwriting kernel memory with it. 当一个特权用户(root就是一个明显的例子)应用于/ dev / mem时,请考虑write(2)系统调用 - 没有什么可以阻止你用它覆盖内核内存。

Unix is like that - it gives you the full length of the rope to hang yourself easily, if this is what you wish to do :-) Unix就是这样 - 如果你想做的话,它可以让你轻松地挂起自己的绳子:-)

Of course, the kernel must check the syscall parameters, user permissions, resources availability and handle issues like concurrency in order to avoid crash at all costs. 当然,内核必须检查系统调用参数,用户权限,资源可用性以及处理并发等问题,以避免不惜一切代价崩溃。 The bottomline is that a simple user (even root, ideally - but as mentionned by gby this is difficult since root can have direct access to the physical address space) should never be able to crash the system, no matter how hard she tries. 最重要的是,一个简单的用户(即使是root,理想情况下 - 但由于gby提到这很困难,因为root可以直接访问物理地址空间) 永远不能让系统崩溃,无论她多么努力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM