From patchwork Wed Feb 24 16:21:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62805 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp2502856lbl; Wed, 24 Feb 2016 08:28:52 -0800 (PST) X-Received: by 10.66.167.237 with SMTP id zr13mr56615452pab.85.1456331332313; Wed, 24 Feb 2016 08:28:52 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id h4si5798081pat.211.2016.02.24.08.28.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Feb 2016 08:28:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYcI8-00037L-B9; Wed, 24 Feb 2016 16:27:56 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aYcCT-0005RJ-5O for linux-arm-kernel@lists.infradead.org; Wed, 24 Feb 2016 16:22:12 +0000 Received: by mail-wm0-x230.google.com with SMTP id a4so37332595wme.1 for ; Wed, 24 Feb 2016 08:21:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9SdDiYYXFV4XGFrADcNXY/8yIJ0pkHxY4RYhGBdJLao=; b=A1IujzwGuk9AIgQXmW4UVSmSm9CRlDNvcTCmuwSAy2ZsYxJbaXqhyhX7W56+aSxtrC JODmq/gipWyfESGiuG3bZIynNUDHTB5Qc08suyAmtoZLnhmgZq53/KVEfDyZI7HVzh0o 6gmEuWcF0Tw9x0FN9BRVS5yDtnCi7IRBts69c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9SdDiYYXFV4XGFrADcNXY/8yIJ0pkHxY4RYhGBdJLao=; b=IQf9bqX1Qnuv5UGB226xnyA+DgIrC96VpA5lcf9Mr7S0xTsb4aGddbXDqfdUgauHmS vd8gfsPULiILCjCmgj5uQngzcCyjmLyyfWi6P0DZg0ZT2/SsNN83767QfPbye35OhfzV Vt1KnfmOlvly33PV7ZN3+GiVTfb6KF1Sls36T0tZujMk5xBEB0fURMBNmrGrajx98NF9 4aujBiHarlMiUGNRZ7TfD8KS/0momGnRwVAiEAu1h/tXopFB0wGwoeAboDi5c1cSDXYx aMQp+KX+HckNzrQXPjHKzcFgau/rMwN4XBFRTYOsMQOdNPyigEJWGK1giQWp1Y/96ttS xCng== X-Gm-Message-State: AG10YOT8TyH8QsEV7PNhREGssgPSqp/3tjSTetujLhhQFyNxxz+gzXS804Y7CdcGwhrhAk6l X-Received: by 10.28.183.69 with SMTP id h66mr25441555wmf.6.1456330903425; Wed, 24 Feb 2016 08:21:43 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id gb9sm3730412wjb.26.2016.02.24.08.21.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Feb 2016 08:21:42 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com Subject: [RFC PATCH 2/6] arm64: vdso: avoid virt_to_page() translations on kernel symbols Date: Wed, 24 Feb 2016 17:21:29 +0100 Message-Id: <1456330893-19228-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456330893-19228-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456330893-19228-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160224_082205_892390_14E00B63 X-CRM114-Status: GOOD ( 12.24 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:230 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org The translation performed by virt_to_page() is only valid for linear addresses, and kernel symbols are no longer in the linear mapping. So perform the __pa() translation explicitly, which does the right thing in either case, and only then translate to a struct page offset. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/vdso.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 97bc68f4c689..fb3c17f031aa 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c @@ -131,11 +131,12 @@ static int __init vdso_init(void) return -ENOMEM; /* Grab the vDSO data page. */ - vdso_pagelist[0] = virt_to_page(vdso_data); + vdso_pagelist[0] = pfn_to_page(__pa(vdso_data) >> PAGE_SHIFT); /* Grab the vDSO code pages. */ - for (i = 0; i < vdso_pages; i++) - vdso_pagelist[i + 1] = virt_to_page(&vdso_start + i * PAGE_SIZE); + vdso_pagelist[1] = pfn_to_page(__pa(&vdso_start) >> PAGE_SHIFT); + for (i = 1; i < vdso_pages; i++) + vdso_pagelist[i + 1] = vdso_pagelist[1] + i; /* Populate the special mapping structures */ vdso_spec[0] = (struct vm_special_mapping) {