]> sourceware.org Git - systemtap.git/commitdiff
PR10551: build compatibility for pax/grsecurity include/linux/module.h
authorFrank Ch. Eigler <fche@elastic.org>
Sun, 23 Aug 2009 22:18:21 +0000 (18:18 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Sun, 23 Aug 2009 22:18:21 +0000 (18:18 -0400)
This patch adapts to patches such as:

diff -urNp linux-2.6.29.6/include/linux/module.h linux-2.6.29.6/include/linux/module.h
--- linux-2.6.29.6/include/linux/module.h       2009-07-02 19:41:20.000000000 -0400
+++ linux-2.6.29.6/include/linux/module.h       2009-07-30 17:59:26.175602427 -0400
@@ -278,16 +278,16 @@ struct module
        int (*init)(void);

        /* If this is non-NULL, vfree after init() returns */
-       void *module_init;
+       void *module_init_rx, *module_init_rw;

        /* Here is the actual code + data, vfree'd on unload. */
-       void *module_core;
+       void *module_core_rx, *module_core_rw;

        /* Here are the sizes of the init and core sections */
-       unsigned int init_size, core_size;
+       unsigned int init_size_rw, core_size_rw;

        /* The size of the executable code in each section.  */
-       unsigned int init_text_size, core_text_size;
+       unsigned int init_size_rx, core_size_rx;

* runtime/autoconf-grsecurity.c: New test.
* buildrun.cxx: Try it.
* runtime/print.c: Use it.

buildrun.cxx
runtime/autoconf-grsecurity.c [new file with mode: 0644]
runtime/print.c

index 796663e01099fa3b719b827cf5cc47cd0f9a744d..1820002df72cc7789d91400ce152d73fe01d8f15 100644 (file)
@@ -154,6 +154,7 @@ compile_pass (systemtap_session& s)
   output_autoconf(s, o, "autoconf-procfs-owner.c", "STAPCONF_PROCFS_OWNER", NULL);
   output_autoconf(s, o, "autoconf-alloc-percpu-align.c", "STAPCONF_ALLOC_PERCPU_ALIGN", NULL);
   output_autoconf(s, o, "autoconf-x86-gs.c", "STAPCONF_X86_GS", NULL);
+  output_autoconf(s, o, "autoconf-grsecurity.c", "STAPCONF_GRSECURITY", NULL);
 
 #if 0
   /* NB: For now, the performance hit of probe_kernel_read/write (vs. our
diff --git a/runtime/autoconf-grsecurity.c b/runtime/autoconf-grsecurity.c
new file mode 100644 (file)
index 0000000..ee2e4e5
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR10551: pax/grsecurity changes linux/module.h */
+
+#include <linux/module.h>
+
+struct module *t;
+unsigned size;
+
+void foo (void)
+{
+   size += t->init_size_rw + t->init_size_rx + t->core_size_rw + t->core_size_rx;  
+}
index 69e04073fc5ed8f4409e1626ef1fb281385099bd..b11e659bd8172d1ed8922f6f1f8903aed07b2135 100644 (file)
@@ -216,28 +216,32 @@ static void _stp_print_char (const char c)
 
 static void _stp_print_kernel_info(char *vstr, int ctx, int num_probes)
 {
+       printk(KERN_DEBUG
+               "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u"
 #ifdef DEBUG_MEM
-       printk(KERN_DEBUG "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u+%u data+text+ctx+net+alloc, probes: %d\n",
+               "+%u"
+#endif
+               " data+text+ctx+net"
+#ifdef DEBUG_MEM
+               "+alloc"
+#endif
+               ", probes: %d\n",
               THIS_MODULE->name,
               vstr, 
-              THIS_MODULE->module_core,  
+              THIS_MODULE->module_core,
+#ifndef STAPCONF_GRSECURITY
               (unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size),
                (unsigned long) THIS_MODULE->core_text_size,
-              ctx,
-              _stp_allocated_net_memory,
-              _stp_allocated_memory - _stp_allocated_net_memory,
-               num_probes);
 #else
-       printk(KERN_DEBUG "%s: systemtap: %s, base: %p, memory: %lu+%lu+%u+%u data+text+ctx+net, probes: %d\n",
-              THIS_MODULE->name,
-              vstr, 
-              THIS_MODULE->module_core,  
-              (unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size),
-               (unsigned long) THIS_MODULE->core_text_size,
+              (unsigned long) (THIS_MODULE->core_size_rw - THIS_MODULE->core_size_rx),
+               (unsigned long) THIS_MODULE->core_size_rx,
+#endif
               ctx,
               _stp_allocated_net_memory,
-              num_probes);
+#ifdef DEBUG_MEM
+              _stp_allocated_memory - _stp_allocated_net_memory,
 #endif
+               num_probes);
 }
 
 /** @} */
This page took 0.031084 seconds and 5 git commands to generate.