Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3691253pxb; Mon, 24 Jan 2022 15:29:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJ8hPOmjrZrTqMwSskol83i9nBJBa5wVKHnH+Xq6MuZT33oiY0S0LYmXPZU+7jcadL9jnF X-Received: by 2002:a17:902:e5c3:b0:14b:4528:c968 with SMTP id u3-20020a170902e5c300b0014b4528c968mr8814326plf.41.1643066976409; Mon, 24 Jan 2022 15:29:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066976; cv=none; d=google.com; s=arc-20160816; b=Mru1Q+mQpEzDMqTGaQNy/tmOq9gkTwQG7Ej3rFrYkQADnvjA35yl2kOEVQs/LyOrss 8C0WAdz+P1VKvdz/D5xCEYN4u4n6MpcLpSExcjgDHVcw2119Dg4a8sQA6MuHIsXYAfHq i7aZawNIEFyDqWj2MfuBb22k30rUo/c5aIPTZ+bc2Wtmdmx8DgWwDGMRqWBjCQZtAN0l jLXhcAAwCP1SVcAvpfgsgDxJH/ZgeeWN8G+ELXckIuaGTKkSeEDj9UdHp57H3nwOmIHk 77m/PirlBRqC0H540SWWnkVpFS7RGBRrInOH7Nw93euNSdTrrpSQHIFITNuXP+dIzAWx SZgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=LelPLFVyiMTpw5yA1vIPFMWw4VOWdiJSPS8F5u+bLEc=; b=xuTPS3vs1/S0xX2FnhD5Df5OCKY2xX0VrJKHiU0ox5tJv9SElx4ErPOZ4I5Yhoi8fh oyINXqZjCoh0iHNKUrlRo6Es+yK0gd6l+hM2cEW8Il5AqoFplc9HBGNz6GWsoQni6Uyw 9fBBxXwDILqWOdblrtJcPjLt+gRH5WKCRznvO6/C0Ek//A4RDMNhnAwtu+LQxliPy6m+ xB3/YZt8qut+0t6gL6y6IFWnC7m2Z1YdoXAf2ybF34yBRqDOaLiBjBNPgxQEaaqaOmdn vRmFGkMrwsWbgGVe04Swmt1HKQinPZG3RKiSgRblQsQMTRgvYHEWaqqjrSNJAEe8hFDs je0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qRZb3pM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si15318786pfu.135.2022.01.24.15.29.25; Mon, 24 Jan 2022 15:29:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=qRZb3pM+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1849746AbiAXX0f (ORCPT + 99 others); Mon, 24 Jan 2022 18:26:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1835942AbiAXWhu (ORCPT ); Mon, 24 Jan 2022 17:37:50 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 027F8C0D9433 for ; Mon, 24 Jan 2022 12:59:58 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id o30-20020a05600c511e00b0034f4c3186f4so203691wms.3 for ; Mon, 24 Jan 2022 12:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=LelPLFVyiMTpw5yA1vIPFMWw4VOWdiJSPS8F5u+bLEc=; b=qRZb3pM+5b2VNWc/AzABp2OqhydpmI2RSTdUgZsB+pKt3vGNMqDrBgXP/MKGbxYyHg wWnY5BfxqqcbIUq6wPMF9Wrl3cFRKva373rvxCvgG/CE3dvo9GQkBwHGCDK8CsN8vWpD 7ThNJfRa6Vr+Tbjs2BXWAheDIeoqp5RiCRk8u1cD2qULgAiilowza9Apg/0qECxnejBa Fad6dKu/8fVBAYJjbuNnYB1rOP9vDJdi1naj3nqGx/sHOem74ASUXGbfnLBjY2QkTYNc WTA2kK8IEaUhDo+ifHdp9FaYSgg8bYW1d5pV0BY6wa5HAyUByZbm4iPldXhv8wz416yY ASyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=LelPLFVyiMTpw5yA1vIPFMWw4VOWdiJSPS8F5u+bLEc=; b=s8pnbCkmJTmIDl10x6S11XwTzn07EJDDch4+1tYbmJR0CEmd5qImFB+4r+j4A1Hfny xZvRrm+Fc+ADC4jsYzi63M+bZ68hspWIHcc8JAz1KGz1uagXRNmrBXcRd/Y6Ke0GRGsE f2nYi1mVDS/FHxnvhRsw47dXHE/waFGn6My+keDBcoJ+ZlLn4+lSpmXekipOHiN8qyuo HhEyh2nz4HBBMkLlz7vNkl0XdE3mUR59fLtBnX0ZjUfmbm4vJpv8x8yqAtL3cDK4gTo7 yxorD5NbA//x39L/EI/oU3x6atRrffXVSSRvM1Ii/vnhxaXc58t7vBeZsFsm/iqAHBXk h1jg== X-Gm-Message-State: AOAM532ODqQmmkSHMNg9/CQbGSimrQ/iYJClIFF/zP3WarywNUNp0pCU AZ63nbwXh0VWUhQbDxd0CuuBj0krwnRw9BzPftQ0lA== X-Received: by 2002:a05:600c:3503:: with SMTP id h3mr110888wmq.164.1643057996298; Mon, 24 Jan 2022 12:59:56 -0800 (PST) MIME-Version: 1.0 From: Hao Luo Date: Mon, 24 Jan 2022 12:59:44 -0800 Message-ID: Subject: [Question] How to reliably get BuildIDs from bpf prog To: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann Cc: Song Liu , Yonghong Song , Martin KaFai Lau , KP Singh , bpf , open list , Jiri Olsa , Blake Jones , Alexey Alexandrov , Namhyung Kim , Ian Rogers , "pasha.tatashin@soleen.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear BPF experts, I'm working on collecting some kernel performance data using BPF tracing prog. Our performance profiling team wants to associate the data with user stack information. One of the requirements is to reliably get BuildIDs from bpf_get_stackid() and other similar helpers [1]. As part of an early investigation, we found that there are a couple issues that make bpf_get_stackid() much less reliable than we'd like for our use: 1. The first page of many binaries (which contains the ELF headers and thus the BuildID that we need) is often not in memory. The failure of find_get_page() (called from build_id_parse()) is higher than we would want. 2. When anonymous huge pages are used to hold some regions of process text, build_id_parse() also fails to get a BuildID because vma->vm_file is NULL. These two issues are critical blockers for us to use BPF in production. Can we do better? What do other users do to reliably get build ids? Thanks very much, Hao [1] https://man7.org/linux/man-pages/man7/bpf-helpers.7.html