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

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