pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Silence -fsanitize=function where we cast function pointers on p
Date: Sun, 04 Oct 2026 14:58:43 +0000
Message-ID: <E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org> (raw)

Silence -fsanitize=function where we cast function pointers on purpose

In clang, -fsanitize=undefined includes -fsanitize=function, which
reports every call made through a function pointer whose type does not
exactly match the called function, so it fires all over the place on
expression tree walkers and mutators, as well as a few other places.
So -fsanitize=undefined hasn't been working cleanly under clang for a
while.  (Before clang 17, it only applied to C++.)

This is the same issue that caused us to use
-Wno-cast-function-type-strict with clang.  That warning applies at
the place where the mismatching function pointer is passed, so there
are potentially hundreds of sites.  Therefore, a global disabling is
appropriate.  The sanitizer, on the other hand, triggers where the
function is called, which are only about two dozen places, so it seems
possible to silence these checks individually and still main the check
for accidental violations elsewhere.

Add pg_attribute_no_sanitize_function() and place it on the functions
that make such calls.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/2db401d9-ef16-430e-a42c-34477006a49f%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3ff475ac12ec8d8d07cf3fd86144659285a59d83

Modified Files
--------------
contrib/pgcrypto/pgcrypto.c       |  1 +
src/backend/access/heap/heapam.c  |  1 +
src/backend/nodes/nodeFuncs.c     | 12 ++++++++++++
src/backend/parser/analyze.c      |  1 +
src/backend/utils/hash/dynahash.c |  2 ++
src/backend/utils/mmgr/mcxt.c     |  1 +
src/include/c.h                   | 16 ++++++++++++++++
src/include/executor/execScan.h   |  1 +
src/include/lib/sort_template.h   |  2 ++
src/pl/plpgsql/src/pl_funcs.c     |  1 +
10 files changed, 38 insertions(+)



Message-ID: <E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org>
Permalink:  ../E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Silence -fsanitize=function where we cast function pointers on p
  In-Reply-To: <E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org>
  References: <E1xDNfn-00000000HaE-2o1C@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox