public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/KASLR: use the right memcpy
@ 2017-05-30  9:14 Arnd Bergmann
  2017-05-30 13:56 ` Baoquan He
  2017-05-31  9:40 ` [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation tip-bot for Arnd Bergmann
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2017-05-30  9:14 UTC (permalink / raw)
  To: Ingo Molnar, x86
  Cc: Arnd Bergmann, H. Peter Anvin, Thomas Gleixner, Kees Cook,
	Baoquan He, Thomas Garnier, Dave Jiang, linux-kernel

The decompressor has its own implementation of the string functions,
but has to include the right header to get those, while implicitly
including linux/string.h may result in a link error:

arch/x86/boot/compressed/kaslr.o: In function `choose_random_location':
kaslr.c:(.text+0xf51): undefined reference to `_mmx_memcpy'

This has appeared now as kaslr started using memcpy. Other files in the
decompressor already do the same thing.

Fixes: d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/boot/compressed/kaslr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index e0eba12bffe7..fe318b44f7b8 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -30,6 +30,7 @@
 
 #include "misc.h"
 #include "error.h"
+#include "../string.h"
 
 #include <generated/compile.h>
 #include <linux/module.h>
-- 
2.9.0

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

* Re: [PATCH] x86/KASLR: use the right memcpy
  2017-05-30  9:14 [PATCH] x86/KASLR: use the right memcpy Arnd Bergmann
@ 2017-05-30 13:56 ` Baoquan He
  2017-05-30 14:24   ` Arnd Bergmann
  2017-05-31  9:40 ` [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation tip-bot for Arnd Bergmann
  1 sibling, 1 reply; 5+ messages in thread
From: Baoquan He @ 2017-05-30 13:56 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ingo Molnar, x86, H. Peter Anvin, Thomas Gleixner, Kees Cook,
	Thomas Garnier, Dave Jiang, linux-kernel

On 05/30/17 at 11:14am, Arnd Bergmann wrote:
> The decompressor has its own implementation of the string functions,
> but has to include the right header to get those, while implicitly
> including linux/string.h may result in a link error:
> 
> arch/x86/boot/compressed/kaslr.o: In function `choose_random_location':
> kaslr.c:(.text+0xf51): undefined reference to `_mmx_memcpy'
> 
> This has appeared now as kaslr started using memcpy. Other files in the
> decompressor already do the same thing.
> 
> Fixes: d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for this fix, Arnd!

The linking error didn't happen when I tested the patch of d52e7d5a952c.
Could you tell in what condition it will be triggered? Not sure if I
should wait for this fix being merged and do a back porting, or can
defer it if it's not risky.

Thanks
Baoquan

> ---
>  arch/x86/boot/compressed/kaslr.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index e0eba12bffe7..fe318b44f7b8 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -30,6 +30,7 @@
>  
>  #include "misc.h"
>  #include "error.h"
> +#include "../string.h"
>  
>  #include <generated/compile.h>
>  #include <linux/module.h>
> -- 
> 2.9.0
> 

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

* Re: [PATCH] x86/KASLR: use the right memcpy
  2017-05-30 13:56 ` Baoquan He
@ 2017-05-30 14:24   ` Arnd Bergmann
  2017-05-31  1:43     ` Baoquan He
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2017-05-30 14:24 UTC (permalink / raw)
  To: Baoquan He
  Cc: Ingo Molnar, the arch/x86 maintainers, H. Peter Anvin,
	Thomas Gleixner, Kees Cook, Thomas Garnier, Dave Jiang,
	Linux Kernel Mailing List

On Tue, May 30, 2017 at 3:56 PM, Baoquan He <bhe@redhat.com> wrote:
> On 05/30/17 at 11:14am, Arnd Bergmann wrote:
>> The decompressor has its own implementation of the string functions,
>> but has to include the right header to get those, while implicitly
>> including linux/string.h may result in a link error:
>>
>> arch/x86/boot/compressed/kaslr.o: In function `choose_random_location':
>> kaslr.c:(.text+0xf51): undefined reference to `_mmx_memcpy'
>>
>> This has appeared now as kaslr started using memcpy. Other files in the
>> decompressor already do the same thing.
>>
>> Fixes: d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks for this fix, Arnd!
>
> The linking error didn't happen when I tested the patch of d52e7d5a952c.
> Could you tell in what condition it will be triggered? Not sure if I
> should wait for this fix being merged and do a back porting, or can
> defer it if it's not risky.

It only happens on 32-bit kernels with CONFIG_X86_USE_3DNOW, maybe
there are additional requirements.

       Arnd

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

* Re: [PATCH] x86/KASLR: use the right memcpy
  2017-05-30 14:24   ` Arnd Bergmann
@ 2017-05-31  1:43     ` Baoquan He
  0 siblings, 0 replies; 5+ messages in thread
From: Baoquan He @ 2017-05-31  1:43 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ingo Molnar, the arch/x86 maintainers, H. Peter Anvin,
	Thomas Gleixner, Kees Cook, Thomas Garnier, Dave Jiang,
	Linux Kernel Mailing List

On 05/30/17 at 04:24pm, Arnd Bergmann wrote:
> On Tue, May 30, 2017 at 3:56 PM, Baoquan He <bhe@redhat.com> wrote:
> > On 05/30/17 at 11:14am, Arnd Bergmann wrote:
> >> The decompressor has its own implementation of the string functions,
> >> but has to include the right header to get those, while implicitly
> >> including linux/string.h may result in a link error:
> >>
> >> arch/x86/boot/compressed/kaslr.o: In function `choose_random_location':
> >> kaslr.c:(.text+0xf51): undefined reference to `_mmx_memcpy'
> >>
> >> This has appeared now as kaslr started using memcpy. Other files in the
> >> decompressor already do the same thing.
> >>
> >> Fixes: d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Thanks for this fix, Arnd!
> >
> > The linking error didn't happen when I tested the patch of d52e7d5a952c.
> > Could you tell in what condition it will be triggered? Not sure if I
> > should wait for this fix being merged and do a back porting, or can
> > defer it if it's not risky.
> 
> It only happens on 32-bit kernels with CONFIG_X86_USE_3DNOW, maybe
> there are additional requirements.

Checked code again, in commit d52e7d5a952c "#include "../boot.h" is
removed. Not sure if that removal caused the 32-bit kernel link error.
While I didn't see boot/string.h is included into the boot/boot.h.

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

* [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation
  2017-05-30  9:14 [PATCH] x86/KASLR: use the right memcpy Arnd Bergmann
  2017-05-30 13:56 ` Baoquan He
@ 2017-05-31  9:40 ` tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Arnd Bergmann @ 2017-05-31  9:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, keescook, tglx, thgarnie, torvalds, mingo, arnd,
	peterz, hpa, bhe, dave.jiang

Commit-ID:  5b8b9cf76add98e19ff8ceb4247c2920687591a0
Gitweb:     http://git.kernel.org/tip/5b8b9cf76add98e19ff8ceb4247c2920687591a0
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Tue, 30 May 2017 11:14:17 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 31 May 2017 07:59:45 +0200

x86/KASLR: Use the right memcpy() implementation

The decompressor has its own implementation of the string functions,
but has to include the right header to get those, while implicitly
including linux/string.h may result in a link error:

  arch/x86/boot/compressed/kaslr.o: In function `choose_random_location':
  kaslr.c:(.text+0xf51): undefined reference to `_mmx_memcpy'

This has appeared now as KASLR started using memcpy(), via:

	d52e7d5a952c ("x86/KASLR: Parse all 'memmap=' boot option entries")

Other files in the decompressor already do the same thing.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170530091446.1000183-1-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/boot/compressed/kaslr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index e0eba12..fe318b4 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -30,6 +30,7 @@
 
 #include "misc.h"
 #include "error.h"
+#include "../string.h"
 
 #include <generated/compile.h>
 #include <linux/module.h>

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

end of thread, other threads:[~2017-05-31  9:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-30  9:14 [PATCH] x86/KASLR: use the right memcpy Arnd Bergmann
2017-05-30 13:56 ` Baoquan He
2017-05-30 14:24   ` Arnd Bergmann
2017-05-31  1:43     ` Baoquan He
2017-05-31  9:40 ` [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation tip-bot for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox