Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4507512imu; Tue, 15 Jan 2019 00:57:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4C8TjXhzdH6YIwPaVqYRjrbYwj+ghUD1juCJqdCNpW265WjbOzBsbGPlY0flAs1GBaq8oW X-Received: by 2002:a63:f717:: with SMTP id x23mr2835908pgh.317.1547542662554; Tue, 15 Jan 2019 00:57:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547542662; cv=none; d=google.com; s=arc-20160816; b=CgVl8dKq2dwLsuiQ8/pyiDZv8G35s15621h6BOLzePZqaWORt1R4u8XcKGLPpZMC0e ROClEWT7KlELFfN9MpIz4wCidquWJeRiNZbE1DqvoAXZSYzFuc9Keg/3GKx9C+zm2LtZ bPWjBTVb2n/p+ga0dhGM5srVSjAZj1viHIrwBDcGbbYVdvQtAnANC2Qrt9O+Q9LFijNt zjQagREqMqmWK9EuHDvkpWmSs/PVKIxReTofhT5KAPrK3g/AV2WQ2eb/5UAjiP9VVBnE YFeoNl9T7Ug/JOzftluuBQQTV4V2ri9KInJnzDrSc0jX8SmU3v8cH71MUiy/ek4RYaIR 4v7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=XT6UhF8ddx1Drb82FGz8dY0m9pQt1y7PsNSy4v+QC5w=; b=OgXkYi4SZGNKJ0/7Sqqav+1Zsd0XEid18/NIKqRItGixGPWfFG4W3wpUUyHPjM14pg oGbkbri6flUOlvw3Ud07byfyZtYcAzfHvOfjvc6gTt3vuI31oC4ppL1BgXy0J8VXnYqp XiHDTBQSBRK5LyMwjcv+BQEFaJQ6A1nTHb03xyUr6GhGqB3QMFt+t14uK5FVG7a4G+X9 HMSCXDCh1ykx4c66mJLVRNDEWLKFfhqIWEpEiUxV0MHB1YTAX9kL0nOTFo2ong8iGsBA q6ZKO7NMYxp31DNNoWhMkG/IwW3EjFB19d9g6CkV4ZWj/xDPg1knlTyKawzYREWcYGxN eJRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k35si2684797pgm.225.2019.01.15.00.57.27; Tue, 15 Jan 2019 00:57:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728451AbfAOIUo (ORCPT + 99 others); Tue, 15 Jan 2019 03:20:44 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:2019 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728085AbfAOIUn (ORCPT ); Tue, 15 Jan 2019 03:20:43 -0500 X-IronPort-AV: E=Sophos;i="5.56,481,1539648000"; d="scan'208";a="84595790" Date: Tue, 15 Jan 2019 09:20:36 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Dongli Zhang CC: , , , , , Subject: Re: [Xen-devel] [PATCH v6 2/2] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront Message-ID: <20190115082036.y7svi3xz3dkqd4w4@mac> References: <1547484104-20625-1-git-send-email-dongli.zhang@oracle.com> <1547484104-20625-2-git-send-email-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1547484104-20625-2-git-send-email-dongli.zhang@oracle.com> User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 15, 2019 at 12:41:44AM +0800, Dongli Zhang wrote: > The xenstore 'ring-page-order' is used globally for each blkback queue and > therefore should be read from xenstore only once. However, it is obtained > in read_per_ring_refs() which might be called multiple times during the > initialization of each blkback queue. > > If the blkfront is malicious and the 'ring-page-order' is set in different > value by blkfront every time before blkback reads it, this may end up at > the "WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));" in > xen_blkif_disconnect() when frontend is destroyed. > > This patch reworks connect_ring() to read xenstore 'ring-page-order' only > once. > > Signed-off-by: Dongli Zhang LGTM: Reviewed-by: Roger Pau Monn? Thanks!