ipmi-lite: Fix IPMI SEL rollover (Record ID 0 collision with SEL_RECID_FIRST)#274
Open
louis-nexthop wants to merge 1 commit into
Open
ipmi-lite: Fix IPMI SEL rollover (Record ID 0 collision with SEL_RECID_FIRST)#274louis-nexthop wants to merge 1 commit into
louis-nexthop wants to merge 1 commit into
Conversation
Signed-off-by: Louis Maliyam <louis@nexthop.ai>
|
This pull request has been imported. If you are a Meta employee, you can view this in D108252417. (Because this pull request was imported automatically, there will not be any future comments.) |
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.
Description
Fixes #273
Context
IPMI Specification: https://www.intel.la/content/dam/www/public/us/en/documents/specification-updates/ipmi-intelligent-platform-mgt-interface-spec-2nd-gen-v2-0-spec-update.pdf
The standard IPMI SEL "iterator" protocol
An IPMI client (e.g.
ipmitool sel list) walks the log by:Get SEL Entrywithread_rec_id = 0x0000 (SEL_RECID_FIRST).next_rec_id.Get SEL Entrywithread_rec_id = next_rec_id.next_rec_id == 0xFFFF (SEL_RECID_LAST).What was done
Fix
indexandrecord IDcalculations insel_get_entry()andsel_add_entry(), so they are consistent with these conventions from the specs:indexis 0-indexed.record IDis 1-indexed.record ID = 0x0000 (SEL_RECID_FIRST)is reserved with a special meaning for access command (GET FIRST ENTRY; "give me the first record")record ID = 0xFFFF (SEL_RECID_LAST)is reserved with a special meaning for access command (GET LAST ENTRY; "give me the last record")g_sel_hdr[node].beginis the first index of the bufferg_sel_hdr[node].endis the next empty slot of the bufferMotivation
The rollover logic had a flaw.
sel.cused Record ID0x0000which should be reserved.After ring-buffer rollover, ipmitool's
Get SEL Entrychain hit a*next_rec_id = 0(post-wrap), re-issuedGet SEL Entry(0), andsel_get_entry()returned the first record again — infinite loop, broken by ipmitool's cycle-detection. Symptom: host'sipmitool sel listcollapsed to a single row after rollover.Test Plan
Before:
After (flash BMC with a new image):