Last active
October 29, 2021 09:13
-
-
Save jirib/4c99c9d8b513664241a4b0429bb1bbdc to your computer and use it in GitHub Desktop.
testing kernel oops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on https://programmersought.com/article/30002612436/ and | |
# https://www.thegeekstuff.com/2013/07/write-linux-kernel-module/ | |
cat > oops.c <<EOF | |
#include <linux/kernel.h> | |
#include <linux/module.h> | |
static int __init hello_init(void) | |
{ | |
int *p = 0; | |
*p = 1; | |
return 0; | |
} | |
static void __exit hello_exit(void) | |
{ | |
return; | |
} | |
module_init(hello_init); | |
module_exit(hello_exit); | |
MODULE_LICENSE("GPL"); | |
EOF | |
zypper -v in kernel-default-devel=$(uname -r | sed 's/-default//')" | |
cat > Makefile <<EOF | |
obj-m += oops.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build -M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build -M=$(PWD) clean | |
insmod oops.ko | |
# ooops | |
sed -n '/oops/,$p' /var/crash/2021-10-29-11\:01/dmesg.txt | |
[ 1717.826175] oops: loading out-of-tree module taints kernel. | |
[ 1717.826229] oops: module verification failed: signature and/or required key missing - tainting kernel | |
[ 1717.826805] BUG: kernel NULL pointer dereference, address: 0000000000000000 | |
[ 1717.826815] #PF: supervisor write access in kernel mode | |
[ 1717.826819] #PF: error_code(0x0002) - not-present page | |
[ 1717.826822] PGD 0 P4D 0 | |
[ 1717.826828] Oops: 0002 [#1] SMP NOPTI | |
[ 1717.826834] CPU: 1 PID: 12861 Comm: insmod Kdump: loaded Tainted: G OE N 5.3.18-24.83-default #1 SLE15-SP2 | |
[ 1717.826839] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155821a-rebuilt.opensuse.org 04/01/2014 | |
[ 1717.826848] RIP: 0010:hello_init+0x5/0x1000 [oops] | |
[ 1717.826854] Code: Bad RIP value. | |
[ 1717.826857] RSP: 0018:ffffb05b8040bc98 EFLAGS: 00010246 | |
[ 1717.826861] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 | |
[ 1717.826865] RDX: 00000000000015c9 RSI: 0000000000000cc0 RDI: ffffffffc06f7000 | |
[ 1717.826869] RBP: ffffffffc06f7000 R08: ffff8a35bfcb1060 R09: ffff8a35bffd45c0 | |
[ 1717.826889] R10: 00000000000015c9 R11: ffff8a35bffd4000 R12: ffff8a348f0fa270 | |
[ 1717.826893] R13: 0000000000000001 R14: ffff8a34bf883a20 R15: ffffb05b8040be88 | |
[ 1717.826898] FS: 00007faa1598bb80(0000) GS:ffff8a35bfc80000(0000) knlGS:0000000000000000 | |
[ 1717.826901] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 | |
[ 1717.826904] CR2: ffffffffc06f6fdb CR3: 000000004f382000 CR4: 0000000000340ee0 | |
[ 1717.826909] Call Trace: | |
[ 1717.826916] do_one_initcall+0x46/0x1f4 | |
[ 1717.826927] ? kmem_cache_alloc_trace+0x43/0x260 | |
[ 1717.826930] ? do_init_module+0x22/0x22f | |
[ 1717.826935] do_init_module+0x5b/0x22f | |
[ 1717.826942] load_module+0x1d6a/0x2310 | |
[ 1717.826948] ? ima_post_read_file+0xe2/0x120 | |
[ 1717.826953] ? __do_sys_finit_module+0xe9/0x110 | |
[ 1717.826956] __do_sys_finit_module+0xe9/0x110 | |
[ 1717.826961] do_syscall_64+0x5b/0x1e0 | |
[ 1717.826966] entry_SYSCALL_64_after_hwframe+0x44/0xa9 | |
[ 1717.826976] RIP: 0033:0x7faa1505f759 | |
[ 1717.826980] Code: 00 48 81 c4 80 00 00 00 89 f0 c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 0f d7 2b 00 f7 d8 64 89 01 48 | |
[ 1717.826985] RSP: 002b:00007ffe8698ef38 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 | |
[ 1717.826989] RAX: ffffffffffffffda RBX: 0000561acb656760 RCX: 00007faa1505f759 | |
[ 1717.826991] RDX: 0000000000000000 RSI: 0000561ac9ec5688 RDI: 0000000000000003 | |
[ 1717.826994] RBP: 0000561ac9ec5688 R08: 0000000000000000 R09: 00007ffe8698efc0 | |
[ 1717.826997] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000 | |
[ 1717.826999] R13: 0000561acb6563b0 R14: 0000000000000000 R15: 0000000000000000 | |
[ 1717.827003] Modules linked in: oops(OENN+) af_packet xt_tcpudp ip6t_rpfilter ip6t_REJECT ipt_REJECT xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat nf_conntrack iscsi_ibft iscsi_boot_sysfs nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_mangle iptable_raw iptable_security ebtable_filter ebtables rfkill ip6table_filter ip6_tables iptable_filter ip_tables x_tables bpfilter crc32_pclmul ghash_clmulni_intel aesni_intel snd_hda_codec_generic ledtrig_audio aes_x86_64 crypto_simd iTCO_wdt iTCO_vendor_support snd_hda_intel cryptd glue_helper snd_hda_codec snd_hda_core snd_hwdep snd_pcm pcspkr snd_timer snd soundcore lpc_ich mfd_core i2c_i801 joydev virtio_balloon button ext4 crc16 mbcache jbd2 hid_generic usbhid sr_mod cdrom sd_mod ahci libahci qxl drm_kms_helper virtio_net virtio_rng net_failover failover virtio_scsi syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm crc32c_intel xhci_pci xhci_hcd serio_raw | |
[ 1717.827033] usbcore libata qemu_fw_cfg virtio_pci sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua scsi_mod | |
[ 1717.827058] Supported: No, Unsupported modules are loaded | |
[ 1717.827061] CR2: 0000000000000000 | |
[ 1717.827074] disable async PF for cpu 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment