1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix exit_thread(2) passing unaligned sizes to UnmapMemory.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-02-16 14:22:45 +01:00
parent 8eae7f359a
commit 472e31a9a1

View file

@ -351,6 +351,7 @@ int sys_exit_thread(int requested_exit_code,
extended.unmap_size ) extended.unmap_size )
{ {
ScopedLock lock(&process->segment_lock); ScopedLock lock(&process->segment_lock);
extended.unmap_size = Page::AlignDown(extended.unmap_size);
Memory::UnmapMemory(process, (uintptr_t) extended.unmap_from, Memory::UnmapMemory(process, (uintptr_t) extended.unmap_from,
extended.unmap_size); extended.unmap_size);
Memory::Flush(); Memory::Flush();
@ -362,6 +363,7 @@ int sys_exit_thread(int requested_exit_code,
extended.tls_unmap_size ) extended.tls_unmap_size )
{ {
ScopedLock lock(&process->segment_lock); ScopedLock lock(&process->segment_lock);
extended.tls_unmap_size = Page::AlignDown(extended.tls_unmap_size);
Memory::UnmapMemory(process, (uintptr_t) extended.tls_unmap_from, Memory::UnmapMemory(process, (uintptr_t) extended.tls_unmap_from,
extended.tls_unmap_size); extended.tls_unmap_size);
Memory::Flush(); Memory::Flush();