[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] VT-d: avoid infinite recursion on domain_context_mapping_one() error path


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 7 Apr 2022 10:54:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q9Nglw6eE4Dsn6wn+HpgWD0PvY6JLqpvnlu7/OBr0kM=; b=QAZ5sJWGx/YyHCy6vUnCArYzeS+GsNYBiBQTCLQRhK08jXKifQLf5Y/vq9tHkNEyKlLWGdYsSZP5VLvj3vKOdL50JGIpv/yawVsDpPUKj2D2i5rm7FJfxMYeu/3fc6UpJGBCpZaZn3xIkwquV7WKKcO2LMXGw9P3iDH8mqfbcNcEsmq5pKBB7Q8cq+v0CCiHv2hRHUlBiiv1aouu5raaegrosf6ZuavHkFgaNNnCfmRGFTXDVxGPyX7vajn9uCp6aNvPnxcfnSmCWVmtF/DFfZ/CjjUBo9k3KB9sKmyxtc3knavQCrb3RqBy3aoxj0Z/g1K/2OQ+w/SCee8JKttQxw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pg6ZwaUds0svrnZQB875WhbXGNmVj7fxcXoodoNb6/CL8g5JTmgUxPTPeveqoiqckfJ+4zF8lBKprOBtEPW8gigvNgddSxDXW8eWG4WDxmgKKP1vSBsJMCt2m44PlYcGhrX2qsUTMeWZMeh+GvBPovTRQkNqiwoW48jxMzvxuBku9VqVK4ox8xjyKEKP8vvrujXx+0B0sWFcQL7N7+cUTwx/Bn/CTy2piPQsTjkSCuRITzNz3Et3mQMFhnS2T65rs4idQPGoplGb/FqiDT61e3qhBFPlRLj/0Nwc3PC/Jnpatumu5Qg7GUqt0CHp+ceQkU+6zj3jO1Ndv+Wty/cbzQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Thu, 07 Apr 2022 08:54:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.04.2022 09:51, Roger Pau Monné wrote:
> On Thu, Apr 07, 2022 at 08:11:45AM +0200, Jan Beulich wrote:
>> Despite the comment there infinite recursion was still possible, by
>> flip-flopping between two domains. This is because prev_dom is derived
>> from the DID found in the context entry, which was already updated by
>> the time error recovery is invoked. Simply introduce yet another mode
>> flag to prevent rolling back an in-progress roll-back of a prior
>> mapping attempt.
>>
>> Also drop the existing recursion prevention for having been dead anyway:
>> Earlier in the function we already bail when prev_dom == domain.
> 
> I wonder whether it would be cleaner to stash the previous context
> entry if present and try to (re)set that one instead of recurring into
> ourselves.

I'm not sure this would be cleaner (it might be easier): The entry
may have had modifications which we want to undo by a clean
establishing of the "new" (really original) mapping. Otoh roll-back
can certainly mean simply going back to what was there. But that
would likely want to be a separate change, for likely coming with
a lot of code churn: I'd see the function gaining a two-iteration
loop then, which would mean re-indenting fair parts of it. But
maybe it could also be dealt with by other means, while still not
introducing a fake loop via adding a "goto" back to the top of the
function ...

>> Fixes: 8f41e481b485 ("VT-d: re-assign devices directly")
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.