Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libyang crash when parsing rpc error containing yuma tools namespace #2191

Open
g0wtham opened this issue Feb 28, 2024 · 6 comments
Open

libyang crash when parsing rpc error containing yuma tools namespace #2191

g0wtham opened this issue Feb 28, 2024 · 6 comments
Labels
is:bug Bug description. status:invalid Issue is not reproducible or the behavior is intended.

Comments

@g0wtham
Copy link

g0wtham commented Feb 28, 2024

Hi All,

I am facing a crash issue with libyang where it not able to parse the rpc-reply from the client which has the yuma tools name space embedded in the rpc-reply msg, can someone please tell me how to fix the libyang crash issue.

The BT of the crash looks like below:

#0  0x00007f3f250b9acf in raise () from /usr/lib64/libc.so.6
No symbol table info available.
#1  0x00007f3f2508cea5 in abort () from /usr/lib64/libc.so.6
No symbol table info available.
#2  0x00007f3f2508cd79 in __assert_fail_base.cold.0 () from /usr/lib64/libc.so.6
No symbol table info available.
#3  0x00007f3f250b2426 in __assert_fail () from /usr/lib64/libc.so.6
No symbol table info available.
#4  0x00007f3f25fab4e0 in lyd_insert_node (parent=0x7f3ee0024690, first_sibling_p=0x0, node=0x0, last=1 '\001')
    at /workspace/rhel-build/open-source/libyang/src/tree_data.c:2550
        anchor = 0xe8004cc0
        first_sibling = 0x7f3f0638bfc8
        __PRETTY_FUNCTION__ = "lyd_insert_node"
#5  0x00007f3f25fb7ced in lydxml_env_netconf_rpc_reply_error_info (xmlctx=0x7f3ee001ea70, parent=0x7f3ee0024690)
    at /workspace/rhel-build/open-source/libyang/src/parser_xml.c:1091
        r = LY_SUCCESS
        child = 0x0
        iter = 0x7f3ee8004cc0
        ns = 0x7f3ee000e600
        no_dup = 0 '\000'
        __PRETTY_FUNCTION__ = "lydxml_env_netconf_rpc_reply_error_info"
 6  0x00007f3f25fb82b1 in lydxml_env_netconf_rpc_reply_error (xmlctx=0x7f3ee001ea70, parent=0x7f3ee0069f60)
    at /workspace/rhel-build/open-source/libyang/src/parser_xml.c:1225
        r = LY_SUCCESS
        child = 0x7f3ee0024690
        iter = 0x0
        val = 0x7f3ee80443c0 "error"
        no_dup = 1 '\001'
        __PRETTY_FUNCTION__ = "lydxml_env_netconf_rpc_reply_error"
#7  0x00007f3f25fb86ff in lydxml_env_netconf_reply (xmlctx=0x7f3ee001ea70, envp=0x7f3f0638be10, int_opts=0x7f3f0638bd84,
    close_elem=0x7f3f0638bd80) at /workspace/rhel-build/open-source/libyang/src/parser_xml.c:1344
        rc = LY_SUCCESS
        r = LY_SUCCESS
--Type <RET> for more, q to quit, c to continue without paging--c
        child = 0x7f3ee0069f60
        parsed_elem = 0x0
        __PRETTY_FUNCTION__ = "lydxml_env_netconf_reply"
#8  0x00007f3f25fb8ae8 in lyd_parse_xml (ctx=0x7f3ee800d470, ext=0x0, parent=0x7f3ee0067780, first_p=0x7f3f0638be18, in=0x7f3ee0069e80, parse_opts=327680, val_opts=0, data_type=LYD_TYPE_REPLY_NETCONF, envp=0x7f3f0638be10, parsed=0x7f3f0638be20, lydctx_p=0x7f3f0638be38) at /workspace/rhel-build/open-source/libyang/src/parser_xml.c:1423
        rc = LY_SUCCESS
        lydctx = 0x7f3ee0023620
        i = 0
        int_opts = 0
        close_elem = 0
        parsed_data_nodes = 0 '\000'
        __PRETTY_FUNCTION__ = "lyd_parse_xml"
        __func__ = "lyd_parse_xml"
#9  0x00007f3f25fa4115 in lyd_parse_op_ (ctx=0x7f3ee800d470, ext=0x0, parent=0x7f3ee0067780, in=0x7f3ee0069e80, format=LYD_XML, data_type=LYD_TYPE_REPLY_NETCONF, tree=0x7f3f0638bfa8, op=0x0) at /workspace/rhel-build/open-source/libyang/src/tree_data.c:558
        rc = LY_SUCCESS
        lydctx = 0x0
        parsed = {size = 0, count = 0, {dnodes = 0x0, snodes = 0x0, objs = 0x0}}
        first = 0x0
        envp = 0x7f3ee0069ed0
        i = 3758509704
        parse_opts = 327680
        val_opts = 0
        __func__ = "lyd_parse_op_"
#10 0x00007f3f25fa4465 in lyd_parse_op (ctx=0x0, parent=0x7f3ee0067780, in=0x7f3ee0069e80, format=LYD_XML, data_type=LYD_TYPE_REPLY_NETCONF, tree=0x7f3f0638bfa8, op=0x0) at /workspace/rhel-build/open-source/libyang/src/tree_data.c:625
        __func__ = "lyd_parse_op"
#11 0x00007f3f2655e51f in recv_reply (session=0x7f3ee8004cc0, timeout=10000, op=0x7f3ee0067780, msgid=274, envp=0x7f3f0638bfa8) at /workspace/rhel-build/open-source/libnetconf2/src/session_client.c:1842
        lyrc = 4109878016
        msg = 0x7f3ee0069e80
        ret = NC_MSG_REPLY
        __PRETTY_FUNCTION__ = "recv_reply"
#12 0x00007f3f2655ecfe in nc_recv_reply (session=0x7f3ee8004cc0, rpc=0x7f3ed80029b0, msgid=274, timeout=10000, envp=0x7f3f0638bfa8, op=0x7f3f0638bfb0) at /workspace/rhel-build/open-source/libnetconf2/src/session_client.c:2050

The rpc reply from the client is,

image

Thanks,
P.Gowtham

@michalvasko
Copy link
Member

I have briefly tested it and got the correct error

Unexpected child element "error-number" of "rpc-error".

because custom error information is supposed to be stored in error-info. But it should definitely not crash, what libyang version are you using?

@michalvasko michalvasko added the is:bug Bug description. label Feb 28, 2024
@g0wtham
Copy link
Author

g0wtham commented Feb 29, 2024

Thanks @michalvasko for the quick response, the version of libyang we are using is v2.0.88 of revision "dd349cf0fb2c6ae91fae72e5bc07d994057cf2ef"

@michalvasko
Copy link
Member

Okay, that is way too old and you are lucky if this is the first issue you encountered.

@michalvasko michalvasko added the status:invalid Issue is not reproducible or the behavior is intended. label Feb 29, 2024
@g0wtham
Copy link
Author

g0wtham commented Feb 29, 2024

@michalvasko can you let me know to which version of libyang should I upgrade so that issue might be not seen

@michalvasko
Copy link
Member

No, I would have to look for the exact version with a fix. Just grab the latest released version and you should be fine (2.1.148).

@g0wtham
Copy link
Author

g0wtham commented Feb 29, 2024

will update and check if the issue exists or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Bug description. status:invalid Issue is not reproducible or the behavior is intended.
Projects
None yet
Development

No branches or pull requests

2 participants