public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] Test for CVE-2017-2618 in setprocattr
Date: Thu, 12 Oct 2017 15:27:26 +0200	[thread overview]
Message-ID: <87k2007ayp.fsf@our.domain.is.not.set> (raw)
In-Reply-To: <20170831074404.26337-1-fenggw-fnst@cn.fujitsu.com>

Hello,

Guangwen Feng writes:

> +
> +#include <errno.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include "tst_test.h"
> +
> +#define LOOPS	100
> +#define PATH_ATTRFS	"/proc/self/attr/fscreate"

Will this exist on all systems? I am guessing that if SELINUX is not
configured in the kernel then this won't exist. So it is probably best
to exit with TCONF if we can not find it.

> +
> +static void do_test(void)
> +{
> +	int i, fd;
> +
> +	for (i = 0; i < LOOPS; i++) {
> +		if (!SAFE_FORK()) {
> +			fd = SAFE_OPEN(PATH_ATTRFS, O_WRONLY);
> +			write(fd, "\n", 1);
> +			SAFE_CLOSE(fd);
> +			exit(0);
> +		}
> +
> +		tst_reap_children();
> +	}
> +
> +	tst_res(TPASS, "Bug not reproduced");
> +}
> +
> +static struct tst_test test = {
> +	.forks_child = 1,
> +	.test_all = do_test,
> +};
> --
> 2.9.4

Otherwise this looks good.

--
Thank you,
Richard.

  reply	other threads:[~2017-10-12 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31  7:44 [LTP] [PATCH] Test for CVE-2017-2618 in setprocattr Guangwen Feng
2017-10-12 13:27 ` Richard Palethorpe [this message]
2017-10-16  5:09   ` Guangwen Feng

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=87k2007ayp.fsf@our.domain.is.not.set \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox