Skip to content

Commit

Permalink
fixup! [PAL/Linux] Log a message on mmap() returning -ENOMEM
Browse files Browse the repository at this point in the history
Signed-off-by: Kailun Qin <[email protected]>
  • Loading branch information
kailun-qin committed Oct 15, 2024
1 parent 3968717 commit 8a95c28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pal/src/host/linux/pal_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ int _PalVirtualMemoryAlloc(void* addr, size_t size, pal_prot_flags_t prot) {
if (IS_PTR_ERR(res_addr)) {
int ret = PTR_TO_ERR(res_addr);
if (ret == -ENOMEM && FIRST_TIME()) {
log_error("Host Linux returned -ENOMEM on mmap(); this may happen because process's "
"maximum number of mappings is exceeded. Gramine cannot handle this case. "
"You may want to increase the value in /proc/sys/vm/max_map_count.");
log_debug("Host Linux returned -ENOMEM on mmap(); this may happen because process's "
"maximum number of mappings would be exceeded. Gramine cannot handle this "
"case. You may want to increase the value in /proc/sys/vm/max_map_count.");
}

return unix_to_pal_error(ret);
Expand All @@ -57,7 +57,7 @@ int _PalVirtualMemoryFree(void* addr, size_t size) {
int ret = DO_SYSCALL(munmap, addr, size);
if (ret == -ENOMEM && FIRST_TIME()) {
log_error("Host Linux returned -ENOMEM on munmap(); this may happen because process's "
"maximum number of mappings is exceeded. Gramine cannot handle this case. "
"maximum number of mappings would be exceeded. Gramine cannot handle this case. "
"You may want to increase the value in /proc/sys/vm/max_map_count.");
}
return ret < 0 ? unix_to_pal_error(ret) : 0;
Expand Down

0 comments on commit 8a95c28

Please sign in to comment.