Skip to content

Commit e8aff60

Browse files
torvaldsgregkh
authored andcommitted
/proc/iomem: only expose physical resource addresses to privileged users
commit 51d7b120418e99d6b3bf8df9eb3cc31e8171dee4 upstream. In commit c4004b02f8e5b ("x86: remove the kernel code/data/bss resources from /proc/iomem") I was hoping to remove the phyiscal kernel address data from /proc/iomem entirely, but that had to be reverted because some system programs actually use it. This limits all the detailed resource information to properly credentialed users instead. [sumits: this is used in Ubuntu as a fix for CVE-2015-8944] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 14ae9c4 commit e8aff60

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

kernel/resource.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,25 @@ static int r_show(struct seq_file *m, void *v)
105105
{
106106
struct resource *root = m->private;
107107
struct resource *r = v, *p;
108+
unsigned long long start, end;
108109
int width = root->end < 0x10000 ? 4 : 8;
109110
int depth;
110111

111112
for (depth = 0, p = r; depth < MAX_IORES_LEVEL; depth++, p = p->parent)
112113
if (p->parent == root)
113114
break;
115+
116+
if (file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) {
117+
start = r->start;
118+
end = r->end;
119+
} else {
120+
start = end = 0;
121+
}
122+
114123
seq_printf(m, "%*s%0*llx-%0*llx : %s\n",
115124
depth * 2, "",
116-
width, (unsigned long long) r->start,
117-
width, (unsigned long long) r->end,
125+
width, start,
126+
width, end,
118127
r->name ? r->name : "<BAD>");
119128
return 0;
120129
}

0 commit comments

Comments
 (0)