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
F163219579: D30820.id91208.diff
Tue, Jul 21, 4:19 AM
F163217274: D30820.id.diff
Tue, Jul 21, 3:48 AM
Unknown Object (File)
Sun, Jul 19, 2:52 PM
Unknown Object (File)
Mon, Jun 22, 8:55 PM
Unknown Object (File)
Jun 16 2026, 7:26 AM
Unknown Object (File)
Jun 12 2026, 12:09 PM
Unknown Object (File)
Jun 10 2026, 5:03 AM
Unknown Object (File)
May 4 2026, 9:23 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.