STRUCT TEE_SHM(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– struct tee_shm โ€” the shared memory glow-up ๐Ÿ’–

okay so this is a page from the Kernel API Manual (section 9, kernel land, very demure very mindful) and it's literally all about struct tee_shm โ€” the shared memory object. it's giving "the thing that holds your bytes when the normal world and the secure world need to pass notes in class" โœจ


๐ŸŒธ NAME ๐ŸŒธ

struct tee_shm โ€” shared memory object. that's it. that's the whole name. iconic behavior honestly ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

here's the whole struct, bestie, copied exactly, do not touch:

struct tee_shm {
    struct tee_context *ctx;
    phys_addr_t paddr;
    void *kaddr;
    size_t size;
    unsigned int offset;
    struct page **pages;
    size_t num_pages;
    refcount_t refcount;
    u32 flags;
    int id;
    u64 sec_world_id;
 };

look at her. eleven fields, all main character energy ๐Ÿ‘‘


โœจ Members โœจ

okay so now we go member by member, no skipping, i don't make the rules (i do, actually, and the rule is keep every detail):

  • ctx โ€” the context using the object. like, whose vibe is this shm attached to ๐Ÿซถ
  • paddr โ€” physical address of the shared memory. the real-real address, ngl ๐Ÿ“
  • kaddr โ€” virtual address of the shared memory. the kernel's own little view of it ๐Ÿ’œ
  • size โ€” size of shared memory. how much room we're working with, periodt ๐Ÿ“
  • offset โ€” offset of buffer in user space. where the good stuff actually starts ๐Ÿ™ˆ
  • pages โ€” locked pages from userspace. they're pinned down and they're staying put ๐Ÿ”’
  • num_pages โ€” number of locked pages. gotta count 'em ๐Ÿงฎ
  • refcount โ€” reference counter. classic. keeps track of how many people are holding on ๐ŸŒˆ
  • flags โ€” defined by TEE_SHM_* in tee_core.h. go look at the header, i'm not doing your homework for you ๐Ÿ’…
  • id โ€” unique id of a shared memory object on this device, shared with user space. yes, user space gets to see this one, it's a whole collab ๐Ÿค
  • sec_world_id โ€” secure world assigned id of this shared memory object, not used by all drivers. lowkey not every driver bothers with it, so don't assume ๐Ÿ”ฅ
fr fr: sec_world_id is not used by all drivers โ€” so don't go reading it and acting surprised if it's not what you expected. that's on you bestie ๐Ÿ˜ญ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

the whole friend group, all linked in Kernel file ./include/linux/tee_drv.h:

like, that's the whole squad, go read them all, i'll wait ๐Ÿ“


and that's the page!! shipped from the source at ./include/linux, dated October 2026 โ€” so yes she's from the future and she's still slaying ๐Ÿ’… k bye, go write some TEE code, i believe in you ๐Ÿงš๐Ÿ’–

๐Ÿ“ฆ where this page comes from