lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <457e03a0-7f74-4b9d-3699-ce8775ed69c0@sberdevices.ru>
Date:   Tue, 15 Mar 2022 08:35:44 +0000
From:   Krasnov Arseniy Vladimirovich <AVKrasnov@...rdevices.ru>
To:     Stefano Garzarella <sgarzare@...hat.com>
CC:     Krasnov Arseniy <oxffffaa@...il.com>,
        Rokosov Dmitry Dmitrievich <DDRokosov@...rdevices.ru>,
        "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
        "virtualization@...ts.linux-foundation.org" 
        <virtualization@...ts.linux-foundation.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1 2/3] af_vsock: SOCK_SEQPACKET receive timeout test

On 15.03.2022 11:15, Stefano Garzarella wrote:
> On Fri, Mar 11, 2022 at 10:55:42AM +0000, Krasnov Arseniy Vladimirovich wrote:
>> Test for receive timeout check: connection is established,
>> receiver sets timeout, but sender does nothing. Receiver's
>> 'read()' call must return EAGAIN.
>>
>> Signed-off-by: Arseniy Krasnov <AVKrasnov@...rdevices.ru>
>> ---
>> tools/testing/vsock/vsock_test.c | 49 ++++++++++++++++++++++++++++++++
>> 1 file changed, 49 insertions(+)
>>
>> diff --git a/tools/testing/vsock/vsock_test.c b/tools/testing/vsock/vsock_test.c
>> index 2a3638c0a008..aa2de27d0f77 100644
>> --- a/tools/testing/vsock/vsock_test.c
>> +++ b/tools/testing/vsock/vsock_test.c
>> @@ -391,6 +391,50 @@ static void test_seqpacket_msg_trunc_server(const struct test_opts *opts)
>>     close(fd);
>> }
>>
>> +static void test_seqpacket_timeout_client(const struct test_opts *opts)
>> +{
>> +    int fd;
>> +    struct timeval tv;
>> +    char dummy;
>> +
>> +    fd = vsock_seqpacket_connect(opts->peer_cid, 1234);
>> +    if (fd < 0) {
>> +        perror("connect");
>> +        exit(EXIT_FAILURE);
>> +    }
>> +
>> +    tv.tv_sec = 1;
>> +    tv.tv_usec = 0;
>> +
>> +    if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)) == -1) {
>> +        perror("setsockopt 'SO_RCVTIMEO'");
>> +        exit(EXIT_FAILURE);
>> +    }
>> +
>> +    if ((read(fd, &dummy, sizeof(dummy)) != -1) ||
>> +        (errno != EAGAIN)) {
>> +        perror("EAGAIN expected");
>> +        exit(EXIT_FAILURE);
>> +    }
> 
> The patch LGTM, maybe the only thing I would add here is a check on the time spent in the read(), to see that it is approximately the timeout we have set.

Ack, I'll add it on v2

> 
> Thanks,
> Stefano
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ