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=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 7D38CC433DF for ; Wed, 1 Jul 2020 20:30:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4E1FC2071A for ; Wed, 1 Jul 2020 20:30:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Euwkb9nf"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="OGDlAsLM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E1FC2071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0d+h940waLQZBrQLntqY+itFtaliQkHk45dmReVKPHg=; b=Euwkb9nf1nOuDIjN4cEr5Txdk lNJsAaCDDfa5Jnc8DarC/fs0wxxL24Lvu0fuwmHreQue2HG5pgPOnJFhAOJ9k6rIhzvvWZ00qsUYa kn1BXy8Bdayj446l2msYRv23CWxq0RDiXM11c3U0B8w0++NJ/xyZ2aRIuW/o/+pZZKMsbgT83DtYZ lCHo9dEsEzcBfFkLexl9QyKPa4embMIOUuUNs+9RoRFo5FnbPn7TcNMMZrngz1Q5URxq4JlcDoyCQ TyUDKfgixmaQ89ZDGBs9ij5lv0b8SAKFSt2j/mX5Jw5cV4EvrLjHkWDiSpvlLV3QQeR8TnK5WSHgf 8rp72f4Rg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqjMI-0004ZJ-TT; Wed, 01 Jul 2020 20:29:30 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqjME-0004Xx-Ji for linux-arm-kernel@lists.infradead.org; Wed, 01 Jul 2020 20:29:27 +0000 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B80F20870; Wed, 1 Jul 2020 20:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593635366; bh=WSI7tO7Fa4R8omP22jB/lPegzqXjvS0v2ZJ5TVXB+q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OGDlAsLM5MnizCiCBIzebh8gF/M+KqqKq7WAC0PiNvVCtapVOnIJWdlrZPq/E25V6 1YWeZaOuFtOGBIybNbjxWtNkPvLz4RFXsqQ7oi4tbxPhElgGrH0Rc229l5U/CH6dX5 PnBAIK2h2PLn5v2XVMwpmk4gKhtmKkMwsAewHOSo= From: Mark Brown To: Catalin Marinas , Will Deacon , Marc Zyngier Subject: [PATCH v2 06/11] arm64: vdso: Document and verify alignment of vDSO text Date: Wed, 1 Jul 2020 21:28:41 +0100 Message-Id: <20200701202846.54648-7-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200701202846.54648-1-broonie@kernel.org> References: <20200701202846.54648-1-broonie@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200701_162926_736185_8E4BDA54 X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Brown , Andrei Vagin , Vincenzo Frascino , linux-arm-kernel@lists.infradead.org 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 We do no rounding when working out the number of vDSO text pages because we ensure in vdso.S that the vDSO text is an exact number of pages long. This is not immediately apparent when looking at the code that does the vDSO mapping in vdso.c so add a comment explaining what's going on and check that this assumption is true. Ideally we'd have a BUILD_BUG_ON() but since the start and end come from another compilation unit it needs to be a runtime check, add one which prints a warning and errors out similarly to the existing check for the vDSO not being an ELF object. Signed-off-by: Mark Brown --- arch/arm64/kernel/vdso.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index b05e4d5880af..95e69df42141 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -99,6 +99,15 @@ static int __vdso_init(enum vdso_abi abi) return -EINVAL; } + /* + * We ensure that the vDSO text is page aligned and an exact + * number of pages in vdso.S so don't need to round here. + */ + if (!PAGE_ALIGNED(vdso_info[abi].vdso_code_start) || + !PAGE_ALIGNED(vdso_info[abi].vdso_code_end)) { + pr_err("vDSO is not page aligned\n"); + return -EINVAL; + } vdso_info[abi].vdso_pages = ( vdso_info[abi].vdso_code_end - vdso_info[abi].vdso_code_start) >> -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel