From patchwork Wed Jul 12 22:33:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 107535 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1411650qge; Wed, 12 Jul 2017 15:34:19 -0700 (PDT) X-Received: by 10.98.163.203 with SMTP id q72mr56533770pfl.97.1499898859150; Wed, 12 Jul 2017 15:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499898859; cv=none; d=google.com; s=arc-20160816; b=YHnR6rXe8VEeYAKZsXOHp0VUhQ/xDJhJOF/dzdek5H2L/ZUxDm2OcLViAmWNuEPd+f QFr6DFn+pKDVetXd+4s5XQCgBKieYKK9ep8b0RgoWK14bvSoesy+pZfiaDpZMiuz4GdR wGbjBTLq7TUU5ZDXp6Y+PFT0TskTJEHkq+62x53t5/gWm0makX6pq8IDJ7p6ar9XVWRb XrQz8ehh27lQSuyPv94Djk98hwwpWWpbxDtP9rNvq08E3Eo9O0OquKsUPa08l1kftQan dcrsjsO8orjREIpG+i2J7OkavoS7em7iu/tF/OcAqZVIqMGNORbTA01uMQbLK5x/c6fA 67Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=/dRvVKMXvmBfzhqq7UEBXZQNjBfDcqqaPT/5LdGTZho=; b=gM2mqWjzdZ3oRNwxPxKaVB3RPdSXql3UWvLtIT8rPeVFxw6cWjm6PTQdpTPUFo4e0W 1pJJM2qdPHzrS9oDy7vtoCj88z/2CJzb84LATMPYJJoBO8x+mNRSiw7HxBeyxVLBKlSb 9wNNmGjySe7Ovq5xxIaL2xmjS92MY3Z0XGZVFTNBMmGhvXR3kBPly8w0jpyKP5eLWYvB JncIj+FpNRH6KI8dJiaq0mSylu5fos8uD76S5IuSgOG62BLw6bHHpMRFro3Xa52lHvHr FUDaDyPqn+T8KLpnKHAZ7D2ZSGHQFFaRlGcy+uiIdq+xRv79j9kw5h831WuMwFXQ0Obl bX6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si2966209pli.72.2017.07.12.15.34.18; Wed, 12 Jul 2017 15:34:19 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbdGLWeO (ORCPT + 25 others); 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 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1E81915BE; Wed, 12 Jul 2017 15:34:11 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 46ED33F3E1; Wed, 12 Jul 2017 15:34:09 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 1.9.1 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)