stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace
@ 2019-10-23 12:07 Konstantin Khlebnikov
  2019-10-23 12:07 ` [PATCH 4.4 2/2] x86/vdso: Remove hpet_page from vDSO Konstantin Khlebnikov
  2019-10-23 13:05 ` [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
  0 siblings, 2 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2019-10-23 12:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable; +Cc: Thomas Gleixner, linux-kernel, Andy Lutomirski

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.

Fixes: d96d87834d5b ("x86/vdso: Remove direct HPET access through the vDSO") # v4.4.190
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Link: https://lore.kernel.org/lkml/6fd42b2b-e29a-1fd6-03d1-e9da9192e6c5@yandex-team.ru/
---
 arch/x86/entry/vdso/vma.c |   14 --------------
 1 file changed, 14 deletions(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 6b46648588d8..cc0a3c16a95d 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -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,


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4.4 2/2] x86/vdso: Remove hpet_page from vDSO
  2019-10-23 12:07 [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
@ 2019-10-23 12:07 ` Konstantin Khlebnikov
  2019-10-23 13:05 ` [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
  1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Khlebnikov @ 2019-10-23 12:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable; +Cc: Thomas Gleixner, linux-kernel, Andy Lutomirski

From: Jia Zhang <zhang.jia@linux.alibaba.com>

Commit 81d30225bc0c246b53270eb90b23cfbb941a186d upstream.

This trivial cleanup finalizes the removal of vDSO HPET support.

Fixes: 1ed95e52d902 ("x86/vdso: Remove direct HPET access through the vDSO")
Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: luto@kernel.org
Cc: bp@alien8.de
Link: https://lkml.kernel.org/r/20190401114045.7280-1-zhang.jia@linux.alibaba.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 arch/x86/entry/vdso/vdso2c.c |    3 ---
 arch/x86/include/asm/vdso.h  |    1 -
 2 files changed, 4 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
index 491020b2826d..6446ba489eb2 100644
--- a/arch/x86/entry/vdso/vdso2c.c
+++ b/arch/x86/entry/vdso/vdso2c.c
@@ -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
diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index deabaf9759b6..c2a1188cd0bf 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -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;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace
  2019-10-23 12:07 [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
  2019-10-23 12:07 ` [PATCH 4.4 2/2] x86/vdso: Remove hpet_page from vDSO Konstantin Khlebnikov
@ 2019-10-23 13:05 ` Konstantin Khlebnikov
  2019-10-27 13:50   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 4+ messages in thread
From: Konstantin Khlebnikov @ 2019-10-23 13:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, stable; +Cc: Thomas Gleixner, linux-kernel, Andy Lutomirski

On 23/10/2019 15.07, Konstantin Khlebnikov wrote:
> 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.
> 
> Fixes: d96d87834d5b ("x86/vdso: Remove direct HPET access through the vDSO") # v4.4.190
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> Link: https://lore.kernel.org/lkml/6fd42b2b-e29a-1fd6-03d1-e9da9192e6c5@yandex-team.ru/
> ---
>   arch/x86/entry/vdso/vma.c |   14 --------------
>   1 file changed, 14 deletions(-)
> 
> diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
> index 6b46648588d8..cc0a3c16a95d 100644
> --- a/arch/x86/entry/vdso/vma.c
> +++ b/arch/x86/entry/vdso/vma.c
> @@ -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) {

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.

> -		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,
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace
  2019-10-23 13:05 ` [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
@ 2019-10-27 13:50   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2019-10-27 13:50 UTC (permalink / raw)
  To: Konstantin Khlebnikov
  Cc: stable, Thomas Gleixner, linux-kernel, Andy Lutomirski

On Wed, Oct 23, 2019 at 04:05:47PM +0300, Konstantin Khlebnikov wrote:
> On 23/10/2019 15.07, Konstantin Khlebnikov wrote:
> > 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.
> > 
> > Fixes: d96d87834d5b ("x86/vdso: Remove direct HPET access through the vDSO") # v4.4.190
> > Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> > Link: https://lore.kernel.org/lkml/6fd42b2b-e29a-1fd6-03d1-e9da9192e6c5@yandex-team.ru/
> > ---
> >   arch/x86/entry/vdso/vma.c |   14 --------------
> >   1 file changed, 14 deletions(-)
> > 
> > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
> > index 6b46648588d8..cc0a3c16a95d 100644
> > --- a/arch/x86/entry/vdso/vma.c
> > +++ b/arch/x86/entry/vdso/vma.c
> > @@ -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) {
> 
> 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.

Ok, so these two patches are not needed?  I'll drop them from my
todo-queue, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-27 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 12:07 [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
2019-10-23 12:07 ` [PATCH 4.4 2/2] x86/vdso: Remove hpet_page from vDSO Konstantin Khlebnikov
2019-10-23 13:05 ` [PATCH 4.4 1/2] x86/vdso: Remove direct HPET mapping into userspace Konstantin Khlebnikov
2019-10-27 13:50   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).