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-tools-fixes-for-v6.17-2025-08-27' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools

Pull perf-tools fixes from Namhyung Kim:
"A number of kernel header sync changes and two build-id fixes"

* tag 'perf-tools-fixes-for-v6.17-2025-08-27' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
perf symbol: Add blocking argument to filename__read_build_id
perf symbol-minimal: Fix ehdr reading in filename__read_build_id
tools headers: Sync uapi/linux/vhost.h with the kernel source
tools headers: Sync uapi/linux/prctl.h with the kernel source
tools headers: Sync uapi/linux/fs.h with the kernel source
tools headers: Sync uapi/linux/fcntl.h with the kernel source
tools headers: Sync syscall tables with the kernel source
tools headers: Sync powerpc headers with the kernel source
tools headers: Sync arm64 headers with the kernel source
tools headers: Sync x86 headers with the kernel source
tools headers: Sync linux/cfi_types.h with the kernel source
tools headers: Sync linux/bits.h with the kernel source
tools headers: Sync KVM headers with the kernel source
perf test: Fix a build error in x86 topdown test

+342 -94
+28
tools/arch/arm64/include/asm/cputype.h
··· 75 75 #define ARM_CPU_PART_CORTEX_A76 0xD0B 76 76 #define ARM_CPU_PART_NEOVERSE_N1 0xD0C 77 77 #define ARM_CPU_PART_CORTEX_A77 0xD0D 78 + #define ARM_CPU_PART_CORTEX_A76AE 0xD0E 78 79 #define ARM_CPU_PART_NEOVERSE_V1 0xD40 79 80 #define ARM_CPU_PART_CORTEX_A78 0xD41 80 81 #define ARM_CPU_PART_CORTEX_A78AE 0xD42 81 82 #define ARM_CPU_PART_CORTEX_X1 0xD44 82 83 #define ARM_CPU_PART_CORTEX_A510 0xD46 84 + #define ARM_CPU_PART_CORTEX_X1C 0xD4C 83 85 #define ARM_CPU_PART_CORTEX_A520 0xD80 84 86 #define ARM_CPU_PART_CORTEX_A710 0xD47 85 87 #define ARM_CPU_PART_CORTEX_A715 0xD4D ··· 121 119 #define QCOM_CPU_PART_KRYO 0x200 122 120 #define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800 123 121 #define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801 122 + #define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802 124 123 #define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803 125 124 #define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804 126 125 #define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805 126 + #define QCOM_CPU_PART_ORYON_X1 0x001 127 127 128 128 #define NVIDIA_CPU_PART_DENVER 0x003 129 129 #define NVIDIA_CPU_PART_CARMEL 0x004 ··· 133 129 #define FUJITSU_CPU_PART_A64FX 0x001 134 130 135 131 #define HISI_CPU_PART_TSV110 0xD01 132 + #define HISI_CPU_PART_HIP09 0xD02 136 133 #define HISI_CPU_PART_HIP12 0xD06 137 134 138 135 #define APPLE_CPU_PART_M1_ICESTORM 0x022 ··· 164 159 #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) 165 160 #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1) 166 161 #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) 162 + #define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE) 167 163 #define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1) 168 164 #define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78) 169 165 #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE) 170 166 #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) 171 167 #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) 168 + #define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C) 172 169 #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) 173 170 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) 174 171 #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) ··· 203 196 #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) 204 197 #define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD) 205 198 #define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER) 199 + #define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD) 206 200 #define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER) 207 201 #define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD) 208 202 #define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER) 203 + #define MIDR_QCOM_ORYON_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_ORYON_X1) 204 + 205 + /* 206 + * NOTES: 207 + * - Qualcomm Kryo 5XX Prime / Gold ID themselves as MIDR_CORTEX_A77 208 + * - Qualcomm Kryo 5XX Silver IDs itself as MIDR_QCOM_KRYO_4XX_SILVER 209 + * - Qualcomm Kryo 6XX Prime IDs itself as MIDR_CORTEX_X1 210 + * - Qualcomm Kryo 6XX Gold IDs itself as ARM_CPU_PART_CORTEX_A78 211 + * - Qualcomm Kryo 6XX Silver IDs itself as MIDR_CORTEX_A55 212 + */ 213 + 209 214 #define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER) 210 215 #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL) 211 216 #define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX) 212 217 #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110) 218 + #define MIDR_HISI_HIP09 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP09) 213 219 #define MIDR_HISI_HIP12 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP12) 214 220 #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM) 215 221 #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM) ··· 310 290 { 311 291 return read_cpuid(MIDR_EL1); 312 292 } 293 + 294 + struct target_impl_cpu { 295 + u64 midr; 296 + u64 revidr; 297 + u64 aidr; 298 + }; 299 + 300 + bool cpu_errata_set_target_impl(u64 num, void *impl_cpus); 313 301 314 302 static inline u64 __attribute_const__ read_cpuid_mpidr(void) 315 303 {
-13
tools/arch/powerpc/include/uapi/asm/kvm.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 2 /* 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License, version 2, as 5 - * published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - * 12 - * You should have received a copy of the GNU General Public License 13 - * along with this program; if not, write to the Free Software 14 - * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 - * 16 3 * Copyright IBM Corp. 2007 17 4 * 18 5 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+9 -1
tools/arch/x86/include/asm/cpufeatures.h
··· 218 218 #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1) /* "flexpriority" Intel FlexPriority */ 219 219 #define X86_FEATURE_EPT ( 8*32+ 2) /* "ept" Intel Extended Page Table */ 220 220 #define X86_FEATURE_VPID ( 8*32+ 3) /* "vpid" Intel Virtual Processor ID */ 221 + #define X86_FEATURE_COHERENCY_SFW_NO ( 8*32+ 4) /* SNP cache coherency software work around not needed */ 221 222 222 223 #define X86_FEATURE_VMMCALL ( 8*32+15) /* "vmmcall" Prefer VMMCALL to VMCALL */ 223 224 #define X86_FEATURE_XENPV ( 8*32+16) /* Xen paravirtual guest */ ··· 457 456 #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */ 458 457 #define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */ 459 458 #define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */ 459 + #define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */ 460 460 #define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */ 461 + 461 462 #define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */ 462 463 #define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */ 464 + 465 + #define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */ 463 466 464 467 #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */ 465 468 #define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */ ··· 492 487 #define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */ 493 488 #define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */ 494 489 #define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */ 490 + #define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */ 491 + #define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */ 492 + #define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */ 495 493 496 494 /* 497 495 * BUG word(s) ··· 550 542 #define X86_BUG_OLD_MICROCODE X86_BUG( 1*32+ 6) /* "old_microcode" CPU has old microcode, it is surely vulnerable to something */ 551 543 #define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */ 552 544 #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */ 553 - 545 + #define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */ 554 546 #endif /* _ASM_X86_CPUFEATURES_H */
+7
tools/arch/x86/include/asm/msr-index.h
··· 419 419 #define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI (1UL << 12) 420 420 #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14 421 421 #define DEBUGCTLMSR_FREEZE_IN_SMM (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT) 422 + #define DEBUGCTLMSR_RTM_DEBUG BIT(15) 422 423 423 424 #define MSR_PEBS_FRONTEND 0x000003f7 424 425 ··· 734 733 #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 735 734 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 736 735 736 + /* AMD Hardware Feedback Support MSRs */ 737 + #define MSR_AMD_WORKLOAD_CLASS_CONFIG 0xc0000500 738 + #define MSR_AMD_WORKLOAD_CLASS_ID 0xc0000501 739 + #define MSR_AMD_WORKLOAD_HRST 0xc0000502 740 + 737 741 /* AMD Last Branch Record MSRs */ 738 742 #define MSR_AMD64_LBR_SELECT 0xc000010e 739 743 ··· 837 831 #define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT) 838 832 #define MSR_K7_HWCR_IRPERF_EN_BIT 30 839 833 #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT) 834 + #define MSR_K7_HWCR_CPUID_USER_DIS_BIT 35 840 835 #define MSR_K7_FID_VID_CTL 0xc0010041 841 836 #define MSR_K7_FID_VID_STATUS 0xc0010042 842 837 #define MSR_K7_HWCR_CPB_DIS_BIT 25
+7 -1
tools/arch/x86/include/uapi/asm/kvm.h
··· 965 965 struct kvm_tdx_capabilities { 966 966 __u64 supported_attrs; 967 967 __u64 supported_xfam; 968 - __u64 reserved[254]; 968 + 969 + __u64 kernel_tdvmcallinfo_1_r11; 970 + __u64 user_tdvmcallinfo_1_r11; 971 + __u64 kernel_tdvmcallinfo_1_r12; 972 + __u64 user_tdvmcallinfo_1_r12; 973 + 974 + __u64 reserved[250]; 969 975 970 976 /* Configurable CPUID bits for userspace */ 971 977 struct kvm_cpuid2 cpuid;
+6 -23
tools/include/linux/bits.h
··· 2 2 #ifndef __LINUX_BITS_H 3 3 #define __LINUX_BITS_H 4 4 5 - #include <linux/const.h> 6 5 #include <vdso/bits.h> 7 6 #include <uapi/linux/bits.h> 8 - #include <asm/bitsperlong.h> 9 7 10 8 #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) 11 9 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) ··· 48 50 (type_max(t) << (l) & \ 49 51 type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h))))) 50 52 53 + #define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l) 54 + #define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l) 55 + 51 56 #define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l) 52 57 #define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l) 53 58 #define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l) 54 59 #define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l) 60 + #define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l) 55 61 56 62 /* 57 63 * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The ··· 81 79 * BUILD_BUG_ON_ZERO is not available in h files included from asm files, 82 80 * disable the input check if that is the case. 83 81 */ 84 - #define GENMASK_INPUT_CHECK(h, l) 0 82 + #define GENMASK(h, l) __GENMASK(h, l) 83 + #define GENMASK_ULL(h, l) __GENMASK_ULL(h, l) 85 84 86 85 #endif /* !defined(__ASSEMBLY__) */ 87 - 88 - #define GENMASK(h, l) \ 89 - (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) 90 - #define GENMASK_ULL(h, l) \ 91 - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) 92 - 93 - #if !defined(__ASSEMBLY__) 94 - /* 95 - * Missing asm support 96 - * 97 - * __GENMASK_U128() depends on _BIT128() which would not work 98 - * in the asm code, as it shifts an 'unsigned __int128' data 99 - * type instead of direct representation of 128 bit constants 100 - * such as long and unsigned long. The fundamental problem is 101 - * that a 128 bit constant will get silently truncated by the 102 - * gcc compiler. 103 - */ 104 - #define GENMASK_U128(h, l) \ 105 - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l)) 106 - #endif 107 86 108 87 #endif /* __LINUX_BITS_H */
+23
tools/include/linux/cfi_types.h
··· 41 41 SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) 42 42 #endif 43 43 44 + #else /* __ASSEMBLY__ */ 45 + 46 + #ifdef CONFIG_CFI_CLANG 47 + #define DEFINE_CFI_TYPE(name, func) \ 48 + /* \ 49 + * Force a reference to the function so the compiler generates \ 50 + * __kcfi_typeid_<func>. \ 51 + */ \ 52 + __ADDRESSABLE(func); \ 53 + /* u32 name __ro_after_init = __kcfi_typeid_<func> */ \ 54 + extern u32 name; \ 55 + asm ( \ 56 + " .pushsection .data..ro_after_init,\"aw\",\%progbits \n" \ 57 + " .type " #name ",\%object \n" \ 58 + " .globl " #name " \n" \ 59 + " .p2align 2, 0x0 \n" \ 60 + #name ": \n" \ 61 + " .4byte __kcfi_typeid_" #func " \n" \ 62 + " .size " #name ", 4 \n" \ 63 + " .popsection \n" \ 64 + ); 65 + #endif 66 + 44 67 #endif /* __ASSEMBLY__ */ 45 68 #endif /* _LINUX_CFI_TYPES_H */
+7 -1
tools/include/uapi/asm-generic/unistd.h
··· 852 852 #define __NR_open_tree_attr 467 853 853 __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr) 854 854 855 + /* fs/inode.c */ 856 + #define __NR_file_getattr 468 857 + __SYSCALL(__NR_file_getattr, sys_file_getattr) 858 + #define __NR_file_setattr 469 859 + __SYSCALL(__NR_file_setattr, sys_file_setattr) 860 + 855 861 #undef __NR_syscalls 856 - #define __NR_syscalls 468 862 + #define __NR_syscalls 470 857 863 858 864 /* 859 865 * 32 bit systems traditionally used different
+27
tools/include/uapi/linux/kvm.h
··· 178 178 #define KVM_EXIT_NOTIFY 37 179 179 #define KVM_EXIT_LOONGARCH_IOCSR 38 180 180 #define KVM_EXIT_MEMORY_FAULT 39 181 + #define KVM_EXIT_TDX 40 181 182 182 183 /* For KVM_EXIT_INTERNAL_ERROR */ 183 184 /* Emulate instruction failed. */ ··· 448 447 __u64 gpa; 449 448 __u64 size; 450 449 } memory_fault; 450 + /* KVM_EXIT_TDX */ 451 + struct { 452 + __u64 flags; 453 + __u64 nr; 454 + union { 455 + struct { 456 + __u64 ret; 457 + __u64 data[5]; 458 + } unknown; 459 + struct { 460 + __u64 ret; 461 + __u64 gpa; 462 + __u64 size; 463 + } get_quote; 464 + struct { 465 + __u64 ret; 466 + __u64 leaf; 467 + __u64 r11, r12, r13, r14; 468 + } get_tdvmcall_info; 469 + struct { 470 + __u64 ret; 471 + __u64 vector; 472 + } setup_event_notify; 473 + }; 474 + } tdx; 451 475 /* Fix the size of the union. */ 452 476 char padding[256]; 453 477 }; ··· 961 935 #define KVM_CAP_ARM_EL2 240 962 936 #define KVM_CAP_ARM_EL2_E2H0 241 963 937 #define KVM_CAP_RISCV_MP_STATE_RESET 242 938 + #define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243 964 939 965 940 struct kvm_irq_routing_irqchip { 966 941 __u32 irqchip;
+2
tools/perf/arch/arm/entry/syscalls/syscall.tbl
··· 482 482 465 common listxattrat sys_listxattrat 483 483 466 common removexattrat sys_removexattrat 484 484 467 common open_tree_attr sys_open_tree_attr 485 + 468 common file_getattr sys_file_getattr 486 + 469 common file_setattr sys_file_setattr
+2
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
··· 382 382 465 n64 listxattrat sys_listxattrat 383 383 466 n64 removexattrat sys_removexattrat 384 384 467 n64 open_tree_attr sys_open_tree_attr 385 + 468 n64 file_getattr sys_file_getattr 386 + 469 n64 file_setattr sys_file_setattr
+2
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
··· 558 558 465 common listxattrat sys_listxattrat 559 559 466 common removexattrat sys_removexattrat 560 560 467 common open_tree_attr sys_open_tree_attr 561 + 468 common file_getattr sys_file_getattr 562 + 469 common file_setattr sys_file_setattr
+2
tools/perf/arch/s390/entry/syscalls/syscall.tbl
··· 470 470 465 common listxattrat sys_listxattrat sys_listxattrat 471 471 466 common removexattrat sys_removexattrat sys_removexattrat 472 472 467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr 473 + 468 common file_getattr sys_file_getattr sys_file_getattr 474 + 469 common file_setattr sys_file_setattr sys_file_setattr
+2
tools/perf/arch/sh/entry/syscalls/syscall.tbl
··· 471 471 465 common listxattrat sys_listxattrat 472 472 466 common removexattrat sys_removexattrat 473 473 467 common open_tree_attr sys_open_tree_attr 474 + 468 common file_getattr sys_file_getattr 475 + 469 common file_setattr sys_file_setattr
+2
tools/perf/arch/sparc/entry/syscalls/syscall.tbl
··· 513 513 465 common listxattrat sys_listxattrat 514 514 466 common removexattrat sys_removexattrat 515 515 467 common open_tree_attr sys_open_tree_attr 516 + 468 common file_getattr sys_file_getattr 517 + 469 common file_setattr sys_file_setattr
+2
tools/perf/arch/x86/entry/syscalls/syscall_32.tbl
··· 473 473 465 i386 listxattrat sys_listxattrat 474 474 466 i386 removexattrat sys_removexattrat 475 475 467 i386 open_tree_attr sys_open_tree_attr 476 + 468 i386 file_getattr sys_file_getattr 477 + 469 i386 file_setattr sys_file_setattr
+2
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
··· 391 391 465 common listxattrat sys_listxattrat 392 392 466 common removexattrat sys_removexattrat 393 393 467 common open_tree_attr sys_open_tree_attr 394 + 468 common file_getattr sys_file_getattr 395 + 469 common file_setattr sys_file_setattr 394 396 395 397 # 396 398 # Due to a historical design error, certain syscalls are numbered differently
+1
tools/perf/arch/x86/tests/topdown.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 #include "arch-tests.h" 3 3 #include "../util/topdown.h" 4 + #include "debug.h" 4 5 #include "evlist.h" 5 6 #include "parse-events.h" 6 7 #include "pmu.h"
+2
tools/perf/arch/xtensa/entry/syscalls/syscall.tbl
··· 438 438 465 common listxattrat sys_listxattrat 439 439 466 common removexattrat sys_removexattrat 440 440 467 common open_tree_attr sys_open_tree_attr 441 + 468 common file_getattr sys_file_getattr 442 + 469 common file_setattr sys_file_setattr
+1 -1
tools/perf/bench/inject-buildid.c
··· 85 85 if (typeflag == FTW_D || typeflag == FTW_SL) 86 86 return 0; 87 87 88 - if (filename__read_build_id(fpath, &bid) < 0) 88 + if (filename__read_build_id(fpath, &bid, /*block=*/true) < 0) 89 89 return 0; 90 90 91 91 dso->name = realpath(fpath, NULL);
+4 -4
tools/perf/builtin-buildid-cache.c
··· 180 180 struct nscookie nsc; 181 181 182 182 nsinfo__mountns_enter(nsi, &nsc); 183 - err = filename__read_build_id(filename, &bid); 183 + err = filename__read_build_id(filename, &bid, /*block=*/true); 184 184 nsinfo__mountns_exit(&nsc); 185 185 if (err < 0) { 186 186 pr_debug("Couldn't read a build-id in %s\n", filename); ··· 204 204 int err; 205 205 206 206 nsinfo__mountns_enter(nsi, &nsc); 207 - err = filename__read_build_id(filename, &bid); 207 + err = filename__read_build_id(filename, &bid, /*block=*/true); 208 208 nsinfo__mountns_exit(&nsc); 209 209 if (err < 0) { 210 210 pr_debug("Couldn't read a build-id in %s\n", filename); ··· 280 280 if (!dso__build_id_filename(dso, filename, sizeof(filename), false)) 281 281 return true; 282 282 283 - if (filename__read_build_id(filename, &bid) == -1) { 283 + if (filename__read_build_id(filename, &bid, /*block=*/true) == -1) { 284 284 if (errno == ENOENT) 285 285 return false; 286 286 ··· 309 309 int err; 310 310 311 311 nsinfo__mountns_enter(nsi, &nsc); 312 - err = filename__read_build_id(filename, &bid); 312 + err = filename__read_build_id(filename, &bid, /*block=*/true); 313 313 nsinfo__mountns_exit(&nsc); 314 314 if (err < 0) { 315 315 pr_debug("Couldn't read a build-id in %s\n", filename);
+2 -2
tools/perf/builtin-inject.c
··· 680 680 681 681 mutex_lock(dso__lock(dso)); 682 682 nsinfo__mountns_enter(dso__nsinfo(dso), &nsc); 683 - if (filename__read_build_id(dso__long_name(dso), &bid) > 0) 683 + if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0) 684 684 dso__set_build_id(dso, &bid); 685 685 else if (dso__nsinfo(dso)) { 686 686 char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso)); 687 687 688 - if (new_name && filename__read_build_id(new_name, &bid) > 0) 688 + if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0) 689 689 dso__set_build_id(dso, &bid); 690 690 free(new_name); 691 691 }
+1 -1
tools/perf/tests/sdt.c
··· 31 31 struct build_id bid = { .size = 0, }; 32 32 int err; 33 33 34 - err = filename__read_build_id(filename, &bid); 34 + err = filename__read_build_id(filename, &bid, /*block=*/true); 35 35 if (err < 0) { 36 36 pr_debug("Failed to read build id of %s\n", filename); 37 37 return err;
+18
tools/perf/trace/beauty/include/uapi/linux/fcntl.h
··· 90 90 #define DN_ATTRIB 0x00000020 /* File changed attibutes */ 91 91 #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ 92 92 93 + /* Reserved kernel ranges [-100], [-10000, -40000]. */ 93 94 #define AT_FDCWD -100 /* Special value for dirfd used to 94 95 indicate openat should use the 95 96 current working directory. */ 96 97 98 + /* 99 + * The concept of process and threads in userland and the kernel is a confusing 100 + * one - within the kernel every thread is a 'task' with its own individual PID, 101 + * however from userland's point of view threads are grouped by a single PID, 102 + * which is that of the 'thread group leader', typically the first thread 103 + * spawned. 104 + * 105 + * To cut the Gideon knot, for internal kernel usage, we refer to 106 + * PIDFD_SELF_THREAD to refer to the current thread (or task from a kernel 107 + * perspective), and PIDFD_SELF_THREAD_GROUP to refer to the current thread 108 + * group leader... 109 + */ 110 + #define PIDFD_SELF_THREAD -10000 /* Current thread. */ 111 + #define PIDFD_SELF_THREAD_GROUP -10001 /* Current thread group leader. */ 112 + 113 + #define FD_PIDFS_ROOT -10002 /* Root of the pidfs filesystem */ 114 + #define FD_INVALID -10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */ 97 115 98 116 /* Generic flags for the *at(2) family of syscalls. */ 99 117
+88
tools/perf/trace/beauty/include/uapi/linux/fs.h
··· 60 60 #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ 61 61 #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ 62 62 63 + /* 64 + * The root inode of procfs is guaranteed to always have the same inode number. 65 + * For programs that make heavy use of procfs, verifying that the root is a 66 + * real procfs root and using openat2(RESOLVE_{NO_{XDEV,MAGICLINKS},BENEATH}) 67 + * will allow you to make sure you are never tricked into operating on the 68 + * wrong procfs file. 69 + */ 70 + enum procfs_ino { 71 + PROCFS_ROOT_INO = 1, 72 + }; 73 + 63 74 struct file_clone_range { 64 75 __s64 src_fd; 65 76 __u64 src_offset; ··· 100 89 struct fs_sysfs_path { 101 90 __u8 len; 102 91 __u8 name[128]; 92 + }; 93 + 94 + /* Protection info capability flags */ 95 + #define LBMD_PI_CAP_INTEGRITY (1 << 0) 96 + #define LBMD_PI_CAP_REFTAG (1 << 1) 97 + 98 + /* Checksum types for Protection Information */ 99 + #define LBMD_PI_CSUM_NONE 0 100 + #define LBMD_PI_CSUM_IP 1 101 + #define LBMD_PI_CSUM_CRC16_T10DIF 2 102 + #define LBMD_PI_CSUM_CRC64_NVME 4 103 + 104 + /* sizeof first published struct */ 105 + #define LBMD_SIZE_VER0 16 106 + 107 + /* 108 + * Logical block metadata capability descriptor 109 + * If the device does not support metadata, all the fields will be zero. 110 + * Applications must check lbmd_flags to determine whether metadata is 111 + * supported or not. 112 + */ 113 + struct logical_block_metadata_cap { 114 + /* Bitmask of logical block metadata capability flags */ 115 + __u32 lbmd_flags; 116 + /* 117 + * The amount of data described by each unit of logical block 118 + * metadata 119 + */ 120 + __u16 lbmd_interval; 121 + /* 122 + * Size in bytes of the logical block metadata associated with each 123 + * interval 124 + */ 125 + __u8 lbmd_size; 126 + /* 127 + * Size in bytes of the opaque block tag associated with each 128 + * interval 129 + */ 130 + __u8 lbmd_opaque_size; 131 + /* 132 + * Offset in bytes of the opaque block tag within the logical block 133 + * metadata 134 + */ 135 + __u8 lbmd_opaque_offset; 136 + /* Size in bytes of the T10 PI tuple associated with each interval */ 137 + __u8 lbmd_pi_size; 138 + /* Offset in bytes of T10 PI tuple within the logical block metadata */ 139 + __u8 lbmd_pi_offset; 140 + /* T10 PI guard tag type */ 141 + __u8 lbmd_guard_tag_type; 142 + /* Size in bytes of the T10 PI application tag */ 143 + __u8 lbmd_app_tag_size; 144 + /* Size in bytes of the T10 PI reference tag */ 145 + __u8 lbmd_ref_tag_size; 146 + /* Size in bytes of the T10 PI storage tag */ 147 + __u8 lbmd_storage_tag_size; 148 + __u8 pad; 103 149 }; 104 150 105 151 /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ ··· 215 147 __u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ 216 148 unsigned char fsx_pad[8]; 217 149 }; 150 + 151 + /* 152 + * Variable size structure for file_[sg]et_attr(). 153 + * 154 + * Note. This is alternative to the structure 'struct file_kattr'/'struct fsxattr'. 155 + * As this structure is passed to/from userspace with its size, this can 156 + * be versioned based on the size. 157 + */ 158 + struct file_attr { 159 + __u64 fa_xflags; /* xflags field value (get/set) */ 160 + __u32 fa_extsize; /* extsize field value (get/set)*/ 161 + __u32 fa_nextents; /* nextents field value (get) */ 162 + __u32 fa_projid; /* project identifier (get/set) */ 163 + __u32 fa_cowextsize; /* CoW extsize field value (get/set) */ 164 + }; 165 + 166 + #define FILE_ATTR_SIZE_VER0 24 167 + #define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0 218 168 219 169 /* 220 170 * Flags for the fsx_xflags field ··· 333 247 * also /sys/kernel/debug/ for filesystems with debugfs exports 334 248 */ 335 249 #define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path) 250 + /* Get logical block metadata capability details */ 251 + #define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap) 336 252 337 253 /* 338 254 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
+8 -1
tools/perf/trace/beauty/include/uapi/linux/prctl.h
··· 244 244 # define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) 245 245 /* Unused; kept only for source compatibility */ 246 246 # define PR_MTE_TCF_SHIFT 1 247 + /* MTE tag check store only */ 248 + # define PR_MTE_STORE_ONLY (1UL << 19) 247 249 /* RISC-V pointer masking tag length */ 248 250 # define PR_PMLEN_SHIFT 24 249 251 # define PR_PMLEN_MASK (0x7fUL << PR_PMLEN_SHIFT) ··· 257 255 /* Dispatch syscalls to a userspace handler */ 258 256 #define PR_SET_SYSCALL_USER_DISPATCH 59 259 257 # define PR_SYS_DISPATCH_OFF 0 260 - # define PR_SYS_DISPATCH_ON 1 258 + /* Enable dispatch except for the specified range */ 259 + # define PR_SYS_DISPATCH_EXCLUSIVE_ON 1 260 + /* Enable dispatch for the specified range */ 261 + # define PR_SYS_DISPATCH_INCLUSIVE_ON 2 262 + /* Legacy name for backwards compatibility */ 263 + # define PR_SYS_DISPATCH_ON PR_SYS_DISPATCH_EXCLUSIVE_ON 261 264 /* The control values for the user space selector when dispatch is enabled */ 262 265 # define SYSCALL_DISPATCH_FILTER_ALLOW 0 263 266 # define SYSCALL_DISPATCH_FILTER_BLOCK 1
+35
tools/perf/trace/beauty/include/uapi/linux/vhost.h
··· 235 235 */ 236 236 #define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \ 237 237 struct vhost_vring_state) 238 + 239 + /* Extended features manipulation */ 240 + #define VHOST_GET_FEATURES_ARRAY _IOR(VHOST_VIRTIO, 0x83, \ 241 + struct vhost_features_array) 242 + #define VHOST_SET_FEATURES_ARRAY _IOW(VHOST_VIRTIO, 0x83, \ 243 + struct vhost_features_array) 244 + 245 + /* fork_owner values for vhost */ 246 + #define VHOST_FORK_OWNER_KTHREAD 0 247 + #define VHOST_FORK_OWNER_TASK 1 248 + 249 + /** 250 + * VHOST_SET_FORK_FROM_OWNER - Set the fork_owner flag for the vhost device, 251 + * This ioctl must called before VHOST_SET_OWNER. 252 + * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y 253 + * 254 + * @param fork_owner: An 8-bit value that determines the vhost thread mode 255 + * 256 + * When fork_owner is set to VHOST_FORK_OWNER_TASK(default value): 257 + * - Vhost will create vhost worker as tasks forked from the owner, 258 + * inheriting all of the owner's attributes. 259 + * 260 + * When fork_owner is set to VHOST_FORK_OWNER_KTHREAD: 261 + * - Vhost will create vhost workers as kernel threads. 262 + */ 263 + #define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8) 264 + 265 + /** 266 + * VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device. 267 + * Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y 268 + * 269 + * @return: An 8-bit value indicating the current thread mode. 270 + */ 271 + #define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8) 272 + 238 273 #endif
+2 -2
tools/perf/util/build-id.c
··· 115 115 struct build_id bid = { .size = 0, }; 116 116 int ret; 117 117 118 - ret = filename__read_build_id(pathname, &bid); 118 + ret = filename__read_build_id(pathname, &bid, /*block=*/true); 119 119 if (ret < 0) 120 120 return ret; 121 121 ··· 841 841 int ret; 842 842 843 843 nsinfo__mountns_enter(nsi, &nsc); 844 - ret = filename__read_build_id(filename, bid); 844 + ret = filename__read_build_id(filename, bid, /*block=*/true); 845 845 nsinfo__mountns_exit(&nsc); 846 846 847 847 return ret;
+6 -2
tools/perf/util/debuginfo.c
··· 110 110 if (!dso) 111 111 goto out; 112 112 113 - /* Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO */ 114 - if (is_regular_file(path) && filename__read_build_id(path, &bid) > 0) 113 + /* 114 + * Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block 115 + * incase the path isn't for a regular file. 116 + */ 117 + assert(!dso__has_build_id(dso)); 118 + if (filename__read_build_id(path, &bid, /*block=*/false) > 0) 115 119 dso__set_build_id(dso, &bid); 116 120 117 121 for (type = distro_dwarf_types;
+2 -2
tools/perf/util/dsos.c
··· 81 81 return 0; 82 82 } 83 83 nsinfo__mountns_enter(dso__nsinfo(dso), &nsc); 84 - if (filename__read_build_id(dso__long_name(dso), &bid) > 0) { 84 + if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0) { 85 85 dso__set_build_id(dso, &bid); 86 86 args->have_build_id = true; 87 87 } else if (errno == ENOENT && dso__nsinfo(dso)) { 88 88 char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso)); 89 89 90 - if (new_name && filename__read_build_id(new_name, &bid) > 0) { 90 + if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0) { 91 91 dso__set_build_id(dso, &bid); 92 92 args->have_build_id = true; 93 93 }
+5 -4
tools/perf/util/symbol-elf.c
··· 902 902 903 903 #else // HAVE_LIBBFD_BUILDID_SUPPORT 904 904 905 - static int read_build_id(const char *filename, struct build_id *bid) 905 + static int read_build_id(const char *filename, struct build_id *bid, bool block) 906 906 { 907 907 size_t size = sizeof(bid->data); 908 908 int fd, err = -1; ··· 911 911 if (size < BUILD_ID_SIZE) 912 912 goto out; 913 913 914 - fd = open(filename, O_RDONLY); 914 + fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK)); 915 915 if (fd < 0) 916 916 goto out; 917 917 ··· 934 934 935 935 #endif // HAVE_LIBBFD_BUILDID_SUPPORT 936 936 937 - int filename__read_build_id(const char *filename, struct build_id *bid) 937 + int filename__read_build_id(const char *filename, struct build_id *bid, bool block) 938 938 { 939 939 struct kmod_path m = { .name = NULL, }; 940 940 char path[PATH_MAX]; ··· 958 958 } 959 959 close(fd); 960 960 filename = path; 961 + block = true; 961 962 } 962 963 963 - err = read_build_id(filename, bid); 964 + err = read_build_id(filename, bid, block); 964 965 965 966 if (m.comp) 966 967 unlink(filename);
+29 -30
tools/perf/util/symbol-minimal.c
··· 4 4 5 5 #include <errno.h> 6 6 #include <unistd.h> 7 - #include <stdio.h> 8 7 #include <fcntl.h> 9 8 #include <string.h> 10 9 #include <stdlib.h> ··· 85 86 /* 86 87 * Just try PT_NOTE header otherwise fails 87 88 */ 88 - int filename__read_build_id(const char *filename, struct build_id *bid) 89 + int filename__read_build_id(const char *filename, struct build_id *bid, bool block) 89 90 { 90 - FILE *fp; 91 - int ret = -1; 91 + int fd, ret = -1; 92 92 bool need_swap = false, elf32; 93 - u8 e_ident[EI_NIDENT]; 94 - int i; 95 93 union { 96 94 struct { 97 95 Elf32_Ehdr ehdr32; ··· 99 103 Elf64_Phdr *phdr64; 100 104 }; 101 105 } hdrs; 102 - void *phdr; 103 - size_t phdr_size; 104 - void *buf = NULL; 105 - size_t buf_size = 0; 106 + void *phdr, *buf = NULL; 107 + ssize_t phdr_size, ehdr_size, buf_size = 0; 106 108 107 - fp = fopen(filename, "r"); 108 - if (fp == NULL) 109 + fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK)); 110 + if (fd < 0) 109 111 return -1; 110 112 111 - if (fread(e_ident, sizeof(e_ident), 1, fp) != 1) 113 + if (read(fd, hdrs.ehdr32.e_ident, EI_NIDENT) != EI_NIDENT) 112 114 goto out; 113 115 114 - if (memcmp(e_ident, ELFMAG, SELFMAG) || 115 - e_ident[EI_VERSION] != EV_CURRENT) 116 + if (memcmp(hdrs.ehdr32.e_ident, ELFMAG, SELFMAG) || 117 + hdrs.ehdr32.e_ident[EI_VERSION] != EV_CURRENT) 116 118 goto out; 117 119 118 - need_swap = check_need_swap(e_ident[EI_DATA]); 119 - elf32 = e_ident[EI_CLASS] == ELFCLASS32; 120 + need_swap = check_need_swap(hdrs.ehdr32.e_ident[EI_DATA]); 121 + elf32 = hdrs.ehdr32.e_ident[EI_CLASS] == ELFCLASS32; 122 + ehdr_size = (elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64)) - EI_NIDENT; 120 123 121 - if (fread(elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64, 122 - elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64), 123 - 1, fp) != 1) 124 + if (read(fd, 125 + (elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64) + EI_NIDENT, 126 + ehdr_size) != ehdr_size) 124 127 goto out; 125 128 126 129 if (need_swap) { ··· 133 138 hdrs.ehdr64.e_phnum = bswap_16(hdrs.ehdr64.e_phnum); 134 139 } 135 140 } 136 - phdr_size = elf32 ? hdrs.ehdr32.e_phentsize * hdrs.ehdr32.e_phnum 137 - : hdrs.ehdr64.e_phentsize * hdrs.ehdr64.e_phnum; 141 + if ((elf32 && hdrs.ehdr32.e_phentsize != sizeof(Elf32_Phdr)) || 142 + (!elf32 && hdrs.ehdr64.e_phentsize != sizeof(Elf64_Phdr))) 143 + goto out; 144 + 145 + phdr_size = elf32 ? sizeof(Elf32_Phdr) * hdrs.ehdr32.e_phnum 146 + : sizeof(Elf64_Phdr) * hdrs.ehdr64.e_phnum; 138 147 phdr = malloc(phdr_size); 139 148 if (phdr == NULL) 140 149 goto out; 141 150 142 - fseek(fp, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET); 143 - if (fread(phdr, phdr_size, 1, fp) != 1) 151 + lseek(fd, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET); 152 + if (read(fd, phdr, phdr_size) != phdr_size) 144 153 goto out_free; 145 154 146 155 if (elf32) ··· 152 153 else 153 154 hdrs.phdr64 = phdr; 154 155 155 - for (i = 0; i < elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum; i++) { 156 - size_t p_filesz; 156 + for (int i = 0; i < (elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum); i++) { 157 + ssize_t p_filesz; 157 158 158 159 if (need_swap) { 159 160 if (elf32) { ··· 179 180 goto out_free; 180 181 buf = tmp; 181 182 } 182 - fseek(fp, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET); 183 - if (fread(buf, p_filesz, 1, fp) != 1) 183 + lseek(fd, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET); 184 + if (read(fd, buf, p_filesz) != p_filesz) 184 185 goto out_free; 185 186 186 187 ret = read_build_id(buf, p_filesz, bid, need_swap); ··· 193 194 free(buf); 194 195 free(phdr); 195 196 out: 196 - fclose(fp); 197 + close(fd); 197 198 return ret; 198 199 } 199 200 ··· 323 324 if (ret >= 0) 324 325 RC_CHK_ACCESS(dso)->is_64_bit = ret; 325 326 326 - if (filename__read_build_id(ss->name, &bid) > 0) 327 + if (filename__read_build_id(ss->name, &bid, /*block=*/true) > 0) 327 328 dso__set_build_id(dso, &bid); 328 329 return 0; 329 330 }
+4 -4
tools/perf/util/symbol.c
··· 1869 1869 1870 1870 /* 1871 1871 * Read the build id if possible. This is required for 1872 - * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work 1872 + * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work. Don't block in case path 1873 + * isn't for a regular file. 1873 1874 */ 1874 - if (!dso__has_build_id(dso) && 1875 - is_regular_file(dso__long_name(dso))) { 1875 + if (!dso__has_build_id(dso)) { 1876 1876 struct build_id bid = { .size = 0, }; 1877 1877 1878 1878 __symbol__join_symfs(name, PATH_MAX, dso__long_name(dso)); 1879 - if (filename__read_build_id(name, &bid) > 0) 1879 + if (filename__read_build_id(name, &bid, /*block=*/false) > 0) 1880 1880 dso__set_build_id(dso, &bid); 1881 1881 } 1882 1882
+1 -1
tools/perf/util/symbol.h
··· 140 140 141 141 enum dso_type dso__type_fd(int fd); 142 142 143 - int filename__read_build_id(const char *filename, struct build_id *id); 143 + int filename__read_build_id(const char *filename, struct build_id *id, bool block); 144 144 int sysfs__read_build_id(const char *filename, struct build_id *bid); 145 145 int modules__parse(const char *filename, void *arg, 146 146 int (*process_module)(void *arg, const char *name,
+1 -1
tools/perf/util/synthetic-events.c
··· 401 401 nsi = nsinfo__new(event->pid); 402 402 nsinfo__mountns_enter(nsi, &nc); 403 403 404 - rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; 404 + rc = filename__read_build_id(event->filename, &bid, /*block=*/false) > 0 ? 0 : -1; 405 405 406 406 nsinfo__mountns_exit(&nc); 407 407 nsinfo__put(nsi);
+2
tools/scripts/syscall.tbl
··· 408 408 465 common listxattrat sys_listxattrat 409 409 466 common removexattrat sys_removexattrat 410 410 467 common open_tree_attr sys_open_tree_attr 411 + 468 common file_getattr sys_file_getattr 412 + 469 common file_setattr sys_file_setattr