public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] vsock01, CVE-2021-26708: Add reproducer for race condition
Date: Fri, 2 Jul 2021 16:26:35 +0200	[thread overview]
Message-ID: <YN8iG1fchuyC/SEI@yuki> (raw)
In-Reply-To: <20210702123533.18008-1-rpalethorpe@suse.com>

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.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-07-02 14:26 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 [this message]
2021-07-06  8:53   ` Richard Palethorpe

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=YN8iG1fchuyC/SEI@yuki \
    --to=chrubis@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox