Blame SOURCES/0319-koops-Filter-kernel-oopses-based-on-logged-hostname.patch

06486d
From 9fdd19c8ce013fa32d2ab62e4363d6890132dbb3 Mon Sep 17 00:00:00 2001
06486d
From: clime <clime@redhat.com>
06486d
Date: Thu, 22 Nov 2018 13:45:38 +0100
06486d
Subject: [PATCH] koops: Filter kernel oopses based on logged hostname
06486d
06486d
syslog message parser that looks for kernel oopses did not look
06486d
at hostname in each message before. If logs from multiple machines
06486d
are collected into a single system log on one central machine, abrt
06486d
can trigger on events that come from those other machines, whereas it
06486d
should trigger only on events coming from the machine itself. This
06486d
commit fixes the behavior by checking the hostname in each event.
06486d
06486d
rsyslogd needs to be configured to include the hostname (short or full)
06486d
in the syslog messages, otherwise all kernel oopses will be filtered out.
06486d
By default system configuration, the short hostname is included.
06486d
06486d
* also adds fixes for tests because host name in test input files now matters
06486d
06486d
Related: bz#1613182
06486d
---
06486d
 src/lib/kernel.c                              |  43 ++++
06486d
 tests/Makefile.am                             |  12 +-
06486d
 tests/examples/koops-tainted-g                |  61 -----
06486d
 tests/examples/koops-tainted-g.template       |  59 +++++
06486d
 tests/examples/koops-tainted-insane           |   6 -
06486d
 tests/examples/koops-tainted-insane.template  |   6 +
06486d
 tests/examples/nmi_oops.test                  |  32 ---
06486d
 tests/examples/nmi_oops.test.template         |  32 +++
06486d
 tests/examples/not_oops_foreign_hostname.test |   1 +
06486d
 tests/examples/oops_full_hostname.test        |   1 +
06486d
 tests/examples/oops_full_hostname.test.template |   1 +
06486d
 tests/examples/prepare-data                   |  10 +
06486d
 12 files changed, 161 insertions(+), 103 deletions(-)
06486d
 delete mode 100644 tests/examples/koops-tainted-g
06486d
 create mode 100644 tests/examples/koops-tainted-g.template
06486d
 delete mode 100644 tests/examples/koops-tainted-insane
06486d
 create mode 100644 tests/examples/koops-tainted-insane.template
06486d
 delete mode 100644 tests/examples/nmi_oops.test
06486d
 create mode 100644 tests/examples/nmi_oops.test.template
06486d
 create mode 100644 tests/examples/not_oops_foreign_hostname.test
06486d
 create mode 100644 tests/examples/oops_full_hostname.test
06486d
 create mode 100644 tests/examples/oops_full_hostname.test.template
06486d
 create mode 100755 tests/examples/prepare-data
06486d
06486d
diff --git a/src/lib/kernel.c b/src/lib/kernel.c
06486d
index 346b0a662..0a8488e25 100644
06486d
--- a/src/lib/kernel.c
06486d
+++ b/src/lib/kernel.c
06486d
@@ -20,6 +20,7 @@
06486d
 #include <satyr/thread.h>
06486d
 
06486d
 #include <regex.h>
06486d
+#include <string.h>
06486d
 
06486d
 #define _GNU_SOURCE 1 /* for strcasestr */
06486d
 #include "libabrt.h"
06486d
@@ -234,6 +235,38 @@ void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen)
06486d
     int lines_info_size = 0;
06486d
     struct line_info *lines_info = NULL;
06486d
 
06486d
+    /* prepare hostname search string (needle) */
06486d
+    unsigned hsz = 256;
06486d
+    char *hostname = xmalloc(hsz);
06486d
+    char *short_needle = xmalloc(hsz+10);
06486d
+    char *long_needle = xmalloc(hsz+10);
06486d
+    if (gethostname(hostname, hsz) != 0)
06486d
+    {
06486d
+        hostname[0] = '\0';
06486d
+    }
06486d
+    else
06486d
+    {
06486d
+        char *dot_str = strchr(hostname, '.');
06486d
+        unsigned dot_pos;
06486d
+        if (dot_str != NULL)
06486d
+        {
06486d
+            dot_pos = dot_str - hostname;
06486d
+        }
06486d
+        else
06486d
+        {
06486d
+            hostname[hsz-1] = '\0';
06486d
+            dot_pos = strlen(hostname);
06486d
+        }
06486d
+        short_needle[0] = ' ';
06486d
+        short_needle[1] = '\0';
06486d
+        strncat(short_needle, hostname, dot_pos);
06486d
+        strncat(short_needle, " kernel: ", 10);
06486d
+        long_needle[0] = ' ';
06486d
+        long_needle[1] = '\0';
06486d
+        strncat(long_needle, hostname, hsz-1);
06486d
+        strncat(long_needle, " kernel: ", 10);
06486d
+    }
06486d
+
06486d
     /* Split buffer into lines */
06486d
 
06486d
     if (buflen != 0)
06486d
@@ -289,6 +322,13 @@ void koops_extract_oopses(GList **oops_list, char *buffer, size_t buflen)
06486d
                 }
06486d
                 goto next_line;
06486d
             }
06486d
+
06486d
+            /* check if the machine hostname is contained in the message hostname */
06486d
+            if (hostname[0] != '\0' && !strstr(c, short_needle) && !strstr(c, long_needle))
06486d
+            {
06486d
+                goto next_line;
06486d
+            }
06486d
+
06486d
             c = kernel_str + sizeof("kernel: ")-1;
06486d
         }
06486d
 
06486d
@@ -499,6 +539,9 @@ next_line:
06486d
     }
06486d
 
06486d
     free(lines_info);
06486d
+    free(hostname);
06486d
+    free(short_needle);
06486d
+    free(long_needle);
06486d
 }
06486d
 
06486d
 int koops_hash_str(char result[SHA1_RESULT_LEN*2 + 1], const char *oops_buf)
06486d
diff --git a/tests/Makefile.am b/tests/Makefile.am
06486d
index 1e1b63376..dc96e5d7e 100644
06486d
--- a/tests/Makefile.am
06486d
+++ b/tests/Makefile.am
06486d
@@ -25,8 +25,8 @@ EXTRA_DIST = package.m4 ignored_problems_data
06486d
 ## ------------ ##
06486d
 
06486d
 TESTSUITE_FILES =
06486d
-TESTSUITE_FILES += examples/koops-tainted-g
06486d
-TESTSUITE_FILES += examples/koops-tainted-insane
06486d
+TESTSUITE_FILES += examples/koops-tainted-g.template
06486d
+TESTSUITE_FILES += examples/koops-tainted-insane.template
06486d
 TESTSUITE_FILES += examples/koops-tainted-spaces
06486d
 TESTSUITE_FILES += examples/cut_here.right
06486d
 TESTSUITE_FILES += examples/oops-kernel-3.x.x
06486d
@@ -42,7 +42,7 @@ TESTSUITE_FILES += examples/oops-with-jiffies.test
06486d
 TESTSUITE_FILES += examples/oops-with-jiffies.right
06486d
 TESTSUITE_FILES += examples/oops_recursive_locking1.test
06486d
 TESTSUITE_FILES += examples/oops_recursive_locking1.right
06486d
-TESTSUITE_FILES += examples/nmi_oops.test
06486d
+TESTSUITE_FILES += examples/nmi_oops.test.template
06486d
 TESTSUITE_FILES += examples/nmi_oops.right
06486d
 TESTSUITE_FILES += examples/nmi_oops_hash.test
06486d
 TESTSUITE_FILES += examples/nmi_oops_hash.right
06486d
@@ -66,11 +66,15 @@ TESTSUITE_AT = \
06486d
 EXTRA_DIST += $(TESTSUITE_AT) $(TESTSUITE_FILES)
06486d
 TESTSUITE = $(srcdir)/testsuite
06486d
 MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
06486d
-check_DATA = atconfig atlocal $(TESTSUITE)
06486d
+check_DATA = atconfig atlocal prepare-data $(TESTSUITE)
06486d
 DISTCLEANFILES = atconfig
06486d
 EXTRA_DIST += atlocal.in
06486d
 EXTRA_DIST += koops-test.h
06486d
 EXTRA_DIST += GList_append.supp
06486d
+EXTRA_DIST += examples/prepare-data
06486d
+
06486d
+prepare-data:
06486d
+	${top_builddir}/tests/examples/prepare-data
06486d
 
06486d
 atconfig: $(top_builddir)/config.status
06486d
 	(cd ${top_builddir} && ./config.status ${subdir}/atconfig)
06486d
diff --git a/tests/examples/koops-tainted-g b/tests/examples/koops-tainted-g
06486d
deleted file mode 100644
06486d
index f59c7400e..000000000
06486d
--- a/tests/examples/koops-tainted-g
06486d
+++ /dev/null
06486d
@@ -1,61 +0,0 @@
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564718] ------------[ cut here]------------
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564721] WARNING: atarch/x86/xen/mmu.c:475 xen_make_pte+0x32/0x8e()
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564723] Hardware name: OptiPlex 755                 
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564725] Modules linked in: nfs
06486d
-fscache auth_rpcgss nfs_acl tcp_lp ppdev parport_pc lp parport ebtable_nat
06486d
-ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun
06486d
-bridge stp llc lockd drbd lru_cache ip6t_REJECT nf_conntrack_ipv6
06486d
-nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack
06486d
-ip6table_filter ip6_tables snd_hda_codec_analog dcdbas snd_hda_intel
06486d
-snd_hda_codec snd_hwdep snd_seq snd_seq_device 3c59x mii snd_pcm i2c_i801
06486d
-serio_raw iTCO_wdt iTCO_vendor_support snd_timer snd soundcore snd_page_alloc
06486d
-e1000e xen_netback xen_blkback xen_gntdev xen_evtchn sunrpc uinput xenfs
06486d
-pata_acpi usb_storage ata_generic radeon ttm drm_kms_helper drm i2c_algo_bit
06486d
-i2c_core [last unloaded: scsi_wait_scan]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564791] Pid: 912, comm: X Tainted: G            3.1.0-0.rc9.git0.0.fc16.x86_64 #1
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564793] Call Trace:
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564797]  [<ffffffff81057a56>] warn_slowpath_common+0x83/0x9b
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564800]  [<ffffffff81057a88>] warn_slowpath_null+0x1a/0x1c
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564803]  [<ffffffff8100527e>] xen_make_pte+0x32/0x8e
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564807]  [<ffffffff810045f1>] __raw_callee_save_xen_make_pte+0x11/0x1e
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564810]  [<ffffffff81032b0a>] ? pfn_pte+0x26/0x29
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564814]  [<ffffffff81032f75>] __change_page_attr_set_clr+0x130/0x749
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564817]  [<ffffffff8100782a>] ? get_phys_to_machine+0x1f/0x62
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564821]  [<ffffffff81005318>] ? mfn_to_pfn.part.3+0x3e/0x88
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564824]  [<ffffffff8100539d>] ? pte_mfn_to_pfn+0x3b/0x4d
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564827]  [<ffffffff81005c03>] ? __xen_set_pte+0x1b/0x5b
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564831]  [<ffffffff81033543>] __change_page_attr_set_clr+0x6fe/0x749
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564834]  [<ffffffff811063e7>] ? __purge_vmap_area_lazy+0x7c/0x17d
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564838]  [<ffffffff810336da>] change_page_attr_set_clr+0x14c/0x305
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564842]  [<ffffffff81033aa7>] _set_pages_array+0xa3/0xf1
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564845]  [<ffffffff81033b08>] set_pages_array_wc+0x13/0x15
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564852]  [<ffffffffa0065a2d>] ttm_set_pages_caching+0x39/0x5b [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564858]  [<ffffffffa0065b22>] ttm_alloc_new_pages+0xd3/0x15b [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564864]  [<ffffffffa0065e09>] ttm_get_pages+0x137/0x361 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564870]  [<ffffffffa005fdba>] __ttm_tt_get_page+0x54/0xb0 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564876]  [<ffffffffa0060099>] ttm_tt_populate+0x3d/0x7c [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564881]  [<ffffffffa006010a>] ttm_tt_bind+0x32/0x66 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564887]  [<ffffffffa006178a>] ttm_bo_handle_move_mem+0x114/0x2a1 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564893]  [<ffffffffa0061bb6>] ttm_bo_evict+0x29f/0x2e8 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564899]  [<ffffffffa0061d51>] ttm_mem_evict_first+0x152/0x180 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564906]  [<ffffffffa00623c6>] ttm_bo_mem_space+0x29b/0x2ea [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564912]  [<ffffffffa00624cb>] ttm_bo_move_buffer+0xb6/0x10c [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564922]  [<ffffffffa001ec90>] ? drm_mm_insert_helper+0xd3/0xec [drm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564928]  [<ffffffffa00625d7>] ttm_bo_validate+0xb6/0xf4 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564934]  [<ffffffffa0062915>] ttm_bo_init+0x300/0x339 [ttm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564949]  [<ffffffffa009a442>] radeon_bo_create+0x1bf/0x248 [radeon]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564965]  [<ffffffffa009a194>] ? radeon_bo_clear_surface_reg+0x50/0x50 [radeon]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564983]  [<ffffffffa00a9f7a>] radeon_gem_object_create+0x53/0xd8 [radeon]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565001]  [<ffffffffa00aa232>] radeon_gem_create_ioctl+0x4b/0x81 [radeon]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565005]  [<ffffffff8104402b>] ? should_resched+0xe/0x2d
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565013]  [<ffffffffa0015784>] drm_ioctl+0x29e/0x37b [drm]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565031]  [<ffffffffa00aa1e7>] ? radeon_gem_pwrite_ioctl+0x28/0x28 [radeon]
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565034]  [<ffffffff811de8d4>] ? inode_has_perm+0x32/0x34
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565038]  [<ffffffff811de97d>] ? file_has_perm+0xa7/0xc9
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565041]  [<ffffffff81136f33>] do_vfs_ioctl+0x452/0x493
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565045]  [<ffffffff81136fca>] sys_ioctl+0x56/0x7c
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565048]  [<ffffffff811291aa>] ? sys_read+0x61/0x6e
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565059]  [<ffffffff814bc0c2>] system_call_fastpath+0x16/0x1b
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565062] ---[ end trace e17fa7b6cce3a141 ]---
06486d
-
06486d
-
06486d
diff --git a/tests/examples/koops-tainted-g.template b/tests/examples/koops-tainted-g.template
06486d
new file mode 100644
06486d
index 000000000..104d6bf16
06486d
--- /dev/null
06486d
+++ b/tests/examples/koops-tainted-g.template
06486d
@@ -0,0 +1,59 @@
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564718] ------------[ cut here]------------
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564721] WARNING: atarch/x86/xen/mmu.c:475 xen_make_pte+0x32/0x8e()
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564723] Hardware name: OptiPlex 755                 
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564725] Modules linked in: nfs
06486d
+fscache auth_rpcgss nfs_acl tcp_lp ppdev parport_pc lp parport ebtable_nat
06486d
+ebtables ipt_MASQUERADE iptable_nat nf_nat xt_CHECKSUM iptable_mangle tun
06486d
+bridge stp llc lockd drbd lru_cache ip6t_REJECT nf_conntrack_ipv6
06486d
+nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack
06486d
+ip6table_filter ip6_tables snd_hda_codec_analog dcdbas snd_hda_intel
06486d
+snd_hda_codec snd_hwdep snd_seq snd_seq_device 3c59x mii snd_pcm i2c_i801
06486d
+serio_raw iTCO_wdt iTCO_vendor_support snd_timer snd soundcore snd_page_alloc
06486d
+e1000e xen_netback xen_blkback xen_gntdev xen_evtchn sunrpc uinput xenfs
06486d
+pata_acpi usb_storage ata_generic radeon ttm drm_kms_helper drm i2c_algo_bit
06486d
+i2c_core [last unloaded: scsi_wait_scan]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564791] Pid: 912, comm: X Tainted: G            3.1.0-0.rc9.git0.0.fc16.x86_64 #1
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564793] Call Trace:
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564797]  [<ffffffff81057a56>] warn_slowpath_common+0x83/0x9b
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564800]  [<ffffffff81057a88>] warn_slowpath_null+0x1a/0x1c
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564803]  [<ffffffff8100527e>] xen_make_pte+0x32/0x8e
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564807]  [<ffffffff810045f1>] __raw_callee_save_xen_make_pte+0x11/0x1e
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564810]  [<ffffffff81032b0a>] ? pfn_pte+0x26/0x29
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564814]  [<ffffffff81032f75>] __change_page_attr_set_clr+0x130/0x749
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564817]  [<ffffffff8100782a>] ? get_phys_to_machine+0x1f/0x62
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564821]  [<ffffffff81005318>] ? mfn_to_pfn.part.3+0x3e/0x88
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564824]  [<ffffffff8100539d>] ? pte_mfn_to_pfn+0x3b/0x4d
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564827]  [<ffffffff81005c03>] ? __xen_set_pte+0x1b/0x5b
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564831]  [<ffffffff81033543>] __change_page_attr_set_clr+0x6fe/0x749
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564834]  [<ffffffff811063e7>] ? __purge_vmap_area_lazy+0x7c/0x17d
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564838]  [<ffffffff810336da>] change_page_attr_set_clr+0x14c/0x305
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564842]  [<ffffffff81033aa7>] _set_pages_array+0xa3/0xf1
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564845]  [<ffffffff81033b08>] set_pages_array_wc+0x13/0x15
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564852]  [<ffffffffa0065a2d>] ttm_set_pages_caching+0x39/0x5b [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564858]  [<ffffffffa0065b22>] ttm_alloc_new_pages+0xd3/0x15b [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564864]  [<ffffffffa0065e09>] ttm_get_pages+0x137/0x361 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564870]  [<ffffffffa005fdba>] __ttm_tt_get_page+0x54/0xb0 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564876]  [<ffffffffa0060099>] ttm_tt_populate+0x3d/0x7c [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564881]  [<ffffffffa006010a>] ttm_tt_bind+0x32/0x66 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564887]  [<ffffffffa006178a>] ttm_bo_handle_move_mem+0x114/0x2a1 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564893]  [<ffffffffa0061bb6>] ttm_bo_evict+0x29f/0x2e8 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564899]  [<ffffffffa0061d51>] ttm_mem_evict_first+0x152/0x180 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564906]  [<ffffffffa00623c6>] ttm_bo_mem_space+0x29b/0x2ea [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564912]  [<ffffffffa00624cb>] ttm_bo_move_buffer+0xb6/0x10c [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564922]  [<ffffffffa001ec90>] ? drm_mm_insert_helper+0xd3/0xec [drm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564928]  [<ffffffffa00625d7>] ttm_bo_validate+0xb6/0xf4 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564934]  [<ffffffffa0062915>] ttm_bo_init+0x300/0x339 [ttm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564949]  [<ffffffffa009a442>] radeon_bo_create+0x1bf/0x248 [radeon]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564965]  [<ffffffffa009a194>] ? radeon_bo_clear_surface_reg+0x50/0x50 [radeon]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564983]  [<ffffffffa00a9f7a>] radeon_gem_object_create+0x53/0xd8 [radeon]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565001]  [<ffffffffa00aa232>] radeon_gem_create_ioctl+0x4b/0x81 [radeon]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565005]  [<ffffffff8104402b>] ? should_resched+0xe/0x2d
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565013]  [<ffffffffa0015784>] drm_ioctl+0x29e/0x37b [drm]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565031]  [<ffffffffa00aa1e7>] ? radeon_gem_pwrite_ioctl+0x28/0x28 [radeon]
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565034]  [<ffffffff811de8d4>] ? inode_has_perm+0x32/0x34
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565038]  [<ffffffff811de97d>] ? file_has_perm+0xa7/0xc9
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565041]  [<ffffffff81136f33>] do_vfs_ioctl+0x452/0x493
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565045]  [<ffffffff81136fca>] sys_ioctl+0x56/0x7c
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565048]  [<ffffffff811291aa>] ? sys_read+0x61/0x6e
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565059]  [<ffffffff814bc0c2>] system_call_fastpath+0x16/0x1b
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565062] ---[ end trace e17fa7b6cce3a141 ]---
06486d
diff --git a/tests/examples/koops-tainted-insane b/tests/examples/koops-tainted-insane
06486d
deleted file mode 100644
06486d
index 1d3eee631..000000000
06486d
--- a/tests/examples/koops-tainted-insane
06486d
+++ /dev/null
06486d
@@ -1,6 +0,0 @@
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564718] ------------[ cut here]------------
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564721] WARNING: atarch/x86/xen/mmu.c:475 xen_make_pte+0x32/0x8e()
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564791] Pid: 912, comm: X Tainted: ABCDEFGHIJKLMNOPQRSTUVWXYZ 3.1.0-0.rc9.git0.0.fc16.x86_64 #1
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564793] Call Trace:
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.564797]  [<ffffffff81057a56>] warn_slowpath_common+0x83/0x9b
06486d
-Oct 11 10:57:36 jerry-opti755 kernel: [ 4552.565062] ---[ end trace e17fa7b6cce3a141 ]---
06486d
diff --git a/tests/examples/koops-tainted-insane.template b/tests/examples/koops-tainted-insane.template
06486d
new file mode 100644
06486d
index 000000000..6b24f709b
06486d
--- /dev/null
06486d
+++ b/tests/examples/koops-tainted-insane.template
06486d
@@ -0,0 +1,6 @@
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564718] ------------[ cut here]------------
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564721] WARNING: atarch/x86/xen/mmu.c:475 xen_make_pte+0x32/0x8e()
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564791] Pid: 912, comm: X Tainted: ABCDEFGHIJKLMNOPQRSTUVWXYZ 3.1.0-0.rc9.git0.0.fc16.x86_64 #1
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564793] Call Trace:
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.564797]  [<ffffffff81057a56>] warn_slowpath_common+0x83/0x9b
06486d
+Oct 11 10:57:36 :HOSTNAME: kernel: [ 4552.565062] ---[ end trace e17fa7b6cce3a141 ]---
06486d
diff --git a/tests/examples/nmi_oops.test b/tests/examples/nmi_oops.test
06486d
deleted file mode 100644
06486d
index 978281f74..000000000
06486d
--- a/tests/examples/nmi_oops.test
06486d
+++ /dev/null
06486d
@@ -1,32 +0,0 @@
06486d
-Jan 11 22:31:37 kids1 kernel: ------------[ cut here ]------------
06486d
-Jan 11 22:31:38 kids1 kernel: WARNING: at kernel/watchdog.c:245 watchdog_overflow_callback+0x9c/0xd0()
06486d
-Jan 11 22:31:38 kids1 kernel: Hardware name: Bochs
06486d
-Jan 11 22:31:38 kids1 kernel: Watchdog detected hard LOCKUP on cpu 0
06486d
-Jan 11 22:31:38 kids1 kernel: Modules linked in: tcp_lp fuse ebtable_nat xt_CHECKSUM bridge stp llc nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6table_nat nf_nat_ipv6 ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 iptable_nat nf_nat_ipv4 nf_nat iptable_mangle nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack bnep nf_conntrack bluetooth rfkill ebtable_filter ebtables ip6table_filter ip6_tables joydev snd_intel8x0 snd_ac97_codec crc32_pclmul ac97_bus crc32c_intel snd_seq snd_seq_device ghash_clmulni_intel snd_pcm snd_page_alloc snd_timer snd microcode virtio_balloon 8139too i2c_piix4 soundcore 8139cp mii binfmt_misc qxl drm_kms_helper ttm drm i2c_core uinput
06486d
-Jan 12 14:32:19 kids1 kernel: Pid: 0, comm: swapper/0 Not tainted 3.8.9-200.fc18.x86_64 #1
06486d
-Jan 12 14:32:21 kids1 kernel: Call Trace:
06486d
-Jan 12 14:32:21 kids1 kernel:   <NMI>  [<ffffffff810eb800>] ? watchdog_overflow_callback+0x60/0xd0
06486d
-Jan 12 14:32:21 kids1 kernel:   [<ffffffff8105cd86>] warn_slowpath_common+0x66/0x80
06486d
-Jan 12 14:32:21 kids1 kernel:   [<ffffffff8105cdec>] warn_slowpath_fmt+0x4c/0x50
06486d
-Jan 12 16:12:16 kids1 kernel:   [<ffffffff810eb7a0>] ? watchdog_enable+0x1e0/0x1e0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff810eb83c>] watchdog_overflow_callback+0x9c/0xd0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff811261ce>] __perf_event_overflow+0x8e/0x220
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81125059>] ? perf_event_update_userpage+0x19/0x100
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81126da4>] perf_event_overflow+0x14/0x20
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81028b02>] intel_pmu_handle_irq+0x1b2/0x370
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81646e1d>] perf_event_nmi_handler+0x1d/0x20
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff816465e9>] nmi_handle.isra.0+0x59/0x90
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff816466f0>] do_nmi+0xd0/0x310
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81645c41>] end_repeat_nmi+0x1e/0x2e
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
-Jan 12 19:08:41 kids1 kernel:   <<EOE>>  [<ffffffff810944f0>] account_idle_ticks+0x90/0xa0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff810b6ae5>] tick_nohz_idle_exit+0x165/0x1a0
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff8101c06b>] cpu_idle+0x11b/0x140
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81629902>] rest_init+0x72/0x80
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81d04eca>] start_kernel+0x3f2/0x3fe
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81d048e1>] ? repair_env_string+0x5c/0x5c
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81d04120>] ? early_idt_handlers+0x120/0x120
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81d045e0>] x86_64_start_reservations+0x2a/0x2c
06486d
-Jan 12 19:08:41 kids1 kernel:   [<ffffffff81d046d5>] x86_64_start_kernel+0xf3/0x100
06486d
diff --git a/tests/examples/nmi_oops.test.template b/tests/examples/nmi_oops.test.template
06486d
new file mode 100644
06486d
index 000000000..058d55916
06486d
--- /dev/null
06486d
+++ b/tests/examples/nmi_oops.test.template
06486d
@@ -0,0 +1,32 @@
06486d
+Jan 11 22:31:37 :HOSTNAME: kernel: ------------[ cut here ]------------
06486d
+Jan 11 22:31:38 :HOSTNAME: kernel: WARNING: at kernel/watchdog.c:245 watchdog_overflow_callback+0x9c/0xd0()
06486d
+Jan 11 22:31:38 :HOSTNAME: kernel: Hardware name: Bochs
06486d
+Jan 11 22:31:38 :HOSTNAME: kernel: Watchdog detected hard LOCKUP on cpu 0
06486d
+Jan 11 22:31:38 :HOSTNAME: kernel: Modules linked in: tcp_lp fuse ebtable_nat xt_CHECKSUM bridge stp llc nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6table_nat nf_nat_ipv6 ip6table_mangle ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 iptable_nat nf_nat_ipv4 nf_nat iptable_mangle nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack bnep nf_conntrack bluetooth rfkill ebtable_filter ebtables ip6table_filter ip6_tables joydev snd_intel8x0 snd_ac97_codec crc32_pclmul ac97_bus crc32c_intel snd_seq snd_seq_device ghash_clmulni_intel snd_pcm snd_page_alloc snd_timer snd microcode virtio_balloon 8139too i2c_piix4 soundcore 8139cp mii binfmt_misc qxl drm_kms_helper ttm drm i2c_core uinput
06486d
+Jan 12 14:32:19 :HOSTNAME: kernel: Pid: 0, comm: swapper/0 Not tainted 3.8.9-200.fc18.x86_64 #1
06486d
+Jan 12 14:32:21 :HOSTNAME: kernel: Call Trace:
06486d
+Jan 12 14:32:21 :HOSTNAME: kernel:   <NMI>  [<ffffffff810eb800>] ? watchdog_overflow_callback+0x60/0xd0
06486d
+Jan 12 14:32:21 :HOSTNAME: kernel:   [<ffffffff8105cd86>] warn_slowpath_common+0x66/0x80
06486d
+Jan 12 14:32:21 :HOSTNAME: kernel:   [<ffffffff8105cdec>] warn_slowpath_fmt+0x4c/0x50
06486d
+Jan 12 16:12:16 :HOSTNAME: kernel:   [<ffffffff810eb7a0>] ? watchdog_enable+0x1e0/0x1e0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff810eb83c>] watchdog_overflow_callback+0x9c/0xd0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff811261ce>] __perf_event_overflow+0x8e/0x220
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81125059>] ? perf_event_update_userpage+0x19/0x100
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81126da4>] perf_event_overflow+0x14/0x20
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81028b02>] intel_pmu_handle_irq+0x1b2/0x370
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81646e1d>] perf_event_nmi_handler+0x1d/0x20
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff816465e9>] nmi_handle.isra.0+0x59/0x90
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff816466f0>] do_nmi+0xd0/0x310
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81645c41>] end_repeat_nmi+0x1e/0x2e
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81093e44>] ? irqtime_account_process_tick.isra.2+0x94/0x3c0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   <<EOE>>  [<ffffffff810944f0>] account_idle_ticks+0x90/0xa0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff810b6ae5>] tick_nohz_idle_exit+0x165/0x1a0
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff8101c06b>] cpu_idle+0x11b/0x140
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81629902>] rest_init+0x72/0x80
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81d04eca>] start_kernel+0x3f2/0x3fe
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81d048e1>] ? repair_env_string+0x5c/0x5c
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81d04120>] ? early_idt_handlers+0x120/0x120
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81d045e0>] x86_64_start_reservations+0x2a/0x2c
06486d
+Jan 12 19:08:41 :HOSTNAME: kernel:   [<ffffffff81d046d5>] x86_64_start_kernel+0xf3/0x100
06486d
diff --git a/tests/examples/not_oops_foreign_hostname.test b/tests/examples/not_oops_foreign_hostname.test
06486d
new file mode 100644
06486d
index 000000000..b74169988
06486d
--- /dev/null
06486d
+++ b/tests/examples/not_oops_foreign_hostname.test
06486d
@@ -0,0 +1 @@
06486d
+Oct 12 23:25:16 some-totally-nonexistent-hostname-that-no-machine-can-have-right-thats-it kernel: mce: [Hardware Error]: Machine check events logged
06486d
diff --git a/tests/examples/oops_full_hostname.test b/tests/examples/oops_full_hostname.test
06486d
new file mode 100644
06486d
index 000000000..3d8a11649
06486d
--- /dev/null
06486d
+++ b/tests/examples/oops_full_hostname.test
06486d
@@ -0,0 +1 @@
06486d
+ Oct 12 23:25:16 coprbox.den kernel: mce: [Hardware Error]: Machine check events logged
06486d
diff --git a/tests/examples/oops_full_hostname.test.template b/tests/examples/oops_full_hostname.test.template
06486d
new file mode 100644
06486d
index 000000000..3a5c44001
06486d
--- /dev/null
06486d
+++ b/tests/examples/oops_full_hostname.test.template
06486d
@@ -0,0 +1 @@
06486d
+Oct 12 23:25:16 :FULL_HOSTNAME: kernel: mce: [Hardware Error]: Machine check events logged
06486d
diff --git a/tests/examples/prepare-data b/tests/examples/prepare-data
06486d
new file mode 100755
06486d
index 000000000..6645003e3
06486d
--- /dev/null
06486d
+++ b/tests/examples/prepare-data
06486d
@@ -0,0 +1,10 @@
06486d
+#!/bin/bash
06486d
+
06486d
+export scriptdir="$(builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
06486d
+
06486d
+hostname="$(hostname -s)"
06486d
+full_hostname="$(hostname)"
06486d
+
06486d
+for f in "$scriptdir"/*.template; do
06486d
+    cat "$f" | sed -e "s/:HOSTNAME:/${hostname}/" -e "s/:FULL_HOSTNAME:/${full_hostname}/" > "${f%%.template}"
06486d
+done
06486d
-- 
06486d
2.17.2
06486d