linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
@ 2019-10-04  4:23 Anshuman Khandual
  2019-10-04 10:19 ` Steven Price
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Anshuman Khandual @ 2019-10-04  4:23 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel,
	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.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 45c00a54909c..ea7d38011e83 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -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.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
  2019-10-04  4:23 [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area() Anshuman Khandual
@ 2019-10-04 10:19 ` Steven Price
  2019-10-04 10:48   ` Anshuman Khandual
  2019-10-15  0:49 ` Will Deacon
  2019-10-16 12:56 ` Catalin Marinas
  2 siblings, 1 reply; 6+ messages in thread
From: Steven Price @ 2019-10-04 10:19 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel

On 04/10/2019 05:23, Anshuman Khandual wrote:
> 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.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

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.

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  arch/arm64/mm/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 45c00a54909c..ea7d38011e83 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -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
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
  2019-10-04 10:19 ` Steven Price
@ 2019-10-04 10:48   ` Anshuman Khandual
  2019-10-04 10:52     ` Steven Price
  0 siblings, 1 reply; 6+ messages in thread
From: Anshuman Khandual @ 2019-10-04 10:48 UTC (permalink / raw)
  To: Steven Price, linux-arm-kernel
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel



On 10/04/2019 03:49 PM, Steven Price wrote:
> On 04/10/2019 05:23, Anshuman Khandual wrote:
>> 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.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> 
> 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/

> 
> Reviewed-by: Steven Price <steven.price@arm.com>
> 
>> ---
>>  arch/arm64/mm/init.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> index 45c00a54909c..ea7d38011e83 100644
>> --- a/arch/arm64/mm/init.c
>> +++ b/arch/arm64/mm/init.c
>> @@ -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
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
  2019-10-04 10:48   ` Anshuman Khandual
@ 2019-10-04 10:52     ` Steven Price
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Price @ 2019-10-04 10:52 UTC (permalink / raw)
  To: Anshuman Khandual, linux-arm-kernel
  Cc: Mark Rutland, Catalin Marinas, Will Deacon, linux-kernel

On 04/10/2019 11:48, Anshuman Khandual wrote:
> 
> 
> On 10/04/2019 03:49 PM, Steven Price wrote:
>> On 04/10/2019 05:23, Anshuman Khandual wrote:
>>> 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.
>>>
>>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>>> Cc: Will Deacon <will@kernel.org>
>>> Cc: Mark Rutland <mark.rutland@arm.com>
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>
>> 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

>>
>> Reviewed-by: Steven Price <steven.price@arm.com>
>>
>>> ---
>>>  arch/arm64/mm/init.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>>> index 45c00a54909c..ea7d38011e83 100644
>>> --- a/arch/arm64/mm/init.c
>>> +++ b/arch/arm64/mm/init.c
>>> @@ -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
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
  2019-10-04  4:23 [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area() Anshuman Khandual
  2019-10-04 10:19 ` Steven Price
@ 2019-10-15  0:49 ` Will Deacon
  2019-10-16 12:56 ` Catalin Marinas
  2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2019-10-15  0:49 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: Mark Rutland, Catalin Marinas, linux-kernel, linux-arm-kernel

On Fri, Oct 04, 2019 at 09:53:58AM +0530, Anshuman Khandual wrote:
> 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.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
>  arch/arm64/mm/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 45c00a54909c..ea7d38011e83 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -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");

Acked-by: Will Deacon <will@kernel.org>

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area()
  2019-10-04  4:23 [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area() Anshuman Khandual
  2019-10-04 10:19 ` Steven Price
  2019-10-15  0:49 ` Will Deacon
@ 2019-10-16 12:56 ` Catalin Marinas
  2 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2019-10-16 12:56 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: Mark Rutland, Will Deacon, linux-kernel, linux-arm-kernel

On Fri, Oct 04, 2019 at 09:53:58AM +0530, Anshuman Khandual wrote:
> 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.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

Queued for 5.5. Thanks.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-10-16 12:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04  4:23 [PATCH] arm64/mm: Poison initmem while freeing with free_reserved_area() Anshuman Khandual
2019-10-04 10:19 ` Steven Price
2019-10-04 10:48   ` Anshuman Khandual
2019-10-04 10:52     ` Steven Price
2019-10-15  0:49 ` Will Deacon
2019-10-16 12:56 ` Catalin Marinas

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