Skip to content

Commit

Permalink
Enable TSan validation to detect when a mutable accessor of a message…
Browse files Browse the repository at this point in the history
… is called concurrently with another accessor on the same message, which is a data race.

This is the fourth phase, in which we enable validation for message fields.

PiperOrigin-RevId: 545695188
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jul 5, 2023
1 parent 532d2a2 commit 0275e51
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/google/protobuf/port_def.inc
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,15 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#define PROTOBUF_TSAN_DECLARE_MEMBER
#endif

// TODO(b/280674214): enable these macros in phases. The phases are: repeated
// fields/maps, enum/primitive fields, string fields, message fields.
// TODO(b/280674214): cleanup these macros.
#define PROTOBUF_TSAN_READ_REPEATED(addr) PROTOBUF_TSAN_READ(addr)
#define PROTOBUF_TSAN_READ_PRIMITIVE(addr) PROTOBUF_TSAN_READ(addr)
#define PROTOBUF_TSAN_READ_STRING(addr) PROTOBUF_TSAN_READ(addr)
#define PROTOBUF_TSAN_READ_MESSAGE(addr)
#define PROTOBUF_TSAN_READ_MESSAGE(addr) PROTOBUF_TSAN_READ(addr)
#define PROTOBUF_TSAN_WRITE_REPEATED(addr) PROTOBUF_TSAN_WRITE(addr)
#define PROTOBUF_TSAN_WRITE_PRIMITIVE(addr) PROTOBUF_TSAN_WRITE(addr)
#define PROTOBUF_TSAN_WRITE_STRING(addr) PROTOBUF_TSAN_WRITE(addr)
#define PROTOBUF_TSAN_WRITE_MESSAGE(addr)
#define PROTOBUF_TSAN_WRITE_MESSAGE(addr) PROTOBUF_TSAN_WRITE(addr)

#ifdef PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION
#error PROTOBUF_USE_TABLE_PARSER_ON_REFLECTION was previously defined
Expand Down

0 comments on commit 0275e51

Please sign in to comment.