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: <20151015091826.GD4795@dhcp-129-3.nay.redhat.com>
Date:	Thu, 15 Oct 2015 17:18:26 +0800
From:	Dave Young <dyoung@...hat.com>
To:	Borislav Petkov <bp@...en8.de>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andy Lutomirski <luto@...capital.net>,
	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
	jerry_hoemann@...com, Jiri Kosina <jkosina@...e.cz>,
	Joerg Roedel <jroedel@...e.de>,
	Juergen Gross <jgross@...e.com>,
	Mark Salter <msalter@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	WANG Chao <chaowang@...hat.com>, x86-ml <x86@...nel.org>
Subject: Re: [PATCH 4/5] x86/setup/crash: Check memblock_reserve() retval

On 10/15/15 at 10:20am, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
> 
> memblock_reserve() can fail but the crashkernel reservation code
> doesn't check that and this can lead the user into believing that the
> crashkernel region was actually reserved. Make sure we check that return
> value and we exit early with a failure message in the error case.
> 
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Dave Young <dyoung@...hat.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: jerry_hoemann@...com
> Cc: Jiri Kosina <jkosina@...e.cz>
> Cc: Joerg Roedel <jroedel@...e.de>
> Cc: Juergen Gross <jgross@...e.com>
> Cc: Mark Salter <msalter@...hat.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: WANG Chao <chaowang@...hat.com>
> Cc: x86-ml <x86@...nel.org>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> ---
>  arch/x86/kernel/setup.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index d4788719a1e2..3f75297d5fd0 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -531,7 +531,11 @@ static int __init reserve_crashkernel_low(void)
>  		return -ENOMEM;
>  	}
>  
> -	memblock_reserve(low_base, low_size);
> +	ret = memblock_reserve(low_base, low_size);
> +	if (ret) {
> +		pr_err("%s: Error reserving crashkernel low memblock.\n", __func__);
> +		return ret;
> +	}
>  

Seems there's no checking for other callback to memblock_reserve in setup.c
Need another cleanup?

BTW, a further cleanup is reasonable to me, there's a lot of below patter:
memblock_find_in_range
error checking
memblock_reserve
error checking

So a new function memblock_reserve_in_range is reasonable.

Thanks
Dave
--
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