Skip to contentSkip to conversation

arm64/mm: Poison initmem while freeing with free_reserved_area()

PATCH Applied Anshuman Khandual 4 participants 6 messages Oct 4, 2019 – Oct 16, 2019 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/mm: Poison initmem while freeing with free_reserved_area()

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/init.c +1 -1
index 45c00a54909c..ea7d38011e83 100644
@@ -571,7 +571,7 @@ void free_initmem(void)
 {
 	free_reserved_area(lm_alias(__init_begin),
 			   lm_alias(__init_end),
-			   0, "unused kernel");
+			   POISON_FREE_INITMEM, "unused kernel");
 	/*
 	 * Unmap the __init region but leave the VM area in place. This
 	 * prevents the region from being reused for kernel modules, which
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Anshuman Khandual

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

Is there a good reason you haven't made a similar change to free_initrd_mem() - the same logic seems to apply. However this change looks fine to me.

Quoted 18 lines
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/init.c +1 -1
index 45c00a54909c..ea7d38011e83 100644
@@ -571,7 +571,7 @@ void free_initmem(void)
 {
 	free_reserved_area(lm_alias(__init_begin),
 			   lm_alias(__init_end),
-			   0, "unused kernel");
+			   POISON_FREE_INITMEM, "unused kernel");
 	/*
 	 * Unmap the __init region but leave the VM area in place. This
 	 * prevents the region from being reused for kernel modules, which
#2 lore raw
Quoted 12 lines · Steven Price
Quoted 10 lines · Anshuman Khandual

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

Quoted 3 lines

Is there a good reason you haven't made a similar change to free_initrd_mem() - the same logic seems to apply. However this change looks fine to me.

We will use generic free_initrd_mem() going forward as proposed in a recent patch which does call free_reserved_area() with POISON_FREE_INITMEM.

https://patchwork.kernel.org/patch/11165379/

Quoted 23 lines
Quoted 18 lines
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/init.c +1 -1
index 45c00a54909c..ea7d38011e83 100644
@@ -571,7 +571,7 @@ void free_initmem(void)
 {
 	free_reserved_area(lm_alias(__init_begin),
 			   lm_alias(__init_end),
-			   0, "unused kernel");
+			   POISON_FREE_INITMEM, "unused kernel");
 	/*
 	 * Unmap the __init region but leave the VM area in place. This
 	 * prevents the region from being reused for kernel modules, which
#3 lore raw
Quoted 15 lines · Anshuman Khandual
Quoted 12 lines · Steven Price
Quoted 10 lines · Anshuman Khandual

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

Quoted 8 lines
Quoted 3 lines

Is there a good reason you haven't made a similar change to free_initrd_mem() - the same logic seems to apply. However this change looks fine to me.

We will use generic free_initrd_mem() going forward as proposed in a recent patch which does call free_reserved_area() with POISON_FREE_INITMEM.

https://patchwork.kernel.org/patch/11165379/

Great - that sounds like a very good reason!

Thanks,

Steve

Quoted 29 lines
Quoted 7 lines
Quoted 4 lines
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 6 lines
arch/arm64/mm/init.c +0 -0
index 45c00a54909c..ea7d38011e83 100644

arch/arm64/mm/init.c void free_initmem(void) · line 577

Quoted 8 lines
arch/arm64/mm/init.c +1 -1
@@ -571,7 +571,7 @@ void free_initmem(void)
 {
 	free_reserved_area(lm_alias(__init_begin),
 			   lm_alias(__init_end),
-			   0, "unused kernel");
+			   POISON_FREE_INITMEM, "unused kernel");
 	/*
 	 * Unmap the __init region but leave the VM area in place. This
 	 * prevents the region from being reused for kernel modules, which

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Acked-by on v1 1/1
#4 lore raw
In reply to Anshuman Khandual
Quoted 19 lines · Anshuman Khandual

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/init.c +0 -0
index 45c00a54909c..ea7d38011e83 100644

arch/arm64/mm/init.c void free_initmem(void) · line 574

Quoted 5 lines
arch/arm64/mm/init.c +1 -1
@@ -571,7 +571,7 @@ void free_initmem(void)
 {
 	free_reserved_area(lm_alias(__init_begin),
 			   lm_alias(__init_end),
-			   0, "unused kernel");
+			   POISON_FREE_INITMEM, "unused kernel");

Will

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

maintainer Applied
#5 lore raw
In reply to Anshuman Khandual
Quoted 10 lines · Anshuman Khandual

Platform implementation for free_initmem() should poison the memory while freeing it up. Hence pass across POISON_FREE_INITMEM while calling into free_reserved_area(). The same is being followed in the generic fallback for free_initmem() and some other platforms overriding it.

Queued for 5.5. Thanks.

Signature · 1 line
Catalin