Summary: | querying memory/physical/buffer crashes ksystemstats on FreeBSD | ||
---|---|---|---|
Product: | [Frameworks and Libraries] ksystemstats | Reporter: | Henry Hu <henry.hu.sh> |
Component: | General | Assignee: | Plasma Bugs List <plasma-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | ahiemstra, kde, nate |
Priority: | NOR | ||
Version First Reported In: | 6.2.4 | ||
Target Milestone: | --- | ||
Platform: | FreeBSD Ports | ||
OS: | FreeBSD | ||
Latest Commit: | https://invent.kde.org/plasma/ksystemstats/-/commit/6bd39bbe1ce2b0e9bdb7e499bd54f3b212c7669e | Version Fixed In: | 6.3.0 |
Sentry Crash Report: |
Description
Henry Hu
2025-01-08 05:09:01 UTC
I think the 'application' memory is also wrong. This is traced to an integer overflow: it's computed with (inactive pages + active pages) * page_size; page counts are in uint32_t, but we need to do the computation in uint64_t at least. Preparing fixes in https://invent.kde.org/henryhu/ksystemstats/-/commits/freebsd_mem The problem is that the code tried to convert a uint64_t to QVariant and sent it through dbus; however, uint64_t maps to Qt type 'ulong', which is not mapped for Qt DBus type system (https://doc.qt.io/qt-6/qdbustypesystem.html). On the other hand, we can use 'unsigned long long', which maps to Qt type 'qulonglong', which maps to DBus type 'uint64', which is what we want. I wrote that code (in a vm) and your analysis makes sense. Sadly I can't remember why I chose uint64_t for some sensors and uint32_t for some others and can't think of a rason why for example should have a shorter size type. A possibly relevant merge request was started @ https://invent.kde.org/plasma/ksystemstats/-/merge_requests/102 Git commit 6bd39bbe1ce2b0e9bdb7e499bd54f3b212c7669e by Arjen Hiemstra, on behalf of Henry Hu. Committed on 09/01/2025 at 11:28. Pushed by ahiemstra into branch 'master'. Fix buffer memory reporting We can't use 'uint64_t' here, because it's mapped to 'ulong' Qt type, which is not registered in Qt DBus type system. On the other hand, 'unsigned long long' is okay, because it maps to 'qulonglong', which maps to DBus type 'uint64', which is what we want. See https://doc.qt.io/qt-6/qdbustypesystem.html for details. M +2 -1 plugins/memory/freebsdbackend.cpp https://invent.kde.org/plasma/ksystemstats/-/commit/6bd39bbe1ce2b0e9bdb7e499bd54f3b212c7669e |