Projects
openEuler:Roll:Everything:RVA20
dim
_service:obs_scm:backport-Fix-calculating-ELF-m...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:backport-Fix-calculating-ELF-memory-address.patch of Package dim
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
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2