From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68467372B41 for ; Wed, 4 Mar 2026 09:10:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772615408; cv=none; b=XN4gb9QwZBJHVjn9glzl95K0LCb/Yl/KUT2vg7FqQWd0SW/ksMbAhWDhj351zQU3v9PrW3R7R0Z/me+ncHhIktcEozVk4dUzcIXv55piiaDEd1PSKx0O2FXqgnq4dU3qHPFR9QBHNoOckflOKNlybBcQZUKgMn/EhmyAJy4+peM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772615408; c=relaxed/simple; bh=xTHcZR9Y6fW3DtqZPI/YYZUQPXkPFsw7XdARufuD4qs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VLdtVwUtxdkiR0wUKaIR4067gPnBLh4CCr1d6I6oef8vlQBskamgBMG2xhVPGwr+w0gtZEcMQYczFPdjHs6e5AgPB/SOsFN5LtyO4DF7WfIAqPrMVbv9YObZfSYQSsyROGr69LZyf2vsVTXA0kEgge+vqsq76wqUNfzOqnYKLpE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=frZOQien; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="frZOQien" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-439b97a8a8cso2967424f8f.1 for ; Wed, 04 Mar 2026 01:10:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1772615406; x=1773220206; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=4CAhwn0L/es+Z/kiWXoW/P41mLkYQ6qC5q4Cz2nXIOA=; b=frZOQienvsalSRQ4kPRQbAjCpJNcvFVPQEWT58XYCOHUIruAIVk0S/mHxkRyxpIvGH YCUSzTeh62D4wWbexS+TgI/VHYZX4pzLCnsHuPGxE3J9i6kdeY5uXPlUHUqp3ei+tQrr jK5Kte3vSGX/Ld0q3/ZzBLVl7OCrCbShLveI40v1xqMGfRNM8BQQRRFeLy57xpFvsgSu sQuv2Zy6QaERTHP1bzl+AraCuxdB0UDdeNew0mdxkfEKF8EQMokxEGsCmLqgMUMUq21E Fg/9LGTRM529Nr0O6QGiRuBREHaJlU3vTcK0+vbDJjqYI4ACeTCLYDFKwQMivp+qhN9R oQOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772615406; x=1773220206; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4CAhwn0L/es+Z/kiWXoW/P41mLkYQ6qC5q4Cz2nXIOA=; b=q887/CQDu+oVMEHkAZEySWFsivRarrH84+Y04AhodES1CFihnNAKnzgoVQ9ORxEiQi qkDiUyEQJ5B+tzxYVJnu8XA+YCl3KZPGv1QIW81WeEoevyjoC2nNxgZ2P3q2vbSzFicg ohG7vGIMLAO5zWiv1SAMnH/OwOwIT7vt5z9ysbFa4Th1hv3oRlNzi+x7pjrUgQRRXEXG HV43mpq/3KEZSZYWbW6Lk1p+ky7B3xi6xWjikEF/eZ2wCNjczNoQht2Ro68XSB6efvpP 0jS1wpx86W+U/N7kVXx2rK9IkO5t5kDEV2vxnJc/FmtoVYGOitTpchpkYY07LbaT4dJy lAIg== X-Forwarded-Encrypted: i=1; AJvYcCVweABBiZGPyEuhFPLToTKHTetxto2Z5HPmTWEh/mKo13N2fBeXE6X4SigE/wwHx914ND1ndBZyln915qs=@vger.kernel.org X-Gm-Message-State: AOJu0YwYFlDKEouUUk50pcLr1SpC0eyoZ3yPrwSztzLTDa+TGRzGie1d eM1fNTC9b8/06KTp114Dugy4p475UPqdOzazORvhe2DaR0lon79HSe0CZEg70h8HvkM= X-Gm-Gg: ATEYQzzFWcxfd+ijwreeDmca0ecbTaWLxwAH2LSlOYKRQ583Dibp2r21jV8uIG/SFER 5TUzm5z0V9vKKq4cbb9URs2ABmwZeynWgKeJ06y/e+Do1gJ4vMPsGxXv8EQebob+9O3WVoMZAnF IUS4YluWMcGbj1XDr/OJSWmnTa6tMTkleZiZfijqEMXuuXLqsQOOXbLOvk1N6P+ATfWY2q2VWmm sbY/D6EAKkIxJnANBanY2xJWwYUw+wDEnagtyf8T5jfDwVzTmG9auP0LjOGULN/FAtqnLUbatib kBCpD/0OlrE2Ki/6gBJMtd5GnytKZkl2c456aR30LN8rXNhx3B3jBPkfK6z5bpbRzRfPfQJTQSH krIXj0gMomWa7LjvB4r5Q38QZoS1lN4Ld0tUQcorZojS9Qlp0bFzJt4KVPKTCwr7pGRjLgjmS2b i1+g+5ViJB3Fs7LrmE2+Zt3NvMuge1 X-Received: by 2002:a05:6000:604:b0:439:b744:c5fe with SMTP id ffacd0b85a97d-439c7ffcb6emr2262601f8f.52.1772615405678; Wed, 04 Mar 2026 01:10:05 -0800 (PST) Received: from [192.168.1.3] ([185.48.77.170]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439ba2a5970sm17858078f8f.33.2026.03.04.01.10.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Mar 2026 01:10:05 -0800 (PST) Message-ID: <7b008bb8-47de-450b-823f-29d28b2366f0@linaro.org> Date: Wed, 4 Mar 2026 09:10:03 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/1] perf arm64: Send pointer auth masks to ring buffer To: Jakub Brnak Cc: James Clark , Leo Yan , Peter Zijlstra , linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, broonie@kernel.org, acme@kernel.org, Andrew Kilroy , Vince Weaver , Mark Rutland , Ingo Molnar , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , Catalin Marinas , kristina.martsenko@arm.com References: <20221020101921.1219533-1-james.clark@arm.com> <20221020101921.1219533-2-james.clark@arm.com> <4e50b890-0588-1551-fb7c-6cd8191d1054@arm.com> <133c2f4b-1ca5-2d0c-f4f4-e01ff5e028c8@arm.com> <197f3d1e-5d1e-4b2d-a12b-782287eecc43@linaro.org> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 03/03/2026 3:26 pm, Jakub Brnak wrote: > On Tue, Mar 03, 2026 at 10:38:23AM +0000, James Clark wrote: >> >> >> On 02/03/2026 4:33 pm, Jakub Brnak wrote: >>> On Mon, Oct 31, 2022 at 01:48:56PM +0000, James Clark wrote: >>>> >>>> >>>> On 27/10/2022 18:20, Peter Zijlstra wrote: >>>>> On Tue, Oct 25, 2022 at 04:28:12PM +0100, James Clark wrote: >>>>> >>>>>>> Why do we want the same mask repeated over and over with each sample; >>>>>>> should this not be part of the address space (side-band) data? >>>>>> >>>>>> You are probably right that it could be done that way. The reason that >>>>>> we did it this way was to be consistent with ptrace feature [1] where it >>>>>> is delivered to userspace on a per-process basis. And there is also a >>>>>> prctl for the enabled key types [2] which can be changed dynamically. >>>>>> Particularly for the last reason is why it was done per sample. >>>>>> >>>>>> Having said that, the enabled keys field is not used by perf, only the >>>>>> mask is used, so I can drop the per sample data until enabled keys is >>>>>> needed, which may be never. >>>>>> >>>>>> I'm going to assume that perf shouldn't use ptrace because of >>>>>> permissions and conflicts with debuggers, so I could put the mask >>>>>> somewhere like PERF_RECORD_FORK instead of per sample. >>>>> >>>>> Yeah, or create an new RECORD type which you can also send around at >>>>> prctl() time. >>>>> >>>>> The only thing that's needed on top of that is exposing the mask >>>>> somewhere in /proc for existing tasks; which is what perf also uses to >>>>> syntesize RECORD_MMAP events on startup etc.. >>>>> >>>> >>>> Hmm ok, in that case I can just add the /proc interface for now because >>>> the mask won't change and we can add the new record type at the point >>>> it's needed in the future. >>>> >>>> Thanks for the feedback. >>> >>> Hi all, >>> >>> Does anyone know how this issue was eventually resolved? >>> Specifically, is the mask for the pointer authentication bits >>> currently exposed and stored somewhere in perf.data so it can be >>> used when running perf report? >>> >>> Thanks, >>> Jakub >>> >>> >> >> Hi Jakub, >> >> No we never finished this, you're actually the first person to mention it. >> Can you give a bit more detail about your use case? Maybe we can dig out the >> old branches and work on it again. >> >> For a summary of the current status, frame pointer unwinds in the kernel are >> working with pointer auth because the kernel strips them. >> >> We patched libunwind for support on commit f67ef2867bc5 ("Unwind with >> pointer authentication on arm64"). And libdw on commit 0af6c7289c22 >> (libdwfl, aarch64: Demangle return addresses using a PAC mask). These two >> were to support dwarf unwinding, but the kernel changes to expose the mask >> and Perf changes to pass it to the unwinders were never finished. >> >> Thanks >> James >> > > Hi James, > > Thanks for the answer. I was investigating a failure in one of the perf tests on > AArch64 RHEL-10 that verifies stack unwinding using DWARF, and it was consistently > failing. I dug a bit deeper and discovered that DWARF unwinding in perf report does > not work correctly at all, and addresses polluted by PAC bits are likely the cause. > I stepped through the program and observed that in libdw the code path responsible for > masking these bits is executed, but the mask is always set to 0 and therefore has no effect. > During the unwinding process, there is a structure that is supposed to store the > mask and use it later. However, since perf constructs the unwinding context offline from samples > and currently does not store the mask anywhere in perf.data, there is likely a no way to propagate > it into that structure. It would be nice if we could push this forward. > > Thanks, > Jakub > Sure, I can put it back on the todo list.