linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] x86/vdso: Remove remnants of the fake section table
@ 2018-12-04 16:17 Sean Christopherson
  2018-12-04 16:17 ` [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation Sean Christopherson
  2018-12-04 16:17 ` [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script Sean Christopherson
  0 siblings, 2 replies; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 16:17 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel, Andy Lutomirski

Remove pieces of the vDSO's fake section table mechanism that were left
behind when the vDSO build process reverted to using "objdump -S" to
strip the userspace image.

One of the removed pieces is a 0x340 byte reservation (for 64-bit) in
the .rodata section.  Trimming that fat drops the current image's size
to under 4k, i.e. reduces the effective size of the userspace vDSO
mapping by a full page.

Sean Christopherson (2):
  x86/vdso: Remove obsolete "fake section table" reservation
  x86/vdso: Remove a stale/misleading comment from the linker script

 arch/x86/entry/vdso/vdso-layout.lds.S | 27 ---------------------------
 arch/x86/entry/vdso/vdso2c.c          |  6 ------
 2 files changed, 33 deletions(-)

-- 
2.19.2


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

* [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 16:17 [PATCH 0/2] x86/vdso: Remove remnants of the fake section table Sean Christopherson
@ 2018-12-04 16:17 ` Sean Christopherson
  2018-12-04 18:22   ` Sean Christopherson
  2018-12-04 16:17 ` [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script Sean Christopherson
  1 sibling, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 16:17 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel, Andy Lutomirski

At one point the vDSO image was manually stripped down by vdso2c in an
attempt to minimize the size of the image mapped into userspace.  Part
of that stripping process involved building a fake section table so as
not to break userspace processes that parse the section table.  Memory
for the fake section table was reserved in the .rodata section so that
vdso2c could simply copy the entire PT_LOAD segment into the userspace
image after building the fake table.

Eventually, the entire fake section table approach was dropped in favor
of stripping the vdso "the old fashioned way", i.e. via objdump -S.
But, the reservation in .rodata for the fake table was left behind.
Remove the reserveration along with a few other related defines and
section entries.

Removing the fake section table placeholder zaps a whopping 0x340 bytes
from the 64-bit vDSO image, which drops the current image's size to
under 4k, i.e. reduces the effective size of the userspace vDSO mapping
by a full page.

Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/entry/vdso/vdso-layout.lds.S | 22 ----------------------
 arch/x86/entry/vdso/vdso2c.c          |  6 ------
 2 files changed, 28 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso-layout.lds.S b/arch/x86/entry/vdso/vdso-layout.lds.S
index acfd5ba7d943..0cedc905c8d6 100644
--- a/arch/x86/entry/vdso/vdso-layout.lds.S
+++ b/arch/x86/entry/vdso/vdso-layout.lds.S
@@ -7,16 +7,6 @@
  * This script controls its layout.
  */
 
-#if defined(BUILD_VDSO64)
-# define SHDR_SIZE 64
-#elif defined(BUILD_VDSO32) || defined(BUILD_VDSOX32)
-# define SHDR_SIZE 40
-#else
-# error unknown VDSO target
-#endif
-
-#define NUM_FAKE_SHDRS 13
-
 SECTIONS
 {
 	/*
@@ -60,20 +50,8 @@ SECTIONS
 		*(.bss*)
 		*(.dynbss*)
 		*(.gnu.linkonce.b.*)
-
-		/*
-		 * Ideally this would live in a C file, but that won't
-		 * work cleanly for x32 until we start building the x32
-		 * C code using an x32 toolchain.
-		 */
-		VDSO_FAKE_SECTION_TABLE_START = .;
-		. = . + NUM_FAKE_SHDRS * SHDR_SIZE;
-		VDSO_FAKE_SECTION_TABLE_END = .;
 	}						:text
 
-	.fake_shstrtab	: { *(.fake_shstrtab) }		:text
-
-
 	.note		: { *(.note.*) }		:text	:note
 
 	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
index 4674f58581a1..2479a454b15c 100644
--- a/arch/x86/entry/vdso/vdso2c.c
+++ b/arch/x86/entry/vdso/vdso2c.c
@@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
 	[sym_hpet_page] = {"hpet_page", true},
 	[sym_pvclock_page] = {"pvclock_page", true},
 	[sym_hvclock_page] = {"hvclock_page", true},
-	[sym_VDSO_FAKE_SECTION_TABLE_START] = {
-		"VDSO_FAKE_SECTION_TABLE_START", false
-	},
-	[sym_VDSO_FAKE_SECTION_TABLE_END] = {
-		"VDSO_FAKE_SECTION_TABLE_END", false
-	},
 	{"VDSO32_NOTE_MASK", true},
 	{"__kernel_vsyscall", true},
 	{"__kernel_sigreturn", true},
-- 
2.19.2


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

* [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script
  2018-12-04 16:17 [PATCH 0/2] x86/vdso: Remove remnants of the fake section table Sean Christopherson
  2018-12-04 16:17 ` [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation Sean Christopherson
@ 2018-12-04 16:17 ` Sean Christopherson
  2018-12-04 18:59   ` Andy Lutomirski
  1 sibling, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 16:17 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel, Andy Lutomirski

Once upon a time, vdso2c aggressively stripped data from the vDSO
image when generating the final userspace image.  This included
stripping the .altinstructions and .altinstr_replacement sections.
Eventually, the stripping process reverted to "objdump -S" and no
longer removed the aforementioned sections, but the comment remained.

Keeping the .alt* sections at the end of the PT_LOAD segment is no
longer necessary, but there's no harm in doing so and it's a helpful
reminder that they don't need to be included in the final vDSO image,
i.e. someone may want to take another stab at zapping/stripping the
unneeded sections.

Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 arch/x86/entry/vdso/vdso-layout.lds.S | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/entry/vdso/vdso-layout.lds.S b/arch/x86/entry/vdso/vdso-layout.lds.S
index 0cedc905c8d6..93c6dc7812d0 100644
--- a/arch/x86/entry/vdso/vdso-layout.lds.S
+++ b/arch/x86/entry/vdso/vdso-layout.lds.S
@@ -65,11 +65,6 @@ SECTIONS
 
 	.text		: { *(.text*) }			:text	=0x90909090,
 
-	/*
-	 * At the end so that eu-elflint stays happy when vdso2c strips
-	 * these.  A better implementation would avoid allocating space
-	 * for these.
-	 */
 	.altinstructions	: { *(.altinstructions) }	:text
 	.altinstr_replacement	: { *(.altinstr_replacement) }	:text
 
-- 
2.19.2


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

* Re: [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 16:17 ` [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation Sean Christopherson
@ 2018-12-04 18:22   ` Sean Christopherson
  2018-12-04 18:29     ` Sean Christopherson
  0 siblings, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 18:22 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel, Andy Lutomirski

On Tue, Dec 04, 2018 at 08:17:40AM -0800, Sean Christopherson wrote:
> At one point the vDSO image was manually stripped down by vdso2c in an
> attempt to minimize the size of the image mapped into userspace.  Part
> of that stripping process involved building a fake section table so as
> not to break userspace processes that parse the section table.  Memory
> for the fake section table was reserved in the .rodata section so that
> vdso2c could simply copy the entire PT_LOAD segment into the userspace
> image after building the fake table.
> 
> Eventually, the entire fake section table approach was dropped in favor
> of stripping the vdso "the old fashioned way", i.e. via objdump -S.
> But, the reservation in .rodata for the fake table was left behind.
> Remove the reserveration along with a few other related defines and
> section entries.
> 
> Removing the fake section table placeholder zaps a whopping 0x340 bytes
> from the 64-bit vDSO image, which drops the current image's size to
> under 4k, i.e. reduces the effective size of the userspace vDSO mapping
> by a full page.
> 
> Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
> Cc: Andy Lutomirski <luto@amacapital.net>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
> diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
> index 4674f58581a1..2479a454b15c 100644
> --- a/arch/x86/entry/vdso/vdso2c.c
> +++ b/arch/x86/entry/vdso/vdso2c.c
> @@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
>  	[sym_hpet_page] = {"hpet_page", true},
>  	[sym_pvclock_page] = {"pvclock_page", true},
>  	[sym_hvclock_page] = {"hvclock_page", true},
> -	[sym_VDSO_FAKE_SECTION_TABLE_START] = {
> -		"VDSO_FAKE_SECTION_TABLE_START", false
> -	},
> -	[sym_VDSO_FAKE_SECTION_TABLE_END] = {
> -		"VDSO_FAKE_SECTION_TABLE_END", false
> -	},

Doh, I missed removing the definitions for sym_VDSO_FAKE_SECTION_TABLE_*.

>  	{"VDSO32_NOTE_MASK", true},
>  	{"__kernel_vsyscall", true},
>  	{"__kernel_sigreturn", true},
> -- 
> 2.19.2
> 

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

* Re: [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 18:22   ` Sean Christopherson
@ 2018-12-04 18:29     ` Sean Christopherson
  2018-12-04 18:58       ` Andy Lutomirski
  0 siblings, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 18:29 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86
  Cc: H. Peter Anvin, linux-kernel, Andy Lutomirski

On Tue, Dec 04, 2018 at 10:22:39AM -0800, Sean Christopherson wrote:
> On Tue, Dec 04, 2018 at 08:17:40AM -0800, Sean Christopherson wrote:
> > At one point the vDSO image was manually stripped down by vdso2c in an
> > attempt to minimize the size of the image mapped into userspace.  Part
> > of that stripping process involved building a fake section table so as
> > not to break userspace processes that parse the section table.  Memory
> > for the fake section table was reserved in the .rodata section so that
> > vdso2c could simply copy the entire PT_LOAD segment into the userspace
> > image after building the fake table.
> > 
> > Eventually, the entire fake section table approach was dropped in favor
> > of stripping the vdso "the old fashioned way", i.e. via objdump -S.
> > But, the reservation in .rodata for the fake table was left behind.
> > Remove the reserveration along with a few other related defines and
> > section entries.
> > 
> > Removing the fake section table placeholder zaps a whopping 0x340 bytes
> > from the 64-bit vDSO image, which drops the current image's size to
> > under 4k, i.e. reduces the effective size of the userspace vDSO mapping
> > by a full page.
> > 
> > Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
> > Cc: Andy Lutomirski <luto@amacapital.net>
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > ---
> > diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
> > index 4674f58581a1..2479a454b15c 100644
> > --- a/arch/x86/entry/vdso/vdso2c.c
> > +++ b/arch/x86/entry/vdso/vdso2c.c
> > @@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
> >  	[sym_hpet_page] = {"hpet_page", true},
> >  	[sym_pvclock_page] = {"pvclock_page", true},
> >  	[sym_hvclock_page] = {"hvclock_page", true},
> > -	[sym_VDSO_FAKE_SECTION_TABLE_START] = {
> > -		"VDSO_FAKE_SECTION_TABLE_START", false
> > -	},
> > -	[sym_VDSO_FAKE_SECTION_TABLE_END] = {
> > -		"VDSO_FAKE_SECTION_TABLE_END", false
> > -	},
> 
> Doh, I missed removing the definitions for sym_VDSO_FAKE_SECTION_TABLE_*.

And with sym_VDSO_FAKE_SECTION_TABLE_* gone all symbols are exported,
meaning required_syms can be a char* array and struct vdso_sym can be
removed.

> >  	{"VDSO32_NOTE_MASK", true},
> >  	{"__kernel_vsyscall", true},
> >  	{"__kernel_sigreturn", true},
> > -- 
> > 2.19.2
> > 

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

* Re: [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 18:29     ` Sean Christopherson
@ 2018-12-04 18:58       ` Andy Lutomirski
  2018-12-04 19:28         ` Sean Christopherson
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Lutomirski @ 2018-12-04 18:58 UTC (permalink / raw)
  To: Christopherson, Sean J
  Cc: Andrew Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	X86 ML, H. Peter Anvin, LKML

On Tue, Dec 4, 2018 at 10:29 AM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> On Tue, Dec 04, 2018 at 10:22:39AM -0800, Sean Christopherson wrote:
> > On Tue, Dec 04, 2018 at 08:17:40AM -0800, Sean Christopherson wrote:
> > > At one point the vDSO image was manually stripped down by vdso2c in an
> > > attempt to minimize the size of the image mapped into userspace.  Part
> > > of that stripping process involved building a fake section table so as
> > > not to break userspace processes that parse the section table.  Memory
> > > for the fake section table was reserved in the .rodata section so that
> > > vdso2c could simply copy the entire PT_LOAD segment into the userspace
> > > image after building the fake table.
> > >
> > > Eventually, the entire fake section table approach was dropped in favor
> > > of stripping the vdso "the old fashioned way", i.e. via objdump -S.
> > > But, the reservation in .rodata for the fake table was left behind.
> > > Remove the reserveration along with a few other related defines and
> > > section entries.
> > >
> > > Removing the fake section table placeholder zaps a whopping 0x340 bytes
> > > from the 64-bit vDSO image, which drops the current image's size to
> > > under 4k, i.e. reduces the effective size of the userspace vDSO mapping
> > > by a full page.
> > >
> > > Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
> > > Cc: Andy Lutomirski <luto@amacapital.net>
> > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > ---
> > > diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
> > > index 4674f58581a1..2479a454b15c 100644
> > > --- a/arch/x86/entry/vdso/vdso2c.c
> > > +++ b/arch/x86/entry/vdso/vdso2c.c
> > > @@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
> > >     [sym_hpet_page] = {"hpet_page", true},
> > >     [sym_pvclock_page] = {"pvclock_page", true},
> > >     [sym_hvclock_page] = {"hvclock_page", true},
> > > -   [sym_VDSO_FAKE_SECTION_TABLE_START] = {
> > > -           "VDSO_FAKE_SECTION_TABLE_START", false
> > > -   },
> > > -   [sym_VDSO_FAKE_SECTION_TABLE_END] = {
> > > -           "VDSO_FAKE_SECTION_TABLE_END", false
> > > -   },
> >
> > Doh, I missed removing the definitions for sym_VDSO_FAKE_SECTION_TABLE_*.
>
> And with sym_VDSO_FAKE_SECTION_TABLE_* gone all symbols are exported,
> meaning required_syms can be a char* array and struct vdso_sym can be
> removed.

I bet that we'll want that field to parse out the extable entries once
all the dust settles, though.

--Andy

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

* Re: [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script
  2018-12-04 16:17 ` [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script Sean Christopherson
@ 2018-12-04 18:59   ` Andy Lutomirski
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Lutomirski @ 2018-12-04 18:59 UTC (permalink / raw)
  To: Christopherson, Sean J
  Cc: Andrew Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	X86 ML, H. Peter Anvin, LKML

On Tue, Dec 4, 2018 at 8:17 AM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> Once upon a time, vdso2c aggressively stripped data from the vDSO
> image when generating the final userspace image.  This included
> stripping the .altinstructions and .altinstr_replacement sections.
> Eventually, the stripping process reverted to "objdump -S" and no
> longer removed the aforementioned sections, but the comment remained.
>
> Keeping the .alt* sections at the end of the PT_LOAD segment is no
> longer necessary, but there's no harm in doing so and it's a helpful
> reminder that they don't need to be included in the final vDSO image,
> i.e. someone may want to take another stab at zapping/stripping the
> unneeded sections.

Acked-by: Andy Lutomirski <luto@kernel.org>

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

* Re: [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 18:58       ` Andy Lutomirski
@ 2018-12-04 19:28         ` Sean Christopherson
  2018-12-04 19:46           ` Andy Lutomirski
  0 siblings, 1 reply; 9+ messages in thread
From: Sean Christopherson @ 2018-12-04 19:28 UTC (permalink / raw)
  To: Andy Lutomirski
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, X86 ML,
	H. Peter Anvin, LKML

On Tue, Dec 04, 2018 at 10:58:51AM -0800, Andy Lutomirski wrote:
> On Tue, Dec 4, 2018 at 10:29 AM Sean Christopherson
> <sean.j.christopherson@intel.com> wrote:
> >
> > On Tue, Dec 04, 2018 at 10:22:39AM -0800, Sean Christopherson wrote:
> > > On Tue, Dec 04, 2018 at 08:17:40AM -0800, Sean Christopherson wrote:
> > > > At one point the vDSO image was manually stripped down by vdso2c in an
> > > > attempt to minimize the size of the image mapped into userspace.  Part
> > > > of that stripping process involved building a fake section table so as
> > > > not to break userspace processes that parse the section table.  Memory
> > > > for the fake section table was reserved in the .rodata section so that
> > > > vdso2c could simply copy the entire PT_LOAD segment into the userspace
> > > > image after building the fake table.
> > > >
> > > > Eventually, the entire fake section table approach was dropped in favor
> > > > of stripping the vdso "the old fashioned way", i.e. via objdump -S.
> > > > But, the reservation in .rodata for the fake table was left behind.
> > > > Remove the reserveration along with a few other related defines and
> > > > section entries.
> > > >
> > > > Removing the fake section table placeholder zaps a whopping 0x340 bytes
> > > > from the 64-bit vDSO image, which drops the current image's size to
> > > > under 4k, i.e. reduces the effective size of the userspace vDSO mapping
> > > > by a full page.
> > > >
> > > > Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
> > > > Cc: Andy Lutomirski <luto@amacapital.net>
> > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > ---
> > > > diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
> > > > index 4674f58581a1..2479a454b15c 100644
> > > > --- a/arch/x86/entry/vdso/vdso2c.c
> > > > +++ b/arch/x86/entry/vdso/vdso2c.c
> > > > @@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
> > > >     [sym_hpet_page] = {"hpet_page", true},
> > > >     [sym_pvclock_page] = {"pvclock_page", true},
> > > >     [sym_hvclock_page] = {"hvclock_page", true},
> > > > -   [sym_VDSO_FAKE_SECTION_TABLE_START] = {
> > > > -           "VDSO_FAKE_SECTION_TABLE_START", false
> > > > -   },
> > > > -   [sym_VDSO_FAKE_SECTION_TABLE_END] = {
> > > > -           "VDSO_FAKE_SECTION_TABLE_END", false
> > > > -   },
> > >
> > > Doh, I missed removing the definitions for sym_VDSO_FAKE_SECTION_TABLE_*.
> >
> > And with sym_VDSO_FAKE_SECTION_TABLE_* gone all symbols are exported,
> > meaning required_syms can be a char* array and struct vdso_sym can be
> > removed.
> 
> I bet that we'll want that field to parse out the extable entries once
> all the dust settles, though.

Hmm, the extable stuff will be sections, a la .altinstructions, I don't
think we'll need separate symbols.

What if I send out a RFC for the extable stuff in parallel to this series
and to the SGX series?  It'd also be nice to iterate on that code without
having to spin a full SGX series.

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

* Re: [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation
  2018-12-04 19:28         ` Sean Christopherson
@ 2018-12-04 19:46           ` Andy Lutomirski
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Lutomirski @ 2018-12-04 19:46 UTC (permalink / raw)
  To: Christopherson, Sean J
  Cc: Andrew Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	X86 ML, H. Peter Anvin, LKML

On Tue, Dec 4, 2018 at 11:28 AM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> On Tue, Dec 04, 2018 at 10:58:51AM -0800, Andy Lutomirski wrote:
> > On Tue, Dec 4, 2018 at 10:29 AM Sean Christopherson
> > <sean.j.christopherson@intel.com> wrote:
> > >
> > > On Tue, Dec 04, 2018 at 10:22:39AM -0800, Sean Christopherson wrote:
> > > > On Tue, Dec 04, 2018 at 08:17:40AM -0800, Sean Christopherson wrote:
> > > > > At one point the vDSO image was manually stripped down by vdso2c in an
> > > > > attempt to minimize the size of the image mapped into userspace.  Part
> > > > > of that stripping process involved building a fake section table so as
> > > > > not to break userspace processes that parse the section table.  Memory
> > > > > for the fake section table was reserved in the .rodata section so that
> > > > > vdso2c could simply copy the entire PT_LOAD segment into the userspace
> > > > > image after building the fake table.
> > > > >
> > > > > Eventually, the entire fake section table approach was dropped in favor
> > > > > of stripping the vdso "the old fashioned way", i.e. via objdump -S.
> > > > > But, the reservation in .rodata for the fake table was left behind.
> > > > > Remove the reserveration along with a few other related defines and
> > > > > section entries.
> > > > >
> > > > > Removing the fake section table placeholder zaps a whopping 0x340 bytes
> > > > > from the 64-bit vDSO image, which drops the current image's size to
> > > > > under 4k, i.e. reduces the effective size of the userspace vDSO mapping
> > > > > by a full page.
> > > > >
> > > > > Fixes: da861e18eccc ("x86, vdso: Get rid of the fake section mechanism")
> > > > > Cc: Andy Lutomirski <luto@amacapital.net>
> > > > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > ---
> > > > > diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c
> > > > > index 4674f58581a1..2479a454b15c 100644
> > > > > --- a/arch/x86/entry/vdso/vdso2c.c
> > > > > +++ b/arch/x86/entry/vdso/vdso2c.c
> > > > > @@ -98,12 +98,6 @@ struct vdso_sym required_syms[] = {
> > > > >     [sym_hpet_page] = {"hpet_page", true},
> > > > >     [sym_pvclock_page] = {"pvclock_page", true},
> > > > >     [sym_hvclock_page] = {"hvclock_page", true},
> > > > > -   [sym_VDSO_FAKE_SECTION_TABLE_START] = {
> > > > > -           "VDSO_FAKE_SECTION_TABLE_START", false
> > > > > -   },
> > > > > -   [sym_VDSO_FAKE_SECTION_TABLE_END] = {
> > > > > -           "VDSO_FAKE_SECTION_TABLE_END", false
> > > > > -   },
> > > >
> > > > Doh, I missed removing the definitions for sym_VDSO_FAKE_SECTION_TABLE_*.
> > >
> > > And with sym_VDSO_FAKE_SECTION_TABLE_* gone all symbols are exported,
> > > meaning required_syms can be a char* array and struct vdso_sym can be
> > > removed.
> >
> > I bet that we'll want that field to parse out the extable entries once
> > all the dust settles, though.
>
> Hmm, the extable stuff will be sections, a la .altinstructions, I don't
> think we'll need separate symbols.

In my mind, the easiest nice implementation is to have a section that
gets thrown away by objcopy --remove-section, and to have the actual
table in that section be bracketed by a pair of symbols, since vdso2c
already parses that.  But vdso2c could certainly also just find the
section direclty.  Then vdso2c could expose an list of extable entries
in the vdso_image, and that would be that.  Does that seem reasonable?

>
> What if I send out a RFC for the extable stuff in parallel to this series
> and to the SGX series?  It'd also be nice to iterate on that code without
> having to spin a full SGX series.

Sounds great!

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

end of thread, other threads:[~2018-12-04 19:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 16:17 [PATCH 0/2] x86/vdso: Remove remnants of the fake section table Sean Christopherson
2018-12-04 16:17 ` [PATCH 1/2] x86/vdso: Remove obsolete "fake section table" reservation Sean Christopherson
2018-12-04 18:22   ` Sean Christopherson
2018-12-04 18:29     ` Sean Christopherson
2018-12-04 18:58       ` Andy Lutomirski
2018-12-04 19:28         ` Sean Christopherson
2018-12-04 19:46           ` Andy Lutomirski
2018-12-04 16:17 ` [PATCH 2/2] x86/vdso: Remove a stale/misleading comment from the linker script Sean Christopherson
2018-12-04 18:59   ` Andy Lutomirski

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).