#18435 closed bug (fixed)
physical addresses stored in addr_t in sUserMutexTable
Reported by: | pulkomandy | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | System/Kernel | Version: | R1/beta4 |
Keywords: | Cc: | jessicah | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
We are looking at sUserMutexTable in src/system/kernel/locks/user_mutex.cpp
This has come under attention while debugging locking issues in the GHC compiler, although it isn't clear yet if the issue comes from here or not.
This code was written in 2010 and uses addr_t for physical addresses. On 32bit systems with PAE, this means the addresses can be truncated. phys_addr_t should be used instead to avoid truncation.
I guess we didn't notice because it is a bit unlikely that two entries in the table have physical addresses that are a multiple of 4GB apart?
Another question was the use of physical addresses in this code to identify objects, as the physical addresses can change if the object is mapped out of memory and back in. But if I understand the code correctly, it uses vm_wire_page/vm_unwire_page to lock things in physical memory for the duration of the locking, and so, that shouldn't be a problem.
Change History (3)
comment:1 by , 19 months ago
comment:2 by , 19 months ago
Milestone: | Unscheduled → R1/beta5 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in hrev57067.
comment:3 by , 19 months ago
Yes, we use wiring to lock pages in physical memory, indeed.
We do, but I didn't check carefully if the code always removes things from the hashmap before unwiring them (it seems so at a quick glance but it sounds worth checking in more detail).
If you checked that during your code review and didn't find anything suspicious, it's fine.
Yes, we use wiring to lock pages in physical memory, indeed.