lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Jul 2023 11:11:46 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, David Ahern <dsahern@...nel.org>,
	Andrea Claudi <aclaudi@...hat.com>, Ying Xu <yinxu@...hat.com>
Subject: Re: [PATCH iproute2] lib: move rtnl_echo_talk from libnetlink to
 utils

On Tue, Jul 11, 2023 at 09:00:11AM -0700, Stephen Hemminger wrote:
> On Tue, 11 Jul 2023 15:31:17 +0800
> Hangbin Liu <liuhangbin@...il.com> wrote:
> 
> > In commit 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()"),
> > some json obj functions were exported in libnetlink. Which cause build
> > error like:
> >     /usr/bin/ld: /tmp/cc6YaGBM.o: in function `rtnl_echo_talk':
> >     libnetlink.c:(.text+0x25bd): undefined reference to `new_json_obj'
> >     /usr/bin/ld: libnetlink.c:(.text+0x25c7): undefined reference to `open_json_object'
> >     /usr/bin/ld: libnetlink.c:(.text+0x25e3): undefined reference to `close_json_object'
> >     /usr/bin/ld: libnetlink.c:(.text+0x25e8): undefined reference to `delete_json_obj'
> >     collect2: error: ld returned 1 exit status
> > 
> > Commit 6d68d7f85d8a ("testsuite: fix build failure") only fixed this issue
> > for iproute building. But if other applications include the libnetlink.a,
> > they still have this problem, because libutil.a is not exported to the
> > LDLIBS. So let's move the rtnl_echo_talk() from libnetlink.c to utils.c
> > to avoid this issue.
> > 
> > After the fix, we can also remove the update by c0a06885b944 ("testsuite: fix
> > testsuite build failure when iproute build without libcap-devel").
> > 
> > Reported-by: Ying Xu <yinxu@...hat.com>
> > Fixes: 6c09257f1bf6 ("rtnetlink: add new function rtnl_echo_talk()")
> > Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> 
> I don't see this when iproute2 is built.

Yes, because commit 6d68d7f85d8a fixed this for iproute2.

> Libnetlink is not a public API. And there is no guarantee about

OK..

> compatibility if an application links with it.  Collect2 should be
> using a supported library like libmnl instea.

It's not about compatibility. If an application linked with netlink.a, the
build will failed. e.g. 

# cat test.c
#include <libnetlink.h>

int main()
{
        struct rtnl_handle rth = { .dump = 123456, };

        rtnl_close(&rth);

        return 0;
}
# cc test.c -lnetlink -lmnl
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libnetlink.a(libnetlink.o): in function `rtnl_echo_talk':
(.text[.text.group]+0x1f78): undefined reference to `new_json_obj'
/usr/bin/ld: (.text[.text.group]+0x1f7f): undefined reference to `open_json_object'
/usr/bin/ld: (.text[.text.group]+0x1f94): undefined reference to `close_json_object'
/usr/bin/ld: (.text[.text.group]+0x1f99): undefined reference to `delete_json_obj'
collect2: error: ld returned 1 exit status

Thanks
Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ