Date: Mon, 21 Apr 2025 04:00:04 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 77721403c91d - main - libpmcstat: fix pmcstat -G on older-ish -CURRENT w/ drm-kmod Message-ID: <202504210400.53L404YU085007@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=77721403c91d67dbfd5a2c5c667e7f5d87acb3f6 commit 77721403c91d67dbfd5a2c5c667e7f5d87acb3f6 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-04-21 04:00:01 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2025-04-21 04:00:01 +0000 libpmcstat: fix pmcstat -G on older-ish -CURRENT w/ drm-kmod The linuxkpi_gplv2.ko module on older-ish -CURRENT had absolutely no .text contents, but it was still loaded. Instead of hitting the later assertion because 0 is not less than 0, we can just skip images like this as we should not have any samples from them. Reviewed by: gallatin Differential Revision: https://reviews.freebsd.org/D39875 --- lib/libpmcstat/libpmcstat_image.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libpmcstat/libpmcstat_image.c b/lib/libpmcstat/libpmcstat_image.c index 414ba133590b..69274dca31e8 100644 --- a/lib/libpmcstat/libpmcstat_image.c +++ b/lib/libpmcstat/libpmcstat_image.c @@ -193,6 +193,14 @@ pmcstat_image_link(struct pmcstat_process *pp, struct pmcstat_image *image, assert(image->pi_type != PMCSTAT_IMAGE_UNKNOWN && image->pi_type != PMCSTAT_IMAGE_INDETERMINABLE); + /* + * It's possible to have images with nothing of value in .text + * legitimately. We shouldn't have any samples from this image, so + * don't bother with a map entry either. + */ + if (image->pi_start == 0 && image->pi_end == 0) + return; + if ((pcmnew = malloc(sizeof(*pcmnew))) == NULL) err(EX_OSERR, "ERROR: Cannot create a map entry");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504210400.53L404YU085007>