-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
The UBSAN alignment test is currently disable #904, since it triggers a bunch of failures. Most of these are related to taking some Buffer slice address and using it directly for uint16_t or uint32_t. It's probably functionally not a big issue to have these misalignments, even though technically undefined behavior at the C++ level, on x86, but it hurts architectural portability and performance.
To discover the failures, enable alignment checking in tools/bazel.rc. Here's example output:
//test/common/grpc:rpc_channel_impl_test FAILED in 1 out of 2 in 1.8s
/usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/grpc/rpc_channel_impl_test/test.log
//test/common/mongo:codec_impl_test FAILED in 1 out of 2 in 0.3s
/usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/mongo/codec_impl_test/test.log
//test/common/network:dns_impl_test FAILED in 1 out of 2 in 0.9s
/usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/network/dns_impl_test/test.log
//test/common/tracing:http_tracer_impl_test FAILED in 1 out of 2 in 1.8s
/usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/tracing/http_tracer_impl_test/test.log
<clang-san> htuch@htuch00:~/src/envoy ⊧ cat /usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/grpc/rpc_channel_impl_test/test.log
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
[==========] Running 13 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 13 tests from GrpcRequestImplTest
[ RUN ] GrpcRequestImplTest.NoError
source/common/grpc/common.cc:48:3: runtime error: store to misaligned address 0x6190000064b1 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x6190000064b1: note: pointer points here
61 00 00 00 be be be be be be be be be be be be be be be be be be be be be be be be be be be be
^
SUMMARY: AddressSanitizer: undefined-behavior source/common/grpc/common.cc:48:3 in
Use --strategy=TestRunner=standalone to disable sandboxing for the failing actions.
<clang-san> htuch@htuch00:~/src/envoy ⊧ cat /usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/mongo/codec_impl_test/test.log
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
[==========] Running 14 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 14 tests from MongoCodecImplTest
[ RUN ] MongoCodecImplTest.QueryEqual
[ OK ] MongoCodecImplTest.QueryEqual (0 ms)
[ RUN ] MongoCodecImplTest.Query
source/common/mongo/bson_impl.cc:21:10: runtime error: load of misaligned address 0x6190000032c9 for type 'int32_t' (aka 'int'), which requires 4 byte alignment
0x6190000032c9: note: pointer points here
65 73 74 00 14 00 00 00 ff ff ff ff f1 00 00 00 02 73 74 72 69 6e 67 00 07 00 00 00 73 74 72 69
^
SUMMARY: AddressSanitizer: undefined-behavior source/common/mongo/bson_impl.cc:21:10 in
Use --strategy=TestRunner=standalone to disable sandboxing for the failing actions.
<clang-san> htuch@htuch00:~/src/envoy ⊧ cat /usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/network/dns_impl_test/test.log
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
[==========] Running 6 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 5 tests from DnsImplTest
[ RUN ] DnsImplTest.DestructPending
[ OK ] DnsImplTest.DestructPending (2 ms)
[ RUN ] DnsImplTest.LocalLookup
[ OK ] DnsImplTest.LocalLookup (1 ms)
[ RUN ] DnsImplTest.RemoteAsyncLookup
[ OK ] DnsImplTest.RemoteAsyncLookup (2 ms)
[ RUN ] DnsImplTest.MultiARecordLookup
[ OK ] DnsImplTest.MultiARecordLookup (1 ms)
[ RUN ] DnsImplTest.Cancel
test/common/network/dns_impl_test.cc:69:20: runtime error: load of misaligned address 0x619000007dcf for type 'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
0x619000007dcf: note: pointer points here
00 01 00 01 00 22 c2 d8 01 00 00 01 00 00 00 00 00 00 04 73 6f 6d 65 04 67 6f 6f 64 06 64 6f 6d
^
SUMMARY: AddressSanitizer: undefined-behavior test/common/network/dns_impl_test.cc:69:20 in
Use --strategy=TestRunner=standalone to disable sandboxing for the failing actions.
<clang-san> htuch@htuch00:~/src/envoy ⊧ cat /usr/local/google/home/htuch/.cache/bazel/_bazel_htuch/89676793239ac96d94294e6c7a44597f/execroot/envoy/bazel-out/local-dbg/testlogs/test/common/tracing/http_tracer_impl_test/test.log
exec ${PAGER:-/usr/bin/less} "$0" || exit 1
-----------------------------------------------------------------------------
[==========] Running 14 tests from 4 test cases.
[----------] Global test environment set-up.
[----------] 6 tests from HttpTracerUtilityTest
[ RUN ] HttpTracerUtilityTest.mutateHeaders
[ OK ] HttpTracerUtilityTest.mutateHeaders (3 ms)
[ RUN ] HttpTracerUtilityTest.IsTracing
[ OK ] HttpTracerUtilityTest.IsTracing (2 ms)
[ RUN ] HttpTracerUtilityTest.OriginalAndLongPath
[ OK ] HttpTracerUtilityTest.OriginalAndLongPath (2 ms)
[ RUN ] HttpTracerUtilityTest.SpanOptionalHeaders
[ OK ] HttpTracerUtilityTest.SpanOptionalHeaders (1 ms)
[ RUN ] HttpTracerUtilityTest.SpanPopulatedFailureResponse
[ OK ] HttpTracerUtilityTest.SpanPopulatedFailureResponse (2 ms)
[ RUN ] HttpTracerUtilityTest.operationTypeToString
[ OK ] HttpTracerUtilityTest.operationTypeToString (0 ms)
[----------] 6 tests from HttpTracerUtilityTest (10 ms total)
[----------] 1 test from HttpNullTracerTest
[ RUN ] HttpNullTracerTest.BasicFunctionality
[ OK ] HttpNullTracerTest.BasicFunctionality (2 ms)
[----------] 1 test from HttpNullTracerTest (2 ms total)
[----------] 2 tests from HttpTracerImplTest
[ RUN ] HttpTracerImplTest.BasicFunctionalityNullSpan
[ OK ] HttpTracerImplTest.BasicFunctionalityNullSpan (2 ms)
[ RUN ] HttpTracerImplTest.BasicFunctionalityNodeSet
[ OK ] HttpTracerImplTest.BasicFunctionalityNodeSet (2 ms)
[----------] 2 tests from HttpTracerImplTest (4 ms total)
[----------] 5 tests from LightStepDriverTest
[ RUN ] LightStepDriverTest.InitializeDriver
[ OK ] LightStepDriverTest.InitializeDriver (8 ms)
[ RUN ] LightStepDriverTest.FlushSeveralSpans
source/common/grpc/common.cc:48:3: runtime error: store to misaligned address 0x6190000087b1 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x6190000087b1: note: pointer points here
61 00 00 00 be be be be be be be be be be be be be be be be be be be be be be be be be be be be
^
SUMMARY: AddressSanitizer: undefined-behavior source/common/grpc/common.cc:48:3 in
Use --strategy=TestRunner=standalone to disable sandboxing for the failing actions.
Reactions are currently unavailable