Skip to content

Conversation

Manpreet-k0
Copy link
Contributor

BT:

3  <signal handler called>
4  0x00005616837546fc in bgp_static_update (bgp=bgp@entry=0x5616865eac50, p=0x561686639e40,
    bgp_static=0x561686639f50, afi=afi@entry=AFI_IP6, safi=safi@entry=SAFI_UNICAST) at ../bgpd/bgp_route.c:7232
5  0x0000561683754ad0 in bgp_static_add (bgp=0x5616865eac50) at ../bgpd/bgp_table.h:413
6  0x0000561683785e2e in no_bgp_network_import_check (self=<optimized out>, vty=0x5616865e04c0,
    argc=<optimized out>, argv=<optimized out>) at ../bgpd/bgp_vty.c:4609
7  0x00007fdbcc294820 in cmd_execute_command_real (vline=vline@entry=0x561686663000,

The program encountered a SEG FAULT when attempting to access pi->extra->vrfleak->bgp_orig because pi->extra->vrfleak was NULL.

(gdb) p pi->extra->vrfleak
$1 = (struct bgp_path_info_extra_vrfleak *) 0x0
(gdb) p pi->extra->vrfleak->bgp_orig
Cannot access memory at address 0x8

Added NOT NULL check on pi->extra->vrfleak before accessing pi->extra->vrfleak->bgp_orig to prevent the segmentation fault.

@frrbot frrbot bot added the bgp label Mar 14, 2025
@Manpreet-k0 Manpreet-k0 force-pushed the redo_import_check_crash branch 2 times, most recently from a7196eb to 74acf17 Compare March 14, 2025 08:23
@ton31337
Copy link
Member

In what case is this happening?

@Manpreet-k0
Copy link
Contributor Author

Manpreet-k0 commented Mar 14, 2025

we are seeing this issue (inconsistently) on executing “no bgp network import-check” command. BGP is redistributing both IPv4 and IPv6 networks

BT:
```
3  <signal handler called>
4  0x00005616837546fc in bgp_static_update (bgp=bgp@entry=0x5616865eac50, p=0x561686639e40,
    bgp_static=0x561686639f50, afi=afi@entry=AFI_IP6, safi=safi@entry=SAFI_UNICAST) at ../bgpd/bgp_route.c:7232
5  0x0000561683754ad0 in bgp_static_add (bgp=0x5616865eac50) at ../bgpd/bgp_table.h:413
6  0x0000561683785e2e in no_bgp_network_import_check (self=<optimized out>, vty=0x5616865e04c0,
    argc=<optimized out>, argv=<optimized out>) at ../bgpd/bgp_vty.c:4609
7  0x00007fdbcc294820 in cmd_execute_command_real (vline=vline@entry=0x561686663000,
```

The program encountered a SEG FAULT when attempting to access pi->extra->vrfleak->bgp_orig because
pi->extra->vrfleak was NULL.
```
(gdb) p pi->extra->vrfleak
$1 = (struct bgp_path_info_extra_vrfleak *) 0x0
(gdb) p pi->extra->vrfleak->bgp_orig
Cannot access memory at address 0x8
```
Added NOT NULL check on pi->extra->vrfleak before accessing pi->extra->vrfleak->bgp_orig
to prevent the segmentation fault.

Signed-off-by: Manpreet Kaur <manpreetk@nvidia.com>
@Manpreet-k0 Manpreet-k0 force-pushed the redo_import_check_crash branch from 74acf17 to bc1008b Compare March 14, 2025 12:40
@louis-6wind louis-6wind self-requested a review March 14, 2025 13:19
@louis-6wind
Copy link
Contributor

Commit looks OK.

Have you checked all the bgp_orig pointer accesses to make sure that the issue is not present somewhere else ?

@louis-6wind
Copy link
Contributor

And that nothing is accessed in vrfleak pointer without checking its validity ?

@Manpreet-k0
Copy link
Contributor Author

Manpreet-k0 commented Mar 14, 2025

I checked and found no issues. The bgp_orig is accessed only after confirming that vrfleak is not null at other places.

@louis-6wind
Copy link
Contributor

I checked and found no issues. The bgp_orig is accessed only after confirming that vrfleak is not null at other places.

And about other stuff like vrfleak->parent ?

@Manpreet-k0
Copy link
Contributor Author

I checked and found no issues. The bgp_orig is accessed only after confirming that vrfleak is not null at other places.

And about other stuff like vrfleak->parent ?

Found no issue in accessing any of the member of vrfleak

Copy link
Contributor

@louis-6wind louis-6wind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ton31337
Copy link
Member

@Mergifyio backport stable/10.3 stable/10.2 stable/10.1 stable/10.0

Copy link

mergify bot commented Mar 15, 2025

backport stable/10.3 stable/10.2 stable/10.1 stable/10.0

✅ Backports have been created

@ton31337 ton31337 merged commit f5a74fc into FRRouting:master Mar 15, 2025
13 checks passed
donaldsharp added a commit that referenced this pull request Mar 17, 2025
bgpd: Fixed crash upon bgp network import-check command (backport #18387)
donaldsharp added a commit that referenced this pull request Mar 17, 2025
bgpd: Fixed crash upon bgp network import-check command (backport #18387)
donaldsharp added a commit that referenced this pull request Mar 17, 2025
bgpd: Fixed crash upon bgp network import-check command (backport #18387)
donaldsharp added a commit that referenced this pull request Mar 17, 2025
bgpd: Fixed crash upon bgp network import-check command (backport #18387)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants