From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 614EA42970 for ; Mon, 17 Apr 2023 21:16:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 58D1140DFB; Mon, 17 Apr 2023 21:16:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id B6D2440698 for ; Mon, 17 Apr 2023 21:16:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681758968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rH1IpBSi9KhdFwnjPuVVT9mVO61mUIBuE6Qd6VmYgFk=; b=JKXeiMEKZnY2lqRuWQcSY4XxRksZ9QaGJqJGj7wk3F+aWVYhmNq/gmbsDzrgSkPoBFN9QF 3ybvWU6HHqniVFBCdc+ZvUHC6X0tmEw2PNfBE/5vVHhCMzvWYeHBwP0/UkxnWDNBRhmGKg j1zIws5yMYwMaiV2p56pza70H8jbGAg= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-388-hLaL1mUXNvaTBVBphGpaew-1; Mon, 17 Apr 2023 15:16:06 -0400 X-MC-Unique: hLaL1mUXNvaTBVBphGpaew-1 Received: by mail-ej1-f69.google.com with SMTP id tj6-20020a170907c24600b0093d7f81fd04so9095630ejc.19 for ; Mon, 17 Apr 2023 12:16:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681758965; x=1684350965; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rH1IpBSi9KhdFwnjPuVVT9mVO61mUIBuE6Qd6VmYgFk=; b=NRJSw2GjXczqV/uQX0ac1Qj505k+Bb01vefy/Lud1PERIJhrk52KhD2E6RdL8FZuuu tUXKamjdUtLTigIus9XgMmVCmUQix0cvJUBN5Xv3DDm1BW43MN/7u2uzevmsG2uhzHys KmXbQrWOT9xt/Xuk9OQoQQWw1vd1PhNL72gjTfW7MgPmY/IqzELh8MH6r/x/3Mo42rcl cP3q0bu0+nZttOgAxileqehGfjKPD8gwEywWyeXELLBsTezTkcC9XfVH6go7cVxycQqu mcDcllMKRm4/MaA+jxKFIR/2GzzbbNMLHp8hzF2/2i4hJ+NerPJlAoVuS5FS3Ifp02PV EjPw== X-Gm-Message-State: AAQBX9d3GxyjrsIW0xBvR55yFk2C2Ug4g/5obvrDyLfyc3gzti+6Z7wb rRt/nSNR0gVJ5lCiptKv+E4ybiHfbgEFqH50qRwxrkseO9aETG+QiBTN0meGQJ+VJdUtR0ToGF7 ZN/tJeW+l1g5WVSeegBcqLyY= X-Received: by 2002:a17:907:90c4:b0:94a:62d4:91b8 with SMTP id gk4-20020a17090790c400b0094a62d491b8mr7433303ejb.11.1681758965672; Mon, 17 Apr 2023 12:16:05 -0700 (PDT) X-Google-Smtp-Source: AKy350aT2tmamjbVSbe1VJ1P8NDTlZzw9gq45ZSDzwjxs1coVAM2DcMcshptN1QGkA8fE3J/+b1tfWmW489hWcbdvC4= X-Received: by 2002:a17:907:90c4:b0:94a:62d4:91b8 with SMTP id gk4-20020a17090790c400b0094a62d491b8mr7433282ejb.11.1681758965361; Mon, 17 Apr 2023 12:16:05 -0700 (PDT) MIME-Version: 1.0 References: <20230331154259.1447831-1-maxime.coquelin@redhat.com> <20230331154259.1447831-4-maxime.coquelin@redhat.com> In-Reply-To: <20230331154259.1447831-4-maxime.coquelin@redhat.com> From: Mike Pattrick Date: Mon, 17 Apr 2023 15:15:54 -0400 Message-ID: Subject: Re: [RFC 03/27] vhost: fix IOTLB entries overlap check with previous entry To: Maxime Coquelin Cc: dev@dpdk.org, david.marchand@redhat.com, chenbo.xia@intel.com, fbl@redhat.com, jasowang@redhat.com, cunming.liang@intel.com, xieyongji@bytedance.com, echaudro@redhat.com, eperezma@redhat.com, amorenoz@redhat.com, stable@dpdk.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Fri, Mar 31, 2023 at 11:43=E2=80=AFAM Maxime Coquelin wrote: > > Commit 22b6d0ac691a ("vhost: fix madvise IOTLB entries pages overlap chec= k") > fixed the check to ensure the entry to be removed does not > overlap with the next one in the IOTLB cache before marking > it as DONTDUMP with madvise(). This is not enough, because > the same issue is present when comparing with the previous > entry in the cache, where the end address of the previous > entry should be used, not the start one. > > Fixes: dea092d0addb ("vhost: fix madvise arguments alignment") > Cc: stable@dpdk.org > > Signed-off-by: Maxime Coquelin Hi Maxime, This makes sense. Acked-by: Mike Pattrick > --- > lib/vhost/iotlb.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/vhost/iotlb.c b/lib/vhost/iotlb.c > index 3f45bc6061..870c8acb88 100644 > --- a/lib/vhost/iotlb.c > +++ b/lib/vhost/iotlb.c > @@ -178,8 +178,8 @@ vhost_user_iotlb_cache_random_evict(struct virtio_net= *dev, struct vhost_virtque > mask =3D ~(alignment - 1); > > /* Don't disable coredump if the previous node is= in the same page */ > - if (prev_node =3D=3D NULL || > - (node->uaddr & mask) !=3D (prev_n= ode->uaddr & mask)) { > + if (prev_node =3D=3D NULL || (node->uaddr & mask)= !=3D > + ((prev_node->uaddr + prev_node->s= ize - 1) & mask)) { > next_node =3D RTE_TAILQ_NEXT(node, next); > /* Don't disable coredump if the next nod= e is in the same page */ > if (next_node =3D=3D NULL || ((node->uadd= r + node->size - 1) & mask) !=3D > @@ -283,8 +283,8 @@ vhost_user_iotlb_cache_remove(struct virtio_net *dev,= struct vhost_virtqueue *vq > mask =3D ~(alignment-1); > > /* Don't disable coredump if the previous node is= in the same page */ > - if (prev_node =3D=3D NULL || > - (node->uaddr & mask) !=3D (prev_n= ode->uaddr & mask)) { > + if (prev_node =3D=3D NULL || (node->uaddr & mask)= !=3D > + ((prev_node->uaddr + prev_node->s= ize - 1) & mask)) { > next_node =3D RTE_TAILQ_NEXT(node, next); > /* Don't disable coredump if the next nod= e is in the same page */ > if (next_node =3D=3D NULL || ((node->uadd= r + node->size - 1) & mask) !=3D > -- > 2.39.2 >