Skip to content

Commit

Permalink
netlink-notifier: Silence the UBsan's function pointer mismatch error.
Browse files Browse the repository at this point in the history
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.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
igsilya committed Jul 19, 2024
1 parent 99038d3 commit 21948c2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/netlink-notifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 21948c2

Please sign in to comment.