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] [day] [month] [year] [list]
Date:   Tue, 9 Apr 2019 11:25:49 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Oscar Salvador <osalvador@...e.de>
Cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Banman <andrew.banman@....com>, mike.travis@....com,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Michal Hocko <mhocko@...e.com>,
        Pavel Tatashin <pavel.tatashin@...rosoft.com>,
        Wei Yang <richard.weiyang@...il.com>, Qian Cai <cai@....pw>,
        Arun KS <arunks@...eaurora.org>,
        Mathieu Malaterre <malat@...ian.org>, linux-mm@...ck.org,
        dan.j.williams@...el.com
Subject: Re: [PATCH RFC 3/3] mm/memory_hotplug: Remove memory block devices
 before arch_remove_memory()

On 09.04.19 11:18, Oscar Salvador wrote:
> On Mon, Apr 08, 2019 at 12:12:26PM +0200, David Hildenbrand wrote:
>> Let's factor out removing of memory block devices, which is only
>> necessary for memory added via add_memory() and friends that created
>> memory block devices. Remove the devices before calling
>> arch_remove_memory().
>>
>> TODO: We should try to get rid of the errors that could be reported by
>> unregister_memory_block_under_nodes(). Ignoring failures is not that
>> nice.
> 
> Hi David,
> 
> I am sorry but I will not have to look into this until next week as I am
> up to my ears with work plus I am in the middle of a move.

No worries, I have plenty of other stuff to do as well and this is only
an RFC that will require other refactorings and maybe discussions first
- one of these, I will send out shortly so we can discuss.

Happy moving :)

> 
> I remember I was once trying to simplify unregister_mem_sect_under_nodes (your
> new unregister_memory_block_under_nodes), and I checked whether we could get
> rid of the NODEMASK_ALLOC there, something like:

Yeah, something like that makes perfect sense. Thanks!

> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 8598fcbd2a17..f4294a2928dd 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -805,16 +805,10 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, void *arg)
>  int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
>                                     unsigned long phys_index)
>  {
> -       NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL);
> +       nodemask_t unlinked_nodes;
>         unsigned long pfn, sect_start_pfn, sect_end_pfn;
>  
> -       if (!mem_blk) {
> -               NODEMASK_FREE(unlinked_nodes);
> -               return -EFAULT;
> -       }
> -       if (!unlinked_nodes)
> -               return -ENOMEM;
> -       nodes_clear(*unlinked_nodes);
> +       nodes_clear(unlinked_nodes);
>  
>         sect_start_pfn = section_nr_to_pfn(phys_index);
>         sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> @@ -826,14 +820,13 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
>                         continue;
>                 if (!node_online(nid))
>                         continue;
> -               if (node_test_and_set(nid, *unlinked_nodes))
> +               if (node_test_and_set(nid, unlinked_nodes))
>                         continue;
>                 sysfs_remove_link(&node_devices[nid]->dev.kobj,
>                          kobject_name(&mem_blk->dev.kobj));
>                 sysfs_remove_link(&mem_blk->dev.kobj,
>                          kobject_name(&node_devices[nid]->dev.kobj));
>         }
> -       NODEMASK_FREE(unlinked_nodes);
>         return 0;
>  }
> 
> 
> nodemask_t is 128bytes when CONFIG_NODES_SHIFT is 10 , which is the maximum value.
> We just need to check whether we can overflow the stack or not.
> 
> AFAICS, it is not really a shore stack but it might not be that deep either.


-- 

Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ