mm/shm/shmget: Zero allocated shared memory pages when created.

Modification based on opengroup's description for shmget: "When the shared memory segment is created, it shall be initialized with all zero values."

Link to documentation page for shmget: https://pubs.opengroup.org/onlinepubs/9699919799/
This commit is contained in:
Stuart Ianna 2023-09-11 11:41:06 +10:00 committed by Xiang Xiao
parent 890dd87a4a
commit 531e5c2011
1 changed files with 4 additions and 0 deletions

View File

@ -188,6 +188,10 @@ static int shm_extend(int shmid, size_t size)
break;
}
/* Zero the allocated page. */
memset((void *)region->sr_pages[pgalloc], 0, MM_PGSIZE);
/* Increment the number of pages successfully allocated */
pgalloc++;