read_guest_lc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:


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