Skip to content

xen/privcmd: prevent page migration for hypercall buffers

David Vrabel xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 8 repliesIn review
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Addressed Jan's feedback for #2 (see patch for details).

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2xen/prvicmd: use ENOTTY if the IOCTL is not supporteddrivers/xen/privcmd.c+1 -11 reply
2/2xen/privcmd: add ioctls for locking/unlocking hypercall buffersdrivers/xen/privcmd.c include/uapi/xen/privcmd.h+254 -04 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJan BeulichJuergen Gross
SeriesA-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCHv2 0/2] xen/privcmd: prevent page migration for hypercall buffers

Currently libxencall using mlocked buffers for hypercall buffers. This pages are subject to compaction and page migration. A userspace process may see a hypercall fail with -EFAULT if a page backing a hypercall buffer is in the process of being migrated.

Page migration can be prevented by taking an additional reference to the page.

There are three possible ways to do this:

1. Add a new device which when mmap()'d populated the VMA with suitable memory that has an additional reference. This would give VMAs that have appropriate properties set (e.g., VM_DONTCOPY) without having to do additional madvise() calls.

2. Add a new ioctl to privcmd to populate a VMA with suitably ref-counted pages. However, mmap() on privcmd is already used for foreign mappings and the VMA properties for hypercall buffers and foreign mappings might need to be different and the handling of unmap will need to be different. This might be tricky.

3. Add a pair of ioctls to privcmd to lock/unlock a buffer by getting/putting an additional reference to the page. This is what's implemented in this series.

Any thoughts on which is the best approach?

Changes in v2:
- Addressed Jan's feedback for #2 (see patch for details).

David

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel