Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp538070pxb; Wed, 27 Jan 2021 14:18:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/KlyjZHRdXtSjdxR05wEp2S1bGZvBFRcnsjXFzZvRZANRRWlxqzgZr4wIqHXexGw7epBJ X-Received: by 2002:a50:b5c5:: with SMTP id a63mr11017654ede.227.1611785884937; Wed, 27 Jan 2021 14:18:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611785884; cv=none; d=google.com; s=arc-20160816; b=NVuMaf/6/wvY3rQNPouT/4agOdv66aK9anGxMWQKJqqQdGV8G56TJ6fDCdIjqZurQI XehI+OTwENSeNmyCi3CByo9d76+ThtVnzF72PmBMZ2REVOCxaxJjio301YIHdfGnMLs0 t7g9zKqBvU70PYKglYY0Nsczz+JP39OdNDHTOl2xfy377MDnp38HbYY65/f/FNuRi8kV FmW1b7n9bjN3VYfVcQFYi9bJXX8cUqYqPgYWVq3L9c9KoDBCTX7ik1657Clr2tHhXvD6 lkCEniv1KXCJSulVtUFXa1wqe+D1lH1dm9nljtdy2g6ImKm+xnzV7vFVE/Z0CFPuDQFh DmCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=X22pjoc3R05cEyBcSdDS4M+jzZBi8OqIcNLr6tG6NLo=; b=N9wG2SPtlBRX95sKEAU6Eiovdwg+6FcgABKsK4QNNpV5bQvhOWzIpPUhbSk7p105x6 SuvqQ35ZQletGkVhXxpFN1bTvbuIN6vK6iBNLmUVraZpyuyC4V6aduj79HzuZU3qW+AV O5Q09FCTt6of4yWyg4PGzI4oXKr7YuRMvWOsgQWWj3/3zpYtd/ekRvO+Bm4LOSJrF6MI 4c5hvk4PQYHY0PDKqsnsbQH/kkkVlNycPSNHQBxB5b9EGcFMs+vq5iocAYVU+xxPXfgA oftiy1fibGkd9V4cTtIAaIVXgRMh4JJcgpXyd7KhlLugZzVZt4EZQxb1vcMvJIs3scRj T00A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=nWOlT5MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si1647318edy.179.2021.01.27.14.17.40; Wed, 27 Jan 2021 14:18:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=nWOlT5MK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235616AbhA0LCT (ORCPT + 99 others); Wed, 27 Jan 2021 06:02:19 -0500 Received: from mx2.suse.de ([195.135.220.15]:46450 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236284AbhA0K5n (ORCPT ); Wed, 27 Jan 2021 05:57:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1611745017; h=from:from:reply-to: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=X22pjoc3R05cEyBcSdDS4M+jzZBi8OqIcNLr6tG6NLo=; b=nWOlT5MKFwcGje+YqBzXMPqVKCRFjabR9mcyxK5VaWeAAj2AB61FSPqmvMIC96JshZSh15 E/ttqk3HsfnyQzDb3FuyzUWFrqGv9F4pRupOeYjEtUX5mzbiu9+YhMg+RkxaVWKQYiyG/v y4OM9V4DsGMBEY4bt99qv7mCEL/8r3I= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0F674AD2B; Wed, 27 Jan 2021 10:56:57 +0000 (UTC) Subject: Re: [PATCH] xen-blkback: fix compatibility bug with single page rings To: Paul Durrant Cc: Paul Durrant , Konrad Rzeszutek Wilk , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Jens Axboe , Dongli Zhang , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, xen-devel@lists.xenproject.org References: <20210127103034.2559-1-paul@xen.org> From: Jan Beulich Message-ID: Date: Wed, 27 Jan 2021 11:56:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210127103034.2559-1-paul@xen.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.01.2021 11:30, Paul Durrant wrote: > From: Paul Durrant > > Prior to commit 4a8c31a1c6f5 ("xen/blkback: rework connect_ring() to avoid > inconsistent xenstore 'ring-page-order' set by malicious blkfront"), the > behaviour of xen-blkback when connecting to a frontend was: > > - read 'ring-page-order' > - if not present then expect a single page ring specified by 'ring-ref' > - else expect a ring specified by 'ring-refX' where X is between 0 and > 1 << ring-page-order > > This was correct behaviour, but was broken by the afforementioned commit to > become: > > - read 'ring-page-order' > - if not present then expect a single page ring > - expect a ring specified by 'ring-refX' where X is between 0 and > 1 << ring-page-order > - if that didn't work then see if there's a single page ring specified by > 'ring-ref' > > This incorrect behaviour works most of the time but fails when a frontend > that sets 'ring-page-order' is unloaded and replaced by one that does not > because, instead of reading 'ring-ref', xen-blkback will read the stale > 'ring-ref0' left around by the previous frontend will try to map the wrong > grant reference. > > This patch restores the original behaviour. Isn't this only the 2nd of a pair of fixes that's needed, the first being the drivers, upon being unloaded, to fully clean up after itself? Any stale key left may lead to confusion upon re-use of the containing directory. Jan