gnbsim icon indicating copy to clipboard operation
gnbsim copied to clipboard

gNBSim crashes upon receiving NAS Configuration update command

Open yoursunny opened this issue 1 year ago • 10 comments

After UE registration, if the core network sends a NAS PDU with Message type: Configuration update command (0x54), gNBSim process crashes with a fatal error. Packet capture and gNBSim logs: gnbsim54.zip

The offending packet was generated by Open5GCore and looks like this:

NG Application Protocol (DownlinkNASTransport)
    NGAP-PDU: initiatingMessage (0)
        initiatingMessage
            procedureCode: id-DownlinkNASTransport (4)
            criticality: ignore (1)
            value
                DownlinkNASTransport
                    protocolIEs: 3 items
                        Item 0: id-AMF-UE-NGAP-ID
                        Item 1: id-RAN-UE-NGAP-ID
                        Item 2: id-NAS-PDU
                            ProtocolIE-Field
                                id: id-NAS-PDU (38)
                                criticality: reject (0)
                                value
                                    NAS-PDU: 7e0232960dbd027e0054431510004f00700065006e003500470063006f00720065450910006f0035004700634742105241529000
                                        Non-Access-Stratum 5GS (NAS)PDU
                                            Security protected NAS 5GS message
                                            Plain NAS 5GS Message
                                                Extended protocol discriminator: 5G mobility management messages (126)
                                                0000 .... = Spare Half Octet: 0
                                                .... 0000 = Security header type: Plain NAS message, not security protected (0)
                                                Message type: Configuration update command (0x54)
                                                Network Name - Full name for network
                                                Network Name - Short Name
                                                Time Zone and Time - Universal Time and Local Time Zone

gNBSim log: (84 is decimal of 0x54)

time="2024-01-25T14:25:09Z" level=info msg="Received Message Type: 84" category=RealUe component=GNBSIM supi=imsi-001017005551000
time="2024-01-25T14:25:09Z" level=fatal msg="Invalid Event ID: 0x2000054" category=App component=GNBSIM

yoursunny avatar Jan 25 '24 14:01 yoursunny

Thanks for nice bug report @yoursunny . I shall provide the fix, but due to lack of setup I may not be able to verify it. But please expect some update in coming days.

thakurajayL avatar Jan 25 '24 16:01 thakurajayL

https://github.com/omec-project/gnbsim/blob/0cca26603b562d13f830dccf5c24f40201e5b861/common/events.go#L245

replace with Panicf maybe ok

Fatalf will call Logger.Exit(1)

lrh3321 avatar Mar 07 '24 02:03 lrh3321

This issue has been stale for 30 days and will be closed in 5 days. Comment to keep it open.

onf-bot avatar Apr 07 '24 00:04 onf-bot

https://fvsch.com/stale-bots

yoursunny avatar Apr 07 '24 00:04 yoursunny

Let us keep this open and we should see how we can reproduce this and identify possible solution. Thanks.

ajaythakurintel avatar Apr 08 '24 13:04 ajaythakurintel

Let us keep this open and we should see how we can reproduce this and identify possible solution. Thanks.

Hi @thakurajayL, the crash is because "Configuration update command" (0x54) is not currently handled in gNBSim (https://github.com/omec-project/gnbsim/blob/main/common/events.go#L106) and if message is not handled gNBSim crashes due to logger.AppLog.Fatalf("Invalid Event ID: %#v", id) (https://github.com/omec-project/gnbsim/blob/main/common/events.go#L245)

gab-arrobo avatar Apr 08 '24 15:04 gab-arrobo

@thakurajayL, FYI, I still need to open a PR to update the "days before mark/close" in the Stale action to increase it as agreed on the TST. I have been running a few tests before making the change/update

gab-arrobo avatar Apr 08 '24 15:04 gab-arrobo

It seems that free5GC v3.4.1 is also sending NAS Configuration update command. Therefore, gNBSim is no longer compatible with free5GC.

yoursunny avatar Apr 16 '24 13:04 yoursunny

When this is planned to be addressed?

mangeshdube avatar Apr 21 '24 22:04 mangeshdube

Can you uuse this one and see if it does not crash - https://github.com/omec-project/gnbsim/pull/164 ?

I need to add code to send response as well.

thakurajayL avatar Apr 22 '24 02:04 thakurajayL

close by #164

gab-arrobo avatar Jun 26 '24 03:06 gab-arrobo