How to use linuxHangTaskFrameExtractor method of report Package

Best Syzkaller code snippet using report.linuxHangTaskFrameExtractor

linux.go

Source:linux.go Github

copy

Full Screen

...582 prev = frame583 }584 return "", "did not find any anchor frame"585}586func linuxHangTaskFrameExtractor(frames []string) (string, string) {587 // The problem with task hung reports is that they manifest at random victim stacks,588 // rather at the root cause stack. E.g. if there is something wrong with RCU subsystem,589 // we are getting hangs all over the kernel on all synchronize_* calls.590 // So before resotring to the common logic of skipping some common frames,591 // we look for 2 common buckets: hangs on synchronize_rcu and hangs on rtnl_lock592 // and group these together.593 const synchronizeRCU = "synchronize_rcu"594 anchorFrames := map[string]string{595 "rtnl_lock": "",596 "synchronize_rcu": synchronizeRCU,597 "synchronize_srcu": synchronizeRCU,598 "synchronize_net": synchronizeRCU,599 "synchronize_sched": synchronizeRCU,600 }601 for _, frame := range frames {602 for anchor, replacement := range anchorFrames {603 if strings.HasPrefix(frame, anchor) {604 if replacement != "" {605 frame = replacement606 }607 return frame, ""608 }609 }610 }611 skip := []string{"sched", "_lock", "_slowlock", "down", "rwsem", "completion", "kthread",612 "wait", "synchronize", "context_switch", "__switch_to", "cancel_delayed_work"}613nextFrame:614 for _, frame := range frames {615 for _, ignore := range skip {616 if strings.Contains(frame, ignore) {617 continue nextFrame618 }619 }620 return frame, ""621 }622 return "", "all frames are skipped"623}624var linuxStallAnchorFrames = []*regexp.Regexp{625 // Various generic functions that dispatch work.626 // We also include some of their callers, so that if some names change627 // we don't skip whole stacks and proceed parsing the next one.628 compile("process_one_work"), // workqueue callback629 compile("do_syscall_"), // syscall entry630 compile("do_fast_syscall_"), // syscall entry631 compile("sysenter_dispatch"), // syscall entry632 compile("tracesys_phase2"), // syscall entry633 compile("netif_receive_skb"), // net receive entry point634 compile("do_softirq"),635 compile("call_timer_fn"),636 compile("_run_timers"),637 compile("run_timer_softirq"),638 compile("run_ksoftirqd"),639 compile("smpboot_thread_fn"),640 compile("kthread"),641 compile("start_secondary"),642 compile("cpu_startup_entry"),643 compile("ret_from_fork"),644 // Important discriminated syscalls (file_operations callbacks, etc):645 compile("vfs_write"),646 compile("vfs_read"),647 compile("vfs_iter_read"),648 compile("vfs_iter_write"),649 compile("do_iter_read"),650 compile("do_iter_write"),651 compile("vfs_ioctl"),652 compile("ksys_ioctl"), // vfs_ioctl may be inlined653 compile("compat_ioctl"),654 compile("compat_sys_ioctl"),655 compile("blkdev_driver_ioctl"),656 compile("blkdev_ioctl"),657 compile("^call_read_iter"),658 compile("^call_write_iter"),659 compile("do_iter_readv_writev"),660 compile("^call_mmap"),661 compile("mmap_region"),662 compile("do_mmap"),663 compile("do_dentry_open"),664 compile("vfs_open"),665 // Socket operations:666 compile("^sock_sendmsg"),667 compile("^sock_recvmsg"),668 compile("^sock_release"),669 compile("^__sock_release"),670 compile("__sys_setsockopt"),671 compile("kernel_setsockopt"),672 compile("sock_common_setsockopt"),673 compile("__sys_listen"),674 compile("kernel_listen"),675 compile("sk_common_release"),676 compile("^sock_mmap"),677 compile("__sys_accept"),678 compile("kernel_accept"),679 compile("^sock_do_ioctl"),680 compile("^sock_ioctl"),681 compile("^compat_sock_ioctl"),682 compile("^nfnetlink_rcv_msg"),683 compile("^(compat_)?(SYSC|SyS|__sys|___sys|__do_sys|__se_sys|__x64_sys)_(socketpair|connect|ioctl)"),684 // Page fault entry points:685 compile("__do_fault"),686 compile("handle_mm_fault"),687 compile("do_page_fault"),688 compile("^page_fault$"),689 // exit_to_usermode_loop callbacks:690 compile("__fput"),691 compile("task_work_run"),692 compile("exit_to_usermode"),693}694// nolint: lll695var (696 linuxSymbolizeRe = regexp.MustCompile(`(?:\[\<(?:[0-9a-f]+)\>\])?[ \t]+(?:[0-9]+:)?([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`)697 linuxStackFrameRe = regexp.MustCompile(`^ *(?:\[\<?(?:[0-9a-f]+)\>?\] ?){0,2}[ \t]+(?:[0-9]+:)?([a-zA-Z0-9_.]+)\+0x([0-9a-f]+)/0x([0-9a-f]+)`)698 linuxRipFrame = compile(`N?IP:? (?:(?:[0-9]+:)?(?:{{PC}} +){0,2}{{FUNC}}|[0-9]+:0x[0-9a-f]+|(?:[0-9]+:)?{{PC}} +\[< *\(null\)>\] +\(null\)|[0-9]+: +\(null\))`)699)700var linuxCorruptedTitles = []*regexp.Regexp{701 // Sometimes timestamps get merged into the middle of report description.702 regexp.MustCompile(`\[ *[0-9]+\.[0-9]+\]`),703}704var linuxStackKeywords = []*regexp.Regexp{705 regexp.MustCompile(`Call Trace`),706 regexp.MustCompile(`Allocated:`),707 regexp.MustCompile(`Allocated by task [0-9]+:`),708 regexp.MustCompile(`Freed:`),709 regexp.MustCompile(`Freed by task [0-9]+:`),710 // Match 'backtrace:', but exclude 'stack backtrace:'711 regexp.MustCompile(`[^k] backtrace:`),712}713var linuxStackParams = &stackParams{714 stackStartRes: linuxStackKeywords,715 frameRes: []*regexp.Regexp{716 compile("^ *(?:{{PC}} ){0,2}{{FUNC}}"),717 },718 skipPatterns: []string{719 "__sanitizer",720 "__asan",721 "kasan",722 "__msan",723 "kmsan",724 "check_memory_region",725 "read_word_at_a_time",726 "print_address_description",727 "panic",728 "invalid_op",729 "report_bug",730 "fixup_bug",731 "do_error",732 "invalid_op",733 "_trap",734 "dump_stack",735 "warn_slowpath",736 "warn_alloc",737 "__warn",738 "debug_object",739 "timer_is_static_object",740 "work_is_static_object",741 "lockdep",742 "perf_trace",743 "lock_acquire",744 "lock_release",745 "lock_class",746 "reacquire_held_locks",747 "spin_lock",748 "spin_trylock",749 "spin_unlock",750 "raw_read_lock",751 "raw_read_trylock",752 "raw_write_lock",753 "raw_write_trylock",754 "down",755 "down_read",756 "down_write",757 "down_read_trylock",758 "down_write_trylock",759 "up_read",760 "up_write",761 "mutex_lock",762 "mutex_trylock",763 "mutex_unlock",764 "mutex_remove_waiter",765 "osq_lock",766 "osq_unlock",767 "__wake_up",768 "refcount_add",769 "refcount_sub",770 "refcount_inc",771 "refcount_dec",772 "refcount_set",773 "refcount_read",774 "memcpy",775 "memcmp",776 "memset",777 "memchr",778 "memmove",779 "strcmp",780 "strncmp",781 "strcpy",782 "strlcpy",783 "strncpy",784 "strscpy",785 "strlen",786 "strnstr",787 "strnlen",788 "strchr",789 "copy_to_user",790 "copy_from_user",791 "put_user",792 "get_user",793 "might_fault",794 "might_sleep",795 "list_add",796 "list_del",797 "list_replace",798 "list_move",799 "list_splice",800 "_indirect_thunk_", // retpolines801 "string",802 "pointer",803 "snprintf",804 "scnprintf",805 "kasprintf",806 "kvasprintf",807 "printk",808 "va_format",809 "dev_info",810 "dev_notice",811 "dev_warn",812 "dev_err",813 "dev_alert",814 "dev_crit",815 "dev_emerg",816 "program_check_exception",817 "program_check_common",818 "del_timer",819 "flush_work",820 "__cancel_work_timer",821 "cancel_work_sync",822 "try_to_grab_pending",823 "flush_workqueue",824 "drain_workqueue",825 "destroy_workqueue",826 "finish_wait",827 "kthread_stop",828 "kobject_del",829 "kobject_put",830 "kobject_uevent_env",831 "add_uevent_var",832 "get_device_parent",833 "device_add",834 "device_del",835 "device_unregister",836 "device_destroy",837 "device_release",838 "devres_release_all",839 "hwrng_unregister",840 "i2c_del_adapter",841 "__unregister_client",842 "device_for_each_child",843 "rollback_registered",844 "unregister_netdev",845 "sysfs_remove",846 "device_remove_file",847 "tty_unregister_device",848 "dummy_urb_enqueue",849 "usb_kill_urb",850 "usb_kill_anchored_urbs",851 "usb_control_msg",852 "usb_hcd_submit_urb",853 "usb_submit_urb",854 "^complete$",855 "wait_for_completion",856 "^kfree$",857 "kfree_skb",858 },859 corruptedLines: []*regexp.Regexp{860 // Fault injection stacks are frequently intermixed with crash reports.861 // Note: the actual symbol can have all kinds of weird suffixes like ".isra.7", ".cold" or ".isra.56.cold.74".862 compile(`^( \[\<?(?:0x)?[0-9a-f]+\>?\])? should_fail(slab)?(\.[a-z0-9.]+)?\+0x`),863 },864}865func warningStackFmt(skip ...string) *stackFmt {866 return &stackFmt{867 // In newer kernels WARNING traps and actual stack starts after invalid_op frame,868 // older kernels just print stack.869 parts: []*regexp.Regexp{870 // x86_64 warning stack starts with "RIP:" line,871 // while powerpc64 starts with "--- interrupt:".872 compile("(?:" + linuxRipFrame.String() + "|--- interrupt: [0-9]+ at {{FUNC}})"),873 parseStackTrace,874 },875 parts2: []*regexp.Regexp{876 compile("Call Trace:"),877 parseStackTrace,878 },879 skip: skip,880 }881}882// nolint: lll883var linuxOopses = append([]*oops{884 {885 []byte("BUG:"),886 []oopsFormat{887 {888 title: compile("BUG: KASAN:"),889 report: compile("BUG: KASAN: ([a-z\\-]+) in {{FUNC}}(?:.*\\n)+?.*(Read|Write) of size (?:[0-9]+)"),890 fmt: "KASAN: %[1]v %[3]v in %[4]v",891 stack: &stackFmt{892 parts: []*regexp.Regexp{893 compile("BUG: KASAN: (?:[a-z\\-]+) in {{FUNC}}"),894 compile("Call Trace:"),895 parseStackTrace,896 },897 },898 },899 {900 title: compile("BUG: KASAN:"),901 report: compile("BUG: KASAN: double-free or invalid-free in {{FUNC}}"),902 fmt: "KASAN: invalid-free in %[2]v",903 stack: &stackFmt{904 parts: []*regexp.Regexp{905 compile("BUG: KASAN: double-free or invalid-free in {{FUNC}}"),906 compile("Call Trace:"),907 parseStackTrace,908 },909 skip: []string{"kmem_", "slab_", "kfree", "vunmap", "vfree"},910 },911 },912 {913 title: compile("BUG: KASAN: ([a-z\\-]+) on address(?:.*\\n)+?.*(Read|Write) of size ([0-9]+)"),914 fmt: "KASAN: %[1]v %[2]v",915 },916 {917 title: compile("BUG: KASAN: (.*)"),918 fmt: "KASAN: %[1]v",919 corrupted: true,920 },921 {922 title: compile("BUG: KMSAN: kernel-usb-infoleak"),923 report: compile("BUG: KMSAN: kernel-usb-infoleak in {{FUNC}}"),924 fmt: "KMSAN: kernel-usb-infoleak in %[2]v",925 stack: warningStackFmt("usb_submit_urb", "usb_start_wait_urb", "usb_bulk_msg", "usb_interrupt_msg", "usb_control_msg"),926 },927 {928 title: compile("BUG: KMSAN:"),929 report: compile("BUG: KMSAN: ([a-z\\-]+) in {{FUNC}}"),930 fmt: "KMSAN: %[1]v in %[3]v",931 stack: &stackFmt{932 parts: []*regexp.Regexp{933 compile("Call Trace:"),934 parseStackTrace,935 },936 },937 },938 {939 title: compile("BUG: KCSAN:"),940 report: compile("BUG: KCSAN: (.*)"),941 fmt: "KCSAN: %[1]v",942 noStackTrace: true,943 },944 {945 title: compile("BUG: (?:unable to handle kernel paging request|unable to handle page fault for address|Unable to handle kernel data access)"),946 fmt: "BUG: unable to handle kernel paging request in %[1]v",947 stack: &stackFmt{948 parts: []*regexp.Regexp{949 linuxRipFrame,950 compile("Call Trace:"),951 parseStackTrace,952 },953 },954 },955 {956 title: compile("BUG: (?:unable to handle kernel NULL pointer dereference|kernel NULL pointer dereference|Kernel NULL pointer dereference)"),957 fmt: "BUG: unable to handle kernel NULL pointer dereference in %[1]v",958 stack: &stackFmt{959 parts: []*regexp.Regexp{960 linuxRipFrame,961 compile("Call Trace:"),962 parseStackTrace,963 },964 },965 },966 {967 // Sometimes with such BUG failures, the second part of the header doesn't get printed968 // or gets corrupted, because kernel prints it as two separate printk() calls.969 title: compile("BUG: (?:unable to handle kernel|Unable to handle kernel)"),970 fmt: "BUG: unable to handle kernel",971 corrupted: true,972 },973 {974 title: compile("BUG: spinlock (lockup suspected|already unlocked|recursion|bad magic|wrong owner|wrong CPU)"),975 fmt: "BUG: spinlock %[1]v in %[2]v",976 stack: &stackFmt{977 parts: []*regexp.Regexp{978 compile("Call Trace:"),979 parseStackTrace,980 },981 skip: []string{"spin_"},982 },983 },984 {985 title: compile("BUG: soft lockup"),986 fmt: "BUG: soft lockup in %[1]v",987 stack: &stackFmt{988 parts: []*regexp.Regexp{989 linuxRipFrame,990 compile("Call Trace:"),991 parseStackTrace,992 },993 extractor: linuxStallFrameExtractor,994 },995 },996 {997 title: compile("BUG: .*still has locks held!"),998 report: compile("BUG: .*still has locks held!(?:.*\\n)+?.*{{PC}} +{{FUNC}}"),999 fmt: "BUG: still has locks held in %[1]v",1000 },1001 {1002 title: compile("BUG: lock held when returning to user space"),1003 report: compile("BUG: lock held when returning to user space(?:.*\\n)+?.*leaving the kernel with locks still held(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1004 fmt: "BUG: lock held when returning to user space in %[1]v",1005 noStackTrace: true,1006 },1007 {1008 title: compile("BUG: bad unlock balance detected!"),1009 report: compile("BUG: bad unlock balance detected!(?:.*\\n){0,15}?.*is trying to release lock(?:.*\\n){0,15}?.*{{PC}} +{{FUNC}}"),1010 fmt: "BUG: bad unlock balance in %[1]v",1011 },1012 {1013 title: compile("BUG: held lock freed!"),1014 report: compile("BUG: held lock freed!(?:.*\\n)+?.*{{PC}} +{{FUNC}}"),1015 fmt: "BUG: held lock freed in %[1]v",1016 },1017 {1018 title: compile("BUG: Bad rss-counter state"),1019 fmt: "BUG: Bad rss-counter state",1020 noStackTrace: true,1021 },1022 {1023 title: compile("BUG: non-zero nr_ptes on freeing mm"),1024 fmt: "BUG: non-zero nr_ptes on freeing mm",1025 noStackTrace: true,1026 },1027 {1028 title: compile("BUG: non-zero nr_pmds on freeing mm"),1029 fmt: "BUG: non-zero nr_pmds on freeing mm",1030 noStackTrace: true,1031 },1032 {1033 title: compile("BUG: Dentry .* still in use \\([0-9]+\\) \\[unmount of ([^\\]]+)\\]"),1034 fmt: "BUG: Dentry still in use [unmount of %[1]v]",1035 },1036 {1037 title: compile("BUG: Bad page state"),1038 fmt: "BUG: Bad page state",1039 },1040 {1041 title: compile("BUG: Bad page map"),1042 fmt: "BUG: Bad page map",1043 },1044 {1045 title: compile("BUG: workqueue lockup"),1046 fmt: "BUG: workqueue lockup",1047 noStackTrace: true,1048 },1049 {1050 title: compile("BUG: sleeping function called from invalid context at (.*)"),1051 fmt: "BUG: sleeping function called from invalid context in %[2]v",1052 stack: &stackFmt{1053 parts: []*regexp.Regexp{1054 compile("Call Trace:"),1055 parseStackTrace,1056 },1057 },1058 },1059 {1060 title: compile("BUG: using ([a-z_]+)\\(\\) in preemptible"),1061 fmt: "BUG: using %[1]v() in preemptible code in %[2]v",1062 stack: &stackFmt{1063 parts: []*regexp.Regexp{1064 compile("Call Trace:"),1065 parseStackTrace,1066 },1067 skip: []string{"dump_stack", "preemption", "preempt", "debug_",1068 "processor_id", "this_cpu"},1069 },1070 },1071 {1072 title: compile("BUG: workqueue leaked lock or atomic"),1073 report: compile("BUG: workqueue leaked lock or atomic(?:.*\\n)+?" +1074 ".*last function: ([a-zA-Z0-9_]+)\\n"),1075 fmt: "BUG: workqueue leaked lock or atomic in %[1]v",1076 noStackTrace: true,1077 },1078 {1079 title: compile("BUG: memory leak"),1080 fmt: memoryLeakPrefix + "%[1]v",1081 stack: &stackFmt{1082 parts: []*regexp.Regexp{1083 compile("backtrace:"),1084 parseStackTrace,1085 },1086 skip: []string{"kmemleak", "kmalloc", "kcalloc", "kzalloc",1087 "vmalloc", "mmap", "kmem", "slab", "alloc", "create_object",1088 "idr_get", "list_lru_init", "kasprintf", "kvasprintf",1089 "pcpu_create", "strdup", "strndup", "memdup"},1090 },1091 },1092 {// ACHyb1093 title: compile("BUG: ACHYB ([A-Za-z0-9,/\\:\\_\\>\\-\\(\\)\\s]+)\\n"),1094 report: compile("BUG: ACHYB ([A-Za-z0-9,/\\:\\_\\>\\-\\(\\)\\s]+)\\n"),1095 // report: compile("BUG: acl bug: ([A-Za-z0-9,/\\:\\_\\>\\-\\(\\)\\s]+)\\nCall Trace:\\n[A-Za-z0-9|\\-\\_,\\s\\:]+TRACEEND"),1096 fmt: "BUG: ACHYB %[1]v",1097 noStackTrace: true,1098 // noStackTrace: true,1099 /*stack: &stackFmt{1100 parts: []*regexp.Regexp{1101 compile("Call Trace:\\n[A-Za-z0-9\\-\\_,\\s\\:]+END"),1102 },1103 },*/1104 },1105 {1106 title: compile("BUG: stack guard page was hit at"),1107 fmt: "BUG: stack guard page was hit in %[1]v",1108 stack: &stackFmt{1109 parts: []*regexp.Regexp{1110 linuxRipFrame,1111 },1112 },1113 noStackTrace: true,1114 },1115 {1116 title: compile(`BUG:[[:space:]]*(?:\n|$)`),1117 fmt: "BUG: corrupted",1118 corrupted: true,1119 },1120 },1121 []*regexp.Regexp{1122 // CONFIG_DEBUG_OBJECTS output.1123 compile("ODEBUG:"),1124 // Android prints this sometimes during boot.1125 compile("Boot_DEBUG:"),1126 compile("xlog_status:"),1127 // Android ART debug output.1128 compile("DEBUG:"),1129 // pkg/host output in debug mode.1130 compile("BUG: no syscalls can create resource"),1131 },1132 },1133 {1134 []byte("WARNING:"),1135 []oopsFormat{1136 {1137 title: compile("WARNING: .*lib/debugobjects\\.c.* (?:debug_print|debug_check)"),1138 fmt: "WARNING: ODEBUG bug in %[1]v",1139 // Skip all users of ODEBUG as well.1140 stack: warningStackFmt("debug_", "rcu", "hrtimer_", "timer_",1141 "work_", "percpu_", "kmem_", "slab_", "kfree", "vunmap",1142 "vfree", "__free_", "debug_check", "kobject_"),1143 },1144 {1145 title: compile("WARNING: .*mm/usercopy\\.c.* usercopy_warn"),1146 fmt: "WARNING: bad usercopy in %[1]v",1147 stack: warningStackFmt("usercopy", "__check"),1148 },1149 {1150 title: compile("WARNING: .*lib/kobject\\.c.* kobject_"),1151 fmt: "WARNING: kobject bug in %[1]v",1152 stack: warningStackFmt("kobject_"),1153 },1154 {1155 title: compile("WARNING: .*fs/proc/generic\\.c.* proc_register"),1156 fmt: "WARNING: proc registration bug in %[1]v",1157 stack: warningStackFmt("proc_"),1158 },1159 {1160 title: compile("WARNING: .*lib/refcount\\.c.* refcount_"),1161 fmt: "WARNING: refcount bug in %[1]v",1162 stack: warningStackFmt("refcount", "kobject_"),1163 },1164 {1165 title: compile("WARNING: .*kernel/locking/lockdep\\.c.*lock_"),1166 fmt: "WARNING: locking bug in %[1]v",1167 stack: warningStackFmt("lock_sock", "release_sock"),1168 },1169 {1170 title: compile("WARNING: lock held when returning to user space"),1171 report: compile("WARNING: lock held when returning to user space(?:.*\\n)+?.*leaving the kernel with locks still held(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1172 fmt: "WARNING: lock held when returning to user space in %[1]v",1173 noStackTrace: true,1174 },1175 {1176 title: compile("WARNING: .*mm/.*\\.c.* k?.?malloc"),1177 fmt: "WARNING: kmalloc bug in %[1]v",1178 stack: warningStackFmt("kmalloc", "kcalloc", "kzalloc", "krealloc",1179 "vmalloc", "slab", "kmem"),1180 },1181 {1182 title: compile("WARNING: .* usb_submit_urb"),1183 fmt: "WARNING in %[1]v/usb_submit_urb",1184 stack: warningStackFmt("usb_submit_urb", "usb_start_wait_urb", "usb_bulk_msg", "usb_interrupt_msg", "usb_control_msg"),1185 },1186 {1187 title: compile("WARNING: .* at {{SRC}} {{FUNC}}"),1188 fmt: "WARNING in %[3]v",1189 stack: warningStackFmt(),1190 },1191 {1192 title: compile("WARNING: possible circular locking dependency detected"),1193 report: compile("WARNING: possible circular locking dependency detected(?:.*\\n)+?.*is trying to acquire lock"),1194 fmt: "possible deadlock in %[1]v",1195 stack: &stackFmt{1196 parts: []*regexp.Regexp{1197 compile("at: (?:{{PC}} +)?{{FUNC}}"),1198 compile("at: (?:{{PC}} +)?{{FUNC}}"),1199 parseStackTrace,1200 },1201 // These workqueue functions take locks associated with work items.1202 // All deadlocks observed in these functions are1203 // work-item-subsystem-related.1204 skip: []string{"process_one_work", "flush_workqueue",1205 "drain_workqueue", "destroy_workqueue"},1206 },1207 },1208 {1209 title: compile("WARNING: possible irq lock inversion dependency detected"),1210 report: compile("WARNING: possible irq lock inversion dependency detected(?:.*\\n)+?.*just changed the state of lock(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1211 fmt: "possible deadlock in %[1]v",1212 },1213 {1214 title: compile("WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detecte"),1215 report: compile("WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected(?:.*\\n)+?.*is trying to acquire(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1216 fmt: "possible deadlock in %[1]v",1217 },1218 {1219 title: compile("WARNING: possible recursive locking detected"),1220 report: compile("WARNING: possible recursive locking detected(?:.*\\n)+?.*is trying to acquire lock(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1221 fmt: "possible deadlock in %[1]v",1222 },1223 {1224 title: compile("WARNING: inconsistent lock state"),1225 report: compile("WARNING: inconsistent lock state(?:.*\\n)+?.*takes(?:.*\\n)+?.*at: (?:{{PC}} +)?{{FUNC}}"),1226 fmt: "inconsistent lock state in %[1]v",1227 },1228 {1229 title: compile("WARNING: suspicious RCU usage"),1230 report: compile("WARNING: suspicious RCU usage(?:.*\n)+?.*?{{SRC}}"),1231 fmt: "WARNING: suspicious RCU usage in %[2]v",1232 stack: &stackFmt{1233 parts: []*regexp.Regexp{1234 compile("Call Trace:"),1235 parseStackTrace,1236 },1237 skip: []string{"rcu", "kmem", "slab", "kmalloc",1238 "vmalloc", "kcalloc", "kzalloc"},1239 },1240 },1241 {1242 title: compile("WARNING: kernel stack regs at [0-9a-f]+ in [^ ]* has bad '([^']+)' value"),1243 fmt: "WARNING: kernel stack regs has bad '%[1]v' value",1244 noStackTrace: true,1245 },1246 {1247 title: compile("WARNING: kernel stack frame pointer at [0-9a-f]+ in [^ ]* has bad value"),1248 fmt: "WARNING: kernel stack frame pointer has bad value",1249 noStackTrace: true,1250 },1251 {1252 title: compile("WARNING: bad unlock balance detected!"),1253 report: compile("WARNING: bad unlock balance detected!(?:.*\\n){0,15}?.*is trying to release lock(?:.*\\n){0,15}?.*{{PC}} +{{FUNC}}"),1254 fmt: "WARNING: bad unlock balance in %[1]v",1255 },1256 {1257 title: compile("WARNING: held lock freed!"),1258 report: compile("WARNING: held lock freed!(?:.*\\n)+?.*at:(?: {{PC}})? +{{FUNC}}"),1259 fmt: "WARNING: held lock freed in %[1]v",1260 },1261 {1262 title: compile("WARNING: kernel stack regs .* has bad 'bp' value"),1263 fmt: "WARNING: kernel stack regs has bad value",1264 noStackTrace: true,1265 },1266 {1267 title: compile("WARNING: kernel stack frame pointer .* has bad value"),1268 fmt: "WARNING: kernel stack regs has bad value",1269 noStackTrace: true,1270 },1271 {1272 title: compile(`WARNING:[[:space:]]*(?:\n|$)`),1273 fmt: "WARNING: corrupted",1274 corrupted: true,1275 },1276 },1277 []*regexp.Regexp{1278 compile("WARNING: /etc/ssh/moduli does not exist, using fixed modulus"), // printed by sshd1279 compile("WARNING: workqueue cpumask: online intersect > possible intersect"),1280 },1281 },1282 {1283 []byte("INFO:"),1284 []oopsFormat{1285 {1286 title: compile("INFO: possible circular locking dependency detected"),1287 report: compile("INFO: possible circular locking dependency detected \\](?:.*\\n)+?.*is trying to acquire lock(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),1288 fmt: "possible deadlock in %[1]v",1289 },1290 {1291 title: compile("INFO: possible irq lock inversion dependency detected"),1292 report: compile("INFO: possible irq lock inversion dependency detected \\](?:.*\\n)+?.*just changed the state of lock(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),1293 fmt: "possible deadlock in %[1]v",1294 },1295 {1296 title: compile("INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected"),1297 report: compile("INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected \\](?:.*\\n)+?.*is trying to acquire(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),1298 fmt: "possible deadlock in %[1]v",1299 },1300 {1301 title: compile("INFO: possible recursive locking detected"),1302 report: compile("INFO: possible recursive locking detected \\](?:.*\\n)+?.*is trying to acquire lock(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),1303 fmt: "possible deadlock in %[1]v",1304 },1305 {1306 title: compile("INFO: inconsistent lock state"),1307 report: compile("INFO: inconsistent lock state \\](?:.*\\n)+?.*takes(?:.*\\n)+?.*at: {{PC}} +{{FUNC}}"),1308 fmt: "inconsistent lock state in %[1]v",1309 },1310 {1311 title: compile("INFO: rcu_(?:preempt|sched|bh) (?:self-)?detected(?: expedited)? stall"),1312 fmt: "INFO: rcu detected stall in %[1]v",1313 stack: &stackFmt{1314 parts: []*regexp.Regexp{1315 compile("apic_timer_interrupt"),1316 linuxRipFrame,1317 parseStackTrace,1318 },1319 parts2: []*regexp.Regexp{1320 compile("apic_timer_interrupt"),1321 parseStackTrace,1322 },1323 skip: []string{"apic_timer_interrupt", "rcu"},1324 extractor: linuxStallFrameExtractor,1325 },1326 },1327 {1328 title: compile("INFO: trying to register non-static key"),1329 fmt: "INFO: trying to register non-static key in %[1]v",1330 stack: &stackFmt{1331 parts: []*regexp.Regexp{1332 compile("Call Trace:"),1333 parseStackTrace,1334 },1335 skip: []string{"stack", "lock", "IRQ"},1336 },1337 },1338 {1339 title: compile("INFO: suspicious RCU usage"),1340 report: compile("INFO: suspicious RCU usage(?:.*\n)+?.*?{{SRC}}"),1341 fmt: "INFO: suspicious RCU usage in %[2]v",1342 stack: &stackFmt{1343 parts: []*regexp.Regexp{1344 compile("Call Trace:"),1345 parseStackTrace,1346 },1347 skip: []string{"rcu", "kmem", "slab", "kmalloc",1348 "vmalloc", "kcalloc", "kzalloc"},1349 },1350 },1351 {1352 title: compile("INFO: task .* blocked for more than [0-9]+ seconds"),1353 fmt: "INFO: task hung in %[1]v",1354 stack: &stackFmt{1355 parts: []*regexp.Regexp{1356 compile("Call Trace:"),1357 parseStackTrace,1358 },1359 extractor: linuxHangTaskFrameExtractor,1360 },1361 },1362 {1363 // This gets captured for corrupted old-style KASAN reports.1364 title: compile("INFO: (Freed|Allocated) in (.*)"),1365 fmt: "INFO: %[1]v in %[2]v",1366 corrupted: true,1367 },1368 {1369 title: compile(`INFO:[[:space:]]*(?:\n|$)`),1370 fmt: "INFO: corrupted",1371 corrupted: true,1372 },1373 },...

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2var (3 Config = struct {4 }{}5 RootCmd = &cobra.Command{6 RunE: func(c *cobra.Command, args []string) error {7 return run()8 },9 }10func init() {11 cobra.OnInitialize(initConfig)12 RootCmd.PersistentFlags().StringVar(&Config.ConfigFile, "config", "", "config file (default is $HOME/.dlframework/config.yaml)")13 RootCmd.PersistentFlags().IntVar(&Config.Port, "port", 8080, "port to serve on")14 flags.AddFrameworkFlags(RootCmd.PersistentFlags())15 flags.AddServerFlags(RootCmd.PersistentFlags())16 viper.BindPFlags(RootCmd.PersistentFlags())17}18func initConfig() {19 if Config.ConfigFile != "" {20 viper.SetConfigFile(Config.ConfigFile)21 } else {22 viper.AddConfigPath("$HOME/.dlframework")23 viper.SetConfigName("config")24 }25 viper.SetEnvPrefix("DLFRAMEWORK")26 viper.AutomaticEnv()27 if err := viper.ReadInConfig(); err != nil {28 fmt.Println("Failed to read config file:", err)29 os.Exit(1)30 }31}32func run() error {33 if err := cmd.SetupFramework(); err != nil {34 }35 model, err := local.NewModel(dlframework.ModelManifest{36 }, options.WithModelFramework(dlframework.Framework_KERAS))

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 rep, err := report.NewReporter(nil, nil)4 if err != nil {5 fmt.Println(err)6 }7 fmt.Println(rep)8 frames, err := rep.ParseLinuxHangTaskFrameExtractor([]byte("BUG: unable to handle kernel paging request at ffff8800f6f0e0009Modules linked in: nvidia(OE) nvidia_modeset nvidia_uvm10FS: 00007f4e4b4d2700(0000) GS:ffff8800f7b00000(0000) knlGS:0000000000000000

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 file, err := os.Open("hang_1")4 if err != nil {5 log.Fatal(err)6 }7 defer file.Close()8 report, err := profile.Parse(file)9 if err != nil {10 log.Fatal(err)11 }12 stacks, err := report.LinuxHangTaskFrameExtractor()13 if err != nil {14 log.Fatal(err)15 }16 for _, stack := range stacks {17 fmt.Println(stack)18 }19}20runtime/pprof.writeGoroutineStacks(0x7f7a0f5b5e80, 0xc42000c018, 0x0, 0x0)21runtime/pprof.writeGoroutine(0x7f7a0f5b5e80, 0xc42000c018, 0x2, 0x0, 0x0)22runtime/pprof.(*Profile).WriteTo(0x1b6f1e0, 0x7f7a0f5b5e80, 0xc42000c018, 0x2, 0x0, 0x0)23main.main()24goroutine 2 [force gc (idle)]:25runtime.gopark(0x11d8aa0, 0x1b6f4f0, 0x11d1b2c, 0xf, 0x14, 0x1)26runtime.goparkunlock(0x1b6f4f0, 0x11d1

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 r := report{}4 p := profile.Profile{}5 s := profile.Sample{}6 l := profile.Location{}7 m := profile.Mapping{}8 line := profile.Line{}9 s.Location = append(s.Location, &l)10 l.Line = append(l.Line, &line)11 p.Sample = append(p.Sample, &s)12 p.Mapping = append(p.Mapping, &m)13 f, err := os.Create("stacktrace")14 if err != nil {15 log.Fatal("Cannot create file", err)16 }17 defer f.Close()18 r.linuxHangTaskFrameExtractor(&p, f)19 fmt.Println("Stack trace of the process that is hanging written to a file")20}

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 report := goreport.NewReport("test.txt")4 report.LinuxHangTaskFrameExtractor()5 fmt.Println(report.HangTaskStackTrace)6}

Full Screen

Full Screen

linuxHangTaskFrameExtractor

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println(string(debug.Stack()))4}5runtime/debug.Stack(0x0, 0x0, 0x0)6main.main()

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful