From patchwork Tue Sep 26 11:46:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 144834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1848519vqu; Tue, 26 Sep 2023 04:48:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6Ly2uYnVpF9kwYafzyBVF3/JLp9oJuvI+/mDfBWBAzz5UfuwHXRBNLCPakiVur1FMjzFi X-Received: by 2002:a17:906:519d:b0:9ae:420e:739b with SMTP id y29-20020a170906519d00b009ae420e739bmr8353233ejk.46.1695728934051; Tue, 26 Sep 2023 04:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695728934; cv=none; d=google.com; s=arc-20160816; b=IIjwcpR+6G5Itt5QrY9cF/58T/Raw/AYHhjH4bUXD5x3ArJjXp5qNRKP9yDLXb4j4r Te8iSsSnN6wjL2TJocdbE9XdjOtWv7UjvlDGGMjT2SVKHBf6dmlzXQPWeKlvRPTb3f1S 85KuFt2C2BaQrHK24vda4XpKiDEIrHJocg6BO0d3tI45cMFw7eZFPRSWTkk154rookgA HKk2DV51Xk5yZad3/c6ZUBYzUflIaHGuZNXgm17tBAmI+/D8sco7Tr3kO6QpRE80QZYC XCcbQ935mhDILgXaEvHlKPRplTyWI3USlLYcPblknKHLTv3ji4HphjTyDeib2aTe/Lb6 QWlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=NrheFyaNJiv91Rqcz3mxKvHOF7BXRMHjClHZl+o2jS4=; fh=SM/j4n0SpiXu4rAydeMvRR0AQztOTSK6Iork7L9Y9A4=; b=Ebg5ynGxk6yKzHt6aUN14QYN7rdV+O8etu8RhGJtL44iD8NcGsABFPK80pMSHCjk7N 1BRNWNj0xWt5EHVN4fi7GDkN1VuPYdluEcacyY3wu5sqnq7nW9sk3uEVswNMkhP+8F3x c3mDtRflzJI7T72LUNsXzcBTD4t5wSUys2yD/vuaZvVx/8SwFooRbHG0FboJcx7x5R+0 8sHi1znsw+mSUKl4bTdC5PMcGpD2G7FNMEZi3P4tIsPDlATScqZpO9Jb4USJ8/wx0iQL hbd1bvyPBBN6fbyhPEDLFAuYrg7hejfpqllVrdR5vJPxvV/+9ztzWWAE8C+gn2Aq5g/q dYkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=B5dJud+q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sh8-20020a1709076e8800b009b2849fa9a2si5961693ejc.559.2023.09.26.04.48.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 04:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=B5dJud+q; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BD4AC388203D for ; Tue, 26 Sep 2023 11:46:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id B87CF38618DA for ; Tue, 26 Sep 2023 11:46:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B87CF38618DA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40566f8a093so55527525e9.3 for ; Tue, 26 Sep 2023 04:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1695728783; x=1696333583; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NrheFyaNJiv91Rqcz3mxKvHOF7BXRMHjClHZl+o2jS4=; b=B5dJud+qpkHG8TN6nmDacmmje47kZKB6v7ntwAJ4gWjK5Qj6S8rGi/oK0qiNCjt/NR q52fa2hSFw/iqdjmUjjsJSzgwktN0YfvIxkX2mADaskEZAz9NopCmVn/SQg7EtZBgnjU tyhrhxdH5s7sn0A2E4sx4MG7wXdVZIkFeqqW3jWH8wmX1turgnVfTzZ9mSfH0Avy9C4/ JDMHuRfgHUWiO2o4riH0ah+QMGW+sBt0d0GKCGoCVPrXwwdZd6cZFFfuG6XFPXjMLr8s ycY2d6oaqkiQxefYemsvVLv1wJYOaDocgjDUk0B0fbxkFccD0p9rlYCL59HB6gjEcj3V YxHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695728783; x=1696333583; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NrheFyaNJiv91Rqcz3mxKvHOF7BXRMHjClHZl+o2jS4=; b=XPymgboi1+7NlVGySjk2nGYCcRFhXwgZysnbE5adf+WNvdJsHAKXuoCisVejMB77fe lxW7D76uUPsjFLvfGwuN6izKAno2AQDhlwIjXkUY/bFvCR4j7TISV+/HtwqR1uW+jLfS Iqv6pXmcMWUHgh8+2g5yeN9ZnwTOwbOd/xBvzWpxUEUBTumVKl4RlXQ0TIrFBP7SbnSU 4Nwesg7FELu9QO5GXdKPqSTej+vIlfrh1zuy+BWe6GIxCOkt9MIpjXql+6hv4UPnyQl4 ba4Lkobkv0huA7adTAiCSruumdAcJuBk7jCZoLHq+kGAzZEl6w2hY/lU/THhLVJ94FnH rRBg== X-Gm-Message-State: AOJu0Yxl8H6dLFESD0PRchKkj5Lyd3xnNzpTcm+kmOrXAtwOyRmoRCuX c68/SaYs+jqerfLwgyBm3M/1Y7IFfS+ggSONRCW+wA== X-Received: by 2002:a1c:7409:0:b0:401:d947:c8a3 with SMTP id p9-20020a1c7409000000b00401d947c8a3mr7944281wmc.32.1695728783564; Tue, 26 Sep 2023 04:46:23 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:27f0:a2f3:f97:f30e]) by smtp.gmail.com with ESMTPSA id q12-20020a05600c040c00b0040586360a36sm6640610wmb.17.2023.09.26.04.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 04:46:23 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Daniel King Subject: [COMMITTED] ada: Define CHERI exception types Date: Tue, 26 Sep 2023 13:46:22 +0200 Message-ID: <20230926114622.3272547-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778100662599695029 X-GMAIL-MSGID: 1778100662599695029 From: Daniel King These exception types map to the CHERI hardware exceptions that are triggered due to misuse of capabilities. gcc/ada/ * libgnat/i-cheri.ads (Capability_Bound_Error) (Capability_Permission_Error, Capability_Sealed_Error) (Capability_Tag_Error): New, define CHERI exception types. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/i-cheri.ads | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/ada/libgnat/i-cheri.ads b/gcc/ada/libgnat/i-cheri.ads index 547b033dbaf..80985212589 100644 --- a/gcc/ada/libgnat/i-cheri.ads +++ b/gcc/ada/libgnat/i-cheri.ads @@ -467,4 +467,20 @@ is External_Name => "__builtin_cheri_stack_get"; -- Get the Capability Stack Pointer (CSP) + --------------------------- + -- Capability Exceptions -- + --------------------------- + + Capability_Bound_Error : exception; + -- An out-of-bounds access was attempted + + Capability_Permission_Error : exception; + -- An attempted access exceeded the permissions granted by a capability + + Capability_Sealed_Error : exception; + -- A sealed capability was dereferenced + + Capability_Tag_Error : exception; + -- An invalid capability was dereferenced + end Interfaces.CHERI;