Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1800368pxa; Thu, 6 Aug 2020 16:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOUtn8jKlx/cu8sj9WsKOdmpOKRgAAPUfnMMqS5LDHaps5+V6+SO887t3eiPCSt4rtN38L X-Received: by 2002:aa7:d145:: with SMTP id r5mr6128663edo.323.1596757422065; Thu, 06 Aug 2020 16:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596757422; cv=none; d=google.com; s=arc-20160816; b=pSo/bIRsPhFBOqH9P/Kyxt3vjwdRdHQNN6K+U6wLKb9rxPh37QPIW9I7keUaZu22Kj Qwr8RqoioFgVlbAwh5pg04tD5brLxQ7/+40NwvrnxgFyvCP4QUkdBpox/hgKp8l9RpEo DzVkNnBJrhJfePlGoTyH46R9oTCkGHWlPRSp4Zcd9BHL6WXgecPsP5vpfhdroa4aeUis xCHj3zvCixerF/J58VXiX3zfrtHeiyHr4FTfoftSutYk3QeIk0vCmARUfBdRL1R5M96d cBpVahjB6dyQja2dNqONMVIBPqjseKC6n6JTJrTqdYlDBxzPjqBUTSq7YZ+LddFkxXxx ZMCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=Ch/ZbyQPh5zAPHhTTKYTrb8KpxCzGor9HlcTJgHy8tY=; b=WuD0d6i48AarzcT3MGf4+L+hRd3WKVo4eYzftbKU7nlWJ7mMMdrvHCg/dRw0LPCJMF Ile2fHnREDD75H2GXBEdWyRL29+5vIoN8v6RSnnfDzEXyOTqEhYCbxxXqBJFYANhCk/C neG4tUsRaF7O+C6YbxLwNa2XBg+ChJjiTOSuDps7LDvS94wPPKADl6rzoGiit7udHSoH zV0tTtOsJV7qYMvV7KjAGctT6rB5kh+x5yr+M2Mz/xTy27S1GPOHk716IOz1nSJg7iv/ XMbWNtMVcIwjlEB+w298SV+skrxnV26iv0o3UnHIg0knrOYb8xE05uqO4xgyo/VOY1Hv 0veA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=IMPKijvw; dkim=neutral (no key) header.i=@vger.kernel.org header.b=dDZkm5vh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si3954846ejr.354.2020.08.06.16.43.18; Thu, 06 Aug 2020 16:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=IMPKijvw; dkim=neutral (no key) header.i=@vger.kernel.org header.b=dDZkm5vh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgHFXkQ (ORCPT + 99 others); Thu, 6 Aug 2020 19:40:16 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60928 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbgHFXiy (ORCPT ); Thu, 6 Aug 2020 19:38:54 -0400 Date: Thu, 06 Aug 2020 23:38:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596757131; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ch/ZbyQPh5zAPHhTTKYTrb8KpxCzGor9HlcTJgHy8tY=; b=IMPKijvwk+rwZOUB7nmyrWvaEE9UHFlNrMjDbiCQNmaX1oOVZIARN6JXl30mudGfcK1UAM afhONUWmF61wv4uzqNrzbip4NyWq8d/C9NYLZtwuDDhQfgRl1bbfXPJ72v9tsRLHR1dsNF 5Vo16ux7bwClIJBDpea+fTxJcP+AWvTPRTWqfyRxfUUHl50+m0w9A8hSWR5sGffmUm/Esb VtT/zGGl8hLmm86Nqwx07gomJJXRsJ3lDPD0TMHd02MWvibJngo1g64577leIvZVZZIlhV Td9gl5uXtOCyFhzJ3Oo94+6R5z9HRuWFxq2xphu4w9Fne8gKBEiPq7/WlNkcJA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596757131; h=from:from:sender:sender:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ch/ZbyQPh5zAPHhTTKYTrb8KpxCzGor9HlcTJgHy8tY=; b=dDZkm5vhH4rD4uT6ZM2Keusr+t7ui3LMJ0wV3srWiD7bu4BNY+01ESe5nvoNDvUC3nvE4W GN0hIAvV6B01mcCA== From: "tip-bot2 for Arvind Sankar" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/kaslr] x86/kaslr: Make local variables 64-bit Cc: Arvind Sankar , Ingo Molnar , x86 , LKML In-Reply-To: <20200728225722.67457-21-nivedita@alum.mit.edu> References: <20200728225722.67457-21-nivedita@alum.mit.edu> MIME-Version: 1.0 Message-ID: <159675713110.3192.165971171564749416.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/kaslr branch of tip: Commit-ID: 0eb1a8af01d6264cf948d67c8bff15e2eb859355 Gitweb: https://git.kernel.org/tip/0eb1a8af01d6264cf948d67c8bff15e2eb859355 Author: Arvind Sankar AuthorDate: Tue, 28 Jul 2020 18:57:21 -04:00 Committer: Ingo Molnar CommitterDate: Fri, 31 Jul 2020 11:08:17 +02:00 x86/kaslr: Make local variables 64-bit Change the type of local variables/fields that store mem_vector addresses to u64 to make it less likely that 32-bit overflow will cause issues on 32-bit. Signed-off-by: Arvind Sankar Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200728225722.67457-21-nivedita@alum.mit.edu --- arch/x86/boot/compressed/kaslr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index db8589c..80cdd20 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -461,7 +461,7 @@ static bool mem_avoid_overlap(struct mem_vector *img, { int i; struct setup_data *ptr; - unsigned long earliest = img->start + img->size; + u64 earliest = img->start + img->size; bool is_overlapping = false; for (i = 0; i < MEM_AVOID_MAX; i++) { @@ -506,7 +506,7 @@ static bool mem_avoid_overlap(struct mem_vector *img, } struct slot_area { - unsigned long addr; + u64 addr; unsigned long num; }; @@ -537,7 +537,8 @@ static void store_slot_info(struct mem_vector *region, unsigned long image_size) static void process_gb_huge_pages(struct mem_vector *region, unsigned long image_size) { - unsigned long pud_start, pud_end, gb_huge_pages; + u64 pud_start, pud_end; + unsigned long gb_huge_pages; struct mem_vector tmp; if (!IS_ENABLED(CONFIG_X86_64) || !max_gb_huge_pages) { @@ -579,7 +580,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size) } } -static unsigned long slots_fetch_random(void) +static u64 slots_fetch_random(void) { unsigned long slot; unsigned int i; @@ -595,7 +596,7 @@ static unsigned long slots_fetch_random(void) slot -= slot_areas[i].num; continue; } - return slot_areas[i].addr + slot * CONFIG_PHYSICAL_ALIGN; + return slot_areas[i].addr + ((u64)slot * CONFIG_PHYSICAL_ALIGN); } if (i == slot_area_index) @@ -608,7 +609,7 @@ static void __process_mem_region(struct mem_vector *entry, unsigned long image_size) { struct mem_vector region, overlap; - unsigned long region_end; + u64 region_end; /* Enforce minimum and memory limit. */ region.start = max_t(u64, entry->start, minimum);