Skip to content

Commit

Permalink
[LibOS] Fail if address in arch_prctl() is inaccessible
Browse files Browse the repository at this point in the history
The check was missing. Reported by Scott Constable.

Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
  • Loading branch information
dimakuv authored and mkow committed Sep 11, 2023
1 parent 4de3fa8 commit 4ef6abb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libos/src/arch/x86_64/libos_arch_prctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ long libos_syscall_arch_prctl(int code, unsigned long addr) {
return 0;

case ARCH_GET_FS:
if (!is_user_memory_writable((unsigned long*)addr, sizeof(unsigned long))) {
return -EFAULT;
}
return pal_to_unix_errno(PalSegmentBaseGet(PAL_SEGMENT_FS, (unsigned long*)addr));

/* Emulate ARCH_GET_XCOMP_SUPP, ARCH_GET_XCOMP_PERM, ARCH_REQ_XCOMP_PERM by querying CPUID,
Expand Down

0 comments on commit 4ef6abb

Please sign in to comment.