From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E978C433DB for ; Wed, 17 Mar 2021 12:59:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5827B64F41 for ; Wed, 17 Mar 2021 12:59:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5827B64F41 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:54700 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMVlS-0002nT-8D for qemu-devel@archiver.kernel.org; Wed, 17 Mar 2021 08:59:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMVkk-0002FQ-Lv for qemu-devel@nongnu.org; Wed, 17 Mar 2021 08:58:22 -0400 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]:41776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMVke-0006Gj-Ct for qemu-devel@nongnu.org; Wed, 17 Mar 2021 08:58:19 -0400 Received: by mail-qt1-x831.google.com with SMTP id x9so1251283qto.8 for ; Wed, 17 Mar 2021 05:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5HHNLMHWml3+ETB5EKTIw52cmZO7wwFIrbJzsM104Vk=; b=1J4ryd+DjpmM7rN+/SIxL7KATATXLyJvUfd50yalw7qYvmJ5boTWapASiC8O6fucGR Oe1bw1fy8n6zVRj9BJi0A1VVMppnE4Vy9d9ix23xPClXg2/0+5pws+lvApUzAWxGb77f TS8fQbO3n10E5rw79j9kexdhlQfirxQ85nsPm6gjQjoB94EiboRhuNO0BfjN4RtdhFtG 4BKGxTWaLuG5b83opxXWljXbUSVj7N7vmfZIZ8YME/1jyh8pYRavFJAEtiVQmQeCQdyv +MuRNqB9BXNYJzdRQ6l8JJO4yeIiVIMQu4c7aj8bP/CkK9TKa/XJ4QvRS5S/bcjdBFqg E4XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5HHNLMHWml3+ETB5EKTIw52cmZO7wwFIrbJzsM104Vk=; b=UfzafDsy7+5m6JQuXgHwpiyE2VRjrtb8Yz96aBZaMJjc7OYPla7ODzBEWG+Jwwv5CR Je0ghsLRZjnXpbZNkbK62wbzIZ0HZbyniCM77sqS+5IQjDQLfjl1QYdxdJURjAmi53rL HPCwYPh5c4gIFYULkWKIPyWTt5nCfrSyoai7FAsMbHqAPP/Svcq1r4gth6iZWVS1JGJL 1cErszWMk7MB91gmtG7uk0tZmtVBGmxZITqPlgZfr6X9rqrbJuPXlgEw21oS0BZKEyaS wYv72rHmpjEzsgcnlHgZjlCf6JkmjocryHZlbL6fVXpjp8EbcEv/LPgPmXvWG4adZeFS lNqg== X-Gm-Message-State: AOAM531yM5/80MrXxtDXAYdh7cWys3KxLyF1bPEyFQ77Gb7E7oO5JzRr nYwp6+oXxPPmBoUruJzZwV+GIERZuUb7L7dL12mHJw== X-Google-Smtp-Source: ABdhPJzQdwGqB/FgSJXLwyFPBoR6T2r2RpXpXLilDe23AY3/qmv9l9Lqmo2vpiyecPMwGIrdkAGpOGNEqYgKQfxuYcQ= X-Received: by 2002:ac8:5c44:: with SMTP id j4mr2473220qtj.253.1615985879297; Wed, 17 Mar 2021 05:57:59 -0700 (PDT) MIME-Version: 1.0 References: <20201215162119.27360-1-zhangjiachen.jaycee@bytedance.com> <1709993.NBFj2RoZ23@silver> In-Reply-To: <1709993.NBFj2RoZ23@silver> From: Jiachen Zhang Date: Wed, 17 Mar 2021 20:57:47 +0800 Message-ID: Subject: Re: [External] Re: [RFC PATCH 0/9] Support for Virtio-fs daemon crash reconnection To: Christian Schoenebeck Content-Type: multipart/alternative; boundary="0000000000004dd13b05bdbb0845" Received-SPF: pass client-ip=2607:f8b0:4864:20::831; envelope-from=zhangjiachen.jaycee@bytedance.com; helo=mail-qt1-x831.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , slp@redhat.com, "Michael S . Tsirkin" , "Dr . David Alan Gilbert" , QEMU , virtio-fs@redhat.com, Xie Yongji , =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= , Stefan Hajnoczi Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000004dd13b05bdbb0845 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 17, 2021 at 7:50 PM Christian Schoenebeck < qemu_oss@crudebyte.com> wrote: > On Mittwoch, 17. M=C3=A4rz 2021 11:05:32 CET Stefan Hajnoczi wrote: > > On Fri, Dec 18, 2020 at 05:39:34PM +0800, Jiachen Zhang wrote: > > > Thanks for the suggestions. Actually, we choose to save all state > > > information to QEMU because a virtiofsd has the same lifecycle as its > > > QEMU master. However, saving things to a file do avoid communication > with > > > QEMU, and we no longer need to increase the complexity of vhost-user > > > protocol. The suggestion to save fds to the systemd is also very > > > reasonable > > > if we don't consider the lifecycle issues, we will try it. > > > > Hi, > > We recently discussed crash recovery in the virtio-fs bi-weekly call an= d > > I read some of this email thread because it's a topic I'm interested in= . > > I just had a quick fly over the patches so far. Shouldn't there be some > kind > of constraint for an automatic reconnection feature after a crash to > prevent > this being exploited by ROP brute force attacks? > > E.g. adding some (maybe continuously increasing) delay and/or limiting th= e > amount of reconnects within a certain time frame would come to my mind. > > Best regards, > Christian Schoenebeck > > > Thanks, Christian. I am still trying to figure out the details of the ROP attacks. However, QEMU's vhost-user reconnection is based on chardev socket reconnection. The socket reconnection can be enabled by the "--chardev socket,...,reconnect=3DN" in QEMU command options, in which N means QEMU wi= ll try to connect the disconnected socket every N seconds. We can increase N to increase the reconnect delay. If we want to change the reconnect delay dynamically, I think we should change the chardev socket reconnection code. It is a more generic mechanism than vhost-user-fs and vhost-user backend. By the way, I also considered the socket reconnection delay time in the performance aspect. As the reconnection delay increase, if an application in the guest is doing I/Os, it will suffer larger tail latency. And for now, the smallest delay is 1 second, which is rather large for high-performance virtual I/O devices today. I think maybe a more performant and safer reconnect delay adjustment mechanism should be considered in the future. What are your thoughts? Jiachen --0000000000004dd13b05bdbb0845 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Mar 17, 2021 at 7:50 PM Chris= tian Schoenebeck <qemu_oss@cru= debyte.com> wrote:
On Mittwoch, 17. M=C3=A4rz 2021 11:05:32 CET Stefan Hajnoczi wro= te:
> On Fri, Dec 18, 2020 at 05:39:34PM +0800, Jiachen Zhang wrote:
> > Thanks for the suggestions. Actually, we choose to save all state=
> > information to QEMU because a virtiofsd has the same lifecycle as= its
> > QEMU master. However, saving things to a file do avoid communicat= ion with
> > QEMU, and we no longer need to increase the complexity of vhost-u= ser
> > protocol. The suggestion to save fds to the systemd is also very<= br> > > reasonable
> > if we don't consider the lifecycle issues, we will try it. >
> Hi,
> We recently discussed crash recovery in the virtio-fs bi-weekly call a= nd
> I read some of this email thread because it's a topic I'm inte= rested in.

I just had a quick fly over the patches so far. Shouldn't there be some= kind
of constraint for an automatic reconnection feature after a crash to preven= t
this being exploited by ROP brute force attacks?

E.g. adding some (maybe continuously increasing) delay and/or limiting the =
amount of reconnects within a certain time frame would come to my mind.

Best regards,
Christian Schoenebeck




Thanks,=C2=A0Christian.= I am still trying to figure out the details of the ROP attacks.=C2=A0

However, QEMU's vhost-user reconnection is based o= n chardev socket reconnection. The socket reconnection can be enabled by th= e "--chardev socket,...,reconnect=3DN" in QEMU command options, i= n which N means QEMU will try to connect the disconnected socket every N se= conds. We can increase N to increase the reconnect delay. If we want to cha= nge the reconnect delay dynamically, I think we should change the chardev s= ocket reconnection code. It is a more generic mechanism than vhost-user-fs = and vhost-user backend.

By the way, I also conside= red the socket reconnection delay time in the performance aspect. As the re= connection delay increase, if an application in the guest is doing I/Os, it= will suffer larger tail latency. And for now, the smallest delay is 1 seco= nd, which is rather large for high-performance virtual I/O devices today. I= think maybe a more performant and safer reconnect delay adjustment mechani= sm should be considered in the future. What are your thoughts?

Jiachen

=C2=A0
--0000000000004dd13b05bdbb0845--