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)
Sat, Sep 21, 6:28 PM
Unknown Object (File)
Fri, Sep 20, 7:36 AM
Unknown Object (File)
Fri, Sep 6, 2:51 AM
Unknown Object (File)
Sun, Sep 1, 7:58 PM
Unknown Object (File)
Sat, Aug 31, 11:48 PM
Unknown Object (File)
Aug 18 2024, 10:34 PM
Unknown Object (File)
Aug 14 2024, 8:20 AM
Unknown Object (File)
Aug 8 2024, 1: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.