Page MenuHomeFreeBSD

link_elf_obj: Apply protection based on section flags.
ClosedPublic

Authored by markj on Oct 4 2019, 4:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 6:48 PM
Unknown Object (File)
Mar 16 2024, 7:16 PM
Unknown Object (File)
Jan 2 2024, 3:03 AM
Unknown Object (File)
Dec 22 2023, 11:34 PM
Unknown Object (File)
Nov 9 2023, 3:59 PM
Unknown Object (File)
Nov 6 2023, 4:16 AM
Unknown Object (File)
Oct 8 2023, 2:56 PM
Unknown Object (File)
Oct 5 2023, 3:12 AM
Subscribers

Details

Summary

Unlike the case of DSOs, we cannot assume that protection boundaries are
page-aligned. In this case, we must take the union of the protections
for the sections sharing a page.

There may also be gaps between sections. For instance, the VNET and
DPCPU sections are allocated separately and do not lie within the linker
file mapping. Such gaps are mapped with VM_PROT_READ.

As for link_elf.c, we initially map the file with VM_PROT_ALL and
downgrade once all relocations are processed.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 26874
Build 25192: arc lint + arc unit

Event Timeline

sys/kern/link_elf_obj.c
213

This relies on KERN_SUCCES == 0, I always want more explicitness in handling Mach<->errno translation.

Also, when could vm_map_protect() above fail ?

sys/kern/link_elf_obj.c
213

In fact, it should be impossible for vm_map_protect() to fail here.

Assert that vm_map_protect() returns KERN_SUCCESS.

This revision is now accepted and ready to land.Oct 4 2019, 7:46 PM
This revision was automatically updated to reflect the committed changes.