From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] Add regression test for CVE-2017-17052
Date: Fri, 12 Jan 2018 11:45:40 +0100 [thread overview]
Message-ID: <20180112104540.GA22350@rei> (raw)
In-Reply-To: <20180110155505.28433-1-mmoese@suse.de>
Hi!
> +static void *mmap_thread(void *_arg)
> +{
> + for (;;) {
> + SAFE_MMAP(NULL, 0x1000000, PROT_READ,
> + MAP_POPULATE|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
> + }
> +}
> +
> +static void *fork_thread(void *_arg)
> +{
> + if (shm->exit) {
> + SAFE_SHMDT(shm);
> + exit(0);
> + }
> +
> + usleep(rand() % 10000);
> + SAFE_FORK();
> +}
> +
> +static void do_test_fork(void)
> +{
> + volatile int i;
> + int status;
> +
> + SAFE_FORK();
> + SAFE_FORK();
> + SAFE_FORK();
> +
> + for(;;) {
> + if (SAFE_FORK() == 0) {
> + pthread_t t;
> +
> + SAFE_PTHREAD_CREATE(&t, NULL, mmap_thread, NULL);
> + SAFE_PTHREAD_CREATE(&t, NULL, fork_thread, NULL);
> + usleep(rand() % 10000);
> + syscall(__NR_exit_group, 0);
> + }
> + SAFE_WAIT(&status);
> + if (shm->exit)
> + exit(0);
> + }
> +}
> +
> +static void run(void)
> +{
> + pid_t pid;
> + int status;
> + volatile int run = 0;
> +
> + while (run < RUNS) {
> + pid = SAFE_FORK();
> +
> + if (pid == 0) {
> + do_test_fork();
> + } else {
> + usleep(EXEC_USEC);
> + shm->exit = 1;
> + }
> + tst_res(TINFO, "run %d passed\n", run);
> + run++;
> + }
> +
> + if (run == RUNS)
> + tst_res(TPASS, "kernel survived %d runs", run);
> + else
> + tst_res(TBROK, "something strange happened");
Apart from the SHM, that's already been commented here my only question
is what is the outcome of the test on unpatched kernel? I suppose that
we got TPASS when everything is going well, do we print the "something
strange happened" message if the test fails, or does it fail elsewhere?
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-01-12 10:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 15:55 [LTP] [PATCH v2] Add regression test for CVE-2017-17052 Michael Moese
2018-01-11 12:26 ` Richard Palethorpe
2018-01-11 12:36 ` Michael Moese
2018-01-12 10:45 ` Cyril Hrubis [this message]
2018-01-12 10:52 ` Michael Moese
2018-01-12 10:56 ` Cyril Hrubis
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=20180112104540.GA22350@rei \
--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