Open fdr400 opened 1 month ago
Hi, thanks for the report, the problems seems to be that timespec_get
can return an error an in that case the tspec
isn't initialized. That should be the problem I think. Could you try if initializing it to zero on error fixes your warning?
@emasab i tried to do so and it fixes the problem, but i don't think it is better solution, because
tspec
before calling the rd_timeout_init_timespec
memset
in runtimeInitalization inside rd_timeout_init_timespec
also is not a good idea, because, i suppose, it is unexpected from function that it zeroing the input argument. It can return the constructed tspec
, but it is not the C style
So, the sanitizer unpoison is enough good solution, because it does nothing in Release and Debug builds
@emasab
Description
librdkafka fails with MemorySanitizer with
use-of-unitialized-value
insrc/rdtime.h
.The error is precisely:
Error is in
rd_timeout_init_timespec
and inrd_timeout_init_timespec_us
. Their argumenttspec
is always uninitialized andtimespec_get(tspec, TIME_UTC);
is not initializing it entirely.I found the comment about the same issue in
zstd
code: https://github.com/facebook/zstd/blob/dev/programs/timefn.c#L74Importance
I am from @userver-framework, we have a Kafka client based on librdkafka, which represents non-blocking and scalable interfaces for producers and consumers. We have huge number of tests and CI checks both for internal (in company's repository) and external (in Github CI) repositories, under different compilers, build options and sanitizers. But we cannot enable MSAN sanitizer for Kafka client because of the error.
P.S. I checked that with my fix, our tests works.
P.P.S. Client code: https://github.com/userver-framework/userver/tree/develop/kafka
How to reproduce
I made a repo with instruction and small code example to reproduce the error and check that my fix works. Repository link: https://github.com/fdr400/rdkafka-producer-msan
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
2.5.3
2.13-3.7.0
(but not used in example)bootstrap.servers=localhost:9092
Ubuntu 24.04