soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
Subsystems (2)
PATCH 1/1 soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
rpmh-rsc driver is fairly core to system and should not be removable once its probed. However it allows to unbind driver from sysfs using below command which results into a crash on sc7180.
echo 18200000.rsc > /sys/bus/platform/drivers/rpmh/unbind
Lets prevent unbind at runtime by setting suppress_bind_attrs flag.
--- drivers/soc/qcom/rpmh-rsc.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/qcom/rpmh-rsc.c +1 -0
@@ -1023,6 +1023,7 @@ static struct platform_driver rpmh_driver = { .driver = { .name = "rpmh", .of_match_table = rpmh_drv_match, + .suppress_bind_attrs = true, }, };
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoting Maulik Shah (2020-06-21 23:53:25)
Quoted 3 lines
rpmh-rsc driver is fairly core to system and should not be removable once its probed. However it allows to unbind driver from sysfs using below command which results into a crash on sc7180.
What is the crash? The world falls apart because rpmh APIs start referencing pointers that point to freed memory?
Quoted 4 lines
echo 18200000.rsc >
/sys/bus/platform/drivers/rpmh/unbindLets prevent unbind at runtime by setting
suppress_bind_attrsflag.
Ok. But when the Android module brigade comes knocking they'll have to revert this change and solve this problem too. Have fun!
Quoted 3 lines
Signed-off-by Maulik Shah <[email protected]>---
Hi,
Thanks for the review Stephen.
Quoted 6 lines · Stephen Boyd
Quoting Maulik Shah (2020-06-21 23:53:25)
Quoted 3 lines
rpmh-rsc driver is fairly core to system and should not be removable once its probed. However it allows to unbind driver from sysfs using below command which results into a crash on sc7180.
What is the crash? The world falls apart because rpmh APIs start referencing pointers that point to freed memory?
Yes.
Quoted 6 lines
Quoted 4 lines
echo 18200000.rsc >
/sys/bus/platform/drivers/rpmh/unbindLets prevent unbind at runtime by setting
suppress_bind_attrsflag.Ok. But when the Android module brigade comes knocking they'll have to revert this change and solve this problem too. Have fun!
No should not need to revert this change.
Even if rpmh-rsc is planned to be loadable module for android, Once loaded it should be disallowed to be removed.
same is the case for PDC irqchip as well. these drivers are core to the system and shouldn't be allowed to rmmod/unbind.
Thanks,
Maulik
Quoted 4 lines
Quoted 3 lines
Signed-off-by Maulik Shah <[email protected]>---
Reviewed-by Stephen Boyd <[email protected]>
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 8 lines · Stephen Boyd
Quoting Maulik Shah (2020-06-21 23:53:25)
Quoted 3 lines
rpmh-rsc driver is fairly core to system and should not be removable once its probed. However it allows to unbind driver from sysfs using below command which results into a crash on sc7180.
What is the crash? The world falls apart because rpmh APIs start referencing pointers that point to freed memory?
Presumably the devm_of_platform_populate() will cause said drivers to be dismantled as well - but I think it's safe to say that that code path isn't well tested...
I've applied the patch, but would have preferred that some time was spent to make sure that things are unloadable as well.
Regards,
Bjorn
Quoted 13 lines
Quoted 4 lines
echo 18200000.rsc >
/sys/bus/platform/drivers/rpmh/unbindLets prevent unbind at runtime by setting
suppress_bind_attrsflag.Ok. But when the Android module brigade comes knocking they'll have to revert this change and solve this problem too. Have fun!
Quoted 3 lines
Signed-off-by Maulik Shah <[email protected]>---
Reviewed-by Stephen Boyd <[email protected]>