aboutsummaryrefslogtreecommitdiff
path: root/src/lj_err.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_err.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/lj_err.c b/src/lj_err.c
index 9652ef35..a0a28692 100644
--- a/src/lj_err.c
+++ b/src/lj_err.c
@@ -444,10 +444,10 @@ LJ_FUNCA int lj_err_unwind_dwarf(int version, int actions,
444 if ((actions & _UA_FORCE_UNWIND)) { 444 if ((actions & _UA_FORCE_UNWIND)) {
445 return _URC_CONTINUE_UNWIND; 445 return _URC_CONTINUE_UNWIND;
446 } else if (cf) { 446 } else if (cf) {
447 ASMFunction ip;
447 _Unwind_SetGR(ctx, LJ_TARGET_EHRETREG, errcode); 448 _Unwind_SetGR(ctx, LJ_TARGET_EHRETREG, errcode);
448 _Unwind_SetIP(ctx, (uintptr_t)(cframe_unwind_ff(cf) ? 449 ip = cframe_unwind_ff(cf) ? lj_vm_unwind_ff_eh : lj_vm_unwind_c_eh;
449 lj_vm_unwind_ff_eh : 450 _Unwind_SetIP(ctx, (uintptr_t)lj_ptr_strip(ip));
450 lj_vm_unwind_c_eh));
451 return _URC_INSTALL_CONTEXT; 451 return _URC_INSTALL_CONTEXT;
452 } 452 }
453#if LJ_TARGET_X86ORX64 453#if LJ_TARGET_X86ORX64
@@ -580,9 +580,17 @@ extern void __deregister_frame(const void *);
580 580
581uint8_t *lj_err_register_mcode(void *base, size_t sz, uint8_t *info) 581uint8_t *lj_err_register_mcode(void *base, size_t sz, uint8_t *info)
582{ 582{
583 void **handler; 583 ASMFunction handler = (ASMFunction)err_unwind_jit;
584 memcpy(info, err_frame_jit_template, sizeof(err_frame_jit_template)); 584 memcpy(info, err_frame_jit_template, sizeof(err_frame_jit_template));
585 handler = (void *)err_unwind_jit; 585#if LJ_ABI_PAUTH
586#if LJ_TARGET_ARM64
587 handler = ptrauth_auth_and_resign(handler,
588 ptrauth_key_function_pointer, 0,
589 ptrauth_key_process_independent_code, info + ERR_FRAME_JIT_OFS_HANDLER);
590#else
591#error "missing pointer authentication support for this architecture"
592#endif
593#endif
586 memcpy(info + ERR_FRAME_JIT_OFS_HANDLER, &handler, sizeof(handler)); 594 memcpy(info + ERR_FRAME_JIT_OFS_HANDLER, &handler, sizeof(handler));
587 *(uint32_t *)(info + ERR_FRAME_JIT_OFS_CODE_SIZE) = 595 *(uint32_t *)(info + ERR_FRAME_JIT_OFS_CODE_SIZE) =
588 (uint32_t)(sz - sizeof(err_frame_jit_template) - (info - (uint8_t *)base)); 596 (uint32_t)(sz - sizeof(err_frame_jit_template) - (info - (uint8_t *)base));