From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id DBCC01F451 for ; Wed, 3 Jan 2024 17:22:14 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=ZzSntopR; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15675385783C for ; Wed, 3 Jan 2024 17:22:14 +0000 (GMT) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by sourceware.org (Postfix) with ESMTPS id 8B0283857C4B for ; Wed, 3 Jan 2024 17:15:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B0283857C4B 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 8B0283857C4B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::129 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704302127; cv=none; b=HhWeIxJbmoA/Y2DXIdM2LFmwqkghP8X63UeAM2TKcVzgfYcXL2JJYqSncawd70957d9wluInlBLLRX0WKwdC8fj8ok7G1eKakYoif6CEpfQNm+9hzP2v4vgp1a239ykPUg4ezf2ODY6Mg9CF3MXDKSTjlItSh6QRDeLGx48EvXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704302127; c=relaxed/simple; bh=uvIgA5MdyOI4ldedeXy5Luy98i3OIJ10azVVP7bztpI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Od0okARv5FU0f/VnlAGKShgbV5a2u7+UbAjycQMxrx2VjqYcwwbsPh7xCdHelmegVm6KusAhuIsqmJc+IeGJNzYq7WMHDiXUHud/PtXOzPq91bkJjgjNYq1DDy8BxlHAXbCr/xew03y0fma9Wmrfur1P3xa3l//CRmBH8CHFfC4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-50e6ee8e911so9177425e87.1 for ; Wed, 03 Jan 2024 09:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704302122; x=1704906922; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Ve+kEy/ecuycFiWd9KbOD1CIzcWohNfrCFm0uuGF4z4=; b=ZzSntopRRLClKOvZKv+b5Fb3Fckq6IG9ioF+q01gdAnjSvyq9SaY3x879y7OGa5wqT JKl5p0cwo3qn3E4o2rlF3Gjr2lAd1TjD8V1c9gPLvkWe5k8/a/m/w7SOaSCd70KyozEO LDI/c0z+bKmQ6pzqrraVEA9wuk7O9KD5GU1mMcvs2NT/GBvKzUQTfctig8oFprgMpcAV vkMWVUdrroRrjImGwphea+AZq8rNp4q+bzwFFYYj4mM4SNTadYMWlSqfAQ5SYiOM9BeN SGAmFQCX5La2cjwR6O+zZ22rLzCdJ5cN+u8ueU70cuRYxcWpaICMRQ2oPMD+WUV60oDG Q9ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704302122; x=1704906922; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ve+kEy/ecuycFiWd9KbOD1CIzcWohNfrCFm0uuGF4z4=; b=wr3i7uLhB9c8DwmnHg0ThRjg/V9ZdSrz9lIdbq8JGyNYGdF1aDjXKl/O9FcDqnvxt1 0o6BeGglLxYg3Ubx6gulvkf5l/b+8yufNCADnCq3zDrzXvGbpSkiw0m9/myie5QqUaVY EEJWmVTQkOovs/zgMDaH3iZRTtyPt46CXAJP9mZA1DJDxM2ckbdq+cIft6cA8rW9rvxO 7P1dn1iln5V+cQ6G/Q0LRYzOS37qqbOGLUOd1390XIjEl576v5h4zstN80feJ6FlC7yk 9gNMHjvqzyQt7zD4uxcV8mhWX+cn+1eZeGhhIFoa85l48g9hoILRyzVikBSL3gZtaZmA U8YQ== X-Gm-Message-State: AOJu0YyiOgA/9A5t+Pf415jDrczERRIMBJg0oeYly9O/H7KFf2TmkThf 2+1c+2BGddgnXLxP8G2Qk7Q5uOicBo0= X-Google-Smtp-Source: AGHT+IGHqJ0mltKCO1934EjLOH35vBBNqjnt/mybqqgE9xdvy7ixm8zGAkZfTljw5tXUp8pDXYx36A== X-Received: by 2002:a19:2d07:0:b0:50e:76cd:f3f with SMTP id k7-20020a192d07000000b0050e76cd0f3fmr6281257lfj.54.1704302121672; Wed, 03 Jan 2024 09:15:21 -0800 (PST) Received: from surface-pro-6.. ([2a00:1370:818c:b32f:ebdc:fd0:376b:8006]) by smtp.gmail.com with ESMTPSA id y23-20020a196417000000b0050e6d84d177sm3546068lfb.279.2024.01.03.09.15.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 09:15:21 -0800 (PST) From: Sergey Bugaev To: libc-alpha@sourceware.org, bug-hurd@gnu.org Subject: [RFC PATCH 18/23] hurd: Implement longjmp for AArch64 Date: Wed, 3 Jan 2024 20:14:51 +0300 Message-ID: <20240103171502.1358371-19-bugaevc@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240103171502.1358371-1-bugaevc@gmail.com> References: <20240103171502.1358371-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+e=80x24.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 --- This is also entirely untested. Please review carefully. 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) -- 2.43.0