Page MenuHomeFreeBSD

[PowerPC] Switch to Secure-PLT PIC modules, allow MD code to participate in DYNAMIC parsing.

Authored by bdragon on Fri, Nov 29, 8:37 PM.



Due to issues like (with more details @ ), clang's support for freestanding / static model / "EABI" code is still slightly lacking on ppc32.

As such, I'm investigating building powerpc* kernel modules as PIC (enforced secure-plt on powerpc32)

  • Add elf_cpu_parse_dynamic() to allow MD code to do its own DYNAMIC parsing. Add stubs to all link_elf.c platforms.
  • Implement jump table relocation for ppc32 secure-plt LD_BIND_NOW style and add a check to ensure it is only loading secure-plt modules (using elf_cpu_parse_dynamic())
  • Build kernel modules -fPIC on powerpc*.
  • Poison the powerpc32 runtime resolver to ensure any attempts to call it cause an appropriate panic instead of a branch-to-zero.


  • Figure out why dtrace is broken again. Was due to CTF type bloat, again.
  • Use elf_cpu_parse_dynamic() to make ppc64 module loading more robust?
  • Document rationale behind this change
  • ELFv1 (gcc4) testing. ELFv1 works with -fPIC (and doesn't generate PLT slots.)
  • add kib or jhb to reviewers list after this summary is cleaned up

Contra indications:

  • Using PIC kernel modules crashes GCC4 when compiling module<->module linker sets. (accf_http, etc.)

Diff Detail

rS FreeBSD src repository
Lint Skipped
Unit Tests Skipped

Event Timeline

bdragon created this revision.Fri, Nov 29, 8:37 PM
bdragon edited the summary of this revision. (Show Details)Fri, Nov 29, 9:32 PM
bdragon edited the summary of this revision. (Show Details)Fri, Nov 29, 9:40 PM
bdragon edited the summary of this revision. (Show Details)Fri, Nov 29, 10:23 PM
bdragon edited the summary of this revision. (Show Details)Sat, Nov 30, 4:39 PM
luporl added a comment.Mon, Dec 2, 6:18 PM

Looks good to me.


The return style is not very consistent on this file, but I think that on new functions at least it is better to always enclose return values in parentheses, as documented in style(9).

jhibbits accepted this revision.Tue, Dec 10, 7:11 PM

LGTM, modulo @luporl's remark about style.

This revision is now accepted and ready to land.Tue, Dec 10, 7:11 PM