-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allocate e_flags for landing pad and shadow stack #395
Conversation
We didn't allocate bit for individual extension generally, but landing pad and (hardware) shadow stack will require dynamic linker to check all dependent DSOs, so it worth to allocate e_flags to those two speical extension. `EF_RISCV_CFI_LP` means this binary has build with landing pad, but *NOT* required the platform has support Zicfilp extension, since Zicfilp is using hint instruction, so it can be safely execute without Zicfilp, dynamic linker will check all dependent DSOs has set this flag, and enable the landing pad checking if all DSOs has support. `EF_RISCV_CFI_SS` means this binary requires the Zimop or Zicfiss extension, which is different than `EF_RISCV_CFI_LP`, because it's *NOT* using hint instruction, dynamic linker will check all dependent DSOs has set this flag, and enable the shadow stack if all DSOs has support, otherwise enable Zimop mode only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Attributes can encode that. They’re not fundamental ABI decisions. X86 and AArch64 don’t use e_flags. e_flags is for core ABI compatibility differences that mean you use a different set of libraries.
Yes, attribute can encoding that, however the parsing overhead are relative high compare to Just note, checked with AArch64 / X86, they are using GNU property to mark the binary has using BTI / CET. |
Yes, they are using GNU property, which is extensible, not e_flags, which is a tiny consumable resource. So please don't use e_flags. |
That is, if you don't want it in .riscv.attributes, put it in another note, but don't put it in e_flags. |
Yeah, I am thinking we might introduce * I try to prevent called it GNU property as possible since I don't want to make psABI seems like GNU-ish. |
e_flags bits are a scarce resource and I agree that we should be careful when allocating new bits. I think Link editors that support Arm BTI/PAC and Intel CET already have code decoding |
Moving to program property: #417 |
We didn't allocate bit for individual extension generally, but landing pad and (hardware) shadow stack will require dynamic linker to check all dependent DSOs, so it worth to allocate e_flags to those two speical extension.
EF_RISCV_CFI_LP
means this binary has build with landing pad, but NOT required the platform has support Zicfilp extension, since Zicfilp is using hint instruction, so it can be safely execute without Zicfilp, dynamic linker will check all dependent DSOs has set this flag, and enable the landing pad checking if all DSOs has support.EF_RISCV_CFI_SS
means this binary requires the Zimop or Zicfiss extension, which is different thanEF_RISCV_CFI_LP
, because it's NOT using hint instruction, dynamic linker will check all dependent DSOs has set this flag, and enable the shadow stack if all DSOs has support, otherwise enable Zimop mode only.NOTE:
Zicfiss
andZicfilp
are not frozen yet, this PR created for asking feedback and implement toolchain PoC