[Bug 3629] Building with Clang-17 fails due to -fzero-call-used-regs

2023-11-20 Thread bugzilla-daemon
https://bugzilla.mindrot.org/show_bug.cgi?id=3629

--- Comment #9 from David Bohman  ---
I cherry-picked 2a19e02 ff220d4 99a2df5 on top of V_9_5_P1, and it does
build successfully on my system.

Are there security implications associated with not using this flag?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
___
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs


[Bug 3629] Building with Clang-17 fails due to -fzero-call-used-regs

2023-11-20 Thread bugzilla-daemon
https://bugzilla.mindrot.org/show_bug.cgi?id=3629

--- Comment #8 from Darren Tucker  ---
Sigh.  Looks like clang is not the only compiler to have problems with
this flag: gcc 11 on mips and mipsel (at least on OpenWRT, not sure if
it's specific to that or not) also does:

cc -g -O2 -pipe -Wno-error=format-truncation -Wall -Wpointer-arith
-Wuninitialized -Wsign-compare -Wformat-security
-Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result
-Wimplicit-fallthrough -Wmisleading-indentation -fno-strict-aliasing
-D_FORTIFY_SOURCE=2 -ftrapv -fzero-call-used-regs=used
-fno-builtin-memset -fstack-protector-strong   -fPIC -I. -I.. -I.
-I./..  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE
-D_GNU_SOURCE -DHAVE_CONFIG_H -c arc4random_uniform.c
during RTL pass: final
arc4random_uniform.c: In function 'arc4random_uniform':
arc4random_uniform.c:63:1: internal compiler error: in
mips_output_move, at config/mips/mips.c:5327
   63 | }
  | ^
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
{standard input}: Assembler messages:
{standard input}: Warning: missing .end at end of assembly
{standard input}: Error: open CFI at the end of file; missing
.cfi_endproc directive

$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/mipsel-openwrt-linux-musl/11.2.0/lto-wrapper
Target: mipsel-openwrt-linux-musl
Configured with:
/builder/shared-workdir/build/sdk/build_dir/target-mipsel_24kc_musl/gcc-11.2.0/configure
--target=mipsel-openwrt-linux --host=mipsel-openwrt-linux
--build=x86_64-pc-linux-gnu --program-prefix= --program-suffix=
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share
--localstatedir=/var --mandir=/usr/man --infodir=/usr/info
--disable-nls 'CXXFLAGS_FOR_TARGET=-g -O2
-D_GLIBCXX_INCLUDE_NEXT_C_HEADERS' --build=x86_64-pc-linux-gnu
--host=mipsel-openwrt-linux-musl --target=mipsel-openwrt-linux-musl
--enable-languages=c,c++ --with-bugurl=https://dev.openwrt.org/
--with-pkgversion='OpenWrt GCC 11.2.0' --enable-shared
--disable-__cxa_atexit --with-default-libstdcxx-abi=gcc4-compatible
--enable-target-optspace --with-gnu-ld --disable-nls
--disable-libsanitizer --disable-libvtv --disable-libcilkrts
--disable-libmudflap --disable-libmpx --disable-multilib
--disable-libgomp --disable-libquadmath --disable-libssp
--disable-decimal-float --disable-libstdcxx-pch
--with-host-libstdcxx=-lstdc++ --prefix=/usr --libexecdir=/usr/lib
--with-local-prefix=/usr --with-stage1-ldflags=-lstdc++
--with-float=soft
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (OpenWrt GCC 11.2.0) 

We can reduce this to a fairly minimal testcase:

$ cat conftest.c 
unsigned int
arc4random_uniform(unsigned int upper_bound)
{
return arc4random() % upper_bound;
}

$ cc -O -fzero-call-used-regs=used -c conftest.c 
conftest.c: In function 'arc4random_uniform':
conftest.c:4:16: warning: implicit declaration of function 'arc4random'
[-Wimplicit-function-declaration]
4 | return arc4random() % upper_bound;
  |^~
during RTL pass: final
conftest.c:5:1: internal compiler error: in mips_output_move, at
config/mips/mips.c:5327
5 | }
  | ^

Prior to my change, the AC_COMPILE_IFELSE test in
OSSH_CHECK_CFLAG_COMPILE was sufficient to catch the problem with
-fzero-call-used-regs=all, but does not catch it with
-fzero-call-used-regs=used.  Expanding the testcase  in
OSSH_CHECK_CFLAG_COMPILE does seem to help:

-void f(int n) {}
+int f(int n) {return rand() % n;}

-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
___
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs


[Bug 3628] tracking bug for openssh-9.6

2023-11-20 Thread bugzilla-daemon
https://bugzilla.mindrot.org/show_bug.cgi?id=3628

Darren Tucker  changed:

   What|Removed |Added

 Depends on||3629


Referenced Bugs:

https://bugzilla.mindrot.org/show_bug.cgi?id=3629
[Bug 3629] Building with Clang-17 fails due to -fzero-call-used-regs
-- 
You are receiving this mail because:
You are watching the reporter of the bug.
You are watching the assignee of the bug.
___
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs


[Bug 3628] tracking bug for openssh-9.6

2023-11-20 Thread bugzilla-daemon
https://bugzilla.mindrot.org/show_bug.cgi?id=3628
Bug 3628 depends on bug 3629, which changed state.

Bug 3629 Summary: Building with Clang-17 fails due to -fzero-call-used-regs
https://bugzilla.mindrot.org/show_bug.cgi?id=3629

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are watching the reporter of the bug.
You are watching the assignee of the bug.
___
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs


[Bug 3629] Building with Clang-17 fails due to -fzero-call-used-regs

2023-11-20 Thread bugzilla-daemon
https://bugzilla.mindrot.org/show_bug.cgi?id=3629

Darren Tucker  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED
 Blocks||3628

--- Comment #7 from Darren Tucker  ---
OK,
https://github.com/openssh/openssh-portable/commit/ff220d4010717f7bfbbc02a2400666fb9d24f250
stops using -fzero-call-used-regs on all Apple clang versions.  Please
reopen if this does not solve your problem.

We can allowlist specific versions that are know to work if people
report those.


Referenced Bugs:

https://bugzilla.mindrot.org/show_bug.cgi?id=3628
[Bug 3628] tracking bug for openssh-9.6
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
___
openssh-bugs mailing list
openssh-bugs@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-bugs