From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31D23C433DB for ; Tue, 26 Jan 2021 17:12:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B017220848 for ; Tue, 26 Jan 2021 17:12:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B017220848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4RtG-0001l6-GJ for qemu-devel@archiver.kernel.org; Tue, 26 Jan 2021 12:12:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4Rrl-0000O2-Td for qemu-devel@nongnu.org; Tue, 26 Jan 2021 12:10:57 -0500 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:37016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4Rrk-00076T-6k for qemu-devel@nongnu.org; Tue, 26 Jan 2021 12:10:57 -0500 Received: by mail-pj1-x102d.google.com with SMTP id g15so2600137pjd.2 for ; Tue, 26 Jan 2021 09:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ugh5R04K55nASwcE5f02HiwZDz8uqE+EUVZkb2KWqDQ=; b=Yl3wA9qPwapXzt79TxVfRAg5mUSnA3xpLkwPJ0nJEHLxCiBcAnkITbWW9y+jHTfhkC 6cgwhe3lCHxFyz7nS2Q/Q5qUF02AmUtBW2E6CeZtoqqw2DgFa/f/3PP5H2nuueo4Mq4u hSOq64Huna7QS4xJdXyUKTVNeLy4hvu1sOL8AWCA1iHRiGCdfApGSdH74yimcjn+Qw17 IPu8EUs3QfWF+kkQGB4c5NMDjghIiTrZKy7cR+iAudACIWD5PcMtPaZufuoSHFdgHRvB eXsIeOazVM8yhxkp2HxeyILLyD+JkSpLTDzKimQtqYyq7j28Cx+Z3Gt/htLH8AkpamHx EA+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ugh5R04K55nASwcE5f02HiwZDz8uqE+EUVZkb2KWqDQ=; b=aZlWxJR8BJmArQEzQtgJpArKAtFdNZ1hUz5HQ4TFxeOZ8ieHSuRsrRLLiJ3Cxz/XpF RKnlwvki52vzchZxoRtJpVW30lEWxcWB/SGEtmJcdjz9OcAam2UHHn8KG4/yCJeusLQi OxAgiU/+qaZPDlSuAeP+d1LUXE2lXaLDjQYvIdwDs034Tc+TxYUTTfnXvhVhbkRgrNgi jUAepcdBkBQcXhdRxS53be3ZTpuZgc2clbVyJ+Efb/xOl7nFdd7ae6UXPpUekHk+JXeR NIyDDypIplIvr3XXGDJwXnkejRFIr3T9rv7GIf43JbYkdvAwjiO6RJt6zbWqp5ri9ENo hYZw== X-Gm-Message-State: AOAM531fYiF6ke8q+6kjAkP8KfDNF8CNkxmS3cAbEd2cfzScsYV9uEht HaddOTW9mv1KFluke/d3/gpMBQ== X-Google-Smtp-Source: ABdhPJwIqj0WEIZYNdg59Tfuyzc3o8P6xF6X3pu2jXbHRelfbZqXkO3xKvGufxYtOiDMAVPTywQ3Cg== X-Received: by 2002:a17:902:b986:b029:df:e5d6:cd71 with SMTP id i6-20020a170902b986b02900dfe5d6cd71mr7214714pls.42.1611681054520; Tue, 26 Jan 2021 09:10:54 -0800 (PST) Received: from [192.168.3.43] (cpe-66-27-222-29.hawaii.res.rr.com. [66.27.222.29]) by smtp.gmail.com with ESMTPSA id j5sm2848494pjf.47.2021.01.26.09.10.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Jan 2021 09:10:53 -0800 (PST) Subject: Re: [PATCH v3 11/21] exec: Add support for TARGET_TAGGED_ADDRESSES To: Peter Maydell References: <20210115224645.1196742-1-richard.henderson@linaro.org> <20210115224645.1196742-12-richard.henderson@linaro.org> From: Richard Henderson Message-ID: Date: Tue, 26 Jan 2021 07:10:50 -1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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, NICE_REPLY_A=-0.001, 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 , QEMU Developers Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 1/22/21 4:13 AM, Peter Maydell wrote: > On Fri, 15 Jan 2021 at 22:47, Richard Henderson > wrote: >> >> The AArch64 Linux ABI has always enabled TBI, but has historically >> required that pointer tags be removed before a syscall. This has >> changed in the lead-up to ARMv8.5-MTE, in a way that affects the >> ABI generically and not specifically to MTE. >> >> This patch allows the target to indicate that (1) there are tags >> and (2) whether or not they should be taken into account at the >> syscall level. >> >> Adjust g2h, guest_addr_valid, and guest_range_valid to ignore >> pointer tags, similar to how TIF_TAGGED_ADDR alters __range_ok >> in the arm64 kernel source. >> >> The prctl syscall is not not yet updated, so this change by itself >> has no visible effect. >> >> Signed-off-by: Richard Henderson >> --- >> include/exec/cpu_ldst.h | 20 +++++++++++++++++--- >> 1 file changed, 17 insertions(+), 3 deletions(-) >> >> diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h >> index e62f4fba00..1df9b93e59 100644 >> --- a/include/exec/cpu_ldst.h >> +++ b/include/exec/cpu_ldst.h >> @@ -69,17 +69,31 @@ typedef uint64_t abi_ptr; >> #define TARGET_ABI_FMT_ptr "%"PRIx64 >> #endif >> >> +static inline abi_ptr untagged_addr(abi_ptr x) >> +{ >> +#ifdef TARGET_TAGGED_ADDRESSES >> + if (current_cpu) { >> + return cpu_untagged_addr(current_cpu, x); >> + } >> +#endif >> + return x; >> +} > > The current_cpu global is a nasty hack and I don't like seeing > new usages of it. In particular, it's very difficult to > analyse in what places this will get called when current_cpu is > NULL and whether it's always OK to not clean the tag in that > situation. Well, that'll be a really lot of changes to add cpu/env as an argument to get_user et al. Let's see how easily coccinelle can fix em all up for me... r~