Page MenuHomeFreeBSD

Add kernel ifunc support on arm64
ClosedPublic

Authored by andrew on Oct 1 2018, 11:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:38 AM
Unknown Object (File)
Nov 5 2023, 10:59 AM
Unknown Object (File)
Oct 4 2023, 9:55 AM
Unknown Object (File)
Sep 6 2023, 7:12 PM
Unknown Object (File)
Sep 6 2023, 7:12 PM
Unknown Object (File)
Sep 6 2023, 7:12 PM
Unknown Object (File)
Sep 6 2023, 7:11 PM
Unknown Object (File)
Sep 1 2023, 12:55 PM
Subscribers

Details

Summary

Tested with ifunc resolvers in the kernel and module with calls from
kernel to kernel, module to kernel, and module to module.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/arm64/arm64/machdep.c
1077 ↗(On Diff #48609)

Does panic work (or planned to work after real ifunc introduction) before ifuncs are resolved ?

sys/arm64/include/ifunc.h
41 ↗(On Diff #48609)

Did you committed the change to add six zero args ?

andrew marked an inline comment as done.
  • Move link_elf_ireloc earlier in the boot
  • Include all the arguments in DEFINE_UIFUNC
sys/arm64/arm64/machdep.c
1077 ↗(On Diff #48609)

I expect to move link_elf_ireloc earlier into the boot, however I also expect we will need to rerun the resolver functions after secondary CPUs have been started. They may have different ID registers that affect which implementation they select.

kib added inline comments.
sys/arm64/arm64/machdep.c
1077 ↗(On Diff #48609)

For RELA relocations this should work, but not for REL. Also, you need to ensure that APs do not execute relocated code until fixed.

This revision is now accepted and ready to land.Oct 1 2018, 3:53 PM
andrew added inline comments.
sys/arm64/arm64/machdep.c
1077 ↗(On Diff #48609)

I would expect we need to transform REL to RELA before the first relocation pass.

The resolvers in the early pass would need to understand they need to return safe values, however I expect any function that runs on the boot CPU will also run on the non-boot CPU, however it may be suboptimal.

sys/arm64/arm64/machdep.c
1077 ↗(On Diff #48609)

I am not sure I see how the REL->RELA translation can be done, there is no space in Elf_Rel to save the addend, it is taken from the patched place and is overwritten by the act of relocation.

OTOH, I expect that arm64 uses RELA, same as amd64.

This revision was automatically updated to reflect the committed changes.