History log of /openbmc/libmctp/core.c (Results 1 – 25 of 59)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 133df7ab 14-May-2024 John Chung <john.chung@arm.com>

core: Allow to handle destination null and broadcast endpoint id

mctp daemon might query endpoint (i.e., get endpoint id command)
by physical addressed requests and set destination eid as 0.

Curren

core: Allow to handle destination null and broadcast endpoint id

mctp daemon might query endpoint (i.e., get endpoint id command)
by physical addressed requests and set destination eid as 0.

Current implementation will block handling destination null and
broadcast endpoint id for MCTP control message type.

Change-Id: Ie17035f88a80649e848fab93159a23172de0a33a
Signed-off-by: John Chung <john.chung@arm.com>

show more ...


# 487b31e0 14-Sep-2022 Rashmica Gupta <rashmica@linux.ibm.com>

core: Ensure mctp_pktbuf_alloc() initialises end-offset in-bounds

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
Change-Id: I423fea60fbc5a40e66761b3a66bf9b44c3a9bc84


# b7824b66 08-Aug-2023 Benjamin Gwin <bgwin@google.com>

core: Fix use of wrong 'free' function

This memory was allocated using `__mctp_alloc` but mistakenly being free
with plain `free`, causing a potential heap corruption or crash if users
define their

core: Fix use of wrong 'free' function

This memory was allocated using `__mctp_alloc` but mistakenly being free
with plain `free`, causing a potential heap corruption or crash if users
define their own malloc hooks.

Signed-off-by: Benjamin Gwin <bgwin@google.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I1d78f62098e5d9b57e58e4dd90c4841b2923300d

show more ...


# 7f7fdc1d 12-May-2023 Andrew Jeffery <andrew@aj.id.au>

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest

clang-format: copy latest and re-format

clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic5b4c8584fafe5ebe3d01c1f685cab271dd9690b

show more ...


# 2608b294 30-Mar-2023 Pedro Martelletto <martelletto@google.com>

core: check for __mctp_alloc() failure in mctp_pktbuf_alloc()

Check for allocation failure in mctp_pktbuf_alloc(), as done
elsewhere in the code.

Change-Id: If3b6d84335d87f4d0ddef059910e63edab82a30

core: check for __mctp_alloc() failure in mctp_pktbuf_alloc()

Check for allocation failure in mctp_pktbuf_alloc(), as done
elsewhere in the code.

Change-Id: If3b6d84335d87f4d0ddef059910e63edab82a30e
Signed-off-by: Pedro Martelletto <martelletto@google.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>

show more ...


# f2988977 08-Nov-2022 Rashmica Gupta <rashmica@linux.ibm.com>

pcap: Use SLL2 linktype for captures

This means we can use wireshark on our pcaps.

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
Change-Id: I215af00e064d352e41d0a8eb87d5a30582998676


# a721c2d8 04-Dec-2022 Patrick Williams <patrick@stwcx.xyz>

format: reformat with clang-format

Reformat everything with clang-format and remove .clang-ignore and
custom code formatter.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I93dfca67

format: reformat with clang-format

Reformat everything with clang-format and remove .clang-ignore and
custom code formatter.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I93dfca67948d3fbcc0f05ece4ae3e4dd9495ab57

show more ...


# 0721f585 28-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

core: Define return value behaviours for binding Tx callbacks

Binding Tx callbacks must return 0 upon success or a negative error code
on failure. Some error codes invoke specific error handling beh

core: Define return value behaviours for binding Tx callbacks

Binding Tx callbacks must return 0 upon success or a negative error code
on failure. Some error codes invoke specific error handling behaviours.
If a binding Tx callback returns the following negative error codes:

1. EMSGSIZE: The packet whose transmission failed is dequeued from the
transmit queue and dropped, as it will never be successfully
transmitted

2. EBUSY: The packet whose transmission failed remains queued for a
subsequent attempt.

This prevents Tx queue stalls for bindings such as astlpc where
reinitialisation can renegotiate the Tx buffer size to a lower value
than the size of packets already in the Tx queue. Previously the
implementation in core failed to discard the packet from the binding Tx
queue if transmission of the head packet was not possible.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I7dde22bd7340f2c028adf5112d7d4ab78cac66a6

show more ...


# 7aaccb51 28-Jun-2022 Moritz Fischer <moritzf@google.com>

core: Address a handful of compiler warnings

Address a handful of compiler warnings where void pointers are
incremented.

Suggested-by: Younghyun Park <younghyunpark@google.com>
Signed-off-by: Morit

core: Address a handful of compiler warnings

Address a handful of compiler warnings where void pointers are
incremented.

Suggested-by: Younghyun Park <younghyunpark@google.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Change-Id: I6171efce851a6b9585b069d12daa389e2338a98b

show more ...


Revision tags: v0.11
# f39c3857 10-Jan-2022 Sumanth Bhat <sumanth.bhat@linux.intel.com>

core: Add TX/RX API that exposes message tag and tag owner

MCTP received packets can carry a message tag and tag owner bit
which is set by a remote MCTP endpoint. This can be used by the
remote MCTP

core: Add TX/RX API that exposes message tag and tag owner

MCTP received packets can carry a message tag and tag owner bit
which is set by a remote MCTP endpoint. This can be used by the
remote MCTP endpoint to track the responses. Thus, libmctp should
provide a mechanism for the upper layer MCTP applications to
respond with the same message tag.

This patchset extends TX and RX API with message tag and
tag owner bits.

Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: I6d07eafa86c653abdd4313ab7cc77e5a93124477

show more ...


# 663ec39e 07-Oct-2021 Brad Bishop <bradleyb@fuzziesquirrel.com>

core: check n_busses before transmit

Handle the unusual case of no buses - for example with the null binding.

Change-Id: Ia61123d43efa16c5e00fa0f718d4a6206ee6ffae
Signed-off-by:

core: check n_busses before transmit

Handle the unusual case of no buses - for example with the null binding.

Change-Id: Ia61123d43efa16c5e00fa0f718d4a6206ee6ffae
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>

show more ...


# 2094c3c0 25-Aug-2021 Andrew Jeffery <andrew@aj.id.au>

libmctp: Add mctp_unregister_bus()

Allow for safe cleanup of busses associated with bindings when the
binding has work to do in the tear-down path.

Signed-off-by: Andrew Jeffery

libmctp: Add mctp_unregister_bus()

Allow for safe cleanup of busses associated with bindings when the
binding has work to do in the tear-down path.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I7cc45e30d778554cfa33c49a47fe237b23fe5431

show more ...


# 5d3d4e6d 20-Aug-2021 Andrew Jeffery <andrew@aj.id.au>

core: Add infrastructure for packet captures

A callback and user data member is defined to abstract out the
implementation details of capturing the packets. The captured packets
are

core: Add infrastructure for packet captures

A callback and user data member is defined to abstract out the
implementation details of capturing the packets. The captured packets
are in DSP0236 form, i.e. no binding metadata is present.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Id8234d6e8f7856c70a0ca3fe5d4cee38ec11bd8c

show more ...


# 34d4c96f 16-Jun-2021 Sumanth Bhat <sumanth.bhat@linux.intel.com>

core: Handle exhaution of message contexts

If message contexts are exhausted, there is a possibility of
NULL pointer dereference. Close this attack surface with a
check on the messag

core: Handle exhaution of message contexts

If message contexts are exhausted, there is a possibility of
NULL pointer dereference. Close this attack surface with a
check on the message context creation status.

Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: I208349b74a27a14b180c976bd78ec81a7991e43f

show more ...


# bc79c24e 16-Jun-2021 Sumanth Bhat <sumanth.bhat@linux.intel.com>

core: Handle arithmetic overflow in adding new fragments

Large fragment sizes can cause arithmetic overflows and can
cause memory corruptions. However, this condition will not be hit

core: Handle arithmetic overflow in adding new fragments

Large fragment sizes can cause arithmetic overflows and can
cause memory corruptions. However, this condition will not be hit
with a fragment size check in place and with a sane memory allocator
in place.

Adding this check to ensure that we have defense in depth.

Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: Iaa976ce636c1eb617afa75e852b39c50699ebeb2

show more ...


# 69f545f7 18-May-2021 Sumanth Bhat <sumanth.bhat@linux.intel.com>

core: Handle MCTP fragment sizes

Message assembly can be terminated if case we receive a
middle/end packet of unexpected size. This provision is
provided in DSP0236 v1.3.1 section 8.

core: Handle MCTP fragment sizes

Message assembly can be terminated if case we receive a
middle/end packet of unexpected size. This provision is
provided in DSP0236 v1.3.1 section 8.8 incorrect transmission
unit.

Reception of middle packets whose size is not equal to
start packet and end packets whose size is not less than
or equal to the start packet causes message assembly
termination.

Signed-off-by: Sumanth Bhat <sumanth.bhat@linux.intel.com>
Change-Id: I6371ab9e22e2c8ece70a9480f224de3f1f2f184e

show more ...


# a523bcc1 19-May-2021 Helen Huang <he.huang@linux.intel.com>

core: Check Null pointer in mctp_bridge_busses()

Handle memory allocation failures in mctp_bridge_busses to
reduce the likelihood of a possible attack.

Change-Id: Ib8edc94ae5942

core: Check Null pointer in mctp_bridge_busses()

Handle memory allocation failures in mctp_bridge_busses to
reduce the likelihood of a possible attack.

Change-Id: Ib8edc94ae5942dc1c0b2355aeb3642d079512537
Signed-off-by: Helen Huang <he.huang@linux.intel.com>

show more ...


# eba19a3b 09-Mar-2021 Andrew Jeffery <andrew@aj.id.au>

astlpc: Introduce protocol v3 with integrity checks

v3 of the binding adds a CRC-32 value as a medium-specific trailer to
each packet passing over the binding interface.

The pat

astlpc: Introduce protocol v3 with integrity checks

v3 of the binding adds a CRC-32 value as a medium-specific trailer to
each packet passing over the binding interface.

The patch includes a naive bit-shift implementation of CRC-32, we can
improve it later as necessary.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I93a95bccef30010d56e10e29b6d84554268ab7af

show more ...


# 39da3d03 12-Mar-2021 Andrew Jeffery <andrew@aj.id.au>

libmctp: Split padding in pktbuf into header and trailer

The astlpc binding will shortly make use of a medium-specific trailer to
implement a CRC-32 integrity check over packet data. All

libmctp: Split padding in pktbuf into header and trailer

The astlpc binding will shortly make use of a medium-specific trailer to
implement a CRC-32 integrity check over packet data. Allow for
medium-specific trailer data in the pktbuf in order to remove the need
for a bounce-buffer. The binding will trim the pktbuf to the payload
length before passing the instance up the stack.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ib215a552ff218b007f7f119c5235fbc75d9ca6cb

show more ...


# 19275230 28-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Fail bridge initialisation if a binding fails to start

The start() callback can return an error, so make sure we propagate this
to the caller of mctp_bridge_busses().

mctp

core: Fail bridge initialisation if a binding fails to start

The start() callback can return an error, so make sure we propagate this
to the caller of mctp_bridge_busses().

mctp_destroy() will clean up the memory allocated for the bridged
busses. Cleaning the bus memory up before returning from
mctp_bridge_busses() may leave a started binding in an unsafe state
state (as its bus pointer will be either invalid or NULL), so we'll
avoid doing that for now.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I84803ced41d106ac96e2bf94c90feb5eea10579f

show more ...


# 1fa707e2 27-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Validate binding MTU before allowing transmission

Don't accept MTU values like 0, which will cause the packetisation loop
to fail in unacceptable ways (OOM).

Signed-off-by

core: Validate binding MTU before allowing transmission

Don't accept MTU values like 0, which will cause the packetisation loop
to fail in unacceptable ways (OOM).

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I00d563cd91f718e695ed28d2b9978fc38566c4ae

show more ...


# c61501cc 27-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Drop messages sent before binding enables transmission

Some bindings (astlpc) have a handshake that must occur before packets
can be sent across the bus, but after the binding inst

core: Drop messages sent before binding enables transmission

Some bindings (astlpc) have a handshake that must occur before packets
can be sent across the bus, but after the binding instance has been
constructed. Similarly, some bindings (astlpc) require coordination of
resources between endpoints as part of regular operation, which
motivates the existence of the associated `tx_enabled` state.

If a binding invokes mctp_binding_set_tx_enabled() with a `true`
argument it implies that all required handshaking has been completed
(if it had not, we still would not be able to send packets).

Switch `tx_enabled` from a boolean to a ternary state machine to capture
the `constructed` state of a binding (before required handshaking has
completed). Further, error out if mctp_message_tx_on_bus() is invoked
with a binding in the `constructed` state, as it's possible the
information required to correctly packetise the provided message is
invalid.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: If4baf07ab5fe7edd7f522fac29e32fc5c2a6105d

show more ...


# 3ae89dce 27-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Introduce mctp_bus_destroy()

Tearing down a binding needs to free all packets that have been queued
but not yet transmitted.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au

core: Introduce mctp_bus_destroy()

Tearing down a binding needs to free all packets that have been queued
but not yet transmitted.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia4bff3243f80e1088c521b09a512584383deb1ad

show more ...


# 2304c833 28-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Set n_busses appropriately on failure to start binding

We were cleaning up the allocated memory but failing to reset the number
of allocated busses to zero. This makes it harder to

core: Set n_busses appropriately on failure to start binding

We were cleaning up the allocated memory but failing to reset the number
of allocated busses to zero. This makes it harder to correctly clean up
the MCTP context later in the lifecycle.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I392ef6d6f7ffa7af7bb33d1aedfc4968f1749f7b

show more ...


# b4ae00b9 17-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

core: Remove Rube Goldberg sequence point in packet body assignment

The code isn't wrong* - if it were we certainly would have noticed - but
why it's *right* isn't something we want to b

core: Remove Rube Goldberg sequence point in packet body assignment

The code isn't wrong* - if it were we certainly would have noticed - but
why it's *right* isn't something we want to be reasoning about.

Convert the sequence point to a plain statement to make the ordering and
value state requirements obvious to the reader.

* the sequence point will order the write to p before mctp_rx() is
invoked, giving p the correct value at the time of invocation, but its
value after the return of mctp_rx() is undefined.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I68a1e35ba6a9b8daf89c4d5782037ed623ebbeb5

show more ...


123