Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
c7d2a4a
Revert "x86/module: prepare module loading for ROX allocations of text"
rppt Jan 26, 2025
f09dd43
x86/ibt: Clean up is_endbr()
Feb 7, 2025
c23c959
Revert "NVIDIA: SAUCE: iommu/arm-smmu-v3: Implement arm_smmu_get_msi_…
nirmoy Jul 11, 2025
7a95ace
iommu/arm-smmu-v3: Fix iommu_device_probe bug due to duplicated strea…
nicolinc Apr 15, 2025
68f8f4f
iommufd/fault: Remove iommufd_fault_domain_attach/detach/replace_dev()
nicolinc Feb 4, 2025
d2e60f9
Revert "NVIDIA: SAUCE: iommu/dma: Support MSIs through nested domains"
nirmoy Jul 11, 2025
eecb9eb
genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iomm…
jgunthorpe Feb 20, 2025
8397d3c
genirq/msi: Refactor iommu_dma_compose_msi_msg()
jgunthorpe Feb 20, 2025
623d849
iommu: Make iommu_dma_prepare_msi() into a generic operation
jgunthorpe Feb 20, 2025
1cc5397
iommu: Make @handle mandatory in iommu_{attach|replace}_group_handle()
yiliu1765 Feb 26, 2025
660ddef
iommu: Drop iommu_group_replace_domain()
yiliu1765 Feb 26, 2025
c214450
iommu: Store either domain or handle in group->pasid_array
yiliu1765 Feb 26, 2025
86d636c
iommu: Swap the order of setting group->pasid_array and calling attac…
yiliu1765 Feb 26, 2025
93d570b
iommu: Unexport iommu_fwspec_free()
rmurphy-arm Feb 27, 2025
5e0f75a
iommu: Keep dev->iommu state consistent
rmurphy-arm Feb 28, 2025
2a2332d
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by irqchips that need it
jgunthorpe Feb 20, 2025
0b55f0f
iommu: Turn fault_data to iommufd private pointer
nicolinc Feb 20, 2025
15afd38
iommufd: Implement sw_msi support natively
jgunthorpe Feb 20, 2025
998ab3e
iommufd/fault: Move two fault functions out of the header
nicolinc Mar 11, 2025
c723f95
iommufd/fault: Add an iommufd_fault_init() helper
nicolinc Mar 11, 2025
b2d082b
iommufd: Abstract an iommufd_eventq from iommufd_fault
nicolinc Mar 11, 2025
a167327
iommufd: Rename fault.c to eventq.c
nicolinc Mar 11, 2025
6be9088
iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC
nicolinc Mar 11, 2025
c892d2b
iommufd/viommu: Add iommufd_viommu_get_vdev_id helper
nicolinc Mar 11, 2025
236f0d2
iommufd/viommu: Add iommufd_viommu_report_event helper
nicolinc Mar 11, 2025
e013ea3
iommufd/selftest: Require vdev_id when attaching to a nested domain
nicolinc Mar 11, 2025
307e945
iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_VEVENT for vEVENTQ coverage
nicolinc Mar 11, 2025
7d11a3e
iommufd/selftest: Add IOMMU_VEVENTQ_ALLOC test coverage
nicolinc Mar 11, 2025
431c71b
Documentation: userspace-api: iommufd: Update FAULT and VEVENTQ
nicolinc Mar 11, 2025
082c4cd
iommu/arm-smmu-v3: Introduce struct arm_smmu_vmaster
nicolinc Mar 11, 2025
7eb0576
iommu/arm-smmu-v3: Report events that belong to devices attached to v…
nicolinc Mar 11, 2025
1b52e01
iommufd: Disallow allocating nested parent domain with fault ID
yiliu1765 Feb 26, 2025
8128d0e
iommufd: Set domain->iommufd_hwpt in all hwpt->domain allocators
nicolinc Mar 5, 2025
cd8926a
iommu: Sort out domain user data
rmurphy-arm Mar 25, 2025
ea9cee5
iommufd: Move iommufd_sw_msi and related functions to driver.c
nicolinc Mar 25, 2025
6cd633f
iommu: Drop sw_msi from iommu_domain
nicolinc Mar 25, 2025
a57ace3
iommu: Require passing new handles to APIs supporting handle
yiliu1765 Mar 21, 2025
bce43e7
Revert "iommu: Skip PASID validation for devices without PASID capabi…
nirmoy Jul 11, 2025
597ff84
iommu: Introduce a replace API for device pasid
yiliu1765 Mar 21, 2025
fa260d1
iommu: Skip PASID validation for devices without PASID capability
tdavenvidia May 20, 2025
0b0edd8
iommufd: Pass @pasid through the device attach/replace path
yiliu1765 Mar 21, 2025
60be2d7
iommufd/device: Only add reserved_iova in non-pasid path
yiliu1765 Mar 21, 2025
4d77211
iommufd/device: Replace idev->igroup with local variable
yiliu1765 Mar 21, 2025
9a62e50
iommufd/device: Add helper to detect the first attach of a group
yiliu1765 Mar 21, 2025
b219b73
iommufd/device: Wrap igroup->hwpt and igroup->device_list into attach…
yiliu1765 Mar 21, 2025
90dd742
iommufd/device: Replace device_list with device_array
yiliu1765 Mar 21, 2025
8e208e6
iommufd/device: Add pasid_attach array to track per-PASID attach
yiliu1765 Mar 21, 2025
4057816
iommufd: Enforce PASID-compatible domain in PASID path
yiliu1765 Mar 21, 2025
ee7a73e
iommufd: Support pasid attach/replace
yiliu1765 Mar 21, 2025
31706ee
iommufd: Enforce PASID-compatible domain for RID
yiliu1765 Mar 21, 2025
95bc460
iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support
yiliu1765 Mar 21, 2025
0239187
iommufd: Allow allocating PASID-compatible domain
yiliu1765 Mar 21, 2025
6fd70f5
iommufd/selftest: Add set_dev_pasid in mock iommu
yiliu1765 Mar 21, 2025
720df5e
iommufd/selftest: Add a helper to get test device
yiliu1765 Mar 21, 2025
e589a79
iommufd/selftest: Add test ops to test pasid attach/detach
yiliu1765 Mar 21, 2025
0654bbf
iommufd/selftest: Add coverage for iommufd pasid attach/detach
yiliu1765 Mar 21, 2025
902f208
ida: Add ida_find_first_range()
yiliu1765 Mar 21, 2025
047d490
vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices
yiliu1765 Mar 21, 2025
0ee69e5
vfio: VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT support pasid
yiliu1765 Mar 21, 2025
2edbd49
iommufd: Initialize the flags of vevent in iommufd_viommu_report_event()
yiliu1765 Mar 24, 2025
151b3e0
iommufd: Balance veventq->num_events inc/dec
yiliu1765 Mar 24, 2025
a22fcf1
iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability
yiliu1765 Mar 21, 2025
5576c82
iommufd/selftest: Add coverage for reporting max_pasid_log2 via IOMMU…
yiliu1765 Mar 21, 2025
d2cbe9d
iommu/virtio: Break out bypass identity support into a global static
jgunthorpe Apr 8, 2025
4e9fa24
iommu: Add domain_alloc_identity()
jgunthorpe Apr 8, 2025
369a135
iommu/virtio: Move to domain_alloc_paging()
jgunthorpe Apr 8, 2025
bcf1724
iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()
jgunthorpe Apr 8, 2025
8469bd7
iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU
jgunthorpe Apr 8, 2025
61ca867
iommufd: Apply obvious cosmetic fixes
nicolinc Jun 14, 2025
7b32510
iommufd: Drop unused ictx in struct iommufd_vdevice
nicolinc Jun 14, 2025
46bc822
iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu
nicolinc Jun 14, 2025
9eb4e35
iommufd: Use enum iommu_veventq_type for type in struct iommufd_veventq
nicolinc Jun 14, 2025
93d7f33
iommufd: Return EOPNOTSUPP for failures due to driver bugs
nicolinc Jun 14, 2025
6224782
iommu: Introduce get_viommu_size and viommu_init ops
nicolinc Jun 14, 2025
6a5590a
iommufd/viommu: Support get_viommu_size and viommu_init ops
nicolinc Jun 14, 2025
88f68ee
iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
nicolinc Jun 14, 2025
57fc949
iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
nicolinc Jun 14, 2025
643c655
iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init
nicolinc Jun 14, 2025
23d9863
iommu: Deprecate viommu_alloc op
nicolinc Jun 14, 2025
6e69eee
iommufd: Move _iommufd_object_alloc out of driver.c
nicolinc Jun 14, 2025
53769ba
iommufd: Introduce iommufd_object_alloc_ucmd helper
nicolinc Jun 14, 2025
76eb0a1
iommufd: Apply the new iommufd_object_alloc_ucmd helper
nicolinc Jun 14, 2025
5380475
iommufd: Report unmapped bytes in the error path of iopt_unmap_iova_r…
nicolinc Jul 10, 2025
e5110f3
iommufd: Correct virt_id kdoc at struct iommu_vdevice_alloc
nicolinc Jul 10, 2025
242f815
iommufd/viommu: Explicitly define vdev->virt_id
nicolinc Jul 10, 2025
e2ac5a1
iommu: Use enum iommu_hw_info_type for type in hw_info op
nicolinc Jul 10, 2025
be27eb4
iommu: Add iommu_copy_struct_to_user helper
nicolinc Jul 10, 2025
0649fb1
iommu: Pass in a driver-level user data structure to viommu_init op
nicolinc Jul 10, 2025
b9e8571
iommufd/viommu: Allow driver-specific user data for a vIOMMU object
nicolinc Jul 10, 2025
c28e80f
iommufd/selftest: Support user_data in mock_viommu_alloc
nicolinc Jul 10, 2025
f663ab7
iommufd/selftest: Add coverage for viommu data
nicolinc Jul 10, 2025
695ccc6
iommufd/access: Add internal APIs for HW queue to use
nicolinc Jul 10, 2025
7683815
iommufd/access: Bypass access->ops->unmap for internal use
nicolinc Jul 10, 2025
13afa65
iommufd/viommu: Add driver-defined vDEVICE support
nicolinc Jul 10, 2025
02bfcf9
iommufd/viommu: Introduce IOMMUFD_OBJ_HW_QUEUE and its related struct
nicolinc Jul 10, 2025
3220558
iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl
nicolinc Jul 10, 2025
966d87b
iommufd/driver: Add iommufd_hw_queue_depend/undepend() helpers
nicolinc Jul 10, 2025
d96f995
iommufd/selftest: Add coverage for IOMMUFD_CMD_HW_QUEUE_ALLOC
nicolinc Jul 10, 2025
21795cb
iommufd: Add mmap interface
nicolinc Jul 10, 2025
37142c0
iommufd/selftest: Add coverage for the new mmap interface
nicolinc Jul 10, 2025
6a4c6b8
Documentation: userspace-api: iommufd: Update HW QUEUE
nicolinc Jul 10, 2025
fdd6a78
iommu: Allow an input type in hw_info op
nicolinc Jul 10, 2025
e2b8ffc
iommufd: Allow an input data_type via iommu_hw_info
nicolinc Jul 10, 2025
32f6925
iommufd/selftest: Update hw_info coverage for an input data_type
nicolinc Jul 10, 2025
476fc75
iommu/arm-smmu-v3-iommufd: Add vsmmu_size/type and vsmmu_init impl ops
nicolinc Jul 10, 2025
8ec85d3
iommu/arm-smmu-v3-iommufd: Add hw_info to impl_ops
nicolinc Jul 10, 2025
840fa9a
iommu/tegra241-cmdqv: Use request_threaded_irq
nicolinc Jul 10, 2025
e4bdb91
iommu/tegra241-cmdqv: Simplify deinit flow in tegra241_cmdqv_remove_v…
nicolinc Jul 10, 2025
eeb9db0
iommu/tegra241-cmdqv: Do not statically map LVCMDQs
nicolinc Jul 10, 2025
159375c
iommu/tegra241-cmdqv: Add user-space use support
nicolinc Jul 10, 2025
88f3274
iommu/tegra241-cmdqv: Add IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV support
nicolinc Jul 10, 2025
7fe8211
iommufd: Do not allow _iommufd_object_alloc_ucmd if abort op is set
nicolinc Jul 10, 2025
767e6f3
iommu/tegra241-cmdqv: import IOMMUFD module namespace
arndb Jul 14, 2025
32737a2
NVIDIA: SAUCE: mm: handle poisoning of pfn without struct pages
ankita-nv Jul 14, 2025
a0c542b
NVIDIA: SAUCE: mm: Add poison error check in fixup_user_fault() for m…
ankita-nv Dec 6, 2023
65988cc
NVIDIA: SAUCE: mm: Change ghes code to allow poison of non-struct pfn
ankita-nv Dec 6, 2023
03f3020
NVIDIA: SAUCE: vfio/nvgrace-gpu: register device memory for poison ha…
ankita-nv Feb 25, 2024
f87108f
NVIDIA: SAUCE: arm64: configs: Build NVGRACE_GPU_VFIO_PCI as LKM
nicolinc Dec 4, 2023
707b6cf
NVIDIA: SAUCE: arm64: configs: Enable IOMMUFD and VFIO_DEVICE_CDEV
nicolinc Nov 7, 2023
d122d42
NVIDIA: SAUCE: arm64: configs: Replace VFIO_CONTAINER with IOMMUFD_VF…
nicolinc Jan 22, 2024
6b0cf2b
NVIDIA: SAUCE: KVM: arm64: Allow exec fault on memory mapped cacheabl…
ankita-nv Aug 29, 2024
99fe6a9
NVIDIA: SAUCE: vfio/nvgrace-egm: Introduce module to manage EGM
ankita-nv Aug 29, 2024
e2e199f
NVIDIA: SAUCE: vfio/nvgrace-egm: Handle pages with ECC errors on the EGM
ankita-nv Aug 29, 2024
fed1e56
NVIDIA: SAUCE: vfio/nvgrace-egm: Register EGM for runtime ECC poison …
ankita-nv Aug 29, 2024
fa811f0
NVIDIA: SAUCE: arm64: configs: Build CONFIG_NVGRACE_EGM as LKM
nvmochs Aug 30, 2024
432a901
NVIDIA: SAUCE: vfio/nvgrace-egm: Move the egm header file to include
ankita-nv Oct 13, 2024
f59a9dd
NVIDIA: SAUCE: vfio/nvgrace-egm: Free region memory during unregistra…
nvmochs Nov 7, 2024
03e61cf
NVIDIA: SAUCE: vfio/nvgrace-egm: Move region hash initialization
nvmochs Nov 7, 2024
7bd126f
NVIDIA: SAUCE: vfio/nvgrace-egm: Handle and convey EGM registration e…
nvmochs Nov 7, 2024
c704df8
NVIDIA: SAUCE: vfio/nvgrace-gpu: Handle EGM registration failure
nvmochs Nov 7, 2024
825cf43
NVIDIA: SAUCE: vfio/nvgrace-gpu: Address checkpatch warnings
nvmochs Nov 7, 2024
14bcbe8
NVIDIA: SAUCE: vfio/nvgrace-egm: Address sparse errors
nvmochs Nov 8, 2024
404d0fd
NVIDIA: SAUCE: vfio/nvgrace-egm: Address smatch errors
nvmochs Nov 8, 2024
6e2cfd6
NVIDIA: SAUCE: vfio/nvgrace-gpu: Address smatch errors
nvmochs Nov 8, 2024
c517485
NVIDIA: SAUCE: vfio/nvgrace-egm: Ensure ACPI value reads are successful
nvmochs Nov 22, 2024
1b8aac3
NVIDIA: SAUCE: vfio/nvgrace-egm: Avoid invalid retired pages base
nvmochs Nov 14, 2024
68299f9
NVIDIA: SAUCE: vfio/nvgrace-egm: Update EGM unregistration API
nvmochs Jan 23, 2025
6cbf132
NVIDIA: SAUCE: vfio/nvgrace-egm: track GPUs associated with the EGM r…
ankita-nv May 6, 2025
cb3ae57
NVIDIA: SAUCE: vfio/nvgrace-egm: list gpus through sysfs
ankita-nv May 6, 2025
4cfef70
NVIDIA: SAUCE: vfio/nvgrace-egm: expose the egm size through sysfs
ankita-nv May 6, 2025
cdc15a8
NVIDIA: SAUCE: vfio/nvgrace-egm: Add null pointer checks after memory…
KobaKoNvidia May 26, 2025
4ff9dc6
NVIDIA: SAUCE: arm64: configs: enable NVGRACE_EGM as module
nirmoy Jul 14, 2025
e2d029c
NVIDIA: SAUCE: vfio/nvgrace-gpu: Avoid resmem pfn unregistration
nvmochs Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Documentation/userspace-api/iommufd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Following IOMMUFD objects are exposed to userspace:
space usually has mappings from guest-level I/O virtual addresses to guest-
level physical addresses.

- IOMMUFD_FAULT, representing a software queue for an HWPT reporting IO page
faults using the IOMMU HW's PRI (Page Request Interface). This queue object
provides user space an FD to poll the page fault events and also to respond
to those events. A FAULT object must be created first to get a fault_id that
could be then used to allocate a fault-enabled HWPT via the IOMMU_HWPT_ALLOC
command by setting the IOMMU_HWPT_FAULT_ID_VALID bit in its flags field.

- IOMMUFD_OBJ_VIOMMU, representing a slice of the physical IOMMU instance,
passed to or shared with a VM. It may be some HW-accelerated virtualization
features and some SW resources used by the VM. For examples:
Expand Down Expand Up @@ -109,6 +116,25 @@ Following IOMMUFD objects are exposed to userspace:
vIOMMU, which is a separate ioctl call from attaching the same device to an
HWPT_PAGING that the vIOMMU holds.

- IOMMUFD_OBJ_VEVENTQ, representing a software queue for a vIOMMU to report its
events such as translation faults occurred to a nested stage-1 (excluding I/O
page faults that should go through IOMMUFD_OBJ_FAULT) and HW-specific events.
This queue object provides user space an FD to poll/read the vIOMMU events. A
vIOMMU object must be created first to get its viommu_id, which could be then
used to allocate a vEVENTQ. Each vIOMMU can support multiple types of vEVENTS,
but is confined to one vEVENTQ per vEVENTQ type.

- IOMMUFD_OBJ_HW_QUEUE, representing a hardware accelerated queue, as a subset
of IOMMU's virtualization features, for the IOMMU HW to directly read or write
the virtual queue memory owned by a guest OS. This HW-acceleration feature can
allow VM to work with the IOMMU HW directly without a VM Exit, so as to reduce
overhead from the hypercalls. Along with the HW QUEUE object, iommufd provides
user space an mmap interface for VMM to mmap a physical MMIO region from the
host physical address space to the guest physical address space, allowing the
guest OS to directly control the allocated HW QUEUE. Thus, when allocating a
HW QUEUE, the VMM must request a pair of mmap info (offset/length) and pass in
exactly to an mmap syscall via its offset and length arguments.

All user-visible objects are destroyed via the IOMMU_DESTROY uAPI.

The diagrams below show relationships between user-visible objects and kernel
Expand Down Expand Up @@ -251,8 +277,11 @@ User visible objects are backed by following datastructures:
- iommufd_device for IOMMUFD_OBJ_DEVICE.
- iommufd_hwpt_paging for IOMMUFD_OBJ_HWPT_PAGING.
- iommufd_hwpt_nested for IOMMUFD_OBJ_HWPT_NESTED.
- iommufd_fault for IOMMUFD_OBJ_FAULT.
- iommufd_viommu for IOMMUFD_OBJ_VIOMMU.
- iommufd_vdevice for IOMMUFD_OBJ_VDEVICE.
- iommufd_veventq for IOMMUFD_OBJ_VEVENTQ.
- iommufd_hw_queue for IOMMUFD_OBJ_HW_QUEUE.

Several terminologies when looking at these datastructures:

Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1762,3 +1762,12 @@ CONFIG_CORESIGHT_STM=m
CONFIG_CORESIGHT_CPU_DEBUG=m
CONFIG_CORESIGHT_CTI=m
CONFIG_MEMTEST=y
CONFIG_NVGRACE_GPU_VFIO_PCI=m
CONFIG_NVGRACE_EGM=m
CONFIG_VFIO_DEVICE_CDEV=y
# CONFIG_VFIO_CONTAINER is not set
CONFIG_FAULT_INJECTION=y
CONFIG_IOMMUFD_DRIVER=y
CONFIG_IOMMUFD=y
CONFIG_IOMMUFD_TEST=y
CONFIG_IOMMUFD_VFIO_CONTAINER=y
5 changes: 4 additions & 1 deletion arch/arm64/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
bool s2_force_noncacheable = false, vfio_allow_any_uc = false;
unsigned long mmu_seq;
phys_addr_t ipa = fault_ipa;
unsigned long mt;
struct kvm *kvm = vcpu->kvm;
struct vm_area_struct *vma;
short vma_shift;
Expand Down Expand Up @@ -1593,6 +1594,8 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
vma_pagesize = min(vma_pagesize, (long)max_map_size);
}

mt = FIELD_GET(PTE_ATTRINDX_MASK, pgprot_val(vma->vm_page_prot));

/*
* Both the canonical IPA and fault IPA must be hugepage-aligned to
* ensure we find the right PFN and lay down the mapping in the right
Expand Down Expand Up @@ -1676,7 +1679,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
writable = false;
}

if (exec_fault && s2_force_noncacheable)
if (exec_fault && s2_force_noncacheable && mt != MT_NORMAL)
return -ENOEXEC;

/*
Expand Down
11 changes: 5 additions & 6 deletions arch/um/kernel/um_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,25 +440,24 @@ void __init arch_cpu_finalize_init(void)
os_check_bugs();
}

void apply_seal_endbr(s32 *start, s32 *end, struct module *mod)
void apply_seal_endbr(s32 *start, s32 *end)
{
}

void apply_retpolines(s32 *start, s32 *end, struct module *mod)
void apply_retpolines(s32 *start, s32 *end)
{
}

void apply_returns(s32 *start, s32 *end, struct module *mod)
void apply_returns(s32 *start, s32 *end)
{
}

void apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
s32 *start_cfi, s32 *end_cfi, struct module *mod)
s32 *start_cfi, s32 *end_cfi)
{
}

void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
struct module *mod)
void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
{
}

Expand Down
3 changes: 1 addition & 2 deletions arch/x86/entry/vdso/vma.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ int __init init_vdso_image(const struct vdso_image *image)

apply_alternatives((struct alt_instr *)(image->data + image->alt),
(struct alt_instr *)(image->data + image->alt +
image->alt_len),
NULL);
image->alt_len));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ static bool is_uprobe_at_func_entry(struct pt_regs *regs)
return true;

/* endbr64 (64-bit only) */
if (user_64bit_mode(regs) && is_endbr(*(u32 *)auprobe->insn))
if (user_64bit_mode(regs) && is_endbr((u32 *)auprobe->insn))
return true;

return false;
Expand Down
14 changes: 7 additions & 7 deletions arch/x86/include/asm/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
* instructions were patched in already:
*/
extern int alternatives_patched;
struct module;

extern void alternative_instructions(void);
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
struct module *mod);
extern void apply_retpolines(s32 *start, s32 *end, struct module *mod);
extern void apply_returns(s32 *start, s32 *end, struct module *mod);
extern void apply_seal_endbr(s32 *start, s32 *end, struct module *mod);
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
extern void apply_retpolines(s32 *start, s32 *end);
extern void apply_returns(s32 *start, s32 *end);
extern void apply_seal_endbr(s32 *start, s32 *end);
extern void apply_fineibt(s32 *start_retpoline, s32 *end_retpoine,
s32 *start_cfi, s32 *end_cfi, struct module *mod);
s32 *start_cfi, s32 *end_cfi);

struct module;

struct callthunk_sites {
s32 *call_start, *call_end;
Expand Down
16 changes: 2 additions & 14 deletions arch/x86/include/asm/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,9 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)

static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
{
#ifdef CONFIG_X86_KERNEL_IBT
u32 instr;

/* We want to be extra safe in case entry ip is on the page edge,
* but otherwise we need to avoid get_kernel_nofault()'s overhead.
*/
if ((fentry_ip & ~PAGE_MASK) < ENDBR_INSN_SIZE) {
if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE)))
return fentry_ip;
} else {
instr = *(u32 *)(fentry_ip - ENDBR_INSN_SIZE);
}
if (is_endbr(instr))
if (is_endbr((void*)(fentry_ip - ENDBR_INSN_SIZE)))
fentry_ip -= ENDBR_INSN_SIZE;
#endif

return fentry_ip;
}
#define ftrace_get_symaddr(fentry_ip) arch_ftrace_get_symaddr(fentry_ip)
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/include/asm/ibt.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static inline __attribute_const__ u32 gen_endbr_poison(void)
return 0x001f0f66; /* osp nopl (%rax) */
}

static inline bool is_endbr(u32 val)
static inline bool __is_endbr(u32 val)
{
if (val == gen_endbr_poison())
return true;
Expand All @@ -74,6 +74,7 @@ static inline bool is_endbr(u32 val)
return val == gen_endbr();
}

extern __noendbr bool is_endbr(u32 *val);
extern __noendbr u64 ibt_save(bool disable);
extern __noendbr void ibt_restore(u64 save);

Expand All @@ -98,7 +99,7 @@ extern __noendbr void ibt_restore(u64 save);

#define __noendbr

static inline bool is_endbr(u32 val) { return false; }
static inline bool is_endbr(u32 *val) { return false; }

static inline u64 ibt_save(bool disable) { return 0; }
static inline void ibt_restore(u64 save) { }
Expand Down
Loading