summaryrefslogtreecommitdiff
path: root/package/exmap/patches/patch-kernel_exmap_c
diff options
context:
space:
mode:
Diffstat (limited to 'package/exmap/patches/patch-kernel_exmap_c')
-rw-r--r--package/exmap/patches/patch-kernel_exmap_c137
1 files changed, 122 insertions, 15 deletions
diff --git a/package/exmap/patches/patch-kernel_exmap_c b/package/exmap/patches/patch-kernel_exmap_c
index 0a641298c..08b22ea02 100644
--- a/package/exmap/patches/patch-kernel_exmap_c
+++ b/package/exmap/patches/patch-kernel_exmap_c
@@ -1,7 +1,40 @@
$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
--- exmap-console-0.4.1.orig/kernel/exmap.c 2006-10-24 20:45:11.000000000 +0200
-+++ exmap-console-0.4.1/kernel/exmap.c 2009-06-11 12:31:45.000000000 +0200
-@@ -392,7 +392,11 @@ int setup_from_pid(pid_t pid)
++++ exmap-console-0.4.1/kernel/exmap.c 2013-11-02 18:56:21.000000000 +0100
+@@ -340,24 +340,22 @@ static int show_vma_start(struct exmap_v
+ }
+
+
+-static int exmap_show_next(char *buffer, int length)
++static ssize_t exmap_show_next(char *buffer, size_t length)
+ {
+- int offset = 0;
++ ssize_t offset = 0;
+ struct exmap_vma_data *vma_data;
+ pte_t pte;
+ int line_len;
+
+ while (local_data.vma_cursor < local_data.num_vmas) {
+ vma_data = local_data.vma_data + local_data.vma_cursor;
+-// printk (KERN_INFO
+-// "exmap: examining vma %08lx [%d/%d] %d\n",
+-// vma_data->vm_start,
+-// local_data.vma_cursor,
+-// local_data.num_vmas,
+-// vma_data->start_shown);
++ printk (KERN_INFO
++ "exmap: examining vma %08lx [%d/%d] %d\n",
++ vma_data->vm_start,
++ local_data.vma_cursor,
++ local_data.num_vmas,
++ vma_data->start_shown);
+ if (!vma_data->start_shown) {
+-// printk (KERN_INFO
+-// "exmap: svs\n");
+ line_len = show_vma_start(vma_data,
+ buffer + offset,
+ length - offset);
+@@ -392,7 +390,11 @@ int setup_from_pid(pid_t pid)
struct task_struct *tsk;
int errcode = -EINVAL;
@@ -13,27 +46,101 @@ $Id: update-patches 24 2008-08-31 14:56:13Z wbx $
if (tsk == NULL) {
printk (KERN_ALERT
"/proc/%s: can't find task for pid %d\n",
-@@ -507,7 +511,7 @@ int init_module ()
- NULL);
+@@ -445,10 +447,10 @@ Exit:
+ * where deadbeef is the hex addr of the vma to examine
+ * and pid is the (decimal) pid of the process to examine
+ */
+-static int procfile_write (struct file *file,
++static ssize_t procfile_write (struct file *file,
+ const char __user *buffer,
+- unsigned long count,
+- void *data)
++ size_t count,
++ loff_t *off)
+ {
+ pid_t pid;
+ int errcode = -EINVAL;
+@@ -475,14 +477,11 @@ static int procfile_write (struct file *
+ * Only support sequential reading of file from start to finish
+ * (following a write() to set the pid to examine
+ */
+-static int procfile_read (char *buffer,
+- char **buffer_location,
+- off_t offset,
+- int buffer_length,
+- int *eof,
+- void *data)
++static ssize_t procfile_read (struct file *filp,
++ char __user *buf,
++ size_t len,
++ loff_t *ppos)
+ {
+- int ret;
+
+ if (local_data.vma_data == NULL) {
+ printk (KERN_ALERT "/proc/%s: vma data not set\n",
+@@ -490,47 +489,40 @@ static int procfile_read (char *buffer,
+ return -EINVAL;
+ }
+
+- ret = exmap_show_next(buffer, buffer_length);
+- if (ret > 0) {
+- *buffer_location = buffer;
+- }
+- return ret;
++ return exmap_show_next(buf, len);
+ }
+
+-int init_module ()
++static const struct file_operations proc_file_fops = {
++ .owner = THIS_MODULE,
++ .write = procfile_write,
++ .read = procfile_read,
++};
++
++
++static int __init exmap_init(void)
+ {
+ struct proc_dir_entry *exmap_proc_file;
+ printk (KERN_INFO "/proc/%s: insert\n", PROCFS_NAME);
+
+- exmap_proc_file = create_proc_entry (PROCFS_NAME,
++ exmap_proc_file = proc_create (PROCFS_NAME,
+ 0644,
+- NULL);
++ NULL,
++ &proc_file_fops);
if (exmap_proc_file == NULL) {
- remove_proc_entry (PROCFS_NAME, &proc_root);
-+ remove_proc_entry (PROCFS_NAME, NULL);
printk (KERN_ALERT "/proc/%s: could not initialize\n",
PROCFS_NAME);
return -ENOMEM;
-@@ -515,7 +519,6 @@ int init_module ()
+ }
- exmap_proc_file->read_proc = procfile_read;
- exmap_proc_file->write_proc = procfile_write;
+- exmap_proc_file->read_proc = procfile_read;
+- exmap_proc_file->write_proc = procfile_write;
- exmap_proc_file->owner = THIS_MODULE;
-
- /* exmap_proc_file->mode = S_IFREG | S_IRUGO; */
- /* TODO - this is quite probably a security problem */
-@@ -532,5 +535,5 @@ int init_module ()
- void cleanup_module ()
+-
+- /* exmap_proc_file->mode = S_IFREG | S_IRUGO; */
+- /* TODO - this is quite probably a security problem */
+- exmap_proc_file->mode = 0666;
+-
+- exmap_proc_file->uid = 0;
+- exmap_proc_file->gid = 0;
+- exmap_proc_file->size = 0;
+-
+ init_local_data();
+ return 0;
+ }
+
+-void cleanup_module ()
++static void __exit exmap_exit(void)
{
- printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
+- printk (KERN_INFO "/proc/%s: remove\n", PROCFS_NAME);
- remove_proc_entry (PROCFS_NAME, &proc_root);
-+ remove_proc_entry (PROCFS_NAME, NULL);
++ remove_proc_entry(PROCFS_NAME, NULL);
}
++
++module_init(exmap_init);
++module_exit(exmap_exit);