From patchwork Fri Nov 10 11:34:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13452359 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 ADC30C4332F for ; Fri, 10 Nov 2023 11:35:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630211.982902 (Exim 4.92) (envelope-from ) id 1r1Pmg-000812-Ss; Fri, 10 Nov 2023 11:34:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630211.982902; Fri, 10 Nov 2023 11:34:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmg-00080d-O1; Fri, 10 Nov 2023 11:34:46 +0000 Received: by outflank-mailman (input) for mailman id 630211; Fri, 10 Nov 2023 11:34:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmf-0007vX-U0 for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:45 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 24c674ba-7fbd-11ee-98da-6d05b1d4d9a1; Fri, 10 Nov 2023 12:34:44 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A98A61F8BA; Fri, 10 Nov 2023 11:34:43 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 77EDA13398; Fri, 10 Nov 2023 11:34:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hFVPGlMVTmXfAwAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:43 +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: 24c674ba-7fbd-11ee-98da-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3t0G5pmc2tLtGKnSz0jnViu11fvXLpv0iet8qXj51Qc=; b=RT77VAcD/8qmhPqKRYDJFsLU3i+kRf25gQ+WUCfhbSILqpLleXo659ePRYndl3bYxroFEZ BUsSK/BTrxaxdf0SadYaaO0cEjubUiFpVcDGV9uGzCxRhTsvczddDGWi4lGqzFd/6z1kAh iWOoU3lVzzkQoSJhdspcoGrV6mrFW8M= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 1/5] Mini-OS: make xenstore_buf externally visible Date: Fri, 10 Nov 2023 12:34:31 +0100 Message-Id: <20231110113435.22609-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 For support of the 9pfs frontend in Xenstore-stubdom xenstore_buf needs to be externally visible. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- include/xenbus.h | 2 ++ xenbus.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/xenbus.h b/include/xenbus.h index c0fc0ac5..542ee456 100644 --- a/include/xenbus.h +++ b/include/xenbus.h @@ -8,12 +8,14 @@ typedef unsigned long xenbus_transaction_t; #ifdef CONFIG_XENBUS extern uint32_t xenbus_evtchn; +extern struct xenstore_domain_interface *xenstore_buf; /* Initialize the XenBus system. */ void init_xenbus(void); void get_xenbus(void *p); #else #define xenbus_evtchn ~0 +#define xenstore_buf NULL static inline void init_xenbus(void) { diff --git a/xenbus.c b/xenbus.c index 923e8181..8bfd5bd4 100644 --- a/xenbus.c +++ b/xenbus.c @@ -44,7 +44,7 @@ #define DEBUG(_f, _a...) ((void)0) #endif -static struct xenstore_domain_interface *xenstore_buf; +struct xenstore_domain_interface *xenstore_buf; static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); DECLARE_WAIT_QUEUE_HEAD(xenbus_watch_queue); static __DECLARE_SEMAPHORE_GENERIC(xb_write_sem, 1); From patchwork Fri Nov 10 11:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13452358 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 0C407C4167B for ; Fri, 10 Nov 2023 11:35:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630212.982911 (Exim 4.92) (envelope-from ) id 1r1Pmn-0008MP-1s; Fri, 10 Nov 2023 11:34:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630212.982911; Fri, 10 Nov 2023 11:34:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmm-0008MI-VY; Fri, 10 Nov 2023 11:34:52 +0000 Received: by outflank-mailman (input) for mailman id 630212; Fri, 10 Nov 2023 11:34:52 +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 1r1Pmm-0007he-4H for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:52 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2819436e-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:34:49 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4191C1F8BA; Fri, 10 Nov 2023 11:34:49 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 153EA13398; Fri, 10 Nov 2023 11:34:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Pte9A1kVTmXsAwAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:49 +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: 2819436e-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616089; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oEkaTvWrd2nXatjBd0EXJy9ZObp+JBhOQHMFm6gHKW4=; b=s9UoIFSj79bmGo8WgY7yrK18Ld9fC6vQctHhLCTBqkGMmsjBmbVM1gDtyGugGGBjAj0Qlz tADXA2DapRZ48BJzdZWkqnuM3OO/grtYiQPXRQRi9CeGacPQAj9eVUd5axRdrZU09BDte6 VtrGrER+gGEF/hmdiIKl0QHRxHg8J3I= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 2/5] Mini-OS: get own domid Date: Fri, 10 Nov 2023 12:34:32 +0100 Message-Id: <20231110113435.22609-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 Get the own domid via creation of a temporary event channel. There is no "official" way to read the own domid in PV guests, so use the event channel interface to get it: - allocate an unbound event channel specifying DOMID_SELF for the other end - read the event channel status which will contain the own domid in unbound.dom - close the event channel Signed-off-by: Juergen Gross --- events.c | 32 ++++++++++++++++++++++++++++++++ include/events.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/events.c b/events.c index cdae90f4..af9f9f9e 100644 --- a/events.c +++ b/events.c @@ -261,6 +261,38 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) return rc; } +domid_t evtchn_get_domid(void) +{ + int rc; + domid_t domid = DOMID_INVALID; + evtchn_alloc_unbound_t op; + struct evtchn_status status; + struct evtchn_close close; + + op.dom = DOMID_SELF; + op.remote_dom = DOMID_SELF; + rc = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op); + if ( rc ) + { + printk("ERROR: alloc_unbound failed with rc=%d", rc); + return domid; + } + + status.dom = DOMID_SELF; + status.port = op.port; + rc = HYPERVISOR_event_channel_op(EVTCHNOP_status, &status); + if ( rc ) + printk("ERROR: EVTCHNOP_status failed with rc=%d", rc); + else + domid = status.u.unbound.dom; + + close.port = op.port; + rc = HYPERVISOR_event_channel_op(EVTCHNOP_close, &close); + if ( rc ) + printk("WARN: close_port %d failed rc=%d. ignored\n", close.port, rc); + + return domid; +} /* * Local variables: diff --git a/include/events.h b/include/events.h index 705ad93a..87311481 100644 --- a/include/events.h +++ b/include/events.h @@ -57,4 +57,6 @@ static inline int notify_remote_via_evtchn(evtchn_port_t port) void fini_events(void); void suspend_events(void); +domid_t evtchn_get_domid(void); + #endif /* _EVENTS_H_ */ From patchwork Fri Nov 10 11:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13452360 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 80D93C4332F for ; Fri, 10 Nov 2023 11:35:11 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630215.982930 (Exim 4.92) (envelope-from ) id 1r1Pmu-0000PE-GH; Fri, 10 Nov 2023 11:35:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630215.982930; Fri, 10 Nov 2023 11:35:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmu-0000Oy-Cs; Fri, 10 Nov 2023 11:35:00 +0000 Received: by outflank-mailman (input) for mailman id 630215; Fri, 10 Nov 2023 11:34:58 +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 1r1Pms-0007he-NU for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:34:58 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2b71cb8c-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:34:55 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D74AB1F8BA; Fri, 10 Nov 2023 11:34:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A717613398; Fri, 10 Nov 2023 11:34:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mZB6J14VTmUABAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:34:54 +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: 2b71cb8c-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616094; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UMM1Ggz+vBiGVJdcd2QMUJ1ZGIfkpwMwpm/gMVXFLeQ=; b=hZooTPeThVheEzRapoEd6UFJiQa3WN3RnkHWOV0CJVv/fy91v0n9hCFLqDjphzDoFl8Ocj M/UUI9z1zxlzsSupMF80JwZRdnLSJiyKbHXUZZlMLPNEcEi6OrOe3fO2GUCPLlWrRukScl OZmwN4JSkTsHU1iD8eiNiwBvJryxXrM= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 3/5] Mini-OS: don't crash if no shutdown node is available Date: Fri, 10 Nov 2023 12:34:33 +0100 Message-Id: <20231110113435.22609-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 It might be perfectly fine not to have a control/shutdown Xenstore node. If this is the case, don't crash, but just terminate the shutdown thread after issuing a message that shutdown isn't available. In fini_shutdown() clearing the watch can result in an error now, in case the early exit above was taken. Just ignore this error now. Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- shutdown.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/shutdown.c b/shutdown.c index bb2c6f11..ded6b64d 100644 --- a/shutdown.c +++ b/shutdown.c @@ -75,7 +75,9 @@ static void shutdown_thread(void *p) xenbus_wait_for_watch(&events); if ((err = xenbus_read(XBT_NIL, path, &shutdown))) { free(err); - do_exit(); + free(xenbus_unwatch_path_token(XBT_NIL, path, token)); + printk("Shutdown Xenstore node not available.\n"); + return; } if (end_shutdown_thread) @@ -117,15 +119,9 @@ void init_shutdown(void) void fini_shutdown(void) { - char *err; - end_shutdown_thread = 1; xenbus_release_wait_for_watch(&events); - err = xenbus_unwatch_path_token(XBT_NIL, path, token); - if (err) { - free(err); - do_exit(); - } + free(xenbus_unwatch_path_token(XBT_NIL, path, token)); } #endif From patchwork Fri Nov 10 11:34:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13452361 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 B8595C4332F for ; Fri, 10 Nov 2023 11:35:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630218.982944 (Exim 4.92) (envelope-from ) id 1r1Pmz-0000u4-QT; Fri, 10 Nov 2023 11:35:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630218.982944; Fri, 10 Nov 2023 11:35:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pmz-0000ts-N6; Fri, 10 Nov 2023 11:35:05 +0000 Received: by outflank-mailman (input) for mailman id 630218; Fri, 10 Nov 2023 11:35:04 +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 1r1Pmy-0007he-DA for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:35:04 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2ed45b4b-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:35:00 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7FB3A1F8BB; Fri, 10 Nov 2023 11:35:00 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 454E613398; Fri, 10 Nov 2023 11:35:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aoa7D2QVTmUJBAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:35:00 +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: 2ed45b4b-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616100; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iyiJvbdzxfjlxXumjIe2Le5NJ94QuV7U0Z18Or31ob0=; b=lXQ/tq5ePTKElZQM2cBlSIKbW004yTsXKydCqgdKUBQFJrzrswpHjd9+7NaTI0I9do4B4f pKop2gWJifnXuPOvU98XvCwT0+UJ2pyelDL5f4UjaB6yfibWJQBmzcgOuQH+xtZZOtPqoE BcdJmeRTcmFuPCQuQ5cmoYOjDNJBZSk= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross , Jason Andryuk Subject: [PATCH v2 4/5] Mini-OS: fix 9pfs stat receive format Date: Fri, 10 Nov 2023 12:34:34 +0100 Message-Id: <20231110113435.22609-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 The format string of the received data for the 9pfs stat command is missing the initial 2 byte total length specifier. Add it. Fixes: 2d1dfccd3aa3 ("Mini-OS: add read and write support to 9pfsfront") Signed-off-by: Juergen Gross Reviewed-by: Jason Andryuk --- 9pfront.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/9pfront.c b/9pfront.c index 5da8a365..43c7409f 100644 --- a/9pfront.c +++ b/9pfront.c @@ -711,6 +711,7 @@ static int p9_create(struct dev_9pfs *dev, uint32_t fid, char *path, static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat) { struct req *req = get_free_req(dev); + uint16_t total; int ret; if ( !req ) @@ -719,10 +720,10 @@ static int p9_stat(struct dev_9pfs *dev, uint32_t fid, struct p9_stat *stat) memset(stat, 0, sizeof(*stat)); req->cmd = P9_CMD_STAT; send_9p(dev, req, "U", fid); - rcv_9p(dev, req, "uuUQUUULSSSSSUUU", &stat->size, &stat->type, &stat->dev, - stat->qid, &stat->mode, &stat->atime, &stat->mtime, &stat->length, - &stat->name, &stat->uid, &stat->gid, &stat->muid, &stat->extension, - &stat->n_uid, &stat->n_gid, &stat->n_muid); + rcv_9p(dev, req, "uuuUQUUULSSSSSUUU", &total, &stat->size, &stat->type, + &stat->dev, stat->qid, &stat->mode, &stat->atime, &stat->mtime, + &stat->length, &stat->name, &stat->uid, &stat->gid, &stat->muid, + &stat->extension, &stat->n_uid, &stat->n_gid, &stat->n_muid); ret = req->result; From patchwork Fri Nov 10 11:34:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 13452362 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 F3BC5C4332F for ; Fri, 10 Nov 2023 11:45:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630248.982958 (Exim 4.92) (envelope-from ) id 1r1Pws-0005XR-Ql; Fri, 10 Nov 2023 11:45:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630248.982958; Fri, 10 Nov 2023 11:45:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1Pws-0005XI-Nv; Fri, 10 Nov 2023 11:45:18 +0000 Received: by outflank-mailman (input) for mailman id 630248; Fri, 10 Nov 2023 11:45:17 +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 1r1Pn3-0007he-Do for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 11:35:09 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 32192935-7fbd-11ee-9b0e-b553b5be7939; Fri, 10 Nov 2023 12:35:06 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0A2CD1F8BA; Fri, 10 Nov 2023 11:35:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D240B13398; Fri, 10 Nov 2023 11:35:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id JNYFMmkVTmUYBAAAMHmgww (envelope-from ); Fri, 10 Nov 2023 11:35:05 +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: 32192935-7fbd-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1699616106; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pEEtaKVN/DMgZvS8wiA2rruIly8+jtG6pBEpyWM89Hs=; b=iTkromXprVW3/nlojohrUMSkRDHKNbAXjPRqSQgXtZNtgoDrr9+z3Vs3FUuCmFlWEaWOxD NIKEOvNlJcgV421yMkbkpRvLV02NEins8CCiI+/mkuCA+fEg1h722mm7/EcdQlYiTcqKCH if+Qv8+FJKIqYgYb903VLkCAZFzBrk8= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 5/5] Mini-OS: fix 9pfs response receiving Date: Fri, 10 Nov 2023 12:34:35 +0100 Message-Id: <20231110113435.22609-6-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231110113435.22609-1-jgross@suse.com> References: <20231110113435.22609-1-jgross@suse.com> MIME-Version: 1.0 When copying a 9pfs response chunk from the ring buffer across the ring end, the local ring pointer and length field are not updated correctly. Fix that. Fixes: 0924fec1de58 ("Mini-OS: add 9pfs transport layer") Signed-off-by: Juergen Gross --- V2: - new patch --- 9pfront.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/9pfront.c b/9pfront.c index 43c7409f..35c5552b 100644 --- a/9pfront.c +++ b/9pfront.c @@ -386,7 +386,9 @@ static void copy_bufs(unsigned char **buf1, unsigned char **buf2, printk("9pfs: short copy (dropping %u bytes)\n", len - *len1); len = *len1; } - memcpy(target, *buf1, *len1); + memcpy(target, *buf1, len); + *buf1 += len; + *len1 -= len; } }