From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id 8DC7B38451B0 for ; Tue, 29 Nov 2022 01:24:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8DC7B38451B0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id DE8D7300089; Tue, 29 Nov 2022 01:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1669685040; bh=RkPUdBBTLI9g8IVNboL7g1P30pw+Ucn6L9gRW53G61A=; h=From:To:Cc:Subject:Date:Message-Id:Mime-Version: Content-Transfer-Encoding; b=KJTjXw+uk8SiX6bWW7aU2P2YqkXyaBO/iLbZXTQSkv2YOKH6KrYy71eC76WYQNpSt Zq3p7j9zFtan9aSQorOXha0U4Dl4JunT8KBLR0I7rKNO462JX7jMcp3A7Ox79UGiCf jZbgbw/pVq6OOj2h4n+ewTZESN3EmuQ6vMqA4NHU= From: Tsukasa OI To: Tsukasa OI Cc: binutils@sourceware.org Subject: [REVIEW ONLY 0/3] UNRATIFIED RISC-V: Add 'Zisslpcfi' extension and its TENTATIVE CSRs Date: Tue, 29 Nov 2022 01:23:56 +0000 Message-Id: Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 List-Id: *** WAIT FOR SPECIFICATION FREEZE *** This is an implementation for unratified and not frozen RISC-V extension and not intended to be merged for now. The only intent to submit this patchset is to test new instructions for your (possibly virtual) environment and early review for fast adoption after ratification. This patchset adds following unratified extension to GNU Binutils: - 'Zisslpcfi' (Control-Flow Integrity - Shadow Stacks and Landing Pads) version 0.1 (may change on ratification) which adds 11 instructions (all are MOPs [a type of instruction defined in the 'Zimop' extension as rd=0 by default but allowed to change architectural state if certain features are supported and optionally enabled; unlike HINTs, changing the state is allowed]) and 4 CSRs. This extension is a part of Control-Flow Integrity (CFI) and with this, many types of control-flow attacks usually caused by a buffer overflow (including ROP/JOP/COP) can be prevented/mitigated. Since landing pads come with tags, targeting certain address is harder than Intel's Indirect Branch Tracking. This is based on the commit 6400f27c3742 of: and following change not reflected in the documentation yet: - Extension name: 'Zimop', not 'Zimops' This is told by the author of the upcoming 'Zimop' extension, Dr. Andrew Waterman himself. Note that all (4) CSR values are not allocated yet. So, these CSRs are assigned with custom range values and this patchset comes with an instantiation script ("$(srcdir)/instantiate-zisslpcfi.sh") to assign custom values (overwrites all related files and removes itself). Because of dependency to the 'Zimop' extension (which documentation is not available yet [upcoming]), this patchset is NEVER going to be committed as is (even if a maintainer approves). Be careful. Tsukasa OI (3): RISC-V: Add "XUN@S" operand type UNRATIFIED RISC-V: Add 'Zisslpcfi' extension and its TENTATIVE CSRs TEST: Add instantiation script on CSR allocation bfd/elfxx-riscv.c | 8 ++ gas/config/tc-riscv.c | 6 + gas/testsuite/gas/riscv/csr-dw-regnums.d | 2 + gas/testsuite/gas/riscv/csr-dw-regnums.s | 3 + gas/testsuite/gas/riscv/csr-version-1p10.d | 4 + gas/testsuite/gas/riscv/csr-version-1p10.l | 4 + gas/testsuite/gas/riscv/csr-version-1p11.d | 4 + gas/testsuite/gas/riscv/csr-version-1p11.l | 4 + gas/testsuite/gas/riscv/csr-version-1p12.d | 4 + gas/testsuite/gas/riscv/csr-version-1p12.l | 4 + gas/testsuite/gas/riscv/csr-version-1p9p1.d | 4 + gas/testsuite/gas/riscv/csr-version-1p9p1.l | 4 + gas/testsuite/gas/riscv/csr.s | 4 + gas/testsuite/gas/riscv/zisslpcfi-fail.d | 2 + gas/testsuite/gas/riscv/zisslpcfi-fail.l | 19 +++ gas/testsuite/gas/riscv/zisslpcfi-fail.s | 26 ++++ gas/testsuite/gas/riscv/zisslpcfi-noarch.d | 3 + gas/testsuite/gas/riscv/zisslpcfi-noarch.l | 24 ++++ gas/testsuite/gas/riscv/zisslpcfi.d | 31 +++++ gas/testsuite/gas/riscv/zisslpcfi.s | 26 ++++ include/opcode/riscv-opc.h | 41 +++++++ include/opcode/riscv.h | 1 + instantiate-zisslpcfi.sh | 127 ++++++++++++++++++++ opcodes/riscv-dis.c | 9 +- opcodes/riscv-opc.c | 19 +++ 25 files changed, 380 insertions(+), 3 deletions(-) create mode 100644 gas/testsuite/gas/riscv/zisslpcfi-fail.d create mode 100644 gas/testsuite/gas/riscv/zisslpcfi-fail.l create mode 100644 gas/testsuite/gas/riscv/zisslpcfi-fail.s create mode 100644 gas/testsuite/gas/riscv/zisslpcfi-noarch.d create mode 100644 gas/testsuite/gas/riscv/zisslpcfi-noarch.l create mode 100644 gas/testsuite/gas/riscv/zisslpcfi.d create mode 100644 gas/testsuite/gas/riscv/zisslpcfi.s create mode 100755 instantiate-zisslpcfi.sh base-commit: cb44f89ce977b1ab2d4063f2487950bddfb75bc7 -- 2.38.1