Page MenuHomeFreeBSD

static dtb: add BTI note
ClosedPublic

Authored by br on Mar 3 2026, 8:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 8, 12:01 AM
Unknown Object (File)
Sun, Apr 5, 4:13 PM
Unknown Object (File)
Sun, Apr 5, 5:56 AM
Unknown Object (File)
Tue, Mar 31, 5:49 PM
Unknown Object (File)
Thu, Mar 26, 3:35 AM
Unknown Object (File)
Wed, Mar 25, 1:49 PM
Unknown Object (File)
Wed, Mar 25, 2:18 AM
Unknown Object (File)
Tue, Mar 24, 9:17 PM
Subscribers

Details

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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

br requested review of this revision.Mar 3 2026, 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.Mar 4 2026, 5:08 PM
This revision was automatically updated to reflect the committed changes.