From patchwork Tue Nov 21 09:49:49 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: 13462686 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 32A69C5ACB3 for ; Tue, 21 Nov 2023 09:50:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637628.993615 (Exim 4.92) (envelope-from ) id 1r5NOP-0000Zr-VL; Tue, 21 Nov 2023 09:50:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637628.993615; Tue, 21 Nov 2023 09:50: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 1r5NOP-0000ZI-RS; Tue, 21 Nov 2023 09:50:05 +0000 Received: by outflank-mailman (input) for mailman id 637628; Tue, 21 Nov 2023 09:50:04 +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 1r5NOO-00008u-Lv for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 09:50:04 +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 571c7c69-8853-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 10:50:03 +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 D6BE51F8A8; Tue, 21 Nov 2023 09:50:01 +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 B1271138E3; Tue, 21 Nov 2023 09:50:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6KwTKkl9XGVcNQAAMHmgww (envelope-from ); Tue, 21 Nov 2023 09:50:01 +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: 571c7c69-8853-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700560201; 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=ImnKRcdwceNKjdDVCKv+HrhuMRTPVTqJczF/AtYyDP3XK/aZDyn0FlYb7ChrOcf94ZKzeP tb5tdFC6UJqrHNieZjr9spJrp6QpLY87KQaoQTBz4G38P7xOdZygnyyAkEB5Hw+Dqaf3d8 T3Ew9bDLM0otCXSHIxk0V+Qk5OdxedU= 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 v3 1/5] Mini-OS: make xenstore_buf externally visible Date: Tue, 21 Nov 2023 10:49:49 +0100 Message-Id: <20231121094953.22430-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231121094953.22430-1-jgross@suse.com> References: <20231121094953.22430-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-0.60 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.30)[75.12%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[ens-lyon.org,xen.org,suse.com,gmail.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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 Tue Nov 21 09:49:50 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: 13462685 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 862D8C54FB9 for ; Tue, 21 Nov 2023 09:50:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637630.993629 (Exim 4.92) (envelope-from ) id 1r5NOV-00017I-86; Tue, 21 Nov 2023 09:50:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637630.993629; Tue, 21 Nov 2023 09:50:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5NOV-00017B-4l; Tue, 21 Nov 2023 09:50:11 +0000 Received: by outflank-mailman (input) for mailman id 637630; Tue, 21 Nov 2023 09:50:09 +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 1r5NOT-00008u-Eb for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 09:50:09 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5a711029-8853-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 10:50:07 +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-out1.suse.de (Postfix) with ESMTPS id 82EC321979; Tue, 21 Nov 2023 09:50:07 +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 4D18B138E3; Tue, 21 Nov 2023 09:50:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id n6yPEU99XGVxNQAAMHmgww (envelope-from ); Tue, 21 Nov 2023 09:50:07 +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: 5a711029-8853-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700560207; 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=v1odbQaI2Gr+IB2DF9QOM7VdackHo1o2+QYsBMZ4bdY=; b=KfLurMQ4BH9ZlhxVuC+1e+vLr0vYONRl4iXWBkaynG9Z7bfUaO4P1xNdCOD9UOacQQLsAI zTpGlS3ZaK7AbJSmwdygH959eIAlFyzRk3e/NsDZmKamfMPFYoGXsA7jymLIW71o3ghiKL OerhNh/G/0uOnNeB1Hkm1nVZpKMswKE= 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 v3 2/5] Mini-OS: get own domid Date: Tue, 21 Nov 2023 10:49:50 +0100 Message-Id: <20231121094953.22430-3-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231121094953.22430-1-jgross@suse.com> References: <20231121094953.22430-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-0.83 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.53)[80.55%] 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 --- V2: - new patch V3: - rename function to get_domid() (Julien Grall) Signed-off-by: Juergen Gross --- events.c | 33 +++++++++++++++++++++++++++++++++ include/lib.h | 3 +++ 2 files changed, 36 insertions(+) diff --git a/events.c b/events.c index cdae90f4..4683e8e1 100644 --- a/events.c +++ b/events.c @@ -261,6 +261,39 @@ int evtchn_get_peercontext(evtchn_port_t local_port, char *ctx, int size) return rc; } +/* Replace below when a hypercall is available to get the domid. */ +domid_t 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/lib.h b/include/lib.h index fd8c36de..dd68985a 100644 --- a/include/lib.h +++ b/include/lib.h @@ -154,6 +154,9 @@ do { \ /* Consistency check as much as possible. */ void sanity_check(void); +/* Get own domid. */ +domid_t get_domid(void); + #ifdef HAVE_LIBC extern struct wait_queue_head event_queue; From patchwork Tue Nov 21 09:49:51 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: 13462688 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 4B395C54FB9 for ; Tue, 21 Nov 2023 09:50:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637633.993643 (Exim 4.92) (envelope-from ) id 1r5NOa-0001Xr-JR; Tue, 21 Nov 2023 09:50:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637633.993643; Tue, 21 Nov 2023 09:50:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5NOa-0001Xk-Es; Tue, 21 Nov 2023 09:50:16 +0000 Received: by outflank-mailman (input) for mailman id 637633; Tue, 21 Nov 2023 09:50:14 +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 1r5NOY-00008u-PU for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 09:50:14 +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 5dc3f73e-8853-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 10:50:13 +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 0F1111F8A8; Tue, 21 Nov 2023 09:50:13 +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 D7941138E3; Tue, 21 Nov 2023 09:50:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3wJuM1R9XGV9NQAAMHmgww (envelope-from ); Tue, 21 Nov 2023 09:50:12 +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: 5dc3f73e-8853-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700560213; 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=phAppV4EtZF0Z3rNx4++xXTxpsVGKl2OMvyHuw2nsrHhk8IYRMThKWX5ZIDV0mdkApKgPH Y0jkNgcwq5SOHnDkjjPZrypWT3TkSVIrNSZbKhf4GLMEmWrZ//GfAzSXHiaZYSZwVU6m+E WlLe8nboqcgT6YEz9yQ8n2mpkSx2Muo= 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 v3 3/5] Mini-OS: don't crash if no shutdown node is available Date: Tue, 21 Nov 2023 10:49:51 +0100 Message-Id: <20231121094953.22430-4-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231121094953.22430-1-jgross@suse.com> References: <20231121094953.22430-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-1.16 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.86)[85.56%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[ens-lyon.org,xen.org,suse.com,gmail.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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 Tue Nov 21 09:49:52 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: 13462687 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 6CB5FC61D88 for ; Tue, 21 Nov 2023 09:50:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637636.993657 (Exim 4.92) (envelope-from ) id 1r5NOf-000206-RT; Tue, 21 Nov 2023 09:50:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637636.993657; Tue, 21 Nov 2023 09:50:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5NOf-0001zx-Of; Tue, 21 Nov 2023 09:50:21 +0000 Received: by outflank-mailman (input) for mailman id 637636; Tue, 21 Nov 2023 09:50:20 +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 1r5NOe-00008u-FJ for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 09:50:20 +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 6118832b-8853-11ee-98e1-6d05b1d4d9a1; Tue, 21 Nov 2023 10:50:18 +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 9DE341F8A8; Tue, 21 Nov 2023 09:50:18 +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 72D45138E3; Tue, 21 Nov 2023 09:50:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hTaZGlp9XGWINQAAMHmgww (envelope-from ); Tue, 21 Nov 2023 09:50:18 +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: 6118832b-8853-11ee-98e1-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700560218; 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=PrGDdahfNfQ3H/Q9PXDL+f81pggJATumNSVFeTSO2T9il7ghf+LrZzKq4DU0RFMi5YzVe0 /h2Brqh+I+HP1CJPTrmqtZ99DOYWXSdY6QZ0M8WkojzogWFRUUVztFETSrGsT20q6JeLSM O+WmoaI6kQew/eh8pSRzO4Upmsnch5Q= 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 v3 4/5] Mini-OS: fix 9pfs stat receive format Date: Tue, 21 Nov 2023 10:49:52 +0100 Message-Id: <20231121094953.22430-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231121094953.22430-1-jgross@suse.com> References: <20231121094953.22430-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-0.30 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_HAM(-0.00)[41.57%]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[ens-lyon.org,xen.org,suse.com,gmail.com]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] 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 Tue Nov 21 09:49:53 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: 13462689 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 1CEBFC5ACB3 for ; Tue, 21 Nov 2023 09:50:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.637639.993667 (Exim 4.92) (envelope-from ) id 1r5NOm-0002Zy-5R; Tue, 21 Nov 2023 09:50:28 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 637639.993667; Tue, 21 Nov 2023 09:50:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r5NOm-0002Zk-1X; Tue, 21 Nov 2023 09:50:28 +0000 Received: by outflank-mailman (input) for mailman id 637639; Tue, 21 Nov 2023 09:50:27 +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 1r5NOl-0007zB-4D for xen-devel@lists.xenproject.org; Tue, 21 Nov 2023 09:50:27 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 646fbeb5-8853-11ee-9b0e-b553b5be7939; Tue, 21 Nov 2023 10:50:24 +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-out1.suse.de (Postfix) with ESMTPS id 4E93521979; Tue, 21 Nov 2023 09:50:24 +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 17BA9138E3; Tue, 21 Nov 2023 09:50:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id K/VuBGB9XGWhNQAAMHmgww (envelope-from ); Tue, 21 Nov 2023 09:50:24 +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: 646fbeb5-8853-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700560224; 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=RwGWhfyB9qHCNw/w/9VaTGkxHfDfaHsS9buPKleCEVZxZFi6Of4UNX9lKsw7wtebD8ospa sPio5H9udGcRmQPzsPlHFoMbKot97nyE9JkTbAyU0kblakLFSPb6gGkxSwOQcd1fJgvbP+ RBdGieVswBdRpuWvN5xeye5Od5pkF8U= 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 v3 5/5] Mini-OS: fix 9pfs response receiving Date: Tue, 21 Nov 2023 10:49:53 +0100 Message-Id: <20231121094953.22430-6-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231121094953.22430-1-jgross@suse.com> References: <20231121094953.22430-1-jgross@suse.com> MIME-Version: 1.0 Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-2.89 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.59)[98.19%] 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 Reviewed-by: Samuel Thibault --- 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; } }