[PATCH v4 11/17] riscv/cfi: Support locking/disabling CFI and move OS depedent code
Bill Roberts
bill.roberts@foss.arm.com
Thu Sep 10 14:33:30 GMT 2026
On 5/26/26 1:16 AM, Jesse Huang wrote:
> +static __always_inline int
> +dl_cfi_lock_cfi (unsigned int feature)
> +{
> + int res = 0;
> +#ifdef __riscv_landing_pad
> + if (feature & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED)
> + res |= prctl (PR_LOCK_INDIR_BR_LP_STATUS, 0, 0, 0, 0);
> +#endif /* __riscv_landing_pad */
> +#ifdef __riscv_shadow_stack
> + if (feature & GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS)
> + res |= prctl (PR_LOCK_SHADOW_STACK_STATUS, 0, 0, 0, 0);
arg2 should be PR_SHADOW_STACK_ENABLE to lock this, not 0.
This would mean it's all *unlocked*.
I am going to float a patch to the kernel before this lands, so
hopefully to prevent this broken behavior from becoming
a thing.
More information about the Libc-alpha
mailing list