From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796361704; b=jNFjQsvO9ZCo6kai8L2X6rhD3HAJ6U0HBjYp6yqbSOZhEcSFQftyl7SXmBMI+91bzmgQ RbHOZKkwxUVHYgzFrOfXSNFREon7ijgP+EENFHdgUZvUrFZYWL2gg08WWaSJlPBw6NxTu Ycm4AMVe1IhNoR3v8zvBdfKiy62kSea4n5VWAtN+DNUeMvjs4AfJs4gl5j+D/xiqWK2ru vCbza0h+hbTDvBRVTIZ2Ele32hcBxVp6yWYzj51pB4jcr9QTnMk/QCMQ/ak8BPYkjymTG 67LxT8mEjKJNX0hgy2K5zNdyRWvT0Vhl1ITwt9HMakvS6sVMLzEdHnStD66FQAMrqaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796361704; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=kSgBLatr3GM5i/pT1MntEWZWWpqn8gxs0cvup7j1+ys=; b=c/l3WG3Ab5RkzaG2H44VXGHfem4FhWLRqNghjRhDitK7hHtWCHzgrhKitHSK61w0mXGX j/9LUqIfptA3zmuc+n8fY1on1zTyTN40vcmV7kq7wYtiYYxADstYjleRm/HFYvakxwd4N kfgfRF/Em7e26OnxRStOvZR+lWlO749kryujd6r5r9GRCgbFwZlJI6CfL0WSw5lJ4yAr0 o9ojCt+TcRIkC8DVxEh+0X06hwVhXEC+kA/CBlG24Gw05y2l1I+KICoG25+JLWQ5TYHmk pYdPQ+Im/V8wah87YadODgSVAa//X4wIjvnXtCAoDc5W+pTd9h9+UPZIwupHwDOG1rg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eFeX1c3y; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33F8B606A32F for ; Fri, 4 Dec 2026 05:21:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eFeX1c3y Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01DE61F00897; Fri, 4 Dec 2026 05:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796361704; bh=kSgBLatr3GM5i/pT1MntEWZWWpqn8gxs0cvup7j1+ys=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=eFeX1c3y/8CGvOpu3prpSLEvnzAZ0ZMQ+jFbH9o+JkllWmJT0ujsU4ZstW2MYHEUJ L1GFTyYmtV3fSRct12XGw9zvIhkxIhfa/GGsTDSEafOlxJ7ipZYBxcLipRzo6bQ6c7 duOFj27RRs+DJmphZfKnBfvQAyDXKxiCoRLh3/7WJBao30OBOJseFfmv8YDAS2EU4c 131HCr5RtCZFUNInLVYeVl+tFhJllh4IAq7ovZPTh3bKxuRNwWlWBYagfI3MgxlH9O kzsqjmaoctElXEbkL7T7rnOt6XmZzm/DHGQ0yQvTGvqGcW30iipgVGoeGN75B5bN0B AdV4MBlbKPUWw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 4/6] perf synthetic-events: Use PROCMAP_QUERY to synthesize mmap events Reply-To: sashiko-reviews@lists.linux.dev To: "Ian Rogers" , linux-perf-users@vger.kernel.org In-Reply-To: <20261204045948.2254888-5-irogers@google.com> References: <20261204045948.2254888-1-irogers@google.com> <20261204045948.2254888-5-irogers@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 05:21:43 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] perf synthetic-events: incomplete procmap_query__skip_build_id() denylist - [Low] perf synthetic-events: untracked tools fs.h include and inaccurate comment -- commit 731593d66b5cd9e950bcf3d00319b9a21bc49f26 Author: Ian Rogers perf synthetic-events: Use PROCMAP_QUERY to synthesize mmap events This commit updates perf_event__synthesize_mmap_events() to use the PROCMAP_QUERY ioctl to enumerate VMAs and retrieve build IDs directly from the kernel, falling back to parsing /proc//task//maps text when unsupported. Link: https://lore.kernel.org/lkml/20261202124341.GA677025@noisy.programmin= g.kicks-ass.net/ > diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthet= ic-events.c > index 445199d7bbd46..d6d99de1774b5 100644 > --- a/tools/perf/util/synthetic-events.c > +++ b/tools/perf/util/synthetic-events.c [ ... ] > @@ -20,6 +21,8 @@ > #include "util/target.h" > #include "util/time-utils.h" > #include > +#include > +#include /* PROCMAP_QUERY, from tools/include/uapi if not i= n system headers */ > #include > #include > #include [Severity: Low] Does the inline comment accurately describe the include precedence here? tools/perf/Makefile.config puts -I$(srctree)/tools/include/uapi ahead of system include paths, so this unconditionally includes tools/include/uapi/linux/fs.h rather than falling back to it when system headers lack PROCMAP_QUERY (the commit message states the same). In addition, tools/perf/check-headers.sh only checks include/uapi/linux/fs.h under BEAUTY_FILES and does not track tools/include/uapi/linux/fs.h, which has already drifted from include/uapi/linux/fs.h. If perf now compiles against that copy, check-headers.sh should track it. [ ... ] > +static bool procmap_query__skip_build_id(struct machine *machine, const = char *name) > +{ > + struct stat st; > + > + /* > + * Skip device nodes and pseudo-filesystems before asking the kernel > + * for a build ID: do_procmap_query() passes vma->vm_file straight to > + * build_id_parse_file() -> __kernel_read(), which warns on device > + * files without ->read_iter and can crash 6.11-6.18 kernels lacking > + * commit 777a8560fd29 ("lib/buildid: use __kernel_read() for > + * sleepable context"). Allow /dev/shm/ regular files. > + */ > + if ((!strncmp(name, "/dev/", 5) && strncmp(name, "/dev/shm/", 9)) || > + !strncmp(name, "/sys/", 5) || !strncmp(name, "/proc/", 6)) > + return true; > + > + /* > + * Skip any other non-regular file visible in this mount namespace. > + * If stat() fails (e.g. a deleted binary or a file only in the > + * target's mount namespace), still let the kernel try. > + */ > + if (machine__is_host(machine) && stat(name, &st) =3D=3D 0 && !S_ISREG(s= t.st_mode)) > + return true; > + > + return false; > +} [Severity: Medium] Can procmap_query__skip_build_id() still trigger a kernel NULL pointer dereference on 6.11-6.18 kernels lacking commit 777a8560fd29 ("lib/buildid: use __kernel_read() for sleepable context")? On those kernels, do_procmap_query() -> build_id_parse_file() calls read_cache_folio() when page 0 is not resident, which dereferences mapping->a_ops->read_folio in filemap_read_folio(). Several common mappings have a non-zero inode, a leading '/', and a NULL read_folio, yet bypass this denylist: shmem/tmpfs files (including /dev/shm= /, explicitly allowed here, and /memfd:), /dmabuf: mappings, hugetlbfs mappings such as /anon_hugepage (deleted), and /[aio] (deleted) mappings. On 6.19+ kernels, device nodes outside /dev/, /sys/, and /proc/ in another mount namespace also bypass the host-namespace stat() check and can trigger pr_warn_ratelimited() in __kernel_read(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204045948.2254= 888-1-irogers@google.com?part=3D4