Fix Y2K38: Comprehensive 2038 timestamp overflow fixes across submodules#3
Open
devin-ai-integration[bot] wants to merge 15 commits intomasterfrom
Open
Fix Y2K38: Comprehensive 2038 timestamp overflow fixes across submodules#3devin-ai-integration[bot] wants to merge 15 commits intomasterfrom
devin-ai-integration[bot] wants to merge 15 commits intomasterfrom
Conversation
This commit addresses the Y2K38 (2038 timestamp overflow) issue by adding compile-time assertions to ensure the system is using 64-bit time_t. Changes: - Added include/iccp_time.h with: - _Static_assert to verify sizeof(time_t) >= 8 - Y2K38 boundary constants - Helper functions for Y2K38-safe time operations - Updated include/iccp_csm.h to include the new iccp_time.h header The CSM struct uses time_t for several timestamp fields (connTimePrev, heartbeat_send_time, heartbeat_update_time, peer_warm_reboot_time, etc.). On 64-bit Linux systems, time_t is already 64-bit. This change adds compile-time verification to catch any 32-bit builds that would be vulnerable to Y2K38 overflow. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
This commit addresses the Y2K38 (2038 timestamp overflow) issue by changing the auth history timestamp parameter from 32-bit to 64-bit. Changes: - authmgr/common/auth_mgr_api.h: Changed authmgrAuthHistoryLogTimestampGet() pTimeStamp parameter from uint32* to uint64* This ensures that authentication history timestamps can correctly represent dates beyond January 19, 2038. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
This commit addresses the Y2K38 (2038 timestamp overflow) issue by adding a compile-time assertion to verify that time_t is at least 64-bit. Changes: - Added patch/0098-SONiC-ONLY-Y2K38-Add-compile-time-check-for-64-bit-time_t.patch - Updated patch/series to include the new patch FRR uses time_t extensively for timestamps in routing protocols (BGP, ISIS, OSPF, etc.). This compile-time check ensures that FRR is built on a system with 64-bit time_t support, preventing timestamp overflow on January 19, 2038. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
This commit adds a comprehensive test suite to verify Y2K38 fixes across all sonic-buildimage submodules. Tests include: - Compile-time checks for 64-bit time_t - Timestamp arithmetic beyond 2038 boundary - Epoch extension logic for 32-bit hardware timestamps - Submodule-specific tests verifying Y2K38 fixes are in place Run with: python3 tests/y2k38/run_all_y2k38_tests.py Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Updated submodules to include Y2K38 (2038 timestamp overflow) fixes: - sonic-wpa-supplicant: Changed os_time_t to 64-bit - sonic-stp: Changed timer and timestamp types to 64-bit - sonic-platform-common: Added epoch extension logic for 32-bit hardware timestamps - sonic-sairedis: Changed FDB timestamp to 64-bit Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Added unit tests to verify Y2K38 fixes work correctly: - src/iccpd/tests/test_y2k38.c: 10 tests verifying time_t is 64-bit, timestamp arithmetic, CSM heartbeat timestamps, and warm reboot timestamps - src/sonic-pac/authmgr/tests/test_y2k38.c: 10 tests verifying uint64 timestamp storage, auth history log timestamps, and timestamp ordering - tests/y2k38/run_all_y2k38_tests.py: Updated with instructions for running all Y2K38 tests across submodules Run instructions: - iccpd: cd src/iccpd/tests && gcc -I../include -o test_y2k38 test_y2k38.c && ./test_y2k38 - sonic-pac: cd src/sonic-pac/authmgr/tests && gcc -o test_y2k38 test_y2k38.c && ./test_y2k38 Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
The patch context was incorrect - updated to match the actual lib/libfrr.h file structure in FRR 10.4.1 where includes are different from the original patch context. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Owner
|
test gh input, you do not need to action on this |
Generated patch using git format-patch to ensure proper format with: - Correct commit hash in From line - Proper index line with git blob hashes - Correct context matching FRR 10.4.1 lib/libfrr.h The patch now applies cleanly with both git apply and stg import. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Changed From: email from GitHub bot format to simple email format. stg import doesn't accept email addresses with + and [bot] characters. Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
…back" This reverts commit e67b365.
Co-Authored-By: Arthur Poon <arthur.poon@windsurf.com>
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
This PR addresses the Y2K38 (Year 2038) timestamp overflow problem across multiple SONiC components. The Y2K38 problem occurs when 32-bit signed integers used to store Unix timestamps overflow on January 19, 2038 at 03:14:07 UTC (value 2147483647).
Without this fix, various SONiC components will malfunction after 2038 due to timestamp overflow in timers, authentication logs, FDB entries, and routing protocol timestamps.
Work item tracking
How I did it
Added Y2K38 fixes across multiple components:
iccp_time.hheader with compile-time assertion ensuringtime_tis 64-bit0098-SONiC-ONLY-Y2K38-Add-compile-time-check-for-64-bit-time_t.patchto verify 64-bit time_t at compile timeauthmgrAuthHistoryLogTimestampGet()parameter fromuint32*touint64*os_time_tfromlongtoint64_tm_timestampfromuint32_ttouint64_ttests/y2k38/run_all_y2k38_tests.pyto verify Y2K38 fixesUpdates since last revision
Fixed FRR patch application failure:
lib/libfrr.h: patch does not applybecause the patch context didn't match FRR 10.4.1's actual file structurehook.h,northbound.h) instead of incorrect context (sigevent.h,vector.h)git apply --checkPreviously added:
src/iccpd/tests/test_y2k38.c: 10 tests verifying time_t size, Y2K38 boundary handling, timestamp arithmeticsrc/sonic-pac/authmgr/tests/test_y2k38.c: 10 tests verifying uint64 timestamp storagetests/y2k38/run_all_y2k38_tests.pywith detailed instructions for running all Y2K38 testsHow to verify it
Run the Y2K38 integration test suite:
Run individual component tests (requires build environment):
Build the image and verify compile-time assertions pass
Review the linked submodule PRs for detailed changes
Review Checklist for Human
Verify patch applies cleanlyFixed - patch context updated to match FRR 10.4.1authmgrAuthHistoryLogTimestampGet()and verify they handleuint64*correctly_Static_assert(sizeof(time_t) >= 8)will fail on 32-bit systems - confirm this is acceptablesrc/iccpd/tests/test_y2k38.candsrc/sonic-pac/authmgr/tests/test_y2k38.ccompile without errorsWhich release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Add Y2K38 (2038 timestamp overflow) fixes across iccpd, sonic-frr, sonic-pac, and multiple submodules by changing 32-bit timestamp types to 64-bit, with comprehensive unit tests.
Link to config_db schema for YANG module changes
N/A - no YANG model changes
A picture of a cute animal (not mandatory but encouraged)
Link to Devin run: https://cisco-demo.devinenterprise.com/sessions/712e69b033404428ae768b2fdd2fb130
Requested by: Arthur Poon (@arthurkkp-cog)