Bug 14651

Summary: OpenSSH 8.9p1 compiler error under ARM
Product: buildroot Reporter: mf
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: buildroot, shaforostoff
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: Buildroot config file
openssh-8.9p1 config.log

Description mf 2022-03-09 09:58:14 UTC
9-March-2022 from git master
ARM little endian
gcc-11.2
kernel aspberrypi,linux,0b54dbda3cca2beb51e236a25738784e90853b64

compiling error openssh 8.9.p1

-fzero-call-used-regs is not supported on this target 


ssherr.c: In Funktion »ssh_err«:
ssherr.c:151:1: nicht implementiert: »-fzero-call-used-regs« wird auf diesem Ziel nicht unterstützt
  151 | }
      | ^
Comment 1 Peter Seiderer 2022-03-09 21:44:20 UTC
(In reply to mf from comment #0)

- from build/openssh-8.9p1/ChangeLog:

 2692 commit 39f2111b1d5f00206446257377dcce58cc72369f
 2693 Author: Darren Tucker <dtucker@dtucker.net>
 2694 Date:   Wed Sep 29 10:53:55 2021 +1000
 2695 
 2696     Add new compiler hardening flags.
 2697     
 2698     Add -fzero-call-used-regs and -ftrivial-auto-var-init to the list of
 2699     compiler hardening flags that configure checks for.  These are support      ed
 2700     by clang and gcc, and make ROP gadgets less useful and mitigate
 2701     stack-based infoleaks respectively.  ok djm@


- from openssh-8.9p1/configure.ac:

 195         OSSH_CHECK_CFLAG_COMPILE([-fzero-call-used-regs=all])


- from build/openssh-8.9p1/config.log:

  716 configure:6832: checking if .../host/bin/arm-buildroot-linux-gnueabihf-gcc supports compile flag       -fzero-call-used-regs=all
  717 configure:6865: .../hos      t/bin/arm-buildroot-linux-gnueabihf-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFIL      E64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1 -pipe -Wno-      error=format-truncation -Wall -Wextra -Wpointer-arith -Wuninitialized -Wsi      gn-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign       -Wno-unused-parameter -Wno-unused-result -Wimplicit-fallthrough -Wmisleadi      ng-indentation -fno-strict-aliasing -ftrapv -Werror -fzero-call-used-regs=      all -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conft      est.c >&5
  718 arm-buildroot-linux-gnueabihf-gcc.br_real: error: unrecognized command-lin      e option '-fzero-call-used-regs=all'
[...]
  766 configure:6878: result: no


So 'zero-call-used-regs' not supported (gcc-10.3, raspberrypi0w_defconfig) is detected correctly here...

Same test with  gcc-11.2, from build/openssh-8.9p1/config.log:

configure:6832: checking if .../host/bin/arm-buildroot-linux-gnueabihf-gcc supports compile flag -fzero-call-used-regs=all
configure:6865: .../host/bin/arm-buildroot-linux-gnueabihf-gcc -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os -g0 -D_FORTIFY_SOURCE=1 -pipe -Wno-error=format-truncation -Wall -Wextra -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-parameter -Wno-unused-result -Wimplicit-fallthrough -Wmisleading-indentation -fno-strict-aliasing -ftrapv -Werror -fzero-call-used-regs=all -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
configure:6865: $? = 0
configure:6873: result: yes


Which compiler do you use? For which target do you compile?

Can you provide a failing .config/defconfig file?
Comment 2 mf 2022-03-10 09:19:21 UTC
Created attachment 9236 [details]
Buildroot config file

Sample buildroot config file.
Comment 3 mf 2022-03-10 09:22:04 UTC
Created attachment 9241 [details]
openssh-8.9p1 config.log
Comment 4 Peter Seiderer 2022-03-10 20:23:52 UTC
Suggested buildroot patch [1] should fix the problem, thanks for reporting the problem and providing the config file!

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20220310202126.8379-1-ps.report@gmx.net/