Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp134371pxb; Wed, 6 Oct 2021 01:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo0boqCXaSoMNwCnxTf8SnR4uGuXCQPjgzpZ6n5v8m8wi6bGTpv/gmvZS24ZbUuIglBoeB X-Received: by 2002:a17:90b:4c8d:: with SMTP id my13mr9416316pjb.101.1633508409866; Wed, 06 Oct 2021 01:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633508409; cv=none; d=google.com; s=arc-20160816; b=yh+usGq4VqzTBHZmnOxn2faqQYiEAIVF4r9GLwSRJ7dXgKSTdDTMf5bIkIYOoaP/9H cOoMmFlkU3H6jLJQuyTwApcBkznRqdyLHNIbubMV/dZhRedR2nUzlH0tosUefazl2f+4 UFYt1fnc34RpXq0CsNeT48DF+nHdGVbIQUk9oIbSFT0XnxrjaGGRO53kNcjPvryNdJFY FXTts4WpUBme0SXcC7RHFulrjRd87b2hiMg+mEMevrwMbE8s1e+sEcSUXyYzeQQLx7/e 0KkJNQWHfnPT2Acr0BnHzwVahAxE++VsPENYBwYe3FzG7uYLg/VvuhmIfR1JauLEjCai QMEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:reply-to :date:subject:cc:to:from:user-agent:references:dkim-signature :dkim-signature; bh=cRAF9XQbKrlzJn8BZCX3Hi9xm9TVoz2BxZrKoRbPKAo=; b=kDDJtfBMacntXmWjiGa+uYgONRmbPswcjdgCeP5ebDjCl9CWgz5oIZjbjExuW43z8K Fe2LjGu4aVdi4ww/i/lf3zMoEjFNcUOvJEIEF7L4nuRhA8/7K9D/0CsDhpJmb/QanKdH +prqzXuRFOReM90TTOW20RJuV9WygSbLEqCgyLCQAVkd6sgnl6Ll56Dcal+soUflPuTM 3HtH17PzmWPoDROwRSmNXKrQKN6wcJ6ZlL7WGq12G7nB3ThNMsf/BKnr3BFJ8SlRR4si sGtLnIMDBbY2ot/nmLsbkZ+mhxIVXoP5OlDaltuLZ7eWnBoolLrTpvWU3nr3K7bD9s4z z2mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BO9gIx80; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si25254921pfn.170.2021.10.06.01.19.54; Wed, 06 Oct 2021 01:20:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BO9gIx80; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237751AbhJFIUc (ORCPT + 99 others); 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.