youker-assistant/0001-CVE-2023-2091.patch
peijiankang 81d71e5ba5 CVE-2023-2091
(cherry picked from commit 5fd2e5987a5a074d04db727a1ffd8dcaa11bb607)
2024-04-24 13:43:35 +08:00

36 lines
1.4 KiB
Diff
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From bf35ca1d06f748d9255fa939ee69b411aaf0131e Mon Sep 17 00:00:00 2001
From: peijiankang <peijiankang@kylinos.cn>
Date: Wed, 24 Apr 2024 10:52:48 +0800
Subject: [PATCH] CVE-2023-2091
---
kyasDbus/systemdaemon/kacpufm.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/kyasDbus/systemdaemon/kacpufm.py b/kyasDbus/systemdaemon/kacpufm.py
index f6b5883..8e39321 100644
--- a/kyasDbus/systemdaemon/kacpufm.py
+++ b/kyasDbus/systemdaemon/kacpufm.py
@@ -153,6 +153,18 @@ class KACpuFM(dbus.service.Object):
origin = {Cpufm_Average_Corefreq:""}
if(not os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq")):
+ # 存在机型没有开启动态调频默认为cpu频率方案移植
+ if(os.path.exists("/proc/cpuinfo")):
+ args = ["cat /proc/cpuinfo | grep -i 'cpu MHz'"]
+ pipe = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE , shell=True)
+ output = pipe.stdout.readlines()
+
+ cpuFreq = ""
+ if len(output) != 0:
+ cpuFreq = bytes.decode(output[0],"utf-8","ignore")
+ if "cpu mhz" in cpuFreq.lower():
+ cpuFreq = cpuFreq.split(":")[-1].strip()
+ origin[Cpufm_Average_Corefreq] = self.num_convert(str(int(float(cpuFreq)*1000)));
return origin
v = 0
--
2.43.0