History log of /openbmc/libpldm/src/dsp/pdr.c (Results 1 – 21 of 21)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v0.11.0, v0.10.0, v0.9.1, v0.9.0
# bc40dd5a 02-Aug-2024 Archana Kakani <archana.kakani@ibm.com>

pdr: Fix for Entity Association PDR looping

While normalizing the Entity association PDR, record handle
is passed to the library function. Considering PDR contains
logical and physical contained ent

pdr: Fix for Entity Association PDR looping

While normalizing the Entity association PDR, record handle
is passed to the library function. Considering PDR contains
logical and physical contained entities, two pdrs with same
record handle are created.

To fix the issue, we are propagating the recently used record
handle from the pldm_pdr_add to entity_association_pdr_add.
Then incrementing the record handle before creating next PDR.

gitlint-ignore: B1, UC1
Fixes: 25ddbccfae0e ("pdr: Add pldm_entity_association_pdr_add_from_node_with_record_handle()")
Change-Id: Ifaa5694cabe7ad38d8881f0b7be0a79d9d3e06c0
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>

show more ...


# 94e2d754 12-Dec-2024 Archana Kakani <archana.kakani@ibm.com>

pdr: Handle removal of the last contained entity from EA PDR

After removing the contained entity from the entity association
PDR, if there is no other contained entity present, we need to
remove the

pdr: Handle removal of the last contained entity from EA PDR

After removing the contained entity from the entity association
PDR, if there is no other contained entity present, we need to
remove the entity association PDR.
Also modified the testcase to delete all the entities from the entity
association PDR.

Fixes: b31e4c6c4663 ("pdr: Remove contained entity from PDR repo")
Change-Id: If426314a571e91d178e8ae802a49bb7a3746080e
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>

show more ...


# ae05d5e5 11-Oct-2024 Matt Johnston <matt@codeconstruct.com.au>

dsp: pdr: Replace ENOKEY with ENOENT

Make pldm_pdr_find_child_container_id_index_range_exclude() return
ENOENT, since that is a standard errno. ENOKEY is Linux specific.

pldm_pdr_find_child_contain

dsp: pdr: Replace ENOKEY with ENOENT

Make pldm_pdr_find_child_container_id_index_range_exclude() return
ENOENT, since that is a standard errno. ENOKEY is Linux specific.

pldm_pdr_find_child_container_id_index_range_exclude() is marked as
TESTING ABI, so the change in error code should be OK.

Change-Id: I3fb3076b236e4e3b1c31f13d819dcaca38076a5d
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>

show more ...


# 8f33a1dc 11-Oct-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Rework test in pldm_entity_association_pdr_extract()

Testing on IBM's simulator[1] and bisection by Manoj
found that 9e566597d91e ("dsp: pdr: Bound check
pldm_entity_association_pdr_extrac

dsp: pdr: Rework test in pldm_entity_association_pdr_extract()

Testing on IBM's simulator[1] and bisection by Manoj
found that 9e566597d91e ("dsp: pdr: Bound check
pldm_entity_association_pdr_extract()") caused their host boot process
to come unstuck[1]:

[1]: https://gerrit.openbmc.org/c/openbmc/openbmc/+/75130/comments/fc6548ce_78285814

```
26.98655|2024/10/08 10:04:51|ISTEP 6. 5 - host_set_ipl_parms
27.02035|2024/10/08 10:04:51|ISTEP 6. 6 - host_discover_targets
27.31030|Detected new part : 00030000 (Physical:/Sys0/Node0/DIMM0)
27.64652|Detected new part : 00030004 (Physical:/Sys0/Node0/DIMM2)
29.58074|Detected new part : 00050000 (Physical:/Sys0/Node0/Proc0)
43.28986|Detected new part : 00050000 (Physical:/Sys0/Node0/Proc0)
47.49649|HWAS|---------------------------------
47.49650|HWAS|PRESENT>
47.52988|TARG|PROC=80000000
47.53612|TARG|PROC[00]:
47.53616|TARG| CORE=FF000000 DIMM=8800000000000000
47.53620|TARG| CACHE=FF000000 OCMB=C000
47.53632|TARG|PROC[01]:
47.53637|TARG| CORE=00000000 DIMM=0000000000000000
47.53641|TARG| CACHE=00000000 OCMB=0000
47.3653|TARG|PROC[02]:
47.53658|TARG| CORE=00000000 DIMM=0000000000000000
47.53662|TARG| CACHE=00000000 OCMB=0000
47.53674|TARG|PROC[03]:
47.53679|TARG| CORE=00000000 DIMM=0000000000000000
47.53683|TARG| CACHE=00000000 OCMB=0000
47.53738|WAS|---------------------------------
47.56477|devtree|Syncing to BMC
57.36060|Triggering graceful reboot fr Rebooting due to a FRU hot-remove
57.85530|================================================
57.87003|Error reprted by pldm (0x4700) EID 0x90000013
57.88170| Software problem, could not find reboot count effecter PDR.
57.88174| ModuleId 0x3e MOD_RESET_REBOOT_COUNT
57.90019| ReasonCode 0x471a RC_INVALID_EFFECTER_ID
57.90028| UserData1 The total number of PDRs that PDR Manager is aware of. : 0x00000000000001ee
57.90031| UserData2 : 0x0000000000000000
57.90034|------------------------------------------------
57.90038| Callouttype : Procedure Callout
57.90041| Procedure : EPUB_PRC_HB_CODE
57.92782| Priority : SRCI_PRIORITY_HIGH
57.92785|-----------------------------------------------
57.92788| Callout type : Procedure Callout
57.92791| Procedure : EPUB_PRC_SP_COE
57.92794| Priority : SRCI_PRIORITY_HIGH
57.92798|-----------------------------------------------
57.92801| Callout type : Procedure Callout
57.92804| Procedure : EPUB_PRC_HB_CODE
57.92808| Priority : SRCI_PRIORITY_MED
57.92811|------------------------------------------------
57.92816| Hostboot Build ID: hostboot-p11-e7437ab-sha1:997c6a7f/hbicore.bin
57.92819|================================================
59.00252|Soft poweroff requested by the BMC
```

This seems to be the result of the following from the BMC's side:

```
Oct 08 10:04:30 p10bmc pldmd[642]: Instance ID expiry for EID '9' using InstanceID '1'
Oct 08 10:04:30 p10bmc pldmd[642]: Failed to receive response for setEventReceiver command
Oct 08 10:04:32 p10bmc pldmd[642]: sdeventplus: ioCallback: Instance ID 1 for TID 9 was not previously allocated
Oct 08 10:04:32 p10bmc pldmd[642]: sdeventplus: ioCallback: Instance ID 1 for TID 9 was not previously allocated
Oct 08 10:04:32 p10bmc pldmd[642]: sdeventplus: ioCallback: Instance ID 1 for TID 9 was not previously allocated
Oct 08 10:04:32 p10bmc bmcwebd[282]: PAM unable to resolve symbol: pam_sm_acct_mgmt
Oct 08 10:04:33 p10bmc bmcwebd[282]: pam_succeed_if(webserver:auth): requirement "user ingroup redfish" was met by user "root"
Oct 08 10:04:35 p10bmc bmcwebd[282]: PAM unable to resolve symbol: pam_sm_acct_mgmt
Oct 08 10:04:35 p10bmc pldmd[642]: Checking if directory '/usr/share/pldm/pdr' exists
Oct 08 10:04:35 p10bmc pldmd[642]: Checking if directory '/usr/share/pldm/pdr/com.ibm.Hardware.Chassis.Model.Rainier4U' exists
Oct 08 10:04:35 p10bmc pldmd[642]: Failed to create sensor PDR, D-Bus object '/org/freedesktop/UPower/devices/ups_hiddev0' returned error - sd_bus_call: xyz.openbmc_project.Common.Error.ResourceNotFound: The resource is not found.
Oct 08 10:04:35 p10bmc bmcwebd[282]: pam_succeed_if(webserver:auth): requirement "user ingroup redfish" was met by user "root"
Oct 08 10:04:36 p10bmc pldmd[642]: Failed to create sensor PDR, D-Bus object '/xyz/openbmc_project/led/physical/virtual_enc_id' returned error - sd_bus_call: xyz.openbmc_project.Common.Error.ResourceNotFound: The resource is not found.
Oct 08 10:04:36 p10bmc pldmd[642]: Failed to create sensor PDR, D-Bus object '/xyz/openbmc_project/led/physical/virtual_enc_fault' returned error - sd_bus_call: xyz.openbmc_project.Common.Error.ResourceNotFound: The resource is not found.
```

Ultimately the check was trying to satisfy the following from GCC's
analyzer:

```
| 1345 | size_t l_num_entities = entity_association_pdr->num_children + 1;
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (16) ...to here
| 1346 | if (l_num_entities < 2) {
| | ~
| | |
| | (17) following ‘false’ branch (when ‘l_num_entities > 1’)...
|......
| 1354 | pldm_entity *l_entities = calloc(l_num_entities, sizeof(pldm_entity));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (18) ...to here
| | (19) use of attacker-controlled value ‘(size_t)((int)*((char *)&*pdr + 10).num_children + 1) * 6’ as size without upper-bounds checking
|
```

However, rather than the relationship to pdr_len, the issue was the
confusion from the promotion from uint8_t to size_t. Teach the analyzer
about the UINT8_MAX limit explicitly.

gitlint-ignore: UC1, B1
Fixes: 9e566597d91e ("dsp: pdr: Bound check pldm_entity_association_pdr_extract()")
Change-Id: I0c71ba3b80da2946658a4e6a3add4636752b4e74
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 36324f6b 24-Sep-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

Apply GCC's tainted_args attribute to library entrypoints

The implementation applies `__attribute__((tainted_args))` by
integrating it into the existing ABI macro annotations.

In the process, quite

Apply GCC's tainted_args attribute to library entrypoints

The implementation applies `__attribute__((tainted_args))` by
integrating it into the existing ABI macro annotations.

In the process, quite a number of APIs were discovered to be unsafe in
ways that were not immediately fixable. Often this is because they lack
arguments that enable the appropriate bounds-checking to be applied.

Redesigning them is work beyond the scope of the immediate
effort. Instead, we also introduce a new annotation,
LIBPLDM_ABI_DEPRECATED_UNSAFE, that simply lacks
`__attribute__((tainted_args))` and therefore doesn't trigger the extra
analysis.

Change-Id: Ib8994eaa3907a5432d040426ad03687cbf4c2136
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 9e566597 02-Oct-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Bound check pldm_entity_association_pdr_extract()

```
../src/dsp/pdr.c: In function ‘pldm_entity_association_pdr_extract’:
../src/dsp/pdr.c:1333:35: error: use of attacker-controlled value

dsp: pdr: Bound check pldm_entity_association_pdr_extract()

```
../src/dsp/pdr.c: In function ‘pldm_entity_association_pdr_extract’:
../src/dsp/pdr.c:1333:35: error: use of attacker-controlled value ‘(size_t)((int)*((char *)&*pdr + 10).num_children + 1) * 6’ as allocation size without upper-bounds checking [CWE-789] [-Werror=analyzer-tainted-allocation-size]
1333 | pldm_entity *l_entities = malloc(sizeof(pldm_entity) * l_num_entities);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Fixes: 9c76679224cf ("libpldm: Migrate to subproject")
Change-Id: I96582ae2b19d22413919ae0a6a9b94e2d3d40f39
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 74c9a546 13-Sep-2024 Archana Kakani <archana.kakani@ibm.com>

pdr: Improve error propagation

Enhance error propagation in
pldm_entity_association_pdr_add_from_node_with_record_handle(). Instead
of always returning 0, the function now returns the result from
en

pdr: Improve error propagation

Enhance error propagation in
pldm_entity_association_pdr_add_from_node_with_record_handle(). Instead
of always returning 0, the function now returns the result from
entity_association_pdr_add to accurately reflect success/failure.

gitlint-ignore: B1, UC1
Fixes: [25ddbccfae0e ("pdr: Add pldm_entity_association_pdr_add_from_node_with_record_handle()")
Change-Id: I4d3711e096b2a90c62a600be89a16b47e6b20f79
Signed-off-by: Archana Kakani <archana.kakani@ibm.com>

show more ...


# 60582150 22-Sep-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Add pldm_entity_association_tree_copy_root_check()

Allocations cannot be treated as infallible. Ensure that copying
the entity association tree signals failure to the caller along with
cle

dsp: pdr: Add pldm_entity_association_tree_copy_root_check()

Allocations cannot be treated as infallible. Ensure that copying
the entity association tree signals failure to the caller along with
cleaning up after itself to avoid leaking memory.

Change-Id: Icfd255b45530e42a6a3a0a3205e665eed53708d1
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 05507773 22-Sep-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Open-code next_container_id() at its callsite

There was only one invocation. Open-code the implementation so its
easier to understand the assertion should never fire.

Change-Id: I8963c3e1

dsp: pdr: Open-code next_container_id() at its callsite

There was only one invocation. Open-code the implementation so its
easier to understand the assertion should never fire.

Change-Id: I8963c3e15afa85f8bc5457b6cd94a272f408b48a
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 890d37a3 22-Sep-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Apply LIBPLDM_CC_NONNULL to reduce assert()s

The PDR API implementations are in a bit of a state. Reduce the use of
asserts to highlight the more egregious ones.

Again adjusting some asse

dsp: pdr: Apply LIBPLDM_CC_NONNULL to reduce assert()s

The PDR API implementations are in a bit of a state. Reduce the use of
asserts to highlight the more egregious ones.

Again adjusting some assert behavior has impacted the ABI as
measured by abi-compliance-checker. pldm_pdr_find_record() and
pldm_pdr_get_next_record() are both affected, with changes to the
registers assigned for parameter-passing.

Change-Id: I7797217dac76afcf7a9df7519d9d2aa394d3b5dd
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 5c49f162 22-Sep-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

meson: Ban variable length arrays

Caller-controlled sizes for variable length arrays are bad for the
reasons outlined in the SEI CERT C Coding Standard[1]

Enable -Wvla to prevent future use.

[1]:

meson: Ban variable length arrays

Caller-controlled sizes for variable length arrays are bad for the
reasons outlined in the SEI CERT C Coding Standard[1]

Enable -Wvla to prevent future use.

[1]: https://wiki.sei.cmu.edu/confluence/display/c/MEM05-C.+Avoid+large+stack+allocations

Change-Id: Id587bd1432255cff11b419cb5a7f454fc64e2054
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 8b53ad9d 15-Jun-2024 Varsha Kaverappa <vkaverap@in.ibm.com>

pdr: Remove PDR record by record set identifier

API to remove a record from a PLDM PDR repository if it is
of type FRU record set identifier and if it matches given
record set identifier. Record han

pdr: Remove PDR record by record set identifier

API to remove a record from a PLDM PDR repository if it is
of type FRU record set identifier and if it matches given
record set identifier. Record handle of the PDR where this
entity is found is saved and will be required to update PDR
repo by removing the entry corresponding to this entity
in the PDR table. Also the Node associated with this pldm
entity is deleted from PDR tree.

Change-Id: I24606c4d75ff64864f4aa95d8b2341b8911a7ff8
Signed-off-by: Varsha Kaverappa <vkaverap@in.ibm.com>

show more ...


# b31e4c6c 25-Jun-2024 Varsha Kaverappa <vkaverap@in.ibm.com>

pdr: Remove contained entity from PDR repo

API to remove a contained entity from an entity association PDR. This
API saves record handle of the PLDM PDR record where the contained
entity is found. T

pdr: Remove contained entity from PDR repo

API to remove a contained entity from an entity association PDR. This
API saves record handle of the PLDM PDR record where the contained
entity is found. The record handle we get from this API will be
required to update PDR repo by removing the entry corresponding to
this entity in the PDR table. Also the Node associated with this pldm
entity is deleted from PDR tree. The PLDM PDR record which holds the
contained entity to be removed is found with the parent entity
properties sent to this API as input.

Tested By: Unit tested by removing entities from PDR repo

Change-Id: I55fb898a0e67d8c9cd95594b4ec6a6a4866c9531
Signed-off-by: Varsha Kaverappa <vkaverap@in.ibm.com>

show more ...


# 860a43d9 22-Aug-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

compiler: Provide LIBPLDM_CC_UNUSED

Ensure that we have __has_attribute available, and then further
ensure that the unused attribute is provided. Once satisfied, define
LIBPDLM_CC_UNUSED and replace

compiler: Provide LIBPLDM_CC_UNUSED

Ensure that we have __has_attribute available, and then further
ensure that the unused attribute is provided. Once satisfied, define
LIBPDLM_CC_UNUSED and replace raw use of __attribute__((unused)).

Change-Id: I2433039297d5fdedb8b8d99b30e73e4542d9069f
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# aa49b71f 24-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Rename pldm_entity_association_pdr_add_from_node_check()

Introduce pldm_entity_association_pdr_add_from_node(), deprecate
pldm_entity_association_pdr_add_from_node_check(), add the rename

dsp: pdr: Rename pldm_entity_association_pdr_add_from_node_check()

Introduce pldm_entity_association_pdr_add_from_node(), deprecate
pldm_entity_association_pdr_add_from_node_check(), add the rename
configuration and apply it.

Change-Id: Id4f20365115977810491e8feb465042e51e3a267
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# d72ea4b8 24-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Rename pldm_entity_association_pdr_add_check()

Introduce pldm_entity_association_pdr_add(), deprecate
pldm_entity_association_pdr_add_check(), add the rename configuration
and then apply i

dsp: pdr: Rename pldm_entity_association_pdr_add_check()

Introduce pldm_entity_association_pdr_add(), deprecate
pldm_entity_association_pdr_add_check(), add the rename configuration
and then apply it.

One quirk this time around is that we had forgotten to remove the
declaration of pldm_entity_association_pdr_add() from the header when we
removed its implementation. Clean this issue up as well, as it's
necessary to avoid the type conflict.

Change-Id: Id8e61c817017dd7caefa9fd7b2bc59ee0f1f6721
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# e7f55113 20-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Rename pldm_pdr_add_fru_record_set_check()

Drop the `_check` suffix so it is now `pldm_pdr_add_fru_record_set()`,
and run `apply-renames` to update any internal references.

Change-Id: Iaa

dsp: pdr: Rename pldm_pdr_add_fru_record_set_check()

Drop the `_check` suffix so it is now `pldm_pdr_add_fru_record_set()`,
and run `apply-renames` to update any internal references.

Change-Id: Iaaa452269caa47369c80b43bf65f30d2a004ec66
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# fae3641d 20-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: pdr: Rename pldm_pdr_add_check()

Drop the `_check` suffix so it is now `pldm_pdr_add()`.

Change-Id: I9b32317f99a89acbe1cc0510380cd26badd145d6
Signed-off-by: Andrew Jeffery <andrew@codeconstruc

dsp: pdr: Rename pldm_pdr_add_check()

Drop the `_check` suffix so it is now `pldm_pdr_add()`.

Change-Id: I9b32317f99a89acbe1cc0510380cd26badd145d6
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 274732fc 05-Jul-2024 Pavithra Barithaya <pavithrabarithaya07@gmail.com>

pdr: Add pldm_pdr_get_terminus_handle() API

Adds a new libpldm API to get the terminus handle of the
particular record given as input from the PDR repo.

Change-Id: I3694cc3974a564296f4584b70de7d6d1

pdr: Add pldm_pdr_get_terminus_handle() API

Adds a new libpldm API to get the terminus handle of the
particular record given as input from the PDR repo.

Change-Id: I3694cc3974a564296f4584b70de7d6d1dad2a866
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>

show more ...


# 9e3a5d45 17-Jun-2024 Manojkiran Eda <manojkiran.eda@gmail.com>

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://githu

Fix spelling mistakes using codespell

This commit corrects various spelling mistakes throughout the
repository. The corrections were made automatically using `codespell`[1]
tool.

[1]: https://github.com/codespell-project/codespell

Change-Id: I25415165df192cfc3bd1405aca81bfa5bf2f7a63
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>

show more ...


# 48761c62 03-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

libpldm: Reorganize source and test files

Primarily this is about moving specification-specific files into
'dsp/' (in the "DMTF Standard Publication" sense[1]) subdirectories of
both src/ and tests/

libpldm: Reorganize source and test files

Primarily this is about moving specification-specific files into
'dsp/' (in the "DMTF Standard Publication" sense[1]) subdirectories of
both src/ and tests/.

[1]: https://www.dmtf.org/sites/default/files/standards/documents/DSP4014_2.14.0.pdf

libpldm is a concrete C implementation of the PLDM family of
specifications. This invokes some accidental complexity[2] such as the
msgbuf APIs and other concerns.

[2]: https://en.wikipedia.org/wiki/No_Silver_Bullet

Separate the essential complexity (everything under the dsp/
subdirectories) from the accidental complexity (almost everything else).

While doing so, I took the opportunity to drop the 'libpldm_' prefix
and '_test' suffix from a variety of tests. The 'libpldm_' prefix is a
hangover from the days when libpldm was a subproject of OpenBMC's pldm
repo. The '_test' suffix feels redundant given the parent directory
path.

Note that we maintain separation of the src/ and tests/. The test suite
is implemented in C++ while libpldm's APIs are declared and defined in
C. The ability to chop all the tests and C++ out of the implementation
by ignoring a subtree seems like a desirable property when vendoring the
library into other projects.

Finally, update the x86_64 GCC ABI dump, as rearranging the source
causes a lot of churn in its definitions.

Change-Id: Icffcc6cf48b3101ecd38168827c0a81cffb8f083
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...