From mboxrd@z Thu Jan 1 00:00:00 1970 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 E99C5C02194 for ; Fri, 7 Feb 2025 13:18:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgOEs-0003Lx-Dz; Fri, 07 Feb 2025 08:17:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tgOEa-0003IJ-Vs for qemu-devel@nongnu.org; Fri, 07 Feb 2025 08:17:32 -0500 Received: from smtp-out1.suse.de ([195.135.223.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgOEY-0004lu-1K for qemu-devel@nongnu.org; Fri, 07 Feb 2025 08:17:27 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6457221166; Fri, 7 Feb 2025 13:17:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738934243; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xyCRc/Oj+cmkDIwkT9Z+rHuhLGxZKWyeie2SqufzUtQ=; b=c+Ksj84OPBDh5KHdsTpPeC3/7+a5LnsQv8AgbFnfRR/Ko655HraoukJbP7z3Bq6FpKYKJB ptuKFkkqBQOPj8cDRzpW7KLmu2+GywndYj0mAwe2X8RgilS/JEHh054FhUP9Lk/dwRQ9X0 zN0rnApQZJoItZRbTSFEoWHB/tXqhy8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738934243; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xyCRc/Oj+cmkDIwkT9Z+rHuhLGxZKWyeie2SqufzUtQ=; b=KDFQSNnJooLXxeF8ddhmtWvDP6OczYpSmgDUn9TGiLEsVGPPsEiiCIRz6cVKHdYQJWuelL QdcLGsPXkjm4ANAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738934243; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xyCRc/Oj+cmkDIwkT9Z+rHuhLGxZKWyeie2SqufzUtQ=; b=c+Ksj84OPBDh5KHdsTpPeC3/7+a5LnsQv8AgbFnfRR/Ko655HraoukJbP7z3Bq6FpKYKJB ptuKFkkqBQOPj8cDRzpW7KLmu2+GywndYj0mAwe2X8RgilS/JEHh054FhUP9Lk/dwRQ9X0 zN0rnApQZJoItZRbTSFEoWHB/tXqhy8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738934243; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xyCRc/Oj+cmkDIwkT9Z+rHuhLGxZKWyeie2SqufzUtQ=; b=KDFQSNnJooLXxeF8ddhmtWvDP6OczYpSmgDUn9TGiLEsVGPPsEiiCIRz6cVKHdYQJWuelL QdcLGsPXkjm4ANAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CA27113694; Fri, 7 Feb 2025 13:17:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4YkQIeIHpmcDJgAAD6G6ig (envelope-from ); Fri, 07 Feb 2025 13:17:22 +0000 From: Fabiano Rosas To: Peter Xu Cc: "Maciej S. Szmigiero" , Alex Williamson , =?utf-8?Q?Daniel_P=2E_Berrang=C3=A9?= , =?utf-8?Q?C=C3=A9dric?= Le Goater , Eric Blake , Markus Armbruster , Avihai Horon , Joao Martins , qemu-devel@nongnu.org Subject: Re: [PATCH v4 08/33] migration/multifd: Allow premature EOF on TLS incoming channels In-Reply-To: References: <87zfj0mcmy.fsf@suse.de> <87wme4m8ci.fsf@suse.de> <192db6a6-f3ff-4cf9-8537-b849fb3a97b3@maciej.szmigiero.name> <87tt97ma9l.fsf@suse.de> <87msezm75y.fsf@suse.de> <87jza3m12b.fsf@suse.de> Date: Fri, 07 Feb 2025 10:17:19 -0300 Message-ID: <87cyftnbc0.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[10]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid] Received-SPF: pass client-ip=195.135.223.130; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Peter Xu writes: > On Thu, Feb 06, 2025 at 02:32:12PM -0300, Fabiano Rosas wrote: >> > In any case we'd still need some kind of a compatibility behavior for >> > the TLS bit stream emitted by older QEMU versions (which is always >> > improperly terminated). >> > >> >> There is no compat issue. For <= 9.2, QEMU is still doing an extra >> multifd_send_sync_main(), which results in an extra MULTIFD_FLAG_SYNC on >> the destination and it gets stuck waiting for the >> RAM_SAVE_FLAG_MULTIFD_FLUSH that never comes. Therefore the src always >> closes the connection before dst reaches the extra recv(). >> >> I test migration both ways with 2 previous QEMU versions and the >> gnutls_bye() series passes all tests. I also put an assert at >> tlssession.c and never triggers for GNUTLS_E_PREMATURE_TERMINATION. The >> MULTIFD_FLAG_EOS should behave the same. > > Which are the versions you tried? As only 9.1 and 9.2 has 637280aeb2, so I > wonder if the same issue would hit too with 9.0 or older. Good point. 9.0 indeed breaks. > > I'd confess I feel unreliable relying on the side effect of 637280aeb2, > because fundamentally it works based on the fact that multifd threads need > to be kicked out by the main load thread SYNC event on dest QEMU to avoid > the readv() from going wrong. > We're relying on the opposite: mutlifd_recv NOT getting kicked. Which is a bug that 1d457daf86 fixed. > What I'm not sure here is, is it sheer luck that the main channel SYNC will > always arrive _before_ pre-mature terminations of the multifd channels? It > sounds like it could also happen when the multifd channels got its > pre-mature termination early, before the main thread got the SYNC. You lost me here, what main channel sync? Its the MULTIFD_FLAG_SYNC that puts the recv thread in the "won't see the termination" state and that is serialized: SEND RECV -------------------------+---------------------------- 1 multifd_send_sync_main() 2 pending_sync==true, 3 send thread sends SYNC recv thread gets SYNC 4 recv gets stuck. 5 multifd_send_shutdown()