Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1314402 > unrolled thread

[PATCH 4/5] x86/alternatives: Add an auxilary section

Started byBorislav Petkov <bp@alien8.de>
First post2016-01-21 19:40 +0100
Last post2016-01-21 20:10 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/5] x86/alternatives: Add an auxilary section Borislav Petkov <bp@alien8.de> - 2016-01-21 19:40 +0100
    Re: [PATCH 4/5] x86/alternatives: Add an auxilary section Borislav Petkov <bp@alien8.de> - 2016-01-21 20:10 +0100
      Re: [PATCH 4/5] x86/alternatives: Add an auxilary section "H. Peter Anvin" <hpa@zytor.com> - 2016-01-21 20:20 +0100
    Re: [PATCH 4/5] x86/alternatives: Add an auxilary section "H. Peter Anvin" <hpa@zytor.com> - 2016-01-21 20:10 +0100

#1314402 — [PATCH 4/5] x86/alternatives: Add an auxilary section

FromBorislav Petkov <bp@alien8.de>
Date2016-01-21 19:40 +0100
Subject[PATCH 4/5] x86/alternatives: Add an auxilary section
Message-ID<qTsjg-I1-9@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

Add .altinstr_aux for additional instructions which will be used before
and/or during patching. All stuff which needs more sophisticated
patching should go there. See next patch.

Signed-off-by: Borislav Petkov <bp@suse.de>
---
 arch/x86/kernel/vmlinux.lds.S | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index 74e4bf11f562..1335ff4854ae 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -244,6 +244,15 @@ SECTIONS
 	 */
 	.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
 		*(.altinstr_replacement)
+		/*
+		 * Section for code used exclusively before alternatives are
+		 * run. All references to such code must be patched out by
+		 * alternatives, normally by using a patch with
+		 * X86_FEATURE_ALWAYS.
+		 *
+		 * See static_cpu_has() for an example.
+		 */
+		*(.altinstr_aux)
 	}
 
 	/*
-- 
2.3.5

[toc] | [next] | [standalone]


#1314427

FromBorislav Petkov <bp@alien8.de>
Date2016-01-21 20:10 +0100
Message-ID<qTsMi-19q-17@gated-at.bofh.it>
In reply to#1314402
On Thu, Jan 21, 2016 at 11:00:03AM -0800, H. Peter Anvin wrote:
> NAK on this being part of .altinstr_replacement (if anything it ought to
> simply be part of .text.init).  Otherwise fine.

You mean .init.text. Brian had it there in his original version. Out of
curiosity, why don't you want it in .altinstr_replacement? To avoid any
mixup?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

[toc] | [prev] | [next] | [standalone]


#1314436

From"H. Peter Anvin" <hpa@zytor.com>
Date2016-01-21 20:20 +0100
Message-ID<qTsVY-1dK-7@gated-at.bofh.it>
In reply to#1314427
On 01/21/16 11:07, Borislav Petkov wrote:
> On Thu, Jan 21, 2016 at 11:00:03AM -0800, H. Peter Anvin wrote:
>> NAK on this being part of .altinstr_replacement (if anything it ought to
>> simply be part of .text.init).  Otherwise fine.
> 
> You mean .init.text. Brian had it there in his original version. Out of
> curiosity, why don't you want it in .altinstr_replacement? To avoid any
> mixup?
> 

We covered that already:

.altinstr_replacement doesn't need to be +X (and shouldn't be, but
that's another patch.)

.altinstr_replacement is also "special" in that all the instructions are
offset and not run in place.  These are just plain code stubs and are
executed in place, as is.  The only reason to have a special section for
these at all is to avoid the "init code referenced from non-init-code"
warning.

	-hpa

[toc] | [prev] | [next] | [standalone]


#1314433

From"H. Peter Anvin" <hpa@zytor.com>
Date2016-01-21 20:10 +0100
Message-ID<qTsMi-19q-19@gated-at.bofh.it>
In reply to#1314402
On 01/21/16 10:34, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Add .altinstr_aux for additional instructions which will be used before
> and/or during patching. All stuff which needs more sophisticated
> patching should go there. See next patch.
> 
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  arch/x86/kernel/vmlinux.lds.S | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index 74e4bf11f562..1335ff4854ae 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -244,6 +244,15 @@ SECTIONS
>  	 */
>  	.altinstr_replacement : AT(ADDR(.altinstr_replacement) - LOAD_OFFSET) {
>  		*(.altinstr_replacement)
> +		/*
> +		 * Section for code used exclusively before alternatives are
> +		 * run. All references to such code must be patched out by
> +		 * alternatives, normally by using a patch with
> +		 * X86_FEATURE_ALWAYS.
> +		 *
> +		 * See static_cpu_has() for an example.
> +		 */
> +		*(.altinstr_aux)
>  	}

NAK on this being part of .altinstr_replacement (if anything it ought to
simply be part of .text.init).  Otherwise fine.

	-hpa

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web