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

Re: [PATCH v2] libxc: avoid clobbering errno in xc_domain_pod_target()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 10 Dec 2021 14:00:06 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=r8VcXUS7sdOt5uyX20vcLsKw3rFrqEpG93aATo8RQXM=; b=fHlZz+EDOWgqM8cZ1oYO2yWxtVmXe+nHEazcP8zg9n5GEAfe89OuRr4LBamIM3pqAAD6gSWcZ033ioRyRHfPAVUbUopQ8KgVPSOONOABZWuC+FwgxMA7vdYILTj3v4VeCFmcwo1WZntZXRpFinP7lFihD+QN4GjTKGlS3iiVj1Y0my2Hru2CHKZJMbAgDVud7Zrg8Kz+e2aV1lew83jsIfFvJn5Y0l9jJXiq6uqOx7XwxklrbSnUU1gQPYJ0AxXETMc0m7F7HD+sgHUyTS08pt0LjPstsiL/SBiOYxIBYjnK9SnH9YbTW2r3Na8ka4DlNiaFVrxI5jIjavE7iz1UrQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmcK67p91UcB++XIVeJZKXEHH5NToIjzsUwKFsHJEQmWQCEM+5Xdx/03Jrq2AjZdSVn/ccIAm2UtWSI4dnGdrFje6TZXd3D1g4Xk0/K16xPX3ssgX5J3DxrYMvas+5dKdBaY0T5j3zcbvQKOkqYfFqssyjSOXI4rnfYShY2oC3Ro+s6qIc1d4XamygGri50xiwshM/N3OQbRblzYTnwiSWTizk9nXszwrsOa+10w/GIT7iTjaItt5hz3gH1nRUp4fpBC7yDIbn4bcd5yJjIhBYE0LU2CJhYtKcE6nIBoLDM2GESK7eGoaaatVGcQXU9wXi3K75NFWrpVoQJGZ2h18Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Fri, 10 Dec 2021 14:00:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHX7ceTNtjLavE+e0K+in6YCJvpZawrvk0AgAABFoCAAAGGAA==
  • Thread-topic: [PATCH v2] libxc: avoid clobbering errno in xc_domain_pod_target()

Hi Jan,

> On 10 Dec 2021, at 13:54, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> 
> On 10.12.2021 14:50, Bertrand Marquis wrote:
>>> On 10 Dec 2021, at 13:11, Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>> 
>>> do_memory_op() supplies return value and has "errno" set the usual way.
>>> Don't overwrite "errno" with 1 (aka EPERM on at least Linux). There's
>>> also no reason to overwrite "err".
>>> 
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> 
> Thanks.
> 
>> But if err can really only be 0 or -1, I do wonder if the else forcing err 
>> to 0 could
>> be removed but I must say I have no idea if do_memory_op could return a 
>> value >0.
> 
> Indeed - see ...
> 
>>> ---
>>> While the hypervisor side of the hypercall gives the impression of being
>>> able to return positive values as of 637a283f17eb ("PoD: Allow
>>> pod_set_cache_target hypercall to be preempted"), due to the use of
>>> "rc >= 0" there, afaict that's not actually the case. IOW "err" can
>>> really only be 0 or -1 here, and hence its setting to zero may also be
>>> worthwhile to drop.
>>> ---
> 
> ... this.

So the else should be dropped then, why not doing it and just mentioning it 
there ?

Bertrand

> 
> Jan
> 




 


Rackspace

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