[LTP] [PATCH] Test for CVE-2017-2618 in setprocattr
Richard Palethorpe
rpalethorpe@suse.de
Thu Oct 12 15:27:26 CEST 2017
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.
More information about the ltp
mailing list