Page MenuHomeFreeBSD

static dtb: add BTI note
AcceptedPublic

Authored by br on Tue, Mar 3, 8:15 PM.

Details

Reviewers
andrew
Summary

Add BTI note to fdt_static_dtb.o

  • resolves "Branch Target exception" panic on FDT systems with static DTB
  • also required by bti_report linker feature
Test Plan

tested on cix cd8160

readelf --notes ../arm64.aarch64/sys/GENERIC/fdt_static_dtb.o
Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0 (property note)
    Properties:    aarch64 feature: BTI, PAC

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

br requested review of this revision.Tue, Mar 3, 8:15 PM
br created this revision.

How does it fix the Branch Target exception? The kernel doesn't care about the note, it's just there to ensure all source files are built with BTI enabled.

How does it fix the Branch Target exception? The kernel doesn't care about the note, it's just there to ensure all source files are built with BTI enabled.

I will check, but could something happen with landing pads in the beginning of functions if one of the objects used for linkage has no BTI note?

The change is correct. I think it is more likely that rebuilding the kernel with a consistent toolchain is the fix for the BTI exception.

Same toolchain (latest), but without this change a few functions don't have landing pad: copyin/copyout and sched_idletd.

I see, the issue is the generated ifunc trampolines only have BTI landing pads when the note is in all object files.

This revision is now accepted and ready to land.Wed, Mar 4, 5:08 PM