From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] vsock01, CVE-2021-26708: Add reproducer for race condition
Date: Tue, 06 Jul 2021 09:53:51 +0100 [thread overview]
Message-ID: <8735sr961s.fsf@suse.de> (raw)
In-Reply-To: <YN8iG1fchuyC/SEI@yuki>
Hello Cyril,
Cyril Hrubis <chrubis@suse.cz> writes:
> Hi!
>> diff --git a/include/lapi/vm_sockets.h b/include/lapi/vm_sockets.h
>> new file mode 100644
>> index 000000000..94d0248c5
>> --- /dev/null
>> +++ b/include/lapi/vm_sockets.h
>> @@ -0,0 +1,14 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (C) 2021 SUSE LLC <rpalethorpe@suse.com>
>> + */
>> +
>> +#include <sys/socket.h>
>> +
>> +#if HAVE_LINUX_VM_SOCKETS_H
>> +# include <linux/vm_sockets.h>
>> +#endif
>> +
>> +#ifndef VMADDR_CID_LOCAL
>> +# define VMADDR_CID_LOCAL 1
>> +#endif
>
> I've added guards to this header.
>
>> +#include "config.h"
>> +#include "tst_test.h"
>> +
>> +#if HAVE_LINUX_VM_SOCKETS_H
>> +# include "tst_fuzzy_sync.h"
>> +# include "lapi/vm_sockets.h"
>> +
>> +static struct tst_fzsync_pair pair;
>> +int vsock = -1;
>> +
>> +void *writer(LTP_ATTRIBUTE_UNUSED void *unused)
>> +{
>> + const uint64_t b_buflen = 0x4141;
>> +
>> + while (tst_fzsync_run_b(&pair)) {
>> + tst_fzsync_start_race_b(&pair);
>> + SAFE_SETSOCKOPT(vsock, AF_VSOCK,
>> + SO_VM_SOCKETS_BUFFER_SIZE,
>> + &b_buflen, sizeof(b_buflen));
>> + tst_fzsync_end_race_b(&pair);
>> + }
>> +
>> +
>> + return NULL;
>> +}
>
> And sprinkled a few 'static' keywords here, and pushed, thanks.
Just noting; this would be caught by Wmissing-declarations.
--
Thank you,
Richard.
prev parent reply other threads:[~2021-07-06 8:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 12:35 [LTP] [PATCH] vsock01, CVE-2021-26708: Add reproducer for race condition Richard Palethorpe
2021-07-02 14:26 ` Cyril Hrubis
2021-07-06 8:53 ` 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=8735sr961s.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.