Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp991517pxb; Wed, 3 Mar 2021 23:46:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1Udu22/zAvXp6FoavM6iMD/sRoLpHTtZc70poIucp3hRYScBrVgJeOAsabd6TL3yChIQ6 X-Received: by 2002:a17:906:cd12:: with SMTP id oz18mr2858349ejb.498.1614844017911; Wed, 03 Mar 2021 23:46:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614844017; cv=none; d=google.com; s=arc-20160816; b=h4Dm11CvnvEJUQiOn64SOtVxbbYcFwaA6dlw2+CSoZayP75xb0AMvganOUmYnLNljR fasGXwl5AJU74miJi2b9lhOWNxmdv28nZByjfTUdaGmziF7fPsyxKJG8UPi4X/hSZz06 bpohBC01V5Fm8GYe6TrZq05sZ95h/b/kK8C64bunZrBiO2CJaCBxQX6s5L8zb7W3CEo1 fGSkPv3AVpFSxqUzIuLURC3HLg0yy98Rm0D4lkp+0lEa5Iv6V9QZF8n+19QwvFM5FSaE dDpRDmYKnuSeDAXz+laeL87ordXK1lESFdGDvPKa9broLRX0p5pTNSSVkkNyqFr8LCcJ FUMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=2ZHo6bqqoFQHDt1XsnxWzUIHllyauSrjIJToDTBiZLY=; b=UT6+k4H4NnaQ3bngwGcWIRVwWLeVdCnXFoScXpRopBndNkBgKf6J/vowp0E9DfIP6y R74a74MUaCz+Z3u9iFIY19zJZsK3NZvG/djvpLbw5f7NfqRSqQMspiF4zYn3+qNDCrec 35kiE6yhZ/TpHl+AlEGdfP4uX+Uu8neF/cCL+W/w475hUtch20l/Aptx/XTzxN2sUIxZ M+nowcPetBgzbx5afuzv4W/VJKYck0FiS/SIiqEzku7ZjL3a5McXgkBFyAhq5vwGwSeo BdqZQNY7/OJFjzfSbPv1fDZxJCzUnovsWF4+kSUiN11ndUnlMoEUhiwk3E5dlYD8rlnH njTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=HFHYvchu; 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 si28si12260308ejb.106.2021.03.03.23.46.35; Wed, 03 Mar 2021 23:46:57 -0800 (PST) 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=@soleen.com header.s=google header.b=HFHYvchu; 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 S1383112AbhCCKuc (ORCPT + 99 others); Wed, 3 Mar 2021 05:50:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237499AbhCCAYB (ORCPT ); Tue, 2 Mar 2021 19:24:01 -0500 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25914C0617AB for ; Tue, 2 Mar 2021 16:22:35 -0800 (PST) Received: by mail-qk1-x732.google.com with SMTP id q85so22341709qke.8 for ; Tue, 02 Mar 2021 16:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=2ZHo6bqqoFQHDt1XsnxWzUIHllyauSrjIJToDTBiZLY=; b=HFHYvchu6CpdqexxuDSsNYf6zc2J6VEKWIBzKSjPVt7Oj5tn2/oRKB1PtdVtAhgBcu 8QtnWiz/7P8/LqX5wFb1aqUQju3puj7mBA1eY2moIHPzNRpZr6tHqSrfP6M19tFtCndA Dw7uvs/8X/wLRsL+Y2oTYcwh4VUTm1gb0QoWI27HLxniuFGEj0KhR+xLWCeoEvbTnu+7 iDZO6hGQaznymI4Z7Kti3JjhODZC9KYEwl0lPssNr6T7Q8YrqF4+AmY67n+7+DzGelJs WYrCxrVf4ENesVrOPXLzb1mOiHh9nKU3H9yCHxRR06iUcT7IO02sj3oVqitQee/e+0NO HyTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2ZHo6bqqoFQHDt1XsnxWzUIHllyauSrjIJToDTBiZLY=; b=FRhYCD4xoqPfZSax+vNHBZOgHh/wwXjyaK1GpovHEduXRB2C6Zc9WDw1H/tVuNZ3m/ 6jxAXY5AztG4PGaqY5St+TOgJa/6Cns2vj0IEzsHh4EuGDAPmuIPGaeD4LH8o/0yV0mD S5b1cFqWdCqU/NSer9TefH2waHzx3gjjtQvjz16pJJaSfu4ol4xbEzPhsR8EuB0FBcNf 1cvUryuo/A5WeS+ZpysV3AWHJpyaHBPkIxrbypaES1wUClNno6G2PdIaUcGDyCz+4fYK DmegCzRzvUUKpJSJpB758jSBkMh0M0zvSmhCRzO6uv/HD3cMQ26bTVsoCr+QRqRQUfsz M3Jg== X-Gm-Message-State: AOAM533qha2fHmqTYuA+4ekiYL6TkWPP16st03tfgVT4JmWz5D3PMPoh 8vaImtL56IkQw//B8O2tbTL2Dw== X-Received: by 2002:a37:4743:: with SMTP id u64mr16003296qka.350.1614730954363; Tue, 02 Mar 2021 16:22:34 -0800 (PST) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id r3sm16690512qkm.129.2021.03.02.16.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 16:22:34 -0800 (PST) From: Pavel Tatashin To: pasha.tatashin@soleen.com, jmorris@namei.org, sashal@kernel.org, ebiederm@xmission.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, corbet@lwn.net, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, maz@kernel.org, james.morse@arm.com, vladimir.murzin@arm.com, matthias.bgg@gmail.com, linux-mm@kvack.org, mark.rutland@arm.com, steve.capper@arm.com, rfontana@redhat.com, tglx@linutronix.de, selindag@gmail.com, tyhicks@linux.microsoft.com Subject: [PATCH v12 01/17] arm64: hyp-stub: Check the size of the HYP stub's vectors Date: Tue, 2 Mar 2021 19:22:14 -0500 Message-Id: <20210303002230.1083176-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210303002230.1083176-1-pasha.tatashin@soleen.com> References: <20210303002230.1083176-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: James Morse Hibernate contains a set of temporary EL2 vectors used to 'park' EL2 somewhere safe while all the memory is thrown in the air. Making kexec do its relocations with the MMU on means they have to be done at EL1, so EL2 has to be parked. This means yet another set of vectors. All these things do is HVC_SET_VECTORS and HVC_SOFT_RESTART, both of which are implemented by the hyp-stub. Lets copy it instead of re-inventing it. To do this the hyp-stub's entrails need to be packed neatly inside its 2K vectors. Start by moving the final 2K alignment inside the end marker, and add a build check that we didn't overflow 2K. Signed-off-by: James Morse Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/hyp-stub.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index 5eccbd62fec8..572b28646005 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S @@ -41,9 +41,13 @@ SYM_CODE_START(__hyp_stub_vectors) ventry el1_irq_invalid // IRQ 32-bit EL1 ventry el1_fiq_invalid // FIQ 32-bit EL1 ventry el1_error_invalid // Error 32-bit EL1 + .align 11 +SYM_INNER_LABEL(__hyp_stub_vectors_end, SYM_L_LOCAL) SYM_CODE_END(__hyp_stub_vectors) - .align 11 +# Check the __hyp_stub_vectors didn't overflow +.org . - (__hyp_stub_vectors_end - __hyp_stub_vectors) + SZ_2K + SYM_CODE_START_LOCAL(el1_sync) cmp x0, #HVC_SET_VECTORS -- 2.25.1