Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-19 Thread David Hildenbrand
>> >> Most probably, >> >> struct range memhp_get_addressable_range(bool need_mapping) >> { >> ... >> } > > Something like this... > > +struct memhp_range { > + u64 start; > + u64 end; > +}; We do have struct range already in include/linux/range.h > + > +#ifndef

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-19 Thread Anshuman Khandual
On 10/07/2020 02:09 PM, David Hildenbrand wrote: >>> We do have __add_pages()->check_hotplug_memory_addressable() where we >>> already check against MAX_PHYSMEM_BITS. >> >> Initially, I thought about check_hotplug_memory_addressable() but the >> existing check that asserts end of hotplug wrt

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-14 Thread Ard Biesheuvel
On Wed, 14 Oct 2020 at 07:07, Anshuman Khandual wrote: > > > > On 10/12/2020 12:59 PM, Ard Biesheuvel wrote: > > On Tue, 6 Oct 2020 at 08:36, Anshuman Khandual > > wrote: > >> > >> > >> > >> On 09/30/2020 01:32 PM, Anshuman Khandual wrote: > >>> But if __is_lm_address() checks against the

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-13 Thread Anshuman Khandual
On 10/12/2020 12:59 PM, Ard Biesheuvel wrote: > On Tue, 6 Oct 2020 at 08:36, Anshuman Khandual > wrote: >> >> >> >> On 09/30/2020 01:32 PM, Anshuman Khandual wrote: >>> But if __is_lm_address() checks against the effective linear range instead >>> i.e [_PAGE_OFFSET(vabits_actual)..(PAGE_END -

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-12 Thread Ard Biesheuvel
On Tue, 6 Oct 2020 at 08:36, Anshuman Khandual wrote: > > > > On 09/30/2020 01:32 PM, Anshuman Khandual wrote: > > But if __is_lm_address() checks against the effective linear range instead > > i.e [_PAGE_OFFSET(vabits_actual)..(PAGE_END - 1)], it can be used for hot > > plug physical range check

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-07 Thread David Hildenbrand
>> We do have __add_pages()->check_hotplug_memory_addressable() where we >> already check against MAX_PHYSMEM_BITS. > > Initially, I thought about check_hotplug_memory_addressable() but the > existing check that asserts end of hotplug wrt MAX_PHYSMEM_BITS, is > generic in nature. AFAIK the linear

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-06 Thread Anshuman Khandual
On 10/06/2020 09:04 PM, David Hildenbrand wrote: > On 17.09.20 10:46, Anshuman Khandual wrote: >> During memory hotplug process, the linear mapping should not be created for >> a given memory range if that would fall outside the maximum allowed linear >> range. Else it might cause memory

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-06 Thread David Hildenbrand
On 17.09.20 10:46, Anshuman Khandual wrote: > During memory hotplug process, the linear mapping should not be created for > a given memory range if that would fall outside the maximum allowed linear > range. Else it might cause memory corruption in the kernel virtual space. > > Maximum linear

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-06 Thread Anshuman Khandual
On 09/30/2020 01:32 PM, Anshuman Khandual wrote: > But if __is_lm_address() checks against the effective linear range instead > i.e [_PAGE_OFFSET(vabits_actual)..(PAGE_END - 1)], it can be used for hot > plug physical range check there after. Perhaps something like this, though > not tested

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-10-06 Thread Anshuman Khandual
On 09/30/2020 04:31 PM, Ard Biesheuvel wrote: > On Wed, 30 Sep 2020 at 10:03, Anshuman Khandual > wrote: >> >> >> On 09/29/2020 08:52 PM, Will Deacon wrote: >>> On Tue, Sep 29, 2020 at 01:34:24PM +0530, Anshuman Khandual wrote: On 09/29/2020 02:05 AM, Will Deacon wrote: > On

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-30 Thread Ard Biesheuvel
On Wed, 30 Sep 2020 at 10:03, Anshuman Khandual wrote: > > > On 09/29/2020 08:52 PM, Will Deacon wrote: > > On Tue, Sep 29, 2020 at 01:34:24PM +0530, Anshuman Khandual wrote: > >> > >> > >> On 09/29/2020 02:05 AM, Will Deacon wrote: > >>> On Thu, Sep 17, 2020 at 02:16:42PM +0530, Anshuman

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-30 Thread Anshuman Khandual
On 09/29/2020 08:52 PM, Will Deacon wrote: > On Tue, Sep 29, 2020 at 01:34:24PM +0530, Anshuman Khandual wrote: >> >> >> On 09/29/2020 02:05 AM, Will Deacon wrote: >>> On Thu, Sep 17, 2020 at 02:16:42PM +0530, Anshuman Khandual wrote: During memory hotplug process, the linear mapping should

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-29 Thread Will Deacon
On Tue, Sep 29, 2020 at 01:34:24PM +0530, Anshuman Khandual wrote: > > > On 09/29/2020 02:05 AM, Will Deacon wrote: > > On Thu, Sep 17, 2020 at 02:16:42PM +0530, Anshuman Khandual wrote: > >> During memory hotplug process, the linear mapping should not be created for > >> a given memory range if

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-29 Thread Anshuman Khandual
On 09/29/2020 02:05 AM, Will Deacon wrote: > On Thu, Sep 17, 2020 at 02:16:42PM +0530, Anshuman Khandual wrote: >> During memory hotplug process, the linear mapping should not be created for >> a given memory range if that would fall outside the maximum allowed linear >> range. Else it might

Re: [PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-28 Thread Will Deacon
On Thu, Sep 17, 2020 at 02:16:42PM +0530, Anshuman Khandual wrote: > During memory hotplug process, the linear mapping should not be created for > a given memory range if that would fall outside the maximum allowed linear > range. Else it might cause memory corruption in the kernel virtual space.

[PATCH] arm64/mm: Validate hotplug range before creating linear mapping

2020-09-17 Thread Anshuman Khandual
During memory hotplug process, the linear mapping should not be created for a given memory range if that would fall outside the maximum allowed linear range. Else it might cause memory corruption in the kernel virtual space. Maximum linear mapping region is [PAGE_OFFSET..(PAGE_END -1)]