ioctl: add a stub for decoding kvm related ioctls

* kvm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Add linux/kvm.h.
* defs.h (kvm_ioctl): New prototype.
* ioctl.c (ioctl_decode) HAVE_LINUX_KVM_H]: Use kvm_ioctl.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
This commit is contained in:
Masatake YAMATO 2017-12-02 04:05:25 +09:00 committed by Dmitry V. Levin
parent b053dd53ed
commit 3f20fe4a30
5 changed files with 52 additions and 0 deletions

View File

@ -166,6 +166,7 @@ strace_SOURCES = \
kexec.c \ kexec.c \
keyctl.c \ keyctl.c \
keyctl_kdf_params.h \ keyctl_kdf_params.h \
kvm.c \
ldt.c \ ldt.c \
link.c \ link.c \
linux/asm_stat.h \ linux/asm_stat.h \

View File

@ -395,6 +395,7 @@ AC_CHECK_HEADERS(m4_normalize([
linux/ip_vs.h linux/ip_vs.h
linux/ipc.h linux/ipc.h
linux/kcmp.h linux/kcmp.h
linux/kvm.h
linux/memfd.h linux/memfd.h
linux/mmtimer.h linux/mmtimer.h
linux/msg.h linux/msg.h

1
defs.h
View File

@ -658,6 +658,7 @@ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg) \
DECL_IOCTL(dm); DECL_IOCTL(dm);
DECL_IOCTL(file); DECL_IOCTL(file);
DECL_IOCTL(fs_x); DECL_IOCTL(fs_x);
DECL_IOCTL(kvm);
DECL_IOCTL(nsfs); DECL_IOCTL(nsfs);
DECL_IOCTL(ptp); DECL_IOCTL(ptp);
DECL_IOCTL(scsi); DECL_IOCTL(scsi);

View File

@ -313,6 +313,10 @@ ioctl_decode(struct tcb *tcp)
#ifdef HAVE_LINUX_DM_IOCTL_H #ifdef HAVE_LINUX_DM_IOCTL_H
case 0xfd: case 0xfd:
return dm_ioctl(tcp, code, arg); return dm_ioctl(tcp, code, arg);
#endif
#ifdef HAVE_LINUX_KVM_H
case 0xae:
return kvm_ioctl(tcp, code, arg);
#endif #endif
default: default:
break; break;

45
kvm.c Normal file
View File

@ -0,0 +1,45 @@
/*
* Support for decoding of KVM_* ioctl commands.
*
* Copyright (c) 2017 Masatake YAMATO <yamato@redhat.com>
* Copyright (c) 2017 Red Hat, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#ifdef HAVE_LINUX_KVM_H
# include <linux/kvm.h>
int
kvm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
{
switch (code) {
default:
return RVAL_DECODED;
}
}
#endif /* HAVE_LINUX_KVM_H */