Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp654380ima; Wed, 6 Feb 2019 06:19:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IaABxkiBjJoqHsOVeG55YpDMUjJejYkWSzIKlV/lBzIgi96YPfS//yXUklQscRALml9Dv+3 X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr11018582plz.75.1549462740298; Wed, 06 Feb 2019 06:19:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549462740; cv=none; d=google.com; s=arc-20160816; b=NsXgIgqd2mcCZBmuMkaDU3TlBd/L7BNc+GueU9+Owu4jriepL8VyUFkCQxkJkkeOJf fyyUBxl4bHmdPgN3EjkLyxTlL/BhxDRAjXsTBdNbds8sj55FWFN1jUY5/MsPTDeUteco T21dctnRIG+3LJdy7m4BQmSJsLWuEipcexfIyP723No0Lp3UFe3e+tY/fowxMqroHdL5 99X+4cdU/Fu+HjBVWB0BYKWBZV7syshZARUGLd9HwPz2YnDeQCbgEw3XDQm29X5+zQvt w96JrNhqIGCQy1pC749C3DrKEOA0k7DpRCbu2D9H7wktXivlL+Z2D92nHP812xLPnTL8 Q0iw== 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=6+r8WM1MY+7PnsC4p0VPh831+GeJusolDBDKvyGZyjI=; b=RLvlGyySknxmNJloBX3wdcCiXs6rYvpKflliB0+KT1YxONtzKkHkH8dSAq+yrqQr2t rl2Yf6H6+RLCW/GcBoySTHZ+6mmncHm8cwPiO/kmDCv9pB5NZqDKigvcauwPxJo4vL96 eA5O85anMCnuj9W86rRb/WICXGsXCvbYvrF3rFjzZxHU11NV1yFOCpvcLgkpdVDbmvnN YUc+MhxC+g0uaqulYI+XFnQmgvNzA1nOTsgEYyQsXFDyCkv2WtI9EL8EPSSHmKA/VrGf oeWk9GN/xC+S9pfe2aKJwb6+xAlJctoaj7azq9Cwi/owpIPBavEwseX5Y3EPLkfLHWQ3 78FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=Q9XL504p; 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 x8si6099491plv.129.2019.02.06.06.18.36; Wed, 06 Feb 2019 06:19:00 -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=Q9XL504p; 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 S1728579AbfBFOSF (ORCPT + 99 others); Wed, 6 Feb 2019 09:18:05 -0500 Received: from mail.skyhub.de ([5.9.137.197]:50158 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726480AbfBFOSF (ORCPT ); Wed, 6 Feb 2019 09:18:05 -0500 Received: from zn.tnic (p200300EC2BCEF10055133BB909886643.dip0.t-ipconnect.de [IPv6:2003:ec:2bce:f100:5513:3bb9:988:6643]) (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 9F9951EC0338; Wed, 6 Feb 2019 15:18:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1549462683; 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=6+r8WM1MY+7PnsC4p0VPh831+GeJusolDBDKvyGZyjI=; b=Q9XL504pPzDuYEQxYTDl/CNK37nFpAkZjvrMwW9hNxFpT7SaVMDGbIFnQJznrygWfM538q sU4wI6Du6aSgrESetqN8inM3xSfDezPnx8r+iQgn5mqPImw4LCUgF6xWUEpCVR4n0JSU8/ wmp5IVt+UHoIQ9TSnrr1VCHLm+ZO+Is= Date: Wed, 6 Feb 2019 15:17:53 +0100 From: Borislav Petkov To: Julian Stecklina Cc: Julian Stecklina , x86@kernel.org, Thomas Gleixner , Ingo Molnar , hpa@zytor.com, linux-kernel@vger.kernel.org, jschoenh@amazon.de, 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: <20190206141753.GE7314@zn.tnic> References: <1548866403-13390-1-git-send-email-js@alien8.de> <1548866403-13390-2-git-send-email-js@alien8.de> <20190205144441.GS21801@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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, Feb 06, 2019 at 01:50:57PM +0100, Julian Stecklina wrote: > Because at this point, we are not in a good position to handle an > unlimited amount of regions. We could save only the regions which are ok to kaslr into. And we do, apparently: static struct slot_area slot_areas[MAX_SLOT_AREA]; but I guess there was a reason to do the mem_avoid thing too instead of collecting only OK ranges directly. Maybe Kees will know. > As for the choice of "16", I took our usecase and multiplied it by two. > FWIW, this could be even larger. Because our kernel is not fat enough huh? Btw, you missed a spot: static unsigned long find_random_phys_addr(unsigned long minimum, unsigned long image_size) { /* Check if we had too many memmaps. */ if (memmap_too_large) { debug_putstr("Aborted memory entries scan (more than 4 memmap= args)!\n"); ^^^^^^^^^^^^^ -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.