libunwind / libunwind

libunwind official github repo (in need of new / additional maintainer, mail/open issue if interested)
http://www.nongnu.org/libunwind/
MIT License
1.01k stars 290 forks source link

Possible bug in x86_64 validate_mem #232

Closed godlygeek closed 1 year ago

godlygeek commented 3 years ago

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_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.

bregma commented 1 year ago

Fixed by PR #454