{"id":63295,"date":"2025-04-29T08:16:06","date_gmt":"2025-04-29T00:16:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63295\/"},"modified":"2025-04-29T08:16:06","modified_gmt":"2025-04-29T00:16:06","slug":"%e4%bb%80%e4%b9%88%e6%98%aflinux-oops%ef%bc%9f%e8%a7%a3%e6%9e%90%e9%94%99%e8%af%af%e4%bf%a1%e6%81%af-3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63295\/","title":{"rendered":"\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/887\/227\/171092610552886.jpg\" class=\"aligncenter\" title=\"\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f\u63d2\u56fe\" alt=\"\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f\u63d2\u56fe\" \/><\/p>\n<h1>\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b<\/h1>\n<h2>\u7b80\u4ecb<\/h2>\n<p>Linux Oops\u662f\u6307Linux\u5185\u6838\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u8f93\u51fa\u7684\u4e00\u79cd\u9519\u8bef\u4fe1\u606f\uff0c\u7c7b\u4f3c\u4e8eWindows\u7cfb\u7edf\u7684\u84dd\u5c4f\u9519\u8bef\u3002\u5f53Linux\u5185\u6838\u9047\u5230\u65e0\u6cd5\u5904\u7406\u7684\u4e25\u91cd\u9519\u8bef\u65f6\uff0c\u4f1a\u505c\u6b62\u8fd0\u884c\u5e76\u8f93\u51fa\u4e00\u6bb5\u79f0\u4e3aOops\u4fe1\u606f\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u901a\u8fc7\u5206\u6790\u8fd9\u4e9b\u4fe1\u606f\u53ef\u4ee5\u5b9a\u4f4d\u95ee\u9898\u5e76\u8fdb\u884c\u8c03\u8bd5\u3002<\/p>\n<h2>Oops\u4fe1\u606f\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Linux Oops\u4fe1\u606f\u793a\u4f8b\uff1a<\/p>\n<pre>BUG: unable to handle kernel NULL pointer dereference at 0000000000000008\nIP: [&lt;ffffffffa01f9f1a&gt;] some_function+0x1a\/0x40 [module_name]\nPGD 7e0b067 PUD 7e0c067 PMD 0\nOops: 0000 [#1] SMP\nModules linked in: module_name\nCPU: 0 PID: 1 Comm: init Not tainted 4.19.0-16-amd64 #1 Debian 4.19.181-1\nHardware name: VirtualBox VirtualBox, BIOS VirtualBox 12\/01\/2006\nRIP: 0010:some_function+0x1a\/0x40 [module_name]\nRSP: 0018:ffffb3db003f3d8f\nRAX: 0000000000000000 RBX: ffffabc656688000 RCX: 0000000000000000\nRDX: 0000000000000000 RSI: ffffabc6566880f8 RDI: 0000000000000000\nRBP: ffffb3db003f3d8f R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000024 R11: 0000000000000003 R12: ffffabc6566880f8\nR13: ffffabc6fad9d008 R14: 0000000000000000 R15: ffffabc656688000\nFS: 0000000000000000(0000) GS:ffffabc6fac20000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000000000000008 CR3: 0000001f23df6000 CR4: 00000000000706f0\nCall Trace:\nanother_function+0x2b\/0x60 [module_name]\ninit+0x1f\/0x30&lt;\/ffffffffa01f9f1a&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<h2>\u89e3\u6790\u9519\u8bef\u4fe1\u606f<\/h2>\n<ol>\n<li>BUG\uff1a\u6307\u793a\u53d1\u751f\u4e86\u4e00\u4e2a\u9519\u8bef\u3002<\/li>\n<li>unable to handle kernel NULL pointer dereference at 0000000000000008\uff1a\u6307\u793a\u5185\u6838\u65e0\u6cd5\u5904\u7406\u4e00\u4e2a\u7a7a\u6307\u9488\u89e3\u5f15\u7528\u9519\u8bef\u3002<\/li>\n<li>IP\uff1a\u6307\u51fa\u53d1\u751f\u9519\u8bef\u7684\u6307\u4ee4\u5730\u5740\u3002<\/li>\n<li>PGD PUD PMD\uff1a\u63cf\u8ff0\u4e86\u51fa\u9519\u65f6\u7684\u9875\u8868\u60c5\u51b5\u3002<\/li>\n<li>Oops\uff1a\u6307\u51fa\u8fd9\u662f\u4e00\u4e2aOops\u4fe1\u606f\u3002<\/li>\n<li>Modules linked in\uff1a\u5217\u51fa\u4e86\u52a0\u8f7d\u7684\u6a21\u5757\u3002<\/li>\n<li>CPU\uff1a\u6307\u51fa\u53d1\u751f\u9519\u8bef\u7684CPU\u7f16\u53f7\u3001\u8fdb\u7a0bID\u548c\u8fdb\u7a0b\u540d\u3002<\/li>\n<li>RIP\uff1a\u6307\u793a\u5f15\u53d1\u9519\u8bef\u7684\u6307\u4ee4\u5730\u5740\u548c\u6a21\u5757\u3002<\/li>\n<li>\u5bc4\u5b58\u5668\u4fe1\u606f\uff1a\u63cf\u8ff0\u4e86\u4e00\u4e9bCPU\u5bc4\u5b58\u5668\u7684\u503c\u3002<\/li>\n<li>Call Trace\uff1a\u663e\u793a\u4e86\u9519\u8bef\u53d1\u751f\u65f6\u7684\u51fd\u6570\u8c03\u7528\u6808\u3002<\/li>\n<\/ol>\n<h2>\u793a\u4f8b\u4ee3\u7801<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684C\u4ee3\u7801\u793a\u4f8b\uff0c\u6a21\u62df\u4e86\u5f15\u53d1Oops\u7684\u7a7a\u6307\u9488\u89e3\u5f15\u7528\u9519\u8bef\u60c5\u51b5\uff1a<\/p>\n<pre>#include &lt;linux&gt;\n#include &lt;linux&gt;\n\nstatic int *ptr = NULL;\n\nstatic int __init oops_example_init(void)\n{\n    int value;\n    \n    value = *ptr;  \/\/ \u5f15\u53d1\u7a7a\u6307\u9488\u89e3\u5f15\u7528\u9519\u8bef\n    \n    return 0;\n}\n\nstatic void __exit oops_example_exit(void)\n{\n    printk(KERN_INFO \"Exiting Oops Example Module\n\");\n}\n\nmodule_init(oops_example_init);\nmodule_exit(oops_example_exit);\n\nMODULE_LICENSE(\"GPL\");\nMODULE_AUTHOR(\"Author\");&lt;\/linux&gt;&lt;\/linux&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>Linux Oops\u4fe1\u606f\u63d0\u4f9b\u4e86\u6709\u5173\u5185\u6838\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u7684\u5173\u952e\u4fe1\u606f\uff0c\u901a\u8fc7\u89e3\u6790Oops\u4fe1\u606f\u548c\u4ee3\u7801\u793a\u4f8b\uff0c\u53ef\u4ee5\u5b9a\u4f4d\u548c\u89e3\u51b3\u95ee\u9898\u3002\u5728\u5f00\u53d1\u6216\u8c03\u8bd5Linux\u5185\u6838\u6a21\u5757\u65f6\uff0c\u53ca\u65f6\u5904\u7406Oops\u4fe1\u606f\u662f\u975e\u5e38\u91cd\u8981\u7684\uff0c\u4ee5\u4fdd\u8bc1\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ec0\u4e48\u662fLinux Oops\uff1f\u89e3\u6790\u9519\u8bef\u4fe1\u606f\uff0c\u9700\u8981\u5177\u4f53\u4ee3\u7801\u793a\u4f8b \u7b80\u4ecb Linux Oops\u662f\u6307Linux\u5185\u6838\u5728\u53d1\u751f\u4e25\u91cd\u9519\u8bef\u65f6\u8f93\u51fa\u7684\u4e00\u79cd\u9519\u8bef\u4fe1\u606f\uff0c\u7c7b\u4f3c\u4e8eWindows\u7cfb\u7edf\u7684\u84dd\u5c4f\u9519\u8bef\u3002\u5f53Linux\u5185\u6838\u9047\u5230\u65e0\u6cd5\u5904\u7406\u7684\u4e25\u91cd\u9519\u8bef\u65f6\uff0c\u4f1a\u505c\u6b62\u8fd0\u884c\u5e76\u8f93\u51fa\u4e00\u6bb5\u79f0\u4e3aOops\u4fe1\u606f\u7684\u9519\u8bef\u65e5\u5fd7\uff0c\u901a\u8fc7\u5206\u6790\u8fd9\u4e9b\u4fe1\u606f\u53ef\u4ee5\u5b9a\u4f4d\u95ee\u9898\u5e76\u8fdb\u884c\u8c03\u8bd5\u3002 Oops\u4fe1\u606f\u793a\u4f8b \u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Linux Oops\u4fe1\u606f\u793a\u4f8b\uff1a BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 IP: [&lt;ffffffffa01f9f1a&gt;] some_function+0x1a\/0x40 [module_name] PGD 7e0b067 PUD 7e0c067 PMD 0 Oops: 0000 [#1] SMP Modules linked in: module_name CPU: 0 PID: 1 Comm: init Not tainted 4.19.0-16-amd64 #1 Debian 4.19.181-1 Hardware name: VirtualBox VirtualBox, BIOS VirtualBox 12\/01\/2006 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63295","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63295"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63295\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}