Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5126048ima; Tue, 5 Feb 2019 06:48:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IaLr0M8TJzXuDnX72FAPZ3ZGWq5sjXAu9niw5aWloHTKKO1aUV2iX3rRyfH+KeHODOco27M X-Received: by 2002:a63:e051:: with SMTP id n17mr4930327pgj.258.1549378122429; Tue, 05 Feb 2019 06:48:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549378122; cv=none; d=google.com; s=arc-20160816; b=yti8h6z3LpHgpGUofCyj6Cg/vYxXq2okHMGPBEcJSBy7PdnQLuUoKeI5fO7qOtIlgn yfB0FxC6oOonnnbC3mzF6cPsDdxLN9p/gq9JcSusDkW8CclYjqNTycrHPj80SAv0ElRY jNh8c0P9wKs1+cZhvLCxfwSMj+E8pe3c2LQ1TUGN0ZXjFjNiYXGYvamHHoYP1VyVWGT0 L5QpzccTKHTNDWE0SlyBGW66tAWxBBMYN59rf8eWE9VIiDx6OZ2LJ3tck8uF8qMElQ0K IQfoecnCLb+D0vneIJ8ThLpgFU90yjm9eJU8j+S53g/5E+uUWJ4xnkdTA7FvpAazletq OORA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZlpHSnZbHAmNeyPP2R4MuO6HoqgK7DIV3kf5lVJLKoU=; b=PaLAPXeVjH1z3fffxD/oNaMD8zYBLdzSyUZQm1lsvLWDji8DeyusZbSzYStf6YpX0m ftd5E4m+0W0mGSyRyOYoy+ZbCkhLDX63Uxl8lG+rtRurg2n7yrcxDli7iMI4kpLzYqs5 XX1k+sEOxFYD+A6cxG8qnPBpfXMZHn1w5oHZArfbAJjmPMIGiJdAti8TyvtNP1GMnPZb YqvyWTZGct4Bfr70zgRaVbG9JWXZahLWzySpT9YxDII/uD6L8B94yMDIdXmGMzO3FWTJ ulavrvNo0amW+kjxyE2s5lN2xGjv/5YZYa5vSg15w8jA27cgzB+CGgKc1Z/JZpZjj+JD kbpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=PN4OZauR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16si3127851pgk.445.2019.02.05.06.48.25; Tue, 05 Feb 2019 06:48:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=PN4OZauR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728348AbfBEOoy (ORCPT + 99 others); Tue, 5 Feb 2019 09:44:54 -0500 Received: from mail.skyhub.de ([5.9.137.197]:42054 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfBEOoy (ORCPT ); Tue, 5 Feb 2019 09:44:54 -0500 Received: from zn.tnic (p200300EC2BCB6B00244CCF9C8D56D337.dip0.t-ipconnect.de [IPv6:2003:ec:2bcb:6b00:244c:cf9c:8d56:d337]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 2AC9B1EC056D; Tue, 5 Feb 2019 15:44:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1549377892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=ZlpHSnZbHAmNeyPP2R4MuO6HoqgK7DIV3kf5lVJLKoU=; b=PN4OZauRg3jE8oHccsxO83PdFDJEBZEbVko/SfqOTAMtnakPZ/VI4HabJdgjG3JE/A36Ya 5OXTk8wTqCZDaJRPZQeainzl6IrBo2PHGO9OKHVVS1miZGmYMVzacLwSQmdCyNYxC0oGwY xyfAjK1QdoXdpVAJKJMYk+UXtwXWdX8= Date: Tue, 5 Feb 2019 15:44:41 +0100 From: Borislav Petkov To: Julian Stecklina Cc: x86@kernel.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, linux-kernel@vger.kernel.org, jschoenh@amazon.de, Julian Stecklina , Dave Jiang , Kees Cook , Baoquan He , Andy Lutomirski , Peter Zijlstra Subject: Re: [PATCH 2/2] x86/boot: increase maximum number of avoided KASLR regions Message-ID: <20190205144441.GS21801@zn.tnic> References: <1548866403-13390-1-git-send-email-js@alien8.de> <1548866403-13390-2-git-send-email-js@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1548866403-13390-2-git-send-email-js@alien8.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 30, 2019 at 05:40:03PM +0100, Julian Stecklina wrote: > From: Julian Stecklina > > The boot code has a limit of 4 "non-standard" regions to avoid for > KASLR. This limit is easy to reach when supplying memmap= parameters to > the kernel. In this case, KASLR would be disabled. > > Increase the limit to avoid turning off KASLR even when the user is > heavily manipulating the memory map. > > Signed-off-by: Julian Stecklina > --- > arch/x86/boot/compressed/kaslr.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c > index 5657e34..f078d60 100644 > --- a/arch/x86/boot/compressed/kaslr.c > +++ b/arch/x86/boot/compressed/kaslr.c > @@ -92,8 +92,8 @@ struct mem_vector { > unsigned long long size; > }; > > -/* Only supporting at most 4 unusable memmap regions with kaslr */ > -#define MAX_MEMMAP_REGIONS 4 > +/* Only supporting at most this many unusable memmap regions with kaslr */ > +#define MAX_MEMMAP_REGIONS 16 > > static bool memmap_too_large; > > @@ -213,7 +213,7 @@ static void mem_avoid_memmap(char *str) > i++; > } > > - /* More than 4 memmaps, fail kaslr */ > + /* Can't store all regions, fail kaslr */ > if ((i >= MAX_MEMMAP_REGIONS) && str) > memmap_too_large = true; > } > -- Lemme add some of the folks from f28442497b5caf7bf573ade22a7f8d3559e3ef56 to Cc. It all looks arbitrary to me: first 4 unusable memmap regions, this patch raises it to 16. Why are we even imposing such a limit? Hmm. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.