History log of /openbmc/libpldm/src/dsp/bios_table.c (Results 1 – 22 of 22)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v0.11.0, v0.10.0
# 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 ...


# 21cb052b 04-Oct-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Bounds check pldm_bios_table_string_entry_encode()

```
../src/dsp/bios_table.c:82:9: error: use of attacker-controlled value ‘str_length’ as size without upper-bounds checking [CWE-

dsp: bios_table: Bounds check pldm_bios_table_string_entry_encode()

```
../src/dsp/bios_table.c:82:9: error: use of attacker-controlled value ‘str_length’ as size without upper-bounds checking [CWE-129] [-Werror=analyzer-tainted-size]
82 | memcpy(string_entry->name, str, str_length);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

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

show more ...


# 92967bed 02-Oct-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Bounds check pldm_bios_table_attr_value_entry_encode_enum()

```
../src/dsp/bios_table.c: In function ‘pldm_bios_table_attr_value_entry_encode_enum’:
../src/dsp/bios_table.c:711:17:

dsp: bios_table: Bounds check pldm_bios_table_attr_value_entry_encode_enum()

```
../src/dsp/bios_table.c: In function ‘pldm_bios_table_attr_value_entry_encode_enum’:
../src/dsp/bios_table.c:711:17: error: use of attacker-controlled value ‘count’ as size without upper-bounds checking [CWE-129] [-Werror=analyzer-tainted-size]
711 | memcpy(&table_entry->value[1], handles, count);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

gitlint-ignore: T1, B1
Change-Id: Ie8073f6d19ad3c249160c675f36d73dc83afb198
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


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

dsp: bios_table: Bounds check pldm_bios_table_attr_value_entry_encode_string()

```
../src/dsp/bios_table.c: In function ‘pldm_bios_table_attr_value_entry_encode_string’:
../src/dsp/bios_table.c:773:

dsp: bios_table: Bounds check pldm_bios_table_attr_value_entry_encode_string()

```
../src/dsp/bios_table.c: In function ‘pldm_bios_table_attr_value_entry_encode_string’:
../src/dsp/bios_table.c:773:17: error: use of attacker-controlled value ‘str_length’ as size without upper-bounds checking [CWE-129] [-Werror=analyzer-tainted-size]
773 | memcpy(table_entry->value + sizeof(str_length), str,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
774 | str_length);
| ~~~~~~~~~~~
```

gitlint-ignore: T1, B1
Change-Id: I836566b6148443d4653b44adb25cc1c277f9028e
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


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

dsp: bios_table: Bounds check pldm_bios_table_append_pad_checksum()

```
../src/dsp/bios_table.c: In function ‘checksum_append’:
../src/dsp/bios_table.c:905:9: error: use of attacker-controlled value

dsp: bios_table: Bounds check pldm_bios_table_append_pad_checksum()

```
../src/dsp/bios_table.c: In function ‘checksum_append’:
../src/dsp/bios_table.c:905:9: error: use of attacker-controlled value ‘*size’ as offset without upper-bounds checking [CWE-823] [-Werror=analyzer-tainted-offset]
905 | memcpy(table_end, &checksum, sizeof(checksum));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

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

show more ...


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

dsp: bios_table: Tidy up pldm_bios_table_pad_checksum_size()

There was no need for the intermediate variable, and the comment isn't
informative enough for it to remain.

Change-Id: I82881bb49703e08c

dsp: bios_table: Tidy up pldm_bios_table_pad_checksum_size()

There was no need for the intermediate variable, and the comment isn't
informative enough for it to remain.

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

show more ...


# 72dd2dda 02-Oct-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Branchless implementation of pad_size_get()

This is a minor logic cleanup. The equivalence can be tested as follows:

```python
>>> def pad0(x): return (4 - x % 4) if (x % 4) != 0 e

dsp: bios_table: Branchless implementation of pad_size_get()

This is a minor logic cleanup. The equivalence can be tested as follows:

```python
>>> def pad0(x): return (4 - x % 4) if (x % 4) != 0 else 0
...
>>> def pad1(x): return (4 - (x % 4)) % 4
...
>>> for i in range(0, 5):
... print("{}: {} == {} ? {}".format(i, pad0(i), pad1(i), pad0(i) == pad1(i)))
...
0: 0 == 0 ? True
1: 3 == 3 ? True
2: 2 == 2 ? True
3: 1 == 1 ? True
4: 0 == 0 ? True
```

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

show more ...


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

dsp: bios_table: Null check for pldm_bios_table_iter_is_end()

GCC's -fanalyzer identified the following:

```
In file included from ../tests/dsp/bios_table_iter.c:15:
../src/dsp/bios_table.c: In fun

dsp: bios_table: Null check for pldm_bios_table_iter_is_end()

GCC's -fanalyzer identified the following:

```
In file included from ../tests/dsp/bios_table_iter.c:15:
../src/dsp/bios_table.c: In function ‘pldm_bios_table_iter_is_end’:
../src/dsp/bios_table.c:991:17: error: dereference of NULL ‘iter’ [CWE-476] [-Werror=analyzer-null-dereference]
991 | if (iter->table_len - iter->current_pos <= pad_and_check_max) {
| ~~~~^~~~~~~~~~~
```

As a safety measure, return true to indicate the end of the iterator if
the iterator is null.

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

show more ...


Revision tags: v0.9.1, v0.9.0
# d8bb75cb 29-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_append_pad_checksum_check()

Introduce pldm_bios_table_append_pad_checksum(), deprecate
pldm_bios_table_append_pad_checksum_check(), add rename configuration
a

dsp: bios_table: Rename pldm_bios_table_append_pad_checksum_check()

Introduce pldm_bios_table_append_pad_checksum(), deprecate
pldm_bios_table_append_pad_checksum_check(), add rename configuration
and apply it.

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

show more ...


# 504dd17f 29-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_integer_check()

Introduce pldm_bios_table_attr_value_entry_encode_integer(), deprecate
pldm_bios_table_attr_value_entry_encode_integer

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_integer_check()

Introduce pldm_bios_table_attr_value_entry_encode_integer(), deprecate
pldm_bios_table_attr_value_entry_encode_integer_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I7832752518592e69f8d64ac57d2724345b096729
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 1a3983ce 29-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_string_check()

Introduce pldm_bios_table_attr_value_entry_encode_string(), deprecate
pldm_bios_table_attr_value_entry_encode_string_ch

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_string_check()

Introduce pldm_bios_table_attr_value_entry_encode_string(), deprecate
pldm_bios_table_attr_value_entry_encode_string_check, add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I7f785aca80a8115bc5e6c60be40ac23ac3e322f1
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 09004d6a 29-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_enum_check()

Introduce pldm_bios_table_attr_value_entry_encode_enum(), deprecate
pldm_bios_table_attr_value_entry_encode_enum_check(),

dsp: bios_table: Rename pldm_bios_table_attr_value_entry_encode_enum_check()

Introduce pldm_bios_table_attr_value_entry_encode_enum(), deprecate
pldm_bios_table_attr_value_entry_encode_enum_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I8fe0da169b9acc919d01ba024503e72fd2792d4e
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 5347e279 29-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_integer_encode_check()

Introduce pldm_bios_table_attr_entry_integer_encode(), deprecate
pldm_bios_table_attr_entry_integer_encode_check(), add rena

dsp: bios_table: Rename pldm_bios_table_attr_entry_integer_encode_check()

Introduce pldm_bios_table_attr_entry_integer_encode(), deprecate
pldm_bios_table_attr_entry_integer_encode_check(), add rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I4ad074babfa33e661cb5b0791cc539453dbd27c7
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# c668ffce 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_string_decode_def_string_length_check()

Introduce
pldm_bios_table_attr_entry_string_decode_def_string_length(), deprecate
pldm_bios_table_attr_entr

dsp: bios_table: Rename pldm_bios_table_attr_entry_string_decode_def_string_length_check()

Introduce
pldm_bios_table_attr_entry_string_decode_def_string_length(), deprecate
pldm_bios_table_attr_entry_string_decode_def_string_length_check(), add
the rename configuration and apply it.

As a consequence clang-tidy detected the following, though it's unclear
why it was not detected previously:

```
clang-tidy-17 -export-fixes /tmp/tmpf4lalo2j/tmpkiyu1sgy.yaml -p=/home/andrew/src/openbmc.org/openbmc/libpldm/origin/build1qcxy8ww -quiet /home/andrew/src/openbmc.org/openbmc/libpldm/origin/src/dsp/bios_table.c
../src/dsp/bios_table.c:460:2: error: Null pointer passed to 2nd parameter expecting 'nonnull' [clang-analyzer-core.NonNullParamChecker,-warnings-as-errors]
460 | memcpy(buffer, fields->def_string, length);
| ^ ~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: Assuming the condition is true
457 | length = length < (size - 1) ? length : (size - 1);
| ^~~~~~~~~~~~~~~~~~~
../src/dsp/bios_table.c:457:11: note: '?' condition is true
../src/dsp/bios_table.c:460:2: note: Null pointer passed to 2nd parameter expecting 'nonnull'
460 | memcpy(buffer, fields->def_string, length);
| ^ ~~~~~~~~~~~~~~~~~~
```

gitlint-ignore: T1, B1
Change-Id: Ic390e00f520cb3d5e479604b34939cefd09e9448
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# f6be4933 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_string_encode_check()

Introduce pldm_bios_table_attr_entry_string_encode(), deprecate
pldm_bios_table_attr_entry_string_encode_check(), add the ren

dsp: bios_table: Rename pldm_bios_table_attr_entry_string_encode_check()

Introduce pldm_bios_table_attr_entry_string_encode(), deprecate
pldm_bios_table_attr_entry_string_encode_check(), add the rename
configuration and apply it.

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

show more ...


# 82b4d3b4 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_pv_hdls_check()

Introduce pldm_bios_table_attr_entry_enum_decode_pv_hdls(), deprecate
pldm_bios_table_attr_entry_enum_decode_pv_hdls_ch

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_pv_hdls_check()

Introduce pldm_bios_table_attr_entry_enum_decode_pv_hdls(), deprecate
pldm_bios_table_attr_entry_enum_decode_pv_hdls_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: I29b4d24ce0bbb92ff0491c2abae4b512d4374e74
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 46673f4a 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_def_num_check()

Introduce pldm_bios_table_attr_entry_enum_decode_def_num(), deprecate
pldm_bios_table_attr_entry_enum_decode_def_num_ch

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_def_num_check()

Introduce pldm_bios_table_attr_entry_enum_decode_def_num(), deprecate
pldm_bios_table_attr_entry_enum_decode_def_num_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ia0eec8050e39f2ee45c350386af32bd5c37135c5
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# b06882f1 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_pv_num_check()

Introduce `pldm_bios_table_attr_entry_enum_decode_pv_num()`, deprecate
`pldm_bios_table_attr_entry_enum_decode_pv_num_ch

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_decode_pv_num_check()

Introduce `pldm_bios_table_attr_entry_enum_decode_pv_num()`, deprecate
`pldm_bios_table_attr_entry_enum_decode_pv_num_check()`, add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ifb34736e9c1a31ad15649e556dcb6e3c98890f07
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 7126b1d2 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_encode_check()

Introduce pldm_bios_table_attr_entry_enum_encode(), deprecate
pldm_bios_table_attr_entry_enum_encode_check(), add the rename
co

dsp: bios_table: Rename pldm_bios_table_attr_entry_enum_encode_check()

Introduce pldm_bios_table_attr_entry_enum_encode(), deprecate
pldm_bios_table_attr_entry_enum_encode_check(), add the rename
configuration and apply it.

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

show more ...


# 8c37ab36 25-Jun-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

dsp: bios_table: Rename pldm_bios_table_string_entry_decode_string_check()

Introduce pldm_bios_table_string_entry_decode_string(), deprecate
pldm_bios_table_string_entry_decode_string_check(), add t

dsp: bios_table: Rename pldm_bios_table_string_entry_decode_string_check()

Introduce pldm_bios_table_string_entry_decode_string(), deprecate
pldm_bios_table_string_entry_decode_string_check(), add the rename
configuration and apply it.

gitlint-ignore: T1
Change-Id: Ia204acd95d9e1d9bc80d91dd0ff6ffea3a1fe243
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


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

dsp: bios_table: Rename pldm_bios_table_string_entry_encode_check()

Introduce pldm_bios_table_string_entry_encode(), deprecate
pldm_bios_table_string_entry_encode_check(), add the rename
configurati

dsp: bios_table: Rename pldm_bios_table_string_entry_encode_check()

Introduce pldm_bios_table_string_entry_encode(), deprecate
pldm_bios_table_string_entry_encode_check(), add the rename
configuration and apply it.

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

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 ...