From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A748C433B4 for ; Thu, 8 Apr 2021 04:07:58 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E988611BD for ; Thu, 8 Apr 2021 04:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E988611BD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jf4fJUJSA9KF2U1nNQDZaCT9B1ALjOLGT9H4Hag4XfM=; b=pwRDMSAmolkx4HDvGwXCjUM2o RKsxVVoNuNHxKP+J3wUK5+bWaOvr6FYGqktqtQERexb1iWZ/UKuh085u1kOkw9Du9no1V2KR7Ztq5 a0OcO2gNFqugZpcI+slvyQGhF2YK8k5+0e3MisrhiDUD01qvaA3l/55grhiTkpZN8Ji/0XzmRTgSm TCDVbVLFH9F4YzA9mID4or+Oj/d8vqKH7arYlMEmskwf+8Qvd347mquHTEsrVFw0phaxCuhi37gf9 6cE9Lw10mi74ecX7+Lml28+vEYVYU6Qs287M6ZHcr/5/loGIhvLhX5K/i5GerVyK2WN8DYdKwehFs ++r9gyr4w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lULvx-006lqN-Oj; Thu, 08 Apr 2021 04:06:21 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lULvJ-006lVA-PV for linux-arm-kernel@lists.infradead.org; Thu, 08 Apr 2021 04:05:47 +0000 Received: by mail-qk1-x735.google.com with SMTP id 7so927418qka.7 for ; Wed, 07 Apr 2021 21:05:41 -0700 (PDT) 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=X9eAU/eM3040QGUYmUbw7fYBZz3JtF3avBuvT24i1+XpVGvbIi9BNTH2rSlvhxMZ6p vB7bmo+61os1iTwbbNQRR69s0xibH9y2Zh+JxqbT2cEzOMZyXY4XleOC3VU2OQbelf4e qUx64StBUbF+O1txg2vRkmFpmHWn5MioQBG/fANNQ2YzUxTJC8uDaJ4j6/ABFGO80TmL lT7jf5YqjgaPI2Fa4vi35ToQnOb1K/7GhDLWSoB81CHHWcprY9EhPAQcUKCUF69eeTrQ 5rcxFBkWQYTv7dEA+PHoUkVJSA2Bu07e+E9jh6dpYWIsqXcT3kY8zV4f1HpZcTG33b+V 3i2A== 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=UlbaO277ZukoPiY/g6oykAW1G/vAjqKs5sG4pgSjYPQAt7xjYzSUV6iQ+mGpskeQec l3ZsxHTRU5mTEc8E/2jv4WQYX/niYo8X9nU6Mu45VDpy9n07zY20ok1kuFHi3FhtSwKX AGQABkSo+kf8TZhRPg8coyW7GhkThyGDerMl0pgIjr3Sjsi6JpWwLVWqFjn1hIqFiAD4 MX26Tvb0gSgL+WF4Foo8CmgH95KgZGUQX55kn3cLdoiOOX22rrHphMUzK+44PPU5lZNF na9a8FZuV7KkB7Kdq0TanojwLlhPlcH8C/YSZ3L+d75OSYMsIvb1Z/w0gDGYEPrxFrOM XGJA== X-Gm-Message-State: AOAM530zf5ZZBW/ho93kwY5bRSfN1UGl9SfPTW/09hKJ/gbfa33lh9nz NKmY2iT3GYHXi5sW9d2685q17A== X-Google-Smtp-Source: ABdhPJxYXvk2FxZ0FX2jOzjDLvti4P2RgEhIeGGR2Vwo3ThVtxJOO1wAhCh/APii2j5zwyiwpg/lrg== X-Received: by 2002:a37:78b:: with SMTP id 133mr6607278qkh.109.1617854740543; Wed, 07 Apr 2021 21:05:40 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id 207sm18177874qkl.125.2021.04.07.21.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 21:05:39 -0700 (PDT) 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, kernelfans@gmail.com Subject: [PATCH v13 01/18] arm64: hyp-stub: Check the size of the HYP stub's vectors Date: Thu, 8 Apr 2021 00:05:20 -0400 Message-Id: <20210408040537.2703241-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210408040537.2703241-1-pasha.tatashin@soleen.com> References: <20210408040537.2703241-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210408_050541_925975_D878E9D2 X-CRM114-Status: GOOD ( 12.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel