[5.10,301/390] ARM: decompressor: Include .data.rel.ro.local

Message ID 20221024113035.833900007@linuxfoundation.org
State New
Headers
Series None |

Commit Message

Greg KH Oct. 24, 2022, 11:31 a.m. UTC
  From: Kees Cook <keescook@chromium.org>

[ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ]

The .data.rel.ro.local section has the same semantics as .data.rel.ro
here, so include it in the .rodata section of the decompressor.
Additionally since the .printk_index section isn't usable outside of
the core kernel, discard it in the decompressor. Avoids these warnings:

arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local'
arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.printk_index'

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-mm/202209080545.qMIVj7YM-lkp@intel.com
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/boot/compressed/vmlinux.lds.S | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Pavel Machek Oct. 24, 2022, 6:41 p.m. UTC | #1
Hi!

> From: Kees Cook <keescook@chromium.org>
> 
> [ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ]
> 
> The .data.rel.ro.local section has the same semantics as .data.rel.ro
> here, so include it in the .rodata section of the decompressor.
> Additionally since the .printk_index section isn't usable outside of
> the core kernel, discard it in the decompressor. Avoids these warnings:
> 
> arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local'
> arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from
> `arch/arm/boot/compressed/fdt_rw.o' being placed in section
> `.printk_index'

There's no printk_index in 5.10., so I'm not sure we should be
applying it here.

Best regards,
								Pavel
								
> +++ b/arch/arm/boot/compressed/vmlinux.lds.S
> @@ -23,6 +23,7 @@ SECTIONS
>      *(.ARM.extab*)
>      *(.note.*)
>      *(.rel.*)
> +    *(.printk_index)
>      /*
>       * Discard any r/w data - this produces a link error if we have any,
>       * which is required for PIC decompression.  Local data generates
  
Greg KH Oct. 25, 2022, 1:05 p.m. UTC | #2
On Mon, Oct 24, 2022 at 08:41:03PM +0200, Pavel Machek wrote:
> Hi!
> 
> > From: Kees Cook <keescook@chromium.org>
> > 
> > [ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ]
> > 
> > The .data.rel.ro.local section has the same semantics as .data.rel.ro
> > here, so include it in the .rodata section of the decompressor.
> > Additionally since the .printk_index section isn't usable outside of
> > the core kernel, discard it in the decompressor. Avoids these warnings:
> > 
> > arm-linux-gnueabi-ld: warning: orphan section `.data.rel.ro.local' from `arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local'
> > arm-linux-gnueabi-ld: warning: orphan section `.printk_index' from
> > `arch/arm/boot/compressed/fdt_rw.o' being placed in section
> > `.printk_index'
> 
> There's no printk_index in 5.10., so I'm not sure we should be
> applying it here.

Good point, now dropped.

greg k-h
  

Patch

diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
index 1bcb68ac4b01..3fcb3e62dc56 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.S
+++ b/arch/arm/boot/compressed/vmlinux.lds.S
@@ -23,6 +23,7 @@  SECTIONS
     *(.ARM.extab*)
     *(.note.*)
     *(.rel.*)
+    *(.printk_index)
     /*
      * Discard any r/w data - this produces a link error if we have any,
      * which is required for PIC decompression.  Local data generates
@@ -57,6 +58,7 @@  SECTIONS
     *(.rodata)
     *(.rodata.*)
     *(.data.rel.ro)
+    *(.data.rel.ro.*)
   }
   .piggydata : {
     *(.piggydata)