apache / trafficserver

Apache Traffic Server™ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
https://trafficserver.apache.org/
Apache License 2.0
1.8k stars 795 forks source link

Binary Equivalence Problem #8175

Open flymoondust opened 3 years ago

flymoondust commented 3 years ago

Recently, i encounter a Binary Equivalence problem. I compile in a docker in linux.

I already make the influnces,such as timestamp, the same through some techniques. Same mathine ,same docker image, occasionally compile result different, and only this so, the others so and bins are the same!!!

can anyone give me some help?

libtsconfig.so.8.1.zip

flymoondust commented 3 years ago

Now i reproduce the problem by accident,i find TsConfigSyntax.o is the only difference to make libtsconfig.so.And the difference is odd. i see the difference in Hexadecimal mode and find one doesn't include stdint.h. That's odd because why same code can cause different result?

TsConfigSyntax.zip

flymoondust commented 3 years ago

add some compile log: libtool: link: c++ -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-Huawei-linux/7.3.0/../../../../lib64/crti.o /usr/lib/gcc/x86_64-Huawei-linux/7.3.0/crtbeginS.o .libs/Errata.o .libs/TsBuilder.o .libs/TsErrataUtil.o .libs/TsValue.o .libs/TsConfigGrammar.o .libs/TsConfigSyntax.o -L/opt/3rd/ATS/openssl-1.1.1c/lib -L/opt/3rd/ATS/zlib-1.2.11/lib -L/opt/3rd/ATS/pcre-8.44/lib -lpthread -ldl -L/usr/lib/gcc/x86_64-Huawei-linux/7.3.0 -L/usr/lib/gcc/x86_64-Huawei-linux/7.3.0/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-Huawei-linux/7.3.0/../../.. /usr/lib/gcc/x86_64-Huawei-linux/7.3.0/libstdc++.so -lm -lc -lgcc_s /usr/lib/gcc/x86_64-Huawei-linux/7.3.0/crtendS.o /usr/lib/gcc/x86_64-Huawei-linux/7.3.0/../../../../lib64/crtn.o -mcx16 -Wl,--build-id=none -Wl,-z -Wl,relro -Wl,-z -Wl,noexecstack -Wl,-z -Wl,now -O2 -Wl,-z -Wl,now -Wl,-z -Wl,relro -Wl,-z -Wl,noexecstack -Wl,-soname -Wl,libtsconfig.so.8 -o .libs/libtsconfig.so.8.0.8

libtool: compile: cc -DHAVE_CONFIG_H -I. -I../../include -Dlinux -D_LARGEFILE64_SOURCE=1 -D_COMPILE64BIT_SOURCE=1 -D_REENTRANT -DSTDC_LIMIT_MACROS=1 -DSTDC_FORMAT_MACROS=1 -D_FORTIFY_SOURCE=2 -I/opt/3rdSrc/ATS/trafficserver-8.0.8/include -I/opt/3rdSrc/ATS/trafficserver-8.0.8/lib -I/opt/3rd/ATS/tcl8.6.9/include -Wno-unused-function -fPIC -Wl,--build-id=none -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong -D_GNU_SOURCE -I/opt/3rd/ATS/openssl-1.1.1c/include -DOPENSSL_NO_SSL_INTERN -I/opt/3rd/ATS/zlib-1.2.11/include -I/opt/3rd/ATS/pcre-8.44/include -std=gnu99 -g -pipe -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter -Wno-format-truncation -Wno-cast-function-type -Wno-stringop-overflow -feliminate-unused-debug-symbols -fno-strict-aliasing -fstack-protector -mcx16 -Wno-unused-parameter -Wno-unused-function -fPIC -Wl,--build-id=none -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong -MT TsConfigSyntax.lo -MD -MP -MF .deps/TsConfigSyntax.Tpo -c TsConfigSyntax.c -fPIC -DPIC -o .libs/TsConfigSyntax.o

randall commented 3 years ago

What happens with the 9.0.x branch? TsConfigSyntax.cc has been removed in newer versions of ATS.

flymoondust commented 3 years ago

What happens with the 9.0.x branch? TsConfigSyntax.cc has been removed in newer versions of ATS.

Now my software is an old version, which'll not update any more, only fix bugs.

flymoondust commented 3 years ago

i want to know the reason which cause the difference,and accept some patch to fix this, or some suspect to go on is ok. Now i don't find the recurrence condition of the problem, which occure occasionally,so this makes me very frustrated.

dragon512 commented 2 years ago

I was able to get this to work via using libfaketime ( This addresses the issues of the compiler, and some system calls made in the autoconf logic), setting the host and user to the same value for the docker image. I am build 9.x branch. I will double-check my build to make sure the libtsconfig.so matches. At the moment it is passing with the RPM I am producing and testing with rpmdiff.

oceanwalker commented 1 year ago

I have encountered similar question when using Apache Traffic Server 8.1.6. After multiple tests, I find that the following two rows would be recorded in the compilation log after the compilation of the binary file libtsconfig.so.8.1.6:

[INFO] @@pack@@ YACC TsConfigGrammar.c
[INFO] @@pack@@ updating TsConfigGrammar.h

Further analysis shows that the files TsConfigGrammar.h and TsConfigGrammar.c in the source code directory are changed as follows: tsconfig.zip

The modified files are the same as the previously submitted ones. Can somebody help explain it?

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.