X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fproc%2Fkcore.c;fp=fs%2Fproc%2Fkcore.c;h=adc2cd95169a0793b69cde85db8949a11ef8c898;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=150d9c5f1b49b7b6953634007c3306746b8667bf;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 150d9c5f1..adc2cd951 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c @@ -9,6 +9,7 @@ * Safe accesses to vmalloc/direct-mapped discontiguous areas, Kanoj Sarcar */ +#include #include #include #include @@ -25,12 +26,12 @@ static int open_kcore(struct inode * inode, struct file * filp) { - return -EPERM; + return capable(CAP_SYS_RAWIO) ? 0 : -EPERM; } static ssize_t read_kcore(struct file *, char __user *, size_t, loff_t *); -const struct file_operations proc_kcore_operations = { +struct file_operations proc_kcore_operations = { .read = read_kcore, .open = open_kcore, }; @@ -42,6 +43,8 @@ const struct file_operations proc_kcore_operations = { #define kc_offset_to_vaddr(o) ((o) + PAGE_OFFSET) #endif +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) + /* An ELF note in memory */ struct memelfnote { @@ -382,7 +385,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) */ if (n) { if (clear_user(buffer + tsz - n, - n)) + tsz - n)) return -EFAULT; } } else {