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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 500DAC433FE for ; Wed, 6 Oct 2021 08:18:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29BDF60FC3 for ; Wed, 6 Oct 2021 08:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237761AbhJFIUc (ORCPT ); Wed, 6 Oct 2021 04:20:32 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:36234 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbhJFIUb (ORCPT ); Wed, 6 Oct 2021 04:20:31 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B2E0C20335; Wed, 6 Oct 2021 08:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1633508318; h=from:from:reply-to: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=cRAF9XQbKrlzJn8BZCX3Hi9xm9TVoz2BxZrKoRbPKAo=; b=BO9gIx80fyRID1UM/udQW68aQSz6x9ndFZ3bZI7QcKODlD1Efu9lVVkv+FOi9o9rbVHQ2Q 7CF0SB2jAHX70Q02pbNKNzxYiBNn0StPUmR1Ux7Kgwc3Jd3cc3V8cC77EWFJF4KFN5AOs3 44vSwc+jOrBijc2FPA3xiskbdEyKc6s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1633508318; h=from:from:reply-to: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=cRAF9XQbKrlzJn8BZCX3Hi9xm9TVoz2BxZrKoRbPKAo=; b=p6k9Y6Ivyz1mhKX6cDAyohwVQTBRLcieE5RV7FCrYgMxJl/ges0xWL7ZLWAV/xe9EtmTp6 cOomHR8f9fNJmOBA== Received: from g78 (unknown [10.163.24.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E61D5A3B83; Wed, 6 Oct 2021 08:18:37 +0000 (UTC) References: <20211006074547.14724-1-rpalethorpe@suse.com> User-agent: mu4e 1.6.5; emacs 27.2 From: Richard Palethorpe To: Arnd Bergmann Cc: "David S. Miller" , Jakub Kicinski , Stefano Garzarella , Arseny Krasnov , Colin Ian King , Norbert Slusarek , Andra Paraschiv , Deepa Dinamani , Willem de Bruijn , Linux Kernel Mailing List , Networking , rpalethorpe@richiejp.com Subject: Re: [PATCH] vsock: Handle compat 32-bit timeout Date: Wed, 06 Oct 2021 09:13:37 +0100 Reply-To: rpalethorpe@suse.de In-reply-to: Message-ID: <87ee8ybm76.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Arnd, Arnd Bergmann writes: > On Wed, Oct 6, 2021 at 9:48 AM Richard Palethorpe wrote: >> >> Allow 32-bit timevals to be used with a 64-bit kernel. >> >> This allows the LTP regression test vsock01 to run without >> modification in 32-bit compat mode. >> >> Fixes: fe0c72f3db11 ("socket: move compat timeout handling into sock.c") >> Signed-off-by: Richard Palethorpe >> >> --- >> >> This is one of those fixes where I am not sure if we should just >> change the test instead. Because it's not clear if someone is likely >> to use vsock's in 32-bit compat mode? > > We try very hard to ensure that compat mode works for every interface, > so it should be fixed in the kernel. Running compat mode is common > on memory-restricted machines, e.g. on cloud platforms and on deeply > embedded systems. Thanks! > > However, I think fixing the SO_VM_SOCKETS_CONNECT_TIMEOUT > to support 64-bit timeouts would actually be more important here. I think > what you need to do is to define the macro the same way > as the SO_TIMESTAMP one: > > #define SO_RCVTIMEO (sizeof(time_t) == sizeof(__kernel_long_t) ? \ > SO_RCVTIMEO_OLD : SO_RCVTIMEO_NEW) > #define SO_TIMESTAMP (sizeof(time_t) == sizeof(__kernel_long_t) ? \ > SO_TIMESTAMP_OLD : SO_TIMESTAMP_NEW) > ... > > to ensure that user space picks an interface that matches the > user space definition of 'struct timeval'. > > Your change looks correct otherwise, but I think you should first > add the new interface for 64-bit timeouts, since that likely changes > the code in a way that makes your current patch no longer the > best way to write it. > > Arnd Ah, yes, it will still be broken if libc is configured with 64bit timeval only. -- Thank you, Richard.