Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp667015ybg; Tue, 28 Jul 2020 16:00:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybGjihhhlU7OEef4aVY0rjqmRfHgHZqQi+vmC2UkviZ0iEdQ0ortLodaME8EAvFDvFnkd6 X-Received: by 2002:aa7:d8d7:: with SMTP id k23mr12146968eds.54.1595977209496; Tue, 28 Jul 2020 16:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595977209; cv=none; d=google.com; s=arc-20160816; b=vjL6HTkz/zTjo/kT6689s6hciT0GIcPvoK9/iN8Hfxk/2FmjUIrxztgvPmbeW6Q4UW 6LVvfWdj/AU0ISSqtm6RXfKg5U5U2/uH2aXZkZ9KfPxET0Cetgh7StRGNSN43iCoRK9F irarCaLWBVczQOf6hZM0ZZWjDv2QTvmLELPYL3qdor34Y5XVC5838od83a6jarwNd18t UrnZGsdvOoRUGOnOaHVoXQeWb+CWsKxOdlJtHvnLaOoy8uKilpYpuv2d3ZiXutdD5eYe agLgZtGSyJ0qeoMkGLx+dJnwL8beSyMxrqznT0RwE8AlMj+U34OQAJNYoMQIreRo4wqn 9Lhg== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rbgaCyFoSQH758gI8nBq5BNw5E4VtSVD4M81x30MSbg=; b=RhfVq9uNfej0uBrRBDyOr64CwaNOSWPhpfTMLEZmEU3nVJgKAoLPDeh4+KWpENmMaD SYOWZ/3P3shKKHoi3PwIoW8QHQXvnX77NIcX3VyhCB85P5MdiGZqRsRqrmMIOZUiWpaW gqYoMeVafpCrspDp0y0Xo05b/IvGS0SehxZfaDbcAwyvr6UmDLZStKFqpn2VE+4mU1Oo FyLa1yVW77qd6k8oz9W3gJZQ6Rjgx58yKsQqjbv3bGYv4dkKLz+M8gSPUa6x6ZKsQ3Dj TwKVQspWoMNKekrfRF23EkTe0hQWNnTMC5jscobHqcf9sRJVZ72NAPrAhmCjgQLZKecG F9fw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si111467edj.504.2020.07.28.15.59.47; Tue, 28 Jul 2020 16:00:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729970AbgG1W5c (ORCPT + 99 others); Tue, 28 Jul 2020 18:57:32 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:39442 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729808AbgG1W52 (ORCPT ); Tue, 28 Jul 2020 18:57:28 -0400 Received: by mail-qv1-f66.google.com with SMTP id o2so9955500qvk.6 for ; Tue, 28 Jul 2020 15:57:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rbgaCyFoSQH758gI8nBq5BNw5E4VtSVD4M81x30MSbg=; b=Brwdc6br4tvAEA/I2jfO83vMeXXuXbWsDQVKyo5facOEq9rnQHL7xEKDfJKn2YKkD/ 7Nh3yn7vBFDWs6DiIkvJ6yKsQl8Wh+Iw+lRkqBb2GNxfVFhgATBQNwctugoAAtSPU65V akTBDIJqecuGld8GRSkVx6aY2YFcioFAp5hR9GxwjUqVhNNBT9BUAIqq6n9lXy0yAgOi qyBu+O2letryTw/l/5vbqKz4LUVAUuUYp6ZEnhdmGys85i+QEAHZrt9gjqJNBr8bqFzp iBdVddExdsti2ZMeTAfGQr4CvM/qgluKamkxpeDOlEG73q3EB1ZAC5jkyC0uISSyOTVJ MHsw== X-Gm-Message-State: AOAM531Yurq01kZxoVwnLDB14A1SivXhzNvmCEZaLMireglwv3bpn3aR Bt9r1u5tFUMStQELQma7qm85alms X-Received: by 2002:a05:6214:22c:: with SMTP id j12mr16894507qvt.190.1595977047512; Tue, 28 Jul 2020 15:57:27 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id o187sm88118qkd.112.2020.07.28.15.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:57:27 -0700 (PDT) From: Arvind Sankar To: Kees Cook , x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 05/21] x86/kaslr: Fix off-by-one error in __process_mem_region Date: Tue, 28 Jul 2020 18:57:06 -0400 Message-Id: <20200728225722.67457-6-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200727230801.3468620-1-nivedita@alum.mit.edu> References: <20200727230801.3468620-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of an overlap, the beginning of the region should be used even if it is exactly image_size, not just strictly larger. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/kaslr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index da45e66cb6e4..848346fc0dbb 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -669,7 +669,7 @@ static void __process_mem_region(struct mem_vector *entry, } /* Store beginning of region if holds at least image_size. */ - if (overlap.start > region.start + image_size) { + if (overlap.start >= region.start + image_size) { struct mem_vector beginning; beginning.start = region.start; -- 2.26.2