代码拉取完成,页面将自动刷新
From 6c1a35ac10351a2b2d4d66899f5848c1201ca6fc Mon Sep 17 00:00:00 2001
From: Huaxin Lu <luhuaxin1@huawei.com>
Date: Mon, 29 Apr 2024 21:55:45 +0800
Subject: [PATCH 01/28] Fix calculating ELF memory address
---
.../dim_core_measure_process_elf.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/core/tasks/dim_core_measure_process/dim_core_measure_process_elf.c b/src/core/tasks/dim_core_measure_process/dim_core_measure_process_elf.c
index 3821c7f..76d1560 100644
--- a/src/core/tasks/dim_core_measure_process/dim_core_measure_process_elf.c
+++ b/src/core/tasks/dim_core_measure_process/dim_core_measure_process_elf.c
@@ -266,6 +266,7 @@ static int measure_elf_text(struct vm_area_struct *vma,
int ret = 0;
unsigned int i = 0;
unsigned long addr = 0;
+ unsigned long base = 0;
struct elf_phdr *phdr = NULL;
struct dim_digest digest = {
.algo = ctx->m->hash.algo,
@@ -276,10 +277,12 @@ static int measure_elf_text(struct vm_area_struct *vma,
ret = crypto_shash_init(shash);
if (ret < 0)
return ret;
-
+
+ base = vma->vm_start - phdrs_text[0].p_vaddr;
+
for (; i < phdrs_text_num; i++) {
phdr = &phdrs_text[i];
- addr = vma->vm_start + phdr->p_vaddr - vma->vm_pgoff * PAGE_SIZE;
+ addr = base + phdr->p_vaddr;
ret = dim_vm_hash_update_address(vma->vm_mm, addr,
phdr->p_memsz, shash);
if (ret < 0)
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。