[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: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 10 Dec 2021 17:41:02 +0100
  • 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=upBtHwekA+CAUjlFIudIbYncLXTb8CCf5PtlFQsDmlE=; b=AoZbuopvR38qpEulsLjwrkpjnCadfP+rFnIdeXSGNeO43TjIMfcnu/bqQqw2/YSLsrY9V6DUtL0iMRET5Fim/s2BgAzpmNT5qJA42TqrwuNtjMMwcK8eS2UlvjWo+UrLWVhmeCwmTEOIvqX9Ve6hp8OCLcY0pB+BhV/qibVxXYzhlxR0wbQ7/2kAgBVYrgU9mW/Zf52TPo/CKslP7TA18M/CDUwFHc5Orq4VPInmv9Eqvl6h/t9UoWl4LlzqdalHU3U3/RhAdVN7ysBFDUeHXp5FJ/XfAZJ3Jpjw6msCOIC10WJkyUX2KTKqfI8HzReC9f0BapQM9vJU7CExLIMiBg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BI1XsfZ/iRKoMqhWcM5ZYPWIjpzyKcCFsi0FU+lG7dnHVZ/ml84y43nNplUj4TZtTw4/tdihRxkdAtvORZ+9KJPKYS6OPY8/9iimJmblhP3VIL4RW7Q+r6iM26Bj8yGLBd2FD/OpbS0beXsB4s+Enl85/N+rAJaDfvq0nAqXeFGDE8MXkaBw1woIkrApzHu3Eq/YOsfjtOsrp876e/s32/vmawK44H3tlpEGej0T0c+b4AQY+CkwvUDcn3tfrloMtVEpMhT1Uo++zS9AWCfVpq8t6CihnCE1Yvv1NpisJhDdShC95PGq7rXI3lLV+txU+qG9pUC0/UFpSp+SaClZ7g==
  • 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>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Fri, 10 Dec 2021 16:41:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.12.2021 15:00, Bertrand Marquis wrote:
>> 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 ?

Well, I'd like confirmation by a maintainer. There are a few aspects to how
things are done in the tool stack which I'm not always aware of. IOW there
might be reasons to keep things as they are after this variant of the patch.

Jan




 


Rackspace

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