Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp666280ybg; Tue, 28 Jul 2020 15:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdRRKQvmskT73fqmmeBZ9IXCkQFmSjVd11zwMvBBNGqLgYYAIDMyhvCHvVvF0GjwP+iYzk X-Received: by 2002:a50:afa2:: with SMTP id h31mr28530007edd.303.1595977117930; Tue, 28 Jul 2020 15:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595977117; cv=none; d=google.com; s=arc-20160816; b=Cq2g45vuFfcS6GL5WJpc5OOF58ZLGzEiK3YZwPp21SEdRN+BGDg0/vTqd1ZNwpUAiP 6xszsZh/2hma4PA33kAU9YnSb1DtwGivD1B2nn+NR5biIBkHFUvgKZD9C2zbMEN5lBWY f6v52F1SWYcG1/caLCieG07FYvp3arOR4G15BUjHFw5esnhPjcM1c7tBuj1snklOKDCc YWX4QP9dkDalTxsPNd28hN2T5bma3yiiDMzekR2m1zQFsFR/TMVIzeegG44NoekaaMnk yA4pSs+HwvKYaXLFJB8F8V8Z/f80JhT/M3VeXCuaCKs7tLbAchQ++pVUg2EH72b0RJer LDFQ== 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=o6HZ9zvu2ge9bSuVRCDsIjdzt9oaZjNfBsDumZVPTMo=; b=lttnMhj3VMZPypa+7zAKwSFYnhDJgBiilvrIve5B6ReVEiywtgZYtswyBiTGvG8uQQ pVt6TX7bFnR58C/+FSmTJC+ugR+FSXZZ64RUuu5VZuTtFUsgm5CGJdXQbNXukTnRMcIp 1LqIwfwKsXdy6Unwa/syGtWzv8V1bmV309QPvqiu+PgYWVeStgblP48G4D21pFuDZJ+E V+ixFFk86iBgugG2PD53D6wtn5vA1EHeaPxdPpsyz8ttJJykL5wEa0qr5IZ8pDrQLxNs QgBMpmI7ai81tUdX8PnwUtIGmy1p8ed+BOacI0H5qrlgVINDWDbGLAQ30bUcUOqCsJZ/ cMxQ== 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 i23si128384eds.82.2020.07.28.15.58.16; Tue, 28 Jul 2020 15:58:37 -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 S1730149AbgG1W5t (ORCPT + 99 others); Tue, 28 Jul 2020 18:57:49 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:38388 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729972AbgG1W5d (ORCPT ); Tue, 28 Jul 2020 18:57:33 -0400 Received: by mail-qv1-f66.google.com with SMTP id m9so9976402qvx.5 for ; Tue, 28 Jul 2020 15:57:32 -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=o6HZ9zvu2ge9bSuVRCDsIjdzt9oaZjNfBsDumZVPTMo=; b=ZNSukRNI7nAREg/cSUgmtXUbGMN0yfqf/effYm8hnTmQI8pQBYStZxltem38EEPxQi l5HNcjcDBb9/om7fJEKk7vcMzDP+W0rkYmG54yjcQ684GBqIoINjeiycO1V/WNNVXYSZ MrMJwDH2hmulxRr5Gzb+ZkkTqcWvaKsSgw8U9j5xksayWd28ZeGKJ2hNTJxwG6mJPhDd ECzy1sxzBoW1fB0YhtDb9u9WD8dSJCQ09R4zZJ6HbsYFBG0lrntFaqCMr0PfjmRNeob1 Ws8iQvbQYoOHk8PtMlncfpMqDG9x1oD2gkN59+jcsJBziLaMJ4rZ3zjdH8PJC3HyjfyU Srug== X-Gm-Message-State: AOAM5307/Nza8XMT9Ag6wcWsOlj/Ae2WxDOiOnXu9Wu3nRQLXZmZGNku xraK2SZDDZ0O83GhCr6GyY8= X-Received: by 2002:a0c:fc07:: with SMTP id z7mr1054532qvo.65.1595977052196; Tue, 28 Jul 2020 15:57:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 15:57:31 -0700 (PDT) From: Arvind Sankar To: Kees Cook , x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v3 11/21] x86/kaslr: Short-circuit gb_huge_pages on x86-32 Date: Tue, 28 Jul 2020 18:57:12 -0400 Message-Id: <20200728225722.67457-12-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 32-bit does not have GB pages, so don't bother checking for them. Using the IS_ENABLED allows the compiler to completely remove the gb_huge_pages code. Signed-off-by: Arvind Sankar --- arch/x86/boot/compressed/kaslr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 0df513e3e2ce..3727e9708690 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -303,7 +303,7 @@ static void handle_mem_options(void) if (!strcmp(param, "memmap")) { mem_avoid_memmap(PARSE_MEMMAP, val); - } else if (strstr(param, "hugepages")) { + } else if (IS_ENABLED(CONFIG_X86_64) && strstr(param, "hugepages")) { parse_gb_huge_pages(param, val); } else if (!strcmp(param, "mem")) { char *p = val; @@ -551,7 +551,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size) struct mem_vector tmp; int i = 0; - if (!max_gb_huge_pages) { + if (!IS_ENABLED(CONFIG_X86_64) || !max_gb_huge_pages) { store_slot_info(region, image_size); return; } -- 2.26.2