Your message dated Sat, 07 Sep 2019 14:46:58 +0000
with message-id <[email protected]>
and subject line Bug#856439: fixed in fakeroot 1.24-1
has caused the Debian Bug report #856439,
regarding fakeroot doesn't detect and handle message queue and semaphore id 
collision
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 [email protected]
immediately.)


-- 
856439: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=856439
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: fakeroot
Version: 1.20.2-1
Severity: normal
Tags: patch

Dear Maintainer,

I'm raising this as requested by Clint in:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855662#15

Fixing that bug (fakeroot: when msgrcv is interrupted by a signal, faked
accidentally reprocesses the previous message) stopped faked from overwriting
errno, which led me to realize that my intermittent failure problem while
building several packages at once might always be due to EIDRM.  (I only had
one failure with the patched version from that bug before contriving the patch
I submit here, so I don't have a big sample size.)  That led me to realize
that faked is, by default, inventing a random number on which to base its
message queue and semaphore ids.  When it then creates the message queues and
semaphore, it doesn't check for collisions.  Here I present a patch that I
hope detects that situation and retries.  I haven't seen a failure with this
patch, but I've only been running with it since last Friday.  I was previously
seeing as little as one failure per week.  I also haven't attempted the obvious
change to fail visibly in this case, which would have given me confidence that
the diagnosis was right.  I don't know why some of build machines seem more
vulnerable than others.  I don't know why I've only seen this since they were
upgraded to Jessie.  I based the patch supplied here on:

https://anonscm.debian.org/cgit/users/clint/fakeroot.git/

I wasn't sure whether Clint was asking me to base it instead on some upstream
branch.  That was at least due to the corporate email link mangler but I'm
quite new to git and Debian packaging.  This isn't the version I'm running,
which is instead based on the Jessie version.  I'm open to persuasion for
other experiments.


-- System Information:
Debian Release: 8.7
  APT prefers stable-updates
  APT policy: (990, 'stable-updates'), (990, 'stable'), (500, 
'testing-updates'), (500, 'oldstable-updates'), (500, 'oldoldstable'), (500, 
'testing'), (500, 'stable'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
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
Init: systemd (via /run/systemd/system)

Versions of packages fakeroot depends on:
ii  libc6        2.19-18+deb8u7
ii  libfakeroot  1.20.2-1

fakeroot recommends no packages.

fakeroot suggests no packages.

-- no debconf information
diff --git a/faked.c b/faked.c
index a0f92ca..d280668 100644
--- a/faked.c
+++ b/faked.c
@@ -1305,6 +1305,7 @@ int main(int argc, char **argv){
 #ifndef FAKEROOT_FAKENET
   union semun sem_union;
   int justcleanup = 0;
+  int msgflag = IPC_CREAT|0600;
 #else /* FAKEROOT_FAKENET */
   int sd, val;
   unsigned int port = 0;
@@ -1375,29 +1376,42 @@ int main(int argc, char **argv){
 
 #ifndef FAKEROOT_FAKENET
 
-  if(!msg_key) {
-    srandom(time(NULL)+getpid()*33151);
-    while(!msg_key && (msg_key!=-1))  /* values 0 and -1 are treated
-					 specially by libfake */
-      msg_key=random();
-  }
+  do {
+    if(!msg_key) {
+      msgflag |= IPC_EXCL;
+      srandom(time(NULL)+getpid()*33151);
+      while(!msg_key && (msg_key!=-1))  /* values 0 and -1 are treated
+                                           specially by libfake */
+        msg_key=random();
+    }
 
-  if(debug)
-    fprintf(stderr,"using %li as msg key\n",(long)msg_key);
+    if(debug)
+      fprintf(stderr,"using %li as msg key\n",(long)msg_key);
+
+    msg_get=msgget(msg_key,msgflag);
+    if (msg_get != -1)
+      msg_snd=msgget(msg_key+1,msgflag);
+    if (msg_snd != -1)
+      sem_id=semget(msg_key+2,1,msgflag);
+
+    if((msg_get==-1)||(msg_snd==-1)||(sem_id==-1)){
+      if (errno == EEXIST) {
+        if(debug)
+          fprintf(stderr,"using %li as msg key caused a collision, trying again\n",(long)msg_key);
+        cleanup(-1);
+        msg_key = 0;
+        continue;
+      }
+      perror("fakeroot, while creating message channels");
+      fprintf(stderr, "This may be due to a lack of SYSV IPC support.\n");
+      cleanup(-1);
+      exit(1);
+    }
+  } while(msg_key == 0);
 
-  msg_get=msgget(msg_key,IPC_CREAT|0600);
-  msg_snd=msgget(msg_key+1,IPC_CREAT|0600);
-  sem_id=semget(msg_key+2,1,IPC_CREAT|0600);
   sem_union.val=1;
   semctl (sem_id,0,SETVAL,sem_union);
 
-  if((msg_get==-1)||(msg_snd==-1)||(sem_id==-1)){
-    perror("fakeroot, while creating message channels");
-    fprintf(stderr, "This may be due to a lack of SYSV IPC support.\n");
-    cleanup(-1);
-    exit(1);
-  }
-
   if(debug)
     fprintf(stderr,"msg_key=%li\n",(long)msg_key);
 

--- End Message ---
--- Begin Message ---
Source: fakeroot
Source-Version: 1.24-1

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

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

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Clint Adams <[email protected]> (supplier of updated fakeroot 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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 06 Sep 2019 18:48:18 -0400
Source: fakeroot
Binary: fakeroot fakeroot-dbgsym libfakeroot libfakeroot-dbgsym
Architecture: source
Version: 1.24-1
Distribution: unstable
Urgency: medium
Maintainer: Clint Adams <[email protected]>
Changed-By: Clint Adams <[email protected]>
Description:
 fakeroot   - tool for simulating superuser privileges
 libfakeroot - tool for simulating superuser privileges - shared libraries
Closes: 856439 883780
Changes:
 fakeroot (1.24-1) unstable; urgency=medium
 .
   [ Danny Milosavljevic ]
   * Add test "t.cp-a".
 .
   [ Clint Adams ]
   * Patch from Ilias Tsitsimpis to retry msgsnd() if interrupted by
     a signal.  closes: #883780.
   * Patch from Martin Dorey to detect and handle message queue and
     semaphore id collision.  closes: #856439.
   * Drop patch glibc-xattr-types.
Checksums-Sha1:
 8144458d97e8955c430ab51b9fa46f3895f4e75c 1932 fakeroot_1.24-1.dsc
 bebe243d7f66bd016e7d1b28fad064586ecf7a15 522497 fakeroot_1.24.orig.tar.gz
 89f30f9facf9cf712867892395472d28f034545d 22680 fakeroot_1.24-1.debian.tar.xz
Checksums-Sha256:
 b89a3faa92f496a74d8ad4ece6a135262f69417bef804533103e52a50c31c502 1932 
fakeroot_1.24-1.dsc
 2e045b3160370b8ab4d44d1f8d267e5d1d555f1bb522d650e7167b09477266ed 522497 
fakeroot_1.24.orig.tar.gz
 b2f0523ff61d086e9ef8987b9560f21d584eb6fd4f114226ca1c3dd6b9de9b6f 22680 
fakeroot_1.24-1.debian.tar.xz
Files:
 8b37cd512858185fb22087e73d99f0f1 1932 utils optional fakeroot_1.24-1.dsc
 964e5f438f1951e5a515dd54edd50fa6 522497 utils optional 
fakeroot_1.24.orig.tar.gz
 ef8ccb4e564548ebe4c643627afde23d 22680 utils optional 
fakeroot_1.24-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEdYHsh0BT5sgHeRubVZIzHhmdOKgFAl1ztsAACgkQVZIzHhmd
OKhHtw/8D5Re+LLI/3hGVQFDoX0lMFSwL1CW+t5TijJJg97DVimqXdPKKYNdZiuq
7/396oP7vD1PUMUEcG8W4iAMsEQ9iU1RCWXzVAdF5LIiQZGHVsPfR7bMGqiMA6+x
QA88a3eUDqot6Qqr1CeEhMYWvjY4i/emTSYUiTcd/aU1lpHRghQKipNixBb5V4cG
ESDrwMaULMfZeDwkpGYIggO++jSEQe40WqHWy6Y/wtItsWScK7jUJVS6Ec+KC3Dg
RY6ptWWkYNE1qCVxvYz5aR8gegVAadC8Qt6fdpJSvAHUUa8fLC1abh+LmLHVB42k
ZG24CKJL4juvxrKjKpn1J1hCvnp0UiulXShOfSPofkFi5TWT73enz2GWzP84113C
Xc5kxWc+nBRaflBNlCkEfnLrRhloumqwIBVG+ERj/a7EHdWD+T8aDrElsfJhJBon
JxozMtQDqds6rw1Gtx9Vm/yS0wg2XUILuq6dadUEzHsD4Nx6jAZfXY8nxxI6Cm+q
Q7ZBukhc8GXSHPbX4bVyCW8Y5M+cDI0ZwA+jgVIy3AnysPlAn1xC/0n3fI2Y5ecw
5lJoKX3IYoO0fsqxKDgOk6JvJeQEVUm3Q4eSom+JCkVpfhuFa8EotgJYYxXspi8x
vloOmj8MhPgmuOYgORP01eQzGiwvXj1sVUC/bhWoopkWOr/ScTE=
=6LKe
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to