]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph.spec.in: cull _FORTIFY_SOURCE macro from CXXFLAGS for seastar
authorKefu Chai <kchai@redhat.com>
Thu, 23 Jul 2020 08:03:06 +0000 (16:03 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 23 Jul 2020 08:19:56 +0000 (16:19 +0800)
seastar uses setjmp() and longjmp() to implement coroutine, but
longjmp() is defined as ____longjmp_chk() by GCC if _FORTIFY_SOURC is
defined. ____longjmp_chk() simply bails out with an error message if
the dest stack pointer is higher than the src stack pointer, or the dest
stack pointer is not in the sigaltstack. in the case of seastar, the dst
%sp is not necessarily higher than src stack pointer, and it's not
handling a signal for switching the thread context. that's why we have
the "longjmp causes uninitialized stack frame" error when running
crimson-osd on RHEL/CentOS 8 using the prebuilt rpm packages.

the optflags rpm macro adds -D_FORTIFY_SOURCE=2 to CFLAGS and CXXFLAGS,
so even seastar tries to pass -U_FORTIFY_SOURCE to GCC, there is chance
that cmake append CXXFLAGS at the end of the option list passed to GCC.
and this renders seastar's attempt to undefine _FORTIFY_SOURCE useless.

another way to address this issue is to undefine this macro in
seastar:src/core/thread.cc. but since seastar tries neutralize the macro
in its cmake script instead of source file, i assume they have their
considerations. let's drop it in the rpm recipe instead.

Signed-off-by: Kefu Chai <kchai@redhat.com>
ceph.spec.in

index ea1238f1f0b3b2cf4fec9f86124c990b757ef843..4b20dc2fa194e9fdf95d240aae9ac54b8c959912 100644 (file)
@@ -1086,6 +1086,11 @@ export CFLAGS="$RPM_OPT_FLAGS"
 export CXXFLAGS="$RPM_OPT_FLAGS"
 export LDFLAGS="$RPM_LD_FLAGS"
 
+%if 0%{with seastar}
+# seastar uses longjmp() to implement coroutine. and this annoys longjmp_chk()
+export CXXFLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g')
+%endif
+
 # Parallel build settings ...
 CEPH_MFLAGS_JOBS="%{?_smp_mflags}"
 CEPH_SMP_NCPUS=$(echo "$CEPH_MFLAGS_JOBS" | sed 's/-j//')