The validate_mem function wants to validate that the unw_word_t that it's been passed points to memory that is both mapped and readable. This word is apparently able to span across two different pages, per this line.
Either mincore or msync is used to validate that the page or pages are mapped, and then write_validate is called to confirm that it's readable - but the call to write_validateonly reads from the first byte of the address, not the rest of the word.
Unless I'm misreading something, it seems like this would result in a segfault if the word spans across two pages, the first page is readable, and the second page is not.
The
validate_mem
function wants to validate that theunw_word_t
that it's been passed points to memory that is both mapped and readable. This word is apparently able to span across two different pages, per this line.Either
mincore
ormsync
is used to validate that the page or pages are mapped, and thenwrite_validate
is called to confirm that it's readable - but the call towrite_validate
only reads from the first byte of the address, not the rest of the word.Unless I'm misreading something, it seems like this would result in a segfault if the word spans across two pages, the first page is readable, and the second page is not.