lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed,  1 Apr 2015 17:55:43 -0700
From:	Brian Norris <computersforpeace@...il.com>
To:	Zhang Rui <rui.zhang@...el.com>,
	Eduardo Valentin <edubezval@...il.com>
Cc:	<linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	Brian Norris <computersforpeace@...il.com>
Subject: [PATCH] thermal: user_space: add trip point number to uevent data

A user-space thermal governor does not currently know which trip point
caused a uevent to trigger. Let's add this information to the payload.

This is just an RFC, because this patch (on its own) is not very useful.
The only current caller of the .throttle callback is in
thermal_zone_device_update(), which loops over *all* trip points. This
seems very counter-intuitive and unhelpful, but maybe I'm just clueless.

Signed-off-by: Brian Norris <computersforpeace@...il.com>
---
 drivers/thermal/user_space.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/user_space.c b/drivers/thermal/user_space.c
index 10adcddc8821..9fc03d3271d6 100644
--- a/drivers/thermal/user_space.c
+++ b/drivers/thermal/user_space.c
@@ -22,6 +22,8 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 
+#include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/thermal.h>
 
 #include "thermal_core.h"
@@ -34,9 +36,18 @@
  */
 static int notify_user_space(struct thermal_zone_device *tz, int trip)
 {
+	char *envp[] = { NULL, NULL };
+
+	envp[0] = kasprintf(GFP_KERNEL, "TRIPNUM=%u", trip);
+	if (!envp[0])
+		return -ENOMEM;
+
 	mutex_lock(&tz->lock);
-	kobject_uevent(&tz->device.kobj, KOBJ_CHANGE);
+	kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, envp);
 	mutex_unlock(&tz->lock);
+
+	kfree(envp[0]);
+
 	return 0;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ