Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbdGLWeO (ORCPT ); Wed, 12 Jul 2017 18:34:14 -0400 Received: from foss.arm.com ([217.140.101.70]:59100 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbdGLWeL (ORCPT ); Wed, 12 Jul 2017 18:34:11 -0400 From: Mark Rutland To: ard.biesheuvel@linaro.org, kernel-hardening@lists.openwall.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: akashi.takahiro@linaro.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, labbott@fedoraproject.org, will.deacon@arm.com, keescook@chromium.org, Mark Rutland Subject: [RFC PATCH 3/6] arm64: pad stacks to PAGE_SIZE for VMAP_STACK Date: Wed, 12 Jul 2017 23:33:00 +0100 Message-Id: <1499898783-25732-4-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499898783-25732-1-git-send-email-mark.rutland@arm.com> References: <1499898783-25732-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 916 Lines: 30 Our THREAD_SIZE may be smaller than PAGE_SIZE. With VMAP_STACK, we can't allow stacks to share a page with anything else, so may as well pad up-to PAGE_SIZE, and have 64K stacks when we have 64K pages. Signed-off-by: Mark Rutland --- arch/arm64/include/asm/thread_info.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 6d0c59a..3684f86 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -25,7 +25,13 @@ #include -#define THREAD_SHIFT 14 +#define __THREAD_SHIFT 14 + +#if defined(CONFIG_VMAP_STACK) && (__THREAD_SHIFT < PAGE_SHIFT) +#define THREAD_SHIFT PAGE_SHIFT +#else +#define THREAD_SHIFT __THREAD_SHIFT +#endif #if THREAD_SHIFT >= PAGE_SHIFT #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) -- 1.9.1