s390_replace_asce(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… s390_replace_asce(9) β€” the Kernel API Manual page, but make it make sense πŸŽ€

okay so bestie, you're in the Kernel API Manual and this is the page for s390_replace_asce. it's a little s390-specific number and honestly she's doing a lot, so let's get into it ✨


🌸 SYNOPSIS 🌸

int s390_replace_asce (struct gmap *gmap );

πŸ’– ARGUMENTS πŸ’–

  • gmap β€” the gmap whose ASCE needs to be replaced. that's her. that's the one. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the whole vibe πŸ‘‘

if the ASCE is a SEGMENT type, this function will return -EINVAL. no exceptions, no slay. and like, that check is load-bearing, because otherwise the pointers in the host_to_guest radix tree would keep pointing at the wrong pages β€” and that is use-after-free and memory corruption territory πŸ˜­πŸ’€ we do not want that fr fr.

if the allocation of the new top level page table fails, then the ASCE just doesn't get replaced. that's it, that's the outcome. no memory, no new ASCE, stay in your lane.

and here's the part you really need to clock πŸ‘€: in any case, the old ASCE is always removed from the gmap CRST list. like, whether it works out or not, she's off the list. so the caller has to make sure to save a pointer to it beforehand β€” unless a leak is actually what you intended, in which case, um, live your truth I guess πŸ™ˆ

⚠️ bestie please save that pointer. the old ASCE leaves the CRST list no matter what, and if you didn't keep a reference you're gonna have a bad time.

⭐ RETURN ⭐

  • 0 β€” success, we ate πŸ’…
  • -EINVAL β€” the ASCE is segment type ASCE 🚫
  • -ENOMEM β€” running out of memory 😭

πŸŽ€ SEE ALSO πŸŽ€

kernel file ./arch/s390/kvm/gmap/gmap.c and honestly the whole friend group: gmap_new(9), gmap_dispose(9), gmap_age_gfn(9), gmap_unmap_gfn_range(9), gmap_try_fixup_minor(9), gmap_2g_allowed(9), gmap_1m_allowed(9), gmap_ucas_translate(9), gmap_find_shadow(9), gmap_create_shadow(9) 🌈


that's the whole page bestie, no cap πŸ’œ this one lives in ./arch/s390/kvm/gmap and the version/date vibes are October 2026 β€” see you in the next one, mwah πŸ“πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from