ima_inode_hash(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ ima_inode_hash(9) ✨

okay so bestie, welcome to ima_inode_hash β€” that's section 9 of the Kernel API Manual, aka the kernel-functions-for-devs zone πŸ’… this one's all lowercase-and-underscores but it's genuinely iconic, trust.


🌸 NAME 🌸

ima_inode_hash β€” returns the stored measurement if the inode has been hashed and is in the iint cache. that's the whole vibe 🫢


πŸŽ€ SYNOPSIS πŸŽ€

int ima_inode_hash (struct inode *inode , char *buf , size_t buf_size );

like, three args, one int coming back at you. no cap, that's it ✨


πŸ¦‹ ARGUMENTS πŸ¦‹

  • inode β€” pointer to the inode. the main character of this whole function ngl πŸ‘‘
  • buf β€” buffer in which to store the hash. this is where the good stuff goes πŸ’–
  • buf_size β€” length of the buffer. gotta tell it how much room you've got, fr fr πŸ“

πŸ’œ DESCRIPTION πŸ’œ

On success, return the hash algorithm (as defined in the enum hash_algo). yep, the algorithm itself comes back as the return value β€” not the hash. the hash goes in the buffer. lowkey a plot twist but okay we move 🌈

If buf is not NULL, this function also outputs the hash into buf. so like… pointer's not null? boom, hash delivered. πŸ“

If the hash is larger than buf_size, then only buf_size bytes will be copied. so it'll happily truncate on you β€” no drama, no error, just vibes and partial data πŸ’€

It generally just makes sense to pass a buffer capable of holding the largest possible hash: IMA_MAX_DIGEST_SIZE. honestly? just do this. save yourself the heartbreak 😭

The hash returned is based on the entire contents, including the appended signature. the whole thing, signature included. no cherry-picking 🧚

⚠️ if IMA is disabled or if no measurement is available, return -EOPNOTSUPP. if the parameters are incorrect, return -EINVAL. those are your two bad-vibes exits, don't @ me πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./security/integrity/ima/ima_main.c β€” that's the source, go read it bestie, iykyk πŸ‘€

and the whole friend group:


and that's the page!! πŸ’… this lil beauty lives in ./security/integrity/ima, dated October 2026, and it's giving kernel integrity realness from start to finish. go hash an inode, you absolute icon β­πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from