From patchwork Fri Apr 16 18:31:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 422548 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp627839jaf; Fri, 16 Apr 2021 11:32:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj/aT0pRFjKHiKW/WmG8ROkE0+t1UuH+712HR4OqoLbXn3WUqob+CdHSDETmYr3h7H1K8K X-Received: by 2002:a5e:8717:: with SMTP id y23mr4415916ioj.111.1618597923764; Fri, 16 Apr 2021 11:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618597923; cv=none; d=google.com; s=arc-20160816; b=tmbo1d8xz8BTQJ/jLG61DloATv5M8/bsd5km53maFjyvSi1igGxRW4Nx3FnZYJ03XC 7FXmHiQocuB6+bL4IlRc0wD7zqas75lQJi9PRh9IU4O/PPQPNZqYa5/bl8N1F3fwr4Mn tqoliqmcHyEPviIWJsappWVpE70ZIr9l18kAh+/+WcRfT0fk4Cmpna6JagtamEHNC+iI LLAfCyBm1c61UhJhabwE0ZF9RPgJNYQUPM605ZDfUmVFOicZ421uPPYleFm36xcV6xot n6fQUT+Lqopqgfg8VFOeEsUSEPzEtXUuYf8+JCac3eWF7rutw76UM0FMEMKohFEqI1Qn +kEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ArcUUYgFNH5v/yku39T/BAW6N5EhX13DVLb3URS9HQI=; b=SZlLwCceG8kUTxxjMVuJ+Z0XslNV7O5mi6NsIhmOaYB/iZC8W8WVJO330bQaQraOLX ZvDrkopQjYmXoF4cjBCLiB6qbpsi84SilqWN6wswblppU3pFAHQZc4ZdRNXo9h0lJtxs u9yZGGM9oI47doE0TUV54T3P67X4agUYGOV3lFy74s0pRlgN2APNc/1h30s/JWIrWnPM 9/5UbembddO0JIIlornwh8NSijb1cPc06ZRl7NBKm9L6gQGuyU1PEBSWIFz5a8O1dFpT BX83AxR4qvqO8oCmu5MXx020IXecciSPb6/D5MV+5vZiKgCwXwKHc9ChUNSWXcrTZ5Dr +jvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R24xOu9e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g4si1916310jas.78.2021.04.16.11.32.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Apr 2021 11:32:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R24xOu9e; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lXTG7-0001KW-1l for patch@linaro.org; Fri, 16 Apr 2021 14:32:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43502) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lXTFM-0000kN-CE for qemu-devel@nongnu.org; Fri, 16 Apr 2021 14:31:16 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:36666) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lXTFJ-0003iv-RT for qemu-devel@nongnu.org; Fri, 16 Apr 2021 14:31:16 -0400 Received: by mail-pf1-x430.google.com with SMTP id c3so90743pfo.3 for ; Fri, 16 Apr 2021 11:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ArcUUYgFNH5v/yku39T/BAW6N5EhX13DVLb3URS9HQI=; b=R24xOu9eEldG3P4DNtDmpW9KXSrjmN67QugiM8TuhsYHAulvw4vmIDxDhYSGgjdHcd 1M6JAxyeISuXV1S37XmUHyp1VSFZgxELrP9kop9928f0j5SEbNi2eJCVTKx5aswUqgPT DiHB2j9lCJ9aVC/AnWDGFfi8xLC0+T6M0u9ew6nrFCqPONz/iLH0EzS0BtNtT46TMr6T +z2qlueaILhd99lzMnJ99ArSJ4EX5Hco/HX9+MFVHPERdRM3pbDonAw7FeCMgXzjfI6z BUGbvrkw2B9I/uOXenXxwA4DQbedkfIf1CfNuoFZCAKBMGUkFTPlwFWctdtimYDJMpaB LatQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ArcUUYgFNH5v/yku39T/BAW6N5EhX13DVLb3URS9HQI=; b=PaWDwiB8HDScE86sruDRPAmuGHr7DMLQUc3JhxRreLDTxaerWTKVhI8kNVE570+vHq oN4emW67ReENKmD2RnTyxu8oKcM7wxly8WANBtOZR8bJTDib/onEKRXDCANW+HJPkQIW 8zAuC9KdP6t7bXKc6VA74gjMaWLVb2Go4k7Vuyqh7+yNJbZ/pl983iuXlRAPInGW3KYI SSeukxrk7m9lsWEiZ9xRWBM668XFs0f6PCrMHfBOfpyimfUn9rtUYb0yu/8BwEDEZz90 U0raplLj69+0QCq6z33H5KcWkZ26iPEJ2Wxt6Qjk0kUHNwB9Xe5XjvKnxVp3vQAgCvpx XyLg== X-Gm-Message-State: AOAM531cyal9puxrcxEjcGId5GxclMIknBaNIHE25Why4/xCnHUL2ZjA poHkGRwQMBaW2E4IRR/vw4HaB2xcS7aluw== X-Received: by 2002:a65:6907:: with SMTP id s7mr403990pgq.296.1618597872419; Fri, 16 Apr 2021 11:31:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.131.83]) by smtp.gmail.com with ESMTPSA id p18sm3057307pju.3.2021.04.16.11.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 11:31:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 4/9] test/tcg/aarch64: Add mte-5 Date: Fri, 16 Apr 2021 11:31:01 -0700 Message-Id: <20210416183106.1516563-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210416183106.1516563-1-richard.henderson@linaro.org> References: <20210416183106.1516563-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Buglink: https://bugs.launchpad.net/bugs/1921948 Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tests/tcg/aarch64/mte-5.c | 44 +++++++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/aarch64/mte-5.c -- 2.25.1 diff --git a/tests/tcg/aarch64/mte-5.c b/tests/tcg/aarch64/mte-5.c new file mode 100644 index 0000000000..6dbd6ab3ea --- /dev/null +++ b/tests/tcg/aarch64/mte-5.c @@ -0,0 +1,44 @@ +/* + * Memory tagging, faulting unaligned access. + * + * Copyright (c) 2021 Linaro Ltd + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "mte.h" + +void pass(int sig, siginfo_t *info, void *uc) +{ + assert(info->si_code == SEGV_MTESERR); + exit(0); +} + +int main(int ac, char **av) +{ + struct sigaction sa; + void *p0, *p1, *p2; + long excl = 1; + + enable_mte(PR_MTE_TCF_SYNC); + p0 = alloc_mte_mem(sizeof(*p0)); + + /* Create two differently tagged pointers. */ + asm("irg %0,%1,%2" : "=r"(p1) : "r"(p0), "r"(excl)); + asm("gmi %0,%1,%0" : "+r"(excl) : "r" (p1)); + assert(excl != 1); + asm("irg %0,%1,%2" : "=r"(p2) : "r"(p0), "r"(excl)); + assert(p1 != p2); + + memset(&sa, 0, sizeof(sa)); + sa.sa_sigaction = pass; + sa.sa_flags = SA_SIGINFO; + sigaction(SIGSEGV, &sa, NULL); + + /* Store store two different tags in sequential granules. */ + asm("stg %0, [%0]" : : "r"(p1)); + asm("stg %0, [%0]" : : "r"(p2 + 16)); + + /* Perform an unaligned load crossing the granules. */ + asm volatile("ldr %0, [%1]" : "=r"(p0) : "r"(p1 + 12)); + abort(); +} diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 05b2622bfc..928357b10a 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -37,7 +37,7 @@ AARCH64_TESTS += bti-2 # MTE Tests ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_MTE),) -AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-6 +AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4 mte-5 mte-6 mte-%: CFLAGS += -march=armv8.5-a+memtag endif