* [PATCH] iommu/io-pgtable-arm-v7s: Don't check PHYS_OFFSET if RAMDOMIZE_BASE is enabled
@ 2018-12-12 13:02 Yong Wu
2018-12-12 13:39 ` Robin Murphy
0 siblings, 1 reply; 3+ messages in thread
From: Yong Wu @ 2018-12-12 13:02 UTC (permalink / raw)
To: Robin Murphy, Will Deacon, Joerg Roedel, Matthias Brugger
Cc: Tomasz Figa, linux-mediatek, srv_heupstream, linux-kernel,
linux-arm-kernel, iommu, yong.wu, youlin.pei, Nicolas Boichat,
CK Hu
If CONFIG_RANDOMIZE_BASE is enabled, the "memstart_addr" will be updated
randomly, then the PHYS_OFFSET may be random.
Fixes: 82db33dc5e49 ("iommu/io-pgtable-arm: Check for v7s-incapable
systems")
Reported-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
---
drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 445c3bd..70941e6 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -709,7 +709,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
{
struct arm_v7s_io_pgtable *data;
-#ifdef PHYS_OFFSET
+#if defined(PHYS_OFFSET) && !defined(CONFIG_RANDOMIZE_BASE)
if (upper_32_bits(PHYS_OFFSET))
return NULL;
#endif
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/io-pgtable-arm-v7s: Don't check PHYS_OFFSET if RAMDOMIZE_BASE is enabled
2018-12-12 13:02 [PATCH] iommu/io-pgtable-arm-v7s: Don't check PHYS_OFFSET if RAMDOMIZE_BASE is enabled Yong Wu
@ 2018-12-12 13:39 ` Robin Murphy
2018-12-13 2:24 ` Yong Wu
0 siblings, 1 reply; 3+ messages in thread
From: Robin Murphy @ 2018-12-12 13:39 UTC (permalink / raw)
To: Yong Wu, Will Deacon, Joerg Roedel, Matthias Brugger
Cc: Tomasz Figa, linux-mediatek, srv_heupstream, linux-kernel,
linux-arm-kernel, iommu, youlin.pei, Nicolas Boichat, CK Hu
On 12/12/2018 13:02, Yong Wu wrote:
> If CONFIG_RANDOMIZE_BASE is enabled, the "memstart_addr" will be updated
> randomly, then the PHYS_OFFSET may be random.
Oh, I hadn't ever realised that, good catch. However, since 29859aeb8a6e
I think we should probably just remove this check altogether.
> Fixes: 82db33dc5e49 ("iommu/io-pgtable-arm: Check for v7s-incapable
> systems")
Note that this alone wouldn't be sufficient for stable prior to 4.18,
since CONFIG_RANDOMIZE_BASE would then allow the original crash to
happen again.
Robin.
> Reported-by: CK Hu <ck.hu@mediatek.com>
> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> ---
> drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
> index 445c3bd..70941e6 100644
> --- a/drivers/iommu/io-pgtable-arm-v7s.c
> +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> @@ -709,7 +709,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
> {
> struct arm_v7s_io_pgtable *data;
>
> -#ifdef PHYS_OFFSET
> +#if defined(PHYS_OFFSET) && !defined(CONFIG_RANDOMIZE_BASE)
> if (upper_32_bits(PHYS_OFFSET))
> return NULL;
> #endif
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iommu/io-pgtable-arm-v7s: Don't check PHYS_OFFSET if RAMDOMIZE_BASE is enabled
2018-12-12 13:39 ` Robin Murphy
@ 2018-12-13 2:24 ` Yong Wu
0 siblings, 0 replies; 3+ messages in thread
From: Yong Wu @ 2018-12-13 2:24 UTC (permalink / raw)
To: Robin Murphy
Cc: Will Deacon, Joerg Roedel, Matthias Brugger, youlin.pei,
Nicolas Boichat, srv_heupstream, linux-kernel, Tomasz Figa,
iommu, linux-mediatek, CK Hu, linux-arm-kernel, Stephen Boyd
On Wed, 2018-12-12 at 13:39 +0000, Robin Murphy wrote:
> On 12/12/2018 13:02, Yong Wu wrote:
> > If CONFIG_RANDOMIZE_BASE is enabled, the "memstart_addr" will be updated
> > randomly, then the PHYS_OFFSET may be random.
>
> Oh, I hadn't ever realised that, good catch. However, since 29859aeb8a6e
> I think we should probably just remove this check altogether.
Thanks the hint. It looks that I only need revert 82db33dc5e49.
>
> > Fixes: 82db33dc5e49 ("iommu/io-pgtable-arm: Check for v7s-incapable
> > systems")
>
> Note that this alone wouldn't be sufficient for stable prior to 4.18,
> since CONFIG_RANDOMIZE_BASE would then allow the original crash to
> happen again.
Yes. the problem always exist. Nicolas is fixing this. I will delete the
tag here.
>
> Robin.
>
> > Reported-by: CK Hu <ck.hu@mediatek.com>
> > Signed-off-by: Yong Wu <yong.wu@mediatek.com>
> > ---
> > drivers/iommu/io-pgtable-arm-v7s.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
> > index 445c3bd..70941e6 100644
> > --- a/drivers/iommu/io-pgtable-arm-v7s.c
> > +++ b/drivers/iommu/io-pgtable-arm-v7s.c
> > @@ -709,7 +709,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
> > {
> > struct arm_v7s_io_pgtable *data;
> >
> > -#ifdef PHYS_OFFSET
> > +#if defined(PHYS_OFFSET) && !defined(CONFIG_RANDOMIZE_BASE)
> > if (upper_32_bits(PHYS_OFFSET))
> > return NULL;
> > #endif
> >
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-13 2:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 13:02 [PATCH] iommu/io-pgtable-arm-v7s: Don't check PHYS_OFFSET if RAMDOMIZE_BASE is enabled Yong Wu
2018-12-12 13:39 ` Robin Murphy
2018-12-13 2:24 ` Yong Wu
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).