Skip to content

kvm: use anon_inode_getfd() with O_CLOEXEC flag

Yann Droneaud kvm kvm-ppc linuxppc-dev lkml 1 version Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2kvm: use anon_inode_getfd() with O_CLOEXEC flagvirt/kvm/kvm_main.c+3 -31 reply
2/2ppc: kvm: use anon_inode_getfd() with O_CLOEXEC flagarch/powerpc/kvm/book3s_64_mmu_hv.c arch/powerpc/kvm/book3s_64_vio.c arch/powerpc/kvm/book3s_hv.c+3 -34 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchPaolo BonziniAlexander Graf
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 v1 thread

Cover letter [PATCH 0/2] kvm: use anon_inode_getfd() with O_CLOEXEC flag

Hi,

Following a patchset asking to change calls to get_unused_flag() [1] to use O_CLOEXEC, Alex Williamson [2][3] decided to change VFIO to use the flag.

Since it's a related subsystem to KVM, using O_CLOEXEC for file descriptors created by KVM might be applicable too.

I'm suggesting to change calls to anon_inode_getfd() to use O_CLOEXEC as default flag.

This patchset should be reviewed to not break existing userspace program.

BTW, if it's not applicable, I would suggest that new ioctls be added to KVM subsystem, those ioctls would have a "flag" field added to their arguments. Such "flag" would let userspace choose the open flag to use.
See for example other APIs using anon_inode_getfd() such as fanotify, inotify, signalfd and timerfd.

You might be interested to read:

- Secure File Descriptor Handling (Ulrich Drepper, 2008)
http://udrepper.livejournal.com/20407.html

- Excuse me son, but your code is leaking !!! (Dan Walsh, March 2012)
http://danwalsh.livejournal.com/53603.html

Regards.

[1] http://lkml.kernel.org/r/[email protected]
[2] http://lkml.kernel.org/r/[email protected]
[3] http://lkml.kernel.org/r/[email protected]

Yann Droneaud (2):
kvm: use anon_inode_getfd() with O_CLOEXEC flag
ppc: kvm: use anon_inode_getfd() with O_CLOEXEC flag

 arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 +-
 arch/powerpc/kvm/book3s_64_vio.c    | 2 +-
 arch/powerpc/kvm/book3s_hv.c        | 2 +-
 virt/kvm/kvm_main.c                 | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1