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: <CAE9FiQUakjaxE3fTm1w3SuuE-cAXAg2fePmEdwmjomAgp88Psg@mail.gmail.com>
Date:	Mon, 12 Mar 2012 23:13:24 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	Avery Pennarun <apenwarr@...il.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Josh Triplett <josh@...htriplett.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Ingo Molnar <mingo@...e.hu>,
	"David S. Miller" <davem@...emloft.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	"Fabio M. Di Nitto" <fdinitto@...hat.com>,
	Johannes Weiner <hannes@...xchg.org>,
	Olaf Hering <olaf@...fle.de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Tejun Heo <tj@...nel.org>,
	"H. Peter Anvin" <hpa@...ux.intel.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 4/5] printk: use alloc_bootmem() instead of memblock_alloc().

On Mon, Mar 12, 2012 at 10:36 PM, Avery Pennarun <apenwarr@...il.com> wrote:
> The code in setup_log_buf() had two memory allocation branches, depending
> on the value of 'early'.  If early==1, it would use memblock_alloc(); if
> early==0, it would use alloc_bootmem_nopanic().
>
> bootmem should already configured by the time setup_log_buf(early=1) is
> called, so there's no reason to have the separation.  Furthermore, on
> arches with nobootmem, memblock_alloc is essentially the same as
> alloc_bootmem anyway.  x86 is one such arch, and also the only one
> that uses early=1.
>
> Signed-off-by: Avery Pennarun <apenwarr@...il.com>
> ---
>  kernel/printk.c |   13 +------------
>  1 files changed, 1 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/printk.c b/kernel/printk.c
> index 32690a0..bf96a7d 100644
> --- a/kernel/printk.c
> +++ b/kernel/printk.c
> @@ -31,7 +31,6 @@
>  #include <linux/smp.h>
>  #include <linux/security.h>
>  #include <linux/bootmem.h>
> -#include <linux/memblock.h>
>  #include <linux/syscalls.h>
>  #include <linux/kexec.h>
>  #include <linux/kdb.h>
> @@ -195,17 +194,7 @@ void __init setup_log_buf(int early)
>        if (!new_log_buf_len)
>                return;
>
> -       if (early) {
> -               unsigned long mem;
> -
> -               mem = memblock_alloc(new_log_buf_len, PAGE_SIZE);
> -               if (!mem)
> -                       return;
> -               new_log_buf = __va(mem);
> -       } else {
> -               new_log_buf = alloc_bootmem_nopanic(new_log_buf_len);
> -       }
> -
> +       new_log_buf = alloc_bootmem_nopanic(new_log_buf_len);
>        if (unlikely(!new_log_buf)) {
>                pr_err("log_buf_len: %ld bytes not available\n",
>                        new_log_buf_len);
> --

that seems not right.

for x86, setup_log_buf(1) is quite early called in setup_arch() before
bootmem is there.

bootmem should be killed after memblock is supported for arch that
current support bootmem.

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