]> granicus.if.org Git - strace/commitdiff
ioctl: add a stub for decoding kvm related ioctls
authorMasatake YAMATO <yamato@redhat.com>
Fri, 1 Dec 2017 19:05:25 +0000 (04:05 +0900)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 1 Dec 2017 22:27:01 +0000 (22:27 +0000)
* 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>
Makefile.am
configure.ac
defs.h
ioctl.c
kvm.c [new file with mode: 0644]

index 2586a3e0234e9fd5220c7c7962087eff37251716..603760568eaac88b64d7959f31d6536c2b7159d0 100644 (file)
@@ -166,6 +166,7 @@ strace_SOURCES =    \
        kexec.c         \
        keyctl.c        \
        keyctl_kdf_params.h \
+       kvm.c \
        ldt.c           \
        link.c          \
        linux/asm_stat.h \
index 2fc45b76a80d4afc78e511592a589da8e899eaf6..fa451d84fc97f4526ca6c4c47b7d209e064d7fe0 100644 (file)
@@ -395,6 +395,7 @@ AC_CHECK_HEADERS(m4_normalize([
        linux/ip_vs.h
        linux/ipc.h
        linux/kcmp.h
+       linux/kvm.h
        linux/memfd.h
        linux/mmtimer.h
        linux/msg.h
diff --git a/defs.h b/defs.h
index b1a6b95519ab2f70c887a227bafd6d8df4b4180a..0187863ea2307e2ba0ae8c694394fcb0aff67656 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -658,6 +658,7 @@ name ## _ioctl(struct tcb *, unsigned int request, kernel_ulong_t arg)      \
 DECL_IOCTL(dm);
 DECL_IOCTL(file);
 DECL_IOCTL(fs_x);
+DECL_IOCTL(kvm);
 DECL_IOCTL(nsfs);
 DECL_IOCTL(ptp);
 DECL_IOCTL(scsi);
diff --git a/ioctl.c b/ioctl.c
index b61a5be5c464cd28a38e744dabce8235cb2c5a91..35485172c288d9c93ee355c0a2bac09d7840f89c 100644 (file)
--- a/ioctl.c
+++ b/ioctl.c
@@ -313,6 +313,10 @@ ioctl_decode(struct tcb *tcp)
 #ifdef HAVE_LINUX_DM_IOCTL_H
        case 0xfd:
                return dm_ioctl(tcp, code, arg);
+#endif
+#ifdef HAVE_LINUX_KVM_H
+       case 0xae:
+               return kvm_ioctl(tcp, code, arg);
 #endif
        default:
                break;
diff --git a/kvm.c b/kvm.c
new file mode 100644 (file)
index 0000000..2917bbc
--- /dev/null
+++ b/kvm.c
@@ -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 */