From: Richard Palethorpe <rpalethorpe@suse.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Stefano Garzarella <sgarzare@redhat.com>,
Arseny Krasnov <arseny.krasnov@kaspersky.com>,
Colin Ian King <colin.king@canonical.com>,
Norbert Slusarek <nslusarek@gmx.net>,
Andra Paraschiv <andraprs@amazon.com>,
Deepa Dinamani <deepa.kernel@gmail.com>,
Willem de Bruijn <willemb@google.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Networking <netdev@vger.kernel.org>,
rpalethorpe@richiejp.com
Subject: Re: [PATCH] vsock: Handle compat 32-bit timeout
Date: Wed, 06 Oct 2021 09:13:37 +0100 [thread overview]
Message-ID: <87ee8ybm76.fsf@suse.de> (raw)
In-Reply-To: <CAK8P3a0COfvLvnL7WCZY6xp+y=gKhm_RakUJbR9DSbzjit3pGQ@mail.gmail.com>
Hello Arnd,
Arnd Bergmann <arnd@arndb.de> writes:
> On Wed, Oct 6, 2021 at 9:48 AM Richard Palethorpe <rpalethorpe@suse.com> 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 <rpalethorpe@suse.com>
>>
>> ---
>>
>> 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.
prev parent reply other threads:[~2021-10-06 8:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 7:45 [PATCH] vsock: Handle compat 32-bit timeout Richard Palethorpe
2021-10-06 7:59 ` Arnd Bergmann
2021-10-06 8:13 ` Richard Palethorpe [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ee8ybm76.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=andraprs@amazon.com \
--cc=arnd@arndb.de \
--cc=arseny.krasnov@kaspersky.com \
--cc=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=deepa.kernel@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nslusarek@gmx.net \
--cc=rpalethorpe@richiejp.com \
--cc=sgarzare@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox