Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1761866rwb; Tue, 29 Nov 2022 19:19:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PUk6wU5eAALiX7HQuVkQhT+/ppi+8gLeyZc0EyZBSaGu/1nCxhc4x/IJhuCy5AdEOXjqh X-Received: by 2002:a63:1a48:0:b0:477:786:f557 with SMTP id a8-20020a631a48000000b004770786f557mr35791393pgm.476.1669778353610; Tue, 29 Nov 2022 19:19:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669778353; cv=none; d=google.com; s=arc-20160816; b=Fe9EJhwpr93gtVWRlHwgt3DLbBOVKpq1ENyObAf9bkVZ8ZFJE2VLaMVNmNa0ktr16G JJeOdtayMwYI6gnFZVO4wK7nbzwJ/tgVXlaRRaS6fVIjLSAovhIce+LgyQDSRa8clIPS ON5CawSHCc6/epxBwOWakvqWHFq/AZkepjuI9Wylg+1vKVu2XvWXYYwAl2+LsmmaH8gF RwHIcR0FEJGYf9KfVunGES1+JBgqWypagzrSnQgI13OjUZX26uoy3immI1ElHANIonu4 rOoJAo8bkP6S76u0Tft4AElnNz3bGKzjVz7VxI946HDiCcXELhONSI6VrvlTQOkzJRty NJdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:cc:content-transfer-encoding :mime-version:message-id:date:subject:dkim-signature; bh=cCcorQr3xt7S/9kPkpKfyFY9wnh4zyqAGWy8g0u82Pg=; b=ZPGVkPrE4jkXiije3BiFnBdnxVDQZ0dcQf2Sm5I0s08LSIrUjumNhtofHA6Z6cUvGH E4K0aPZnvV+mZBOiEEpVV+BJNK1L1jG85n7JPpSgUNHRoynzc2J2DE0bDoiSVlCVl14B 5oI0/VcHsDKessUFByw8ePe+yo0Zez36GPcW2vf4vfUCCrd/jbJa229eykgOpoqdw/dQ SM46JalJoYzqR7abCf6SDoK2TxAQyoBmhQnM3FIAbX8myXsR0l4XSJzqWxnpT0sRz8Fp zOv/JYTkCHOfb3dd696meRn9OnCtsKS6KFFqnvCSC05EjV8SVB1FOpZRy14JD6HUh/xx VHfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=zIgXfyOI; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a632143000000b00476c718a6b4si114417pgm.453.2022.11.29.19.18.58; Tue, 29 Nov 2022 19:19:13 -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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=zIgXfyOI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiK3Cfu (ORCPT + 85 others); Tue, 29 Nov 2022 21:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbiK3Cfr (ORCPT ); Tue, 29 Nov 2022 21:35:47 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92D7612091 for ; Tue, 29 Nov 2022 18:35:46 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id l22-20020a17090a3f1600b00212fbbcfb78so574227pjc.3 for ; Tue, 29 Nov 2022 18:35:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=cCcorQr3xt7S/9kPkpKfyFY9wnh4zyqAGWy8g0u82Pg=; b=zIgXfyOIwEsoklp4Pj2VNqVlzqwOyXMyUOmtxXL8XX0HZeDXxESlEZt18Ufk8JeuWs 7Q7DrZZk/oBitKWBF64Y72Kp2UZQ7dqDF1tWUk9honYowHZWf7T07fwYEp42FE86aX1Z gotSBlRsn35YWoYFAbebcGNynvUUURc8MWORwvu2WIiMk6mdXfZHEGtdcZ0V537kul+v xAfm8oj9auHJEgnhK834L9M7MGTTIIaw5+ZBB9pNrXTs3FyLHdQzM9t0LKeC8H5zFH92 oL0JH5gN1h6OJbnPfadyReZYXdDjEC1MrmIOqa9EU60CrE7FKP5+UH69dvLJ3D/kKeOV roog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cCcorQr3xt7S/9kPkpKfyFY9wnh4zyqAGWy8g0u82Pg=; b=2duwX4HUnFjLcqFQw80wcFePk24Y2rub64xeOyiTHaFC2C/jwVJnaoNOzsEuE9CkO1 brc5Gv9KhPRCij2JiQWm/v3LG0mKtfqY0XD7Si8EdfJjHIcrkcnwYSyCUwVBPz1+tSGr l4wCLctcEJHeMeXbFt8wLEmHW9BLXhXUO84KZ/mEN3lJN9bNbaAvXZXMa6FQ9l6LB5bU GHWNbAVhyI1htge4tNcXGI+GHAv+/ZkjRBtORvTylxoyPK4VWFgX7k9yTmeXLQ3c/I2w iMIjVs++rEHXQwCVd0M6g+s3VjF2aIWcpN5UAjhdEjRKl9Bgi9zo6bEoQQIv/bMZ4hVb BO0Q== X-Gm-Message-State: ANoB5pnvj1mPWAnf8Zoz232d/MX4ZB747wk1zTSj9DPCIbqQu18XfOCo SGYlxOBTD4R4NgiAT4xZnhgzl/7qgcCoQw== X-Received: by 2002:a17:90a:588b:b0:219:c40:e5f with SMTP id j11-20020a17090a588b00b002190c400e5fmr25718858pji.49.1669775746080; Tue, 29 Nov 2022 18:35:46 -0800 (PST) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id a10-20020a1709027e4a00b0018912c37c8fsm7638pln.129.2022.11.29.18.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 18:35:45 -0800 (PST) Subject: [PATCH 1/2] RISC-V: Align the shadow stack Date: Tue, 29 Nov 2022 18:35:14 -0800 Message-Id: <20221130023515.20217-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Palmer Dabbelt From: Palmer Dabbelt To: jszhang@kernel.org, guoren@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 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 --- 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