All of lore.kernel.org
 help / color / mirror / Atom feed
From: Holger Hans Peter Freyther <holger@freyther.de>
To: Nathan Zimmer <nzimmer@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: /proc/timer_list and weird behavior with dropbear
Date: Fri, 19 Jul 2013 17:28:00 +0200	[thread overview]
Message-ID: <20130719152800.GA20792@xiaoyu.lan> (raw)

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

Dear Nathan,

I am currently upgrading a kernel for a TI Davinci DM644x based design
from Linux 3.2 to Linux 3.10.1. I have a funny re-producible issue that
goes away by reverting b3956a896ea57f25cacd74708b8fab611543a81d.

The dropbear sshd will open several files after accepting a connection to
generate some entropy. The "/proc/timer_list" file is part of that[1].
It will open that file and will try to read until the end of the file, but
most of the time this end never comes. According to strace the read on the
fd will always return 2048. I have attached the testcase I am using to
re-produce the issue.

Can this be re-produced by anyone else?

holger



[1] https://secure.ucc.asn.au/hg/dropbear/file/028fa77f952f/random.c#l204


[-- Attachment #2: proc_test.c --]
[-- Type: text/x-csrc, Size: 722 bytes --]

#include <sys/stat.h>
#include <fcntl.h>

       #include <stdio.h>
       #include <stdlib.h>
       #include <sys/time.h>
       #include <sys/types.h>
       #include <unistd.h>


int main(int argc, char **argv)
{
	fd_set rfds;
	struct timeval tv;
	char buf[2048];

	int fd = open("/proc/timer_list", O_RDONLY, O_NONBLOCK);
	if (fd < 0) {
		perror("Failed to open");
		abort();
	}

	FD_ZERO(&rfds);
	FD_SET(fd, &rfds);


	while (1) {
		tv.tv_sec = 2;
		tv.tv_usec = 0;

		int retval = select(fd + 1, &rfds, NULL, NULL, &tv);
		if (retval == -1)
			perror("select()");
		else if (retval) {
			int ret = read(fd, buf, sizeof(buf));
			if (ret == 0)
				return EXIT_SUCCESS;
		} else {
			printf("TIMEOUT...\n");
		}
	}
}

             reply	other threads:[~2013-07-19 15:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 15:28 Holger Hans Peter Freyther [this message]
2013-07-19 15:45 ` /proc/timer_list and weird behavior with dropbear Nathan Zimmer
2013-07-19 17:03   ` Holger Hans Peter Freyther
2013-07-19 19:05     ` Nathan Zimmer
2013-07-19 20:33     ` Nathan Zimmer
2013-07-19 20:37       ` Nathan Zimmer
2013-07-20  5:43         ` Holger Hans Peter Freyther
2013-07-22 21:18           ` [PATCH] timer_list: Correct the show function for timer_list by using iter->now Nathan Zimmer
2013-07-23  7:18             ` Holger Hans Peter Freyther
2013-07-23 22:50               ` Nathan Zimmer
2013-07-24 14:31               ` [PATCH] timer_list: Correct the iterator for timer_list Nathan Zimmer

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=20130719152800.GA20792@xiaoyu.lan \
    --to=holger@freyther.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nzimmer@sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.