函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\verity\verify.c Create Date:2022-07-29 10:58:44
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Verify a single data page against the file's Merkle tree

函数原型:static bool verify_page(struct inode *inode, const struct fsverity_info *vi, struct ahash_request *req, struct page *data_page)

返回类型:bool

参数:

类型参数名称
struct inode *inode
const struct fsverity_info *vi
struct ahash_request *req
struct page *data_page
89  params等于tree_params
90  hsize等于same as hash_alg->digest_size
91  index等于 Our offset within mapping.
100  如果WARN_ON_ONCE(!PageLocked(data_page) || PageUptodate(data_page))则返回:false
103  pr_debug_ratelimited("Verifying data page %lu...\n", index)
110 level小于umber of levels in Merkle tree 循环
115  hash_at_level() - compute the location of the block's hash at the given level*@params: (in) the Merkle tree parameters*@dindex: (in) the index of the data block being verified*@level: (in) the level of hash we want (0 is leaf level)*@hindex: (out) the
117  pr_debug_ratelimited("Level %d: hindex=%lu, hoffset=%u\n", level, hindex, hoffset)
120  hpage等于read_merkle_tree_page(inode, hindex)
122  如果是错误
123  err等于错误
124  fsverity_err(inode, "Error %d reading Merkle tree page %lu", err, hindex)
127  转到:out
130  如果PageChecked(hpage)则
132  want_hash等于_want_hash
134  pr_debug_ratelimited("Hash page already checked, want %s:%*phN\n", crypto API name, e.g. sha256 , hsize, want_hash)
137  转到:descend
139  pr_debug_ratelimited("Hash page not yet checked\n")
140  hpages[level]等于hpage
141  hoffsets[level]等于hoffset
144  want_hash等于root_hash
145  pr_debug("Want root hash: %s:%*phN\n", crypto API name, e.g. sha256 , hsize, want_hash)
147  descend :
149 level大于0循环
150  hpage等于hpages[level - 1]
151  hoffset等于hoffsets[level - 1]
153  err等于sverity_hash_page() - hash a single data or hash page*@params: the Merkle tree's parameters*@inode: inode for which the hashing is being done*@req: preallocated hash request*@page: the page to hash*@out: output digest, size 'params->digest_size' bytes
154  如果err则转到:out
156  err等于cmp_hashes(vi, want_hash, real_hash, index, level - 1)
157  如果err则转到:out
159  SetPageChecked(hpage)
160  Extract a hash from a hash page
161  want_hash等于_want_hash
162  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
163  pr_debug("Verified hash page at level %d, now want %s:%*phN\n", level - 1, crypto API name, e.g. sha256 , hsize, want_hash)
168  err等于sverity_hash_page() - hash a single data or hash page*@params: the Merkle tree's parameters*@inode: inode for which the hashing is being done*@req: preallocated hash request*@page: the page to hash*@out: output digest, size 'params->digest_size' bytes
169  如果err则转到:out
171  err等于cmp_hashes(vi, want_hash, real_hash, index, - 1)
172  out :
173 level大于0循环Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
176  返回:err恒等于0
调用者
名称描述
fsverity_verify_pagesverity_verify_page() - verify a data page* Verify a page that has just been read from a verity file. The page must be a* pagecache page that is still locked and not yet uptodate.* Return: true if the page is valid, else false.
fsverity_verify_biosverity_verify_bio() - verify a 'read' bio that has just completed* Verify a set of pages that have just been read from a verity file. The pages* must be pagecache pages that are still locked and not yet uptodate. Pages