From patchwork Fri Apr 2 21:42:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 414410 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1728751jai; Fri, 2 Apr 2021 14:47:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3zrJ8k9ba1+Oy3ra57OS8/VZ5RVVlHn1FbnuJYCZpOBDRIHO7Ypyaw5GWzAO/Hn3iwq4j X-Received: by 2002:a02:c017:: with SMTP id y23mr14657059jai.3.1617400032524; Fri, 02 Apr 2021 14:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617400032; cv=none; d=google.com; s=arc-20160816; b=nnyaMJlHtrR2GQw32Ssfaabjw8WLY/nMRUOmjJkgrxUG5lqUBgd2uCR2Jq/5VQL348 Oqsa06xU5vpMqX9STbrzvdKVhHqH4WiTrTw9TSjun+osqf/KpG00zIq8QR9Hgso46g/L bTDNG0XTpnzoyTLDZFhQTulzdUGgQDJRGzjpC8/wdP7U0FW39+qYNFB07nopw0GxRB8e QwHmw00P2/NWTy2p6FkFTVF3qFiyTlDYPQaXw587pM+H9yCpZ52u9NaEOmzB3XSSAyRh NrDvmSmUwQqlKg5tBlo8u03Gv2wnDpNq9FX8cGEfeXgCMTXu+r37/ERfXuk68GjIOJJD VLEA== 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=w7i6Gze7kec69WvQyswSUuzpscM5477tzDtA09nT/yo=; b=03ptVtnmycsdyV9+cF0sVdZDDeyXwLZT2M8cjwsy4fFYLZ/m4gyf5RVZEO9DZo9sda AodGZBzgpX5pJINdHor21/zoZFrAuP4tftYaYTslfrafwn5kciU8LNHXUzMN9Vp+2T9g KiEUoa8j15iuD3z8t80tKqzTXj9gpI+7hU1ieHYQDth9c3TuhYr41PQ9GSao7rcYdn/U ZfJjNIC3DuOxT+PTeyvuAjoiluKO2/MMpVQIHrWa6RInrXtMq03ujygaMR3smvuKdGMV 2e+sPEXFZx3PoZLryTU5GdMP1wDCz2C7gEPzYAFUZ+aqfnJLFtwDYYZP6Ehy3gqj2pHM gNFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sJ+fRRKR; 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 t14si8921937iol.93.2021.04.02.14.47.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Apr 2021 14:47:12 -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=sJ+fRRKR; 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]:52674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSRdI-0007th-12 for patch@linaro.org; Fri, 02 Apr 2021 17:47:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSRYn-0000WD-C9 for qemu-devel@nongnu.org; Fri, 02 Apr 2021 17:42:33 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:34384) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lSRYj-0007ic-MW for qemu-devel@nongnu.org; Fri, 02 Apr 2021 17:42:33 -0400 Received: by mail-pg1-x536.google.com with SMTP id i6so4295016pgs.1 for ; Fri, 02 Apr 2021 14:42:29 -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=w7i6Gze7kec69WvQyswSUuzpscM5477tzDtA09nT/yo=; b=sJ+fRRKRHVe4k1QdnpvFL3P9/4rCwCNXUKcyDTJaKzpzdwZmTWi+X3FpCGgjLYqkUp 5D3Vdml6HWQXZu4mQh8F2VmyJ+23OO+aR4wx90EDfkkdzJIZWAhc0msVTopSgqTb2Oz6 SnEbPrH0V8kr18hfobM/a3d1tNNQgUWOPUUk2yRbfFGA33yj6wp5kGG2kQ8G24Lfbxbb SUqIOBvkt7ygia4CV5b12NC4jhzZ2HYq48XVlbTDCi5R/I5UjAytkw2ZpgAny77ArJRo iwKyRdj6Mgbw6qeZ0emZR8O4DwbTi7RnOvOflokaY2swRT5+OkWnn1ok79U5W5UVm2KL BmZw== 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=w7i6Gze7kec69WvQyswSUuzpscM5477tzDtA09nT/yo=; b=p5e3JuJBKleenCAgeCVF+OyHy52yACQCc3H/aisf8T8L9L87/1hsc6aCOSJkNjTLPv nS/uwj7atAHsylRhmckTqhB0nXJEnyA821Ndj/ET4Z29Uxy/H5RV1dyTM53diwdla8Tz 02kYvcgyAMVDEihA7MLhS1AHvZTQFGW9uQ8sxvm1+6OxR10Rcd/NJeEg2zViM4Aowrks rxJ/1sNYcTHDGZXc5cu7KecUOHCbYlyAUKa89NPmRHak4FTm/A/3etW6G54FnIRcMwHz LjcOXOWOPoT4mYyFj6HY/z2CQSANnu1fpWYNkCewpCZT/4DPcx+9phhoiYYr5pN88vpd dFzA== X-Gm-Message-State: AOAM5325LdqA56bb50y4fDcMopUnz2LGPeHdPjKyl4YK2tDkNwMbmSJI RVzw1FUMAqAUUcHXXZIDkgFOZ1dN3xgHmQ== X-Received: by 2002:a63:d40b:: with SMTP id a11mr13262929pgh.192.1617399748187; Fri, 02 Apr 2021 14:42:28 -0700 (PDT) Received: from localhost.localdomain (h216-228-167-147.bendor.dedicated.static.tds.net. [216.228.167.147]) by smtp.gmail.com with ESMTPSA id f16sm7923329pfj.220.2021.04.02.14.42.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Apr 2021 14:42:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/11] test/tcg/aarch64: Add mte-5 Date: Fri, 2 Apr 2021 14:42:12 -0700 Message-Id: <20210402214217.422585-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210402214217.422585-1-richard.henderson@linaro.org> References: <20210402214217.422585-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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=unavailable 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 Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Buglink: https://bugs.launchpad.net/bugs/1921948 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