Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'perf-urgent-2022-08-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
"Misc fixes to kprobes and the faddr2line script, plus a cleanup"

* tag 'perf-urgent-2022-08-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
perf/core: Fix ';;' typo
scripts/faddr2line: Add CONFIG_DEBUG_INFO check
scripts/faddr2line: Fix vmlinux detection on arm64
x86/kprobes: Update kcb status flag after singlestepping
kprobes: Forbid probing on trampoline and BPF code areas

+20 -10
+11 -7
arch/x86/kernel/kprobes/core.c
··· 814 814 static void kprobe_post_process(struct kprobe *cur, struct pt_regs *regs, 815 815 struct kprobe_ctlblk *kcb) 816 816 { 817 - if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) { 818 - kcb->kprobe_status = KPROBE_HIT_SSDONE; 819 - cur->post_handler(cur, regs, 0); 820 - } 821 - 822 817 /* Restore back the original saved kprobes variables and continue. */ 823 - if (kcb->kprobe_status == KPROBE_REENTER) 818 + if (kcb->kprobe_status == KPROBE_REENTER) { 819 + /* This will restore both kcb and current_kprobe */ 824 820 restore_previous_kprobe(kcb); 825 - else 821 + } else { 822 + /* 823 + * Always update the kcb status because 824 + * reset_curent_kprobe() doesn't update kcb. 825 + */ 826 + kcb->kprobe_status = KPROBE_HIT_SSDONE; 827 + if (cur->post_handler) 828 + cur->post_handler(cur, regs, 0); 826 829 reset_current_kprobe(); 830 + } 827 831 } 828 832 NOKPROBE_SYMBOL(kprobe_post_process); 829 833
+1 -1
kernel/events/core.c
··· 4457 4457 4458 4458 *value = local64_read(&event->count); 4459 4459 if (enabled || running) { 4460 - u64 __enabled, __running, __now;; 4460 + u64 __enabled, __running, __now; 4461 4461 4462 4462 calc_timer_values(event, &__now, &__enabled, &__running); 4463 4463 if (enabled)
+2 -1
kernel/kprobes.c
··· 1560 1560 preempt_disable(); 1561 1561 1562 1562 /* Ensure it is not in reserved area nor out of text */ 1563 - if (!kernel_text_address((unsigned long) p->addr) || 1563 + if (!(core_kernel_text((unsigned long) p->addr) || 1564 + is_module_text_address((unsigned long) p->addr)) || 1564 1565 within_kprobe_blacklist((unsigned long) p->addr) || 1565 1566 jump_label_text_reserved(p->addr, p->addr) || 1566 1567 static_call_text_reserved(p->addr, p->addr) ||
+6 -1
scripts/faddr2line
··· 61 61 READELF="${CROSS_COMPILE:-}readelf" 62 62 ADDR2LINE="${CROSS_COMPILE:-}addr2line" 63 63 AWK="awk" 64 + GREP="grep" 64 65 65 66 command -v ${AWK} >/dev/null 2>&1 || die "${AWK} isn't installed" 66 67 command -v ${READELF} >/dev/null 2>&1 || die "${READELF} isn't installed" ··· 113 112 # section offsets. 114 113 local file_type=$(${READELF} --file-header $objfile | 115 114 ${AWK} '$1 == "Type:" { print $2; exit }') 116 - [[ $file_type = "EXEC" ]] && is_vmlinux=1 115 + if [[ $file_type = "EXEC" ]] || [[ $file_type == "DYN" ]]; then 116 + is_vmlinux=1 117 + fi 117 118 118 119 # Go through each of the object's symbols which match the func name. 119 120 # In rare cases there might be duplicates, in which case we print all ··· 271 268 272 269 [[ ! -f $objfile ]] && die "can't find objfile $objfile" 273 270 shift 271 + 272 + ${READELF} --section-headers --wide $objfile | ${GREP} -q '\.debug_info' || die "CONFIG_DEBUG_INFO not enabled" 274 273 275 274 DIR_PREFIX=supercalifragilisticexpialidocious 276 275 find_dir_prefix $objfile