ima_inode_hash(9)
β¨ 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:
ima_file_free(9)ima_file_mmap(9)ima_file_mprotect(9)ima_bprm_check(9)ima_creds_check(9)ima_bprm_creds_for_exec(9)ima_file_check(9)ima_file_hash(9)ima_post_create_tmpfile(9)ima_post_path_mknod(9)ima_read_file(9)ima_post_read_file(9)ima_load_data(9)ima_post_load_data(9)process_buffer_measurement(9)ima_kexec_cmdline(9)ima_measure_critical_data(9)ima_measure_raw_policy(9)ima_kernel_module_request(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms