Drivers

為什麼我的 /proc/iomem 中的條目都是 00000000-00000000?

  • April 12, 2017

我的 /proc/iomem 中的 Etries 都是 00000000-00000000

/proc/ioports 也是如此。他們都是0000-0000

像:

00000000-00000000 : reserved
00000000-00000000 : System RAM
00000000-00000000 : reserved

我正在執行 4.10.3-1-ARCH x86_64

也歡迎任何關於如何自己找出原因的建議,謝謝。

嘗試sudo在你的命令前面使用,比如sudo less /proc/io{mem,ports}

更新檔解釋了這種現象。

diff --git a/kernel/resource.c b/kernel/resource.c
index 2e78ead..9b5f044 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -105,16 +105,25 @@
{
   struct resource *root = m->private;
   struct resource *r = v, *p;
+   unsigned long long start, end;
   int width = root->end < 0x10000 ? 4 : 8;
   int depth;

   for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)
       if (p->parent == root)
           break;
+
+   if (file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) {
+       start = r->start;
+       end = r->end;
+   } else {
+       start = end = 0;
+   }
+
   seq_printf(m, "%*s%0*llx-%0*llx : %s\n",
           depth * 2, "",
-           width, (unsigned long long) r->start,
-           width, (unsigned long long) r->end,
+           width, start,
+           width, end,
           r->name ? r->name : "<BAD>");
   return 0;
}

引用自:https://unix.stackexchange.com/questions/358050