Thread (12 messages) flat view 12 messages, 3 authors, 2020-11-24

Re: [PATCH bpf-next 2/3] bpf: Add a BPF helper for getting the IMA hash of an inode

From: KP Singh <hidden>
Date: 2020-11-21 00:14:35
Also in: bpf, lkml

[...]
quoted
+ * long bpf_ima_inode_hash(struct inode *inode, void *dst, u32 size)
+ *   Description
+ *           Returns the stored IMA hash of the *inode* (if it's avaialable).
+ *           If the hash is larger than *size*, then only *size*
+ *           bytes will be copied to *dst*
+ *   Return > + *            The **hash_algo** of is returned on success,
of => if?
Just changed it to:

"The **hash_algo** is returned on success"
quoted
+ *           **-EOPNOTSUP** if IMA is disabled and **-EINVAL** if
and => or
Done. (and the same for tools/)
[...]
quoted
+     .gpl_only       = false,
+     .ret_type       = RET_INTEGER,
+     .arg1_type      = ARG_PTR_TO_BTF_ID,
+     .arg1_btf_id    = &bpf_ima_inode_hash_btf_ids[0],
+     .arg2_type      = ARG_PTR_TO_UNINIT_MEM,
+     .arg3_type      = ARG_CONST_SIZE_OR_ZERO,
I know ARG_CONST_SIZE_OR_ZERO provides some flexibility and may
make verifier easier to verify programs. But beyond that did
you see any real use case user will pass a zero size buf to
get hash value?
I agree, in this case it makes more sense to ARG_CONST_SIZE.
quoted
+     .allowed        = bpf_ima_inode_hash_allowed,
+};
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help