all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob fa3b0f1403da217c74424af73ba44b66289c6ce0 3604 bytes (raw)
name: gnu/packages/patches/glibc-hurd-proc-reauth.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
 
Index: glibc-2.31/hurd/hurdsig.c
===================================================================
--- glibc-2.31.orig/hurd/hurdsig.c
+++ glibc-2.31/hurd/hurdsig.c
@@ -1580,28 +1580,53 @@ _hurdsig_init (const int *intarray, size
 static void
 reauth_proc (mach_port_t new)
 {
-  mach_port_t ref, ignore;
+  error_t err;
+  mach_port_t ref, newproc;
 
   ref = __mach_reply_port ();
-  if (! HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
+  err = HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
 		       __proc_reauthenticate (port, ref,
-					      MACH_MSG_TYPE_MAKE_SEND)
-		       || __auth_user_authenticate (new, ref,
-						    MACH_MSG_TYPE_MAKE_SEND,
-						    &ignore))
-      && ignore != MACH_PORT_NULL)
-    __mach_port_deallocate (__mach_task_self (), ignore);
+					      MACH_MSG_TYPE_MAKE_SEND));
+  if (err)
+    {
+      __mach_port_destroy (__mach_task_self (), ref);
+      return;
+    }
+
+  err = __auth_user_authenticate (new, ref,
+                                  MACH_MSG_TYPE_MAKE_SEND,
+                                  &newproc);
   __mach_port_destroy (__mach_task_self (), ref);
+  if (err)
+    return;
+
+  if (newproc == MACH_PORT_NULL)
+    {
+      /* Old versions of the proc server did not recreate the process
+         port when reauthenticating, and passed MACH_PORT_NULL through
+         the auth server.  That must be what we're dealing with.  */
+
+      /* Set the owner of the process here too. */
+      __mutex_lock (&_hurd_id.lock);
+      if (!_hurd_check_ids ())
+	HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
+		       __proc_setowner (port,
+					(_hurd_id.gen.nuids
+					 ? _hurd_id.gen.uids[0] : 0),
+					!_hurd_id.gen.nuids));
+      __mutex_unlock (&_hurd_id.lock);
+
+      return;
+    }
+
+  err = __proc_reauthenticate_complete (newproc);
+  if (err)
+    {
+      __mach_port_deallocate (__mach_task_self (), newproc);
+      return;
+    }
 
-  /* Set the owner of the process here too. */
-  __mutex_lock (&_hurd_id.lock);
-  if (!_hurd_check_ids ())
-    HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC],
-		   __proc_setowner (port,
-				    (_hurd_id.gen.nuids
-				     ? _hurd_id.gen.uids[0] : 0),
-				    !_hurd_id.gen.nuids));
-  __mutex_unlock (&_hurd_id.lock);
+  _hurd_port_set (&_hurd_ports[INIT_PORT_PROC], newproc);
 
   (void) &reauth_proc;		/* Silence compiler warning.  */
 }
Index: glibc-2.31/sysdeps/mach/hurd/spawni.c
===================================================================
--- glibc-2.31.orig/sysdeps/mach/hurd/spawni.c
+++ glibc-2.31/sysdeps/mach/hurd/spawni.c
@@ -651,11 +651,29 @@ retry:
 					ref, MACH_MSG_TYPE_MAKE_SEND,
 					&newproc);
       __mach_port_destroy (__mach_task_self (), ref);
-      if (!err)
-	{
-	  __mach_port_deallocate (__mach_task_self (), proc);
-	  proc = newproc;
-	}
+      if (err)
+        goto out;
+      if (newproc == MACH_PORT_NULL)
+        {
+          /* Old versions of the proc server did not recreate the process
+             port when reauthenticating, and passed MACH_PORT_NULL through
+             the auth server.  That must be what we're dealing with.  Just
+             keep the existing proc port in this case.  */
+        }
+      else
+        {
+          err = __proc_reauthenticate_complete (newproc);
+          if (err)
+            {
+              __mach_port_deallocate (__mach_task_self (), newproc);
+              goto out;
+            }
+          else
+	    {
+	      __mach_port_deallocate (__mach_task_self (), proc);
+	      proc = newproc;
+	    }
+        }
 
       if (!err)
 	err = reauthenticate (INIT_PORT_CRDIR, &rcrdir);

debug log:

solving fa3b0f1403 ...
found fa3b0f1403 in https://yhetil.org/guix/727b3d7ec511589ab714874d6648ee4afa458e3c.camel@telenet.be/

applying [1/1] https://yhetil.org/guix/727b3d7ec511589ab714874d6648ee4afa458e3c.camel@telenet.be/
diff --git a/gnu/packages/patches/glibc-hurd-proc-reauth.patch b/gnu/packages/patches/glibc-hurd-proc-reauth.patch
new file mode 100644
index 0000000000..fa3b0f1403

1:18: trailing whitespace.
 
1:22: space before tab in indent.
 		       __proc_reauthenticate (port, ref,
1:68: trailing whitespace.
 
1:79: trailing whitespace.
 
1:87: space before tab in indent.
 					ref, MACH_MSG_TYPE_MAKE_SEND,
Checking patch gnu/packages/patches/glibc-hurd-proc-reauth.patch...
Applied patch gnu/packages/patches/glibc-hurd-proc-reauth.patch cleanly.
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.

index at:
100644 fa3b0f1403da217c74424af73ba44b66289c6ce0	gnu/packages/patches/glibc-hurd-proc-reauth.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

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.