linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mm] proc: fixup test for read
@ 2018-03-16 23:21 Alexey Dobriyan
  2018-03-16 23:28 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2018-03-16 23:21 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

/proc/kmsg can and will block if read under root.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 tools/testing/selftests/proc/read.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/tools/testing/selftests/proc/read.c
+++ b/tools/testing/selftests/proc/read.c
@@ -54,7 +54,8 @@ static void f_reg(DIR *d, const char *filename)
 	int fd;
 	ssize_t rv;
 
-	fd = openat(dirfd(d), filename, O_RDONLY);
+	/* read from /proc/kmsg can block */
+	fd = openat(dirfd(d), filename, O_RDONLY|O_NONBLOCK);
 	if (fd == -1)
 		return;
 	rv = read(fd, buf, sizeof(buf));

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH -mm] proc: fixup test for read
  2018-03-16 23:21 [PATCH -mm] proc: fixup test for read Alexey Dobriyan
@ 2018-03-16 23:28 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2018-03-16 23:28 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: linux-kernel

On Sat, 17 Mar 2018 02:21:47 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> /proc/kmsg can and will block if read under root.
> 

This fixes
proc-shotgun-test-read-readdir-readlink-a-little-write.patch.  It helps
to point that out, so that reviewers won't be scrambling around
asking wtf.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-16 23:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 23:21 [PATCH -mm] proc: fixup test for read Alexey Dobriyan
2018-03-16 23:28 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).