Message ID | 20240718191238.3177249-1-i.maximets@ovn.org |
---|---|
State | Accepted |
Commit | 8f3d6c145b7cf9ae6c320a0291a715b9c4715bd6 |
Headers | show |
Series | [ovs-dev] netlink-notifier: Silence the UBsan's function pointer mismatch error. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | fail | test: fail |
On Thu, Jul 18, 2024 at 3:12 PM Ilya Maximets <i.maximets@ovn.org> wrote: > > 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 <i.maximets@ovn.org> Acked-by: Mike Pattrick <mkp@redhat.com>
On 7/18/24 22:45, Mike Pattrick wrote: > On Thu, Jul 18, 2024 at 3:12 PM Ilya Maximets <i.maximets@ovn.org> wrote: >> >> 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 <i.maximets@ovn.org> > > Acked-by: Mike Pattrick <mkp@redhat.com> > Thanks, Mike! Applied and backported down to 2.17. Best regards, Ilya Maximets.
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;
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 <i.maximets@ovn.org> --- lib/netlink-notifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)