Skip to content

Commit deb6162

Browse files
committed
chore: update mmap series to v14
Update base series used for secret hiding CI kernels to be Fuad's v14 [1]. [1]: https://lore.kernel.org/kvm/[email protected]/ Signed-off-by: Patrick Roy <[email protected]>
1 parent fc1f6aa commit deb6162

File tree

46 files changed

+450
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+450
-302
lines changed

resources/hiding_ci/linux_patches/05-mmap-support/0001-KVM-Rename-CONFIG_KVM_PRIVATE_MEM-to-CONFIG_KVM_GMEM.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From fc57b8c1deda99bc1e64d45dd7f97a1b9259d16e Mon Sep 17 00:00:00 2001
1+
From 000264f8823f76fb6cf91dc40ace84a29a0fa089 Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:27 +0100
4-
Subject: [PATCH 01/45] KVM: Rename CONFIG_KVM_PRIVATE_MEM to CONFIG_KVM_GMEM
3+
Date: Tue, 15 Jul 2025 10:33:30 +0100
4+
Subject: [PATCH 01/46] KVM: Rename CONFIG_KVM_PRIVATE_MEM to CONFIG_KVM_GMEM
55

66
Rename the Kconfig option CONFIG_KVM_PRIVATE_MEM to CONFIG_KVM_GMEM. The
77
original name implied that the feature only supported "private" memory.
@@ -32,10 +32,10 @@ Signed-off-by: Fuad Tabba <[email protected]>
3232
6 files changed, 17 insertions(+), 17 deletions(-)
3333

3434
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
35-
index 639d9bcee842..66bdd0759d27 100644
35+
index f7af967aa16f..acb25f935d84 100644
3636
--- a/arch/x86/include/asm/kvm_host.h
3737
+++ b/arch/x86/include/asm/kvm_host.h
38-
@@ -2269,7 +2269,7 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
38+
@@ -2275,7 +2275,7 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
3939
int tdp_max_root_level, int tdp_huge_page_level);
4040

4141

@@ -137,10 +137,10 @@ index 724c89af78af..8d00918d4c8b 100644
137137
-kvm-$(CONFIG_KVM_PRIVATE_MEM) += $(KVM)/guest_memfd.o
138138
+kvm-$(CONFIG_KVM_GMEM) += $(KVM)/guest_memfd.o
139139
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
140-
index eec82775c5bf..898c3d5a7ba8 100644
140+
index 222f0e894a0c..d5f0ec2d321f 100644
141141
--- a/virt/kvm/kvm_main.c
142142
+++ b/virt/kvm/kvm_main.c
143-
@@ -4910,7 +4910,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
143+
@@ -4913,7 +4913,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
144144
case KVM_CAP_MEMORY_ATTRIBUTES:
145145
return kvm_supported_mem_attributes(kvm);
146146
#endif
@@ -149,7 +149,7 @@ index eec82775c5bf..898c3d5a7ba8 100644
149149
case KVM_CAP_GUEST_MEMFD:
150150
return !kvm || kvm_arch_has_private_mem(kvm);
151151
#endif
152-
@@ -5344,7 +5344,7 @@ static long kvm_vm_ioctl(struct file *filp,
152+
@@ -5347,7 +5347,7 @@ static long kvm_vm_ioctl(struct file *filp,
153153
case KVM_GET_STATS_FD:
154154
r = kvm_vm_ioctl_get_stats_fd(kvm);
155155
break;
@@ -180,5 +180,5 @@ index acef3f5c582a..ec311c0d6718 100644
180180

181181
#endif /* __KVM_MM_H__ */
182182
--
183-
2.49.0
183+
2.50.1
184184

resources/hiding_ci/linux_patches/05-mmap-support/0002-KVM-Rename-CONFIG_KVM_GENERIC_PRIVATE_MEM-to-CONFIG_.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 2ce4cc59bb3e067e019842870824d7a459d140f0 Mon Sep 17 00:00:00 2001
1+
From 05cf45cc4528079db3c40c021947ae0cc28eec82 Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:28 +0100
4-
Subject: [PATCH 02/45] KVM: Rename CONFIG_KVM_GENERIC_PRIVATE_MEM to
3+
Date: Tue, 15 Jul 2025 10:33:31 +0100
4+
Subject: [PATCH 02/46] KVM: Rename CONFIG_KVM_GENERIC_PRIVATE_MEM to
55
CONFIG_KVM_GENERIC_GMEM_POPULATE
66

77
The original name was vague regarding its functionality. This Kconfig
@@ -99,5 +99,5 @@ index b2aa6bf24d3a..befea51bbc75 100644
9999
kvm_gmem_populate_cb post_populate, void *opaque)
100100
{
101101
--
102-
2.49.0
102+
2.50.1
103103

resources/hiding_ci/linux_patches/05-mmap-support/0003-KVM-Introduce-kvm_arch_supports_gmem.patch

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 85b1525e138e76dd43f58e8b5cfd2f0f861ae6a6 Mon Sep 17 00:00:00 2001
1+
From fd6bbab2fcae663ac196e4c68c8bcd8393b99d6a Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:29 +0100
4-
Subject: [PATCH 03/45] KVM: Introduce kvm_arch_supports_gmem()
3+
Date: Tue, 15 Jul 2025 10:33:32 +0100
4+
Subject: [PATCH 03/46] KVM: Introduce kvm_arch_supports_gmem()
55

66
Introduce kvm_arch_supports_gmem() to explicitly indicate whether an
77
architecture supports guest_memfd.
@@ -30,10 +30,10 @@ Signed-off-by: Fuad Tabba <[email protected]>
3030
3 files changed, 16 insertions(+), 3 deletions(-)
3131

3232
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
33-
index 66bdd0759d27..09f4f6240d9d 100644
33+
index acb25f935d84..bde811b2d303 100644
3434
--- a/arch/x86/include/asm/kvm_host.h
3535
+++ b/arch/x86/include/asm/kvm_host.h
36-
@@ -2271,8 +2271,10 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
36+
@@ -2277,8 +2277,10 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
3737

3838
#ifdef CONFIG_KVM_GMEM
3939
#define kvm_arch_has_private_mem(kvm) ((kvm)->arch.has_private_mem)
@@ -44,7 +44,7 @@ index 66bdd0759d27..09f4f6240d9d 100644
4444
#endif
4545

4646
#define kvm_arch_has_readonly_mem(kvm) (!(kvm)->arch.has_protected_state)
47-
@@ -2325,7 +2327,7 @@ enum {
47+
@@ -2331,7 +2333,7 @@ enum {
4848
#define HF_SMM_INSIDE_NMI_MASK (1 << 2)
4949

5050
# define KVM_MAX_NR_ADDRESS_SPACES 2
@@ -76,7 +76,7 @@ index 359baaae5e9f..ab1bde048034 100644
7676
static inline bool kvm_arch_has_readonly_mem(struct kvm *kvm)
7777
{
7878
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
79-
index 898c3d5a7ba8..afbc025ce4d3 100644
79+
index d5f0ec2d321f..162e2a69cc49 100644
8080
--- a/virt/kvm/kvm_main.c
8181
+++ b/virt/kvm/kvm_main.c
8282
@@ -1588,7 +1588,7 @@ static int check_memory_region_flags(struct kvm *kvm,
@@ -88,7 +88,7 @@ index 898c3d5a7ba8..afbc025ce4d3 100644
8888
valid_flags |= KVM_MEM_GUEST_MEMFD;
8989

9090
/* Dirty logging private memory is not currently supported. */
91-
@@ -4912,7 +4912,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
91+
@@ -4915,7 +4915,7 @@ static int kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
9292
#endif
9393
#ifdef CONFIG_KVM_GMEM
9494
case KVM_CAP_GUEST_MEMFD:
@@ -98,5 +98,5 @@ index 898c3d5a7ba8..afbc025ce4d3 100644
9898
default:
9999
break;
100100
--
101-
2.49.0
101+
2.50.1
102102

resources/hiding_ci/linux_patches/05-mmap-support/0004-KVM-x86-Introduce-kvm-arch.supports_gmem.patch

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 50a700bdda054eaa3f86c79a1510a1d60325f2be Mon Sep 17 00:00:00 2001
1+
From 76851fca367e2d7666c3e709eab8cc016406f91b Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:30 +0100
4-
Subject: [PATCH 04/45] KVM: x86: Introduce kvm->arch.supports_gmem
3+
Date: Tue, 15 Jul 2025 10:33:33 +0100
4+
Subject: [PATCH 04/46] KVM: x86: Introduce kvm->arch.supports_gmem
55

66
Introduce a new boolean member, supports_gmem, to kvm->arch.
77

@@ -31,18 +31,18 @@ Signed-off-by: Fuad Tabba <[email protected]>
3131
4 files changed, 6 insertions(+), 3 deletions(-)
3232

3333
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
34-
index 09f4f6240d9d..ebddedf0a1f2 100644
34+
index bde811b2d303..938b5be03d33 100644
3535
--- a/arch/x86/include/asm/kvm_host.h
3636
+++ b/arch/x86/include/asm/kvm_host.h
37-
@@ -1342,6 +1342,7 @@ struct kvm_arch {
37+
@@ -1348,6 +1348,7 @@ struct kvm_arch {
3838
u8 mmu_valid_gen;
3939
u8 vm_type;
4040
bool has_private_mem;
4141
+ bool supports_gmem;
4242
bool has_protected_state;
4343
bool pre_fault_allowed;
4444
struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
45-
@@ -2271,7 +2272,7 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
45+
@@ -2277,7 +2278,7 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level,
4646

4747
#ifdef CONFIG_KVM_GMEM
4848
#define kvm_arch_has_private_mem(kvm) ((kvm)->arch.has_private_mem)
@@ -64,10 +64,10 @@ index ab9b947dbf4f..d1c484eaa8ad 100644
6464
}
6565

6666
diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
67-
index 1ad20c273f3b..c227516e6a02 100644
67+
index f31ccdeb905b..a3db6df245ee 100644
6868
--- a/arch/x86/kvm/vmx/tdx.c
6969
+++ b/arch/x86/kvm/vmx/tdx.c
70-
@@ -625,6 +625,7 @@ int tdx_vm_init(struct kvm *kvm)
70+
@@ -632,6 +632,7 @@ int tdx_vm_init(struct kvm *kvm)
7171

7272
kvm->arch.has_protected_state = true;
7373
kvm->arch.has_private_mem = true;
@@ -76,10 +76,10 @@ index 1ad20c273f3b..c227516e6a02 100644
7676

7777
/*
7878
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
79-
index a9d992d5652f..b34236029383 100644
79+
index 357b9e3a6cef..adbdc2cc97d4 100644
8080
--- a/arch/x86/kvm/x86.c
8181
+++ b/arch/x86/kvm/x86.c
82-
@@ -12778,8 +12778,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
82+
@@ -12780,8 +12780,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
8383
return -EINVAL;
8484

8585
kvm->arch.vm_type = type;
@@ -91,5 +91,5 @@ index a9d992d5652f..b34236029383 100644
9191
kvm->arch.pre_fault_allowed =
9292
type == KVM_X86_DEFAULT_VM || type == KVM_X86_SW_PROTECTED_VM;
9393
--
94-
2.49.0
94+
2.50.1
9595

resources/hiding_ci/linux_patches/05-mmap-support/0005-KVM-Rename-kvm_slot_can_be_private-to-kvm_slot_has_g.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From c16d4a48f6fbad7bdb9024c1c91c38b6d9bdc4e8 Mon Sep 17 00:00:00 2001
1+
From a56ba2f9a2ec7436126f23997e502543e0e4bbe0 Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:31 +0100
4-
Subject: [PATCH 05/45] KVM: Rename kvm_slot_can_be_private() to
3+
Date: Tue, 15 Jul 2025 10:33:34 +0100
4+
Subject: [PATCH 05/46] KVM: Rename kvm_slot_can_be_private() to
55
kvm_slot_has_gmem()
66

77
Rename kvm_slot_can_be_private() to kvm_slot_has_gmem() to improve
@@ -54,10 +54,10 @@ index 4e06e2e89a8f..213904daf1e5 100644
5454
return -EFAULT;
5555
}
5656
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
57-
index 459c3b791fd4..ade7a5b36c68 100644
57+
index b201f77fcd49..687392c5bf5d 100644
5858
--- a/arch/x86/kvm/svm/sev.c
5959
+++ b/arch/x86/kvm/svm/sev.c
60-
@@ -2319,7 +2319,7 @@ static int snp_launch_update(struct kvm *kvm, struct kvm_sev_cmd *argp)
60+
@@ -2323,7 +2323,7 @@ static int snp_launch_update(struct kvm *kvm, struct kvm_sev_cmd *argp)
6161
mutex_lock(&kvm->slots_lock);
6262

6363
memslot = gfn_to_memslot(kvm, params.gfn_start);
@@ -66,7 +66,7 @@ index 459c3b791fd4..ade7a5b36c68 100644
6666
ret = -EINVAL;
6767
goto out;
6868
}
69-
@@ -4670,7 +4670,7 @@ void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code)
69+
@@ -4678,7 +4678,7 @@ void sev_handle_rmp_fault(struct kvm_vcpu *vcpu, gpa_t gpa, u64 error_code)
7070
}
7171

7272
slot = gfn_to_memslot(kvm, gfn);
@@ -102,5 +102,5 @@ index befea51bbc75..6db515833f61 100644
102102

103103
file = kvm_gmem_get_file(slot);
104104
--
105-
2.49.0
105+
2.50.1
106106

resources/hiding_ci/linux_patches/05-mmap-support/0006-KVM-Fix-comments-that-refer-to-slots_lock.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 4e0120bc233422b398683f708873242163972916 Mon Sep 17 00:00:00 2001
1+
From ffbe742826fa64c4af474398ce274b58338f3e48 Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:32 +0100
4-
Subject: [PATCH 06/45] KVM: Fix comments that refer to slots_lock
3+
Date: Tue, 15 Jul 2025 10:33:35 +0100
4+
Subject: [PATCH 06/46] KVM: Fix comments that refer to slots_lock
55

66
Fix comments so that they refer to slots_lock instead of slots_locks
77
(remove trailing s).
@@ -31,7 +31,7 @@ index ed00c2b40e4b..9c654dfb6dce 100644
3131
#endif
3232
char stats_id[KVM_STATS_NAME_SIZE];
3333
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
34-
index afbc025ce4d3..81bb18fa8655 100644
34+
index 162e2a69cc49..46bddac1dacd 100644
3535
--- a/virt/kvm/kvm_main.c
3636
+++ b/virt/kvm/kvm_main.c
3737
@@ -331,7 +331,7 @@ void kvm_flush_remote_tlbs_memslot(struct kvm *kvm,
@@ -44,5 +44,5 @@ index afbc025ce4d3..81bb18fa8655 100644
4444
*/
4545
lockdep_assert_held(&kvm->slots_lock);
4646
--
47-
2.49.0
47+
2.50.1
4848

resources/hiding_ci/linux_patches/05-mmap-support/0007-KVM-Fix-comment-that-refers-to-kvm-uapi-header-path.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From b9cc809ebdf2e73ebdd42300d3d1b0702aed3d21 Mon Sep 17 00:00:00 2001
1+
From 2b0fd6a86bfa830aee045aaab2cd21616ee2df7d Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:33 +0100
4-
Subject: [PATCH 07/45] KVM: Fix comment that refers to kvm uapi header path
3+
Date: Tue, 15 Jul 2025 10:33:36 +0100
4+
Subject: [PATCH 07/46] KVM: Fix comment that refers to kvm uapi header path
55

66
The comment that points to the path where the user-visible memslot flags
77
are refers to an outdated path and has a typo.
@@ -31,5 +31,5 @@ index 9c654dfb6dce..1ec71648824c 100644
3131
#define KVM_MEMSLOT_INVALID (1UL << 16)
3232

3333
--
34-
2.49.0
34+
2.50.1
3535

resources/hiding_ci/linux_patches/05-mmap-support/0008-KVM-guest_memfd-Allow-host-to-map-guest_memfd-pages.patch

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 58c6400113b15dce2c25f61927c0572e85c497c4 Mon Sep 17 00:00:00 2001
1+
From 86e455716787a2e9361fb48458d38f5731e8666c Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:34 +0100
4-
Subject: [PATCH 08/45] KVM: guest_memfd: Allow host to map guest_memfd pages
3+
Date: Tue, 15 Jul 2025 10:33:37 +0100
4+
Subject: [PATCH 08/46] KVM: guest_memfd: Allow host to map guest_memfd pages
55

66
Introduce the core infrastructure to enable host userspace to mmap()
77
guest_memfd-backed memory. This is needed for several evolving KVM use
@@ -96,10 +96,10 @@ index 1ec71648824c..9ac21985f3b5 100644
9696
static inline bool kvm_arch_has_readonly_mem(struct kvm *kvm)
9797
{
9898
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
99-
index 37891580d05d..c71348db818f 100644
99+
index 7a4c35ff03fe..3beafbf306af 100644
100100
--- a/include/uapi/linux/kvm.h
101101
+++ b/include/uapi/linux/kvm.h
102-
@@ -1592,6 +1592,7 @@ struct kvm_memory_attributes {
102+
@@ -1596,6 +1596,7 @@ struct kvm_memory_attributes {
103103
#define KVM_MEMORY_ATTRIBUTE_PRIVATE (1ULL << 3)
104104

105105
#define KVM_CREATE_GUEST_MEMFD _IOWR(KVMIO, 0xd4, struct kvm_create_guest_memfd)
@@ -212,5 +212,5 @@ index 6db515833f61..07a4b165471d 100644
212212
return -EINVAL;
213213

214214
--
215-
2.49.0
215+
2.50.1
216216

resources/hiding_ci/linux_patches/05-mmap-support/0009-KVM-guest_memfd-Track-guest_memfd-mmap-support-in-me.patch

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From e841f1cf86506f567df73da1a9429fe8586f90a5 Mon Sep 17 00:00:00 2001
1+
From 09759854a3fbd70fc5c8c1f44da8c11c12cd3ac2 Mon Sep 17 00:00:00 2001
22
From: Fuad Tabba <[email protected]>
3-
Date: Wed, 9 Jul 2025 11:59:35 +0100
4-
Subject: [PATCH 09/45] KVM: guest_memfd: Track guest_memfd mmap support in
3+
Date: Tue, 15 Jul 2025 10:33:38 +0100
4+
Subject: [PATCH 09/46] KVM: guest_memfd: Track guest_memfd mmap support in
55
memslot
66

77
Add a new internal flag, KVM_MEMSLOT_GMEM_ONLY, to the top half of
@@ -16,6 +16,7 @@ information directly in the memslot, we reduce overhead and simplify the
1616
logic involved in handling guest_memfd-backed pages for host mappings.
1717

1818
Reviewed-by: Gavin Shan <[email protected]>
19+
Reviewed-by: Shivank Garg <[email protected]>
1920
Acked-by: David Hildenbrand <[email protected]>
2021
Suggested-by: David Hildenbrand <[email protected]>
2122
Signed-off-by: Fuad Tabba <[email protected]>
@@ -67,5 +68,5 @@ index 07a4b165471d..2b00f8796a15 100644
6768
xa_store_range(&gmem->bindings, start, end - 1, slot, GFP_KERNEL);
6869
filemap_invalidate_unlock(inode->i_mapping);
6970
--
70-
2.49.0
71+
2.50.1
7172

0 commit comments

Comments
 (0)