qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
@ 2023-11-28 14:36 Cole Robinson
  2024-01-03 12:44 ` Daniel P. Berrangé
  0 siblings, 1 reply; 4+ messages in thread
From: Cole Robinson @ 2023-11-28 14:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Cole Robinson

binutils 2.39 shows some warnings when building pvh.img

/usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
/usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
/usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions

The latter of which is fatal on Fedora rawhide for some reason.

Add linker options to suppress the errors

Signed-off-by: Cole Robinson <crobinso@redhat.com>
---
 pc-bios/optionrom/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 30d07026c7..f54ed39b54 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -36,7 +36,7 @@ config-cc.mak: Makefile
 	    $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
 -include config-cc.mak
 
-override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
+override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds -Wl,--no-warn-rwx-segments -Wl,--no-warn-execstack
 
 pvh.img: pvh.o pvh_main.o
 



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

* Re: [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
  2023-11-28 14:36 [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide Cole Robinson
@ 2024-01-03 12:44 ` Daniel P. Berrangé
  2024-01-03 15:44   ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel P. Berrangé @ 2024-01-03 12:44 UTC (permalink / raw)
  To: Cole Robinson; +Cc: qemu-devel, Gerd Hoffmann, Stefano Garzarella

On Tue, Nov 28, 2023 at 09:36:47AM -0500, Cole Robinson wrote:
> binutils 2.39 shows some warnings when building pvh.img
> 
> /usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
> /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
> /usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions
> 
> The latter of which is fatal on Fedora rawhide for some reason.
> 
> Add linker options to suppress the errors

This makes it silent, but I guess someone needs to confirm that this
option ROM code genuinely does NOT need to have executable stack,
otherwise the future change that is being warned about could impact
it ?

> 
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
>  pc-bios/optionrom/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
> index 30d07026c7..f54ed39b54 100644
> --- a/pc-bios/optionrom/Makefile
> +++ b/pc-bios/optionrom/Makefile
> @@ -36,7 +36,7 @@ config-cc.mak: Makefile
>  	    $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
>  -include config-cc.mak
>  
> -override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds
> +override LDFLAGS = -nostdlib -Wl,--build-id=none,-T,$(SRC_DIR)/flat.lds -Wl,--no-warn-rwx-segments -Wl,--no-warn-execstack
>  
>  pvh.img: pvh.o pvh_main.o
>  
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: Re: [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
  2024-01-03 12:44 ` Daniel P. Berrangé
@ 2024-01-03 15:44   ` Gerd Hoffmann
  2024-01-21 22:18     ` Cole Robinson
  0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2024-01-03 15:44 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: Cole Robinson, qemu-devel, Stefano Garzarella

On Wed, Jan 03, 2024 at 12:44:39PM +0000, Daniel P. Berrangé wrote:
> On Tue, Nov 28, 2023 at 09:36:47AM -0500, Cole Robinson wrote:
> > binutils 2.39 shows some warnings when building pvh.img
> > 
> > /usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
> > /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
> > /usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions
> > 
> > The latter of which is fatal on Fedora rawhide for some reason.
> > 
> > Add linker options to suppress the errors
> 
> This makes it silent, but I guess someone needs to confirm that this
> option ROM code genuinely does NOT need to have executable stack,
> otherwise the future change that is being warned about could impact
> it ?

Skimming the code it does not look like it depends on a execute-able
stack.  Beside that the option rom will be loaded as raw binary by
seabios and run without paging.  There is nothing which could actually
setup and enforce an NX stack ...

Acked-by: Gerd Hoffmann <kraxel@redhat.com>

take care,
  Gerd



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

* Re: [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide
  2024-01-03 15:44   ` Gerd Hoffmann
@ 2024-01-21 22:18     ` Cole Robinson
  0 siblings, 0 replies; 4+ messages in thread
From: Cole Robinson @ 2024-01-21 22:18 UTC (permalink / raw)
  To: Gerd Hoffmann, Daniel P. Berrangé; +Cc: qemu-devel, Stefano Garzarella

On 1/3/24 10:44 AM, Gerd Hoffmann wrote:
> On Wed, Jan 03, 2024 at 12:44:39PM +0000, Daniel P. Berrangé wrote:
>> On Tue, Nov 28, 2023 at 09:36:47AM -0500, Cole Robinson wrote:
>>> binutils 2.39 shows some warnings when building pvh.img
>>>
>>> /usr/bin/ld: warning: pvh.o: missing .note.GNU-stack section implies executable stack
>>> /usr/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
>>> /usr/bin/ld: warning: pvh.img has a LOAD segment with RWX permissions
>>>
>>> The latter of which is fatal on Fedora rawhide for some reason.
>>>
>>> Add linker options to suppress the errors
>>
>> This makes it silent, but I guess someone needs to confirm that this
>> option ROM code genuinely does NOT need to have executable stack,
>> otherwise the future change that is being warned about could impact
>> it ?
> 
> Skimming the code it does not look like it depends on a execute-able
> stack.  Beside that the option rom will be loaded as raw binary by
> seabios and run without paging.  There is nothing which could actually
> setup and enforce an NX stack ...
> 
> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
> 

I just realized this breaks the build on centos 9 with binutils
2.35.2-42.el9

make[1]: Leaving directory
'/builddir/build/BUILD/qemu-8.2.0/qemu_kvm_build/pc-bios/optionrom'
make[1]: Entering directory
'/builddir/build/BUILD/qemu-8.2.0/qemu_kvm_build/pc-bios/optionrom'
gcc -O2 -g -march=i486 -Wall -m32 -m16 -ffreestanding
-I/builddir/build/BUILD/qemu-8.2.0/include -fcf-protection=none -fno-pie
-no-pie -fno-stack-protector -Wno-array-bounds -nostdlib
-Wl,--build-id=none,-T,/builddir/build/BUILD/qemu-8.2.0/pc-bios/optionrom/flat.lds
-Wl,--no-warn-rwx-segments -Wl,--no-warn-execstack -s -o multiboot.img
multiboot.o
/usr/bin/ld: unrecognized option '--no-warn-rwx-segments'
/usr/bin/ld: use the --help option for usage information

This article has tips about how to fix these issues in the linker
scripts, so maybe that's the better approach:

https://www.redhat.com/en/blog/linkers-warnings-about-executable-stacks-and-segments

Thanks,
Cole



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

end of thread, other threads:[~2024-01-21 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28 14:36 [PATCH] pc-bios/optionrom: Fix pvh.img ld build failure on fedora rawhide Cole Robinson
2024-01-03 12:44 ` Daniel P. Berrangé
2024-01-03 15:44   ` Gerd Hoffmann
2024-01-21 22:18     ` Cole Robinson

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