History log of /openbmc/libmctp/tests/ (Results 1 – 25 of 79)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
b3de343e18-Apr-2024 John Chung <john.chung@arm.com>

serial: Support Frame Check Sequence

According to DSP0253, implementing frame check sequence via
crc-16-ccitt calculation. crc-16-ccitt implementation refer
to RFC1662 Appendix C.

Tested:
Verified

serial: Support Frame Check Sequence

According to DSP0253, implementing frame check sequence via
crc-16-ccitt calculation. crc-16-ccitt implementation refer
to RFC1662 Appendix C.

Tested:
Verified on sending/receiving mctp packets with mctp-serial
kernel driver.

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

show more ...

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

e915aad410-Aug-2022 Rashmica Gupta <rashmica@linux.ibm.com>

tests: undef NDEBUG in tests

So we can run tests even when compiled with -DNDEBUG

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

ca85ad8610-Aug-2022 Rashmica Gupta <rashmica@linux.ibm.com>

tests: bridge: Use unique names for bindings

This makes debugging easier.

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

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

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

695deed829-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

tests: serial: Format with clang-format

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

69eda31b29-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

tests: test-utils: Format with clang-format

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

31b01e0d29-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

tests: core: Format with clang-format

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

c9ac4fc529-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

tests: astlpc: MTU renegotiation with populated Tx queue

Capture the behaviour that lead to a complete stall now that we've fixed
the bug.

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

tests: astlpc: MTU renegotiation with populated Tx queue

Capture the behaviour that lead to a complete stall now that we've fixed
the bug.

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

show more ...

e64c516329-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

tests: astlpc: Rename the message Rx handler

The implementation of the handler is strictly associated with
`struct astlpc_test`, so make this clear through the name.

Signed-off-by: Andrew Jeffery <

tests: astlpc: Rename the message Rx handler

The implementation of the handler is strictly associated with
`struct astlpc_test`, so make this clear through the name.

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

show more ...

89a2878128-Sep-2022 Andrew Jeffery <andrew@aj.id.au>

serial: Give write callbacks a consistent behaviour

Require that the write callbacks return either the number of bytes
written or a negative error code. From there, ensure the return value
behaviour

serial: Give write callbacks a consistent behaviour

Require that the write callbacks return either the number of bytes
written or a negative error code. From there, ensure the return value
behaviour is the same for the fd and custom handler paths.

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

show more ...

fe763e9805-Aug-2022 Andrew Jeffery <andrew@aj.id.au>

astlpc: Implement async support via buffer state tracking

To remove the unbounded loop in mctp_astlpc_kcs_send() we need the
capability to retry sending the pending command once the data value has
b

astlpc: Implement async support via buffer state tracking

To remove the unbounded loop in mctp_astlpc_kcs_send() we need the
capability to retry sending the pending command once the data value has
been consumed. However, the link is duplex and we may enter the state
where we have multiple pending commands.

Rather than explicitly track the set of pending commands, track the
buffer state in order to derive both the pollfd state needed by the
caller _and_ the pending buffer synchronisation commands.

Unfortunately due to the structure of the code the integration of the
state tracking is a little messy, but is capable of correctly booting a
P10 system.

I've put up a less constrained and perhaps aspirational implementation
of how the state tracking could be implemented if we feel the need to
rework things going forward:

https://github.com/amboar/libmctp-shmb/

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

show more ...

fcb65abb06-Jul-2022 Younghyun Park <younghyunpark@google.com>

tests/test_seq.c: Avoid duplicate definition of ARRAY_SIZE

Avoid duplicate definition of "ARRAY_SIZE" macro in environments
that already define the macro

Signed-off-by: Younghyun Park <younghyunpar

tests/test_seq.c: Avoid duplicate definition of ARRAY_SIZE

Avoid duplicate definition of "ARRAY_SIZE" macro in environments
that already define the macro

Signed-off-by: Younghyun Park <younghyunpark@google.com>
Change-Id: I8fa5ddd0d0279cbcda160fcb232c9c481594b0f0

show more ...

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

5ab7825917-Feb-2022 Andrew Jeffery <andrew@aj.id.au>

libmctp: Introduce compiler.h

Define __unused here and include compiler.h in all the places we can
make use of it. Clean up some header ordering and include styles while
we're at it.

Signed-off-by:

libmctp: Introduce compiler.h

Define __unused here and include compiler.h in all the places we can
make use of it. Clean up some header ordering and include styles while
we're at it.

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

show more ...

34d4c96f16-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 message context creati

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

bc79c24e16-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
with a fragment

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

69f545f718-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.8 incorrect tran

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

eba19a3b09-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 patch includes a naive

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

39da3d0312-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. Allow for
mediu

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

88412be409-Mar-2021 Andrew Jeffery <andrew@aj.id.au>

astlpc: Make packet properties depend on protocol version

The astlpc binding will shortly have an implementation of the v3
protocol specification. v3 adjusts the medium-specific packet size to
inclu

astlpc: Make packet properties depend on protocol version

The astlpc binding will shortly have an implementation of the v3
protocol specification. v3 adjusts the medium-specific packet size to
include a CRC-32 in a packet trailer. Implementing v3 must not impact
the behaviour of earlier protocol versions, so provide an ops struct to
handle version-specific details.

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

show more ...

3f4bca9a27-Jan-2021 Andrew Jeffery <andrew@aj.id.au>

tests: astlpc: Exercise mctp_message_tx() before channel init

Attempting to send messages before channel init should intentionally
fail, not fail by OOMing the machine.

Signed-off-by: Andrew Jeffer

tests: astlpc: Exercise mctp_message_tx() before channel init

Attempting to send messages before channel init should intentionally
fail, not fail by OOMing the machine.

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

show more ...

c2b833e427-Oct-2020 Andrew Jeffery <andrew@aj.id.au>

core: Fix large packet buffer overrun

The astlpc binding allows negotiation of Tx/Rx region sizes, but the
packet accumulator assumed packet sizes were at most 4096 bytes. Avoid
buffer overflow by

core: Fix large packet buffer overrun

The astlpc binding allows negotiation of Tx/Rx region sizes, but the
packet accumulator assumed packet sizes were at most 4096 bytes. Avoid
buffer overflow by allocating at least the length of the inbound packet
if we have not yet initialised the packet buffer.

Fixes:

=================================================================
==42296==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000002500 at pc 0x7ff8a22235ce bp 0x7ffd47469750 sp 0x7ffd47468ef8
WRITE of size 8192 at 0x621000002500 thread T0
#0 0x7ff8a22235cd in __interceptor_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x3a5cd)
#1 0x7ff8a21ac78b in memcpy /usr/include/x86_64-linux-gnu/bits/string_fortified.h:34
#2 0x7ff8a21ac78b in mctp_msg_ctx_add_pkt /home/andrew/src/openbmc/libmctp/core.c:237
#3 0x7ff8a21af245 in mctp_bus_rx /home/andrew/src/openbmc/libmctp/core.c:495
#4 0x56458d3f9648 in mctp_astlpc_rx_start astlpc.c:813
#5 0x56458d3f9648 in mctp_astlpc_poll astlpc.c:931
#6 0x56458d3fc1f4 in astlpc_test_send_large_packet tests/test_astlpc.c:1111
#7 0x56458d3efc86 in main tests/test_astlpc.c:1185
#8 0x7ff8a165dcb1 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28cb1)
#9 0x56458d3efe7d in _start (/home/andrew/src/openbmc/libmctp/tests/.libs/test_astlpc+0x17e7d)

0x621000002500 is located 0 bytes to the right of 4096-byte region [0x621000001500,0x621000002500)
allocated by thread T0 here:
#0 0x7ff8a22998d0 in __interceptor_realloc (/usr/lib/x86_64-linux-gnu/libasan.so.6+0xb08d0)
#1 0x7ff8a21b0533 in __mctp_realloc /home/andrew/src/openbmc/libmctp/alloc.c:48

SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.6+0x3a5cd) in __interceptor_memcpy
Shadow bytes around the buggy address:
0x0c427fff8450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c427fff8490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff84a0:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff84b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff84c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff84d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff84e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c427fff84f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==42296==ABORTING

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

show more ...

85c04e4727-Oct-2020 Andrew Jeffery <andrew@aj.id.au>

tests: astlpc: Re-order astlpc ops struct definitions

Make it easier to isolate test cases with `#if 0` hackery.

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

tests: astlpc: Re-order astlpc ops struct definitions

Make it easier to isolate test cases with `#if 0` hackery.

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

show more ...

1234