Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp569601pxb; Wed, 15 Sep 2021 08:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgZ77Dr+/UTYW0Qanz7xNvq2d7MvnyeTIfdb8geJLpcwqKRuW52PySFm1pSkfy8sN9DWrb X-Received: by 2002:a6b:f214:: with SMTP id q20mr486807ioh.84.1631719337620; Wed, 15 Sep 2021 08:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631719337; cv=none; d=google.com; s=arc-20160816; b=vm11IXuzFgcQpdHBuAjMY2p/EHj6mxPWihBeuvNmK4eEuX9RrAbXlJUFqrmasqiftb B50ltbfJS5b4caASTGcIxDG8NDtWqC+n9lLLnzwOF7vb8l4Rw070R8K6tGKJUffOTiLz BIvXsTFM5/ahvEjMQw8Pm5TJ92uQ89dGfBNAmfAYj6pvDSGYm2b+n+9ut7cBgPr8F2f6 sCY4Pc/V5cx0v5J/EpMufTcUUok81B5jwVlskH3SszGuD4Iqgo1EjMSSvugpNgdzvSmi X9SiaPmwgQl7CiLQJOXgjHcwMY4R/ZatAj1znlgqR3XeSIimEKYi8aumAJXMT0u6vbEv vY8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=TLIEOTF8nbdYtQPS+pB+CF0PUqkM+qVm09D9CfIy4g0=; b=Dw+x4RqVWHWVuby83YgdBUt1MBu134sAVpbTHfWH3lmN0UNvfwK8Oxyt6HXz9nKNnU y/jCiGR0sTz0wtByUhop+ukYGzz4CbTpgDOLOO5FtsY95C8rYw+95JFuOqKJhDHemnCr uVvvm92Cqgb/w5jgW6Vj5+VgQX0TaVc39w3Au8AhwUZnRwA2+ejMEWE73+HE/bUjeJCv Dbnsi1qYxaBBFhLbQYqaQyjMBKL8vIl3Pn9U0CTwxXaC54bXwUIIogo/SNpcQ2zjuFWJ s8FygBV0YF3kzaYnbp7CyEQ2VnXodrkdWTDverjdDZCZ81p62Ew3NtqNIV7Ax5JtOV6x Dhzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=kZ8i4QtJ; 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 y28si163636iot.48.2021.09.15.08.22.04; Wed, 15 Sep 2021 08:22:17 -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=pass header.i=@infradead.org header.s=desiato.20200630 header.b=kZ8i4QtJ; 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 S234215AbhIOPU5 (ORCPT + 99 others); Wed, 15 Sep 2021 11:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234024AbhIOPU5 (ORCPT ); Wed, 15 Sep 2021 11:20:57 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 550B7C061574; Wed, 15 Sep 2021 08:19:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=TLIEOTF8nbdYtQPS+pB+CF0PUqkM+qVm09D9CfIy4g0=; b=kZ8i4QtJ8teNEnNCGLodt0lYVR vCNXiV+7GGltWy9Ll936ySZ56NN1926GqHnyUDPW4xXaT4fudGfrsLlBoKm7OOttSb97HAMu3lu97 A+psiODluiXR8wYNQydAHmKI1frxrabeUBUU4oyerooIuFnNUiiwc+w4HXoMigOzvXqOBltN08PaY IBgML0DvAx5HlAFH/bb8A+kezbQiccRQpTOVaepNEcB74JT6oL4yrPtp5NO7YhCr+O4VNO+5Xn9M4 7Ao2mJVyGFbDj/FOSh/lzVtgwryjtfbHaOcDrNLgAzCecJPF4oIW9OtRGzwj+lNPfWuHg3qvrP8p3 +5NTIZYg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQWgw-003QBa-9h; Wed, 15 Sep 2021 15:19:18 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6B1D23000A3; Wed, 15 Sep 2021 17:19:17 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0FA7A234E53A1; Wed, 15 Sep 2021 17:19:17 +0200 (CEST) Date: Wed, 15 Sep 2021 17:19:17 +0200 From: Peter Zijlstra To: =?utf-8?B?546L6LSH?= Cc: Dave Hansen , Dave Hansen , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "open list:X86 MM" , "open list:BPF (Safe dynamic programs and tools)" , "open list:BPF (Safe dynamic programs and tools)" Subject: [PATCH] x86: Increase exception stack sizes Message-ID: References: <09777a57-a771-5e17-7e17-afc03ea9b83b@linux.alibaba.com> <4f63c8bc-1d09-1717-cf81-f9091a9f9fb0@linux.alibaba.com> <18252e42-9c30-73d4-e3bb-0e705a78af41@intel.com> <4cba7088-f7c8-edcf-02cd-396eb2a56b46@linux.alibaba.com> <09d0190b-f2cc-9e64-4d3a-4eb0def22b7b@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <09d0190b-f2cc-9e64-4d3a-4eb0def22b7b@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 03:34:20PM +0800, 王贇 wrote: > Hi, Dave, Peter > > What if we just increase the stack size when ftrace enabled? I think we can do an unconditional increase. But please first test that guard page patch :-) --- Subject: x86: Increase exception stack sizes From: Peter Zijlstra Date: Wed Sep 15 16:19:46 CEST 2021 It turns out that a single page of stack is trivial to overflow with all the tracing gunk enabled. Raise the exception stacks to 2 pages, which is still half the interrupt stacks, which are at 4 pages. Reported-by: Michael Wang Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/page_64_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h @@ -15,7 +15,7 @@ #define THREAD_SIZE_ORDER (2 + KASAN_STACK_ORDER) #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) -#define EXCEPTION_STACK_ORDER (0 + KASAN_STACK_ORDER) +#define EXCEPTION_STACK_ORDER (1 + KASAN_STACK_ORDER) #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER) #define IRQ_STACK_ORDER (2 + KASAN_STACK_ORDER)