From patchwork Mon Apr 26 01:50:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 1470151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ojcwi3/3; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 ozlabs.org (Postfix) with ESMTPS id 4FT7D854zXz9sW7 for ; Mon, 26 Apr 2021 11:51:36 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 759D238515D4; Mon, 26 Apr 2021 01:51:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 759D238515D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1619401894; bh=5vGshGE7bjSsc243hsLmQuY5WL+iF35Rj7RYlW0HRvc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ojcwi3/3VFXJkJkYE8ikZTvwBZFmhqNYhD0mro6sHmqNKRIy6Z0sQSrWz8QSw9ie9 o4KfSTK3K2PQJRPbuUsZOHWNzWFNhdLSKdDLLRKoDR+bK8xCTHpjq33Ru4Tnt4x2Lg vbk7ssHVC6XwyTYW54SIy5oDueq3u/LGEnmbq2IA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 571B8385780C for ; Mon, 26 Apr 2021 01:51:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 571B8385780C Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 13Q1YYTx067723; Sun, 25 Apr 2021 21:51:31 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 385ksg0e1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Apr 2021 21:51:31 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 13Q1Yoen068510; Sun, 25 Apr 2021 21:51:31 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 385ksg0e1a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Apr 2021 21:51:30 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 13Q1lHcq018864; Mon, 26 Apr 2021 01:50:29 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma05wdc.us.ibm.com with ESMTP id 384ay930by-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 26 Apr 2021 01:50:29 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 13Q1oSAP61670002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 26 Apr 2021 01:50:28 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C07B86E054; Mon, 26 Apr 2021 01:50:28 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2CB26E04C; Mon, 26 Apr 2021 01:50:28 +0000 (GMT) Received: from localhost (unknown [9.40.194.84]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 26 Apr 2021 01:50:28 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/4] [rs6000] ROP support Date: Sun, 25 Apr 2021 20:50:14 -0500 Message-Id: X-Mailer: git-send-email 2.17.1 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 1gM-sg3yN_UEfQQEnMUpKkCCaAAx5WKS X-Proofpoint-GUID: cKBPfoEWNiRwjGrhqhLKzDK-fBvTt28c X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-04-25_11:2021-04-23, 2021-04-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104260006 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Bill Schmidt via Gcc-patches From: Bill Schmidt Reply-To: Bill Schmidt Cc: dje.gcc@gmail.com, segher@kernel.crashing.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Add POWER10 support for hashst[p] and hashchk[p] operations. When the -mrop-protect option is selected, any function that loads the link register from memory before returning must have protection in the prologue and epilogue to ensure the link register save location has not been compromised. If -mprivileged is also specified, the protection instructions generated require supervisor privilege. The patches are broken up into logical chunks: - Option handling - Instruction generation - Predefined macro handling - Test cases Bootstrapped and tested on a POWER10 system with no regressions. Tests on a kernel that enables user-space ROP mitigation were successful. Is this series ok for trunk? I would also like to later backport these patches to GCC for the 11.2 release. Thanks! Bill Bill Schmidt (4): rs6000: Add -mrop-protect and -mprivileged flags rs6000: Emit ROP-protect instructions in prologue and epilogue rs6000: Conditionally define __ROP_PROTECT__ rs6000: Add ROP tests gcc/config/rs6000/rs6000-c.c | 3 + gcc/config/rs6000/rs6000-internal.h | 2 + gcc/config/rs6000/rs6000-logue.c | 86 +++++++++++++++++++++--- gcc/config/rs6000/rs6000.c | 7 ++ gcc/config/rs6000/rs6000.md | 39 +++++++++++ gcc/config/rs6000/rs6000.opt | 6 ++ gcc/doc/invoke.texi | 19 +++++- gcc/testsuite/gcc.target/powerpc/rop-1.c | 16 +++++ gcc/testsuite/gcc.target/powerpc/rop-2.c | 16 +++++ gcc/testsuite/gcc.target/powerpc/rop-3.c | 19 ++++++ gcc/testsuite/gcc.target/powerpc/rop-4.c | 14 ++++ gcc/testsuite/gcc.target/powerpc/rop-5.c | 17 +++++ 12 files changed, 231 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-4.c create mode 100644 gcc/testsuite/gcc.target/powerpc/rop-5.c