[101] in The Cryptographic File System users list

home help back first fref pref prev next nref lref last post

cmkdir doesn't terminate under linux

daemon@ATHENA.MIT.EDU (Charles Karney)
Sun Sep 13 22:33:29 1998

From owner-cfs-users@research.att.com Mon Sep 14 02:33:29 1998
Return-Path: <owner-cfs-users@research.att.com>
Delivered-To: cfs-mtg@bloom-picayune.mit.edu
Received: (qmail 29124 invoked from network); 14 Sep 1998 02:33:28 -0000
Received: from unknown (HELO rumor.research.att.com) (192.20.225.9)
  by bloom-picayune.mit.edu with SMTP; 14 Sep 1998 02:33:28 -0000
Received: from research.att.com ([135.207.30.100]) by rumor; Sun Sep 13 22:26:06 EDT 1998
Received: from amontillado.research.att.com ([135.207.24.32]) by research; Sun Sep 13 22:31:02 EDT 1998
Received: from nsa.research.att.com (majordomo@nsa.research.att.com [135.207.24.155])
	by amontillado.research.att.com (8.8.7/8.8.7) with ESMTP id WAA07133;
	Sun, 13 Sep 1998 22:31:29 -0400 (EDT)
Received: (from majordomo@localhost) by nsa.research.att.com (8.7.3/8.7.3) id WAA05025 for cfs-users-list; Sun, 13 Sep 1998 22:23:37 -0400 (EDT)
X-Authentication-Warning: nsa.research.att.com: majordomo set sender to owner-cfs-users@nsa.research.att.com using -f
Received: from research.att.com (research.research.att.com [135.207.30.100]) by nsa.research.att.com (8.7.3/8.7.3) with SMTP id WAA05021 for <cfs-users@nsa.research.att.com>; Sun, 13 Sep 1998 22:23:35 -0400 (EDT)
Received: from pppl.gov ([192.55.106.85]) by research; Sun Sep 13 22:27:31 EDT 1998
Received: from orion.pppl.gov (karney@orion.pppl.gov [198.35.4.73])
	by pppl.gov (8.8.6/8.8.5) with ESMTP id WAA12877;
	Sun, 13 Sep 1998 22:27:28 -0400 (EDT)
Received: (from karney@localhost)
	by orion.pppl.gov (8.9.1/8.9.1) id WAA26702;
	Sun, 13 Sep 1998 22:27:26 -0400 (EDT)
Date: Sun, 13 Sep 1998 22:27:26 -0400 (EDT)
Message-Id: <199809140227.WAA26702@orion.pppl.gov>
From: Charles Karney <karney@pppl.gov>
To: cfs-users@research.att.com
Subject: cmkdir doesn't terminate under linux
Reply-to: karney@princeton.edu
Sender: owner-cfs-users@research.att.com
Precedence: bulk

Configuration: cfs 1.4.0 beta2, Redhat Linux 5.0.
(Question: has cfs 1.4.0 been released yet?)

Problem: cmkdir gets stuck in the alarm routine.

The last bit of an strace gives:

write(2, "\n", 1)                       = 1
ioctl(3, SNDCTL_TMR_CONTINUE, {B9600 opost isig icanon echo ...}) = 0
sigaction(SIGINT, {SIG_DFL}, {SIG_IGN}) = 0
close(3)                                = 0
getitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 0}}) = 0
sigaction(SIGALRM, {SIG_IGN}, {SIG_DFL}) = 0
sigaction(SIGALRM, {0x804d618, [], SA_NOMASK|0x4a804}, {SIG_IGN}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}}, NULL) = 0
--- SIGALRM (Alarm clock) ---
sigaction(SIGALRM, {0x804d618, [], 0}, {0x804d618, [], SA_STACK|0x5188c}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 16665}}, NULL) = 0

Fix: use Linux's /dev/random in raw_truerand:

--- truerand.c~	Sun Dec  7 00:16:36 1997
+++ truerand.c	Sun Sep 13 21:38:06 1998
@@ -88,6 +88,7 @@
 #include <sys/time.h>
 #include <math.h>
 #include <stdio.h>
+#include <fcntl.h>
 
 static jmp_buf env;
 static unsigned count;
@@ -134,27 +135,11 @@
 unsigned long
 raw_truerand()
 {
-	void (*oldalrm)();
-	struct itimerval it;
-	unsigned long counts[12];
-	unsigned char *qshs();
-	unsigned char *r;
 	unsigned long buf;
-	int i;
-
-	getitimer(ITIMER_REAL, &it);
-	oldalrm = signal(SIGALRM, SIG_IGN);
-	for (i=0; i<12; i++) {
-		counts[i]=0;
-		while ((counts[i] += roulette()) < 512)
-			;
-	}
-	signal(SIGALRM, oldalrm);
-	setitimer(ITIMER_REAL, &it, NULL);
-
-	r = qshs(counts,sizeof(counts));
-	buf = *((unsigned long *) r);
-
+	int fd;
+	fd=open("/dev/random",O_RDONLY);
+	read(fd,&buf,4);
+	close(fd);
 	return buf;
 }


Other information:

cmkdir from cfs 1.4.0 on Solaris 2.5.1 works OK.

cmkdir from cfs 1.3.3 on Redhat 5.0 works OK.

-- 
Charles Karney
Plasma Physics Laboratory	  E-mail:  Karney@Princeton.EDU
Princeton University		  Phone:   +1 609 243 2607
Princeton, NJ 08543-0451	  FAX:	   +1 609 243 3438

home help back first fref pref prev next nref lref last post