[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#700422: marked as done (wdm shouldn't use /dev/mem)

Your message dated Fri, 15 Feb 2013 12:02:40 +0000
with message-id <E1U6K00-0006Ou-Sl@franck.debian.org>
and subject line Bug#700422: fixed in wdm 1.28-14~exp1
has caused the Debian Bug report #700422,
regarding wdm shouldn't use /dev/mem
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org

700422: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=700422
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: wdm
Version: 1.28-13
Severity: normal
Tags: upstream patch


this is my first reporting a bug against a debian package so I very well
might've missed something in the process.

Here's the deal: wdm still uses /dev/mem in genauth.c to generate a tmp
key and it shouldn't. The kernel currently allows userspace to read <
640K of /dev/mem for compatibility reasons with X. The modern way of
getting two random longs is /dev/urandom and I've a patch below which
converts wdm to do that.

Patch is ontop of the master branch of
git://git.debian.org/collab-maint/wdm.git and fixes the issue.


-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.5.0+ (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages wdm depends on:
ii  debconf [debconf-2.0]  1.5.40
ii  libc6                  2.13-16
ii  libpam-modules         1.1.3-2
ii  libpam-runtime         1.1.3-2
ii  libpam0g               1.1.3-7.1
ii  libselinux1            2.1.9-5
ii  libwings2              0.95.3-2
ii  libwraster3            0.95.3-2
ii  libwutil2              0.95.3-2
ii  libx11-6               2:1.5.0-1
ii  libxau6                1:1.0.7-1
ii  libxdmcp6              1:1.1.1-1
ii  libxinerama1           2:1.1.2-1
ii  libxmu6                2:1.1.1-1
ii  psmisc                 22.13-1
ii  x11-apps               7.6+5
ii  x11-common             1:7.6+7
ii  x11-utils              7.6+3
ii  x11-xserver-utils      7.6+3

wdm recommends no packages.

Versions of packages wdm suggests:
ii  xfonts-base  1:1.0.3

-- Configuration Files:
/etc/X11/wdm/wdm-config [Errno 13] Permission denied: u'/etc/X11/wdm/wdm-config'

-- debconf information:
* shared/default-x-display-manager: wdm
  wdm/daemon_name: /usr/bin/wdm
diff --git a/debian/man/wdm.1x b/debian/man/wdm.1x
index 5f468d5fcc36..968acf293f2f 100644
--- a/debian/man/wdm.1x
+++ b/debian/man/wdm.1x
@@ -202,7 +202,7 @@ to pass on to the \fIXsetup\fP,
 .IP \fBDisplayManager.randomFile\fP
 A file to checksum to generate the seed of authorization keys.
 This should be a file that changes frequently.
-The default is \fI/dev/mem\fP.
+The default is \fI/dev/urandom\fP.
 .IP \fBDisplayManager.greeterLib\fP
 On systems that support a dynamically-loadable greeter library, the
 name of the library.  The default is
diff --git a/doc/wdm.man.in b/doc/wdm.man.in
index da44f2860d6b..4c22f1db58e6 100644
--- a/doc/wdm.man.in
+++ b/doc/wdm.man.in
@@ -202,7 +202,7 @@ to pass on to the \fIXsetup\fP,
 .IP \fBDisplayManager.randomFile\fP
 A file to checksum to generate the seed of authorization keys.
 This should be a file that changes frequently.
-The default is \fI/dev/mem\fP.
+The default is \fI/dev/urandom\fP.
 .IP \fBDisplayManager.greeterLib\fP
 On systems that support a dynamically-loadable greeter library, the
 name of the library.  The default is
diff --git a/src/wdm/genauth.c b/src/wdm/genauth.c
index e478d936be9d..3156adf8427a 100644
--- a/src/wdm/genauth.c
+++ b/src/wdm/genauth.c
@@ -71,37 +71,26 @@ longtochars (long l, unsigned char *c)
 #if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM)
 static int
-sumFile (char *name, long sum[2])
+sumFile (char *name, long sum[], unsigned n)
-    long    buf[1024*2];
     int	    cnt;
     int	    fd;
-    int	    loops;
-    int	    reads;
-    int	    i;
-    int     ret_status = 0;
+    int     ret_status = 1;
     fd = open (name, O_RDONLY);
     if (fd < 0) {
 	WDMError("Cannot open randomFile \"%s\", errno = %d\n", name, errno);
 	return 0;
-    if (strcmp(name, "/dev/mem") == 0) lseek (fd, (off_t) 0x100000, SEEK_SET);
-    reads = FILE_LIMIT;
-    sum[0] = 0;
-    sum[1] = 0;
-    while ((cnt = read (fd, (char *) buf, sizeof (buf))) > 0 && --reads > 0) {
-	loops = cnt / (2 * sizeof (long));
-	for (i = 0; i < loops; i+= 2) {
-	    sum[0] += buf[i];
-	    sum[1] += buf[i+1];
-	    ret_status = 1;
-	}
-    }
-    if (cnt < 0)
+    memset(sum, 0, n);
+    cnt = read(fd, (char *) sum, sizeof(long) * n);
+    if (cnt < 0) {
 	WDMError("Cannot read randomFile \"%s\", errno = %d\n", name, errno);
+	ret_status = 0;
+    }
     close (fd);
     return ret_status;
@@ -139,7 +128,7 @@ InitXdmcpWrapper (void)
     long	    sum[2];
     unsigned char   tmpkey[8];
-    if (!sumFile (randomFile, sum)) {
+    if (!sumFile (randomFile, sum, 2)) {
 	sum[0] = time ((Time_t *) 0);
 	sum[1] = time ((Time_t *) 0);
@@ -244,7 +233,7 @@ GenerateAuthData (char *auth, int len)
 		localkey[0] = 1;
-    	    if (!sumFile (randomFile, localkey)) {
+    	    if (!sumFile (randomFile, localkey, 2)) {
 		localkey[0] = 1; /* To keep from continually calling sumFile() */
diff --git a/src/wdm/resource.c b/src/wdm/resource.c
index 48922c7e8b24..247819693fa4 100644
--- a/src/wdm/resource.c
+++ b/src/wdm/resource.c
@@ -156,7 +156,7 @@ int_resource	wdmXineramaHead;/* select xinerama head where to show login */
 #define DEF_ACCESS_FILE_PL	""
-#define DEF_RANDOM_FILE "/dev/mem"
+#define DEF_RANDOM_FILE "/dev/urandom"
 #define DEF_GREETER_LIB "/X11/lib/X11/xdm/libXdmGreet.so"

--- End Message ---
--- Begin Message ---
Source: wdm
Source-Version: 1.28-14~exp1

We believe that the bug you reported is fixed in the latest version of
wdm, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 700422@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
Agustin Martin Domingo <agmartin@debian.org> (supplier of updated wdm package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)

Hash: SHA1

Format: 1.8
Date: Fri, 15 Feb 2013 12:03:55 +0100
Source: wdm
Binary: wdm
Architecture: source i386
Version: 1.28-14~exp1
Distribution: experimental
Urgency: low
Maintainer: Debian QA Group <packages@qa.debian.org>
Changed-By: Agustin Martin Domingo <agmartin@debian.org>
 wdm        - WINGs Display Manager - an xdm replacement with a WindowMaker loo
Closes: 694022 700422
 wdm (1.28-14~exp1) experimental; urgency=low
   * QA upload.
   * wdm.init: Remove obsolete "hal" from Should-Start in incorrect LSB
     header (Closes: #694022).
   * 08_do_not_use_dev_mem.patch: Use /dev/urandom instead of
     /dev/mem. Thanks Borislav Petkov (Closes: #700422).
   * Add watch file, in case upstream resumes work in this package.
     Thanks Bart Martens for it.
   * debian/control: Bump Standards-Version. No changes required.
 11833e68a32a83d7d28be8ffddfad45ae7f822a1 1464 wdm_1.28-14~exp1.dsc
 4b1971d2a9abd2b38a2f13c67176bd5e68d99d0d 70320 wdm_1.28-14~exp1.debian.tar.gz
 8faa8aef368237126f19d8f08e4efb74c6805064 338366 wdm_1.28-14~exp1_i386.deb
 f41f79bd59d407ce7098d0380b5679379638ec10a1532a9a8ef1b585676c8b43 1464 wdm_1.28-14~exp1.dsc
 bdc028c8bdd589c0d61f6231792d43e1d095463d1995705d7240da451177ad24 70320 wdm_1.28-14~exp1.debian.tar.gz
 22f5d4ef476160bf7551c6740e240727b765107b2fef0a51d257c2c70f457506 338366 wdm_1.28-14~exp1_i386.deb
 5f0e46488a6dcf722f4e49194d49d8b4 1464 x11 optional wdm_1.28-14~exp1.dsc
 8fa7db38e4e6df9d9b074effc630c847 70320 x11 optional wdm_1.28-14~exp1.debian.tar.gz
 031b6fa8030d0c2ec4bcd8bccac4dcde 338366 x11 optional wdm_1.28-14~exp1_i386.deb

Version: GnuPG v1.4.12 (GNU/Linux)


--- End Message ---

Reply to: