lib: s390: fix guest length in uv_create_guest()
PATCH 1/1 lib: s390: fix guest length in uv_create_guest()
The current code creates secure guests with significantly more memory than expected, but since none of that memory is ever touched, everything still works.
Fix the issue by specifying the actual guest length.
The MSL does not contain the length of the guest, but the address of the last 1M block of guest memory. In order to get the length, MSO needs to be subtracted, and 1M needs to be added.
--- lib/s390x/uv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/s390x/uv.c +1 -1
@@ -146,7 +146,7 @@ void uv_create_guest(struct vm *vm)int cc; uvcb_cgc.guest_stor_origin = vm->sblk->mso; - uvcb_cgc.guest_stor_len = vm->sblk->msl; + uvcb_cgc.guest_stor_len = vm->sblk->msl - vm->sblk->mso +SZ_1M ;/* Config allocation */ vsize = uvcb_qui.conf_base_virt_stor_len +
Signature · 1 line
2.44.0
Quoting Claudio Imbrenda (2024-04-18 13:01:40)
Quoted 11 lines
The current code creates secure guests with significantly more memory than expected, but since none of that memory is ever touched, everything still works.
Fix the issue by specifying the actual guest length.
The MSL does not contain the length of the guest, but the address of the last 1M block of guest memory. In order to get the length, MSO needs to be subtracted, and 1M needs to be added.
Signed-off-by Claudio Imbrenda <[email protected]>
Nico Boehr
AppliedQuoting Claudio Imbrenda (2024-04-18 13:01:40)
Quoted 11 lines
The current code creates secure guests with significantly more memory than expected, but since none of that memory is ever touched, everything still works.
Fix the issue by specifying the actual guest length.
The MSL does not contain the length of the guest, but the address of the last 1M block of guest memory. In order to get the length, MSO needs to be subtracted, and 1M needs to be added.
Signed-off-by Claudio Imbrenda <[email protected]>
Pushed to CI and queued, thanks.