All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Wolfram Sang <wsa@kernel.org>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kernel <kernel@axis.com>
Subject: Re: [PATCH 1/2] i2c: virtio: disable timeout handling
Date: Thu, 21 Oct 2021 11:30:28 +0800	[thread overview]
Message-ID: <df7e6127-05fb-6aad-3896-fc810f213a54@intel.com> (raw)
In-Reply-To: <20211020110316.4x7tnxonswjuuoiw@vireshk-i7>


On 2021/10/20 19:03, Viresh Kumar wrote:
> On 20-10-21, 12:55, Vincent Whitchurch wrote:
>> If the timeout cannot be disabled, then the driver should be fixed to
>> always copy buffers and hold on to them to avoid memory corruption in
>> the case of timeout, as I mentioned in my commit message.  That would be
>> quite a substantial change to the driver so it's not something I'm
>> personally comfortable with doing, especially not this late in the -rc
>> cycle, so I'd leave that to others.
> Or we can avoid clearing up and freeing the buffers here until the
> point where the buffers are returned by the host. Until that happens,
> we can avoid taking new requests but return to the earlier caller with
> timeout failure. That would avoid corruption, by freeing buffers
> sooner, and not hanging of the kernel.


It seems similar to use "wait_for_completion". If the other side is 
hacked, the guest may never

get the buffers returned by the host, right ?


For this moment, we can solve the problem by using a hardcoded big value 
or disabling the timeout.

Over the long term, I think the backend should provide that timeout 
value and guarantee that its processing

time should not exceed that value.



WARNING: multiple messages have this Message-ID (diff)
From: Jie Deng <jie.deng@intel.com>
To: Viresh Kumar <viresh.kumar@linaro.org>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	Wolfram Sang <wsa@kernel.org>, kernel <kernel@axis.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH 1/2] i2c: virtio: disable timeout handling
Date: Thu, 21 Oct 2021 11:30:28 +0800	[thread overview]
Message-ID: <df7e6127-05fb-6aad-3896-fc810f213a54@intel.com> (raw)
In-Reply-To: <20211020110316.4x7tnxonswjuuoiw@vireshk-i7>


On 2021/10/20 19:03, Viresh Kumar wrote:
> On 20-10-21, 12:55, Vincent Whitchurch wrote:
>> If the timeout cannot be disabled, then the driver should be fixed to
>> always copy buffers and hold on to them to avoid memory corruption in
>> the case of timeout, as I mentioned in my commit message.  That would be
>> quite a substantial change to the driver so it's not something I'm
>> personally comfortable with doing, especially not this late in the -rc
>> cycle, so I'd leave that to others.
> Or we can avoid clearing up and freeing the buffers here until the
> point where the buffers are returned by the host. Until that happens,
> we can avoid taking new requests but return to the earlier caller with
> timeout failure. That would avoid corruption, by freeing buffers
> sooner, and not hanging of the kernel.


It seems similar to use "wait_for_completion". If the other side is 
hacked, the guest may never

get the buffers returned by the host, right ?


For this moment, we can solve the problem by using a hardcoded big value 
or disabling the timeout.

Over the long term, I think the backend should provide that timeout 
value and guarantee that its processing

time should not exceed that value.


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-10-21  3:30 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19  7:46 [PATCH 0/2] virtio-i2c: Fix buffer handling Vincent Whitchurch
2021-10-19  7:46 ` Vincent Whitchurch
2021-10-19  7:46 ` [PATCH 1/2] i2c: virtio: disable timeout handling Vincent Whitchurch
2021-10-19  7:46   ` Vincent Whitchurch
2021-10-19  8:09   ` Viresh Kumar
2021-10-19  8:09     ` Viresh Kumar
2021-10-19  9:36     ` Greg KH
2021-10-19  9:36       ` Greg KH
2021-10-19  9:42       ` Viresh Kumar
2021-10-19  9:42         ` Viresh Kumar
2021-10-19 11:15         ` Wolfram Sang
2021-10-19 14:14           ` Viresh Kumar
2021-10-19 14:14             ` Viresh Kumar
2021-10-19 11:16         ` Greg KH
2021-10-19 11:16           ` Greg KH
2021-10-19 14:37           ` Viresh Kumar
2021-10-19 14:37             ` Viresh Kumar
2021-10-19 18:14             ` Wolfram Sang
2021-10-20  4:20               ` Jie Deng
2021-10-20  4:20                 ` Jie Deng
2021-10-20  5:36                 ` Greg KH
2021-10-20  5:36                   ` Greg KH
2021-10-20  6:35                   ` Jie Deng
2021-10-20  6:35                     ` Jie Deng
2021-10-20  6:41                     ` Viresh Kumar
2021-10-20  6:41                       ` Viresh Kumar
2021-10-20  7:04                       ` Jie Deng
2021-10-20  7:04                         ` Jie Deng
2021-10-20 10:55                         ` Vincent Whitchurch
2021-10-20 10:55                           ` Vincent Whitchurch
2021-10-20 11:03                           ` Viresh Kumar
2021-10-20 11:03                             ` Viresh Kumar
2021-10-21  3:30                             ` Jie Deng [this message]
2021-10-21  3:30                               ` Jie Deng
2021-10-29 12:24                               ` Vincent Whitchurch
2021-10-29 12:24                                 ` Vincent Whitchurch
2021-11-01  5:23                                 ` Jie Deng
2021-11-01  5:23                                   ` Jie Deng
2021-11-03  6:18                                   ` Chen, Conghui
2021-11-03  6:37                                     ` Viresh Kumar
2021-11-03  6:37                                       ` Viresh Kumar
2021-11-03 14:42                                       ` Vincent Whitchurch
2021-11-03 14:42                                         ` Vincent Whitchurch
2021-11-09  4:52                                         ` Viresh Kumar
2021-11-09  4:52                                           ` Viresh Kumar
2021-10-20  3:36     ` Jie Deng
2021-10-20  3:36       ` Jie Deng
2021-10-19  7:46 ` [PATCH 2/2] i2c: virtio: fix completion handling Vincent Whitchurch
2021-10-19  7:46   ` Vincent Whitchurch
2021-10-19  8:22   ` Viresh Kumar
2021-10-19  8:22     ` Viresh Kumar
2021-10-20  8:54     ` Jie Deng
2021-10-20  8:54       ` Jie Deng
2021-10-20  9:17       ` Viresh Kumar
2021-10-20  9:17         ` Viresh Kumar
2021-10-20 10:38         ` Vincent Whitchurch
2021-10-20 10:38           ` Vincent Whitchurch
2021-10-20 10:47           ` Viresh Kumar
2021-10-20 10:47             ` Viresh Kumar
2021-10-29 11:54             ` Vincent Whitchurch
2021-10-29 11:54               ` Vincent Whitchurch
2021-10-21  5:55   ` Jie Deng
2021-10-21  5:55     ` Jie Deng
2021-10-21  5:58     ` Viresh Kumar
2021-10-21  5:58       ` Viresh Kumar
2021-11-02  4:32   ` Viresh Kumar
2021-11-02  4:32     ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df7e6127-05fb-6aad-3896-fc810f213a54@intel.com \
    --to=jie.deng@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@axis.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vincent.whitchurch@axis.com \
    --cc=viresh.kumar@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.