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: <20240609154945.55332-18-nsaenz@amazon.com>
Date: Sun, 9 Jun 2024 15:49:46 +0000
From: Nicolas Saenz Julienne <nsaenz@...zon.com>
To: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>
CC: <pbonzini@...hat.com>, <seanjc@...gle.com>, <vkuznets@...hat.com>,
	<linux-doc@...r.kernel.org>, <linux-hyperv@...r.kernel.org>,
	<linux-arch@...r.kernel.org>, <linux-trace-kernel@...r.kernel.org>,
	<graf@...zon.de>, <dwmw2@...radead.org>, <paul@...zon.com>,
	<nsaenz@...zon.com>, <mlevitsk@...hat.com>, <jgowans@...zon.com>,
	<corbet@....net>, <decui@...rosoft.com>, <tglx@...utronix.de>,
	<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>,
	<x86@...nel.org>, <amoorthy@...gle.com>
Subject: [PATCH 17/18] KVM: Introduce traces to track memory attributes modification.

Introduce traces that track memory attributes modification.

Signed-off-by: Nicolas Saenz Julienne <nsaenz@...zon.com>
---
 include/trace/events/kvm.h | 20 ++++++++++++++++++++
 virt/kvm/kvm_main.c        |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 74e40d5d4af42..aa6caeb16f12a 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -489,6 +489,26 @@ TRACE_EVENT(kvm_test_age_hva,
 	TP_printk("mmu notifier test age hva: %#016lx", __entry->hva)
 );
 
+TRACE_EVENT(kvm_vm_set_mem_attributes,
+	TP_PROTO(u64 start, u64 cnt, u64 attributes),
+	TP_ARGS(start, cnt, attributes),
+
+	TP_STRUCT__entry(
+		__field(	u64,	start		)
+		__field(	u64,	cnt		)
+		__field(	u64,	attributes	)
+	),
+
+	TP_fast_assign(
+		__entry->start		= start;
+		__entry->cnt		= cnt;
+		__entry->attributes	= attributes;
+	),
+
+	TP_printk("gfn 0x%llx, cnt 0x%llx, attributes 0x%llx",
+		  __entry->start, __entry->cnt, __entry->attributes)
+);
+
 #endif /* _TRACE_KVM_MAIN_H */
 
 /* This part must be outside protection */
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index bd27fc01e9715..1c493ece3deb1 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2556,6 +2556,8 @@ static int kvm_vm_set_mem_attributes(struct kvm *kvm, gfn_t start, gfn_t end,
 
 	kvm_handle_gfn_range(kvm, &post_set_range);
 
+	trace_kvm_vm_set_mem_attributes(start, end - start, attributes);
+
 out_unlock:
 	mutex_unlock(&kvm->slots_lock);
 
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ