lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1324013528-3663-2-git-send-email-zanghongyong@huawei.com>
Date:	Fri, 16 Dec 2011 13:32:07 +0800
From:	zanghongyong@...wei.com
To:	linux-kernel@...r.kernel.org
Cc:	mst@...hat.com, levinsasha928@...il.com, kvm@...r.kernel.org,
	virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
	xiaowei.yang@...wei.com, hanweidong@...wei.com,
	wusongwei@...wei.com, Hongyong Zang <zanghongyong@...wei.com>
Subject: [PATCH 1/2] kvm: Introduce get_kvm_from_task

From: Hongyong Zang <zanghongyong@...wei.com>

This function finds the kvm structure from its corresponding user
space process, such as qemu process.

Signed-off-by: Hongyong Zang <zanghongyong@...wei.com>
---
 include/linux/kvm_host.h |    2 +-
 virt/kvm/kvm_main.c      |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 8c5c303..1b2f027 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -801,4 +801,4 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
 }
 
 #endif
-
+struct kvm *get_kvm_from_task(struct task_struct *task);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e289486..458fe29 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2664,6 +2664,19 @@ static const struct file_operations *stat_fops[] = {
 	[KVM_STAT_VM]   = &vm_stat_fops,
 };
 
+struct kvm* get_kvm_from_task(struct task_struct *task)
+{
+        struct kvm *kvm;
+
+        list_for_each_entry(kvm, &vm_list, vm_list) {
+                if(kvm->mm == task->mm)
+                    return kvm;
+        }
+
+        return NULL;
+}
+EXPORT_SYMBOL_GPL(get_kvm_from_task);
+
 static void kvm_init_debug(void)
 {
 	struct kvm_stats_debugfs_item *p;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ