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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221117083920.20493-1-nmalwade@nvidia.com>
Date:   Thu, 17 Nov 2022 16:39:20 +0800
From:   Ninad Malwade <nmalwade@...dia.com>
To:     <nmalwade@...dia.com>, <treding@...dia.com>,
        <jonathanh@...dia.com>, <linux@...ck-us.net>, <jdelvare@...e.com>,
        <nicolinc@...dia.com>, <rkasirajan@...dia.com>
CC:     <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-pm@...r.kernel.org>
Subject: [PATCH] hwmon: (ina3221): tighten attribute sysfs permissions

The INA3221 device provides voltage and current measurements for
various power rails, including the CPU rail, on at least some Jetson
boards. This raises the possibility of the Platypus attack being relevant
to Jetson. To prevent this possibility, modify all attribute
channel permissions so that only root can access the values.

This is logically equivalent to 949dd0104c49 ("powercap: restrict energy
meter to root access") upstream.

Signed-off-by: Ninad Malwade <nmalwade@...dia.com>
---
 drivers/hwmon/ina3221.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/hwmon/ina3221.c b/drivers/hwmon/ina3221.c
index e06186986444..ceddcbaa26dc 100644
--- a/drivers/hwmon/ina3221.c
+++ b/drivers/hwmon/ina3221.c
@@ -605,7 +605,7 @@ static umode_t ina3221_is_visible(const void *drvdata,
 		switch (attr) {
 		case hwmon_chip_samples:
 		case hwmon_chip_update_interval:
-			return 0644;
+			return 0600;
 		default:
 			return 0;
 		}
@@ -619,13 +619,13 @@ static umode_t ina3221_is_visible(const void *drvdata,
 			if (channel - 1 <= INA3221_CHANNEL3)
 				input = &ina->inputs[channel - 1];
 			else if (channel == 7)
-				return 0444;
+				return 0400;
 			/* Hide label node if label is not provided */
-			return (input && input->label) ? 0444 : 0;
+			return (input && input->label) ? 0400 : 0;
 		case hwmon_in_input:
-			return 0444;
+			return 0400;
 		case hwmon_in_enable:
-			return 0644;
+			return 0600;
 		default:
 			return 0;
 		}
@@ -634,10 +634,10 @@ static umode_t ina3221_is_visible(const void *drvdata,
 		case hwmon_curr_input:
 		case hwmon_curr_crit_alarm:
 		case hwmon_curr_max_alarm:
-			return 0444;
+			return 0400;
 		case hwmon_curr_crit:
 		case hwmon_curr_max:
-			return 0644;
+			return 0600;
 		default:
 			return 0;
 		}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ