History log of /openbmc/libpldm/tests/fuzz/ (Results 1 – 3 of 3)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
7a8d932b27-Aug-2025 John Chung <john.chung@arm.com>

msgbuf: Define a separate msgbuf structure for encode/decode function

Define separate msgbuf structures to avoid casting away const-qualifiers
in the msgbuf constructor function:

* pldm_msgbuf_rw:

msgbuf: Define a separate msgbuf structure for encode/decode function

Define separate msgbuf structures to avoid casting away const-qualifiers
in the msgbuf constructor function:

* pldm_msgbuf_rw: for encode functions with non const-qualified buffer
* pldm_msgbuf_ro: for decode functions with const-qualified buffer

Further, use _Generic() to keep the API ergonomic while still yielding a
compile error when wrong msgbuf type is passed.

Change-Id: I71dbcb7996e9fb402b49870fce539a939c1497e5
Signed-off-by: John Chung <john.chung@arm.com>
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


/openbmc/libpldm/.clang-tidy
/openbmc/libpldm/CHANGELOG.md
/openbmc/libpldm/CONTRIBUTING.md
/openbmc/libpldm/README.md
/openbmc/libpldm/abi/x86_64/gcc.dump
/openbmc/libpldm/docs/checklists/changes.md
/openbmc/libpldm/docs/checklists/releases.md
/openbmc/libpldm/docs/fuzzing.md
/openbmc/libpldm/evolutions/v0.13.0/crc32.yaml
/openbmc/libpldm/evolutions/v0.13.0/crc8.yaml
/openbmc/libpldm/include/libpldm/base.h
/openbmc/libpldm/include/libpldm/compiler.h
/openbmc/libpldm/include/libpldm/file.h
/openbmc/libpldm/include/libpldm/firmware_update.h
/openbmc/libpldm/include/libpldm/meson.build
/openbmc/libpldm/include/libpldm/oem/ibm/state_set.h
/openbmc/libpldm/include/libpldm/pdr.h
/openbmc/libpldm/include/libpldm/platform.h
/openbmc/libpldm/include/libpldm/pldm.h
/openbmc/libpldm/include/libpldm/pldm_types.h
/openbmc/libpldm/include/libpldm/utils.h
/openbmc/libpldm/meson.build
/openbmc/libpldm/meson.options
/openbmc/libpldm/scripts/changelog.awk
/openbmc/libpldm/scripts/pre-submit
/openbmc/libpldm/src/api.h
/openbmc/libpldm/src/control-internal.h
/openbmc/libpldm/src/control.c
/openbmc/libpldm/src/dsp/base.c
/openbmc/libpldm/src/dsp/bios_table.c
/openbmc/libpldm/src/dsp/file.c
/openbmc/libpldm/src/dsp/firmware_update.c
/openbmc/libpldm/src/dsp/meson.build
/openbmc/libpldm/src/dsp/pdr.c
/openbmc/libpldm/src/dsp/platform.c
/openbmc/libpldm/src/firmware_device/fd.c
/openbmc/libpldm/src/msgbuf.h
/openbmc/libpldm/src/msgbuf/core.h
/openbmc/libpldm/src/msgbuf/platform.h
/openbmc/libpldm/src/oem/meta/file_io.c
/openbmc/libpldm/src/requester/meson.build
/openbmc/libpldm/src/utils.c
/openbmc/libpldm/src/utils.h
/openbmc/libpldm/tests/data/test.hex
/openbmc/libpldm/tests/dsp/base.cpp
/openbmc/libpldm/tests/dsp/bios_table.cpp
/openbmc/libpldm/tests/dsp/bios_table_iter.c
/openbmc/libpldm/tests/dsp/file.cpp
/openbmc/libpldm/tests/dsp/firmware_update.cpp
/openbmc/libpldm/tests/dsp/meson.build
/openbmc/libpldm/tests/dsp/pdr.cpp
/openbmc/libpldm/tests/dsp/platform.cpp
fd-fuzz.cpp
/openbmc/libpldm/tests/meson.build
/openbmc/libpldm/tests/msgbuf.cpp
/openbmc/libpldm/tests/msgbuf.hpp
/openbmc/libpldm/tests/msgbuf_generic.c
/openbmc/libpldm/tests/oem/meta/fileio.cpp
/openbmc/libpldm/tests/utils.cpp
/openbmc/libpldm/tools/meson.build
/openbmc/libpldm/tools/pd.c
a189696703-Mar-2025 Andrew Jeffery <andrew@codeconstruct.com.au>

msgbuf: Rework error handling to improve soundness

Design the implementation to uphold the invariant that a non-negative
remaining value implies the cursor pointer is valid, and that under
other con

msgbuf: Rework error handling to improve soundness

Design the implementation to uphold the invariant that a non-negative
remaining value implies the cursor pointer is valid, and that under
other conditions error values must be observed by the msgbuf user. The
former is tested with assertions in the implementation. The latter is
enforced by construction.

With this change, all msgbuf instances for which
pldm_msgbuf_init_errno() succeeds must be either completed or discarded
by calls to the pldm_msgbuf_complete*() or pldm_msgbuf_discard() APIs
respectively.

We then build on the properties that:

- pldm_msgbuf_init_errno() is marked with the warn_unused_result
function attribute

- pldm_msgbuf_init_errno() returns errors for invalid buffer
configurations

- The complete and discard APIs are marked with the warn_unused_result
function attribute

- The complete APIs test for negative remaining values and return an
error if encountered.

- The discard API propagates the provided error code

Together these provide the foundation to ensure that buffer access
errors are (eventually) detected.

A msgbuf object is always in one of the uninitialized, valid, invalid,
or completed states. The states are defined as follows:

- Uninitialized: Undefined values for remaining and cursor

- Valid: cursor points to a valid object, remaining is both non-negative
and describes a range contained within the object pointed to
by cursor

- Invalid: The value of remaining is negative. The value of cursor is
unspecified.

- Completed: the value of remaining is INTMAX_MIN and cursor is NULL

msgbuf instances must always be in the completed state by the time
their storage is reclaimed. To enforce this, PLDM_MSGBUF_DEFINE_P()
is introduced both to simplify definition of related variables, and
to exploit the compiler's 'cleanup' attribute. The cleanup function
associated with the msgbuf object asserts that the referenced object is
in the completed state.

From there, update the implementations of the msgbuf APIs such that
exceeding implementation type limits forces the msgbuf object to the
invalid state (in addition to returning an error value) to relieve the
caller from testing the result of all API invocations.

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

show more ...

abe9b37f11-Nov-2024 Matt Johnston <matt@codeconstruct.com.au>

libpldm: Add fuzzing for firmware FD responder

This includes a fuzz target fd-fuzz, and infrastructure to run with
either honggfuzz or AFL.

fd-fuzz-input1.dat was crafted from parts of a pldm firmw

libpldm: Add fuzzing for firmware FD responder

This includes a fuzz target fd-fuzz, and infrastructure to run with
either honggfuzz or AFL.

fd-fuzz-input1.dat was crafted from parts of a pldm firmware update
packet capture, as a seed to guide fuzzers.

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

show more ...


/openbmc/libpldm/.clang-format
/openbmc/libpldm/.clang-tidy
/openbmc/libpldm/CHANGELOG.md
/openbmc/libpldm/LICENSE
/openbmc/libpldm/OWNERS
/openbmc/libpldm/README.md
/openbmc/libpldm/abi/x86_64/gcc.dump
/openbmc/libpldm/docs/checklists/changes.md
/openbmc/libpldm/docs/checklists/releases.md
/openbmc/libpldm/docs/fuzzing.md
/openbmc/libpldm/docs/oem/meta/file-io.md
/openbmc/libpldm/evolutions/v0.9.1/get_fru_record_by_option_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/oem-ibm-header-compat.cocci
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_append_pad_checksum_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_enum_decode_def_num_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_enum_decode_pv_hdls_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_enum_decode_pv_num_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_enum_encode_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_integer_encode_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_string_decode_def_string_length_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_entry_string_encode_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_value_entry_encode_enum_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_value_entry_encode_integer_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_attr_value_entry_encode_string_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_string_entry_decode_string_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_bios_table_string_entry_encode_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_entity_association_pdr_add_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_entity_association_pdr_add_from_node_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_pdr_add_check.yaml
/openbmc/libpldm/evolutions/v0.9.1/pldm_pdr_add_fru_record_set_check.yaml
/openbmc/libpldm/include/libpldm/api.h
/openbmc/libpldm/include/libpldm/base.h
/openbmc/libpldm/include/libpldm/bios.h
/openbmc/libpldm/include/libpldm/bios_table.h
/openbmc/libpldm/include/libpldm/compiler.h
/openbmc/libpldm/include/libpldm/control.h
/openbmc/libpldm/include/libpldm/entity.h
/openbmc/libpldm/include/libpldm/firmware_fd.h
/openbmc/libpldm/include/libpldm/firmware_update.h
/openbmc/libpldm/include/libpldm/fru.h
/openbmc/libpldm/include/libpldm/instance-id.h
/openbmc/libpldm/include/libpldm/meson.build
/openbmc/libpldm/include/libpldm/oem/ibm/entity.h
/openbmc/libpldm/include/libpldm/oem/ibm/file_io.h
/openbmc/libpldm/include/libpldm/oem/ibm/fru.h
/openbmc/libpldm/include/libpldm/oem/ibm/host.h
/openbmc/libpldm/include/libpldm/oem/ibm/platform.h
/openbmc/libpldm/include/libpldm/oem/ibm/state_set.h
/openbmc/libpldm/include/libpldm/oem/meta/file_io.h
/openbmc/libpldm/include/libpldm/pdr.h
/openbmc/libpldm/include/libpldm/platform.h
/openbmc/libpldm/include/libpldm/pldm.h
/openbmc/libpldm/include/libpldm/pldm_types.h
/openbmc/libpldm/include/libpldm/sizes.h.in
/openbmc/libpldm/include/libpldm/state_set.h
/openbmc/libpldm/include/libpldm/states.h
/openbmc/libpldm/include/libpldm/transport.h
/openbmc/libpldm/include/libpldm/transport/af-mctp.h
/openbmc/libpldm/include/libpldm/transport/mctp-demux.h
/openbmc/libpldm/include/libpldm/utils.h
/openbmc/libpldm/include/meson.build
/openbmc/libpldm/instance-db/default
/openbmc/libpldm/meson.build
/openbmc/libpldm/meson.options
/openbmc/libpldm/scripts/abi-dump-formatter
/openbmc/libpldm/scripts/abi-dump-updater
/openbmc/libpldm/scripts/apply-renames
/openbmc/libpldm/scripts/changelog.awk
/openbmc/libpldm/scripts/pre-submit
/openbmc/libpldm/scripts/run-ci
/openbmc/libpldm/src/api.h
/openbmc/libpldm/src/array.h
/openbmc/libpldm/src/compiler.h
/openbmc/libpldm/src/control-internal.h
/openbmc/libpldm/src/control.c
/openbmc/libpldm/src/dsp/base.c
/openbmc/libpldm/src/dsp/base.h
/openbmc/libpldm/src/dsp/bios.c
/openbmc/libpldm/src/dsp/bios_table.c
/openbmc/libpldm/src/dsp/firmware_update.c
/openbmc/libpldm/src/dsp/fru.c
/openbmc/libpldm/src/dsp/meson.build
/openbmc/libpldm/src/dsp/pdr.c
/openbmc/libpldm/src/dsp/platform.c
/openbmc/libpldm/src/firmware_device/fd-internal.h
/openbmc/libpldm/src/firmware_device/fd.c
/openbmc/libpldm/src/firmware_device/meson.build
/openbmc/libpldm/src/mctp-defines.h
/openbmc/libpldm/src/meson.build
/openbmc/libpldm/src/msgbuf.h
/openbmc/libpldm/src/msgbuf/platform.h
/openbmc/libpldm/src/oem/ibm/file_io.c
/openbmc/libpldm/src/oem/ibm/host.c
/openbmc/libpldm/src/oem/ibm/meson.build
/openbmc/libpldm/src/oem/ibm/platform.c
/openbmc/libpldm/src/oem/meta/file_io.c
/openbmc/libpldm/src/oem/meta/meson.build
/openbmc/libpldm/src/requester/instance-id.c
/openbmc/libpldm/src/requester/meson.build
/openbmc/libpldm/src/requester/pldm.c
/openbmc/libpldm/src/responder.c
/openbmc/libpldm/src/responder.h
/openbmc/libpldm/src/transport/af-mctp.c
/openbmc/libpldm/src/transport/container-of.h
/openbmc/libpldm/src/transport/mctp-demux.c
/openbmc/libpldm/src/transport/meson.build
/openbmc/libpldm/src/transport/socket.c
/openbmc/libpldm/src/transport/socket.h
/openbmc/libpldm/src/transport/test.c
/openbmc/libpldm/src/transport/test.h
/openbmc/libpldm/src/transport/transport.c
/openbmc/libpldm/src/transport/transport.h
/openbmc/libpldm/src/utils.c
/openbmc/libpldm/subprojects/googletest.wrap
/openbmc/libpldm/tests/.clang-format
/openbmc/libpldm/tests/dsp/base.cpp
/openbmc/libpldm/tests/dsp/bios.cpp
/openbmc/libpldm/tests/dsp/bios_table.cpp
/openbmc/libpldm/tests/dsp/bios_table_iter.c
/openbmc/libpldm/tests/dsp/firmware_update.cpp
/openbmc/libpldm/tests/dsp/fru.cpp
/openbmc/libpldm/tests/dsp/meson.build
/openbmc/libpldm/tests/dsp/pdr.cpp
/openbmc/libpldm/tests/dsp/platform.cpp
fd-fuzz-input1.dat
fd-fuzz.cpp
fd.dict
fuzz-build.py
fuzz-coverage.py
meson.build
/openbmc/libpldm/tests/instance-id.cpp
/openbmc/libpldm/tests/meson.build
/openbmc/libpldm/tests/msgbuf.cpp
/openbmc/libpldm/tests/msgbuf_generic.c
/openbmc/libpldm/tests/oem/ibm/fileio.cpp
/openbmc/libpldm/tests/oem/ibm/host.cpp
/openbmc/libpldm/tests/oem/ibm/meson.build
/openbmc/libpldm/tests/oem/meta/fileio.cpp
/openbmc/libpldm/tests/oem/meta/meson.build
/openbmc/libpldm/tests/responder.cpp
/openbmc/libpldm/tests/transport/meson.build
/openbmc/libpldm/tests/transport/send_recv_one.cpp
/openbmc/libpldm/tests/transport/send_recv_timeout.cpp
/openbmc/libpldm/tests/transport/send_recv_unwanted.cpp
/openbmc/libpldm/tests/transport/send_recv_wrong_command_code.cpp
/openbmc/libpldm/tests/transport/send_recv_wrong_pldm_type.cpp
/openbmc/libpldm/tests/transport/transport.cpp
/openbmc/libpldm/tests/utils.cpp