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)
Sun, Nov 3, 10:09 AM
Unknown Object (File)
Sat, Nov 2, 12:47 PM
Unknown Object (File)
Sat, Oct 19, 10:09 AM
Unknown Object (File)
Oct 6 2024, 8:39 AM
Unknown Object (File)
Oct 3 2024, 10:09 AM
Unknown Object (File)
Oct 3 2024, 5:26 AM
Unknown Object (File)
Sep 29 2024, 5:40 AM
Unknown Object (File)
Sep 24 2024, 1:25 AM
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.