There are two types of netlink notifier callbacks: nln_notify_func and
rtnetlink_notify_func.  The rtnetlink_notify_func is only registered
via rtnetlink_notifier_create(), so there is no real case where we
could use the wrong function pointer.  But UBsan in Clang 17 complains
that the function pointer type is not exactly the same:

  lib/netlink-notifier.c:237:13: runtime error: call to function
    name_table_change through pointer to incorrect function type
    'void (*)(const void *, void *)'

  lib/route-table.c:406: note: name_table_change defined here
    0 0xf65ed7 in nln_report lib/netlink-notifier.c:237:13
    1 0xf64e2e in nln_run lib/netlink-notifier.c
    2 0x50d4f2 in bridge_run vswitchd/bridge.c:3373:5
    3 0x547c55 in main vswitchd/ovs-vswitchd.c:137:9
    4 0x7f8149 in __libc_start_call_main
    5 0x7f820a in __libc_start_main@GLIBC_2.2.5
    6 0x42dfd4 in _start (vswitchd/ovs-vswitchd+0x42dfd4)

Turn off function sanitizing for nln_report() the same as we do for
RCU callbacks to avoid runtime errors with UBsan enabled.

Reproduced with OVN test suite running multiple tests in parallel.

Signed-off-by: Ilya Maximets <[email protected]>
---
 lib/netlink-notifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/netlink-notifier.c b/lib/netlink-notifier.c
index dfecb9778..7ea5a4181 100644
--- a/lib/netlink-notifier.c
+++ b/lib/netlink-notifier.c
@@ -223,7 +223,7 @@ nln_wait(struct nln *nln)
     }
 }
 
-void
+void OVS_NO_SANITIZE_FUNCTION
 nln_report(const struct nln *nln, void *change, int group)
 {
     struct nln_notifier *notifier;
-- 
2.45.2

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to