lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sat, 17 Feb 2024 08:11:52 +0800
From: Jeremy Kerr <jk@...econstruct.com.au>
To: "Ramaiah, DharmaBhushan" <Dharma.Ramaiah@...l.com>, 
	"netdev@...r.kernel.org"
	 <netdev@...r.kernel.org>, "matt@...econstruct.com.au"
	 <matt@...econstruct.com.au>
Subject: Re: MCTP - Bus lock between send and receive

Hi Dharma,

> Linux implementation of the MCTP is via sockets and is realized using
> the “sendto” and “recvfrom”. Requestor intending to send a request
> uses “sendto” and the response is obtained using “recvfrom”. From the
> basic code walkthrough, it appears that the i2c bus is not locked
> between the “sendto” and “recvfrom” i.e., bus is not locked till the
> response is received.

We do take the i2c bus lock over the duration of the MCTP
request/response (or timeout if there is no response). Most of the logic
is here:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mctp/mctp-i2c.c#n483

>  This presents following problems.
>  
>    1. If multiple applications are communicating to the same device,
> device may end up receiving back-to-back requests before sending the
> response for the first request. Few of the devices may not support
> multiple outstanding commands and few of the cases depending on the
> protocol it might throw device into unknown state.

The bus lock does not exclude this. MCTP, as well as some upper-layer
protocols, have specific provisions for multiple messages in flight, and
we assume that the devices will generally behave correctly here. If not,
we can generally quirk this in an upper layer application.

If there are misbehaving devices that require special handling across
protocols, we could look at implementing specific behaviours for those,
but would need details first...

>    1. Consider a case of mux on the I2C bus and there are multiple
> MCTP devices connected on each mux segment. Applications intending to
> communicate to a device on a different mux segment at the same time
> might mux out each other causing the response to be dropped.

Yes, this is the primary use-case for the bus locking.

> Is my understanding correct and is this a known limitation of MCTP on
> Linux?

No, this is not correct - we do have bus locking implemented.

Cheers,


Jeremy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ