Message ID | 20241023110528.487830-1-yury.khrustalev@arm.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A06133858C56 for <patchwork@sourceware.org>; Wed, 23 Oct 2024 11:06:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 7758D3858D21; Wed, 23 Oct 2024 11:05:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7758D3858D21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7758D3858D21 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729681548; cv=none; b=qXjHUaw+d6woLMa4VEiJAykrL7QqJXI3KlKCwEtu1WtmA3prxJqR1E2ygG2COIOcL7lFv9TTBpGh8qdvcpQ+Pdhl5DXheBF20f2Z6pfeBtWsYcK+5yfc4S0L/IQlay+0WFGgXENafB5qEp0X+9trP4IFmyVjMXZTQMOdATjb1Bw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729681548; c=relaxed/simple; bh=JS/da9XVQW59xeXjMb2wdTkpIOn4BVB+69oL5eGfFjc=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=Y90rms8DXvqfT1PgytY0wHnnDlASeFK6+VGiIgTNySBZolqL8A1wCsLnFqaTgRey4ewAxc54qMXLIroPGI6mEUP/wx3McZs75LEeJ/4jhRYKNkguWt+ZwX/7/6DSIQooK7eCSn3iXTacOCBkudcW6mDTjbXasTcxVvpHp+4T3Ok= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CCA12339; Wed, 23 Oct 2024 04:06:15 -0700 (PDT) Received: from udebian.localdomain (unknown [10.1.39.30]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7124D3F528; Wed, 23 Oct 2024 04:05:45 -0700 (PDT) From: Yury Khrustalev <yury.khrustalev@arm.com> To: gcc-patches@gcc.gnu.org Cc: nsz@gcc.gnu.org, richard.earnshaw@arm.com, matthieu.longo@arm.com, richard.ball@arm.com Subject: [PATCH 00/22] aarch64: Add support for Guarded Control Stack extension Date: Wed, 23 Oct 2024 12:05:06 +0100 Message-Id: <20241023110528.487830-1-yury.khrustalev@arm.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org |
Series |
aarch64: Add support for Guarded Control Stack extension
|
|
Message
Yury Khrustalev
Oct. 23, 2024, 11:05 a.m. UTC
This patch series adds support for the Guarded Control Stack extension [1]. GCS marking for binaries is specified in [2]. Regression tested on AArch64 and no regressions have been found. Is this OK for trunk? Sources and branches: - binutils-gdb: sourceware.org/git/binutils-gdb.git users/ARM/gcs - gcc: this patch series, or gcc.gnu.org/git/gcc.git vendors/ARM/gcs-v3 see https://gcc.gnu.org/gitwrite.html#vendor for setup details - glibc: sourceware.org/git/glibc.git arm/gcs-v2 - kernel: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/gcs Cross-building the toolchain for target aarch64-none-linux-gnu: - build and install binutils-gdb - build and install GCC stage 1 - install kernel headers - install glibc headers - build and install GCC stage 2 configuring with --enable-standard-branch-protection - build and install glibc - build and install GCC stage 3 along with target libraries configuring with --enable-standard-branch-protection FVP model provided by the Shrinkwrap tool [3] can be used for testing. Run tests with environment var GLIBC_TUNABLES=glibc.cpu.aarch64_gcs=1:glibc.cpu.aarch64_gcs_policy=2 See details about Glibc tunables in corresponding Glibc patch [4]. Corresponding binutils patch [5]. [1] https://developer.arm.com/documentation/ddi0487/ka/ (chapter D11) [2] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst [3] https://git.gitlab.arm.com/tooling/shrinkwrap.git [4] https://inbox.sourceware.org/libc-alpha/20241023083920.466015-1-yury.khrustalev@arm.com/ [5] https://inbox.sourceware.org/binutils/20241014101743.3222246-1-yury.khrustalev@arm.com/ --- Matthieu Longo (1): aarch64: Fix tests incompatible with GCS Richard Ball (1): aarch64: Add tests and docs for indirect_return attribute Szabolcs Nagy (19): aarch64: Add -mbranch-protection=gcs option aarch64: Add branch-protection target pragma tests aarch64: Add support for chkfeat insn aarch64: Add __builtin_aarch64_chkfeat aarch64: Add __builtin_aarch64_chkfeat tests aarch64: Add GCS instructions aarch64: Add GCS builtins aarch64: Add __builtin_aarch64_gcs* tests aarch64: Add GCS support for nonlocal stack save aarch64: Add non-local goto and jump tests for GCS aarch64: Add ACLE feature macros for GCS aarch64: Add test for GCS ACLE defs aarch64: Add target pragma tests for gcs aarch64: Add GCS support to the unwinder aarch64: Emit GNU property NOTE for GCS aarch64: libgcc: add GCS marking to asm aarch64: libatomic: add GCS marking to asm aarch64: libitm: Add GCS support aarch64: Introduce indirect_return attribute Yury Khrustalev (1): aarch64: Fix nonlocal goto tests incompatible with GCS gcc/config/aarch64/aarch64-builtins.cc | 88 ++++++++++++ gcc/config/aarch64/aarch64-c.cc | 3 + gcc/config/aarch64/aarch64-protos.h | 2 + gcc/config/aarch64/aarch64.cc | 40 ++++++ gcc/config/aarch64/aarch64.h | 7 + gcc/config/aarch64/aarch64.md | 126 ++++++++++++++++++ gcc/config/aarch64/aarch64.opt | 3 + gcc/config/arm/aarch-bti-insert.cc | 36 ++++- gcc/configure | 2 +- gcc/configure.ac | 6 +- gcc/doc/extend.texi | 5 + gcc/doc/invoke.texi | 5 +- gcc/testsuite/g++.target/aarch64/pr94515-1.C | 6 +- .../return_address_sign_ab_exception.C | 19 ++- gcc/testsuite/gcc.target/aarch64/chkfeat-1.c | 75 +++++++++++ gcc/testsuite/gcc.target/aarch64/chkfeat-2.c | 15 +++ gcc/testsuite/gcc.target/aarch64/eh_return.c | 13 ++ .../gcc.target/aarch64/gcs-nonlocal-1.c | 25 ++++ .../gcc.target/aarch64/gcs-nonlocal-2.c | 21 +++ .../gcc.target/aarch64/gcs-nonlocal-3.c | 33 +++++ gcc/testsuite/gcc.target/aarch64/gcspopm-1.c | 69 ++++++++++ gcc/testsuite/gcc.target/aarch64/gcspr-1.c | 31 +++++ gcc/testsuite/gcc.target/aarch64/gcsss-1.c | 49 +++++++ .../gcc.target/aarch64/indirect_return.c | 25 ++++ gcc/testsuite/gcc.target/aarch64/pr104689.c | 3 +- .../gcc.target/aarch64/pragma_cpp_predefs_1.c | 30 +++++ .../gcc.target/aarch64/pragma_cpp_predefs_4.c | 85 ++++++++++++ .../gcc.target/aarch64/sme/nonlocal_goto_4.c | 2 +- .../gcc.target/aarch64/sme/nonlocal_goto_5.c | 2 +- .../gcc.target/aarch64/sme/nonlocal_goto_6.c | 2 +- libatomic/config/linux/aarch64/atomic_16.S | 11 +- libgcc/config/aarch64/aarch64-asm.h | 16 ++- libgcc/config/aarch64/aarch64-unwind.h | 59 +++++++- libitm/config/aarch64/sjlj.S | 60 ++++++++- libitm/config/aarch64/target.h | 1 + 35 files changed, 944 insertions(+), 31 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/chkfeat-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/chkfeat-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcspopm-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcspr-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/gcsss-1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/indirect_return.c
Comments
Yury Khrustalev <yury.khrustalev@arm.com> writes: > This patch series adds support for the Guarded Control Stack extension [1]. > > GCS marking for binaries is specified in [2]. > > Regression tested on AArch64 and no regressions have been found. > > Is this OK for trunk? > > Sources and branches: > - binutils-gdb: sourceware.org/git/binutils-gdb.git users/ARM/gcs > - gcc: this patch series, or > gcc.gnu.org/git/gcc.git vendors/ARM/gcs-v3 > see https://gcc.gnu.org/gitwrite.html#vendor for setup details > - glibc: sourceware.org/git/glibc.git arm/gcs-v2 > - kernel: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/gcs > > Cross-building the toolchain for target aarch64-none-linux-gnu: > - build and install binutils-gdb > - build and install GCC stage 1 > - install kernel headers > - install glibc headers > - build and install GCC stage 2 configuring with --enable-standard-branch-protection > - build and install glibc > - build and install GCC stage 3 along with target libraries configuring with --enable-standard-branch-protection > > FVP model provided by the Shrinkwrap tool [3] can be used for testing. > > Run tests with environment var > > GLIBC_TUNABLES=glibc.cpu.aarch64_gcs=1:glibc.cpu.aarch64_gcs_policy=2 > > See details about Glibc tunables in corresponding Glibc patch [4]. > > Corresponding binutils patch [5]. > > [1] https://developer.arm.com/documentation/ddi0487/ka/ (chapter D11) > [2] https://github.com/ARM-software/abi-aa/blob/main/sysvabi64/sysvabi64.rst > [3] https://git.gitlab.arm.com/tooling/shrinkwrap.git > [4] https://inbox.sourceware.org/libc-alpha/20241023083920.466015-1-yury.khrustalev@arm.com/ > [5] https://inbox.sourceware.org/binutils/20241014101743.3222246-1-yury.khrustalev@arm.com/ Thanks for this. I've replied to some individual patches, but the ones I didn't reply to look ok as-is. Richard > > --- > > Matthieu Longo (1): > aarch64: Fix tests incompatible with GCS > > Richard Ball (1): > aarch64: Add tests and docs for indirect_return attribute > > Szabolcs Nagy (19): > aarch64: Add -mbranch-protection=gcs option > aarch64: Add branch-protection target pragma tests > aarch64: Add support for chkfeat insn > aarch64: Add __builtin_aarch64_chkfeat > aarch64: Add __builtin_aarch64_chkfeat tests > aarch64: Add GCS instructions > aarch64: Add GCS builtins > aarch64: Add __builtin_aarch64_gcs* tests > aarch64: Add GCS support for nonlocal stack save > aarch64: Add non-local goto and jump tests for GCS > aarch64: Add ACLE feature macros for GCS > aarch64: Add test for GCS ACLE defs > aarch64: Add target pragma tests for gcs > aarch64: Add GCS support to the unwinder > aarch64: Emit GNU property NOTE for GCS > aarch64: libgcc: add GCS marking to asm > aarch64: libatomic: add GCS marking to asm > aarch64: libitm: Add GCS support > aarch64: Introduce indirect_return attribute > > Yury Khrustalev (1): > aarch64: Fix nonlocal goto tests incompatible with GCS > > gcc/config/aarch64/aarch64-builtins.cc | 88 ++++++++++++ > gcc/config/aarch64/aarch64-c.cc | 3 + > gcc/config/aarch64/aarch64-protos.h | 2 + > gcc/config/aarch64/aarch64.cc | 40 ++++++ > gcc/config/aarch64/aarch64.h | 7 + > gcc/config/aarch64/aarch64.md | 126 ++++++++++++++++++ > gcc/config/aarch64/aarch64.opt | 3 + > gcc/config/arm/aarch-bti-insert.cc | 36 ++++- > gcc/configure | 2 +- > gcc/configure.ac | 6 +- > gcc/doc/extend.texi | 5 + > gcc/doc/invoke.texi | 5 +- > gcc/testsuite/g++.target/aarch64/pr94515-1.C | 6 +- > .../return_address_sign_ab_exception.C | 19 ++- > gcc/testsuite/gcc.target/aarch64/chkfeat-1.c | 75 +++++++++++ > gcc/testsuite/gcc.target/aarch64/chkfeat-2.c | 15 +++ > gcc/testsuite/gcc.target/aarch64/eh_return.c | 13 ++ > .../gcc.target/aarch64/gcs-nonlocal-1.c | 25 ++++ > .../gcc.target/aarch64/gcs-nonlocal-2.c | 21 +++ > .../gcc.target/aarch64/gcs-nonlocal-3.c | 33 +++++ > gcc/testsuite/gcc.target/aarch64/gcspopm-1.c | 69 ++++++++++ > gcc/testsuite/gcc.target/aarch64/gcspr-1.c | 31 +++++ > gcc/testsuite/gcc.target/aarch64/gcsss-1.c | 49 +++++++ > .../gcc.target/aarch64/indirect_return.c | 25 ++++ > gcc/testsuite/gcc.target/aarch64/pr104689.c | 3 +- > .../gcc.target/aarch64/pragma_cpp_predefs_1.c | 30 +++++ > .../gcc.target/aarch64/pragma_cpp_predefs_4.c | 85 ++++++++++++ > .../gcc.target/aarch64/sme/nonlocal_goto_4.c | 2 +- > .../gcc.target/aarch64/sme/nonlocal_goto_5.c | 2 +- > .../gcc.target/aarch64/sme/nonlocal_goto_6.c | 2 +- > libatomic/config/linux/aarch64/atomic_16.S | 11 +- > libgcc/config/aarch64/aarch64-asm.h | 16 ++- > libgcc/config/aarch64/aarch64-unwind.h | 59 +++++++- > libitm/config/aarch64/sjlj.S | 60 ++++++++- > libitm/config/aarch64/target.h | 1 + > 35 files changed, 944 insertions(+), 31 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/aarch64/chkfeat-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/chkfeat-2.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-2.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcs-nonlocal-3.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcspopm-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcspr-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/gcsss-1.c > create mode 100644 gcc/testsuite/gcc.target/aarch64/indirect_return.c
On Thu, Oct 24, 2024 at 06:47:07PM +0100, Richard Sandiford wrote: > Yury Khrustalev <yury.khrustalev@arm.com> writes: > > This patch series adds support for the Guarded Control Stack extension. > > > > Thanks for this. I've replied to some individual patches, but the > ones I didn't reply to look ok as-is. > > Richard > Thank you for your comments and suggestions. I've tried to address them in the v2 version of this patch series: https://inbox.sourceware.org/gcc-patches/20241031132323.948159-1-yury.khrustalev@arm.com/ There are only two things that are still outstanding: 1. Unwinder changes [1]. 2. Implementation of the indirect_return attribute [2] I will address them shortly in v3. [1] https://inbox.sourceware.org/gcc-patches/mptplnpwjo3.fsf@arm.com/ [2] https://inbox.sourceware.org/gcc-patches/mptttd1v2qo.fsf@arm.com/ Kind regards, Yury