[PATCH] kernel: Restrict permissions of /proc/iomem.

From: zhanglin
Date: Fri Oct 25 2019 - 04:55:33 EST


The permissions of /proc/iomem currently are -r--r--r--. Everyone can
see its content. As iomem contains information about the physical memory
content of the device, restrict the information only to root.

Signed-off-by: zhanglin <zhang.lin16@xxxxxxxxxx>
---
kernel/resource.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 30e1bc6..844456e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -139,7 +139,8 @@ static int __init ioresources_init(void)
{
proc_create_seq_data("ioports", 0, NULL, &resource_op,
&ioport_resource);
- proc_create_seq_data("iomem", 0, NULL, &resource_op, &iomem_resource);
+ proc_create_seq_data("iomem", S_IRUSR, NULL, &resource_op,
+ &iomem_resource);
return 0;
}
__initcall(ioresources_init);
--
2.15.2