summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/patches/0001-libports-silence-pointless-error-message.patch30
-rw-r--r--debian/patches/0002-startup-give-the-tasks-we-create-a-name.patch33
-rw-r--r--debian/patches/0003-auth-simplify-expression.patch35
-rw-r--r--debian/patches/0004-auth-remove-implicit-assumption-about-the-bootstrap-.patch61
-rw-r--r--debian/patches/0005-XXX-proc-call-startup_essential_task-earlier.patch174
-rw-r--r--debian/patches/series5
6 files changed, 338 insertions, 0 deletions
diff --git a/debian/patches/0001-libports-silence-pointless-error-message.patch b/debian/patches/0001-libports-silence-pointless-error-message.patch
new file mode 100644
index 00000000..78c078c8
--- /dev/null
+++ b/debian/patches/0001-libports-silence-pointless-error-message.patch
@@ -0,0 +1,30 @@
+From ba9d293d8fe40f6e634cf800c42ece97727ccd0f Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sat, 3 Jan 2015 16:21:24 +0100
+Subject: [PATCH hurd 1/5] libports: silence pointless error message
+
+* libports/manage-multithread.c (adjust_priority): Silence pointless
+error message.
+---
+ libports/manage-multithread.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
+index 2067cba..ad22991 100644
+--- a/libports/manage-multithread.c
++++ b/libports/manage-multithread.c
+@@ -50,6 +50,11 @@ adjust_priority (unsigned int totalthreads)
+ thread_switch (MACH_PORT_NULL, SWITCH_OPTION_DEPRESS, t);
+
+ err = get_privileged_ports (&host_priv, NULL);
++ if (err == MACH_SEND_INVALID_DEST)
++ /* This is returned if we neither have the privileged host control
++ port cached nor have a proc server to talk to. Give up. */
++ return;
++
+ if (err)
+ goto error_host_priv;
+
+--
+2.1.4
+
diff --git a/debian/patches/0002-startup-give-the-tasks-we-create-a-name.patch b/debian/patches/0002-startup-give-the-tasks-we-create-a-name.patch
new file mode 100644
index 00000000..afa23dcb
--- /dev/null
+++ b/debian/patches/0002-startup-give-the-tasks-we-create-a-name.patch
@@ -0,0 +1,33 @@
+From 6b135febdb8fad613aa8856fb9f48ae8c229e7a1 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Fri, 9 Jan 2015 11:06:52 +0100
+Subject: [PATCH hurd 2/5] startup: give the tasks we create a name
+
+* startup/startup.c (run): Name the tasks we start.
+---
+ startup/startup.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/startup/startup.c b/startup/startup.c
+index 601c894..a9373f1 100644
+--- a/startup/startup.c
++++ b/startup/startup.c
+@@ -33,6 +33,7 @@
+ #include <sys/file.h>
+ #include <unistd.h>
+ #include <string.h>
++#include <mach/gnumach.h>
+ #include <mach/notify.h>
+ #include <stdlib.h>
+ #include <hurd/msg.h>
+@@ -376,6 +377,7 @@ run (const char *server, mach_port_t *ports, task_t *task)
+ printf ("Pausing for %s\n", prog);
+ getchar ();
+ }
++ task_set_name (task, (char *) prog);
+ err = file_exec (file, *task, 0,
+ (char *)prog, strlen (prog) + 1, /* Args. */
+ startup_envz, startup_envz_len,
+--
+2.1.4
+
diff --git a/debian/patches/0003-auth-simplify-expression.patch b/debian/patches/0003-auth-simplify-expression.patch
new file mode 100644
index 00000000..be1a83f0
--- /dev/null
+++ b/debian/patches/0003-auth-simplify-expression.patch
@@ -0,0 +1,35 @@
+From f91191f2643d3c0c1d737e9338bf4224bdc0bdcb Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Fri, 2 Jan 2015 21:53:08 +0100
+Subject: [PATCH hurd 3/5] auth: simplify expression
+
+* auth/auth.c (S_auth_{user,server}_authenticate): Simplify expression.
+---
+ auth/auth.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/auth/auth.c b/auth/auth.c
+index c36bcb2..a7a188a 100644
+--- a/auth/auth.c
++++ b/auth/auth.c
+@@ -299,7 +299,7 @@ S_auth_user_authenticate (struct authhandle *userauth,
+ if (! userauth)
+ return EOPNOTSUPP;
+
+- if (rendezvous == MACH_PORT_NULL || rendezvous == MACH_PORT_DEAD)
++ if (! MACH_PORT_VALID (rendezvous))
+ return EINVAL;
+
+ u.user = userauth;
+@@ -380,7 +380,7 @@ S_auth_server_authenticate (struct authhandle *serverauth,
+ if (! serverauth)
+ return EOPNOTSUPP;
+
+- if (rendezvous == MACH_PORT_NULL || rendezvous == MACH_PORT_DEAD)
++ if (! MACH_PORT_VALID (rendezvous))
+ return EINVAL;
+
+ pthread_mutex_lock (&pending_lock);
+--
+2.1.4
+
diff --git a/debian/patches/0004-auth-remove-implicit-assumption-about-the-bootstrap-.patch b/debian/patches/0004-auth-remove-implicit-assumption-about-the-bootstrap-.patch
new file mode 100644
index 00000000..1c3718f3
--- /dev/null
+++ b/debian/patches/0004-auth-remove-implicit-assumption-about-the-bootstrap-.patch
@@ -0,0 +1,61 @@
+From 05d6695b41a801de1ee024e5d6cc3a8170ab0ea6 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Wed, 7 Jan 2015 16:00:06 +0100
+Subject: [PATCH hurd 4/5] auth: remove implicit assumption about the bootstrap
+ process
+
+The current code assumes that it can speak the startup protocol over
+its bootstrap port.
+
+* auth/auth.c (main): Generalize by trying to use `/servers/startup'
+before falling back to the bootstrap port.
+---
+ auth/auth.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/auth/auth.c b/auth/auth.c
+index a7a188a..d5ef587 100644
+--- a/auth/auth.c
++++ b/auth/auth.c
+@@ -25,6 +25,7 @@
+ #include <pthread.h>
+ #include <hurd.h>
+ #include <hurd/startup.h>
++#include <hurd/paths.h>
+ #include <hurd/ports.h>
+ #include <hurd/ihash.h>
+ #include <idvec.h>
+@@ -482,6 +483,7 @@ main (int argc, char **argv)
+ {
+ error_t err;
+ mach_port_t boot;
++ mach_port_t startup;
+ process_t proc;
+ mach_port_t hostpriv, masterdev;
+ struct authhandle *firstauth;
+@@ -518,10 +520,21 @@ main (int argc, char **argv)
+ _hurd_port_set (&_hurd_ports[INIT_PORT_PROC], proc);
+ _hurd_proc_init (argv, NULL, 0);
+
++ startup = file_name_lookup (_SERVERS_STARTUP, 0, 0);
++ if (! MACH_PORT_VALID (startup))
++ {
++ error (0, errno, "%s", _SERVERS_STARTUP);
++ /* Fall back to using the bootstrap port as before. */
++ startup = boot;
++ }
++
+ /* Init knows intimately that we will be ready for messages
+ as soon as this returns. */
+- startup_essential_task (boot, mach_task_self (), MACH_PORT_NULL, "auth",
++ startup_essential_task (startup, mach_task_self (), MACH_PORT_NULL, "auth",
+ hostpriv);
++
++ if (startup != boot)
++ mach_port_deallocate (mach_task_self (), startup);
+ mach_port_deallocate (mach_task_self (), boot);
+ mach_port_deallocate (mach_task_self (), hostpriv);
+
+--
+2.1.4
+
diff --git a/debian/patches/0005-XXX-proc-call-startup_essential_task-earlier.patch b/debian/patches/0005-XXX-proc-call-startup_essential_task-earlier.patch
new file mode 100644
index 00000000..bf32b383
--- /dev/null
+++ b/debian/patches/0005-XXX-proc-call-startup_essential_task-earlier.patch
@@ -0,0 +1,174 @@
+From 9a149942641d1ff82dc3fcabff82194340873caa Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Wed, 7 Jan 2015 16:05:48 +0100
+Subject: [PATCH hurd 5/5] XXX proc: call `startup_essential_task' earlier
+
+XXX
+
+* proc/main.c (main): Try to lookup `/servers/startup' and send the
+message here, or...
+* proc/msg.c (S_proc_setmsgport): ... fall back to the old way here.
+* proc/proc.h (startup_fallback): New variable.
+* startup/startup.c (main): Move code installing ourself on /servers/startup
+(install_as_translator): ... here.
+(launch_core_servers): And use it here, just before we reply to `/hurd/auth'.
+---
+ proc/main.c | 23 +++++++++++++++++++++++
+ proc/msg.c | 2 +-
+ proc/proc.h | 2 ++
+ startup/startup.c | 44 ++++++++++++++++++++++++++++++++------------
+ 4 files changed, 58 insertions(+), 13 deletions(-)
+
+diff --git a/proc/main.c b/proc/main.c
+index b4288fb..6df4141 100644
+--- a/proc/main.c
++++ b/proc/main.c
+@@ -22,6 +22,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ #include <mach.h>
+ #include <hurd/hurd_types.h>
+ #include <hurd.h>
++#include <hurd/paths.h>
+ #include <hurd/startup.h>
+ #include <device/device.h>
+ #include <assert.h>
+@@ -62,6 +63,7 @@ message_demuxer (mach_msg_header_t *inp,
+ }
+
+ pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
++int startup_fallback;
+
+ error_t
+ increase_priority (void)
+@@ -99,6 +101,7 @@ main (int argc, char **argv, char **envp)
+ error_t err;
+ void *genport;
+ process_t startup_port;
++ mach_port_t startup;
+ struct argp argp = { 0, 0, 0, "Hurd process server" };
+
+ argp_parse (&argp, argc, argv, 0, 0, 0);
+@@ -173,6 +176,26 @@ main (int argc, char **argv, char **envp)
+ mach_port_deallocate (mach_task_self (), cons);
+ }
+
++ startup = file_name_lookup (_SERVERS_STARTUP, 0, 0);
++ if (MACH_PORT_VALID (startup))
++ {
++ err = startup_essential_task (startup, mach_task_self (),
++ MACH_PORT_NULL, "proc", _hurd_host_priv);
++ if (err)
++ /* Due to the single-threaded nature of /hurd/startup, it can
++ only handle requests once the core server bootstrap has
++ completed. Therefore, it does not bind itself to
++ /servers/startup until it is ready. */
++ /* Fall back to abusing the message port lookup. */
++ startup_fallback = 1;
++
++ err = mach_port_deallocate (mach_task_self (), startup);
++ assert_perror (err);
++ }
++ else
++ /* Fall back to abusing the message port lookup. */
++ startup_fallback = 1;
++
+ while (1)
+ ports_manage_port_operations_multithread (proc_bucket,
+ message_demuxer,
+diff --git a/proc/msg.c b/proc/msg.c
+index 796cae3..c7bab99 100644
+--- a/proc/msg.c
++++ b/proc/msg.c
+@@ -63,7 +63,7 @@ S_proc_setmsgport (struct proc *p,
+ prociterate (check_message_return, p);
+ p->p_checkmsghangs = 0;
+
+- if (p == startup_proc)
++ if (p == startup_proc && startup_fallback)
+ {
+ /* Init is single threaded, so we can't delay our reply for
+ the essential task RPC; spawn a thread to do it. */
+diff --git a/proc/proc.h b/proc/proc.h
+index a056d18..4be1de4 100644
+--- a/proc/proc.h
++++ b/proc/proc.h
+@@ -151,6 +151,8 @@ mach_port_t generic_port; /* messages not related to a specific proc */
+
+ pthread_mutex_t global_lock;
+
++extern int startup_fallback; /* (ab)use /hurd/startup's message port */
++
+ /* Forward declarations */
+ void complete_wait (struct proc *, int);
+ int check_uid (struct proc *, uid_t);
+diff --git a/startup/startup.c b/startup/startup.c
+index a9373f1..9906606 100644
+--- a/startup/startup.c
++++ b/startup/startup.c
+@@ -514,6 +514,32 @@ demuxer (mach_msg_header_t *inp,
+ startup_server (inp, outp));
+ }
+
++error_t
++install_as_translator (void)
++{
++ error_t err;
++ file_t node;
++
++ node = file_name_lookup (_SERVERS_STARTUP, O_NOTRANS, 0);
++ if (! MACH_PORT_VALID (node))
++ {
++ if (errno == ENOENT)
++ {
++ /* Degrade gracefully if the node does not exist. */
++ error (0, errno, "%s", _SERVERS_STARTUP);
++ return 0;
++ }
++ return errno;
++ }
++
++ err = file_set_translator (node,
++ 0, FS_TRANS_SET, 0,
++ NULL, 0,
++ startup, MACH_MSG_TYPE_COPY_SEND);
++ mach_port_deallocate (mach_task_self (), node);
++ return err;
++}
++
+ static int
+ parse_opt (int key, char *arg, struct argp_state *state)
+ {
+@@ -587,18 +613,6 @@ main (int argc, char **argv, char **envp)
+ /* Crash if the boot filesystem task dies. */
+ request_dead_name (fstask);
+
+- file_t node = file_name_lookup (_SERVERS_STARTUP, O_NOTRANS, 0);
+- if (node == MACH_PORT_NULL)
+- error (0, errno, "%s", _SERVERS_STARTUP);
+- else
+- {
+- file_set_translator (node,
+- 0, FS_TRANS_SET, 0,
+- NULL, 0,
+- startup, MACH_MSG_TYPE_COPY_SEND);
+- mach_port_deallocate (mach_task_self (), node);
+- }
+-
+ /* Set up the set of ports we will pass to the programs we exec. */
+ for (i = 0; i < INIT_PORT_MAX; i++)
+ switch (i)
+@@ -672,6 +686,12 @@ launch_core_servers (void)
+ proc_task2proc (procserver, authtask, &authproc);
+ proc_mark_important (authproc);
+ proc_mark_exec (authproc);
++
++ err = install_as_translator ();
++ if (err)
++ /* Good luck. Who knows, maybe it's an old installation. */
++ error (0, err, "Failed to bind to " _SERVERS_STARTUP);
++
+ startup_authinit_reply (authreply, authreplytype, 0, authproc,
+ MACH_MSG_TYPE_COPY_SEND);
+ mach_port_deallocate (mach_task_self (), authproc);
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index bde0ea07..8b8e4cb2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -47,3 +47,8 @@ libports-payloads.patch
proc-task-notify-0005-proc-fix-build.patch
merge-me-0001-libports-avoid-acquiring-global-lock-in-message-disp.patch
merge-me-0002-startup-faster-reboots.patch
+0001-libports-silence-pointless-error-message.patch
+0002-startup-give-the-tasks-we-create-a-name.patch
+0003-auth-simplify-expression.patch
+0004-auth-remove-implicit-assumption-about-the-bootstrap-.patch
+0005-XXX-proc-call-startup_essential_task-earlier.patch