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

keychain.c crash when adding new keychain #15707

Closed
2 tasks done
donaldsharp opened this issue Apr 8, 2024 · 1 comment · Fixed by #15771
Closed
2 tasks done

keychain.c crash when adding new keychain #15707

donaldsharp opened this issue Apr 8, 2024 · 1 comment · Fixed by #15771
Labels

Comments

@donaldsharp
Copy link
Member

Description

Adding this config:


!
key chain mypass
 key 1
  cryptographic-algorithm hmac-sha-256
  key-string fsdfsdfsdfsdgsdg
 exit
exit

to frr.conf and then loading it with vtysh -b -n causes rip/ospf/pim/eigrp to crash with this stack trace:

(gdb) bt
#0  0x00007ffff7cd5198 in key_lookup (keychain=0x0, index=1) at lib/keychain.c:118
#1  0x00007ffff7cdc4d3 in key_chains_key_chain_key_crypto_algorithm_modify (args=0x7fffffff96f0) at lib/keychain_nb.c:551
#2  0x00007ffff7d0cfb4 in nb_callback_modify (context=0x7fffffff9c90, nb_node=0x5555556f4580, event=NB_EV_VALIDATE, dnode=0x5555557d0e20, resource=0x0, 
    errmsg=0x7fffffff9d90 "", errmsg_len=8192) at lib/northbound.c:1313
#3  0x00007ffff7d0defc in nb_callback_configuration (context=0x7fffffff9c90, event=NB_EV_VALIDATE, change=0x5555557d1680, errmsg=0x7fffffff9d90 "", 
    errmsg_len=8192) at lib/northbound.c:1666
#4  0x00007ffff7d0c3f8 in nb_candidate_validate_code (context=0x7fffffff9c90, candidate=0x5555556ad8f0, changes=0x7fffffff9ca0, errmsg=0x7fffffff9d90 "", 
    errmsg_len=8192) at lib/northbound.c:1021
#5  0x00007ffff7d0c67d in nb_candidate_commit_prepare (context=..., candidate=0x5555556ad8f0, comment=0x0, transaction=0x7fffffff9d30, skip_validate=false, 
    ignore_zero_change=false, errmsg=0x7fffffff9d90 "", errmsg_len=8192) at lib/northbound.c:1092
#6  0x00007ffff7d0c92c in nb_candidate_commit (context=..., candidate=0x5555556ad8f0, save_transaction=true, comment=0x0, transaction_id=0x0, 
    errmsg=0x7fffffff9d90 "", errmsg_len=8192) at lib/northbound.c:1156
#7  0x00007ffff7d13a9e in nb_cli_classic_commit (vty=0x5555557c78d0) at lib/northbound_cli.c:51
#8  0x00007ffff7d13c5e in nb_cli_pending_commit_check (vty=0x5555557c78d0) at lib/northbound_cli.c:90
#9  0x00007ffff7c9bb90 in cmd_execute_command_real (vline=0x5555556ff500, vty=0x5555557c78d0, cmd=0x0, up_level=0) at lib/command.c:999
#10 0x00007ffff7c9bd26 in cmd_execute_command (vline=0x5555556ff500, vty=0x5555557c78d0, cmd=0x0, vtysh=0) at lib/command.c:1061
#11 0x00007ffff7c9c2d6 in cmd_execute (vty=0x5555557c78d0, cmd=0x5555557ce0a0 " exit\n", matched=0x0, vtysh=0) at lib/command.c:1227
#12 0x00007ffff7d6832d in vty_command (vty=0x5555557c78d0, buf=0x5555557ce0a0 " exit\n") at lib/vty.c:600
#13 0x00007ffff7d6a251 in vty_execute (vty=0x5555557c78d0) at lib/vty.c:1363
#14 0x00007ffff7d6c97d in vtysh_read (thread=0x7fffffffe350) at lib/vty.c:2358
#15 0x00007ffff7d60f04 in event_call (thread=0x7fffffffe350) at lib/event.c:2011
#16 0x00007ffff7ce0ba7 in frr_run (master=0x5555555aae30) at lib/libfrr.c:1217
#17 0x0000555555577fca in main (argc=5, argv=0x7fffffffe5a8, envp=0x7fffffffe5d8) at eigrpd/eigrp_main.c:225
(gdb) ```




### Version

```text
This was introduced by this commit:
sharpd@eva ~/frr5 ((4caffbda…)|BISECTING)> git bisect bad
4caffbda8e6c690dc185b3740b203c2fa54e465e is the first bad commit
commit 4caffbda8e6c690dc185b3740b203c2fa54e465e
Author: Christian Hopps <chopps@labn.net>
Date:   Sat Feb 24 05:48:40 2024 -0500

    lib: add keychain northbound support
    
    Signed-off-by: Christian Hopps <chopps@labn.net>

How to reproduce

run mgmtd/zebra/eigrp( or rip or ospf or pim ) by hand then initiate a vtysh -b -n. Or you can just startup FRR as per normal with the above config snippet in frr.conf

Expected behavior

NO CRASHIE NO WHAMMY

Actual behavior

CRASHIE

Additional context

I like cats

Checklist

  • I have searched the open issues for this bug.
  • I have not included sensitive information in this report.
@donaldsharp donaldsharp added the triage Needs further investigation label Apr 8, 2024
@ton31337 ton31337 added bug and removed triage Needs further investigation labels Apr 15, 2024
idryzhov added a commit to idryzhov/frr that referenced this issue Apr 16, 2024
Operational data should not be used on validation stage. Move the usage
to apply stage only.

Fixes FRRouting#15707.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
@idryzhov
Copy link
Contributor

Should be fixed by #15771

mergify bot pushed a commit that referenced this issue Apr 17, 2024
Operational data should not be used on validation stage. Move the usage
to apply stage only.

Fixes #15707.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 5f018a3)

# Conflicts:
#	lib/keychain_nb.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants