Closed kloczek closed 10 months ago
Can you provide the following details please?
./configure
+ ./configure --bindir=/usr/bin --build=x86_64-redhat-linux --datadir=/usr/share --disable-dependency-tracking --exec-prefix=/usr --host=x86_64-redhat-linux --includedir=/usr/include --infodir=/usr/share/info --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man --prefix=/usr --program-prefix= --runstatedir=/run --sbindir=/usr/sbin --sharedstatedir=/var/lib --sysconfdir=/etc --disable-static --enable-benchmark
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether make supports the include directive... yes (GNU style)
checking for x86_64-redhat-linux-gcc... /usr/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether /usr/bin/gcc accepts -g... yes
checking for /usr/bin/gcc option to enable C11 features... none needed
checking whether /usr/bin/gcc understands -c and -o together... yes
checking dependency style of /usr/bin/gcc... none
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking build system type... x86_64-redhat-linux-gnu
checking host system type... x86_64-redhat-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by /usr/bin/gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/gcc-nm
checking the name lister (/usr/bin/gcc-nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-redhat-linux-gnu file names to x86_64-redhat-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-redhat-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for x86_64-redhat-linux-file... no
checking for file... file
checking for x86_64-redhat-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for x86_64-redhat-linux-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for x86_64-redhat-linux-ar... /usr/bin/gcc-ar
checking for archiver @FILE support... @
checking for x86_64-redhat-linux-strip... no
checking for strip... strip
checking for x86_64-redhat-linux-ranlib... /usr/bin/gcc-ranlib
checking command to parse /usr/bin/gcc-nm output from /usr/bin/gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for x86_64-redhat-linux-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /usr/bin/gcc supports -fno-rtti -fno-exceptions... no
checking for /usr/bin/gcc option to produce PIC... -fPIC -DPIC
checking if /usr/bin/gcc PIC flag -fPIC -DPIC works... yes
checking if /usr/bin/gcc static flag -static works... no
checking if /usr/bin/gcc supports -c -o file.o... yes
checking if /usr/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /usr/bin/gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for x86_64-redhat-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for UV... yes
checking for LZ4... yes
checking whether to build with code coverage support... no
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for stdio.h... (cached) yes
checking for assert.h... yes
checking for unistd.h... (cached) yes
checking for linux/io_uring.h... yes
checking for linux/aio_abi.h... yes
checking for /usr/bin/gcc options needed to detect all undeclared functions... none needed
checking whether RWF_NOWAIT is declared... yes
checking for zfs... no
checking for size_t... yes
checking for ssize_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for /usr/bin/gcc option to enable large file support... none needed
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating raft.pc
config.status: creating Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
[tkloczko@pers-jacek .build_logs]$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 48
On-line CPU(s) list: 0-47
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 12
Socket(s): 2
Stepping: 4
CPU(s) scaling MHz: 28%
CPU max MHz: 3000.0000
CPU min MHz: 800.0000
BogoMIPS: 4200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc ar
t arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid
dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 pti intel_ppin ssbd mba i
brs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap c
lflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts vnmi pku
ospke md_clear flush_l1d
Virtualization features:
Virtualization: VT-x
Caches (sum of all):
L1d: 768 KiB (24 instances)
L1i: 768 KiB (24 instances)
L2: 24 MiB (24 instances)
L3: 33 MiB (2 instances)
NUMA:
NUMA node(s): 2
NUMA node0 CPU(s): 0-11,24-35
NUMA node1 CPU(s): 12-23,36-47
Vulnerabilities:
Gather data sampling: Vulnerable: No microcode
Itlb multihit: KVM: Mitigation: VMX disabled
L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Meltdown: Mitigation; PTI
Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Retbleed: Mitigation; IBRS
Spec rstack overflow: Not affected
Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Srbds: Not affected
Tsx async abort: Mitigation; Clear CPU buffers; SMT vulnerable
Could you apply this patch:
diff --git a/src/configuration.c b/src/configuration.c
index c7782f78..1da3f5ab 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -330,13 +330,16 @@ int configurationDecode(const struct raft_buffer *buf,
cursor = buf->base;
/* Check the encoding format version */
- if (byteGet8(&cursor) != ENCODING_FORMAT) {
+ uint8_t format = byteGet8(&cursor);
+ fprintf(stderr, "ENCODING FORMAT %d\n", format);
+ if (format != ENCODING_FORMAT) {
rv = RAFT_MALFORMED;
goto err;
}
/* Read the number of servers. */
n = (size_t)byteGet64(&cursor);
+ fprintf(stderr, "N %zu\n", n);
/* Decode the individual servers. */
for (i = 0; i < n; i++) {
@@ -346,11 +349,13 @@ int configurationDecode(const struct raft_buffer *buf,
/* Server ID. */
id = byteGet64(&cursor);
+ fprintf(stderr, "ID %llu\n", id);
/* Server Address. */
address = byteGetString(
&cursor,
buf->len - (size_t)((uint8_t *)cursor - (uint8_t *)buf->base));
+ fprintf(stderr, "ADDRESS %p\n", (void *)address);
if (address == NULL) {
rv = RAFT_MALFORMED;
goto err;
@@ -360,6 +365,7 @@ int configurationDecode(const struct raft_buffer *buf,
role = byteGet8(&cursor);
rv = configurationAdd(c, id, address, role);
+ fprintf(stderr, "ADD %d\n", rv);
if (rv != 0) {
/* Only valid configurations should be ever be encoded, so in case
* configurationAdd() fails because of invalid data we return
and then run:
make test/unit/core && ./test/unit/core configurationDecode/oom --param heap-fault-delay 0 --show-stderr
?
Here is the result:
[tkloczko@pers-jacek raft-0.18.3]$ make test/unit/core && ./test/unit/core configurationDecode/oom --param heap-fault-delay 0 --show-stderr
make: 'test/unit/core' is up to date.
Running test suite with seed 0x7db5b784...
configurationDecode/oom
heap-fault-delay=0, heap-fault-repeat=1 [ ERROR ]
ENCODING FORMAT 1
N 2
ID 5
ADDRESS 0x7fff67b89231
ADD 5
Error: test/unit/test_configuration.c:588: assertion failed: configurationDecode(&buf, &f->configuration) == RAFT_NOMEM (6 == 1)
Error: child killed by signal 6 (Aborted)
0 of 1 (0%) tests successful, 0 (0%) test skipped.
Thanks, could you reset the changes from the previous patch, and apply this new patch instead?
diff --git a/src/configuration.c b/src/configuration.c
index c7782f78..f6ef45bd 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -330,13 +330,16 @@ int configurationDecode(const struct raft_buffer *buf,
cursor = buf->base;
/* Check the encoding format version */
- if (byteGet8(&cursor) != ENCODING_FORMAT) {
+ uint8_t format = byteGet8(&cursor);
+ fprintf(stderr, "ENCODING FORMAT %d\n", format);
+ if (format != ENCODING_FORMAT) {
rv = RAFT_MALFORMED;
goto err;
}
/* Read the number of servers. */
n = (size_t)byteGet64(&cursor);
+ fprintf(stderr, "N %zu\n", n);
/* Decode the individual servers. */
for (i = 0; i < n; i++) {
@@ -346,11 +349,17 @@ int configurationDecode(const struct raft_buffer *buf,
/* Server ID. */
id = byteGet64(&cursor);
+ fprintf(stderr, "ID %llu\n", id);
/* Server Address. */
address = byteGetString(
&cursor,
buf->len - (size_t)((uint8_t *)cursor - (uint8_t *)buf->base));
+ if (address != NULL) {
+ fprintf(stderr, "ADDRESS %s LEN %zu\n", address, strlen(address));
+ } else {
+ fprintf(stderr, "NULL ADDRESS\n");
+ }
if (address == NULL) {
rv = RAFT_MALFORMED;
goto err;
@@ -358,8 +367,10 @@ int configurationDecode(const struct raft_buffer *buf,
/* Role code. */
role = byteGet8(&cursor);
+ fprintf(stderr, "ROLE %d\n", role);
rv = configurationAdd(c, id, address, role);
+ fprintf(stderr, "ADD %d\n", rv);
if (rv != 0) {
/* Only valid configurations should be ever be encoded, so in case
* configurationAdd() fails because of invalid data we return
Then again run:
make test/unit/core && ./test/unit/core configurationDecode/oom --param heap-fault-delay 0 --show-stderr
The value of "ROLE" is wrong, it should be 1
, not 120
. Not sure what's going on.
New patch to apply and then re-run the test please:
diff --git a/src/configuration.c b/src/configuration.c
index c7782f78..6c4377a8 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -330,13 +330,16 @@ int configurationDecode(const struct raft_buffer *buf,
cursor = buf->base;
/* Check the encoding format version */
- if (byteGet8(&cursor) != ENCODING_FORMAT) {
+ uint8_t format = byteGet8(&cursor);
+ fprintf(stderr, "ENCODING FORMAT %d\n", format);
+ if (format != ENCODING_FORMAT) {
rv = RAFT_MALFORMED;
goto err;
}
/* Read the number of servers. */
n = (size_t)byteGet64(&cursor);
+ fprintf(stderr, "N %zu\n", n);
/* Decode the individual servers. */
for (i = 0; i < n; i++) {
@@ -346,11 +349,22 @@ int configurationDecode(const struct raft_buffer *buf,
/* Server ID. */
id = byteGet64(&cursor);
+ fprintf(stderr, "ID %llu\n", id);
/* Server Address. */
+ for (int j = 0; j < 17; j++) {
+ fprintf(stderr, "%u ", *((uint8_t *)(cursor) + j));
+ }
+ fprintf(stderr, "\n");
address = byteGetString(
&cursor,
buf->len - (size_t)((uint8_t *)cursor - (uint8_t *)buf->base));
+ fprintf(stderr, "ADDRESS %p\n", (void *)address);
+ if (address != NULL) {
+ fprintf(stderr, "ADDRESS %s LEN %zu\n", address, strlen(address));
+ } else {
+ fprintf(stderr, "NULL ADDRESS\n");
+ }
if (address == NULL) {
rv = RAFT_MALFORMED;
goto err;
@@ -358,8 +372,10 @@ int configurationDecode(const struct raft_buffer *buf,
/* Role code. */
role = byteGet8(&cursor);
+ fprintf(stderr, "ROLE %d\n", role);
rv = configurationAdd(c, id, address, role);
+ fprintf(stderr, "ADD %d\n", rv);
if (rv != 0) {
/* Only valid configurations should be ever be encoded, so in case
* configurationAdd() fails because of invalid data we return
result
[tkloczko@pers-jacek raft-0.18.3]$ make test/unit/core && ./test/unit/core configurationDecode/oom --param heap-fault-delay 0 --show-stderr
make: 'test/unit/core' is up to date.
Running test suite with seed 0x5ceace55...
configurationDecode/oom
heap-fault-delay=0, heap-fault-repeat=1 [ ERROR ]
ENCODING FORMAT 1
N 2
ID 5
120 46 121 0 1 3 0 0 0 0 0 0 0 122 46 119 0
ADDRESS 0x7ffddb024091
ADDRESS x.y LEN 3
ROLE 120
ADD 5
Error: test/unit/test_configuration.c:588: assertion failed: configurationDecode(&buf, &f->configuration) == RAFT_NOMEM (6 == 1)
Error: child killed by signal 6 (Aborted)
0 of 1 (0%) tests successful, 0 (0%) test skipped.
diff --git a/src/configuration.c b/src/configuration.c
index c7782f78..515ed14e 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -330,13 +330,16 @@ int configurationDecode(const struct raft_buffer *buf,
cursor = buf->base;
/* Check the encoding format version */
- if (byteGet8(&cursor) != ENCODING_FORMAT) {
+ uint8_t format = byteGet8(&cursor);
+ fprintf(stderr, "ENCODING FORMAT %d\n", format);
+ if (format != ENCODING_FORMAT) {
rv = RAFT_MALFORMED;
goto err;
}
/* Read the number of servers. */
n = (size_t)byteGet64(&cursor);
+ fprintf(stderr, "N %zu\n", n);
/* Decode the individual servers. */
for (i = 0; i < n; i++) {
@@ -346,11 +349,24 @@ int configurationDecode(const struct raft_buffer *buf,
/* Server ID. */
id = byteGet64(&cursor);
+ fprintf(stderr, "ID %llu\n", id);
/* Server Address. */
+ fprintf(stderr, "CURSOR %p (%d)\n", cursor, *((uint8_t *)cursor));
+ for (int j = 0; j < 17; j++) {
+ fprintf(stderr, "%u ", *((uint8_t *)(cursor) + j));
+ }
+ fprintf(stderr, "\n");
address = byteGetString(
&cursor,
buf->len - (size_t)((uint8_t *)cursor - (uint8_t *)buf->base));
+ fprintf(stderr, "ADDRESS %p\n", (void *)address);
+ fprintf(stderr, "CURSOR %p (%d)\n", cursor, *((uint8_t *)cursor));
+ if (address != NULL) {
+ fprintf(stderr, "ADDRESS %s LEN %zu\n", address, strlen(address));
+ } else {
+ fprintf(stderr, "NULL ADDRESS\n");
+ }
if (address == NULL) {
rv = RAFT_MALFORMED;
goto err;
@@ -358,8 +374,11 @@ int configurationDecode(const struct raft_buffer *buf,
/* Role code. */
role = byteGet8(&cursor);
+ fprintf(stderr, "ROLE %d\n", role);
+ fprintf(stderr, "CURSOR %p (%d)\n", cursor, *((uint8_t *)cursor));
rv = configurationAdd(c, id, address, role);
+ fprintf(stderr, "ADD %d\n", rv);
if (rv != 0) {
/* Only valid configurations should be ever be encoded, so in case
* configurationAdd() fails because of invalid data we return
result
[tkloczko@pers-jacek raft-0.18.3]$ make test/unit/core && ./test/unit/core configurationDecode/oom --param heap-fault-delay 0 --show-stderr make: 'test/unit/core' is up to date.
Running test suite with seed 0xbe756c11...
configurationDecode/oom
heap-fault-delay=0, heap-fault-repeat=1 [ OK ] [ 0.00012779 / 0.00012652 CPU ]
ENCODING FORMAT 1
N 2
ID 5
CURSOR 0x7fffe0ae38a1 (120)
120 46 121 0 1 3 0 0 0 0 0 0 0 122 46 119 0
ADDRESS 0x7fffe0ae38a1
CURSOR 0x7fffe0ae38a5 (1)
ADDRESS x.y LEN 3
ROLE 1
CURSOR 0x7fffe0ae38a6 (3)
ADD 1
1 of 1 (100%) tests successful, 0 (0%) test skipped.
Ok, that's weird, simply printing the pointer makes the failure go away. I suspect there's some compilation flag that might create the problem.
Can you please attach here the content of these files on your system:
cat /usr/lib/rpm/redhat/redhat-hardened-cc1
cat /usr/lib/rpm/redhat/redhat-annobin-cc1
?
[tkloczko@pers-jacek SPECS]$ cat /usr/lib/rpm/redhat/redhat-hardened-cc1
*cc1_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
*cpp_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
[tkloczko@pers-jacek SPECS]$ cat /usr/lib/rpm/redhat/redhat-annobin-cc1
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}
First one forces to compile all code by default as PIE.
Second one -fplugin=annobin
(which add additional ELF section with some data).
Ok, I figured it out.
For some reason your build process is not passing -fno-strict-aliasing
to GCC, although that flag is explicitly listed in configure.ac
, see here.
Please can you try:
make clean
make check CFLAGS="-fno-strict-aliasing"
?
PS: run the above make targets against a clean raft v0.18.3 source tree, without any patch applied.
I just realized that In patch which I'm using I've removed -fno-strict-aliasing
. Original intention of that patch was to remove all hardcoded warning and optimisation flags to control that options from outside of the build procedure describes in rpm spec file.
I need that kind of conditions to be able to perform additional test builds in my build infra.
If your code relies on not use aliasing that is oddest thing which I've ever seen. On scale of almost 5k packages which I have in my distro it would be FIRST such package ever.
OK I've tested and with removed that patch and test suite passes.
============================================================================
Testsuite summary for raft 0.18.3
============================================================================
# TOTAL: 5
# PASS: 5
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/raft-0.18.3'
Q: why your code relies on exact optimisation options? 🤔
I think this is accidental, the code should not rely on -fno-strict-aliasing
. I'll see if I can fix it.
If you need some set of warning flags please hardcode that options in your CI by use:
CFLAGS="<all_-W-foo_options_you_need>" \
./configure <ac_options>
make
or at least please provide autoconf option to allow drop all those options to allow generate
CC=clang
.In some control builds which I;m using I'm building with some CC=<C_code_sanitiser>
. I've not passed raft
over all those control builds but some of the hardcoded warning flags will be causing such build to fail because some of those hardcoded options would b not recognised.
In am/ac files you are hardcoding warning it three ways.
AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability foreign])
CC_CHECK_FLAGS_APPEND()
*_CFLAGS=
.All that makes really hard and/or impossible (especially with automake harcoding) to control those options from one place.
Q: in this case really on aliasing may affect installable ELF binaries or only test suite? 🤔
I you want to make your ac/am cleaner it needs to be done in few small steps to be able easy confirm that nothing is affected.
In my patch I've ignored DEBUG and SANITIZER parts as not relevant for my build.
If you want I can submit for that part part PR to move DEBUG that to only configire.ac.
Than the same way could be simplified --enable-sanitize
part.
My patch looks like exposed places affected by aliasing
[tkloczko@pers-jacek SPECS]$ rpmbuild -ba raft.spec --quiet 2>&1 | grep -- \\[-W | sed 's/.*\[//; s/\]//' | sort | uniq -c | sort -nr
4 -Wstrict-aliasing
Extracted part from stderr:
src/uv_fs.c: In function 'probeAsyncIO':
src/uv_fs.c:732:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
732 | *((void **)(&iocb.aio_buf)) = buf;
| ~^~~~~~~~~~~~~~~~~~~~~~~~~
src/uv_writer.c: In function 'uvWriterPollCb':
src/uv_writer.c:193:37: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
193 | struct UvWriterReq *req = *((void **)&event->data);
| ~^~~~~~~~~~~~~~~~~~~~~~
src/uv_writer.c: In function 'UvWriterSubmit':
src/uv_writer.c:475:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
475 | *((void **)(&req->iocb.aio_buf)) = (void *)bufs;
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/uv_writer.c:478:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
478 | *((void **)(&req->iocb.aio_data)) = (void *)req;
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you need some set of warning flags please hardcode that options in your should hardcode that in CI by use
CFLAGS="<all_-W-foo_options_you_need>" \ ./configure <ac_options> make
or at least please provide autoconf option to allow drop all those options to allow generate
- build log with minimal length
- to allow alter warning flags from outside
- I'm not sure are all those already hardcoded options will be possible use with
CC=clang
.
Note that these flags are not mandatory, just recommended: the CC_CHECK_FLAGS_APPEND
macros checks if a certain flag is available in the compiler being used (the one set with CC
), and if it's not available that flag will not be used.
All the currently recommended flags should be available with CC=clang
, FWIW. But you should be able to use other compilers just fine (e.g. CC=tcc
).
As I said, -fno-strict-aliasing
is currently not only recommended, but necessary. That's a bug that I have to fixed.
In some control builds which I;m using I'm building with some
CC=<C_code_sanitiser>
. I've not passedraft
over all those control builds but some of the hardcoded warning flags will be causing such build to fail because some of those hardcoded options would b not recognised.In am/ac files you are hardcoding warning it three ways.
- in ac
AM_INIT_AUTOMAKE([subdir-objects -Wall -Wno-portability foreign])
- in ac
CC_CHECK_FLAGS_APPEND()
- in am in some
*_CFLAGS=
.All that makes really hard and/or impossible (especially with automake harcoding) to control those options from one place.
Q: in this case really on aliasing may affect installable ELF binaries or only test suite? 🤔
It will affect the final libraft binary, not just the test suite.
Note that these flags are not mandatory, just recommended: the
CC_CHECK_FLAGS_APPEND
macros checks if a certain flag is available in the compiler being used (the one set withCC
), and if it's not available that flag will not be used.
I understand however CC_CHECK_FLAGS_APPEND
aclocal macro is not associated with ac --{enable|disable}-warnings option.
All the currently recommended flags should be available with CC=clang, FWIW. But you should be able to use other compilers just fine (e.g. CC=tcc).
Both gcc and clang are constantly evolving and some gcc options are not handled by clang and vice versa. (IMO) default variant of the builds organized with use GNI autotool, cmake or meson should provide at least option allowing drop all warning options.
Note that these flags are not mandatory, just recommended: the
CC_CHECK_FLAGS_APPEND
macros checks if a certain flag is available in the compiler being used (the one set withCC
), and if it's not available that flag will not be used.I understand however
CC_CHECK_FLAGS_APPEND
aclocal macro is not associated with ac --{enable|disable}-warnings option.
I can surely add an --{enable|disable}-warnings
option or something like that. By default those flags would be checked and used if available, but with --disable-warnings
you can turn of that behavior.
All the currently recommended flags should be available with CC=clang, FWIW. But you should be able to use other compilers just fine (e.g. CC=tcc).
Both gcc and clang are constantly evolving and some gcc options are not handled by clang and vice versa.
Sure, but that's not a problem. If an option is not available CC_CHECK_FLAGS_APPEND
will report that it's not available, and it will not be used.
(IMO) default variant of the builds organized with use GNI autotool, cmake or meson should provide at least option allowing drop all warning options.
Sure. You should be able to build the code however you wish. The code should just provide sane defaults that you can override.
It will affect the final libraft binary, not just the test suite.
I'll keep my patch in my build procwdure + line like below i raft.spec:
%global build_cflags %{build_cflags} -fno-strict-aliasing
to have in spec file visibility that at least for now raft
code depends on aliasing option.
It will affect the final libraft binary, not just the test suite.
I'll keep my patch in my build procwdure + line like below i raft.spec:
%global build_cflags %{build_cflags} -fno-strict-aliasing
to have in spec file visibility that at least for now
raft
code depends on aliasing option.
Thanks. I'll update this issue once I get rid of that dependency.
Thanks. I'll update this issue once I get rid of that dependency.
Sorry to not provide some details initially but .. [mode="Monty Python] Nobody expects the Spanish Inquisition.[/mode] 😋
I'll keep my patch in my build procwdure
Note that you should be able to disable any of the recommended flags without patching configure.ac
, for example if you don't want -Wall
you can set CFLAGS=-Wno-all
. So you can already achieve that without --disable-warnings
(but I'm fine to add that).
E.g. make CFLAGS=-Wno-all
.
Yes I know .. however it makes build logs unnecessarily longer and/or harder to process automatically 😢
This bug should be fixed by #127, which I just merged
Please could you check that you are now able to drop the -fno-strict-aliasing
flag?
There is also a new --disable-hardening
configuration flag that you can use to disable all the hardening compiler options, as you had requested.
If your code relies on not use aliasing that is oddest thing which I've ever seen. On scale of almost 5k packages which I have in my distro it would be FIRST such package ever.
I... admire your naive optimism. :D Lots of code, sadly, depends on this unsafe compiler detail. (Distros do not patch those flags, though...)
Also I am nearly positive you package the linux kernel, also cpython. (There are other famous packages with the issue, but that's enough for now.)
...
@freeekanayaka I figure that your -std is not really a "compile-time hardening option and should still be set unconditionally?
@freeekanayaka I figure that your -std is not really a "compile-time hardening option and should still be set unconditionally?
Good point. Fixed that in #129.
looks like something is wrong and test suite fails in few units.