From: sashiko-bot@kernel.org
To: "Pragnesh Papaniya" <pragnesh.papaniya@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH RFC 06/10] PM / devfreq: Add a governor for tracking remote device frequencies
Date: Fri, 24 Jul 2026 07:33:57 +0000 [thread overview]
Message-ID: <20260724073357.C2A051F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-rfc_v8_scmi_memlat-v1-6-cb732bcff1f4@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [High] The remote tracking governor corrupts observed frequencies and causes continuous log spam due to core PM QoS clamping and exact OPP matching.
- [Medium] Missing validation of `get_cur_freq` during `DEVFREQ_GOV_START` causes infinite error log flooding.
Pre-existing issues:
- [High] Bypassing the IMMUTABLE governor restriction allows a local attacker (root) to trigger a NULL pointer dereference by switching a TRACK_REMOTE device to a mutable governor.
--
--- Patch [6]: [PATCH RFC 06/10] PM / devfreq: Add a governor for tracking remote device frequencies ---
commit dc71eb5d4b37ce705f4a10bb03bda903dcd75d0b
Author: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
PM / devfreq: Add a governor for tracking remote device frequencies
This commit adds a new "remote" devfreq governor that uses the track_remote
flag to expose a remote device's frequency to userspace via trans_stat. The
governor avoids advertising DEVFREQ_GOV_ATTR_TARGET_FREQ and acts strictly as
an observer.
> diff --git a/drivers/devfreq/governor_remote.c b/drivers/devfreq/governor_remote.c
> new file mode 100644
> index 0000000000000..df3819757e56f
> --- /dev/null
> +++ b/drivers/devfreq/governor_remote.c
> @@ -0,0 +1,73 @@
[ ... ]
> +static int devfreq_remote_track_handler(struct devfreq *devfreq, unsigned int event, void *data)
> +{
> + switch (event) {
> + case DEVFREQ_GOV_START:
> + devfreq_monitor_start(devfreq);
[Severity: Medium]
Should the governor validate the presence of get_cur_freq before starting
the monitor?
If a device profile is missing the get_cur_freq callback,
devfreq_remote_track_func() returns -ENXIO. This error is intercepted by the
core devfreq_monitor() function, which logs 'dvfs failed with (-6) error' and
reschedules the delayed work, leading to an infinite flood in the system
logs.
Could we check for get_cur_freq during governor initialization or before
calling devfreq_monitor_start() to fail gracefully?
> + break;
[ ... ]
> +static struct devfreq_governor devfreq_remote_track = {
> + .name = DEVFREQ_GOV_REMOTE,
> + .attrs = DEVFREQ_GOV_ATTR_POLLING_INTERVAL
> + | DEVFREQ_GOV_ATTR_TIMER,
> + .flags = DEVFREQ_GOV_FLAG_IMMUTABLE
[Severity: High]
This is a pre-existing issue, but I wanted to point out a potential
vulnerability when using DEVFREQ_GOV_FLAG_IMMUTABLE.
If the governor_remote module is unloaded, devfreq_remove_governor() stops
it and sets df->governor to NULL. A privileged user could then write a new
mutable governor name (like simpleondemand) to the device's governor sysfs
node.
In the core governor_store() function, the IMMUTABLE security check is
entirely bypassed if !df->governor is true:
drivers/devfreq/devfreq.c:governor_store() {
if (!df->governor)
goto start_new_governor;
if (df->governor == governor) {
...
} else if (IS_SUPPORTED_FLAG(df->governor->flags, IMMUTABLE)
...
}
When the new mutable governor runs devfreq_set_target() without the
TRACK_REMOTE flag, it will blindly call devfreq->profile->target(). Since
TRACK_REMOTE devices intentionally omit the .target callback, this leads to a
NULL pointer dereference.
> + | DEVFREQ_GOV_FLAG_TRACK_REMOTE,
[Severity: High]
Does the use of DEVFREQ_GOV_FLAG_TRACK_REMOTE interact correctly with PM QoS
clamping?
The devfreq_remote_track_func() provides the raw observed frequency. However,
the core devfreq_update_target() applies local PM QoS constraints to this
tracked frequency.
Because DEVFREQ_GOV_FLAG_TRACK_REMOTE bypasses the driver's .target callback,
the frequency is never rounded to a valid OPP:
drivers/devfreq/devfreq.c:devfreq_set_target() {
if (devfreq->governor &&
IS_SUPPORTED_FLAG(devfreq->governor->flags, TRACK_REMOTE)) {
freqs.old = devfreq->previous_freq;
freqs.new = new_freq;
...
goto update_status;
}
}
When this clamped, unrounded frequency is passed directly to
devfreq_update_status(), it will fail to find an exact match in the
freq_table and return -EINVAL. This causes a continuous log spam of
'Couldn't update frequency transition information' on every polling interval
and breaks trans_stat metrics.
> + .get_target_freq = devfreq_remote_track_func,
> + .event_handler = devfreq_remote_track_handler,
> +};
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-rfc_v8_scmi_memlat-v1-0-cb732bcff1f4@oss.qualcomm.com?part=6
next prev parent reply other threads:[~2026-07-24 7:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 7:18 [PATCH RFC 00/10] firmware: arm_scmi: vendors: Qualcomm Generic Vendor Extensions Pragnesh Papaniya
2026-07-24 7:18 ` [PATCH RFC 01/10] firmware: arm_scmi: Add SCMI QCOM Generic Extension Protocol documentation Pragnesh Papaniya
2026-07-24 7:27 ` sashiko-bot
2026-07-24 9:13 ` Sudeep Holla
2026-07-24 7:18 ` [PATCH RFC 02/10] dt-bindings: firmware: arm,scmi: Add Qualcomm Generic Extension Protocol Pragnesh Papaniya
2026-07-24 7:28 ` sashiko-bot
2026-07-24 7:18 ` [PATCH RFC 03/10] firmware: arm_scmi: vendors: Add QCOM SCMI Generic Extensions Pragnesh Papaniya
2026-07-24 7:30 ` sashiko-bot
2026-07-24 7:18 ` [PATCH RFC 04/10] PM / devfreq: Add new target_freq attribute flag for governors Pragnesh Papaniya
2026-07-24 7:35 ` sashiko-bot
2026-07-24 7:18 ` [PATCH RFC 05/10] PM / devfreq: Add new track_remote " Pragnesh Papaniya
2026-07-24 7:31 ` sashiko-bot
2026-07-24 7:18 ` [PATCH RFC 06/10] PM / devfreq: Add a governor for tracking remote device frequencies Pragnesh Papaniya
2026-07-24 7:33 ` sashiko-bot [this message]
2026-07-24 7:18 ` [PATCH RFC 07/10] PM / devfreq: Introduce the QCOM SCMI Memlat devfreq driver Pragnesh Papaniya
2026-07-24 7:18 ` [PATCH RFC 08/10] arm64: dts: qcom: glymur: Enable LLCC/DDR/DDR_QOS DVFS Pragnesh Papaniya
2026-07-24 7:18 ` [PATCH RFC 09/10] arm64: dts: qcom: hamoa: " Pragnesh Papaniya
2026-07-24 7:18 ` [PATCH RFC 10/10] arm64: dts: qcom: kaanapali: " Pragnesh Papaniya
2026-07-24 8:40 ` [PATCH RFC 00/10] firmware: arm_scmi: vendors: Qualcomm Generic Vendor Extensions Sudeep Holla
2026-07-24 9:02 ` Pragnesh Papaniya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260724073357.C2A051F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=pragnesh.papaniya@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox