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

Re: [PATCH v2] xen: don't continue xenstore initialization in case of errors


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 16 Nov 2021 08:44:52 +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=GQsKGv0HALlMmhe4QU/b961BXx1Qzpd9vBXfpctLga4=; b=NmXrxvfCZiQPYaMIguu4UNUp4B1v7Edmg3pYXEPpZWj7yGUlazaGrv7sgmprgfkc0r6olgs8j2bdkxiBWebp21gkwR+0d+NTgm436PQiND+85D5y1JcV7liG0mZvovLoIMpJ+U0KzaonLvtJkGCi48Tn3FWW8DFSU5IqRa4+LEAl6T7lAfzvZ/Urxvt91Z/H0bE2XZ4wD75VHVXPL2SCseI+f43t1UsvOvCyg0sye6TW+3RrEL4WXdaHGfGQiyCddLcGS3NM0mLBrmsDInHlo711LlyR+t+pHsj/SJmpzj2BSiYszptMgrU0XdksjYihhg1MAgTqS5xwzyjF5kgQXw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SvthTJ/szIRW8n5AE6FusWDewALxLjuW/ki7/mIOR2qtNON5E013EvJ2Qlp5XZIjDYuykYDmY9HFt6ORAcA5tOmh6sW+EDQFHSX0V0Noq87PbV0DWb3HauDzpP6U+g2LN6+SXIZ9abxdaaenDgvgpDWpR097Se8iQRsU+wPcYNZoJyr5ZnS4dV63i4pAGBiivZkgOn6nXIHMWTXlehcYLpsYfLR6fzC9+tn191TuahBNR1ZKQJFfQftrYtVzYNHk/cBpqpCXSOdo4y8iZ8F3t+OLcw7bo7o6SkSuV0fi84IwqO3AvQMECcxZVkp17vCTTkADMmWu7drHTSX8DdPs5w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: boris.ostrovsky@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, Stable@xxxxxxxxxxxxxxx, jgross@xxxxxxxx
  • Delivery-date: Tue, 16 Nov 2021 07:45:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.11.2021 23:27, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
> 
> In case of errors in xenbus_init (e.g. missing xen_store_gfn parameter),
> we goto out_error but we forget to reset xen_store_domain_type to
> XS_UNKNOWN. As a consequence xenbus_probe_initcall and other initcalls
> will still try to initialize xenstore resulting into a crash at boot.
> 
> [    2.479830] Call trace:
> [    2.482314]  xb_init_comms+0x18/0x150
> [    2.486354]  xs_init+0x34/0x138
> [    2.489786]  xenbus_probe+0x4c/0x70
> [    2.498432]  xenbus_probe_initcall+0x2c/0x7c
> [    2.503944]  do_one_initcall+0x54/0x1b8
> [    2.507358]  kernel_init_freeable+0x1ac/0x210
> [    2.511617]  kernel_init+0x28/0x130
> [    2.516112]  ret_from_fork+0x10/0x20
> 
> Cc: <Stable@xxxxxxxxxxxxxxx>
> Cc: jbeulich@xxxxxxxx
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>

For the immediate purpose as described this looks okay, so
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

However, aren't there further pieces missing on this error patch:
- clearing of xenstored_ready in case it got set,
- rolling back xenstored_local_init() (XS_LOCAL) and xen_remap()
  (XS_HVM).
And shouldn't xs_init() failure when called from xenbus_probe()
also result in the driver not giving the appearance of being usable?

> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -909,7 +909,7 @@ static struct notifier_block xenbus_resume_nb = {
>  
>  static int __init xenbus_init(void)
>  {
> -     int err = 0;
> +     int err;
>       uint64_t v = 0;
>       xen_store_domain_type = XS_UNKNOWN;
>  

Minor remark: You may want to take the opportunity and add the
missing blank line here to visually separate the assignment from
the declarations.

Jan




 


Rackspace

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