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

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