arm64: vdso: avoid virt_to_page() translations on kernel symbols
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 30 Mar 2016 14:45:56 +0000 (16:45 +0200)
committerWill Deacon <will.deacon@arm.com>
Thu, 14 Apr 2016 15:31:49 +0000 (16:31 +0100)
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 <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/vdso.c

index 97bc68f4c689f28eac7188f5e0b792b5293c37da..64fc030be0f26cee1cecc26a51598ebabf71278d 100644 (file)
@@ -131,11 +131,11 @@ 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(PHYS_PFN(__pa(vdso_data)));
 
        /* 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[i + 1] = pfn_to_page(PHYS_PFN(__pa(&vdso_start)) + i);
 
        /* Populate the special mapping structures */
        vdso_spec[0] = (struct vm_special_mapping) {