x86/vdso: Remove direct HPET mapping into userspace
PATCH 1/2 x86/vdso: Remove direct HPET mapping into userspace
commit 1ed95e52d902035e39a715ff3a314a893a96e5b7 upstream.
Commit d96d87834d5b870402a4a5b565706a4869ebc020 in v4.4.190 which is backport of upstream commit 1ed95e52d902035e39a715ff3a314a893a96e5b7 removed only HPET access from vdso but leaved HPET mapped in "vvar". So userspace still could read HPET directly and confuse hardware.
This patch removes mapping HPET page into userspace.
--- arch/x86/entry/vdso/vma.c | 14 -------------- 1 file changed, 14 deletions(-)
arch/x86/entry/vdso/vma.c +0 -14
@@ -18,7 +18,6 @@#include <asm/vdso.h> #include <asm/vvar.h> #include <asm/page.h> -#include <asm/hpet.h> #include <asm/desc.h> #include <asm/cpufeature.h>
@@ -159,19 +158,6 @@ static int map_vdso(const struct vdso_image *image, bool calculate_addr)if (ret) goto up_fail; -#ifdef CONFIG_HPET_TIMER -if (hpet_address && image->sym_hpet_page) { - ret =io_remap_pfn_range (vma, - text_start + image->sym_hpet_page, - hpet_address >>PAGE_SHIFT , -PAGE_SIZE , -pgprot_noncached (PAGE_READONLY )); - -if (ret) - goto up_fail; - } -#endif - pvti =pvclock_pvti_cpu0_va ();if (pvti && image->sym_pvclock_page) { ret = remap_pfn_range(vma,
PATCH 2/2 x86/vdso: Remove hpet_page from vDSO
From: Jia Zhang <[email protected]>
Commit 81d30225bc0c246b53270eb90b23cfbb941a186d upstream.
This trivial cleanup finalizes the removal of vDSO HPET support.
--- arch/x86/entry/vdso/vdso2c.c | 3 --- arch/x86/include/asm/vdso.h | 1 - 2 files changed, 4 deletions(-)
arch/x86/entry/vdso/vdso2c.c +0 -3
@@ -72,7 +72,6 @@ const char *outfilename;enum { sym_vvar_start, sym_vvar_page, - sym_hpet_page, sym_pvclock_page, sym_VDSO_FAKE_SECTION_TABLE_START, sym_VDSO_FAKE_SECTION_TABLE_END,
@@ -80,7 +79,6 @@ enum {const int special_pages[] = { sym_vvar_page, - sym_hpet_page, sym_pvclock_page, };
@@ -92,7 +90,6 @@ struct vdso_sym {struct vdso_sym required_syms[] = { [sym_vvar_start] = {"vvar_start" , true}, [sym_vvar_page] = {"vvar_page" , true}, - [sym_hpet_page] = {"hpet_page" , true}, [sym_pvclock_page] = {"pvclock_page" , true}, [sym_VDSO_FAKE_SECTION_TABLE_START] = {"VDSO_FAKE_SECTION_TABLE_START" , false
arch/x86/include/asm/vdso.h +0 -1
@@ -21,7 +21,6 @@ struct vdso_image {long sym_vvar_start;/* Negative offset to the vvar area */ long sym_vvar_page; -long sym_hpet_page;long sym_pvclock_page;long sym_VDSO32_NOTE_MASK;long sym___kernel_sigreturn;
Quoted 29 lines · Konstantin Khlebnikov
commit
1ed95e52d902035e39a715ff3a314a893a96e5b7upstream.Commit
d96d87834d5b870402a4a5b565706a4869ebc020in v4.4.190 which is backport of upstream commit1ed95e52d902035e39a715ff3a314a893a96e5b7removed only HPET access from vdso but leaved HPET mapped in "vvar". So userspace still could read HPET directly and confuse hardware.This patch removes mapping HPET page into userspace.
Fixes d96d87834d5b ("x86/vdso: Remove direct HPET access through the vDSO") # v4.4.190Signed-off-by Konstantin Khlebnikov <[email protected]>--- arch/x86/entry/vdso/vma.c | 14 -------------- 1 file changed, 14 deletions(-)arch/x86/entry/vdso/vma.c +0
-1@@ -18,7 +18,6 @@#include <asm/vdso.h> #include <asm/vvar.h> #include <asm/page.h> -#include <asm/hpet.h> #include <asm/desc.h> #include <asm/cpufeature.h>
arch/x86/entry/vdso/vma.c static int map_vdso(const struct vdso_image *image, bool calculate_addr) · line 163
Quoted 5 lines
arch/x86/entry/vdso/vma.c +0
-2@@ -159,19 +158,6 @@ static int map_vdso(const struct vdso_image *image, bool calculate_addr)if (ret) goto up_fail; -#ifdef CONFIG_HPET_TIMER -if (hpet_address && image->sym_hpet_page) {
Probably this patch is not required.
It seems after removing symbol "hpet_page" from vdso code image->sym_hpet_page always is NULL and this branch never executed.
Quoted 15 lines
arch/x86/entry/vdso/vma.c +0
-11- ret =io_remap_pfn_range (vma, - text_start + image->sym_hpet_page, - hpet_address >>PAGE_SHIFT , -PAGE_SIZE , -pgprot_noncached (PAGE_READONLY )); - -if (ret) - goto up_fail; - } -#endif - pvti =pvclock_pvti_cpu0_va ();if (pvti && image->sym_pvclock_page) { ret = remap_pfn_range(vma,
Greg Kroah-Hartman
maintainerQuoted 29 lines · Konstantin Khlebnikov
Quoted 28 lines · Konstantin Khlebnikov
commit
1ed95e52d902035e39a715ff3a314a893a96e5b7upstream.Commit
d96d87834d5b870402a4a5b565706a4869ebc020in v4.4.190 which is backport of upstream commit1ed95e52d902035e39a715ff3a314a893a96e5b7removed only HPET access from vdso but leaved HPET mapped in "vvar". So userspace still could read HPET directly and confuse hardware.This patch removes mapping HPET page into userspace.
Fixes d96d87834d5b ("x86/vdso: Remove direct HPET access through the vDSO") # v4.4.190Signed-off-by Konstantin Khlebnikov <[email protected]>--- arch/x86/entry/vdso/vma.c | 14 -------------- 1 file changed, 14 deletions(-)arch/x86/entry/vdso/vma.c +0
-1@@ -18,7 +18,6 @@#include <asm/vdso.h> #include <asm/vvar.h> #include <asm/page.h> -#include <asm/hpet.h> #include <asm/desc.h> #include <asm/cpufeature.h> @@ -159,19 +158,6 @@ static int map_vdso(const struct vdso_image *image, bool calculate_addr)
Quoted 8 lines
arch/x86/entry/vdso/vma.c static int map_vdso(const struct vdso_image *image, bool calculate_addr) · line 163
Quoted 4 lines
arch/x86/entry/vdso/vma.c +0
-2if (ret) goto up_fail; -#ifdef CONFIG_HPET_TIMER -if (hpet_address && image->sym_hpet_page) {Probably this patch is not required.
It seems after removing symbol "hpet_page" from vdso codeimage->sym_hpet_pagealways is NULL and this branch never executed.
Ok, so these two patches are not needed? I'll drop them from my todo-queue, thanks.
greg k-h