Skip to content

Commit

Permalink
libvmmapi: Map the guest physical address space with PROT_CAP
Browse files Browse the repository at this point in the history
This lets the gdb stub see capability tag bits; otherwise, they're cleared on
load and the debugger sees all capabilities as invalid.

Note that this enables the writing of capabilities to the GPA space as well.
  • Loading branch information
markjdb committed Dec 19, 2024
1 parent f8d9fe2 commit e84bc1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/libvmmapi/vmmapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char *base)
flags |= MAP_NOCORE;

/* mmap into the process address space on the host */
ptr = mmap(base + gpa, len, PROT_RW, flags, ctx->fd, gpa);
ptr = mmap(base + gpa, len, PROT_RW | PROT_CAP, flags, ctx->fd, gpa);
if (ptr == MAP_FAILED)
return (-1);

Expand Down Expand Up @@ -455,7 +455,7 @@ vm_setup_memory(struct vmctx *ctx, size_t memsize, enum vm_mmap_style vms)
* and the adjoining guard regions.
*/
len = VM_MMAP_GUARD_SIZE + objsize + VM_MMAP_GUARD_SIZE;
ptr = mmap(NULL, len, PROT_NONE | PROT_MAX(PROT_RW),
ptr = mmap(NULL, len, PROT_NONE | PROT_MAX(PROT_RW | PROT_CAP),
MAP_GUARD | MAP_ALIGNED_SUPER, -1, 0);
if (ptr == MAP_FAILED)
return (-1);

Check warning on line 461 in lib/libvmmapi/vmmapi.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Expand Down

0 comments on commit e84bc1d

Please sign in to comment.