-
Notifications
You must be signed in to change notification settings - Fork 22
Avoid runtime failure in CopyXLogRecordToWAL with sanitizers enabled #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Should this be upstreamed? |
I can research this deeper, but if my memory serves me (I had the same idea when I discovered the failure in 2023), I could not reach that memcpy with rdata_data == null on vanilla postgres. From the backtrace shown, I suspect that ReplicationSlotDropPtr is producing such unusual WAL records. |
|
Seems like we should probably figure out how we sending NULL to this function then. |
I see three such places: postgres/src/backend/replication/slot.c Line 908 in a8dd6e7
I couldn't find such LogLogicalMessage() calls in vanilla PostgreSQL; so tried: @@ -373,8 +373,9 @@ pg_logical_emit_message_bytea(PG_FUNCTION_ARGS)
bool flush = PG_GETARG_BOOL(3);
XLogRecPtr lsn;
- lsn = LogLogicalMessage(prefix, VARDATA_ANY(data), VARSIZE_ANY_EXHDR(data),
+ lsn = LogLogicalMessage(prefix, NULL, 0,
transactional, flush);and got the same ubsan-detected errors during ' make -s check -C contrib/test_decoding/'. |
|
Yeah, then I think this patch makes sense. I don't think it's possible to not pass NULL there. |
|
Closing this PR, as the proposed change is included in neondatabase/neon#10473 now. And then reopening... |
There is a single place in the code, that triggers:
in several regress tests (test_dropdb_with_subscription, test_layer_bloating, test_logical_replication, ...)
The change proposed is enough to make tests pass with asan/ubsan-enabled postgres build.
See also 46ab07f.