linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration
@ 2018-07-12  9:28 Zhen Lei
  2018-07-12 17:01 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Zhen Lei @ 2018-07-12  9:28 UTC (permalink / raw)
  To: Jean-Philippe Brucker, Robin Murphy, Will Deacon, Joerg Roedel,
	linux-arm-kernel, iommu, linux-kernel
  Cc: Zhen Lei

Stream bypass is not security. A malicious device can be hot plugged
without match any drivers, but it can access to any memory. So change to
disable bypass by default.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/iommu/arm-smmu-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 1d64710..b0ec28d 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -366,7 +366,7 @@
 #define MSI_IOVA_BASE			0x8000000
 #define MSI_IOVA_LENGTH			0x100000

-static bool disable_bypass;
+static bool disable_bypass = 1;
 module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
 MODULE_PARM_DESC(disable_bypass,
 	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
--
1.8.3



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

* Re: [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration
  2018-07-12  9:28 [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration Zhen Lei
@ 2018-07-12 17:01 ` Will Deacon
  2018-07-13  1:48   ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2018-07-12 17:01 UTC (permalink / raw)
  To: Zhen Lei
  Cc: Jean-Philippe Brucker, Robin Murphy, Joerg Roedel,
	linux-arm-kernel, iommu, linux-kernel

On Thu, Jul 12, 2018 at 05:28:43PM +0800, Zhen Lei wrote:
> Stream bypass is not security. A malicious device can be hot plugged
> without match any drivers, but it can access to any memory. So change to
> disable bypass by default.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>  drivers/iommu/arm-smmu-v3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Whilst this sounds nice, I *bet* you it will break some systems. In
particular, those where the SMMU is described but the toplogical information
is either incorrect or incomplete.

I guess we could put it into next and see if anybody complains. What do
others think?

Will

> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index 1d64710..b0ec28d 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -366,7 +366,7 @@
>  #define MSI_IOVA_BASE			0x8000000
>  #define MSI_IOVA_LENGTH			0x100000
> 
> -static bool disable_bypass;
> +static bool disable_bypass = 1;
>  module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
>  MODULE_PARM_DESC(disable_bypass,
>  	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
> --
> 1.8.3
> 
> 

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

* Re: [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration
  2018-07-12 17:01 ` Will Deacon
@ 2018-07-13  1:48   ` Leizhen (ThunderTown)
  2018-07-13  2:22     ` Hanjun Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Leizhen (ThunderTown) @ 2018-07-13  1:48 UTC (permalink / raw)
  To: Will Deacon
  Cc: Jean-Philippe Brucker, Robin Murphy, Joerg Roedel,
	linux-arm-kernel, iommu, linux-kernel, guohanjun (Hanjun Guo)



On 2018/7/13 1:01, Will Deacon wrote:
> On Thu, Jul 12, 2018 at 05:28:43PM +0800, Zhen Lei wrote:
>> Stream bypass is not security. A malicious device can be hot plugged
>> without match any drivers, but it can access to any memory. So change to
>> disable bypass by default.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>>  drivers/iommu/arm-smmu-v3.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Whilst this sounds nice, I *bet* you it will break some systems. In
> particular, those where the SMMU is described but the toplogical information
> is either incorrect or incomplete.

Suppose this scene exists, maybe we should consider updating IORT specification,
to indicate whether a smmu treats all unregistered devices as stream bypass or not, --- global control
to indicate whether a single device default use stream bypass or not, --- local control
that will be more flexible. But we still disable bypass by default.

> 
> I guess we could put it into next and see if anybody complains. What do
> others think?
> 
> Will
> 
>> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
>> index 1d64710..b0ec28d 100644
>> --- a/drivers/iommu/arm-smmu-v3.c
>> +++ b/drivers/iommu/arm-smmu-v3.c
>> @@ -366,7 +366,7 @@
>>  #define MSI_IOVA_BASE			0x8000000
>>  #define MSI_IOVA_LENGTH			0x100000
>>
>> -static bool disable_bypass;
>> +static bool disable_bypass = 1;
>>  module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO);
>>  MODULE_PARM_DESC(disable_bypass,
>>  	"Disable bypass streams such that incoming transactions from devices that are not attached to an iommu domain will report an abort back to the device and will not be allowed to pass through the SMMU.");
>> --
>> 1.8.3
>>
>>
> 
> .
> 

-- 
Thanks!
BestRegards


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

* Re: [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration
  2018-07-13  1:48   ` Leizhen (ThunderTown)
@ 2018-07-13  2:22     ` Hanjun Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Hanjun Guo @ 2018-07-13  2:22 UTC (permalink / raw)
  To: Leizhen (ThunderTown), Will Deacon
  Cc: Jean-Philippe Brucker, Robin Murphy, Joerg Roedel,
	linux-arm-kernel, iommu, linux-kernel

On 2018/7/13 9:48, Leizhen (ThunderTown) wrote:
> 
> 
> On 2018/7/13 1:01, Will Deacon wrote:
>> On Thu, Jul 12, 2018 at 05:28:43PM +0800, Zhen Lei wrote:
>>> Stream bypass is not security. A malicious device can be hot plugged
>>> without match any drivers, but it can access to any memory. So change to
>>> disable bypass by default.
>>>
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>> ---
>>>  drivers/iommu/arm-smmu-v3.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Whilst this sounds nice, I *bet* you it will break some systems. In
>> particular, those where the SMMU is described but the toplogical information
>> is either incorrect or incomplete.
> 
> Suppose this scene exists, maybe we should consider updating IORT specification,
> to indicate whether a smmu treats all unregistered devices as stream bypass or not, --- global control
> to indicate whether a single device default use stream bypass or not, --- local control
> that will be more flexible. But we still disable bypass by default.

IORT (or dts) is about the hardware feature, if it's only
about the wrong topological information of devices and
SMMU, I think IORT is not the right place to describe such
information, we need correct that information instead.

Thanks
Hanjun


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

end of thread, other threads:[~2018-07-13  2:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12  9:28 [PATCH 1/1] iommu/arm-smmu-v3: prevent any devices access to memory without registration Zhen Lei
2018-07-12 17:01 ` Will Deacon
2018-07-13  1:48   ` Leizhen (ThunderTown)
2018-07-13  2:22     ` Hanjun Guo

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).