ny client crashes when executing get-config or get #2240
Labels
is:bug
Bug description.
status:completed
From the developer perspective, the issue was solved (bug fixed, question answered,...)
Hi,
I use (a modified version of) the client example code provided by libnetconf2. When connecting to a device the client crashes in lys_compile_extension due to a null pointer. The problem is the same for libyang-2.1.111 / libnetconf2-2.1.37 or libyang-2.2.8 / libnetconf2-3.0.17.
I think this is related to the following modul structure: the top level module test-moduls includes test-submodule1 and test-submodule1 includes test-submodule2. test-submodule2 imports tailf-common and uses the extension tailf-common:cli-range-list-syntax in test-grouping.
You can find the test-* (sub)modules below. I also added some data frm the core file.
$ gdb ncclient core.ncclient.1210534
GNU gdb (GDB) Red Hat Enterprise Linux 8.2-12.el8
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Controlling the inferior in non-stop mode is off.
Reading symbols from ncclient...done.
[New LWP 1210534]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `ncclient -m modules/device -t ssh -a 172.30.14.221 -u admin -P admin get-config'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 lys_compile_extension (ext=0x25a8d18, extp=0x2504858, ctx=0x7ffc526c5ca0) at ../libyang-2.1.111/src/schema_compile.c:124
124 if (!ep->compiled) {
Missing separate debuginfos, use: yum debuginfo-install audit-libs-3.0-0.17.20191104git1c2f876.el8.x86_64 glibc-2.28-127.el8.x86_64 keyutils-libs-1.5.10-6.el8.x86_64 krb5-libs-1.18.2-5.el8.x86_64 libcap-ng-0.7.9-5.el8.x86_64 libcom_err-1.45.6-1.el8.x86_64 libselinux-2.9-4.el8_3.x86_64 libssh-0.9.4-3.el8.x86_64 libxcrypt-4.1.1-4.el8.x86_64 openssl-libs-1.1.1g-12.el8_3.x86_64 pam-1.3.1-11.el8.x86_64 pcre2-10.32-2.el8.x86_64 sssd-client-2.3.0-9.el8.x86_64 zlib-1.2.11-17.el8.x86_64
(gdb) whe
#0 lys_compile_extension (ext=0x25a8d18, extp=0x2504858, ctx=0x7ffc526c5ca0) at ../libyang-2.1.111/src/schema_compile.c:124
#1 lys_compile_ext (ctx=ctx@entry=0x7ffc526c5ca0, extp=0x2504858, ext=0x25a8d18, parent=parent@entry=0x25a6f10) at ../libyang-2.1.111/src/schema_compile.c:172
#2 0x00007fc57608c29d in lys_compile_node_ (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x2508170, parent=parent@entry=0x25a3a60, inherited_flags=inherited_flags@entry=4, node_compile_spec=0x7fc57608e1d0 <lys_compile_node_list>, node=0x25a6f10, child_set=0x7ffc526c54f0) at ../libyang-2.1.111/src/schema_compile_node.c:2708
#3 0x00007fc57608c658 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x2508170, parent=parent@entry=0x25a3a60, inherited_flags=inherited_flags@entry=4, child_set=child_set@entry=0x7ffc526c54f0) at ../libyang-2.1.111/src/schema_compile_node.c:4263
#4 0x00007fc57608d08e in lys_compile_uses_children (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x2452490, inherited_flags=4, child=, grp_mod=grp_mod@entry=0x2508d80, parent=parent@entry=0x25a3a60, child_set=0x7ffc526c54f0, child_unres_disabled=0 '\000') at ../libyang-2.1.111/src/schema_compile_node.c:3906
#5 0x00007fc57608d581 in lys_compile_uses (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x2452490, parent=parent@entry=0x25a3a60, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4021
#6 0x00007fc57608c6e0 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x2452490, parent=parent@entry=0x25a3a60, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4253
#7 0x00007fc57608e24c in lys_compile_node_list (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x244a880, node=node@entry=0x25a3a60) at ../libyang-2.1.111/src/schema_compile_node.c:3351
#8 0x00007fc57608c1ae in lys_compile_node_ (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x244a880, parent=parent@entry=0x259bd10, inherited_flags=inherited_flags@entry=4, node_compile_spec=0x7fc57608e1d0 <lys_compile_node_list>, node=0x25a3a60, child_set=0x7ffc526c5860) at ../libyang-2.1.111/src/schema_compile_node.c:2705
#9 0x00007fc57608c658 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x244a880, parent=parent@entry=0x259bd10, inherited_flags=inherited_flags@entry=4, child_set=child_set@entry=0x7ffc526c5860) at ../libyang-2.1.111/src/schema_compile_node.c:4263
#10 0x00007fc57608d08e in lys_compile_uses_children (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x23f1020, inherited_flags=4, child=, grp_mod=grp_mod@entry=0x24590c0, parent=parent@entry=0x259bd10, child_set=0x7ffc526c5860, child_unres_disabled=0 '\000') at ../libyang-2.1.111/src/schema_compile_node.c:3906
#11 0x00007fc57608d581 in lys_compile_uses (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x23f1020, parent=parent@entry=0x259bd10, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4021
#12 0x00007fc57608c6e0 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x23f1020, parent=parent@entry=0x259bd10, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4253
#13 0x00007fc57608e24c in lys_compile_node_list (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x23f7300, node=node@entry=0x259bd10) at ../libyang-2.1.111/src/schema_compile_node.c:3351
#14 0x00007fc57608c1ae in lys_compile_node_ (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x23f7300, parent=parent@entry=0x0, inherited_flags=inherited_flags@entry=4, node_compile_spec=0x7fc57608e1d0 <lys_compile_node_list>, node=0x259bd10, child_set=0x7ffc526c5bd0) at ../libyang-2.1.111/src/schema_compile_node.c:2705
#15 0x00007fc57608c658 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x23f7300, parent=parent@entry=0x0, inherited_flags=inherited_flags@entry=4, child_set=child_set@entry=0x7ffc526c5bd0) at ../libyang-2.1.111/src/schema_compile_node.c:4263
#16 0x00007fc57608d08e in lys_compile_uses_children (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x241cd40, inherited_flags=4, child=, grp_mod=grp_mod@entry=0x23f4c10, parent=parent@entry=0x0, child_set=0x7ffc526c5bd0, child_unres_disabled=0 '\000') at ../libyang-2.1.111/src/schema_compile_node.c:3906
#17 0x00007fc57608d581 in lys_compile_uses (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x241cd40, parent=parent@entry=0x0, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4021
#18 0x00007fc57608c6e0 in lys_compile_node (ctx=ctx@entry=0x7ffc526c5ca0, pnode=pnode@entry=0x241cd40, parent=parent@entry=0x0, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4253
#19 0x00007fc57608244f in lys_compile (mod=mod@entry=0x240b5e0, unres=unres@entry=0x2372f10) at ../libyang-2.1.111/src/schema_compile.c:1657
#20 0x00007fc576084c85 in lys_compile_depset_r (ctx=ctx@entry=0x2372e80, dep_set=dep_set@entry=0x2574260, unres=unres@entry=0x2372ee0) at ../libyang-2.1.111/src/schema_compile.c:1463
#21 0x00007fc576084dab in lys_compile_depset_all (ctx=ctx@entry=0x2372e80, unres=unres@entry=0x2372ee0) at ../libyang-2.1.111/src/schema_compile.c:1522
#22 0x00007fc57605a3cb in ly_ctx_compile (ctx=0x2372e80) at ../libyang-2.1.111/src/context.c:561
#23 0x00007fc57636cdd6 in nc_ctx_check_and_fill (session=session@entry=0x2365c10) at ../libnetconf2-2.1.37/src/session_client.c:1359
#24 0x00007fc5763772e3 in nc_connect_ssh (host=0x2365b40 "172.30.14.221", port=830, ctx=) at ../libnetconf2-2.1.37/src/session_client_ssh.c:1722
#25 0x0000000000401fca in main (argc=12, argv=0x7ffc526c7218) at client.c:478
(gdb) f 0
#0 lys_compile_extension (ext=0x25a8d18, extp=0x2504858, ctx=0x7ffc526c5ca0) at ../libyang-2.1.111/src/schema_compile.c:124
124 if (!ep->compiled) {
(gdb) list
119 lys_compile_extension(struct lysc_ctx *ctx, struct lysp_ext_instance *extp, struct lysc_ext **ext)
120 {
121 LY_ERR ret = LY_SUCCESS;
122 struct lysp_ext ep = extp->def;
123
124 if (!ep->compiled) {
125 lysc_update_path(ctx, NULL, "{extension}");
126 lysc_update_path(ctx, NULL, ep->name);
127
128 / compile the extension definition */
(gdb) p *extp
$1 = {
name = 0x24df1b0 "tailf-common:cli-range-list-syntax",
argument = 0x0,
format = LY_VALUE_SCHEMA,
prefix_data = 0x2508d80,
def = 0x0,
parent = 0x2508170,
parent_stmt = LY_STMT_LIST,
parent_stmt_index = 0,
flags = 0,
record = 0x0,
substmts = 0x0,
parsed = 0x0,
child = 0x0
}
(gdb) p *ext
$2 = (struct lysc_ext *) 0x0
(gdb) f 5
#5 0x00007fc57608d581 in lys_compile_uses (ctx=ctx@entry=0x7ffc526c5ca0, uses_p=uses_p@entry=0x2452490, parent=parent@entry=0x25a3a60, inherited_flags=inherited_flags@entry=0, child_set=child_set@entry=0x0) at ../libyang-2.1.111/src/schema_compile_node.c:4021
4021 rc = lys_compile_uses_children(ctx, uses_p, uses_flags, grp->child, grp_mod, parent,
(gdb) p *uses_p
$6 = {
{
node = {
parent = 0x244a880,
nodetype = 2048,
flags = 0,
next = 0x24524f0,
name = 0x24c3e30 "vlan-grouping",
dsc = 0x0,
ref = 0x0,
iffeatures = 0x0,
exts = 0x0
},
{
parent = 0x244a880,
nodetype = 2048,
flags = 0,
next = 0x24524f0,
name = 0x24c3e30 "vlan-grouping",
dsc = 0x0,
ref = 0x0,
iffeatures = 0x0,
exts = 0x0
}
},
refines = 0x0,
augments = 0x0,
when = 0x0
}
(gdb)
The text was updated successfully, but these errors were encountered: