Page MenuHomeFreeBSD

rtld-elf: Check the return value of obj_enforce_relro()
ClosedPublic

Authored by arichardson on Jun 19 2021, 11:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 2, 5:35 AM
Unknown Object (File)
Jan 28 2024, 8:07 PM
Unknown Object (File)
Jan 16 2024, 4:10 PM
Unknown Object (File)
Jan 5 2024, 4:41 PM
Unknown Object (File)
Dec 20 2023, 10:55 AM
Unknown Object (File)
Dec 20 2023, 4:42 AM
Unknown Object (File)
Dec 14 2023, 10:16 PM
Unknown Object (File)
Dec 6 2023, 8:50 PM
Subscribers

Details

Summary

The mprotect() call was failing on CheriBSD when changing rtld's relro
page permissions due to missing CHERI capability permissions on the
mprotect() argument but did not report an error since the return value
was being ignored. It should never fail on any supported FreeBSD
architecture, but checking the return value seems like a good
sanity check to me.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

libexec/rtld-elf/rtld.c
2291–2292

Indentation is a bit odd in this entire function, I just used the existing style.

This revision is now accepted and ready to land.Jun 19 2021, 1:48 PM
libexec/rtld-elf/rtld.c
2291–2292

Other users of obj_enforce_relro() check for -1 to detect error.

libexec/rtld-elf/rtld.c
2291–2292

Ah yes, best to be consistent. @kib okay to commit with != 0 changed to == -1?

kib added inline comments.
libexec/rtld-elf/rtld.c
2291–2292

Sure, ok.