linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] symbol : Make the size of the compile-related array fixed
       [not found] <TY2PR02MB3709103991CF81E89C8F1E37CB4C9@TY2PR02MB3709.apcprd02.prod.outlook.com>
@ 2021-04-16  6:08 ` Christophe Leroy
  2021-04-16  6:12   ` Christophe Leroy
  2021-04-16  6:19 ` Daniel Axtens
  1 sibling, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2021-04-16  6:08 UTC (permalink / raw)
  To: 韩大鹏(Han Dapeng),
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Masahiro Yamada, Michal Marek, Mike Rapoport,
	Pekka Enberg, Andrew Morton, Arseny Solokha, Arvind Sankar,
	Kees Cook, Joerg Roedel, Christian Brauner, Kirill Tkhai,
	linuxppc-dev, linux-kernel, linux-s390, linux-kbuild
  Cc: 陈安庆(Anqing)

Hi,

This mail is unreadable.

Please send your patch as raw text mail, not as attached file.

Thanks
Christophe

Le 16/04/2021 à 05:12, 韩大鹏(Han Dapeng) a écrit :
> ----------------------------------------------------------------------------------------------------
> *OPPO*
> *
> *
> 本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在 
> 未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。
> 
> This e-mail and its attachments contain confidential information from OPPO, which is intended only 
> for the person or entity whose address is listed above. Any use of the information contained herein 
> in any way (including, but not limited to, total or partial disclosure, reproduction, or 
> dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this 
> e-mail in error, please notify the sender by phone or email immediately and delete it!
> 

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

* Re: [PATCH] symbol : Make the size of the compile-related array fixed
  2021-04-16  6:08 ` [PATCH] symbol : Make the size of the compile-related array fixed Christophe Leroy
@ 2021-04-16  6:12   ` Christophe Leroy
  2021-04-16  6:25     ` 答复: " 韩大鹏(Han Dapeng)
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2021-04-16  6:12 UTC (permalink / raw)
  To: 韩大鹏(Han Dapeng),
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Masahiro Yamada, Michal Marek, Mike Rapoport,
	Pekka Enberg, Andrew Morton, Arseny Solokha, Arvind Sankar,
	Kees Cook, Joerg Roedel, Christian Brauner, Kirill Tkhai,
	linuxppc-dev, linux-kernel, linux-s390, linux-kbuild
  Cc: 陈安庆(Anqing)

Also, the following statement which appears at the end of your mail is puzzling. What can we do with 
your patch if there are such limitations ?

This e-mail and its attachments contain confidential information from OPPO, which is intended only 
for the person or entity whose address is listed above. Any use of the information contained herein 
in any way (including, but not limited to, total or partial disclosure, reproduction, or 
dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and delete it!



Le 16/04/2021 à 08:08, Christophe Leroy a écrit :
> Hi,
> 
> This mail is unreadable.
> 
> Please send your patch as raw text mail, not as attached file.
> 
> Thanks
> Christophe
> 
> Le 16/04/2021 à 05:12, 韩大鹏(Han Dapeng) a écrit :
>> ----------------------------------------------------------------------------------------------------
>> *OPPO*
>> *
>> *
>> 本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人 
>> 在 未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其 
>> 附件。
>>
>> This e-mail and its attachments contain confidential information from OPPO, which is intended only 
>> for the person or entity whose address is listed above. Any use of the information contained 
>> herein in any way (including, but not limited to, total or partial disclosure, reproduction, or 
>> dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this 
>> e-mail in error, please notify the sender by phone or email immediately and delete it!
>>

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

* Re: [PATCH] symbol : Make the size of the compile-related array fixed
       [not found] <TY2PR02MB3709103991CF81E89C8F1E37CB4C9@TY2PR02MB3709.apcprd02.prod.outlook.com>
  2021-04-16  6:08 ` [PATCH] symbol : Make the size of the compile-related array fixed Christophe Leroy
@ 2021-04-16  6:19 ` Daniel Axtens
  2021-04-16  6:34   ` 答复: " 韩大鹏(Han Dapeng)
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Axtens @ 2021-04-16  6:19 UTC (permalink / raw)
  To: 韩大鹏(Han Dapeng),
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Heiko Carstens, Vasily Gorbik, Christian Borntraeger,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Masahiro Yamada, Michal Marek, Mike Rapoport,
	Pekka Enberg, Andrew Morton, Arseny Solokha,
	韩大鹏(Han Dapeng),
	Arvind Sankar, Kees Cook, Joerg Roedel, Christian Brauner,
	Kirill Tkhai, linuxppc-dev, linux-kernel, linux-s390,
	linux-kbuild
  Cc: 陈安庆(Anqing)

Hi,

Thanks for your contribution to the kernel!

I notice that your patch is sumbitted as an attachment. In future,
please could you submit your patch inline, rather than as an attachment?
See https://www.kernel.org/doc/html/v4.15/process/5.Posting.html
I'd recommend you use git send-email if possible: see e.g.
https://www.kernel.org/doc/html/v4.15/process/email-clients.html

> Subject: [PATCH] symbol : Make the size of the compile-related array fixed
>
> For the same code, the machine's user name, hostname, or compilation time
> may cause the kernel symbol address to be inconsistent, which is not
> friendly to some symbol-dependent software, such as Crash.

If I understand correctly, this patch makes it easier to recompile the
kernel from the same source but at a different time or on a different
machine or with a different user, but still get the same symbols.
Is that right?

I wonder if there are other reproducible build techniques that might be
simpler to apply? There is a kernel documentation page at
https://www.kernel.org/doc/html/latest/kbuild/reproducible-builds.html
which gives exisiting techniques to override the date, user and host.
Would they be sufficient to address your use case?

Kind regards,
Daniel

>
> Signed-off-by: Han Dapeng <handapeng@oppo.com>
> ---
>  arch/powerpc/mm/nohash/kaslr_booke.c | 2 +-
>  arch/s390/boot/version.c             | 2 +-
>  arch/x86/boot/compressed/kaslr.c     | 2 +-
>  arch/x86/boot/version.c              | 2 +-
>  init/version.c                       | 4 ++--
>  scripts/mkcompile_h                  | 2 ++
>  6 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
> index 4c74e8a5482b..494ef408e60c 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -37,7 +37,7 @@ struct regions {
>  };
>  
>  /* Simplified build-specific string for starting entropy. */
> -static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
> +static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
>  
>  struct regions __initdata regions;
> diff --git a/arch/s390/boot/version.c b/arch/s390/boot/version.c
> index d32e58bdda6a..627416a27d74 100644
> --- a/arch/s390/boot/version.c
> +++ b/arch/s390/boot/version.c
> @@ -3,5 +3,5 @@
>  #include <generated/compile.h>
>  #include "boot.h"
>  
> -const char kernel_version[] = UTS_RELEASE
> +const char kernel_version[COMPILE_STR_MAX] = UTS_RELEASE
>  	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " UTS_VERSION;
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index b92fffbe761f..7b72b518a4c8 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -43,7 +43,7 @@
>  extern unsigned long get_cmd_line_ptr(void);
>  
>  /* Simplified build-specific string for starting entropy. */
> -static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
> +static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
>  
>  static unsigned long rotate_xor(unsigned long hash, const void *area,
> diff --git a/arch/x86/boot/version.c b/arch/x86/boot/version.c
> index a1aaaf6c06a6..08feaa2d7a10 100644
> --- a/arch/x86/boot/version.c
> +++ b/arch/x86/boot/version.c
> @@ -14,6 +14,6 @@
>  #include <generated/utsrelease.h>
>  #include <generated/compile.h>
>  
> -const char kernel_version[] =
> +const char kernel_version[COMPILE_STR_MAX] =
>  	UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
>  	UTS_VERSION;
> diff --git a/init/version.c b/init/version.c
> index 92afc782b043..adfc9e91b56b 100644
> --- a/init/version.c
> +++ b/init/version.c
> @@ -35,11 +35,11 @@ struct uts_namespace init_uts_ns = {
>  EXPORT_SYMBOL_GPL(init_uts_ns);
>  
>  /* FIXED STRINGS! Don't touch! */
> -const char linux_banner[] =
> +const char linux_banner[COMPILE_STR_MAX] =
>  	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
>  
> -const char linux_proc_banner[] =
> +const char linux_proc_banner[COMPILE_STR_MAX] =
>  	"%s version %s"
>  	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
>  	" (" LINUX_COMPILER ") %s\n";
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
> index 4ae735039daf..02b9d9d54da9 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -65,6 +65,8 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
>    LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
>  		      | sed 's/[[:space:]]*$//')
>    printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
> +
> +  echo \#define COMPILE_STR_MAX 512
>  } > .tmpcompile
>  
>  # Only replace the real compile.h if the new one is different,
> -- 
> 2.27.0

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

* 答复: [PATCH] symbol : Make the size of the compile-related array fixed
  2021-04-16  6:12   ` Christophe Leroy
@ 2021-04-16  6:25     ` 韩大鹏(Han Dapeng)
  0 siblings, 0 replies; 5+ messages in thread
From: 韩大鹏(Han Dapeng) @ 2021-04-16  6:25 UTC (permalink / raw)
  To: Christophe Leroy, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Masahiro Yamada,
	Michal Marek, Mike Rapoport, Pekka Enberg, Andrew Morton,
	Arseny Solokha, Arvind Sankar, Kees Cook, Joerg Roedel,
	Christian Brauner, Kirill Tkhai, linuxppc-dev, linux-kernel,
	linux-s390, linux-kbuild
  Cc: 陈安庆(Anqing)

The raw text is shown below:
====================================================================
From 540e6a6c36e6372d4f99eeb4a50c8eaa6d7989b3 Mon Sep 17 00:00:00 2001
From: Han Dapeng <handapeng@oppo.com>
Date: Fri, 16 Apr 2021 10:36:38 +0800
Subject: [PATCH] symbol : Make the size of the compile-related array fixed

For the same code, the machine's user name, hostname, or compilation time
may cause the kernel symbol address to be inconsistent, which is not
friendly to some symbol-dependent software, such as Crash.

Signed-off-by: Han Dapeng <handapeng@oppo.com>
---
 arch/powerpc/mm/nohash/kaslr_booke.c | 2 +-
 arch/s390/boot/version.c             | 2 +-
 arch/x86/boot/compressed/kaslr.c     | 2 +-
 arch/x86/boot/version.c              | 2 +-
 init/version.c                       | 4 ++--
 scripts/mkcompile_h                  | 2 ++
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
index 4c74e8a5482b..494ef408e60c 100644
--- a/arch/powerpc/mm/nohash/kaslr_booke.c
+++ b/arch/powerpc/mm/nohash/kaslr_booke.c
@@ -37,7 +37,7 @@ struct regions {
 };
 
 /* Simplified build-specific string for starting entropy. */
-static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
 
 struct regions __initdata regions;
diff --git a/arch/s390/boot/version.c b/arch/s390/boot/version.c
index d32e58bdda6a..627416a27d74 100644
--- a/arch/s390/boot/version.c
+++ b/arch/s390/boot/version.c
@@ -3,5 +3,5 @@
 #include <generated/compile.h>
 #include "boot.h"
 
-const char kernel_version[] = UTS_RELEASE
+const char kernel_version[COMPILE_STR_MAX] = UTS_RELEASE
 	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " UTS_VERSION;
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index b92fffbe761f..7b72b518a4c8 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -43,7 +43,7 @@
 extern unsigned long get_cmd_line_ptr(void);
 
 /* Simplified build-specific string for starting entropy. */
-static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
 
 static unsigned long rotate_xor(unsigned long hash, const void *area,
diff --git a/arch/x86/boot/version.c b/arch/x86/boot/version.c
index a1aaaf6c06a6..08feaa2d7a10 100644
--- a/arch/x86/boot/version.c
+++ b/arch/x86/boot/version.c
@@ -14,6 +14,6 @@
 #include <generated/utsrelease.h>
 #include <generated/compile.h>
 
-const char kernel_version[] =
+const char kernel_version[COMPILE_STR_MAX] =
 	UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
 	UTS_VERSION;
diff --git a/init/version.c b/init/version.c
index 92afc782b043..adfc9e91b56b 100644
--- a/init/version.c
+++ b/init/version.c
@@ -35,11 +35,11 @@ struct uts_namespace init_uts_ns = {
 EXPORT_SYMBOL_GPL(init_uts_ns);
 
 /* FIXED STRINGS! Don't touch! */
-const char linux_banner[] =
+const char linux_banner[COMPILE_STR_MAX] =
 	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
 
-const char linux_proc_banner[] =
+const char linux_proc_banner[COMPILE_STR_MAX] =
 	"%s version %s"
 	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
 	" (" LINUX_COMPILER ") %s\n";
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 4ae735039daf..02b9d9d54da9 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -65,6 +65,8 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
   LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
 		      | sed 's/[[:space:]]*$//')
   printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
+
+  echo \#define COMPILE_STR_MAX 512
 } > .tmpcompile
 
 # Only replace the real compile.h if the new one is different,
-- 
2.27.0

=====================================================================================
This statement is automatically attached to our company's mail client.
Our company encourages giving code back to the community, no problem, I will take responsibility for this.

Thank you!

-----邮件原件-----
发件人: Christophe Leroy <christophe.leroy@csgroup.eu> 
发送时间: 2021年4月16日 14:13
收件人: 韩大鹏(Han Dapeng) <handapeng@oppo.com>; Michael Ellerman <mpe@ellerman.id.au>; Benjamin Herrenschmidt <benh@kernel.crashing.org>; Paul Mackerras <paulus@samba.org>; Heiko Carstens <hca@linux.ibm.com>; Vasily Gorbik <gor@linux.ibm.com>; Christian Borntraeger <borntraeger@de.ibm.com>; Thomas Gleixner <tglx@linutronix.de>; Ingo Molnar <mingo@redhat.com>; Borislav Petkov <bp@alien8.de>; x86@kernel.org; H. Peter Anvin <hpa@zytor.com>; Masahiro Yamada <masahiroy@kernel.org>; Michal Marek <michal.lkml@markovi.net>; Mike Rapoport <rppt@kernel.org>; Pekka Enberg <penberg@kernel.org>; Andrew Morton <akpm@linux-foundation.org>; Arseny Solokha <asolokha@kb.kras.ru>; Arvind Sankar <nivedita@alum.mit.edu>; Kees Cook <keescook@chromium.org>; Joerg Roedel <jroedel@suse.de>; Christian Brauner <christian.brauner@ubuntu.com>; Kirill Tkhai <ktkhai@virtuozzo.com>; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; linux-s390@vger.kernel.org; linux-kbuild@vger.kernel.org
抄送: 陈安庆(Anqing) <chenanqing@oppo.com>
主题: Re: [PATCH] symbol : Make the size of the compile-related array fixed

Also, the following statement which appears at the end of your mail is puzzling. What can we do with your patch if there are such limitations ?

This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!



Le 16/04/2021 à 08:08, Christophe Leroy a écrit :
> Hi,
> 
> This mail is unreadable.
> 
> Please send your patch as raw text mail, not as attached file.
> 
> Thanks
> Christophe
> 
> Le 16/04/2021 à 05:12, 韩大鹏(Han Dapeng) a écrit :
>> ---------------------------------------------------------------------
>> -------------------------------
>> *OPPO*
>> *
>> *
>> 本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人
>> 在 未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其
>> 附件。
>>
>> This e-mail and its attachments contain confidential information from 
>> OPPO, which is intended only for the person or entity whose address 
>> is listed above. Any use of the information contained herein in any 
>> way (including, but not limited to, total or partial disclosure, 
>> reproduction, or
>> dissemination) by persons other than the intended recipient(s) is 
>> prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!
>>

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

* 答复: [PATCH] symbol : Make the size of the compile-related array fixed
  2021-04-16  6:19 ` Daniel Axtens
@ 2021-04-16  6:34   ` 韩大鹏(Han Dapeng)
  0 siblings, 0 replies; 5+ messages in thread
From: 韩大鹏(Han Dapeng) @ 2021-04-16  6:34 UTC (permalink / raw)
  To: Daniel Axtens, Michael Ellerman, Benjamin Herrenschmidt,
	Paul Mackerras, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, x86, H. Peter Anvin, Masahiro Yamada,
	Michal Marek, Mike Rapoport, Pekka Enberg, Andrew Morton,
	Arseny Solokha, Arvind Sankar, Kees Cook, Joerg Roedel,
	Christian Brauner, Kirill Tkhai, linuxppc-dev, linux-kernel,
	linux-s390, linux-kbuild
  Cc: 陈安庆(Anqing)

Thank you!Got it.
I tried to use Git, but it didn't work.
I'll do it next time.

-----邮件原件-----
发件人: Daniel Axtens <dja@axtens.net>
发送时间: 2021年4月16日 14:19
收件人: 韩大鹏(Han Dapeng) <handapeng@oppo.com>; Michael Ellerman <mpe@ellerman.id.au>; Benjamin Herrenschmidt <benh@kernel.crashing.org>; Paul Mackerras <paulus@samba.org>; Heiko Carstens <hca@linux.ibm.com>; Vasily Gorbik <gor@linux.ibm.com>; Christian Borntraeger <borntraeger@de.ibm.com>; Thomas Gleixner <tglx@linutronix.de>; Ingo Molnar <mingo@redhat.com>; Borislav Petkov <bp@alien8.de>; x86@kernel.org; H. Peter Anvin <hpa@zytor.com>; Masahiro Yamada <masahiroy@kernel.org>; Michal Marek <michal.lkml@markovi.net>; Mike Rapoport <rppt@kernel.org>; Pekka Enberg <penberg@kernel.org>; Andrew Morton <akpm@linux-foundation.org>; Arseny Solokha <asolokha@kb.kras.ru>; 韩大鹏(Han Dapeng) <handapeng@oppo.com>; Arvind Sankar <nivedita@alum.mit.edu>; Kees Cook <keescook@chromium.org>; Joerg Roedel <jroedel@suse.de>; Christian Brauner <christian.brauner@ubuntu.com>; Kirill Tkhai <ktkhai@virtuozzo.com>; linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; linux-s390@vger.kernel.org; linux-kbuild@vger.kernel.org
抄送: 陈安庆(Anqing) <chenanqing@oppo.com>
主题: Re: [PATCH] symbol : Make the size of the compile-related array fixed

Hi,

Thanks for your contribution to the kernel!

I notice that your patch is sumbitted as an attachment. In future, please could you submit your patch inline, rather than as an attachment?
See https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kernel.org%2Fdoc%2Fhtml%2Fv4.15%2Fprocess%2F5.Posting.html&amp;data=04%7C01%7Chandapeng%40oppo.com%7Cd00adeb268d34207f5bb08d9009f98b2%7Cf1905eb1c35341c5951662b4a54b5ee6%7C0%7C0%7C637541508341234090%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=8Sncu0Yyqvv3AtEZiL73vexVEpwmxmwrUjJ124ez%2BPs%3D&amp;reserved=0
I'd recommend you use git send-email if possible: see e.g.
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kernel.org%2Fdoc%2Fhtml%2Fv4.15%2Fprocess%2Femail-clients.html&amp;data=04%7C01%7Chandapeng%40oppo.com%7Cd00adeb268d34207f5bb08d9009f98b2%7Cf1905eb1c35341c5951662b4a54b5ee6%7C0%7C0%7C637541508341234090%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=Ny2BFB4AE05nHHqITJkixtOwfPrB8s1KboWVLTFVXF8%3D&amp;reserved=0

> Subject: [PATCH] symbol : Make the size of the compile-related array
> fixed
>
> For the same code, the machine's user name, hostname, or compilation
> time may cause the kernel symbol address to be inconsistent, which is
> not friendly to some symbol-dependent software, such as Crash.

If I understand correctly, this patch makes it easier to recompile the kernel from the same source but at a different time or on a different machine or with a different user, but still get the same symbols.
Is that right?

I wonder if there are other reproducible build techniques that might be simpler to apply? There is a kernel documentation page at
https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.kernel.org%2Fdoc%2Fhtml%2Flatest%2Fkbuild%2Freproducible-builds.html&amp;data=04%7C01%7Chandapeng%40oppo.com%7Cd00adeb268d34207f5bb08d9009f98b2%7Cf1905eb1c35341c5951662b4a54b5ee6%7C0%7C0%7C637541508341234090%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=s54GLV2Pue3ArPgX4OcEyhAGsanJyBy1LRESkVMOGts%3D&amp;reserved=0
which gives exisiting techniques to override the date, user and host.
Would they be sufficient to address your use case?

Kind regards,
Daniel

>
> Signed-off-by: Han Dapeng <handapeng@oppo.com>
> ---
>  arch/powerpc/mm/nohash/kaslr_booke.c | 2 +-
>  arch/s390/boot/version.c             | 2 +-
>  arch/x86/boot/compressed/kaslr.c     | 2 +-
>  arch/x86/boot/version.c              | 2 +-
>  init/version.c                       | 4 ++--
>  scripts/mkcompile_h                  | 2 ++
>  6 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/arch/powerpc/mm/nohash/kaslr_booke.c
> b/arch/powerpc/mm/nohash/kaslr_booke.c
> index 4c74e8a5482b..494ef408e60c 100644
> --- a/arch/powerpc/mm/nohash/kaslr_booke.c
> +++ b/arch/powerpc/mm/nohash/kaslr_booke.c
> @@ -37,7 +37,7 @@ struct regions {
>  };
>
>  /* Simplified build-specific string for starting entropy. */ -static
> const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
> +static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
>
>  struct regions __initdata regions;
> diff --git a/arch/s390/boot/version.c b/arch/s390/boot/version.c index
> d32e58bdda6a..627416a27d74 100644
> --- a/arch/s390/boot/version.c
> +++ b/arch/s390/boot/version.c
> @@ -3,5 +3,5 @@
>  #include <generated/compile.h>
>  #include "boot.h"
>
> -const char kernel_version[] = UTS_RELEASE
> +const char kernel_version[COMPILE_STR_MAX] = UTS_RELEASE
>  " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") " UTS_VERSION; diff
> --git a/arch/x86/boot/compressed/kaslr.c
> b/arch/x86/boot/compressed/kaslr.c
> index b92fffbe761f..7b72b518a4c8 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -43,7 +43,7 @@
>  extern unsigned long get_cmd_line_ptr(void);
>
>  /* Simplified build-specific string for starting entropy. */ -static
> const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
> +static const char build_str[COMPILE_STR_MAX] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
>
>  static unsigned long rotate_xor(unsigned long hash, const void *area,
> diff --git a/arch/x86/boot/version.c b/arch/x86/boot/version.c index
> a1aaaf6c06a6..08feaa2d7a10 100644
> --- a/arch/x86/boot/version.c
> +++ b/arch/x86/boot/version.c
> @@ -14,6 +14,6 @@
>  #include <generated/utsrelease.h>
>  #include <generated/compile.h>
>
> -const char kernel_version[] =
> +const char kernel_version[COMPILE_STR_MAX] =
>  UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
>  UTS_VERSION;
> diff --git a/init/version.c b/init/version.c index
> 92afc782b043..adfc9e91b56b 100644
> --- a/init/version.c
> +++ b/init/version.c
> @@ -35,11 +35,11 @@ struct uts_namespace init_uts_ns = {
> EXPORT_SYMBOL_GPL(init_uts_ns);
>
>  /* FIXED STRINGS! Don't touch! */
> -const char linux_banner[] =
> +const char linux_banner[COMPILE_STR_MAX] =
>  "Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
>  LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
>
> -const char linux_proc_banner[] =
> +const char linux_proc_banner[COMPILE_STR_MAX] =
>  "%s version %s"
>  " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
>  " (" LINUX_COMPILER ") %s\n";
> diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index
> 4ae735039daf..02b9d9d54da9 100755
> --- a/scripts/mkcompile_h
> +++ b/scripts/mkcompile_h
> @@ -65,6 +65,8 @@ UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
>    LD_VERSION=$($LD -v | head -n1 | sed 's/(compatible with [^)]*)//' \
>        | sed 's/[[:space:]]*$//')
>    printf '#define LINUX_COMPILER "%s"\n' "$CC_VERSION, $LD_VERSION"
> +
> +  echo \#define COMPILE_STR_MAX 512
>  } > .tmpcompile
>
>  # Only replace the real compile.h if the new one is different,
> --
> 2.27.0
________________________________
OPPO

本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。

This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

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

end of thread, other threads:[~2021-04-16  6:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <TY2PR02MB3709103991CF81E89C8F1E37CB4C9@TY2PR02MB3709.apcprd02.prod.outlook.com>
2021-04-16  6:08 ` [PATCH] symbol : Make the size of the compile-related array fixed Christophe Leroy
2021-04-16  6:12   ` Christophe Leroy
2021-04-16  6:25     ` 答复: " 韩大鹏(Han Dapeng)
2021-04-16  6:19 ` Daniel Axtens
2021-04-16  6:34   ` 答复: " 韩大鹏(Han Dapeng)

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