From patchwork Sat Mar 23 17:32:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Bugaev X-Patchwork-Id: 1915217 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=SXrQZ67e; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V25yz5lY9z1yXr for ; Sun, 24 Mar 2024 04:38:51 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CE1943858D28 for ; Sat, 23 Mar 2024 17:38:49 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id 9206A3858C66 for ; Sat, 23 Mar 2024 17:35:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9206A3858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9206A3858C66 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::136 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711215331; cv=none; b=NVnRtLK12HRn5F7Nc78smboE5x+U/lPQZK1yfhMS9oJiO6P0a+aHyiAvd/VLUYW3XBwWWFwOlf20JPA5Y4B5iIURaFlJ+Mof6UJowdWCNizjbGF2/Ke/lSQvPSUEL1qLGSOafK7OvkIY+QcLeNf5cLzrTWvTjTZ+XSmUKtcZIfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711215331; c=relaxed/simple; bh=aRAYH8cg/FQfG9vlbuB3pu7Fpu+FjypNtmhc19FAwaM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=DsM067jEtwV8Vsx48Y2z7MKessLgfLAb3oOmnxzWtaZ74QThRbIKHQ/NGxG6SqHMluOUrWsVuUa9I7P36006ppkP+zH/R8S9ijfNLWQW6jTmcmI808jGh0zD78sFQmMhUOZkFbtV6cMt067xl/JrjFah7n1cxIA5E+9vECZ9t2E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-512e4f4e463so3442320e87.1 for ; Sat, 23 Mar 2024 10:35:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711215327; x=1711820127; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sXaIzdehYTd1QI3bPvefmhKH8e0W7xDPTCky0pSsgKI=; b=SXrQZ67elkHBCIagqc62jehgg5IT7tz8KPyzX5kfTM5RNeELQXSwsSbylL3328g7g9 hXNvpEeD0un4Wd7KDtj+6EmGOUAjfwILa0FX4rC+xyqnkQtOSpQ7Y+GPegTkZQ+skHFO mNS3P3Sz1TnqQVHh13kfUDe6EWYYqFMQR6BWxPL84Qv1NYzx59BIFyh5NBQIjMioEOv1 pnEP6dbcG9WGSZuxFEGrYRvwClfh7+7SZ2G3dA8+rvP0wXIWm9ZAkJmM33v2tQD4pAGe Km7tPnVlUuroB8xm1RZrbUd58cMg6UGgCU8FJcBlQs73MYM+1tZjo/sGFiLWQfFGR2Vk /DDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711215327; x=1711820127; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sXaIzdehYTd1QI3bPvefmhKH8e0W7xDPTCky0pSsgKI=; b=bgAWLZMXMqhuzS9cNmDeEoQSYCkcnA1C1BqJGXHRP8lX03tZ4N9i9Re8gUzvmRbPYU zOYl7+7/fHv7gwFFNh7i9yaPPgTLzH4UuFwe0kF1CJN0tvbF+5qMg5ogce5ekzbppJmT hf2oC1UqhElyKH1XSZaFHd0dD2JeCVqsr7svxUZ+KYUG/0+YKaw21GLO69ALpz8HnvXp 72SduTb00QI+duXoDBcCoOvfRr7Qdk5S8mHrz23HNb43NDSb//KfEFiW/jGAFDBL0kPZ 1ZLfCA9j5RfZUl6Vw+eGG8Gy6K2yZFAypKHtRCZRd52lpM5wz74jixK9Kl44oId8mwBR gAYw== X-Gm-Message-State: AOJu0YxDnR/R9yl+HiQxNM+7mWsjSGJXDAthTDxEJSBycHyg0SwE63ZI rPo4UvRop/Zj6gmYKmBjHpk1etJcSZWYcWisYcqrQCQ9V+L3I60ZnzYDd9+R X-Google-Smtp-Source: AGHT+IFygH9GCkLwTFkbSYH963+iUH8jjIQ/CP5VSUr/esbSO8md5hbXNXBNnmXy1mDSL/Auy6pvpw== X-Received: by 2002:a19:7708:0:b0:515:9568:fb14 with SMTP id s8-20020a197708000000b005159568fb14mr1642482lfc.46.1711215326711; Sat, 23 Mar 2024 10:35:26 -0700 (PDT) Received: from surface-pro-6.. (79-139-171-253.dynamic.spd-mgts.ru. [79.139.171.253]) by smtp.gmail.com with ESMTPSA id g20-20020ac25394000000b00513973dee6fsm361290lfh.150.2024.03.23.10.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Mar 2024 10:35:26 -0700 (PDT) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Cc: Maxim Kuvyrkov , Luca Subject: [PATCH v2 15/20] hurd: Implement longjmp for AArch64 Date: Sat, 23 Mar 2024 20:32:56 +0300 Message-ID: <20240323173301.151066-16-bugaevc@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240323173301.151066-1-bugaevc@gmail.com> References: <20240323173301.151066-1-bugaevc@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org This is based on the generic AArch64 version, but it additionally respects and updates the Hurd sigstate. Signed-off-by: Sergey Bugaev --- Same patch as last time. Something somewhere here should probably be hooked up to the hurd_userlink mechanism; I haven't looked into that. sysdeps/aarch64/htl/tcb-offsets.sym | 5 + sysdeps/mach/hurd/aarch64/Makefile | 24 +++ sysdeps/mach/hurd/aarch64/____longjmp_chk.S | 173 +++++++++++++++++++ sysdeps/mach/hurd/aarch64/__longjmp.S | 150 ++++++++++++++++ sysdeps/mach/hurd/aarch64/signal-defines.sym | 10 ++ 5 files changed, 362 insertions(+) create mode 100644 sysdeps/aarch64/htl/tcb-offsets.sym create mode 100644 sysdeps/mach/hurd/aarch64/Makefile create mode 100644 sysdeps/mach/hurd/aarch64/____longjmp_chk.S create mode 100644 sysdeps/mach/hurd/aarch64/__longjmp.S create mode 100644 sysdeps/mach/hurd/aarch64/signal-defines.sym diff --git a/sysdeps/aarch64/htl/tcb-offsets.sym b/sysdeps/aarch64/htl/tcb-offsets.sym new file mode 100644 index 00000000..56140780 --- /dev/null +++ b/sysdeps/aarch64/htl/tcb-offsets.sym @@ -0,0 +1,5 @@ +#include +#include +#include + +SIGSTATE_OFFSET offsetof (tcbprehead_t, _hurd_sigstate) - sizeof (tcbprehead_t) diff --git a/sysdeps/mach/hurd/aarch64/Makefile b/sysdeps/mach/hurd/aarch64/Makefile new file mode 100644 index 00000000..9210d436 --- /dev/null +++ b/sysdeps/mach/hurd/aarch64/Makefile @@ -0,0 +1,24 @@ +# Copyright (C) 2020-2024 Free Software Foundation, Inc. +# This file is part of the GNU C Library. + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +ifeq ($(subdir),debug) +gen-as-const-headers += signal-defines.sym +endif + +ifeq ($(subdir),setjmp) +gen-as-const-headers += signal-defines.sym +endif diff --git a/sysdeps/mach/hurd/aarch64/____longjmp_chk.S b/sysdeps/mach/hurd/aarch64/____longjmp_chk.S new file mode 100644 index 00000000..90f062df --- /dev/null +++ b/sysdeps/mach/hurd/aarch64/____longjmp_chk.S @@ -0,0 +1,173 @@ +/* Copyright (C) 1997-2024 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +#define SS_ONSTACK 1 +#define SS_ONSTACK_BIT 0 + + .section .rodata.str1.1,"aMS",%progbits,1 + .type longjmp_msg,%object +longjmp_msg: + .string "longjmp causes uninitialized stack frame" + .size longjmp_msg, .-longjmp_msg + .text + +# define CALL_FAIL \ + adrp x0, longjmp_msg; \ + add x0, x0, :lo12:longjmp_msg; \ + b HIDDEN_JUMPTARGET(__fortify_fail) \ + +/* Jump to the position specified by ENV, causing the + setjmp call there to return VAL, or 1 if VAL is 0. + void __longjmp (__jmp_buf env, int val). */ + .text +ENTRY(____longjmp_chk) + cfi_def_cfa(x0, 0) + cfi_offset(x19, JB_X19<<3) + cfi_offset(x20, JB_X20<<3) + cfi_offset(x21, JB_X21<<3) + cfi_offset(x22, JB_X22<<3) + cfi_offset(x23, JB_X23<<3) + cfi_offset(x24, JB_X24<<3) + cfi_offset(x25, JB_X25<<3) + cfi_offset(x26, JB_X26<<3) + cfi_offset(x27, JB_X27<<3) + cfi_offset(x28, JB_X28<<3) + cfi_offset(x29, JB_X29<<3) + cfi_offset(x30, JB_LR<<3) + + cfi_offset( d8, JB_D8<<3) + cfi_offset( d9, JB_D9<<3) + cfi_offset(d10, JB_D10<<3) + cfi_offset(d11, JB_D11<<3) + cfi_offset(d12, JB_D12<<3) + cfi_offset(d13, JB_D13<<3) + cfi_offset(d14, JB_D14<<3) + cfi_offset(d15, JB_D15<<3) + + PTR_ARG (0) + + ldp x19, x20, [x0, #JB_X19<<3] + ldp x21, x22, [x0, #JB_X21<<3] + ldp x23, x24, [x0, #JB_X23<<3] + ldp x25, x26, [x0, #JB_X25<<3] + ldp x27, x28, [x0, #JB_X27<<3] +#ifdef PTR_DEMANGLE + ldp x29, x4, [x0, #JB_X29<<3] + PTR_DEMANGLE (30, 4, 3, 2) +#else + ldp x29, x30, [x0, #JB_X29<<3] +#endif + /* longjmp probe takes 3 arguments, address of jump buffer as + first argument (8@x0), return value as second argument (-4@x1), + and target address (8@x30), respectively. */ + LIBC_PROBE (longjmp, 3, 8@x0, -4@x1, 8@x30) + ldp d8, d9, [x0, #JB_D8<<3] + ldp d10, d11, [x0, #JB_D10<<3] + ldp d12, d13, [x0, #JB_D12<<3] + ldp d14, d15, [x0, #JB_D14<<3] + + /* Originally this was implemented with a series of + .cfi_restore() directives. + + The theory was that cfi_restore should revert to previous + frame value is the same as the current value. In practice + this doesn't work, even after cfi_restore() gdb continues + to try to recover a previous frame value offset from x0, + which gets stuffed after a few more instructions. The + cfi_same_value() mechanism appears to work fine. */ + + cfi_same_value(x19) + cfi_same_value(x20) + cfi_same_value(x21) + cfi_same_value(x22) + cfi_same_value(x23) + cfi_same_value(x24) + cfi_same_value(x25) + cfi_same_value(x26) + cfi_same_value(x27) + cfi_same_value(x28) + cfi_same_value(x29) + cfi_same_value(x30) + cfi_same_value(d8) + cfi_same_value(d9) + cfi_same_value(d10) + cfi_same_value(d11) + cfi_same_value(d12) + cfi_same_value(d13) + cfi_same_value(d14) + cfi_same_value(d15) +#ifdef PTR_DEMANGLE + ldr x4, [x0, #JB_SP<<3] + PTR_DEMANGLE (5, 4, 3, 2) +#else + ldr x5, [x0, #JB_SP<<3] +#endif + + mrs x3, tpidr_el0 +#if !defined (SHARED) || IS_IN (rtld) + cbz x3, L(ok) /* TLS not initialized yet */ +#endif + ldr x3, [x3, #SIGSTATE_OFFSET] + cbz x3, L(ok) /* sigstate not initialized yet */ + + ldrb w4, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)] + tbnz w4, #SS_ONSTACK_BIT, L(onstack) + /* We haven't been using an altstack. Jumping to a higher-address + frame is always allowed, otherwise it's not allowed. */ + mov x6, sp + cmp x5, x6 + b.lt L(ok) + +L(fail): + CALL_FAIL + +L(onstack): + /* We have been using an altstack. Was it above or below ours? */ + ldr x2, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SP__OFFSET)] + cmp x2, x5 + b.lt L(oks) /* Jumping below the altstack, switch */ + ldr x6, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)] + add x2, x2, x6 + cmp x2, x5 + b.lt L(ok) /* Jumping inside the altstack, do not switch */ + + /* Jumping above the altstack, switch */ +L(oks): + and w4, w4, #~(SS_ONSTACK) + str w4, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)] +L(ok): + mov sp, x5 + + /* longjmp_target probe takes 3 arguments, address of jump buffer + as first argument (8@x0), return value as second argument (-4@x1), + and target address (8@x30), respectively. */ + LIBC_PROBE (longjmp_target, 3, 8@x0, -4@x1, 8@x30) + cmp x1, #0 + mov x0, #1 + csel x0, x1, x0, ne + /* Use br instead of ret because ret is guaranteed to mispredict */ + br x30 +END (____longjmp_chk) diff --git a/sysdeps/mach/hurd/aarch64/__longjmp.S b/sysdeps/mach/hurd/aarch64/__longjmp.S new file mode 100644 index 00000000..c9f2e1ce --- /dev/null +++ b/sysdeps/mach/hurd/aarch64/__longjmp.S @@ -0,0 +1,150 @@ +/* Copyright (C) 1997-2024 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +#define SS_ONSTACK 1 +#define SS_ONSTACK_BIT 0 + +/* __longjmp(jmpbuf, val) */ + +ENTRY (__longjmp) + cfi_def_cfa(x0, 0) + cfi_offset(x19, JB_X19<<3) + cfi_offset(x20, JB_X20<<3) + cfi_offset(x21, JB_X21<<3) + cfi_offset(x22, JB_X22<<3) + cfi_offset(x23, JB_X23<<3) + cfi_offset(x24, JB_X24<<3) + cfi_offset(x25, JB_X25<<3) + cfi_offset(x26, JB_X26<<3) + cfi_offset(x27, JB_X27<<3) + cfi_offset(x28, JB_X28<<3) + cfi_offset(x29, JB_X29<<3) + cfi_offset(x30, JB_LR<<3) + + cfi_offset( d8, JB_D8<<3) + cfi_offset( d9, JB_D9<<3) + cfi_offset(d10, JB_D10<<3) + cfi_offset(d11, JB_D11<<3) + cfi_offset(d12, JB_D12<<3) + cfi_offset(d13, JB_D13<<3) + cfi_offset(d14, JB_D14<<3) + cfi_offset(d15, JB_D15<<3) + + PTR_ARG (0) + + ldp x19, x20, [x0, #JB_X19<<3] + ldp x21, x22, [x0, #JB_X21<<3] + ldp x23, x24, [x0, #JB_X23<<3] + ldp x25, x26, [x0, #JB_X25<<3] + ldp x27, x28, [x0, #JB_X27<<3] +#ifdef PTR_DEMANGLE + ldp x29, x4, [x0, #JB_X29<<3] + PTR_DEMANGLE (30, 4, 3, 2) +#else + ldp x29, x30, [x0, #JB_X29<<3] +#endif + /* longjmp probe takes 3 arguments, address of jump buffer as + first argument (8@x0), return value as second argument (-4@x1), + and target address (8@x30), respectively. */ + LIBC_PROBE (longjmp, 3, 8@x0, -4@x1, 8@x30) + ldp d8, d9, [x0, #JB_D8<<3] + ldp d10, d11, [x0, #JB_D10<<3] + ldp d12, d13, [x0, #JB_D12<<3] + ldp d14, d15, [x0, #JB_D14<<3] + + /* Originally this was implemented with a series of + .cfi_restore() directives. + + The theory was that cfi_restore should revert to previous + frame value is the same as the current value. In practice + this doesn't work, even after cfi_restore() gdb continues + to try to recover a previous frame value offset from x0, + which gets stuffed after a few more instructions. The + cfi_same_value() mechanism appears to work fine. */ + + cfi_same_value(x19) + cfi_same_value(x20) + cfi_same_value(x21) + cfi_same_value(x22) + cfi_same_value(x23) + cfi_same_value(x24) + cfi_same_value(x25) + cfi_same_value(x26) + cfi_same_value(x27) + cfi_same_value(x28) + cfi_same_value(x29) + cfi_same_value(x30) + cfi_same_value(d8) + cfi_same_value(d9) + cfi_same_value(d10) + cfi_same_value(d11) + cfi_same_value(d12) + cfi_same_value(d13) + cfi_same_value(d14) + cfi_same_value(d15) +#ifdef PTR_DEMANGLE + ldr x4, [x0, #JB_SP<<3] + PTR_DEMANGLE (5, 4, 3, 2) +#else + ldr x5, [x0, #JB_SP<<3] +#endif + + mrs x3, tpidr_el0 +#if !defined (SHARED) || IS_IN (rtld) + cbz x3, L(ok) /* TLS not initialized yet */ +#endif + ldr x3, [x3, #SIGSTATE_OFFSET] + cbz x3, L(ok) /* sigstate not initialized yet */ + /* If we haven't been using an altstack, don't switch */ + ldrb w4, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)] + tbz w4, #SS_ONSTACK_BIT, L(ok) + + /* We have been using an altstack. Was it above or below ours? */ + ldr x2, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SP__OFFSET)] + cmp x2, x5 + b.lt L(oks) /* Jumping below the altstack, switch */ + ldr x6, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_SIZE__OFFSET)] + add x2, x2, x6 + cmp x2, x5 + b.lt L(ok) /* Jumping inside the altstack, do not switch */ + + /* Jumping above the altstack, switch */ +L(oks): + and w4, w4, #~(SS_ONSTACK) + str w4, [x3, # (HURD_SIGSTATE__SIGALTSTACK__OFFSET + SIGALTSTACK__SS_FLAGS__OFFSET)] +L(ok): + mov sp, x5 + + /* longjmp_target probe takes 3 arguments, address of jump buffer + as first argument (8@x0), return value as second argument (-4@x1), + and target address (8@x30), respectively. */ + LIBC_PROBE (longjmp_target, 3, 8@x0, -4@x1, 8@x30) + cmp x1, #0 + mov x0, #1 + csel x0, x1, x0, ne + /* Use br instead of ret because ret is guaranteed to mispredict */ + br x30 +END (__longjmp) diff --git a/sysdeps/mach/hurd/aarch64/signal-defines.sym b/sysdeps/mach/hurd/aarch64/signal-defines.sym new file mode 100644 index 00000000..e42bbbe0 --- /dev/null +++ b/sysdeps/mach/hurd/aarch64/signal-defines.sym @@ -0,0 +1,10 @@ +#include +#include + +-- + +HURD_SIGSTATE__SIGALTSTACK__OFFSET offsetof(struct hurd_sigstate, sigaltstack) + +SIGALTSTACK__SS_SP__OFFSET offsetof(stack_t, ss_sp) +SIGALTSTACK__SS_SIZE__OFFSET offsetof(stack_t, ss_size) +SIGALTSTACK__SS_FLAGS__OFFSET offsetof(stack_t, ss_flags)