From patchwork Thu Oct 19 16:21:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13429482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7538BCDB465 for ; Thu, 19 Oct 2023 16:21:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.619524.964739 (Exim 4.92) (envelope-from ) id 1qtVmI-000305-9O; Thu, 19 Oct 2023 16:21:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 619524.964739; Thu, 19 Oct 2023 16:21:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtVmI-0002zy-6U; Thu, 19 Oct 2023 16:21:42 +0000 Received: by outflank-mailman (input) for mailman id 619524; Thu, 19 Oct 2023 16:21:41 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qtVmH-0002zq-8W for xen-devel@lists.xenproject.org; Thu, 19 Oct 2023 16:21:41 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 936ca045-6e9b-11ee-9b0e-b553b5be7939; Thu, 19 Oct 2023 18:21:37 +0200 (CEST) Received: from [2001:8b0:10b:5:583b:153f:ff9:f813] (helo=u3832b3a9db3152.ant.amazon.com) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qtVmA-0081qO-LG; Thu, 19 Oct 2023 16:21:34 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 936ca045-6e9b-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Type:Date:Cc:To: From:Subject:Message-ID:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=8/aCv9ZvI17YL8PRWe77kWCnwdWP8QE7b1K0f1aRw9M=; b=T0+Uqjj2wl7h6PtyV7BLUeHTEn sQMxM4qOnd+jVKg9Kjr8AKEpGF6wQmivHDuwC4AB883Uuplm5wh6OCKpHQnJPYiE3jFQwEQgxxfVu +9Cz7XQQTycItZ3RKufDu+4c4AHfcYDGQll+r1coQGH/cdmDKKPvrrCefBWR45Idi9hZ5JgDYeehH MhI5U8W98VI3owqpb8p7vLfcAto90/l6myXIU04f7Q2HS4NiFuoKk7plbAFdmQBx8F+BELTDYFnZY D5UDem0r5F1Dn9BYcswGjuUaRh9Y3Mo1Ogoyf4X5KeKwaOFL/mpB04X6iVNs56vRQl3X/QDJNZSR1 ezKNRwtw==; Message-ID: Subject: [PATCH] ns16550c: avoid crash in ns16550_endboot in PV shim mode From: David Woodhouse To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Date: Thu, 19 Oct 2023 17:21:33 +0100 User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html From: David Woodhouse In shim mode there is no hardware_domain. Dereferencing the pointer doesn't end well. Signed-off-by: David Woodhouse --- This is about as far as I got in my abortive attempt to use the PV shim without an actual PV console being provided by the HVM hosting environment. It still doesn't pass the guest's console through to serial; that only seems to shim to an actual PV console. xen/drivers/char/ns16550.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 28ddedd50d..0818f5578c 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -586,6 +586,8 @@ static void __init cf_check ns16550_endboot(struct serial_port *port) if ( uart->remapped_io_base ) return; + if (!hardware_domain) + return; rv = ioports_deny_access(hardware_domain, uart->io_base, uart->io_base + 7); if ( rv != 0 ) BUG();