lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 25 May 2021 20:12:22 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Oscar Salvador <osalvador@...e.de>,
        "Qian Cai (QUIC)" <quic_qiancai@...cinc.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Michal Hocko <mhocko@...nel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Arm64 crash while online/offline memory sections

On 25.05.21 20:00, Oscar Salvador wrote:
> On Tue, May 25, 2021 at 05:57:34PM +0000, Qian Cai (QUIC) wrote:
>>> Do we know which patch in particular is problematic?
>>
>> Okay, the winner is "mm,memory_hotplug: Allocate memmap from the added memory range".
>>
>> https://lore.kernel.org/linux-mm/20210421102701.25051-5-osalvador@suse.de/
> 
> Ok, which means that is irrelevant to having it enabled, as the latter
> patch of that series actualy enables it for arm64.
> Can you work out where exactly the crash happens?
> 
> I will have a look into it tomorrow.
> 
> Thanks for reporting.
> 

I assume the following will work:

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index b31b3af5c490..6e661d106e96 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -218,14 +218,15 @@ static int memory_block_offline(struct memory_block *mem)
         struct zone *zone;
         int ret;
  
-       zone = page_zone(pfn_to_page(start_pfn));
-
         /*
          * Unaccount before offlining, such that unpopulated zone and kthreads
          * can properly be torn down in offline_pages().
          */
-       if (nr_vmemmap_pages)
+       if (nr_vmemmap_pages) {
+               /* Hotplugged memory has no holes. */
+               zone = page_zone(pfn_to_page(start_pfn));
                 adjust_present_page_count(zone, -nr_vmemmap_pages);
+       }
  
         ret = offline_pages(start_pfn + nr_vmemmap_pages,
                             nr_pages - nr_vmemmap_pages);


We must not touch pfn_to_page(start_pfn) if it might be a memory hole.
offline_pages() will make sure there are no holes, but that's too late.

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ