lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5e2b4a9e2028_551b2aaf5fbda5b8e1@john-XPS-13-9370.notmuch>
Date:   Fri, 24 Jan 2020 11:50:54 -0800
From:   John Fastabend <john.fastabend@...il.com>
To:     Martin Lau <kafai@...com>, Lorenz Bauer <lmb@...udflare.com>,
        John Fastabend <john.fastabend@...il.com>
Cc:     Shuah Khan <shuah@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf 1/4] selftests: bpf: use a temporary file in
 test_sockmap

Martin Lau wrote:
> On Thu, Jan 23, 2020 at 04:59:30PM +0000, Lorenz Bauer wrote:
> > Use a proper temporary file for sendpage tests. This means that running
> > the tests doesn't clutter the working directory, and allows running the
> > test on read-only filesystems.
> > 
> > Signed-off-by: Lorenz Bauer <lmb@...udflare.com>
> > ---
> >  tools/testing/selftests/bpf/test_sockmap.c | 15 +++++----------
> >  1 file changed, 5 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> > index 4a851513c842..779e11da979c 100644
> > --- a/tools/testing/selftests/bpf/test_sockmap.c
> > +++ b/tools/testing/selftests/bpf/test_sockmap.c
> > @@ -331,7 +331,7 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt,
> >  	FILE *file;
> >  	int i, fp;
> >  
> > -	file = fopen(".sendpage_tst.tmp", "w+");
> > +	file = tmpfile();
> >  	if (!file) {
> >  		perror("create file for sendpage");
> >  		return 1;
> > @@ -340,13 +340,8 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt,
> >  		fwrite(&k, sizeof(char), 1, file);
> >  	fflush(file);
> >  	fseek(file, 0, SEEK_SET);
> > -	fclose(file);
> >  
> > -	fp = open(".sendpage_tst.tmp", O_RDONLY);
> > -	if (fp < 0) {
> > -		perror("reopen file for sendpage");
> > -		return 1;
> > -	}
> > +	fp = fileno(file);
> It may be better to keep fp == -1 check here.
> It is not clear to me the original intention of reopen.
> I would defer to John for comment.
> 

Seeing fileno shouldn't fail seems OK to me.

> >  
> >  	clock_gettime(CLOCK_MONOTONIC, &s->start);
> >  	for (i = 0; i < cnt; i++) {



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ