From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796167321; b=idiQrnD46gb2aAavTW6ZR0qoN+kfk4WDDmLRrL5FMQh/vlCMEfi1c6uVYYDmHSSnG4+j rFVmKrFY2P6TMegYPozdfUCd/GAdYa/HqCFFMACOX7W3e789eucle+WE5t96E8INcXkhB p8PKxrO7R7Q1dAYZ8Vgrn1J9116PWqy0r57ZkOtyfBnWcxp1m4O72S5AUtOlTCJUQcsQv OcK+ncyIQdaTWwd4bqy2yBaUyrgY8Wzd3lrS1QWR+dhoF7AppTsda+0tKbkjQUdLIRvJU PhMDtt84q5slMzFS+uLHv37ssBcCJHzj/Cz24GfUYezceEds+T4QALPZG8NCFmYLEuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796167321; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=tvyXfNhWP6jHdyR1H5frAeHBelxdtyj0zNsr2TEWbRU=; b=3vYlN+TS2bqw9QVZXKhCtEidg+yUt2ptMzLYlJbXEYod9N8aOk1xrGoSq6fccbxooASw uatMR54Khznbj3pJ2XjK0o7cr06R7GNyjrBCqyPl75hlEmbF2sZXDXQuCauXujGEenYXC EzsUlSwBIk7DLQJ6ZXqSXfpKgNOVcrWMCDR+dkTY1CPhvO5vn5qpcIx77hta+hPPi4F5N c6vmLUUReP+d3948rnLe0IHfu3CRc6H/5CXrwu5Mv7w+ay2RyeEKzfJjvq1O291DctNYd 0kY8BO/S/QnLWIBxd0AmhhEr70TDbCXDpZhuwBYuMrlox2TJV60/3L45JsjNNB1LPcQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=ahE6cxZo; arc=none smtp.remote-ip=74.125.82.200 Received: from mail-dy1-f200.google.com (mail-dy1-f200.google.com [74.125.82.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A457960738E4 for ; Tue, 1 Dec 2026 23:22:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A457960738E4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=ahE6cxZo Received: by mail-dy1-f200.google.com with SMTP id 5a478bee46e88-386a0f79047so13714822eec.1 for ; Tue, 01 Dec 2026 15:22:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796167320; x=1796772120; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tvyXfNhWP6jHdyR1H5frAeHBelxdtyj0zNsr2TEWbRU=; b=ahE6cxZoLw+NQveiJ3THmc8IK8M4Ip/tKkNA/FSmZ2MIsJ1E6aQRMXixun5Yn8FvAC OtBXlXpyHXOA+BKAwmMoApI0EevmdXVvqx5DEA0ghC2XCVdnlyoYJXgFQ/OWUHKWyxFN vnyyGS7Usl+3piFQlNFPhzqyLuRqxoI+gxTzH26KuIF2z+2yAchUnL2E+mpaeS/LqElP XO6qQAsSYAnfEw22qBMVkC6GuvYX0bA5CzY6KhQ/oDFbTPDy/6nVDKNwyZT/TjAE0sTr Ik0xToJh5AQrLkigjfFZ7ZC7AZy24yDYShGtpPxEOzhoSgvKuGuFNSmKvN3T6vglLURI fORQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796167320; x=1796772120; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tvyXfNhWP6jHdyR1H5frAeHBelxdtyj0zNsr2TEWbRU=; b=PSJnKrrmyZ0ZfdJnXqJM2UTG1Ldlg8xo6O+R5qF2CQQOjbgPiT7W5N9EfbQLW3uIlf cWFcfpAeVuI1Uq9S9FZOIka0CRlDSfq6cF45kiAoK2iWaZoNopmmcOFL0h0r6n1tlgA+ yww2K9WgzVLJIqoE6jsszSvlQP41QTIcPGRMMBYKv0X/3ea2cQmN4TMSqKaxyGWPnY2c EnNjbR72b2sVZ1H2SEcrIix+AW3MAGbSrzDaLl/M+3a9WAcJ9aOIm5/n6zNcEcqyZWBe sRE3OGPhSbj8NAaF5JNd652kEPMJXWWN1roh0jw4JM4j3bp4aSeyG1TnhMCv7kKPrRFd EHzQ== X-Forwarded-Encrypted: i=1; AL+hErEkzRvteDZoHRWOfyVY3u/PUoGxKk2h/1nc/48kHXhg33eJn0TwWxeFROG3ZlmzbX2bZFM=@vger.kernel.org X-Gm-Message-State: APuU4Z9fXN+t2spBEkVWrmOujCu7XVU3mMJU/x66j6PjzvDco/pFNTV1 j26KqILiEl+0g87M07q+cCzUR6ZgRyvpI8y833LZMPsjJ1oUfyGXE/qHEvoVCNZqohMBncLOuKM VRE00ywfLjA== X-Received: from dycnr28-n2.prod.google.com ([2002:a05:7300:e9dc:20b0:386:33c7:a7cb]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:693c:8954:10b0:387:3203:ace4 with SMTP id 5a478bee46e88-3873203b0b7mr198236eec.18.1796167319675; Tue, 01 Dec 2026 15:21:59 -0800 (PST) Date: Tue, 1 Dec 2026 15:21:15 -0800 In-Reply-To: <20261201232116.1988791-1-irogers@google.com> X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261201232116.1988791-1-irogers@google.com> X-Mailer: git-send-email 2.56.1.915.g69d5ec7298-goog Message-ID: <20261201232116.1988791-16-irogers@google.com> Subject: [RFC PATCH 15/16] perf aslr: Anonymize sampled host_ip values From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Sean Christopherson , Paolo Bonzini Cc: Marc Zyngier , Alexei Starovoitov , linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Ian Rogers Content-Type: text/plain; charset="UTF-8" Include PERF_SAMPLE_HOST_IP in ASLR_SAMPLE_MASK and remap sampled host_ip addresses against the host machine in aslr_tool__process_sample() so anonymized perf.data files do not leak raw host hypervisor virtual addresses. Signed-off-by: Ian Rogers --- tools/perf/util/aslr.c | 32 ++++++++++++++++++++++++++++++++ tools/perf/util/aslr.h | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/aslr.c b/tools/perf/util/aslr.c index e365f807b021..ec2c0989e19d 100644 --- a/tools/perf/util/aslr.c +++ b/tools/perf/util/aslr.c @@ -1109,6 +1109,38 @@ static int aslr_tool__process_sample(const struct perf_tool *tool, if (orig_sample_type & PERF_SAMPLE_CODE_PAGE_SIZE) COPY_U64(); /* code_page_size */ + if (orig_sample_type & PERF_SAMPLE_HOST_IP) { + u64 remapped = 0; + + if (CHECK_BOUNDS(1, 1)) { + ret = -EFAULT; + goto out_put; + } + if (sample->host_ip) { + struct machine *host_machine = &aslr->machines.host; + struct thread *host_thread; + u8 host_cpumode = PERF_RECORD_MISC_USER; + + if (aslr_tool__preload_kernel_maps(host_machine) < 0) { + ret = -ENOMEM; + goto out_put; + } + host_thread = machine__findnew_thread(host_machine, sample->pid, + sample->tid); + if (!host_thread) { + ret = -ENOMEM; + goto out_put; + } + if (machine__kernel_ip(host_machine, sample->host_ip)) + host_cpumode = PERF_RECORD_MISC_KERNEL; + remapped = aslr_tool__remap_address(aslr, host_thread, + host_cpumode, sample->host_ip); + thread__put(host_thread); + } + out_array[j++] = remapped; + i++; + } + if (orig_sample_type & PERF_SAMPLE_AUX) { u64 size; diff --git a/tools/perf/util/aslr.h b/tools/perf/util/aslr.h index 9cc14f0263db..8850511a4a43 100644 --- a/tools/perf/util/aslr.h +++ b/tools/perf/util/aslr.h @@ -26,7 +26,8 @@ PERF_SAMPLE_CGROUP | \ PERF_SAMPLE_DATA_PAGE_SIZE | \ PERF_SAMPLE_CODE_PAGE_SIZE | \ - PERF_SAMPLE_AUX) + PERF_SAMPLE_AUX | \ + PERF_SAMPLE_HOST_IP) struct perf_session; struct perf_tool; -- 2.56.1.915.g69d5ec7298-goog