Commit 05628932 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix permissions on /proc/kallsyms

From: Rusty Russell <rusty@rustcorp.com.au>

Change the permissions on /proc/kallsyms.  As David M-T points out,
it's nice for analysis tools not to need root.  Place
cond_resched() to avoid starvation problems on non-preempt.
parent bbe58736
...@@ -189,9 +189,11 @@ static int update_iter(struct kallsym_iter *iter, loff_t pos) ...@@ -189,9 +189,11 @@ static int update_iter(struct kallsym_iter *iter, loff_t pos)
if (pos < iter->pos) if (pos < iter->pos)
reset_iter(iter); reset_iter(iter);
/* We need to iterate through the previous symbols. */ /* We need to iterate through the previous symbols: can be slow */
for (; iter->pos != pos; iter->pos++) for (; iter->pos != pos; iter->pos++) {
get_ksymbol_core(iter); get_ksymbol_core(iter);
cond_resched();
}
return 1; return 1;
} }
...@@ -280,8 +282,7 @@ int __init kallsyms_init(void) ...@@ -280,8 +282,7 @@ int __init kallsyms_init(void)
{ {
struct proc_dir_entry *entry; struct proc_dir_entry *entry;
/* root-only: could chew up lots of cpu by read, seek back, read... */ entry = create_proc_entry("kallsyms", 0444, NULL);
entry = create_proc_entry("kallsyms", 0400, NULL);
if (entry) if (entry)
entry->proc_fops = &kallsyms_operations; entry->proc_fops = &kallsyms_operations;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment