Re: Ubsan complaint on kestrel - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Ubsan complaint on kestrel
Date
Msg-id 4082535.1741038549@sss.pgh.pa.us
Whole thread Raw
In response to Re: Ubsan complaint on kestrel  (Andres Freund <andres@anarazel.de>)
Responses Re: Ubsan complaint on kestrel
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> ../../../../../home/andres/src/postgresql/src/backend/nodes/nodeFuncs.c:2712:6: runtime error: call to function
assign_query_collations_walkerthrough pointer to incorrect function type 'bool (*)(struct Node *, void *)' 
>
/srv/dev/build/postgres/m-dev-assert-clang-sanitizer/../../../../../home/andres/src/postgresql/src/backend/parser/parse_collate.c:127:
note:assign_query_collations_walker defined here 
>     #0 0x55c8ee0ffbd8 in query_tree_walker_impl
/srv/dev/build/postgres/m-dev-assert-clang-sanitizer/../../../../../home/andres/src/postgresql/src/backend/nodes/nodeFuncs.c:2712:6

Ugh.  So they're enforcing the C standard's position that "void *" is
not compatible with anything else.  That makes this check useless to
us.  We already decided that we're not going to take the hit of
declaring all walker/mutator callbacks with "void *", and I don't see
that this tool changes that decision.

> On https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html I found
> -fsanitize=function, which also can be used as -fno-sanitize=function:
>> -fsanitize=function: Indirect call of a function through a function pointer of the wrong type.
> With that I can get past this issue.

Good.

> I wish the sanitizer treated mismatches of void * arguments against a "real
> type" different from other mismatches, but ...

Indeed.  I think we have enough coverage of that via compile-time
checks, though -- it's not like the type match or mismatch will vary
dynamically.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Showing primitive index scan count in EXPLAIN ANALYZE (for skip scan and SAOP scans)
Next
From: Andres Freund
Date:
Subject: Re: Ubsan complaint on kestrel