[LTP] [PATCH] Test for CVE-2017-2618 in setprocattr

Guangwen Feng fenggw-fnst@cn.fujitsu.com
Mon Oct 16 07:09:58 CEST 2017


Hi, Richard

Thanks for your review, but it looks like this patch has been pushed.
I will send a new patch to add the check.

Best Regards,
Guangwen Feng

在 10/12/2017 09:27 PM, Richard Palethorpe 写道:
> 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