Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5379838iog; Wed, 22 Jun 2022 18:56:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uAP2ZJy6bbdkWitAJM8yB//HAWoIdDMogeJBD4hTgpheDDbI7LF9oX3kKz4GvMiODVbJ5U X-Received: by 2002:a17:90b:38c6:b0:1ec:9922:f482 with SMTP id nn6-20020a17090b38c600b001ec9922f482mr1411090pjb.201.1655949395015; Wed, 22 Jun 2022 18:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655949395; cv=none; d=google.com; s=arc-20160816; b=e9aFmRZK0+OEj9VColnPe2T4Q6SON0erO2/bFxwXKlIfYjmxHpNrz2XveFLb+qgCTg 7aoexdlC2jIn4EiD+irxEGMmFqIkzl0t/wmyRJTM4l7EeHIg4HHO/fsJ8GwuPq9+T4ZS jrV8rDgULU+ASEil3mhpSFGrPMxgb3MCHkMvrvGOA0aVPrDgHK0P5lR/+9oW4cP+IjL+ 4zRh1/QrpRSHigh6sb1tOnO1PIsSG2wy5PGaTyZx3Ie9djSUVMZMyueBlL8au/yI4NFn gP7jmYvc2FoSvLqcIHG8PEUL6SR8KbuXNGOr5ZElmGCn2WQ5mcLrScrbm3QIeixzWzi6 p3mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=1J1tmWrkS8CWQq7xJjCc/Twhjoj2QsFUR2qwnajCUP4=; b=w6ZJ2e40brPC8u6SGXRTpvI5BYVTsi+eMFev4XxTvS7iPiXzDPKfVIlhp+PkrwwHov kDO9l2EMa33wr5Hh70gl5ZwXep8sXcqhf/GoMhyLe+KWApuH+NkcW38aB4Fby02n14ex fgwAKVTKB8KoQUAfi22+SaZNhHDLCeORn2kvPmhH6LjAyosbdhGVeqIH45aquDq6+EQw 6O8DBBzeMlb+Tp/1+hEna40ovgNmbT/w+1GsU2jlVlIvuBZKmMttc850ite2MMWOSdJS nWpgHsPbpO9rnRvko4BQK3mgvNwVq6bfrLX3pCMHU/srZcV8CIG790g6AVqk6Oh8iaoQ EJHw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu9-20020a17090b388900b001eccaceca54si1572599pjb.80.2022.06.22.18.56.23; Wed, 22 Jun 2022 18:56:35 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377856AbiFWByX (ORCPT + 99 others); Wed, 22 Jun 2022 21:54:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376548AbiFWBwa (ORCPT ); Wed, 22 Jun 2022 21:52:30 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A748743EC3; Wed, 22 Jun 2022 18:51:54 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LT39q3wKWzkWk9; Thu, 23 Jun 2022 09:50:39 +0800 (CST) Received: from dggpemm500013.china.huawei.com (7.185.36.172) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:52 +0800 Received: from ubuntu1804.huawei.com (10.67.175.36) by dggpemm500013.china.huawei.com (7.185.36.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 23 Jun 2022 09:51:51 +0800 From: Chen Zhongjin To: , , , , , CC: , , , , , , , , , , , , , , Subject: [PATCH v6 30/33] arm64: entry: Align stack size for alternative Date: Thu, 23 Jun 2022 09:49:14 +0800 Message-ID: <20220623014917.199563-31-chenzhongjin@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220623014917.199563-1-chenzhongjin@huawei.com> References: <20220623014917.199563-1-chenzhongjin@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.175.36] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500013.china.huawei.com (7.185.36.172) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 In kernel_exit there is a alternative branch for KPTI which causes stack size conflict for two instruction boundaries. To fix that, make both branch move the sp and then revert it in tramp_exit branch. Signed-off-by: Chen Zhongjin --- arch/arm64/kernel/entry.S | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index d49bfbe81a0d..677e3be471bb 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -430,7 +430,11 @@ alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0 ldr lr, [sp, #S_LR] add sp, sp, #PT_REGS_SIZE // restore sp eret -alternative_else_nop_endif +alternative_else + nop + add sp, sp, #PT_REGS_SIZE // restore sp + nop +alternative_endif #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 bne 4f msr far_el1, x29 @@ -729,6 +733,7 @@ alternative_else_nop_endif .macro tramp_exit, regsize = 64 UNWIND_HINT_EMPTY + sub sp, sp, #PT_REGS_SIZE // revert sp tramp_data_read_var x30, this_cpu_vector get_this_cpu_offset x29 ldr x30, [x30, x29] -- 2.17.1