youker-assistant/0001-CVE-2023-2091.patch

36 lines
1.4 KiB
Diff
Raw Normal View History

2024-04-24 10:54:15 +08:00
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