ensure_nib_shared(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ensure_nib_shared(9) β€” the kernel API manual, bestie edition

okay so this whole page lives in the Kernel API Manual and it's literally all about ensure_nib_shared(9). buckle up πŸŽ€


✨ NAME ✨

ensure_nib_shared β€” bestie, it makes sure the address of the NIB is secure and shared. that's the whole vibe check πŸ”₯


🌸 SYNOPSIS 🌸

int ensure_nib_shared (unsigned long addr );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • addr β€” the physical (absolute) address of the NIB. like, the actual literal address, not a vibe. πŸ“

πŸ’– DESCRIPTION πŸ’–

so this function checks whether the NIB page β€” which has been pinned with vfio_pin_pages β€” is a shared page belonging to a secure guest. πŸ‘‘

it will call uv_pin_shared on it. and if the page was already pinned shared (i.e. if the NIB belongs to a secure guest and is shared), then 0 (success) is returned. slay. ✨

but if the NIB was not shared, then vfio_pin_pages had exported it and now it does not belong to the secure guest anymore 😭 in that case, an error is returned. no cap, that's the sad path.


🫢 CONTEXT 🫢

the NIB (at physical address addr) has to be pinned with vfio_pin_pages before calling this function. like, do the pinning first, then come talk to me. πŸ’…

fr fr bestie, pinned first or this whole thing is giving undefined chaos πŸ™ˆ

⭐ RETURN ⭐

0 in case of success, otherwise an error < 0. that's it, that's the whole report card. πŸ’€


🌈 SEE ALSO 🌈

kernel file ./drivers/s390/crypto/vfio_ap_ops.c β€” go read the source, iykyk πŸ“–


okay and for the cute sign-off πŸŽ€: this whole thing comes from the kernel file ./drivers/s390/crypto, dated October 2026, and it's filed under ensure_nib_shared(9). mwah, go pin some pages bestie πŸ’œπŸ§š

πŸ“¦ where this page comes from