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


Groups > linux.kernel > #1653003 > unrolled thread

[PATCH] x86/KASLR: use the right memcpy

Started byArnd Bergmann <arnd@arndb.de>
First post2017-05-30 11:20 +0200
Last post2017-05-31 11:50 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/KASLR: use the right memcpy Arnd Bergmann <arnd@arndb.de> - 2017-05-30 11:20 +0200
    Re: [PATCH] x86/KASLR: use the right memcpy Baoquan He <bhe@redhat.com> - 2017-05-30 16:00 +0200
      Re: [PATCH] x86/KASLR: use the right memcpy Arnd Bergmann <arnd@arndb.de> - 2017-05-30 16:30 +0200
        Re: [PATCH] x86/KASLR: use the right memcpy Baoquan He <bhe@redhat.com> - 2017-05-31 03:50 +0200
    [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation tip-bot for Arnd Bergmann <tipbot@zytor.com> - 2017-05-31 11:50 +0200

#1653003 — [PATCH] x86/KASLR: use the right memcpy

FromArnd Bergmann <arnd@arndb.de>
Date2017-05-30 11:20 +0200
Subject[PATCH] x86/KASLR: use the right memcpy
Message-ID<tMLtN-5qE-39@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1653252

FromBaoquan He <bhe@redhat.com>
Date2017-05-30 16:00 +0200
Message-ID<tMPQJ-861-1@gated-at.bofh.it>
In reply to#1653003
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
> 

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


#1653278

FromArnd Bergmann <arnd@arndb.de>
Date2017-05-30 16:30 +0200
Message-ID<tMQjN-8vK-25@gated-at.bofh.it>
In reply to#1653252
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

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


#1653767

FromBaoquan He <bhe@redhat.com>
Date2017-05-31 03:50 +0200
Message-ID<tN0VP-6xv-5@gated-at.bofh.it>
In reply to#1653278
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.

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


#1654064 — [tip:x86/boot] x86/KASLR: Use the right memcpy() implementation

Fromtip-bot for Arnd Bergmann <tipbot@zytor.com>
Date2017-05-31 11:50 +0200
Subject[tip:x86/boot] x86/KASLR: Use the right memcpy() implementation
Message-ID<tN8ql-31c-11@gated-at.bofh.it>
In reply to#1653003
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>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web