platform/x86: ISST: Check for admin capability for write commands
Subsystems (2)
Srinivas Pandruvada
maintainerPATCH 1/1 platform/x86: ISST: Check for admin capability for write commands
In some SST deployments, administrators want to allow reading SST capabilities for non-root users. This can be achieved by changing file permissions for "/dev/isst_interface", but they still want to prevent any changes to the SST configuration by non-root users.
This capability was available before for non-TPMI SST. Extend the same capability for TPMI SST by adding a check for CAP_SYS_ADMIN for all write commands.
--- .../x86/intel/speed_select_if/isst_tpmi_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +6 -5
@@ -612,7 +612,7 @@ static long isst_if_core_power_state(void __user *argp)return -EINVAL ;if (core_power.get_set) { -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ; _write_cp_info("cp_enable", core_power.enable, SST_CP_CONTROL_OFFSET,
@@ -659,7 +659,7 @@ static long isst_if_clos_param(void __user *argp)return -EINVAL ;if (clos_param.get_set) { -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ; _write_cp_info("clos.min_freq", clos_param.min_freq_mhz,
@@ -751,7 +751,8 @@ static long isst_if_clos_assoc(void __user *argp) power_domain_info = &sst_inst->power_domain_info[part][punit_id]; -if (assoc_cmds.get_set && power_domain_info->write_blocked) +if (assoc_cmds.get_set && (power_domain_info->write_blocked || + !capable (CAP_SYS_ADMIN )))return -EPERM ; offset = SST_CLOS_ASSOC_0_OFFSET +
@@ -928,7 +929,7 @@ static int isst_if_set_perf_level(void __user *argp)if (!power_domain_info)return -EINVAL ; -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ;if (!(power_domain_info->pp_header.allowed_level_mask &BIT (perf_level.level)))
@@ -988,7 +989,7 @@ static int isst_if_set_perf_feature(void __user *argp)if (!power_domain_info)return -EINVAL ; -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ; _write_pp_info("perf_feature", perf_feature.feature, SST_PP_CONTROL_OFFSET,
Signature · 1 line
2.52.0
Ilpo Järvinen
maintainerQuoted 19 lines · Srinivas Pandruvada
In some SST deployments, administrators want to allow reading SST capabilities for non-root users. This can be achieved by changing file permissions for "
/dev/isst_interface", but they still want to prevent any changes to the SST configuration by non-root users.This capability was available before for non-TPMI SST. Extend the same capability for TPMI SST by adding a check for
CAP_SYS_ADMINfor all write commands.Signed-off-by Srinivas Pandruvada <[email protected]>--- .../x86/intel/speed_select_if/isst_tpmi_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +0
-0
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c static long isst_if_core_power_state(void __user *argp) · line 615
Quoted 5 lines
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1
-1@@ -612,7 +612,7 @@ static long isst_if_core_power_state(void __user *argp)return -EINVAL ;if (core_power.get_set) { -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))
Hi,
This check doesn't exist in my tree, you seem to have mis-submitted this independently of the other series that adds the check.
Signature · 1 line
i.
Quoted 41 lines
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +5
-4return -EPERM ; _write_cp_info("cp_enable", core_power.enable, SST_CP_CONTROL_OFFSET,@@ -659,7 +659,7 @@ static long isst_if_clos_param(void __user *argp)return -EINVAL ;if (clos_param.get_set) { -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ; _write_cp_info("clos.min_freq", clos_param.min_freq_mhz,@@ -751,7 +751,8 @@ static long isst_if_clos_assoc(void __user *argp) power_domain_info = &sst_inst->power_domain_info[part][punit_id]; -if (assoc_cmds.get_set && power_domain_info->write_blocked) +if (assoc_cmds.get_set && (power_domain_info->write_blocked || + !capable (CAP_SYS_ADMIN )))return -EPERM ; offset = SST_CLOS_ASSOC_0_OFFSET +@@ -928,7 +929,7 @@ static int isst_if_set_perf_level(void __user *argp)if (!power_domain_info)return -EINVAL ; -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ;if (!(power_domain_info->pp_header.allowed_level_mask &BIT (perf_level.level)))@@ -988,7 +989,7 @@ static int isst_if_set_perf_feature(void __user *argp)if (!power_domain_info)return -EINVAL ; -if (power_domain_info->write_blocked) +if (power_domain_info->write_blocked || !capable (CAP_SYS_ADMIN ))return -EPERM ; _write_pp_info("perf_feature", perf_feature.feature, SST_PP_CONTROL_OFFSET,
srinivas pandruvada
maintainerQuoted 38 lines · Ilpo Järvinen
Quoted 32 lines · Srinivas Pandruvada
In some SST deployments, administrators want to allow reading SST capabilities for non-root users. This can be achieved by changing file
permissions for "/dev/isst_interface", but they still want to prevent
any changes to the SST configuration by non-root users.This capability was available before for non-TPMI SST. Extend the same
capability for TPMI SST by adding a check forCAP_SYS_ADMINfor all write commands.Signed-off-by: Srinivas Pandruvada <[email protected]>
---
.../x86/intel/speed_select_if/isst_tpmi_core.c | 11 ++++++-
----1 file changed, 6 insertions(+), 5 deletions(-)diff --git
a/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.cb/drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.cindex47026bb3e1af..a624e0b2991f100644drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +0
-0@@ -612,7 +612,7 @@ static long isst_if_core_power_state(void __user *argp) return -EINVAL;
if (core_power.get_set) {drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +1
-1-if (power_domain_info->write_blocked) + if (power_domain_info->write_blocked ||Quoted 1 line
!capable(CAP_SYS_ADMIN))
Hi,
Quoted 3 lines
This check doesn't exist in my tree, you seem to have mis-submitted this
independently of the other series that adds the check.
Hi llpo,
This was part of the series, which was submitted as bug fix before. [PATCH 0/2] platform/x86: ISST: Fix for write lock and suspend/resume
I should have added this as dependency.
Thanks,
Srinivas