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

Re: [PATCH 2/5] libxl: drop dead assignments to "ret" from libxl__domain_config_setdefault()


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 13 Jun 2023 08:33:05 +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=6nTSCP1DrphARgb/sSss1tiuIipQY1cAGUSlHw5dzoU=; b=dAbFflAHy1jgt3RBSUDsvmGhyF38Tl5MeMPL4KKHFSmWKmI7ZDW1s5u1OH2QF1REjqQvsJGWRPCactJToNuVKqPW8ZgFeYrp/80Rww85R87QAJIY9F/qfom2MJJCgK/pvsZGd24VyokWDhHApRp65xH34H0E5IAw5eF04fTXVHYT8qBDx22wLN7A/Y2Rh7XHmHyTxB8is4NeQNbIRznN8lOK4hIDQysZTcVm4K2FMLfeCrIGWbpUpWJWtnil3Ks58suA85S784H4k8wr6lmhIP0i8q2wkZ+Zf5J517QN0ZlaQNJyZ1xiwJVyxral1PsLDZHmpkxJaWYhTnlttJ5dsQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fV7q0u+FNSjsus/y733Ner8bYahQi6u+f4Ht6vUKsr1Zuhnmsv1FSpiSIa7qOjxo672c4KWRU/RCNyD6ezrVqXRaxj/lSQC6LEuaOOet2Op/BGocpu+Gv6BI0cOSakjoIogDN/xjJGheZo7RhRawoewKaeQ0nRft/3gZk/kyWn9qwiLIFTIQ28LURHHldl0xO57Uku2vqP0WxsqyjR58+ZmC4oGsrvlKqkq9koKAtZVoqMV8LevNgrfD2ukfPR08/BuZ6jJw9t0LEu5ee7+zUnOBxKhyVA2Sb7sWCt28lOpIu1hVCFbLRVs0eygQlEIcpCt5f0GEUC5QUpTGnvZ5xg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Anthony Perard <anthony.perard@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 13 Jun 2023 06:33:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.06.2023 22:21, Daniel P. Smith wrote:
> 
> 
> On 6/12/23 15:44, Daniel P. Smith wrote:
>> On 6/12/23 07:46, Jan Beulich wrote:
>>> The variable needs to be properly set only on the error paths.
>>>
>>> Coverity ID: 1532311
>>> Fixes: ab4440112bec ("xl / libxl: push parsing of SSID and CPU pool ID 
>>> down to libxl")
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>
>> Reviewed-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxx>

Thanks.

>>> ---
>>> If XSM is disabled, is it really useful to issue the 2nd and 3rd calls
>>> if the 1st yielded ENOSYS?
>>
>> Would you be okay with the calls staying if instead on the first 
>> invocation of any libxl_flask_* method, flask status was checked and 
>> stored in a variable that would then be checked by any subsequent calls 
>> and immediately returned if flask was not enabled?

I'm wary of global variables in shared libraries.

> Looking closer I realized there is a slight flaw in the logic here. The 
> first call is accomplished via an xsm_op call and then assumes that 
> FLASK is the only XSM that has implemented the xsm hook, xsm_op, and 
> that the result will be an ENOSYS. If someone decides to implement an 
> xsm_op hook for any of the existing XSM modules or introduces a new XSM 
> module that has an xsm_op hook, the return likely would not be ENOSYS. I 
> have often debated if there should be a way to query which XSM module 
> was loaded for instances just like this. The question is what mechanism 
> would be best to do so.

Well, this is what results from abusing ENOSYS. The default case of a
switch() in a handler shouldn't return that value. Only if the entire
hypercall is outright unimplemented, returning ENOSYS is appropriate.
In fact I wonder whether dummy.h's xsm_do_xsm_op() is validly doing so,
when that function also serves as the fallback for XSM modules
choosing to not implement any of the op-s (like SILO does).

Since in the specific case here it looks like the intention really is
to carry out Flask-specific operations, a means to check for Flask
specifically might indeed be appropriate. If not a new sub-op of
xsm_op, a new sysctl might be another option.

Jan



 


Rackspace

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