linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
@ 2020-06-22  6:53 Maulik Shah
  2020-06-22  9:03 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Maulik Shah @ 2020-06-22  6:53 UTC (permalink / raw)
  To: bjorn.andersson, agross
  Cc: linux-arm-msm, linux-kernel, dianders, swboyd, rnayak, ilina,
	lsrao, Maulik Shah

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.

Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
---
 drivers/soc/qcom/rpmh-rsc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index 076fd27..752a561 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -1023,6 +1023,7 @@ static struct platform_driver rpmh_driver = {
 	.driver = {
 		  .name = "rpmh",
 		  .of_match_table = rpmh_drv_match,
+		  .suppress_bind_attrs = true,
 	},
 };
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
  2020-06-22  6:53 [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag Maulik Shah
@ 2020-06-22  9:03 ` Stephen Boyd
  2020-06-22 11:39   ` Maulik Shah
  2020-06-22 19:29   ` Bjorn Andersson
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-06-22  9:03 UTC (permalink / raw)
  To: Maulik Shah, agross, bjorn.andersson
  Cc: linux-arm-msm, linux-kernel, dianders, rnayak, ilina, lsrao,
	Maulik Shah, john.stultz

Quoting Maulik Shah (2020-06-21 23:53:25)
> 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?

> 
> echo 18200000.rsc > /sys/bus/platform/drivers/rpmh/unbind
> 
> Lets prevent unbind at runtime by setting suppress_bind_attrs flag.

Ok. But when the Android module brigade comes knocking they'll have to
revert this change and solve this problem too. Have fun!

> 
> Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
  2020-06-22  9:03 ` Stephen Boyd
@ 2020-06-22 11:39   ` Maulik Shah
  2020-06-22 19:29   ` Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Maulik Shah @ 2020-06-22 11:39 UTC (permalink / raw)
  To: Stephen Boyd, agross, bjorn.andersson
  Cc: linux-arm-msm, linux-kernel, dianders, rnayak, ilina, lsrao, john.stultz

Hi,

Thanks for the review Stephen.

On 6/22/2020 2:33 PM, Stephen Boyd wrote:
> Quoting Maulik Shah (2020-06-21 23:53:25)
>> 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.
>
>> echo 18200000.rsc > /sys/bus/platform/drivers/rpmh/unbind
>>
>> Lets prevent unbind at runtime by setting suppress_bind_attrs flag.
> 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

>
>> Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
>> ---
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
  2020-06-22  9:03 ` Stephen Boyd
  2020-06-22 11:39   ` Maulik Shah
@ 2020-06-22 19:29   ` Bjorn Andersson
  1 sibling, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2020-06-22 19:29 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Maulik Shah, agross, linux-arm-msm, linux-kernel, dianders,
	rnayak, ilina, lsrao, john.stultz

On Mon 22 Jun 02:03 PDT 2020, Stephen Boyd wrote:

> Quoting Maulik Shah (2020-06-21 23:53:25)
> > 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

> > 
> > echo 18200000.rsc > /sys/bus/platform/drivers/rpmh/unbind
> > 
> > Lets prevent unbind at runtime by setting suppress_bind_attrs flag.
> 
> Ok. But when the Android module brigade comes knocking they'll have to
> revert this change and solve this problem too. Have fun!
> 
> > 
> > Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
> > ---
> 
> Reviewed-by: Stephen Boyd <swboyd@chromium.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-22 19:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  6:53 [PATCH] soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag Maulik Shah
2020-06-22  9:03 ` Stephen Boyd
2020-06-22 11:39   ` Maulik Shah
2020-06-22 19:29   ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).