2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

perf-tools fixes for v6.17-rc4

A list of kernel header sync changes and two build-id fixes.
 
 Signed-off-by: Namhyung Kim <namhyung@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSo2x5BnqMqsoHtzsmMstVUGiXMgwUCaK+XpwAKCRCMstVUGiXM
 g/V4AP4keI7dTEyxgGYGDHZcqi0X5Tn/0FSOjtri2d2FNvbhfAEAigK1ogp6hLIU
 gwEK8fbBRBKAFllr9o3AP6YzMR5dPAI=
 =I/2T
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2025-08-27 19:18:51 -07:00
commit 07d9df8008
36 changed files with 342 additions and 94 deletions

View File

@ -75,11 +75,13 @@
#define ARM_CPU_PART_CORTEX_A76 0xD0B #define ARM_CPU_PART_CORTEX_A76 0xD0B
#define ARM_CPU_PART_NEOVERSE_N1 0xD0C #define ARM_CPU_PART_NEOVERSE_N1 0xD0C
#define ARM_CPU_PART_CORTEX_A77 0xD0D #define ARM_CPU_PART_CORTEX_A77 0xD0D
#define ARM_CPU_PART_CORTEX_A76AE 0xD0E
#define ARM_CPU_PART_NEOVERSE_V1 0xD40 #define ARM_CPU_PART_NEOVERSE_V1 0xD40
#define ARM_CPU_PART_CORTEX_A78 0xD41 #define ARM_CPU_PART_CORTEX_A78 0xD41
#define ARM_CPU_PART_CORTEX_A78AE 0xD42 #define ARM_CPU_PART_CORTEX_A78AE 0xD42
#define ARM_CPU_PART_CORTEX_X1 0xD44 #define ARM_CPU_PART_CORTEX_X1 0xD44
#define ARM_CPU_PART_CORTEX_A510 0xD46 #define ARM_CPU_PART_CORTEX_A510 0xD46
#define ARM_CPU_PART_CORTEX_X1C 0xD4C
#define ARM_CPU_PART_CORTEX_A520 0xD80 #define ARM_CPU_PART_CORTEX_A520 0xD80
#define ARM_CPU_PART_CORTEX_A710 0xD47 #define ARM_CPU_PART_CORTEX_A710 0xD47
#define ARM_CPU_PART_CORTEX_A715 0xD4D #define ARM_CPU_PART_CORTEX_A715 0xD4D
@ -119,9 +121,11 @@
#define QCOM_CPU_PART_KRYO 0x200 #define QCOM_CPU_PART_KRYO 0x200
#define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800 #define QCOM_CPU_PART_KRYO_2XX_GOLD 0x800
#define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801 #define QCOM_CPU_PART_KRYO_2XX_SILVER 0x801
#define QCOM_CPU_PART_KRYO_3XX_GOLD 0x802
#define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803 #define QCOM_CPU_PART_KRYO_3XX_SILVER 0x803
#define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804 #define QCOM_CPU_PART_KRYO_4XX_GOLD 0x804
#define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805 #define QCOM_CPU_PART_KRYO_4XX_SILVER 0x805
#define QCOM_CPU_PART_ORYON_X1 0x001
#define NVIDIA_CPU_PART_DENVER 0x003 #define NVIDIA_CPU_PART_DENVER 0x003
#define NVIDIA_CPU_PART_CARMEL 0x004 #define NVIDIA_CPU_PART_CARMEL 0x004
@ -129,6 +133,7 @@
#define FUJITSU_CPU_PART_A64FX 0x001 #define FUJITSU_CPU_PART_A64FX 0x001
#define HISI_CPU_PART_TSV110 0xD01 #define HISI_CPU_PART_TSV110 0xD01
#define HISI_CPU_PART_HIP09 0xD02
#define HISI_CPU_PART_HIP12 0xD06 #define HISI_CPU_PART_HIP12 0xD06
#define APPLE_CPU_PART_M1_ICESTORM 0x022 #define APPLE_CPU_PART_M1_ICESTORM 0x022
@ -159,11 +164,13 @@
#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) #define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76)
#define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1) #define MIDR_NEOVERSE_N1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_N1)
#define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77) #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A77)
#define MIDR_CORTEX_A76AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76AE)
#define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1) #define MIDR_NEOVERSE_V1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V1)
#define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78) #define MIDR_CORTEX_A78 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78)
#define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE) #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
#define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1) #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
#define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510) #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
#define MIDR_CORTEX_X1C MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1C)
#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520) #define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
#define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710) #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
#define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715) #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
@ -196,13 +203,26 @@
#define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO) #define MIDR_QCOM_KRYO MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO)
#define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD) #define MIDR_QCOM_KRYO_2XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_GOLD)
#define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER) #define MIDR_QCOM_KRYO_2XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_2XX_SILVER)
#define MIDR_QCOM_KRYO_3XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_GOLD)
#define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER) #define MIDR_QCOM_KRYO_3XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_3XX_SILVER)
#define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD) #define MIDR_QCOM_KRYO_4XX_GOLD MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_GOLD)
#define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER) #define MIDR_QCOM_KRYO_4XX_SILVER MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_KRYO_4XX_SILVER)
#define MIDR_QCOM_ORYON_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_QCOM, QCOM_CPU_PART_ORYON_X1)
/*
* NOTES:
* - Qualcomm Kryo 5XX Prime / Gold ID themselves as MIDR_CORTEX_A77
* - Qualcomm Kryo 5XX Silver IDs itself as MIDR_QCOM_KRYO_4XX_SILVER
* - Qualcomm Kryo 6XX Prime IDs itself as MIDR_CORTEX_X1
* - Qualcomm Kryo 6XX Gold IDs itself as ARM_CPU_PART_CORTEX_A78
* - Qualcomm Kryo 6XX Silver IDs itself as MIDR_CORTEX_A55
*/
#define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER) #define MIDR_NVIDIA_DENVER MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_DENVER)
#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL) #define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)
#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX) #define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)
#define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110) #define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110)
#define MIDR_HISI_HIP09 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP09)
#define MIDR_HISI_HIP12 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP12) #define MIDR_HISI_HIP12 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP12)
#define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM) #define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)
#define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM) #define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)
@ -291,6 +311,14 @@ static inline u32 __attribute_const__ read_cpuid_id(void)
return read_cpuid(MIDR_EL1); return read_cpuid(MIDR_EL1);
} }
struct target_impl_cpu {
u64 midr;
u64 revidr;
u64 aidr;
};
bool cpu_errata_set_target_impl(u64 num, void *impl_cpus);
static inline u64 __attribute_const__ read_cpuid_mpidr(void) static inline u64 __attribute_const__ read_cpuid_mpidr(void)
{ {
return read_cpuid(MPIDR_EL1); return read_cpuid(MPIDR_EL1);

View File

@ -1,18 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Copyright IBM Corp. 2007 * Copyright IBM Corp. 2007
* *
* Authors: Hollis Blanchard <hollisb@us.ibm.com> * Authors: Hollis Blanchard <hollisb@us.ibm.com>

View File

@ -218,6 +218,7 @@
#define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1) /* "flexpriority" Intel FlexPriority */ #define X86_FEATURE_FLEXPRIORITY ( 8*32+ 1) /* "flexpriority" Intel FlexPriority */
#define X86_FEATURE_EPT ( 8*32+ 2) /* "ept" Intel Extended Page Table */ #define X86_FEATURE_EPT ( 8*32+ 2) /* "ept" Intel Extended Page Table */
#define X86_FEATURE_VPID ( 8*32+ 3) /* "vpid" Intel Virtual Processor ID */ #define X86_FEATURE_VPID ( 8*32+ 3) /* "vpid" Intel Virtual Processor ID */
#define X86_FEATURE_COHERENCY_SFW_NO ( 8*32+ 4) /* SNP cache coherency software work around not needed */
#define X86_FEATURE_VMMCALL ( 8*32+15) /* "vmmcall" Prefer VMMCALL to VMCALL */ #define X86_FEATURE_VMMCALL ( 8*32+15) /* "vmmcall" Prefer VMMCALL to VMCALL */
#define X86_FEATURE_XENPV ( 8*32+16) /* Xen paravirtual guest */ #define X86_FEATURE_XENPV ( 8*32+16) /* Xen paravirtual guest */
@ -456,10 +457,14 @@
#define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */ #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */
#define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */ #define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */
#define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */ #define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */
#define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */
#define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */ #define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */
#define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */ #define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */
#define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */ #define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */
#define X86_FEATURE_GP_ON_USER_CPUID (20*32+17) /* User CPUID faulting */
#define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */ #define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */
#define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */ #define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */
#define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */ #define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
@ -487,6 +492,9 @@
#define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */ #define X86_FEATURE_PREFER_YMM (21*32+ 8) /* Avoid ZMM registers due to downclocking */
#define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */ #define X86_FEATURE_APX (21*32+ 9) /* Advanced Performance Extensions */
#define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */ #define X86_FEATURE_INDIRECT_THUNK_ITS (21*32+10) /* Use thunk for indirect branches in lower half of cacheline */
#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
#define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */
/* /*
* BUG word(s) * BUG word(s)
@ -542,5 +550,5 @@
#define X86_BUG_OLD_MICROCODE X86_BUG( 1*32+ 6) /* "old_microcode" CPU has old microcode, it is surely vulnerable to something */ #define X86_BUG_OLD_MICROCODE X86_BUG( 1*32+ 6) /* "old_microcode" CPU has old microcode, it is surely vulnerable to something */
#define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */ #define X86_BUG_ITS X86_BUG( 1*32+ 7) /* "its" CPU is affected by Indirect Target Selection */
#define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */ #define X86_BUG_ITS_NATIVE_ONLY X86_BUG( 1*32+ 8) /* "its_native_only" CPU is affected by ITS, VMX is not affected */
#define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */
#endif /* _ASM_X86_CPUFEATURES_H */ #endif /* _ASM_X86_CPUFEATURES_H */

View File

@ -419,6 +419,7 @@
#define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI (1UL << 12) #define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI (1UL << 12)
#define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14 #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14
#define DEBUGCTLMSR_FREEZE_IN_SMM (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT) #define DEBUGCTLMSR_FREEZE_IN_SMM (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
#define DEBUGCTLMSR_RTM_DEBUG BIT(15)
#define MSR_PEBS_FRONTEND 0x000003f7 #define MSR_PEBS_FRONTEND 0x000003f7
@ -733,6 +734,11 @@
#define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301 #define MSR_AMD64_PERF_CNTR_GLOBAL_CTL 0xc0000301
#define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302 #define MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR 0xc0000302
/* AMD Hardware Feedback Support MSRs */
#define MSR_AMD_WORKLOAD_CLASS_CONFIG 0xc0000500
#define MSR_AMD_WORKLOAD_CLASS_ID 0xc0000501
#define MSR_AMD_WORKLOAD_HRST 0xc0000502
/* AMD Last Branch Record MSRs */ /* AMD Last Branch Record MSRs */
#define MSR_AMD64_LBR_SELECT 0xc000010e #define MSR_AMD64_LBR_SELECT 0xc000010e
@ -831,6 +837,7 @@
#define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT) #define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
#define MSR_K7_HWCR_IRPERF_EN_BIT 30 #define MSR_K7_HWCR_IRPERF_EN_BIT 30
#define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT) #define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
#define MSR_K7_HWCR_CPUID_USER_DIS_BIT 35
#define MSR_K7_FID_VID_CTL 0xc0010041 #define MSR_K7_FID_VID_CTL 0xc0010041
#define MSR_K7_FID_VID_STATUS 0xc0010042 #define MSR_K7_FID_VID_STATUS 0xc0010042
#define MSR_K7_HWCR_CPB_DIS_BIT 25 #define MSR_K7_HWCR_CPB_DIS_BIT 25

View File

@ -965,7 +965,13 @@ struct kvm_tdx_cmd {
struct kvm_tdx_capabilities { struct kvm_tdx_capabilities {
__u64 supported_attrs; __u64 supported_attrs;
__u64 supported_xfam; __u64 supported_xfam;
__u64 reserved[254];
__u64 kernel_tdvmcallinfo_1_r11;
__u64 user_tdvmcallinfo_1_r11;
__u64 kernel_tdvmcallinfo_1_r12;
__u64 user_tdvmcallinfo_1_r12;
__u64 reserved[250];
/* Configurable CPUID bits for userspace */ /* Configurable CPUID bits for userspace */
struct kvm_cpuid2 cpuid; struct kvm_cpuid2 cpuid;

View File

@ -2,10 +2,8 @@
#ifndef __LINUX_BITS_H #ifndef __LINUX_BITS_H
#define __LINUX_BITS_H #define __LINUX_BITS_H
#include <linux/const.h>
#include <vdso/bits.h> #include <vdso/bits.h>
#include <uapi/linux/bits.h> #include <uapi/linux/bits.h>
#include <asm/bitsperlong.h>
#define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG)) #define BIT_MASK(nr) (UL(1) << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
@ -50,10 +48,14 @@
(type_max(t) << (l) & \ (type_max(t) << (l) & \
type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h))))) type_max(t) >> (BITS_PER_TYPE(t) - 1 - (h)))))
#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l)
#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l)
#define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l) #define GENMASK_U8(h, l) GENMASK_TYPE(u8, h, l)
#define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l) #define GENMASK_U16(h, l) GENMASK_TYPE(u16, h, l)
#define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l) #define GENMASK_U32(h, l) GENMASK_TYPE(u32, h, l)
#define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l) #define GENMASK_U64(h, l) GENMASK_TYPE(u64, h, l)
#define GENMASK_U128(h, l) GENMASK_TYPE(u128, h, l)
/* /*
* Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The * Fixed-type variants of BIT(), with additional checks like GENMASK_TYPE(). The
@ -79,28 +81,9 @@
* BUILD_BUG_ON_ZERO is not available in h files included from asm files, * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
* disable the input check if that is the case. * disable the input check if that is the case.
*/ */
#define GENMASK_INPUT_CHECK(h, l) 0 #define GENMASK(h, l) __GENMASK(h, l)
#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
#endif /* !defined(__ASSEMBLY__) */ #endif /* !defined(__ASSEMBLY__) */
#define GENMASK(h, l) \
(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
#define GENMASK_ULL(h, l) \
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
#if !defined(__ASSEMBLY__)
/*
* Missing asm support
*
* __GENMASK_U128() depends on _BIT128() which would not work
* in the asm code, as it shifts an 'unsigned __int128' data
* type instead of direct representation of 128 bit constants
* such as long and unsigned long. The fundamental problem is
* that a 128 bit constant will get silently truncated by the
* gcc compiler.
*/
#define GENMASK_U128(h, l) \
(GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
#endif
#endif /* __LINUX_BITS_H */ #endif /* __LINUX_BITS_H */

View File

@ -41,5 +41,28 @@
SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)
#endif #endif
#else /* __ASSEMBLY__ */
#ifdef CONFIG_CFI_CLANG
#define DEFINE_CFI_TYPE(name, func) \
/* \
* Force a reference to the function so the compiler generates \
* __kcfi_typeid_<func>. \
*/ \
__ADDRESSABLE(func); \
/* u32 name __ro_after_init = __kcfi_typeid_<func> */ \
extern u32 name; \
asm ( \
" .pushsection .data..ro_after_init,\"aw\",\%progbits \n" \
" .type " #name ",\%object \n" \
" .globl " #name " \n" \
" .p2align 2, 0x0 \n" \
#name ": \n" \
" .4byte __kcfi_typeid_" #func " \n" \
" .size " #name ", 4 \n" \
" .popsection \n" \
);
#endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* _LINUX_CFI_TYPES_H */ #endif /* _LINUX_CFI_TYPES_H */

View File

@ -852,8 +852,14 @@ __SYSCALL(__NR_removexattrat, sys_removexattrat)
#define __NR_open_tree_attr 467 #define __NR_open_tree_attr 467
__SYSCALL(__NR_open_tree_attr, sys_open_tree_attr) __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
/* fs/inode.c */
#define __NR_file_getattr 468
__SYSCALL(__NR_file_getattr, sys_file_getattr)
#define __NR_file_setattr 469
__SYSCALL(__NR_file_setattr, sys_file_setattr)
#undef __NR_syscalls #undef __NR_syscalls
#define __NR_syscalls 468 #define __NR_syscalls 470
/* /*
* 32 bit systems traditionally used different * 32 bit systems traditionally used different

View File

@ -178,6 +178,7 @@ struct kvm_xen_exit {
#define KVM_EXIT_NOTIFY 37 #define KVM_EXIT_NOTIFY 37
#define KVM_EXIT_LOONGARCH_IOCSR 38 #define KVM_EXIT_LOONGARCH_IOCSR 38
#define KVM_EXIT_MEMORY_FAULT 39 #define KVM_EXIT_MEMORY_FAULT 39
#define KVM_EXIT_TDX 40
/* For KVM_EXIT_INTERNAL_ERROR */ /* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */ /* Emulate instruction failed. */
@ -447,6 +448,31 @@ struct kvm_run {
__u64 gpa; __u64 gpa;
__u64 size; __u64 size;
} memory_fault; } memory_fault;
/* KVM_EXIT_TDX */
struct {
__u64 flags;
__u64 nr;
union {
struct {
__u64 ret;
__u64 data[5];
} unknown;
struct {
__u64 ret;
__u64 gpa;
__u64 size;
} get_quote;
struct {
__u64 ret;
__u64 leaf;
__u64 r11, r12, r13, r14;
} get_tdvmcall_info;
struct {
__u64 ret;
__u64 vector;
} setup_event_notify;
};
} tdx;
/* Fix the size of the union. */ /* Fix the size of the union. */
char padding[256]; char padding[256];
}; };
@ -935,6 +961,7 @@ struct kvm_enable_cap {
#define KVM_CAP_ARM_EL2 240 #define KVM_CAP_ARM_EL2 240
#define KVM_CAP_ARM_EL2_E2H0 241 #define KVM_CAP_ARM_EL2_E2H0 241
#define KVM_CAP_RISCV_MP_STATE_RESET 242 #define KVM_CAP_RISCV_MP_STATE_RESET 242
#define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
struct kvm_irq_routing_irqchip { struct kvm_irq_routing_irqchip {
__u32 irqchip; __u32 irqchip;

View File

@ -482,3 +482,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr

View File

@ -382,3 +382,5 @@
465 n64 listxattrat sys_listxattrat 465 n64 listxattrat sys_listxattrat
466 n64 removexattrat sys_removexattrat 466 n64 removexattrat sys_removexattrat
467 n64 open_tree_attr sys_open_tree_attr 467 n64 open_tree_attr sys_open_tree_attr
468 n64 file_getattr sys_file_getattr
469 n64 file_setattr sys_file_setattr

View File

@ -558,3 +558,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr

View File

@ -470,3 +470,5 @@
465 common listxattrat sys_listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr sys_file_setattr

View File

@ -471,3 +471,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr

View File

@ -513,3 +513,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr

View File

@ -473,3 +473,5 @@
465 i386 listxattrat sys_listxattrat 465 i386 listxattrat sys_listxattrat
466 i386 removexattrat sys_removexattrat 466 i386 removexattrat sys_removexattrat
467 i386 open_tree_attr sys_open_tree_attr 467 i386 open_tree_attr sys_open_tree_attr
468 i386 file_getattr sys_file_getattr
469 i386 file_setattr sys_file_setattr

View File

@ -391,6 +391,8 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr
# #
# Due to a historical design error, certain syscalls are numbered differently # Due to a historical design error, certain syscalls are numbered differently

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "arch-tests.h" #include "arch-tests.h"
#include "../util/topdown.h" #include "../util/topdown.h"
#include "debug.h"
#include "evlist.h" #include "evlist.h"
#include "parse-events.h" #include "parse-events.h"
#include "pmu.h" #include "pmu.h"

View File

@ -438,3 +438,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr

View File

@ -85,7 +85,7 @@ static int add_dso(const char *fpath, const struct stat *sb __maybe_unused,
if (typeflag == FTW_D || typeflag == FTW_SL) if (typeflag == FTW_D || typeflag == FTW_SL)
return 0; return 0;
if (filename__read_build_id(fpath, &bid) < 0) if (filename__read_build_id(fpath, &bid, /*block=*/true) < 0)
return 0; return 0;
dso->name = realpath(fpath, NULL); dso->name = realpath(fpath, NULL);

View File

@ -180,7 +180,7 @@ static int build_id_cache__add_file(const char *filename, struct nsinfo *nsi)
struct nscookie nsc; struct nscookie nsc;
nsinfo__mountns_enter(nsi, &nsc); nsinfo__mountns_enter(nsi, &nsc);
err = filename__read_build_id(filename, &bid); err = filename__read_build_id(filename, &bid, /*block=*/true);
nsinfo__mountns_exit(&nsc); nsinfo__mountns_exit(&nsc);
if (err < 0) { if (err < 0) {
pr_debug("Couldn't read a build-id in %s\n", filename); pr_debug("Couldn't read a build-id in %s\n", filename);
@ -204,7 +204,7 @@ static int build_id_cache__remove_file(const char *filename, struct nsinfo *nsi)
int err; int err;
nsinfo__mountns_enter(nsi, &nsc); nsinfo__mountns_enter(nsi, &nsc);
err = filename__read_build_id(filename, &bid); err = filename__read_build_id(filename, &bid, /*block=*/true);
nsinfo__mountns_exit(&nsc); nsinfo__mountns_exit(&nsc);
if (err < 0) { if (err < 0) {
pr_debug("Couldn't read a build-id in %s\n", filename); pr_debug("Couldn't read a build-id in %s\n", filename);
@ -280,7 +280,7 @@ static bool dso__missing_buildid_cache(struct dso *dso, int parm __maybe_unused)
if (!dso__build_id_filename(dso, filename, sizeof(filename), false)) if (!dso__build_id_filename(dso, filename, sizeof(filename), false))
return true; return true;
if (filename__read_build_id(filename, &bid) == -1) { if (filename__read_build_id(filename, &bid, /*block=*/true) == -1) {
if (errno == ENOENT) if (errno == ENOENT)
return false; return false;
@ -309,7 +309,7 @@ static int build_id_cache__update_file(const char *filename, struct nsinfo *nsi)
int err; int err;
nsinfo__mountns_enter(nsi, &nsc); nsinfo__mountns_enter(nsi, &nsc);
err = filename__read_build_id(filename, &bid); err = filename__read_build_id(filename, &bid, /*block=*/true);
nsinfo__mountns_exit(&nsc); nsinfo__mountns_exit(&nsc);
if (err < 0) { if (err < 0) {
pr_debug("Couldn't read a build-id in %s\n", filename); pr_debug("Couldn't read a build-id in %s\n", filename);

View File

@ -680,12 +680,12 @@ static int dso__read_build_id(struct dso *dso)
mutex_lock(dso__lock(dso)); mutex_lock(dso__lock(dso));
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc); nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (filename__read_build_id(dso__long_name(dso), &bid) > 0) if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0)
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
else if (dso__nsinfo(dso)) { else if (dso__nsinfo(dso)) {
char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso)); char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso));
if (new_name && filename__read_build_id(new_name, &bid) > 0) if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0)
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
free(new_name); free(new_name);
} }

View File

@ -31,7 +31,7 @@ static int build_id_cache__add_file(const char *filename)
struct build_id bid = { .size = 0, }; struct build_id bid = { .size = 0, };
int err; int err;
err = filename__read_build_id(filename, &bid); err = filename__read_build_id(filename, &bid, /*block=*/true);
if (err < 0) { if (err < 0) {
pr_debug("Failed to read build id of %s\n", filename); pr_debug("Failed to read build id of %s\n", filename);
return err; return err;

View File

@ -90,10 +90,28 @@
#define DN_ATTRIB 0x00000020 /* File changed attibutes */ #define DN_ATTRIB 0x00000020 /* File changed attibutes */
#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */ #define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
/* Reserved kernel ranges [-100], [-10000, -40000]. */
#define AT_FDCWD -100 /* Special value for dirfd used to #define AT_FDCWD -100 /* Special value for dirfd used to
indicate openat should use the indicate openat should use the
current working directory. */ current working directory. */
/*
* The concept of process and threads in userland and the kernel is a confusing
* one - within the kernel every thread is a 'task' with its own individual PID,
* however from userland's point of view threads are grouped by a single PID,
* which is that of the 'thread group leader', typically the first thread
* spawned.
*
* To cut the Gideon knot, for internal kernel usage, we refer to
* PIDFD_SELF_THREAD to refer to the current thread (or task from a kernel
* perspective), and PIDFD_SELF_THREAD_GROUP to refer to the current thread
* group leader...
*/
#define PIDFD_SELF_THREAD -10000 /* Current thread. */
#define PIDFD_SELF_THREAD_GROUP -10001 /* Current thread group leader. */
#define FD_PIDFS_ROOT -10002 /* Root of the pidfs filesystem */
#define FD_INVALID -10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */
/* Generic flags for the *at(2) family of syscalls. */ /* Generic flags for the *at(2) family of syscalls. */

View File

@ -60,6 +60,17 @@
#define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */ #define RENAME_EXCHANGE (1 << 1) /* Exchange source and dest */
#define RENAME_WHITEOUT (1 << 2) /* Whiteout source */ #define RENAME_WHITEOUT (1 << 2) /* Whiteout source */
/*
* The root inode of procfs is guaranteed to always have the same inode number.
* For programs that make heavy use of procfs, verifying that the root is a
* real procfs root and using openat2(RESOLVE_{NO_{XDEV,MAGICLINKS},BENEATH})
* will allow you to make sure you are never tricked into operating on the
* wrong procfs file.
*/
enum procfs_ino {
PROCFS_ROOT_INO = 1,
};
struct file_clone_range { struct file_clone_range {
__s64 src_fd; __s64 src_fd;
__u64 src_offset; __u64 src_offset;
@ -91,6 +102,63 @@ struct fs_sysfs_path {
__u8 name[128]; __u8 name[128];
}; };
/* Protection info capability flags */
#define LBMD_PI_CAP_INTEGRITY (1 << 0)
#define LBMD_PI_CAP_REFTAG (1 << 1)
/* Checksum types for Protection Information */
#define LBMD_PI_CSUM_NONE 0
#define LBMD_PI_CSUM_IP 1
#define LBMD_PI_CSUM_CRC16_T10DIF 2
#define LBMD_PI_CSUM_CRC64_NVME 4
/* sizeof first published struct */
#define LBMD_SIZE_VER0 16
/*
* Logical block metadata capability descriptor
* If the device does not support metadata, all the fields will be zero.
* Applications must check lbmd_flags to determine whether metadata is
* supported or not.
*/
struct logical_block_metadata_cap {
/* Bitmask of logical block metadata capability flags */
__u32 lbmd_flags;
/*
* The amount of data described by each unit of logical block
* metadata
*/
__u16 lbmd_interval;
/*
* Size in bytes of the logical block metadata associated with each
* interval
*/
__u8 lbmd_size;
/*
* Size in bytes of the opaque block tag associated with each
* interval
*/
__u8 lbmd_opaque_size;
/*
* Offset in bytes of the opaque block tag within the logical block
* metadata
*/
__u8 lbmd_opaque_offset;
/* Size in bytes of the T10 PI tuple associated with each interval */
__u8 lbmd_pi_size;
/* Offset in bytes of T10 PI tuple within the logical block metadata */
__u8 lbmd_pi_offset;
/* T10 PI guard tag type */
__u8 lbmd_guard_tag_type;
/* Size in bytes of the T10 PI application tag */
__u8 lbmd_app_tag_size;
/* Size in bytes of the T10 PI reference tag */
__u8 lbmd_ref_tag_size;
/* Size in bytes of the T10 PI storage tag */
__u8 lbmd_storage_tag_size;
__u8 pad;
};
/* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */ /* extent-same (dedupe) ioctls; these MUST match the btrfs ioctl definitions */
#define FILE_DEDUPE_RANGE_SAME 0 #define FILE_DEDUPE_RANGE_SAME 0
#define FILE_DEDUPE_RANGE_DIFFERS 1 #define FILE_DEDUPE_RANGE_DIFFERS 1
@ -148,6 +216,24 @@ struct fsxattr {
unsigned char fsx_pad[8]; unsigned char fsx_pad[8];
}; };
/*
* Variable size structure for file_[sg]et_attr().
*
* Note. This is alternative to the structure 'struct file_kattr'/'struct fsxattr'.
* As this structure is passed to/from userspace with its size, this can
* be versioned based on the size.
*/
struct file_attr {
__u64 fa_xflags; /* xflags field value (get/set) */
__u32 fa_extsize; /* extsize field value (get/set)*/
__u32 fa_nextents; /* nextents field value (get) */
__u32 fa_projid; /* project identifier (get/set) */
__u32 fa_cowextsize; /* CoW extsize field value (get/set) */
};
#define FILE_ATTR_SIZE_VER0 24
#define FILE_ATTR_SIZE_LATEST FILE_ATTR_SIZE_VER0
/* /*
* Flags for the fsx_xflags field * Flags for the fsx_xflags field
*/ */
@ -247,6 +333,8 @@ struct fsxattr {
* also /sys/kernel/debug/ for filesystems with debugfs exports * also /sys/kernel/debug/ for filesystems with debugfs exports
*/ */
#define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path) #define FS_IOC_GETFSSYSFSPATH _IOR(0x15, 1, struct fs_sysfs_path)
/* Get logical block metadata capability details */
#define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap)
/* /*
* Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS) * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)

View File

@ -244,6 +244,8 @@ struct prctl_mm_map {
# define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT) # define PR_MTE_TAG_MASK (0xffffUL << PR_MTE_TAG_SHIFT)
/* Unused; kept only for source compatibility */ /* Unused; kept only for source compatibility */
# define PR_MTE_TCF_SHIFT 1 # define PR_MTE_TCF_SHIFT 1
/* MTE tag check store only */
# define PR_MTE_STORE_ONLY (1UL << 19)
/* RISC-V pointer masking tag length */ /* RISC-V pointer masking tag length */
# define PR_PMLEN_SHIFT 24 # define PR_PMLEN_SHIFT 24
# define PR_PMLEN_MASK (0x7fUL << PR_PMLEN_SHIFT) # define PR_PMLEN_MASK (0x7fUL << PR_PMLEN_SHIFT)
@ -255,7 +257,12 @@ struct prctl_mm_map {
/* Dispatch syscalls to a userspace handler */ /* Dispatch syscalls to a userspace handler */
#define PR_SET_SYSCALL_USER_DISPATCH 59 #define PR_SET_SYSCALL_USER_DISPATCH 59
# define PR_SYS_DISPATCH_OFF 0 # define PR_SYS_DISPATCH_OFF 0
# define PR_SYS_DISPATCH_ON 1 /* Enable dispatch except for the specified range */
# define PR_SYS_DISPATCH_EXCLUSIVE_ON 1
/* Enable dispatch for the specified range */
# define PR_SYS_DISPATCH_INCLUSIVE_ON 2
/* Legacy name for backwards compatibility */
# define PR_SYS_DISPATCH_ON PR_SYS_DISPATCH_EXCLUSIVE_ON
/* The control values for the user space selector when dispatch is enabled */ /* The control values for the user space selector when dispatch is enabled */
# define SYSCALL_DISPATCH_FILTER_ALLOW 0 # define SYSCALL_DISPATCH_FILTER_ALLOW 0
# define SYSCALL_DISPATCH_FILTER_BLOCK 1 # define SYSCALL_DISPATCH_FILTER_BLOCK 1

View File

@ -235,4 +235,39 @@
*/ */
#define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \ #define VHOST_VDPA_GET_VRING_SIZE _IOWR(VHOST_VIRTIO, 0x82, \
struct vhost_vring_state) struct vhost_vring_state)
/* Extended features manipulation */
#define VHOST_GET_FEATURES_ARRAY _IOR(VHOST_VIRTIO, 0x83, \
struct vhost_features_array)
#define VHOST_SET_FEATURES_ARRAY _IOW(VHOST_VIRTIO, 0x83, \
struct vhost_features_array)
/* fork_owner values for vhost */
#define VHOST_FORK_OWNER_KTHREAD 0
#define VHOST_FORK_OWNER_TASK 1
/**
* VHOST_SET_FORK_FROM_OWNER - Set the fork_owner flag for the vhost device,
* This ioctl must called before VHOST_SET_OWNER.
* Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
*
* @param fork_owner: An 8-bit value that determines the vhost thread mode
*
* When fork_owner is set to VHOST_FORK_OWNER_TASK(default value):
* - Vhost will create vhost worker as tasks forked from the owner,
* inheriting all of the owner's attributes.
*
* When fork_owner is set to VHOST_FORK_OWNER_KTHREAD:
* - Vhost will create vhost workers as kernel threads.
*/
#define VHOST_SET_FORK_FROM_OWNER _IOW(VHOST_VIRTIO, 0x84, __u8)
/**
* VHOST_GET_FORK_OWNER - Get the current fork_owner flag for the vhost device.
* Only available when CONFIG_VHOST_ENABLE_FORK_OWNER_CONTROL=y
*
* @return: An 8-bit value indicating the current thread mode.
*/
#define VHOST_GET_FORK_FROM_OWNER _IOR(VHOST_VIRTIO, 0x85, __u8)
#endif #endif

View File

@ -115,7 +115,7 @@ int filename__snprintf_build_id(const char *pathname, char *sbuild_id, size_t sb
struct build_id bid = { .size = 0, }; struct build_id bid = { .size = 0, };
int ret; int ret;
ret = filename__read_build_id(pathname, &bid); ret = filename__read_build_id(pathname, &bid, /*block=*/true);
if (ret < 0) if (ret < 0)
return ret; return ret;
@ -841,7 +841,7 @@ static int filename__read_build_id_ns(const char *filename,
int ret; int ret;
nsinfo__mountns_enter(nsi, &nsc); nsinfo__mountns_enter(nsi, &nsc);
ret = filename__read_build_id(filename, bid); ret = filename__read_build_id(filename, bid, /*block=*/true);
nsinfo__mountns_exit(&nsc); nsinfo__mountns_exit(&nsc);
return ret; return ret;

View File

@ -110,8 +110,12 @@ struct debuginfo *debuginfo__new(const char *path)
if (!dso) if (!dso)
goto out; goto out;
/* Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO */ /*
if (is_regular_file(path) && filename__read_build_id(path, &bid) > 0) * Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block
* incase the path isn't for a regular file.
*/
assert(!dso__has_build_id(dso));
if (filename__read_build_id(path, &bid, /*block=*/false) > 0)
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
for (type = distro_dwarf_types; for (type = distro_dwarf_types;

View File

@ -81,13 +81,13 @@ static int dsos__read_build_ids_cb(struct dso *dso, void *data)
return 0; return 0;
} }
nsinfo__mountns_enter(dso__nsinfo(dso), &nsc); nsinfo__mountns_enter(dso__nsinfo(dso), &nsc);
if (filename__read_build_id(dso__long_name(dso), &bid) > 0) { if (filename__read_build_id(dso__long_name(dso), &bid, /*block=*/true) > 0) {
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
args->have_build_id = true; args->have_build_id = true;
} else if (errno == ENOENT && dso__nsinfo(dso)) { } else if (errno == ENOENT && dso__nsinfo(dso)) {
char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso)); char *new_name = dso__filename_with_chroot(dso, dso__long_name(dso));
if (new_name && filename__read_build_id(new_name, &bid) > 0) { if (new_name && filename__read_build_id(new_name, &bid, /*block=*/true) > 0) {
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
args->have_build_id = true; args->have_build_id = true;
} }

View File

@ -902,7 +902,7 @@ out_close:
#else // HAVE_LIBBFD_BUILDID_SUPPORT #else // HAVE_LIBBFD_BUILDID_SUPPORT
static int read_build_id(const char *filename, struct build_id *bid) static int read_build_id(const char *filename, struct build_id *bid, bool block)
{ {
size_t size = sizeof(bid->data); size_t size = sizeof(bid->data);
int fd, err = -1; int fd, err = -1;
@ -911,7 +911,7 @@ static int read_build_id(const char *filename, struct build_id *bid)
if (size < BUILD_ID_SIZE) if (size < BUILD_ID_SIZE)
goto out; goto out;
fd = open(filename, O_RDONLY); fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK));
if (fd < 0) if (fd < 0)
goto out; goto out;
@ -934,7 +934,7 @@ out:
#endif // HAVE_LIBBFD_BUILDID_SUPPORT #endif // HAVE_LIBBFD_BUILDID_SUPPORT
int filename__read_build_id(const char *filename, struct build_id *bid) int filename__read_build_id(const char *filename, struct build_id *bid, bool block)
{ {
struct kmod_path m = { .name = NULL, }; struct kmod_path m = { .name = NULL, };
char path[PATH_MAX]; char path[PATH_MAX];
@ -958,9 +958,10 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
} }
close(fd); close(fd);
filename = path; filename = path;
block = true;
} }
err = read_build_id(filename, bid); err = read_build_id(filename, bid, block);
if (m.comp) if (m.comp)
unlink(filename); unlink(filename);

View File

@ -4,7 +4,6 @@
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -86,13 +85,10 @@ int filename__read_debuglink(const char *filename __maybe_unused,
/* /*
* Just try PT_NOTE header otherwise fails * Just try PT_NOTE header otherwise fails
*/ */
int filename__read_build_id(const char *filename, struct build_id *bid) int filename__read_build_id(const char *filename, struct build_id *bid, bool block)
{ {
FILE *fp; int fd, ret = -1;
int ret = -1;
bool need_swap = false, elf32; bool need_swap = false, elf32;
u8 e_ident[EI_NIDENT];
int i;
union { union {
struct { struct {
Elf32_Ehdr ehdr32; Elf32_Ehdr ehdr32;
@ -103,28 +99,27 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
Elf64_Phdr *phdr64; Elf64_Phdr *phdr64;
}; };
} hdrs; } hdrs;
void *phdr; void *phdr, *buf = NULL;
size_t phdr_size; ssize_t phdr_size, ehdr_size, buf_size = 0;
void *buf = NULL;
size_t buf_size = 0;
fp = fopen(filename, "r"); fd = open(filename, block ? O_RDONLY : (O_RDONLY | O_NONBLOCK));
if (fp == NULL) if (fd < 0)
return -1; return -1;
if (fread(e_ident, sizeof(e_ident), 1, fp) != 1) if (read(fd, hdrs.ehdr32.e_ident, EI_NIDENT) != EI_NIDENT)
goto out; goto out;
if (memcmp(e_ident, ELFMAG, SELFMAG) || if (memcmp(hdrs.ehdr32.e_ident, ELFMAG, SELFMAG) ||
e_ident[EI_VERSION] != EV_CURRENT) hdrs.ehdr32.e_ident[EI_VERSION] != EV_CURRENT)
goto out; goto out;
need_swap = check_need_swap(e_ident[EI_DATA]); need_swap = check_need_swap(hdrs.ehdr32.e_ident[EI_DATA]);
elf32 = e_ident[EI_CLASS] == ELFCLASS32; elf32 = hdrs.ehdr32.e_ident[EI_CLASS] == ELFCLASS32;
ehdr_size = (elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64)) - EI_NIDENT;
if (fread(elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64, if (read(fd,
elf32 ? sizeof(hdrs.ehdr32) : sizeof(hdrs.ehdr64), (elf32 ? (void *)&hdrs.ehdr32 : (void *)&hdrs.ehdr64) + EI_NIDENT,
1, fp) != 1) ehdr_size) != ehdr_size)
goto out; goto out;
if (need_swap) { if (need_swap) {
@ -138,14 +133,18 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
hdrs.ehdr64.e_phnum = bswap_16(hdrs.ehdr64.e_phnum); hdrs.ehdr64.e_phnum = bswap_16(hdrs.ehdr64.e_phnum);
} }
} }
phdr_size = elf32 ? hdrs.ehdr32.e_phentsize * hdrs.ehdr32.e_phnum if ((elf32 && hdrs.ehdr32.e_phentsize != sizeof(Elf32_Phdr)) ||
: hdrs.ehdr64.e_phentsize * hdrs.ehdr64.e_phnum; (!elf32 && hdrs.ehdr64.e_phentsize != sizeof(Elf64_Phdr)))
goto out;
phdr_size = elf32 ? sizeof(Elf32_Phdr) * hdrs.ehdr32.e_phnum
: sizeof(Elf64_Phdr) * hdrs.ehdr64.e_phnum;
phdr = malloc(phdr_size); phdr = malloc(phdr_size);
if (phdr == NULL) if (phdr == NULL)
goto out; goto out;
fseek(fp, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET); lseek(fd, elf32 ? hdrs.ehdr32.e_phoff : hdrs.ehdr64.e_phoff, SEEK_SET);
if (fread(phdr, phdr_size, 1, fp) != 1) if (read(fd, phdr, phdr_size) != phdr_size)
goto out_free; goto out_free;
if (elf32) if (elf32)
@ -153,8 +152,8 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
else else
hdrs.phdr64 = phdr; hdrs.phdr64 = phdr;
for (i = 0; i < elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum; i++) { for (int i = 0; i < (elf32 ? hdrs.ehdr32.e_phnum : hdrs.ehdr64.e_phnum); i++) {
size_t p_filesz; ssize_t p_filesz;
if (need_swap) { if (need_swap) {
if (elf32) { if (elf32) {
@ -180,8 +179,8 @@ int filename__read_build_id(const char *filename, struct build_id *bid)
goto out_free; goto out_free;
buf = tmp; buf = tmp;
} }
fseek(fp, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET); lseek(fd, elf32 ? hdrs.phdr32[i].p_offset : hdrs.phdr64[i].p_offset, SEEK_SET);
if (fread(buf, p_filesz, 1, fp) != 1) if (read(fd, buf, p_filesz) != p_filesz)
goto out_free; goto out_free;
ret = read_build_id(buf, p_filesz, bid, need_swap); ret = read_build_id(buf, p_filesz, bid, need_swap);
@ -194,7 +193,7 @@ out_free:
free(buf); free(buf);
free(phdr); free(phdr);
out: out:
fclose(fp); close(fd);
return ret; return ret;
} }
@ -324,7 +323,7 @@ int dso__load_sym(struct dso *dso, struct map *map __maybe_unused,
if (ret >= 0) if (ret >= 0)
RC_CHK_ACCESS(dso)->is_64_bit = ret; RC_CHK_ACCESS(dso)->is_64_bit = ret;
if (filename__read_build_id(ss->name, &bid) > 0) if (filename__read_build_id(ss->name, &bid, /*block=*/true) > 0)
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
return 0; return 0;
} }

View File

@ -1869,14 +1869,14 @@ int dso__load(struct dso *dso, struct map *map)
/* /*
* Read the build id if possible. This is required for * Read the build id if possible. This is required for
* DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work. Don't block in case path
* isn't for a regular file.
*/ */
if (!dso__has_build_id(dso) && if (!dso__has_build_id(dso)) {
is_regular_file(dso__long_name(dso))) {
struct build_id bid = { .size = 0, }; struct build_id bid = { .size = 0, };
__symbol__join_symfs(name, PATH_MAX, dso__long_name(dso)); __symbol__join_symfs(name, PATH_MAX, dso__long_name(dso));
if (filename__read_build_id(name, &bid) > 0) if (filename__read_build_id(name, &bid, /*block=*/false) > 0)
dso__set_build_id(dso, &bid); dso__set_build_id(dso, &bid);
} }

View File

@ -140,7 +140,7 @@ struct symbol *dso__next_symbol(struct symbol *sym);
enum dso_type dso__type_fd(int fd); enum dso_type dso__type_fd(int fd);
int filename__read_build_id(const char *filename, struct build_id *id); int filename__read_build_id(const char *filename, struct build_id *id, bool block);
int sysfs__read_build_id(const char *filename, struct build_id *bid); int sysfs__read_build_id(const char *filename, struct build_id *bid);
int modules__parse(const char *filename, void *arg, int modules__parse(const char *filename, void *arg,
int (*process_module)(void *arg, const char *name, int (*process_module)(void *arg, const char *name,

View File

@ -401,7 +401,7 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
nsi = nsinfo__new(event->pid); nsi = nsinfo__new(event->pid);
nsinfo__mountns_enter(nsi, &nc); nsinfo__mountns_enter(nsi, &nc);
rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1; rc = filename__read_build_id(event->filename, &bid, /*block=*/false) > 0 ? 0 : -1;
nsinfo__mountns_exit(&nc); nsinfo__mountns_exit(&nc);
nsinfo__put(nsi); nsinfo__put(nsi);

View File

@ -408,3 +408,5 @@
465 common listxattrat sys_listxattrat 465 common listxattrat sys_listxattrat
466 common removexattrat sys_removexattrat 466 common removexattrat sys_removexattrat
467 common open_tree_attr sys_open_tree_attr 467 common open_tree_attr sys_open_tree_attr
468 common file_getattr sys_file_getattr
469 common file_setattr sys_file_setattr