summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 17:09:48 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-09-27 17:09:48 +0200
commit35bddcc8d68a040208b07dab416a90c4277d0f99 (patch)
treec3e2dfa809dcc1c08a818f996e90b4949bfb3f15
parentd56344db3911e2035649cc3c7051a4c33d5a0ecd (diff)
add patch series
-rw-r--r--debian/patches/random-fixes0001-libdiskfs-improve-error-handling.patch39
-rw-r--r--debian/patches/random-fixes0002-libdiskfs-fflush-stdout-when-pausing.patch25
-rw-r--r--debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch81
-rw-r--r--debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch151
-rw-r--r--debian/patches/random-fixes0005-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch127
-rw-r--r--debian/patches/series5
6 files changed, 428 insertions, 0 deletions
diff --git a/debian/patches/random-fixes0001-libdiskfs-improve-error-handling.patch b/debian/patches/random-fixes0001-libdiskfs-improve-error-handling.patch
new file mode 100644
index 00000000..5accefa1
--- /dev/null
+++ b/debian/patches/random-fixes0001-libdiskfs-improve-error-handling.patch
@@ -0,0 +1,39 @@
+From 9f179b1ab674355d5afbb6d664dee2d2ac6cb89c Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 16:20:17 +0200
+Subject: [PATCH hurd 1/5] libdiskfs: improve error handling
+
+* libdiskfs/boot-start.c (start_execserver): Improve error handling.
+---
+ libdiskfs/boot-start.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c
+index d10d783..6b829f2 100644
+--- a/libdiskfs/boot-start.c
++++ b/libdiskfs/boot-start.c
+@@ -637,15 +637,18 @@ start_execserver (void)
+ assert_perror (err);
+ right = ports_get_send_right (execboot_info);
+ ports_port_deref (execboot_info);
+- task_set_special_port (diskfs_exec_server_task, TASK_BOOTSTRAP_PORT, right);
+- mach_port_deallocate (mach_task_self (), right);
++ err = task_set_special_port (diskfs_exec_server_task, TASK_BOOTSTRAP_PORT, right);
++ assert_perror (err);
++ err = mach_port_deallocate (mach_task_self (), right);
++ assert_perror (err);
+
+ if (_diskfs_boot_pause)
+ {
+ printf ("pausing for exec\n");
+ getc (stdin);
+ }
+- task_resume (diskfs_exec_server_task);
++ err = task_resume (diskfs_exec_server_task);
++ assert_perror (err);
+
+ printf (" exec");
+ fflush (stdout);
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0002-libdiskfs-fflush-stdout-when-pausing.patch b/debian/patches/random-fixes0002-libdiskfs-fflush-stdout-when-pausing.patch
new file mode 100644
index 00000000..623c38c0
--- /dev/null
+++ b/debian/patches/random-fixes0002-libdiskfs-fflush-stdout-when-pausing.patch
@@ -0,0 +1,25 @@
+From 9e8cb4acfd8971f691b35657e1f63a903f638996 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 16:20:50 +0200
+Subject: [PATCH hurd 2/5] libdiskfs: fflush stdout when pausing
+
+* libdiskfs/boot-start.c (start_execserver): fflush stdout when pausing.
+---
+ libdiskfs/boot-start.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c
+index 6b829f2..809e2c0 100644
+--- a/libdiskfs/boot-start.c
++++ b/libdiskfs/boot-start.c
+@@ -645,6 +645,7 @@ start_execserver (void)
+ if (_diskfs_boot_pause)
+ {
+ printf ("pausing for exec\n");
++ fflush (stdout);
+ getc (stdin);
+ }
+ err = task_resume (diskfs_exec_server_task);
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch b/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
new file mode 100644
index 00000000..d183ee01
--- /dev/null
+++ b/debian/patches/random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
@@ -0,0 +1,81 @@
+From 5696878928905536f571c1945fa75568f9fe3b86 Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 17:01:37 +0200
+Subject: [PATCH hurd 3/5] pflocal: convert to trivfs dynamic classes and
+ buckets
+
+libtrivfs contains two ways of managing more than one port class and
+bucket. There is the old way of using a statically allocated array
+with explicit length, and the new way with dynamically allocated
+vectors.
+
+Converting all users to the new way of handling multiple classes
+and/or buckets, we can simplify the code in libtrivfs. In many cases,
+the code will be simpler and more expressive for the user.
+
+This also fixes a mild bug. The classes and buckets given to
+`trivfs_startup' end up in the dynamic vectors too, making the object
+lookup code use the more complicated code path.
+
+* pflocal/pflocal.c: Convert to dynamic classes and buckets.
+---
+ pflocal/pflocal.c | 20 ++++----------------
+ 1 file changed, 4 insertions(+), 16 deletions(-)
+
+diff --git a/pflocal/pflocal.c b/pflocal/pflocal.c
+index fcb62d1..07d1a97 100644
+--- a/pflocal/pflocal.c
++++ b/pflocal/pflocal.c
+@@ -38,12 +38,6 @@ int trivfs_support_read = 0;
+ int trivfs_support_write = 0;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = 0;
+-
+-/* Trivfs noise. */
+-struct port_class *trivfs_protid_portclasses[1];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 1;
+-int trivfs_cntl_nportclasses = 1;
+
+ /* ---------------------------------------------------------------- */
+ #include "socket_S.h"
+@@ -70,6 +64,7 @@ main(int argc, char *argv[])
+ {
+ error_t err;
+ mach_port_t bootstrap;
++ struct trivfs_control *fsys;
+
+ if (argc > 1)
+ {
+@@ -81,25 +76,18 @@ main(int argc, char *argv[])
+ if (bootstrap == MACH_PORT_NULL)
+ error(2, 0, "Must be started as a translator");
+
+- pf_port_bucket = ports_create_bucket ();
+-
+- trivfs_cntl_portclasses[0] = ports_create_class (trivfs_clean_cntl, 0);
+- trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0);
+-
+ /* Prepare to create sockets. */
+ err = sock_global_init ();
+ if (err)
+ error(3, err, "Initializing");
+
+ /* Reply to our parent */
+- err =
+- trivfs_startup (bootstrap, 0,
+- trivfs_cntl_portclasses[0], pf_port_bucket,
+- trivfs_protid_portclasses[0], pf_port_bucket,
+- NULL);
++ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);
+ if (err)
+ error(3, err, "Contacting parent");
+
++ pf_port_bucket = fsys->pi.bucket;
++
+ /* Launch. */
+ do
+ ports_manage_port_operations_multithread (pf_port_bucket,
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch b/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
new file mode 100644
index 00000000..72ff923c
--- /dev/null
+++ b/debian/patches/random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
@@ -0,0 +1,151 @@
+From 9eefc0037273f0ca560368acd7d60ac154a27e8e Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 17:07:18 +0200
+Subject: [PATCH hurd 4/5] trans/crash: convert to trivfs dynamic classes and
+ buckets
+
+libtrivfs contains two ways of managing more than one port class and
+bucket. There is the old way of using a statically allocated array
+with explicit length, and the new way with dynamically allocated
+vectors.
+
+Converting all users to the new way of handling multiple classes
+and/or buckets, we can simplify the code in libtrivfs. In many cases,
+the code will be simpler and more expressive for the user.
+
+This also fixes a mild bug. The classes and buckets given to
+`trivfs_startup' end up in the dynamic vectors too, making the object
+lookup code use the more complicated code path.
+
+* trans/crash.c: Convert to dynamic classes and buckets.
+---
+ trans/crash.c | 50 ++++++++++++++++++++++++++++----------------------
+ 1 file changed, 28 insertions(+), 22 deletions(-)
+
+diff --git a/trans/crash.c b/trans/crash.c
+index c424b16..1661d4c 100644
+--- a/trans/crash.c
++++ b/trans/crash.c
+@@ -44,6 +44,10 @@ process_t procserver; /* Our proc port, for easy access. */
+ /* Port bucket we service requests on. */
+ struct port_bucket *port_bucket;
+
++/* Our port classes. */
++struct port_class *trivfs_control_class;
++struct port_class *trivfs_protid_class;
++
+ /* Trivfs hooks. */
+ int trivfs_fstype = FSTYPE_MISC;
+ int trivfs_fsid = 0;
+@@ -52,11 +56,6 @@ int trivfs_support_write = 0;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = O_READ|O_WRITE|O_EXEC;
+
+-struct port_class *trivfs_protid_portclasses[1];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 1;
+-int trivfs_cntl_nportclasses = 1;
+-
+ struct trivfs_control *fsys;
+
+ enum crash_action
+@@ -156,7 +155,7 @@ S_crash_dump_task (mach_port_t port,
+ mach_port_t user_proc = MACH_PORT_NULL;
+ enum crash_action how;
+
+- cred = ports_lookup_port (port_bucket, port, trivfs_protid_portclasses[0]);
++ cred = ports_lookup_port (port_bucket, port, trivfs_protid_class);
+ if (! cred)
+ return EOPNOTSUPP;
+
+@@ -415,11 +414,11 @@ dead_crasher (void *ptr)
+ /* The port data structures are cleaned up when we return. */
+
+ /* See if we are going away and this was the last thing keeping us up. */
+- if (ports_count_class (trivfs_cntl_portclasses[0]) == 0)
++ if (ports_count_class (trivfs_control_class) == 0)
+ {
+ /* We have no fsys control port, so we are detached from the
+ parent filesystem. Maybe we have no users left either. */
+- if (ports_count_class (trivfs_protid_portclasses[0]) == 0)
++ if (ports_count_class (trivfs_protid_class) == 0)
+ {
+ /* We have no user ports left. Maybe we have no crashers still
+ around either. */
+@@ -428,9 +427,9 @@ dead_crasher (void *ptr)
+ exit (0);
+ ports_enable_class (crasher_portclass);
+ }
+- ports_enable_class (trivfs_protid_portclasses[0]);
++ ports_enable_class (trivfs_protid_class);
+ }
+- ports_enable_class (trivfs_cntl_portclasses[0]);
++ ports_enable_class (trivfs_control_class);
+ }
+
+
+@@ -563,20 +562,27 @@ main (int argc, char **argv)
+ /* Fetch our proc server port for easy use. */
+ procserver = getproc ();
+
+- port_bucket = ports_create_bucket ();
+- trivfs_cntl_portclasses[0] = ports_create_class (trivfs_clean_cntl, 0);
+- trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0);
+ crasher_portclass = ports_create_class (dead_crasher, 0);
+
++ err = trivfs_add_control_port_class (&trivfs_control_class);
++ if (err)
++ error (1, 0, "error creating control port class");
++
++ err = trivfs_add_protid_port_class (&trivfs_protid_class);
++ if (err)
++ error (1, 0, "error creating control protid class");
++
+ /* Reply to our parent. */
+ err = trivfs_startup (bootstrap, 0,
+- trivfs_cntl_portclasses[0], port_bucket,
+- trivfs_protid_portclasses[0], port_bucket,
+- &fsys);
++ trivfs_control_class, NULL,
++ trivfs_protid_class, NULL, &fsys);
++
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (3, err, "Contacting parent");
+
++ port_bucket = fsys->pi.bucket;
++
+ /* Launch. */
+ do
+ ports_manage_port_operations_multithread (port_bucket, crash_demuxer,
+@@ -602,11 +608,11 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
+ int count;
+
+ /* Stop new requests. */
+- ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_inhibit_class_rpcs (trivfs_control_class);
++ ports_inhibit_class_rpcs (trivfs_protid_class);
+
+ /* Are there any extant user ports for the /servers/crash file? */
+- count = ports_count_class (trivfs_protid_portclasses[0]);
++ count = ports_count_class (trivfs_protid_class);
+ if (count == 0 || (flags & FSYS_GOAWAY_FORCE))
+ {
+ /* No users. Disconnect from the filesystem. */
+@@ -629,9 +635,9 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
+ else
+ {
+ /* We won't go away, so start things going again... */
+- ports_enable_class (trivfs_protid_portclasses[0]);
+- ports_resume_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_resume_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_enable_class (trivfs_protid_class);
++ ports_resume_class_rpcs (trivfs_control_class);
++ ports_resume_class_rpcs (trivfs_protid_class);
+
+ return EBUSY;
+ }
+--
+2.1.4
+
diff --git a/debian/patches/random-fixes0005-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch b/debian/patches/random-fixes0005-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch
new file mode 100644
index 00000000..bdd146f7
--- /dev/null
+++ b/debian/patches/random-fixes0005-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch
@@ -0,0 +1,127 @@
+From 9698d8e468723b0f1eca90be5d094db5c22af14b Mon Sep 17 00:00:00 2001
+From: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Sun, 27 Sep 2015 16:26:03 +0200
+Subject: [PATCH hurd 5/5] trans/passwd: convert to trivfs dynamic classes and
+ buckets
+
+libtrivfs contains two ways of managing more than one port class and
+bucket. There is the old way of using a statically allocated array
+with explicit length, and the new way with dynamically allocated
+vectors.
+
+Converting all users to the new way of handling multiple classes
+and/or buckets, we can simplify the code in libtrivfs. In many cases,
+the code will be simpler and more expressive for the user.
+
+This also fixes a mild bug. The classes and buckets given to
+`trivfs_startup' end up in the dynamic vectors too, making the object
+lookup code use the more complicated code path.
+
+* trans/password.c: Convert to dynamic classes and buckets.
+---
+ trans/password.c | 47 ++++++++++++++++++++++++++---------------------
+ 1 file changed, 26 insertions(+), 21 deletions(-)
+
+diff --git a/trans/password.c b/trans/password.c
+index 344b78b..4fa9535 100644
+--- a/trans/password.c
++++ b/trans/password.c
+@@ -39,6 +39,10 @@ const char *argp_program_version = STANDARD_HURD_VERSION (password);
+ /* Port bucket we service requests on. */
+ struct port_bucket *port_bucket;
+
++/* Our port classes. */
++struct port_class *trivfs_control_class;
++struct port_class *trivfs_protid_class;
++
+ /* Trivfs hooks. */
+ int trivfs_fstype = FSTYPE_MISC;
+ int trivfs_fsid = 0;
+@@ -46,12 +50,6 @@ int trivfs_support_read = 0;
+ int trivfs_support_write = 0;
+ int trivfs_support_exec = 0;
+ int trivfs_allow_open = 0;
+-
+-struct port_class *trivfs_protid_portclasses[1];
+-struct port_class *trivfs_cntl_portclasses[1];
+-int trivfs_protid_nportclasses = 1;
+-int trivfs_cntl_nportclasses = 1;
+-
+
+ static int
+ password_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
+@@ -75,15 +73,22 @@ main (int argc, char *argv[])
+ if (bootstrap == MACH_PORT_NULL)
+ error (1, 0, "must be started as a translator");
+
+- port_bucket = ports_create_bucket ();
+- trivfs_cntl_portclasses[0] = ports_create_class (trivfs_clean_cntl, 0);
+- trivfs_protid_portclasses[0] = ports_create_class (trivfs_clean_protid, 0);
+-
++ err = trivfs_add_port_bucket (&port_bucket);
++ if (err)
++ error (1, 0, "error creating port bucket");
++
++ err = trivfs_add_control_port_class (&trivfs_control_class);
++ if (err)
++ error (1, 0, "error creating control port class");
++
++ err = trivfs_add_protid_port_class (&trivfs_protid_class);
++ if (err)
++ error (1, 0, "error creating control protid class");
++
+ /* Reply to our parent. */
+ err = trivfs_startup (bootstrap, 0,
+- trivfs_cntl_portclasses[0], port_bucket,
+- trivfs_protid_portclasses[0], port_bucket,
+- &fsys);
++ trivfs_control_class, port_bucket,
++ trivfs_protid_class, port_bucket, &fsys);
+ mach_port_deallocate (mach_task_self (), bootstrap);
+ if (err)
+ error (3, err, "Contacting parent");
+@@ -114,17 +119,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
+ int count;
+
+ /* Stop new requests. */
+- ports_inhibit_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_inhibit_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_inhibit_class_rpcs (trivfs_control_class);
++ ports_inhibit_class_rpcs (trivfs_protid_class);
+
+ /* Are there any extant user ports for the /servers/password file? */
+- count = ports_count_class (trivfs_protid_portclasses[0]);
++ count = ports_count_class (trivfs_protid_class);
+ if (count > 0 && !(flags & FSYS_GOAWAY_FORCE))
+ {
+ /* We won't go away, so start things going again... */
+- ports_enable_class (trivfs_protid_portclasses[0]);
+- ports_resume_class_rpcs (trivfs_cntl_portclasses[0]);
+- ports_resume_class_rpcs (trivfs_protid_portclasses[0]);
++ ports_enable_class (trivfs_protid_class);
++ ports_resume_class_rpcs (trivfs_control_class);
++ ports_resume_class_rpcs (trivfs_protid_class);
+
+ return EBUSY;
+ }
+@@ -153,7 +158,7 @@ S_password_check_user (struct trivfs_protid *cred, uid_t user, char *pw,
+ return EOPNOTSUPP;
+
+ if (cred->pi.bucket != port_bucket ||
+- cred->pi.class != trivfs_protid_portclasses[0])
++ cred->pi.class != trivfs_protid_class)
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+@@ -201,7 +206,7 @@ S_password_check_group (struct trivfs_protid *cred, uid_t group, char *pw,
+ return EOPNOTSUPP;
+
+ if (cred->pi.bucket != port_bucket ||
+- cred->pi.class != trivfs_protid_portclasses[0])
++ cred->pi.class != trivfs_protid_class)
+ {
+ ports_port_deref (cred);
+ return EOPNOTSUPP;
+--
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 68dfa6ca..373a021e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -75,3 +75,8 @@ introspection0009-fixup_libports.patch
introspection0010-fixup_libintrospection.patch
introspection0011-fixup_libintrospection.patch
introspection0012-fixup_libintrospection.patch
+random-fixes0001-libdiskfs-improve-error-handling.patch
+random-fixes0002-libdiskfs-fflush-stdout-when-pausing.patch
+random-fixes0003-pflocal-convert-to-trivfs-dynamic-classes-and-bucket.patch
+random-fixes0004-trans-crash-convert-to-trivfs-dynamic-classes-and-bu.patch
+random-fixes0005-trans-passwd-convert-to-trivfs-dynamic-classes-and-b.patch