Last active
September 5, 2019 08:01
-
-
Save nrdmn/c2fd8b1a09e3c3c3598d2991f5470a70 to your computer and use it in GitHub Desktop.
atop bug
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
#include <linux/perf_event.h> | |
#include <linux/hw_breakpoint.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <asm/unistd.h> | |
#include <stdio.h> | |
int main() | |
{ | |
if (geteuid() != 0) { | |
fputs("program must be run as root!\n", stderr); | |
return 1; | |
} | |
struct perf_event_attr foo; | |
memset(&foo, 0, sizeof(struct perf_event_attr)); | |
foo.type = PERF_TYPE_HARDWARE; | |
foo.size = sizeof(struct perf_event_attr); | |
foo.inherit = 1; | |
foo.pinned = 1; | |
foo.config = PERF_COUNT_HW_INSTRUCTIONS; | |
syscall(__NR_perf_event_open, &foo, -1, 0, -1, PERF_FLAG_FD_CLOEXEC); | |
return 0; | |
} |
PCE = 1<<8
CR4.PCE == 1
[ 19.149966] general protection fault: 0000 [#1] SMP
[ 19.150866] Modules linked in: ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_addrtype br_netfilter ip6t_rpfilter ipt_REJECT nf_reject_ipv4 ip6t_REJECT nf_reject_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebtable_broute bridge stp llc ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter overlay(T) ppdev kvm_amd kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd joydev pcspkr parport_pc virtio_rng parport sg virtio_balloon i2c_piix4 ip_tables xfs libcrc32c sr_mod cdrom ata_generic virtio_blk virtio_net virtio_console pata_acpi crct10dif_pclmul crct10dif_common crc32c_intel qxl drm_kms_helper floppy syscopyarea sysfillrect sysimgblt fb_sys_fops ttm ata_piix serio_raw drm libata nvme nvme_core virtio_pci virtio_ring virtio drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
[ 19.152195] CPU: 0 PID: 6403 Comm: bstore_kv_final Tainted: G ------------ T 3.10.0-957.27.2.el7.x86_64 #1
[ 19.152195] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
[ 19.152195] task: ffff9c07997c30c0 ti: ffff9c078de90000 task.ti: ffff9c078de90000
[ 19.152195] RIP: 0010:[<ffffffffad06b456>] [<ffffffffad06b456>] native_read_pmc+0x6/0x20
[ 19.152195] RSP: 0000:ffff9c07bfc03e50 EFLAGS: 00010083
[ 19.152195] RAX: 0000000000000001 RBX: ffff9c07bfc0e280 RCX: 0000000000000000
[ 19.152195] RDX: 0000000000000000 RSI: 00000000001300c0 RDI: 0000000000000000
[ 19.152195] RBP: ffff9c07bfc03e50 R08: ffff9c0799bcdc38 R09: 0000000000000092
[ 19.152195] R10: 0000000000000000 R11: 0000000000000000 R12: ffff800000000001
[ 19.152195] R13: ffff9c0799bcd800 R14: ffff9c0799bcd980 R15: 0000000000000010
[ 19.152195] FS: 00007fd9269cb700(0000) GS:ffff9c07bfc00000(0000) knlGS:0000000000000000
[ 19.152195] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 19.152195] CR2: 00000000006dee20 CR3: 0000000517648000 CR4: 00000000003407f0
[ 19.152195] Call Trace:
[ 19.152195] <IRQ>
[ 19.152195] [<ffffffffad003d1b>] x86_perf_event_update+0x4b/0xa0
[ 19.152195] [<ffffffffad003dc8>] x86_pmu_stop+0x58/0xd0
[ 19.152195] [<ffffffffad003e9a>] x86_pmu_del+0x5a/0x160
[ 19.152195] [<ffffffffad1a63a8>] event_sched_out.isra.94+0x78/0x200
[ 19.152195] [<ffffffffad1a656e>] __perf_remove_from_context+0x3e/0x130
[ 19.152195] [<ffffffffad19f9f8>] event_function+0xa8/0x180
[ 19.152195] [<ffffffffad1a171a>] remote_function+0x4a/0x50
[ 19.152195] [<ffffffffad1127a3>] flush_smp_call_function_queue+0x63/0x130
[ 19.152195] [<ffffffffad112ea3>] generic_smp_call_function_single_interrupt+0x13/0x30
[ 19.152195] [<ffffffffad05747d>] smp_call_function_single_interrupt+0x2d/0x40
[ 19.152195] [<ffffffffad7790a2>] call_function_single_interrupt+0x162/0x170
[ 19.152195] <EOI>
[ 19.152195] Code: c0 48 c1 e2 20 89 0e 48 09 c2 48 89 d0 5d c3 66 0f 1f 44 00 00 55 89 f0 89 f9 48 89 e5 0f 30 31 c0 5d c3 66 90 55 89 f9 48 89 e5 <0f> 33 89 c0 48 c1 e2 20 48 09 c2 48 89 d0 5d c3 66 2e 0f 1f 84
[ 19.152195] RIP [<ffffffffad06b456>] native_read_pmc+0x6/0x20
[ 19.152195] RSP <ffff9c07bfc03e50>
[ 19.152195] ---[ end trace e1f85674715c61b4 ]---
[ 19.152195] Kernel panic - not syncing: Fatal exception in interrupt
[ 19.152195] Kernel Offset: 0x2c000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Fixed in 5.2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
# gdb /usr/lib/debug/usr/lib/modules/3.10.0-957.27.2.el7.x86_64/vmlinux