Skip to content

Commit

Permalink
[LibOS] Lock mmap'ed memory area from sbrk() during checkpointing
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Feb 27, 2024
1 parent 1a72fee commit 2bfdb84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libos/src/sys/libos_brk.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ void* libos_syscall_brk(void* _brk) {

char* brk_current = ALLOC_ALIGN_UP_PTR(brk_region.brk_current);

rwlock_read_lock(&checkpoint_lock);

if (brk < brk_region.brk_start) {
goto out;
} else if (brk <= brk_current) {
Expand Down Expand Up @@ -199,6 +201,7 @@ void* libos_syscall_brk(void* _brk) {
brk_region.brk_current = brk;

out:
rwlock_read_unlock(&checkpoint_lock);
brk = brk_region.brk_current;
unlock(&brk_lock);
return brk;
Expand Down

0 comments on commit 2bfdb84

Please sign in to comment.