Page MenuHomeFreeBSD

Add a BTI sysarch
Needs ReviewPublic

Authored by andrew on Apr 6 2023, 4:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jun 24 2023, 6:55 AM
Unknown Object (File)
Jun 24 2023, 3:48 AM
Unknown Object (File)
Jun 16 2023, 3:51 AM
Unknown Object (File)
Jun 3 2023, 5:11 PM
Unknown Object (File)
May 6 2023, 10:07 AM
Unknown Object (File)
Apr 17 2023, 12:11 PM
Subscribers

Details

Reviewers
kib
markj
manu
Group Reviewers
arm64
Summary

This is used to enable the guard page when an elf binary is built with
BTI instructions.

Sponsored by: Arm Ltd
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54129
Build 51019: arc lint + arc unit

Event Timeline

andrew requested review of this revision.Apr 6 2023, 4:10 PM
andrew added a parent revision: D39452: Support BTI in rtld.
  • Rebase on D42328
  • Move ARM64_GUARD_PAGE from 0 to ensure userspace intends to set it

Where will BTI be documented? Perhaps bti.3 and mitigations.7?

sys/arm64/arm64/sys_machdep.c
49
75

IMO it is clearer to write this in terms of a range:

sva = trunc_page(gp_args.addr);
eva = round_page(gp_args.addr + gp_args.len);
if (sva > eva || eva > VM_MAX_USER_ADDRESS)
    return (EINVAL);
error = pmap_pti_set(pmap, sva, eva);
77

Shouldn't the pmap should be derived from td, not using pcpu? This looks strange, I don't know why PKRU does it this way.

78

pmap_bti_set() returns 0 if the executable didn't have BTI configured. Don't we want to return an error here in that case?

sys/arm64/include/sysarch.h
42

What is this constant for?