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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 3428CC433DF for ; Mon, 1 Jun 2020 15:17:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E8F9A20678 for ; Mon, 1 Jun 2020 15:17:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="p4c/KeKe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E8F9A20678 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 77C0A8E0007; Mon, 1 Jun 2020 11:17:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 72D8B8E0006; Mon, 1 Jun 2020 11:17:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61E2C8E0007; Mon, 1 Jun 2020 11:17:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 475CE8E0006 for ; Mon, 1 Jun 2020 11:17:36 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EE94418037FD3 for ; Mon, 1 Jun 2020 15:17:35 +0000 (UTC) X-FDA: 76880997270.30.mask61_5f5c80273e618 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id C897C1826E8E7 for ; Mon, 1 Jun 2020 15:17:35 +0000 (UTC) X-HE-Tag: mask61_5f5c80273e618 X-Filterd-Recvd-Size: 6580 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 1 Jun 2020 15:17:35 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id f18so9409734qkh.1 for ; Mon, 01 Jun 2020 08:17:35 -0700 (PDT) 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=ema+g3ydcyCdysveoaQH1feMW/DzdkijzM30liMIeLc=; b=p4c/KeKeBCGilR218OwT2br3ctbK2eklA+l1wE8ewKXqdos7sbDPXS40gHMQOdh68X KqXRtOU8YD8+iGvY9iq05r+ljxTHn8cBFnagZoqpz79ZP80dt7EXwil/x9IwCuvyobTD 1Jq/tgpbx221KMxvBd8bzsqzzoK2L3DVJls5H1TS9WEbCVgQLG3vCT/Lj0umaOzYgrip PuxdzVXDNIwzgs6ZJxy+58CjcAs2oeqzWHValY81rDrw96QpfVMFRRVSq/w87kGUuFz0 gPhN55vk6L/m9oDQJjy8cUuzJWTC0fASvVXGeVWN42nR/acdG9QRPJ18qJvec3+WoOWj pa5g== 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=ema+g3ydcyCdysveoaQH1feMW/DzdkijzM30liMIeLc=; b=i2Jj2881r8Jrczq2lUG/GicNsKGtP/KY9YG/HJLlFYZRDhMc0GivUidQK7f0HzI5sO 5nEwsnCXNVqGRpNAGgNhTuT3RgE5pNaxw99puSie1IgrvsXvfj5/8DAaJXNE4EsXv5rJ 4bPZHYikhXkNE23bAw+Ut0RZnjvNbSUakqR1Yt9EdeTIM7g9810vvOXdKxO9hllBcn4G zl7fRcHY7DWjdPgyqWXnWbponl+nRdUDZCitCrnHbTUgHZNlJm0zPzhRhG9vHPXLGtOP U+BmGQeCbq0m6esFwdm5d86jx3a/dyGz+anspXZj0HlAqYafALh7WkZV6HQqu6aRvin6 BUKQ== X-Gm-Message-State: AOAM533nxrUvGtmxdY7U219UFycC8efejBPguk2x41KOHC7HqHCE04sY 31UlqZ6ALlB0bKU//MC+HC3oWA== X-Google-Smtp-Source: ABdhPJxSSpARofioiGe2yw6QlG/+AbT7/HnykawI21N2+Bqe2kgJgrayV/hkOu12C3TI1fbpeg20ow== X-Received: by 2002:a37:bfc1:: with SMTP id p184mr16652777qkf.207.1591024654357; Mon, 01 Jun 2020 08:17:34 -0700 (PDT) Received: from [192.168.0.185] ([179.183.10.105]) by smtp.gmail.com with ESMTPSA id l9sm14947635qki.90.2020.06.01.08.17.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Jun 2020 08:17:33 -0700 (PDT) Subject: Re: [PATCH v4 18/26] arm64: mte: Add PTRACE_{PEEK,POKE}MTETAGS support To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne , Alan Hayward , Omair Javaid References: <20200515171612.1020-1-catalin.marinas@arm.com> <20200515171612.1020-19-catalin.marinas@arm.com> <20200601120724.GB23419@gaia> From: Luis Machado Message-ID: <48197e4c-0b77-5e35-c735-922aede425c5@linaro.org> Date: Mon, 1 Jun 2020 12:17:27 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200601120724.GB23419@gaia> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: C897C1826E8E7 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/1/20 9:07 AM, Catalin Marinas wrote: > On Fri, May 29, 2020 at 06:25:14PM -0300, Luis Machado wrote: >> I have a question about siginfo MTE information. I suppose SEGV_MTESERR will >> be the most useful setting for debugging, right? Does si_addr contain the >> tagged pointer with the logical tag, a zero-tagged memory address or a >> tagged pointer with the allocation tag? > > The si_addr is zero-tagged currently. We were planning to expose the tag > in FAR_EL1 as a separate siginfo field. See these discussions: > > https://lore.kernel.org/linux-arm-kernel/20200513180914.50892-1-pcc@google.com/ > https://lore.kernel.org/linux-arm-kernel/20200521022943.195898-1-pcc@google.com/ > > In theory, we could add the tag to si_addr for SEGV_MTESERR, it > shouldn't break the existing ABI (well, it depends on how you look at > it). > Having additional fields in siginfo that hold useful information is probably best for debuggers. See my comment below about Intel MPX. >> From the debugger user's perspective, one would want to see both the logical >> tag and the allocation tag. And it would be handy to have both available in >> siginfo. Does that make sense? > > The debugger can access the allocation tag via PTRACE_PEEKMTETAGS. I > don't think the kernel should provide this in siginfo. Also, the signal > handler can do an LDG and read the allocation tag directly, no need for > it to be in siginfo. > While the debugger can request this information from the kernel, the debugger has already received a SIGSEGV signal and will have to fetch siginfo for si_code. Having to do another PTRACE_PEEKMTETAGS call just to fetch the allocation tag doesn't sound great. Remember this can travel through TCP to gdbserver so it can call ptrace from the remote's end. It would be best to avoid the round trip. Also, there seems to be past precedent to include more information in siginfo. For example, Intel MPX includes upper/lower bounds violation data in there. Regarding using LDG, are you suggesting force-running this particular instruction in the traced process? If so, that isn't the way GDB (in particular, not sure about LLDB) does things. >> Also, when would we see SEGV_MTEAERR, for example? That would provide no >> additional information about a particular memory address, which is not that >> useful for the debugger. > > Yeah, we can't really do much here since the hardware doesn't provide us > such information. The async mode is only useful as a general test to see > if your program has MTE faults but for actual debugging you'd have to > switch to synchronous. For glibc at least, I think the mode can be > driven by an environment variable. > I suspect SEGV_MTESERR would be a reasonable default then, for whoever is responsible for setting the default settings. I'm assuming it is not the debugger, as it doesn't know how to toggle prctl settings.