Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2876408pxj; Mon, 17 May 2021 11:57:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKspy9qG9RjZAwZDlLRbZAm3zzcXbIFHIHbPr90khBi4ng8ltKaC5bfyA2TgdSSanUPn5g X-Received: by 2002:a05:6e02:12b1:: with SMTP id f17mr731983ilr.187.1621277830839; Mon, 17 May 2021 11:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621277830; cv=none; d=google.com; s=arc-20160816; b=DOV5d9L/6rfMrTEAMiAj6cUagVFT/HpxaTl5xu9BCPJtS/FkXg4bF8qbgIXaeA04hx jiOnKPcnx6zvS862CVCN0ya2xb/ZIfC9oqXdXQyis7e8HuyHdGj1x+hvrnXrhhvDaAMi s4jRctzRiN8vvwrTqFF/9zzX8lMiR0I2o1iWPKZLcjVaT5o/Ro3aBOgAu2Dwl9PGdpkI QKgOjZWBQe0gnTE683WFiNnY65Z6z2n2u/5OBHfmOtCQ5GT7VtTh6ShJCzeeLeElcTwk IkIzDi70tFN64L6ZJlfjMaNGRe7SK8/wAk16+iSZDpR9nhgj+sj3kWsj+d6ZwS6n2d1y hRWg== 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=+NdK/avQ8FBevNdzVt7abclY7ENC4Xp3kwu3bH3BXGU=; b=ZgIW+3hF7qr+mignFuKzRcAeKa38Jq9znrVYw5F/Muq3Enq6bQwUXUCt/LlvyzEblg E5Pbgnbmdv/1wTgTsBxT+6BVMv4PkFrop8DQqvHuhSHDiCCZ8uLedCVvgbIDVqz/Z6L+ AwqshJ9l9QrTfxH5g+628JcdN+z93lN8atlIMwODtkS31WIO1586bYIgB1I+xlP7r3ug zLJdEoPO8o4+oCrJkv1tR0//Tb9+w2LuPjKZ5cAco1LD/YeGkjVa16YOHFb1lPLSYD4P TgR07Yz5Z+j0VSy07wM4IN9ciPkzyQefeiOPmguIX7ZyyaYOp4W/qrrwLkCf4cgqQlAA IptQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=hYPsv114; 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 q4si18497158jas.111.2021.05.17.11.56.55; Mon, 17 May 2021 11:57:10 -0700 (PDT) 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=hYPsv114; 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 S237552AbhEQOCT (ORCPT + 99 others); Mon, 17 May 2021 10:02:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:38878 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbhEQOCS (ORCPT ); Mon, 17 May 2021 10:02:18 -0400 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=1621260061; 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=+NdK/avQ8FBevNdzVt7abclY7ENC4Xp3kwu3bH3BXGU=; b=hYPsv114snNpTzRdG0F8FjOixxA+SuYB69/5PExQu2q6jetyOORhTmI33XUIRFQoSsuumH wm8zR2YajUMDfNKrOTJZip22sEn+XReUuQtivi9aVHWVXxe3Q/Ne8zCb43HBKhQol9uRzg SbZcgBXtsfJDlrDU97x5cATUj+CAjT4= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 67309AC8F; Mon, 17 May 2021 14:01:01 +0000 (UTC) Subject: Re: [PATCH 3/8] xen/blkfront: don't take local copy of a request from the ring page To: Juergen Gross Cc: Boris Ostrovsky , Stefano Stabellini , Konrad Rzeszutek Wilk , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Jens Axboe , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org References: <20210513100302.22027-1-jgross@suse.com> <20210513100302.22027-4-jgross@suse.com> From: Jan Beulich Message-ID: <4cbf7b7f-5f00-4aba-4d54-06aa73d1bc32@suse.com> Date: Mon, 17 May 2021 16:01:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210513100302.22027-4-jgross@suse.com> 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 13.05.2021 12:02, Juergen Gross wrote: > In order to avoid a malicious backend being able to influence the local > copy of a request build the request locally first and then copy it to > the ring page instead of doing it the other way round as today. > > Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich with one remark/question: > @@ -703,6 +704,7 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri > { > struct blkfront_info *info = rinfo->dev_info; > struct blkif_request *ring_req, *extra_ring_req = NULL; > + struct blkif_request *final_ring_req, *final_extra_ring_req; Without setting final_extra_ring_req to NULL just like is done for extra_ring_req, ... > @@ -840,10 +845,10 @@ static int blkif_queue_rw_req(struct request *req, struct blkfront_ring_info *ri > if (setup.segments) > kunmap_atomic(setup.segments); > > - /* Keep a private copy so we can reissue requests when recovering. */ > - rinfo->shadow[id].req = *ring_req; > + /* Copy request(s) to the ring page. */ > + *final_ring_req = *ring_req; > if (unlikely(require_extra_req)) > - rinfo->shadow[extra_id].req = *extra_ring_req; > + *final_extra_ring_req = *extra_ring_req; ... are you sure all supported compilers will recognize the conditional use and not warn about use of a possibly uninitialized variable? Jan