Skip to content

Fix wild/dangling pointer in x86 ptp_kvm

Zelin Deng kvm stable 1 version Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2x86/kvmclock: Move this_cpu_pvti into kvmclock.harch/x86/include/asm/kvmclock.h arch/x86/kernel/kvmclock.c+16 -110 replies
2/2ptp: Fix ptp_kvm_getcrosststamp issue for x86 ptp_kvmdrivers/ptp/ptp_kvm_x86.c+2 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Fix wild/dangling pointer in x86 ptp_kvm

When I was doing PTP_SYS_OFFSET_PRECISE ioctl in VM which has 128 vCPUs, I got error returned occasionally. Then I checked the routine of "getcrosststamp". I found in kvm_arch_ptp_get_crosststamp() of x86, pvclock vcpu time info was got from hv_clock arrary which has only 64 elements. Hence this ioctl is executed on vCPU > 64, a wild/dangling pointer will be got, which had casued the error.
To confirm this finding, I wrote a simple PTP_SYS_OFFSET_PRECISE ioctl test and used "taskset -c n" to run the test, when it was executed on vCPUs >= 64 it returned error.
This patchset exposes this_cpu_pvti() to get per cpu pvclock vcpu time info of vCPUs >= 64 insdead of getting them from hv_clock arrary.

Zelin Deng (2):
x86/kvmclock: Move this_cpu_pvti into kvmclock.h
ptp: Fix ptp_kvm_getcrosststamp issue for x86 ptp_kvm

 arch/x86/include/asm/kvmclock.h | 14 ++++++++++++++
 arch/x86/kernel/kvmclock.c      | 13 ++-----------
 drivers/ptp/ptp_kvm_x86.c       |  9 ++-------
 3 files changed, 18 insertions(+), 18 deletions(-)
Signature · 1 line
1.8.3.1