Skip to content

Commit 2a932b9

Browse files
riptlripatel-fd
authored andcommitted
util: inhibit unsafe FD_CRIT optimization
The use of __builtin_unreachable in FD_CRIT (FD_PARANOID==0) acts like a compiler optimizer hint that assertion failures are never possible. This results in much more aggressive/unsafe code optimizations than if the debug assertion was omitted. Therefore the use of __builtin_unreachable be removed for security.
1 parent c9e6179 commit 2a932b9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/log/fd_log.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@
294294
#define FD_CRIT( c,m) do { if( FD_UNLIKELY( !(c) ) ) FD_LOG_CRIT (( "FAIL: %s (%s)", #c, (m) )); } while(0)
295295
#define FD_ALERT(c,m) do { if( FD_UNLIKELY( !(c) ) ) FD_LOG_ALERT(( "FAIL: %s (%s)", #c, (m) )); } while(0)
296296
#else
297-
#define FD_CRIT( c,m) do { if( FD_UNLIKELY( !(c) ) ) __builtin_unreachable(); } while(0)
298-
#define FD_ALERT(c,m) do { } while(0)
297+
#define FD_CRIT( c,m) do { (void)(c); } while(0)
298+
#define FD_ALERT(c,m) do { } while(0)
299299
#endif
300300

301301
/* Macros for doing hexedit / tcpdump-like logging of memory regions.

0 commit comments

Comments
 (0)