Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp817493rwb; Thu, 1 Dec 2022 08:43:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf4yn+Po4AFVvv7SoP3iH0yr0NAVRcgy3QF8+6pzvpnzsCA8m/SrWYsuZ1GlFwzmbN9NUeE5 X-Received: by 2002:a17:906:3993:b0:7ad:f5a9:ece3 with SMTP id h19-20020a170906399300b007adf5a9ece3mr56982242eje.635.1669913037232; Thu, 01 Dec 2022 08:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669913037; cv=none; d=google.com; s=arc-20160816; b=0bPcr8Ukl5iCd1Nv+1DIQusSJOWbrCUzdI4BSsaP7lcMJVU2kHgcv9sc2Ri+brVCZ9 43IGqm6C4gJq5Y/JuLVZMS9XTTREOuynqRZhfTcb+rOYAPb+/6bldvu8/3P6xd7ydRon ucDr/NkwOTiAjLUZIddUW3TixTRaFcIXnn+R+5MI18BJX26au3DLpri62s0bs8NqEFYm SFoEXlGt9XVQgjjpu6Hfgn8JNnlAE0DQhO/z7T84/9COhY8lkCFx7V/0qjYCXPaHB1UK 8XaY0KIbn7UAQ7rK2MEO6PusP6G6bKelcjqtpwqOGa+l2q2flHdzyVrphpY7cP4rTndf CgbQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RkUgdNDkWXKK9BH3gP5psBpS7OLkrqRmTY3xLXlkNbQ=; b=UP0nSW4FiTkKTzV88bLqItfUySLNDkismwpYraqIqr90nRXB/P1Hv6NgcR0sUYlip7 tQUjZ7yOzo5C1X8uVIVzLFdZuu3OaPxiMLvKJiJZmvo7npqYa14B5128d6kiXFYqNChN OZRWNmYy+9vbz2cn6tLwEDZumnFe4iyHT2GHxK5XMHtb9pqB4TH4u7hgAZ+KdiTvJL5O /aqVOSp4+HMFxTTdK8w1LDmvFRH/cDJWJE75nMGrsiB7KQHrgvYo5YTxTzGrNOuABFZi gXl25FOtkO0QhodketLzgkHYgOWtwWDilPb43g5Z4MLMcuxQO0IeW1F6MK5k7RYMRTS2 dBww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CAaJawPC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b0078b2fed72b9si4594161ejc.111.2022.12.01.08.43.36; Thu, 01 Dec 2022 08:43:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CAaJawPC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbiLAQcV (ORCPT + 83 others); Thu, 1 Dec 2022 11:32:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232216AbiLAQcT (ORCPT ); Thu, 1 Dec 2022 11:32:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248DBA80B9 for ; Thu, 1 Dec 2022 08:32:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEF95B81F8B for ; Thu, 1 Dec 2022 16:32:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 650AAC433C1; Thu, 1 Dec 2022 16:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669912336; bh=cMwzrRKMQ2waFYK+vs1kMdLHyXhAlnzImiEEX0QXs4U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CAaJawPCOdI05RzgTiR0YrbEamagB7IKEaOxAThb5E0xpyB9Qx4gsrfy/B+HXRGf1 vgmaeMrWxHnfNpNlXHWNxVD3OvrTiQZ5FhI67/74iHZeRHCqpBzQGTo3WugcIUjccH KjcP+6WA+VtYEx9WEAfklqX9x3iRj3BKHPBuQny7frB7NGMJCechNmm133FFRL1h+p Ri2YwgcOJWjJ0CA387ZFQo9xvNT/uJFpLQDLxG8FB8uIYnfX5nUxMvFSt/qNvbVO9A rpWYJfeiDZFGQAbi2Mn0l6tektcyc8fU+W2oE9skmJtyCmEcWp3IDCq4idJTlqUEkb u4nEbIdsVQYCA== Date: Fri, 2 Dec 2022 00:22:23 +0800 From: Jisheng Zhang To: Palmer Dabbelt Cc: guoren@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] RISC-V: Align the shadow stack Message-ID: References: <20221130023515.20217-1-palmer@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20221130023515.20217-1-palmer@rivosinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 29, 2022 at 06:35:14PM -0800, Palmer Dabbelt wrote: > The standard RISC-V ABIs all require 16-byte stack alignment. We're > only calling that one function on the shadow stack so I doubt it'd > result in a real issue, but might as well keep this lined up. > > Fixes: 31da94c25aea ("riscv: add VMAP_STACK overflow detection") > Signed-off-by: Palmer Dabbelt Reviewed-by: Jisheng Zhang > --- > arch/riscv/kernel/traps.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c > index be54ccea8c47..acdfcacd7e57 100644 > --- a/arch/riscv/kernel/traps.c > +++ b/arch/riscv/kernel/traps.c > @@ -206,7 +206,7 @@ static DEFINE_PER_CPU(unsigned long [OVERFLOW_STACK_SIZE/sizeof(long)], > * shadow stack, handled_ kernel_ stack_ overflow(in kernel/entry.S) is used > * to get per-cpu overflow stack(get_overflow_stack). > */ > -long shadow_stack[SHADOW_OVERFLOW_STACK_SIZE/sizeof(long)]; > +long shadow_stack[SHADOW_OVERFLOW_STACK_SIZE/sizeof(long)] __aligned(16); > asmlinkage unsigned long get_overflow_stack(void) > { > return (unsigned long)this_cpu_ptr(overflow_stack) + > -- > 2.38.1 >