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]
Message-ID: <CAE9FiQWYPPXA0YmgBP6SkKiEaLJJnzxMqPn2_VwOKoYSKGwULQ@mail.gmail.com>
Date:	Wed, 25 Apr 2012 15:46:42 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	David Miller <davem@...emloft.net>
Cc:	linux-kernel@...r.kernel.org, tj@...nel.org,
	torvalds@...ux-foundation.org
Subject: Re: [PATCH] mm: nobootmem: Correct alloc_bootmem semantics.

On Wed, Apr 25, 2012 at 1:10 PM, David Miller <davem@...emloft.net> wrote:
>
> The comments above __alloc_bootmem_node() claim that the code will
> first try the allocation using 'goal' and if that fails it will
> try again but with the 'goal' requirement dropped.
>
> Unfortunately, this is not what the code does, so fix it to do so.
>
> This is important for nobootmem conversions to architectures such
> as sparc where MAX_DMA_ADDRESS is infinity.
>
> On such architectures all of the allocations done by generic spots,
> such as the sparse-vmemmap implementation, will pass in:
>
>        __pa(MAX_DMA_ADDRESS)
>
> as the goal, and with the limit given as "-1" this will always fail
> unless we add the appropriate fallback logic here.
>
> Signed-off-by: David S. Miller <davem@...emloft.net>
>
> diff --git a/mm/nobootmem.c b/mm/nobootmem.c
> index 24f0fc1..e53bb8a 100644
> --- a/mm/nobootmem.c
> +++ b/mm/nobootmem.c
> @@ -298,13 +298,19 @@ void * __init __alloc_bootmem_node(pg_data_t *pgdat, unsigned long size,
>        if (WARN_ON_ONCE(slab_is_available()))
>                return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id);
>
> +again:
>        ptr = __alloc_memory_core_early(pgdat->node_id, size, align,
>                                         goal, -1ULL);
>        if (ptr)
>                return ptr;

If you want to be consistent to bootmem version.

again label should be here instead.

>
> -       return __alloc_memory_core_early(MAX_NUMNODES, size, align,
> -                                        goal, -1ULL);
> +       ptr = __alloc_memory_core_early(MAX_NUMNODES, size, align,
> +                                       goal, -1ULL);
> +       if (!ptr && goal) {
> +               goal = 0;
> +               goto again;
> +       }
> +       return ptr;
>  }

Thanks

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ