加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-some-word.patch 18.69 KB
一键复制 编辑 原始数据 按行查看 历史
jinlun 提交于 2024-04-16 10:12 . backport some patches
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
From 1b6ab8135e1b2f4f5d0f4ce559f46bc8d71022b6 Mon Sep 17 00:00:00 2001
From: xuyongliang_01 <xuyongliang_yewu@cmss.chinamobile.com>
Date: Wed, 6 Dec 2023 09:55:20 +0800
Subject: [PATCH 07/26] some word
---
src/core/dim_core_baseline.c | 8 ++++----
src/core/dim_core_fs.c | 2 +-
src/core/dim_core_main.c | 10 +++++-----
src/core/dim_core_measure.c | 24 ++++++++++++------------
src/core/dim_core_measure_common.c | 2 +-
src/core/dim_core_measure_kernel.c | 8 ++++----
src/core/dim_core_measure_task.c | 20 ++++++++++----------
src/core/dim_core_mem_pool.c | 12 ++++++------
src/core/dim_core_policy.c | 10 +++++-----
src/core/dim_core_sig.c | 10 +++++-----
src/core/dim_core_static_baseline.c | 10 +++++-----
src/core/dim_core_symbol.c | 2 +-
12 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/src/core/dim_core_baseline.c b/src/core/dim_core_baseline.c
index a0f4832..27a8114 100644
--- a/src/core/dim_core_baseline.c
+++ b/src/core/dim_core_baseline.c
@@ -35,7 +35,7 @@ int dim_core_add_static_baseline(const char *name, int type,
{
int ret = dim_baseline_add(&static_baseline, name, type, digest);
if (ret < 0 && ret != -EEXIST) {
- dim_err("fail to add static baseline of %s\n", name);
+ dim_err("failed to add static baseline of %s\n", name);
return ret;
}
@@ -47,7 +47,7 @@ int dim_core_add_dynamic_baseline(const char *name, int type,
{
int ret = dim_baseline_add(&dynamic_baseline, name, type, digest);
if (ret < 0 && ret != -EEXIST) {
- dim_err("fail to add dynamic baseline of %s\n", name);
+ dim_err("failed to add dynamic baseline of %s\n", name);
return ret;
}
@@ -93,7 +93,7 @@ int dim_core_baseline_init(void)
dim_kfree,
&static_baseline);
if (ret < 0) {
- dim_err("fail to initialize static baseline root: %d\n", ret);
+ dim_err("failed to initialize static baseline root: %d\n", ret);
return ret;
}
@@ -101,7 +101,7 @@ int dim_core_baseline_init(void)
dim_mem_pool_free,
&dynamic_baseline);
if (ret < 0) {
- dim_err("fail to initialize dynamic baseline root: %d\n", ret);
+ dim_err("failed to initialize dynamic baseline root: %d\n", ret);
return ret;
}
diff --git a/src/core/dim_core_fs.c b/src/core/dim_core_fs.c
index d5e39ba..e050a19 100644
--- a/src/core/dim_core_fs.c
+++ b/src/core/dim_core_fs.c
@@ -105,7 +105,7 @@ int dim_core_create_fs(void)
ret = dim_entry_create(&dim_core_dir, NULL);
if (ret < 0) {
- dim_err("fail to create dim dir entry: %d\n", ret);
+ dim_err("failed to create dim dir entry: %d\n", ret);
return ret;
}
diff --git a/src/core/dim_core_main.c b/src/core/dim_core_main.c
index edd86cc..6de0c2a 100644
--- a/src/core/dim_core_main.c
+++ b/src/core/dim_core_main.c
@@ -38,20 +38,20 @@ static int __init dim_core_init(void)
ret = dim_core_kallsyms_init();
if (ret < 0) {
- dim_err("fail to initialize dim kernel symbol: %d\n", ret);
+ dim_err("failed to initialize dim kernel symbol: %d\n", ret);
goto err;
}
ret = dim_mem_pool_init();
if (ret < 0) {
- dim_err("fail to initialize dim memory pool: %d\n", ret);
+ dim_err("failed to initialize dim memory pool: %d\n", ret);
goto err;
}
if (signature) {
ret = dim_core_sig_init();
if (ret < 0) {
- dim_err("fail to initialize dim signature: %d\n", ret);
+ dim_err("failed to initialize dim signature: %d\n", ret);
goto err;
}
}
@@ -59,13 +59,13 @@ static int __init dim_core_init(void)
ret = dim_core_measure_init(measure_hash == NULL ?
DIM_CORE_HASH_DEFAULT : measure_hash);
if (ret < 0) {
- dim_err("fail to initialize dim measurement: %d\n", ret);
+ dim_err("failed to initialize dim measurement: %d\n", ret);
goto err;
}
ret = dim_core_create_fs();
if (ret < 0) {
- dim_err("fail to create dim fs entry: %d\n", ret);
+ dim_err("failed to create dim fs entry: %d\n", ret);
goto err;
}
diff --git a/src/core/dim_core_measure.c b/src/core/dim_core_measure.c
index 59e2cf8..ed4a464 100644
--- a/src/core/dim_core_measure.c
+++ b/src/core/dim_core_measure.c
@@ -125,15 +125,15 @@ static void do_measure(void)
ret = dim_core_measure_task(bi);
if (ret < 0)
- dim_err("fail to measure user process: %d\n", ret);
+ dim_err("failed to measure user process: %d\n", ret);
ret = dim_core_measure_module(bi);
if (ret < 0)
- dim_err("fail to measure kernel modules: %d\n", ret);
+ dim_err("failed to measure kernel modules: %d\n", ret);
ret = dim_core_measure_kernel(bi);
if (ret < 0)
- dim_err("fail to measure kernel: %d\n", ret);
+ dim_err("failed to measure kernel: %d\n", ret);
mutex_unlock(&dim_core_baseline_lock);
}
@@ -144,14 +144,14 @@ static int do_baseline(void)
ret = dim_core_policy_load();
if (ret < 0) {
- dim_err("fail to load dim core policy: %d\n", ret);
+ dim_err("failed to load dim core policy: %d\n", ret);
return ret;
}
dim_core_baseline_destroy();
ret = dim_core_static_baseline_load();
if (ret < 0) {
- dim_err("fail to load dim static baseline: %d\n", ret);
+ dim_err("failed to load dim static baseline: %d\n", ret);
dim_core_policy_destroy();
return ret;
}
@@ -232,7 +232,7 @@ int dim_core_measure_init(const char *alg_name)
/* 2. init measure hash algorithm */
ret = dim_hash_init(alg_name, &dim_core_hash);
if (ret < 0) {
- dim_err("fail to initialize hash algorithm: %d\n", ret);
+ dim_err("failed to initialize hash algorithm: %d\n", ret);
goto err;
}
@@ -240,20 +240,20 @@ int dim_core_measure_init(const char *alg_name)
if (measure_pcr > 0) {
ret = dim_tpm_init(&dim_core_tpm, HASH_ALGO_SHA256);
if (ret < 0)
- dim_warn("fail to initialize tpm chip: %d\n", ret);
+ dim_warn("failed to initialize tpm chip: %d\n", ret);
}
/* 4. init measurement status */
ret = dim_core_status_init();
if (ret < 0) {
- dim_err("fail to initialize dim status: %d\n", ret);
+ dim_err("failed to initialize dim status: %d\n", ret);
goto err;
}
/* 5. init baseline data (static and dynamic) */
ret = dim_core_baseline_init();
if (ret < 0) {
- dim_err("fail to initialize dim baseline: %d\n", ret);
+ dim_err("failed to initialize dim baseline: %d\n", ret);
goto err;
}
@@ -262,7 +262,7 @@ int dim_core_measure_init(const char *alg_name)
&dim_core_hash, &dim_core_tpm,
measure_log_capacity, measure_pcr);
if (ret < 0) {
- dim_err("fail to initialize measure log root: %d\n", ret);
+ dim_err("failed to initialize measure log root: %d\n", ret);
goto err;
}
@@ -271,7 +271,7 @@ int dim_core_measure_init(const char *alg_name)
dim_work_queue = create_singlethread_workqueue("dim_core");
if (dim_work_queue == NULL) {
ret = -ENOMEM;
- dim_err("fail to create dim work queue: %d\n", ret);
+ dim_err("failed to create dim work queue: %d\n", ret);
goto err;
}
@@ -279,7 +279,7 @@ int dim_core_measure_init(const char *alg_name)
if (measure_interval) {
ret = dim_core_measure(1);
if (ret < 0) {
- dim_err("fail to do baseline init: %d\n", ret);
+ dim_err("failed to do baseline init: %d\n", ret);
goto err;
}
diff --git a/src/core/dim_core_measure_common.c b/src/core/dim_core_measure_common.c
index 4e4c0f4..406ed3f 100644
--- a/src/core/dim_core_measure_common.c
+++ b/src/core/dim_core_measure_common.c
@@ -15,7 +15,7 @@ int dim_core_add_measure_log(const char *name, struct dim_digest *digest, int fl
{
int ret = dim_measure_log_add(&dim_core_log, name, digest, flag);
if (ret < 0 && ret != -EEXIST) {
- dim_err("fail to add measure log of %s: %d\n", name, ret);
+ dim_err("failed to add measure log of %s: %d\n", name, ret);
return ret;
}
diff --git a/src/core/dim_core_measure_kernel.c b/src/core/dim_core_measure_kernel.c
index 135899d..3724501 100644
--- a/src/core/dim_core_measure_kernel.c
+++ b/src/core/dim_core_measure_kernel.c
@@ -111,7 +111,7 @@ static int calc_kernel_digest(struct dim_digest *digest)
sizeof(struct jump_entry);
ret = sort_jump_table(sjump, jcode_cnt, &jcode_sort);
if (ret < 0) {
- dim_err("fail to sort kernel jump table: %d\n", ret);
+ dim_err("failed to sort kernel jump table: %d\n", ret);
return ret;
}
} else {
@@ -121,7 +121,7 @@ static int calc_kernel_digest(struct dim_digest *digest)
ret = do_calc_kernel_digest(stext, etext, jcode_sort, jcode_cnt, digest);
if (ret < 0)
- dim_err("fail to calculate kernel digest: %d\n", ret);
+ dim_err("failed to calculate kernel digest: %d\n", ret);
vfree(jcode_sort);
return ret;
@@ -139,13 +139,13 @@ int dim_core_measure_kernel(int baseline_init)
ret = calc_kernel_digest(&digest);
if (ret < 0) {
- dim_err("fail to calculate kernel digest: %d\n", ret);
+ dim_err("failed to calculate kernel digest: %d\n", ret);
return ret;
}
ret = dim_core_check_kernel_digest(baseline_init, kr, &digest);
if (ret < 0)
- dim_err("fail to check kernel digest: %d\n", ret);
+ dim_err("failed to check kernel digest: %d\n", ret);
return ret;
}
diff --git a/src/core/dim_core_measure_task.c b/src/core/dim_core_measure_task.c
index f9c53f0..0d9b995 100644
--- a/src/core/dim_core_measure_task.c
+++ b/src/core/dim_core_measure_task.c
@@ -192,7 +192,7 @@ static bool vm_file_match_policy(struct file *vm_file,
/* get the module path string */
ctx->path = d_path(&vm_file->f_path, ctx->path_buf, PATH_MAX);
if (IS_ERR(ctx->path)) {
- dim_warn("fail to get path of vma: %ld\n", PTR_ERR(ctx->path));
+ dim_warn("failed to get path of vma: %ld\n", PTR_ERR(ctx->path));
ctx->path = NULL;
return false;
}
@@ -225,7 +225,7 @@ static int update_vma_digest(struct vm_area_struct *vma_start,
ret_pages = get_user_pages_remote(vma_start->vm_mm, addr_start, nr_pages,
0, pages, NULL, NULL);
if (ret_pages < 0) {
- dim_err("fail to get vma pages: %ld\n", ret_pages);
+ dim_err("failed to get vma pages: %ld\n", ret_pages);
vfree(pages);
return ret_pages;
}
@@ -233,7 +233,7 @@ static int update_vma_digest(struct vm_area_struct *vma_start,
for (i = 0; i < ret_pages; i++) {
page_ptr = kmap(pages[i]);
if (page_ptr == NULL) {
- dim_err("fail to kmap page\n");
+ dim_err("failed to kmap page\n");
put_page(pages[i]);
continue;
}
@@ -257,7 +257,7 @@ static int check_user_digest(struct dim_digest *digest,
ret = dim_core_check_user_digest(ctx->baseline, ctx->path,
digest, &log_flag);
if (ret < 0) {
- dim_err("fail to check user digest: %d\n", ret);
+ dim_err("failed to check user digest: %d\n", ret);
return ret;
}
@@ -315,7 +315,7 @@ static int measure_task_module_anon_text(struct vm_area_struct *vma,
ret = measure_anon_text_vma(v, ctx);
if (ret < 0)
- dim_err("fail to measure anon text vma: %d\n", ret);
+ dim_err("failed to measure anon text vma: %d\n", ret);
}
return 0;
@@ -367,11 +367,11 @@ static void measure_task_module(struct vm_area_struct *vma,
ret = measure_task_module_file_text(vma, ctx);
if (ret < 0)
- dim_err("fail to measure module file text: %d", ret);
+ dim_err("failed to measure module file text: %d", ret);
#ifdef DIM_CORE_MEASURE_ANON_TEXT
ret = measure_task_module_anon_text(vma, ctx);
if (ret < 0)
- dim_err("fail to measure module anon text: %d", ret);
+ dim_err("failed to measure module anon text: %d", ret);
#endif
}
@@ -425,7 +425,7 @@ out:
if (ctx->task_kill) {
ret = kill_task_tree(task);
if (ret < 0)
- dim_err("fail to kill tampered task, pid = %d: %d\n",
+ dim_err("failed to kill tampered task, pid = %d: %d\n",
task->pid, ret);
}
@@ -446,7 +446,7 @@ static int store_task_pids(pid_t **pid_buf, unsigned int *pid_cnt)
/* maximum processing of PID_MAX_DEFAULT * 2 pids */
buf = vmalloc(max_cnt);
if (buf == NULL) {
- dim_err("fail to allocate memory for pid buffer\n");
+ dim_err("failed to allocate memory for pid buffer\n");
return -ENOMEM;
}
@@ -494,7 +494,7 @@ static int walk_tasks(task_measurer f, struct task_measure_ctx *ctx)
ret = f(task, ctx);
put_task_struct(task);
if (ret < 0) {
- dim_err("fail to measure task, pid = %d: %d", pid_buf[i], ret);
+ dim_err("failed to measure task, pid = %d: %d", pid_buf[i], ret);
if (ret == -EINTR)
break;
}
diff --git a/src/core/dim_core_mem_pool.c b/src/core/dim_core_mem_pool.c
index 5688eaf..a16b7bb 100644
--- a/src/core/dim_core_mem_pool.c
+++ b/src/core/dim_core_mem_pool.c
@@ -18,7 +18,7 @@ static int dim_mem_pool_expand(unsigned int order)
pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
if (pages == NULL) {
- dim_err("fail to allocate pages for memory pool\n");
+ dim_err("failed to allocate pages for memory pool\n");
return -ENOMEM;
}
@@ -27,7 +27,7 @@ static int dim_mem_pool_expand(unsigned int order)
ret = gen_pool_add(dim_pool, pages_addr, size, -1);
if (ret < 0) {
- dim_err("fail to add pages to memory pool: %d\n", ret);
+ dim_err("failed to add pages to memory pool: %d\n", ret);
return ret;
}
@@ -41,7 +41,7 @@ int dim_mem_pool_init(void)
dim_pool = gen_pool_create(DIM_MIN_ALLOC_ORDER, -1);
if (dim_pool == NULL) {
- dim_err("fail to generate memory pool\n");
+ dim_err("failed to generate memory pool\n");
return -ENOMEM;
}
@@ -72,7 +72,7 @@ void dim_mem_pool_destroy(void)
return;
if (gen_pool_avail(dim_pool) != gen_pool_size(dim_pool)) {
- dim_err("dim_mem_pool_destroy fail, memory leak detected\n");
+ dim_err("dim_mem_pool_destroy failed, memory leak detected\n");
return;
}
@@ -96,10 +96,10 @@ void *dim_mem_pool_alloc(size_t size)
if (data != NULL)
goto out;
- dim_devel("gen_pool_alloc fail, try dim_mem_pool_expand\n");
+ dim_devel("gen_pool_alloc failed, try dim_mem_pool_expand\n");
ret = dim_mem_pool_expand(DIM_EXPEND_ALLOC_PAGE_ORDER);
if (ret < 0) {
- dim_err("fail to expand memory pool: %d\n", ret);
+ dim_err("failed to expand memory pool: %d\n", ret);
return NULL;
}
diff --git a/src/core/dim_core_policy.c b/src/core/dim_core_policy.c
index a3fa369..0e7fbf3 100644
--- a/src/core/dim_core_policy.c
+++ b/src/core/dim_core_policy.c
@@ -118,7 +118,7 @@ static int policy_add_path(const char *path, int action)
apath = dim_absolute_path(path, path_buf, PATH_MAX);
if (IS_ERR(apath)) {
- dim_warn("fail to get absolute path of %s in policy: %ld\n",
+ dim_warn("failed to get absolute path of %s in policy: %ld\n",
path, PTR_ERR(apath));
kfree(path_buf);
return 0;
@@ -200,7 +200,7 @@ static int policy_parse_line(char* line, int line_no)
if (obj == DIM_POLICY_OBJ_KERNEL_TEXT) {
ret = policy_add_kernel(action);
if (ret < 0)
- dim_err("fail to add measure policy line %d: %d\n",
+ dim_err("failed to add measure policy line %d: %d\n",
line_no, ret);
return ret;
}
@@ -221,7 +221,7 @@ static int policy_parse_line(char* line, int line_no)
policy_add_path(val, action) :
policy_add_module(val, action);
if (ret < 0)
- dim_err("fail to add measure policy line %d: %d\n",
+ dim_err("failed to add measure policy line %d: %d\n",
line_no, ret);
return ret;
}
@@ -237,14 +237,14 @@ int dim_core_policy_load(void)
ret = dim_read_verify_file(NULL, DIM_POLICY_PATH, &buf);
if (ret < 0 || buf == NULL) {
- dim_err("fail to read policy file: %d\n", ret);
+ dim_err("failed to read policy file: %d\n", ret);
return ret;
}
buf_len = ret;
ret = dim_parse_line_buf(buf, buf_len, policy_parse_line);
if (ret < 0) {
- dim_err("fail to parse policy: %d\n", ret);
+ dim_err("failed to parse policy: %d\n", ret);
dim_core_policy_destroy();
}
diff --git a/src/core/dim_core_sig.c b/src/core/dim_core_sig.c
index 18f6008..aae323c 100644
--- a/src/core/dim_core_sig.c
+++ b/src/core/dim_core_sig.c
@@ -141,7 +141,7 @@ int dim_core_sig_init(void)
KEY_ALLOC_NOT_IN_QUOTA, NULL, NULL);
if (IS_ERR(dim_core_keyring)) {
ret = PTR_ERR(dim_core_keyring);
- dim_err("fail to allocate DIM keyring: %ld\n", ret);
+ dim_err("failed to allocate DIM keyring: %ld\n", ret);
return ret;
}
@@ -149,7 +149,7 @@ int dim_core_sig_init(void)
DIM_CORE_MAX_FILE_SIZE, NULL,
READING_X509_CERTIFICATE);
if (ret < 0) {
- dim_err("fail to read DIM cert file: %ld\n", ret);
+ dim_err("failed to read DIM cert file: %ld\n", ret);
goto err;
}
@@ -158,13 +158,13 @@ int dim_core_sig_init(void)
DIM_CORE_KEY_PERM, KEY_ALLOC_NOT_IN_QUOTA);
if (IS_ERR(key)) {
ret = PTR_ERR(key);
- dim_err("fail to load DIM cert: %ld\n", ret);
+ dim_err("failed to load DIM cert: %ld\n", ret);
goto err;
}
ret = dim_hash_init("sha256", &dim_core_sig_hash);
if (ret < 0) {
- dim_err("fail to init dim signature hash: %ld\n", ret);
+ dim_err("failed to init dim signature hash: %ld\n", ret);
goto err;
}
@@ -186,4 +186,4 @@ void dim_core_sig_destroy(void)
key_put(dim_core_keyring);
dim_hash_destroy(&dim_core_sig_hash);
-}
\ No newline at end of file
+}
diff --git a/src/core/dim_core_static_baseline.c b/src/core/dim_core_static_baseline.c
index f779da1..0d99f7b 100644
--- a/src/core/dim_core_static_baseline.c
+++ b/src/core/dim_core_static_baseline.c
@@ -112,7 +112,7 @@ static int parse_simple_baseline_line(char* line, int line_no)
ret = dim_core_add_static_baseline(line_str, type, &digest);
if (ret < 0)
- dim_warn("fail to add static baseline at line %d: %d\n",
+ dim_warn("failed to add static baseline at line %d: %d\n",
line_no, ret);
return 0;
}
@@ -144,14 +144,14 @@ static_baseline_load(struct dir_context *__ctx,
ret = dim_read_verify_file(ctx->path, name, &buf);
if (ret < 0 || buf == NULL) {
- dim_err("fail to read and verify %s: %d\n", name, ret);
+ dim_err("failed to read and verify %s: %d\n", name, ret);
goto out;
}
buf_len = ret;
ret = dim_parse_line_buf(buf, buf_len, parse_simple_baseline_line);
if (ret < 0)
- dim_err("fail to parse baseline file %s: %d\n", name, ret);
+ dim_err("failed to parse baseline file %s: %d\n", name, ret);
out:
if (buf != NULL)
vfree(buf);
@@ -175,14 +175,14 @@ int dim_core_static_baseline_load(void)
ret = kern_path(DIM_STATIC_BASELINE_ROOT, LOOKUP_DIRECTORY, &kpath);
if (ret < 0) {
- dim_err("fail to get dim baseline root path: %d", ret);
+ dim_err("failed to get dim baseline root path: %d", ret);
return ret;
}
file = filp_open(DIM_STATIC_BASELINE_ROOT, O_RDONLY | O_DIRECTORY, 0);
if (IS_ERR(file)) {
ret = PTR_ERR(file);
- dim_err("fail to open %s: %d\n", DIM_STATIC_BASELINE_ROOT, ret);
+ dim_err("failed to open %s: %d\n", DIM_STATIC_BASELINE_ROOT, ret);
path_put(&kpath);
return ret;
}
diff --git a/src/core/dim_core_symbol.c b/src/core/dim_core_symbol.c
index 128e595..3da3df2 100644
--- a/src/core/dim_core_symbol.c
+++ b/src/core/dim_core_symbol.c
@@ -23,7 +23,7 @@ int dim_core_kallsyms_init(void)
dim_kallsyms_lookup_name = dim_get_symbol_lookup_func();
if (dim_kallsyms_lookup_name == NULL) {
- dim_err("fail to get symbol_lookup_func\n");
+ dim_err("failed to get symbol_lookup_func\n");
return -EINVAL;
}
k->stext = (char *)dim_kallsyms_lookup_name("_stext");
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化