read_guest_lc(9)
π read_guest_lc(9) β like, the whole page, bestie
okay so this is read_guest_lc, straight out of the Kernel API Manual (read_guest_lc(9), section 9, we're in kernel-dev land now π§). Sit down, grab a strawberry drink π, we're copying bytes out of a guest vcpu's lowcore and we're gonna do it correctly.
β¨ NAME β¨
read_guest_lc β copies data from a guest vcpu's lowcore over into kernel space. that's the whole vibe, no cap π
πΈ SYNOPSIS πΈ
int read_guest_lc (struct kvm_vcpu *vcpu , unsigned long gra , void
*data , unsigned long len );
like yes she's a little chunky but she's iconic, we stan a four-argument function π«Ά
π ARGUMENTS π
vcpuβ the virtual cpu. the main character, literally πgraβ the vcpu's source guest real address. where we're reading FROM, bestie β¨dataβ the destination address, and it lives in kernel space. that's where the bytes are going π¦lenβ number of bytes to copy. the size, the amount, the quantity, you get it π
π₯ DESCRIPTION π₯
So what she actually does: she copies data from the guest vcpu's lowcore into kernel space. Simple, cute, slay.
β οΈ BUT β and this is the part you cannot skip β the entire range must be located within the vcpu's lowcore. If it isn't? the result is undefined. not "an error", not "a warning", undefined, which is the β¨worstβ¨ kind of surprise. do not test her. π
Returns zero on success, or -EFAULT on error. that's it, that's the return contract π
π NOTE π
listen up, this matters: an error here means either the kernel is out of memory, or the guest memory mapping is broken. either way π«
The best solution would be to terminate the guest.
And to be so fr fr: it is wrong to inject a guest exception. do not do that. don't be that person. π ββοΈ
β SEE ALSO β
Kernel file ./arch/s390/kvm/s390/gaccess.h, plus the whole friend group:
kvm_s390_real_to_abs(9)_kvm_s390_logical_to_effective(9)kvm_s390_logical_to_effective(9)put_guest_lc(9)write_guest_lc(9)write_guest_with_key(9)write_guest(9)read_guest_with_key(9)read_guest(9)read_guest_instr(9)write_guest_abs(9)read_guest_abs(9)write_guest_real(9)read_guest_real(9)
and that's the page!! mwah π this one lives in ./arch/s390/kvm/s390 and the date on the tin says October 2026 β go read her siblings, they're all in the SEE ALSO up there. byeeeee π¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms